ceklog(); $this->load->library('session'); $this->load->library('rhlib'); } function ceklog() { $user = $this->session->userdata("usernameunlaprivate"); if($user==""){ redirect('auth/login'); } } function retValOrNull($val){ //especially for combo & looukup with no item selected $val = ($val=='')? null : $val; return $val; } function get_srtpindahan(){ $kdprodi = $_POST['kdprodi']; $kdstsemester = $_POST['kdstsemester']; $q = "SELECT * FROM v_srtpindahmhs WHERE kdprodi='".$kdprodi."' AND kdstsemester='".$kdstsemester."'"; $this->rhlib->jsonFromQueryWLimit($q); } function insert_srtpindahan(){ $dataArray = $this->getFieldsAndValues(); $ret = $this->rhlib->insertRecord('srtpindahmhs',$dataArray); return $ret; } function update_srtpindahan(){ $dataArray = $this->getFieldsAndValues(); //UPDATE $this->db->where('idsrtpindahmhs', $_POST['idsrtpindahmhs']); $this->db->update('srtpindahmhs', $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; } function delete_srtpindahan(){ $where['idsrtpindahmhs'] = $_POST['idsrtpindahmhs']; $ret = $this->rhlib->deleteRecord('srtpindahmhs',$where); return $ret; } function getFieldsAndValues(){ $dataArray = array( //'idsrtpindahmhs'=> $_POST['idsrtpindahmhs'], 'nosrtpindahmhs'=> $_POST['nosrtpindahmhs'], 'tglpermohonan'=> $_POST['tglpermohonan'], 'kdstsemester' => $_POST['kdstsemester'], 'tglpersetujuan'=> ($_POST['tglpersetujuan']) ? $_POST['tglpersetujuan'] : null, 'nim'=> $_POST['nim'], 'idstakreditasi'=> $_POST['idstakreditasi'], 'idstsetuju' => $_POST['idstsetuju'], 'kdptitbpti' => $_POST['kdptitbpti'], 'idkopertis' => $_POST['idkopertis'], 'idpimpinan' => $_POST['idpimpinan'], ); return $dataArray; } }