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_stabsensidos(){ $q = "SELECT * FROM stabsensidos ORDER BY kdstabsensidos"; $this->rhlib->jsonFromQueryWLimit($q); } function insert_stabsensidos(){ $dataArray = $this->getFieldsAndValues(); $ret = $this->rhlib->insertRecord('stabsensidos',$dataArray); return $ret; } function update_stabsensidos(){ $fieldsAndValues = $this->getFieldsAndValues(); //UPDATE $this->db->where('idstabsensdos', $_POST['idstabsensdos']); $this->db->update('stabsensidos', $fieldsAndValues); 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_stabsensidos(){ $where['idstabsensdos'] = $_POST['idstabsensdos']; $ret = $this->rhlib->deleteRecord('stabsensidos',$where); return $ret; } function getFieldsAndValues(){ $dataArray = array( 'kdstabsensidos'=> $_POST['kdstabsensidos'], 'nmstabsensidos'=> $_POST['nmstabsensidos'], 'deskripsi'=> $_POST['deskripsi'] ); return $dataArray; } } ?>