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_pekerjaanortu(){ $q = "SELECT * FROM pekerjaanortu ORDER BY kdpekerjaanortu"; $this->rhlib->jsonFromQueryWLimit($q); } function insert_pekerjaanortu(){ $dataArray = $this->getFieldsAndValues(); $ret = $this->rhlib->insertRecord('pekerjaanortu',$dataArray); $this->rhlib->insertRecordPublic('pekerjaanortu',$dataArray); return $ret; } function update_pekerjaanortu(){ $fieldsAndValues = $this->getFieldsAndValues(); //UPDATE $where['idpekerjaanortu'] = $_POST['idpekerjaanortu']; $this->db->where('idpekerjaanortu', $_POST['idpekerjaanortu']); $this->db->update('pekerjaanortu', $fieldsAndValues); if($this->db->affected_rows()){ $ret["success"]=true; $ret["msg"]='Update Data Berhasil'; $this->rhlib->updateRecordPublic('pekerjaanortu',$fieldsAndValues,$where); }else{ $ret["success"]=false; $ret["msg"]= 'Update Data Gagal'; } return $ret; } function delete_pekerjaanortu(){ $where['idpekerjaanortu'] = $_POST['idpekerjaanortu']; $ret = $this->rhlib->deleteRecord('pekerjaanortu',$where); $this->rhlib->deleteRecordPublic('pekerjaanortu',$where); return $ret; } function getFieldsAndValues(){ $dataArray = array( 'kdpekerjaanortu'=> $_POST['kdpekerjaanortu'], 'nmpekerjaanortu'=> $_POST['nmpekerjaanortu'], 'deskripsi'=> $_POST['deskripsi'] ); return $dataArray; } } ?>