load->library('session'); $this->load->library('rhlib'); } function retValOrNull($val){ //especially for combo & looukup with no item selected $val = ($val=='')? null : $val; return $val; } function get_mhs_private($column,$where1,$where2){ $q = "SELECT ".$column." as col FROM mahasiswa WHERE ".$where1."='".$where2."'" ; $query = $this->db->query($q); $col = ''; if ($query->num_rows() != 0) { $row = $query->row(); $col=$row->col; } return $col; } function get_status_konversi($where1,$where2,$where3,$where4){ $q = "SELECT * FROM konversi WHERE ".$where1."='".$where2."' AND ".$where3."='".$where4."'" ; $query = $this->db->query($q); $count = $query->num_rows(); return $count; } /* function get_mhs_konversi(){ $KEDUA= $this->load->database('second', TRUE); $searchBy = ""; if(isset($_POST['key'])){ $key = $_POST['key']; if($key!=null && $key!=''){ $val = ""; if(isset($_POST['value'])) $val = $_POST['value']; $searchBy = " WHERE ".$key." like '%".$val."%'"; } } $q = $KEDUA->query("SELECT * FROM v_pendaftar_pindahan".$searchBy); $data = array(); if ($q->num_rows() > 0) { $data = $q->result(); } $ttl = count($data); $build_array = array ("success"=>true,"results"=>$ttl,"data"=>array()); foreach($data as $row) { $nim=$this->get_mhs_private('nim','nopmb',$row->nopmb); array_push($build_array["data"],array( 'nopmb'=>$row->nopmb, 'tglpmb'=>$row->tglpmb, 'nama'=>$row->nama, 'kdptasal'=>$row->kdptasal, 'nmptasal'=>$row->nmptasal, 'kdprodi'=>$row->kdprodi, 'nmprodi'=>$row->nmprodi, 'kdprodi1'=>$row->kdprodi1, 'nmprodi1'=>$row->nmprodi1, 'kdprodi2'=>$row->kdprodi2, 'nmprodi2'=>$row->nmprodi2, 'kdprodiasal'=>$row->kdprodiasal, 'nmprodiasal'=>$row->nmprodiasal, 'nim'=>$nim, 'thnmasuk'=>$this->get_mhs_private('thnmasuk','nopmb',$row->nopmb), 'statuskonversi'=>$this->get_status_konversi('nim',$nim,'nopmb',$row->nopmb), )); } echo json_encode($build_array); } */ function get_v_konversi(){ $kdprodi = $_POST['kdprodi']; $tahun = $_POST['tahun']; $q = "SELECT * FROM v_konversi where kdprodi='".$kdprodi."' and tahun='".$tahun."'"; $this->rhlib->jsonFromQueryWLimit($q); } function get_prodipilihan(){ //Program Studi lokal $kdprodi1= ($this->input->post("kdprodi1")) ? " AND a.kdprodi='".$this->input->post("kdprodi1")."'":""; $kdprodi2= ($this->input->post("kdprodi2")) ? " AND a.kdprodi='".$this->input->post("kdprodi2")."'":""; $q="SELECT a.kdprodi , ifnull( concat(ifnull(rtrim(a.nourutprodi), '-'), '. ', a.nmprodi, ' (', ifnull(a.nmjenjangstudi, '-'), ')') , nmprodi) AS lnmprodi , a.nidu , b.nmdosdgngelar FROM v_prodi a LEFT JOIN dosen b ON b.nidu=a.nidu WHERE a.nmprodi <> '-' AND a.kdjenjangstudi <> 'B' AND a.kdprodi IN (SELECT kdprodi FROM penggunaprodi WHERE userid = '".$this->my_usession->userdata('user_idunlaprivate')."') ".$kdprodi1.$kdprodi2." ORDER BY a.nourutprodi , a.kdprodi"; $this->rhlib->jsonFromQuery($q); } function get_lookup_mhs_pindahan(){ $q = "SELECT * FROM v_pendaftar_pindahan"; $this->rhlib->jsonFromQueryWLimit2($q); } function get_mhs_nim(){ $nopmb= $this->input->post("nopmb"); $q = "SELECT * FROM mahasiswa where nopmb='".$nopmb."'"; $query = $this->db->query($q); if ($query->num_rows() != 0) { $data = $query->row(); $row ["nim"] = $data->nim; $row ["nmmhs"] = $data->nmmhs; echo json_encode($row); } else { echo json_encode(null); } } function get_matkul_kurikulum(){ $idkn = $_POST['idkn']; $kdprodi = $_POST['kdprodi']; $thnmasuk = $_POST['thnmasuk']; $q = "SELECT a.* , b.nmmkind , concat('SEMESTER ', a.idsemester) AS idsemesternya , if(((SELECT concat(kdmk, '-', kdprodi) AS kdmkprodi FROM konversidet WHERE idkn='".$idkn."' AND kdmk = a.kdmk AND kdprodi = a.kdprodi) = concat(a.kdmk, '-', a.kdprodi)), 1, 0) AS pilihmk , (SELECT nmmkasal FROM konversidet WHERE idkn='".$idkn."' AND kdmk = a.kdmk AND kdprodi = a.kdprodi) as nmmkasal , (SELECT sksasal FROM konversidet WHERE idkn='".$idkn."' AND kdmk = a.kdmk AND kdprodi = a.kdprodi) as sksasal , (SELECT nilaiasal FROM konversidet WHERE idkn='".$idkn."' AND kdmk = a.kdmk AND kdprodi = a.kdprodi) as nilaiasal , (SELECT nilaidiakui FROM konversidet WHERE idkn='".$idkn."' AND kdmk = a.kdmk AND kdprodi = a.kdprodi) as nilaidiakui FROM kurikulum a LEFT JOIN matakuliah b ON b.kdmk=a.kdmk and b.kdprodi=a.kdprodi WHERE a.kdprodi='".$kdprodi."' and a.thnmasuk='".$thnmasuk."' ORDER BY a.idsemester, a.idkurikulum"; $this->rhlib->jsonFromQuery($q); } function batal_konversi(){ $dataArray = array( 'idstkonversi'=>$_POST['idstkonversi'], ); //UPDATE $this->db->where('idkn', $_POST['idkn']); $this->db->update('konversi', $dataArray); if($this->db->affected_rows()){ $ret["success"]=true; $ret["msg"]='Update Data Berhasil'; }else{ $ret["success"]=false; $ret["msg"]= 'Update Data Gagal'; } return $ret; } } ?>