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_pendidikanortu(){ $q = "SELECT * FROM pendidikanortu ORDER BY kdpendidikanortu"; $this->rhlib->jsonFromQueryWLimit($q); } function insert_pendidikanortu(){ $dataArray = $this->getFieldsAndValues(); $ret = $this->rhlib->insertRecord('pendidikanortu',$dataArray); $this->rhlib->insertRecordPublic('pendidikanortu',$dataArray); return $ret; } function update_pendidikanortu(){ $fieldsAndValues = $this->getFieldsAndValues(); //UPDATE $where['idpendidikanortu'] = $_POST['idpendidikanortu']; $this->db->where('idpendidikanortu', $_POST['idpendidikanortu']); $this->db->update('pendidikanortu', $fieldsAndValues); if($this->db->affected_rows()){ $ret["success"]=true; $ret["msg"]='Update Data Berhasil'; $this->rhlib->updateRecordPublic('pendidikanortu',$fieldsAndValues,$where); }else{ $ret["success"]=false; $ret["msg"]= 'Update Data Gagal'; } return $ret; } function delete_pendidikanortu(){ $where['idpendidikanortu'] = $_POST['idpendidikanortu']; $ret = $this->rhlib->deleteRecord('pendidikanortu',$where); $this->rhlib->deleteRecordPublic('pendidikanortu',$where); return $ret; } function getFieldsAndValues(){ $dataArray = array( 'kdpendidikanortu'=> $_POST['kdpendidikanortu'], 'nmpendidikanortu'=> $_POST['nmpendidikanortu'], 'deskripsi'=> $_POST['deskripsi'] ); return $dataArray; } } ?>