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_jskripsi(){ $q = "SELECT * FROM jskripsi ORDER BY kdjskripsi"; $this->rhlib->jsonFromQueryWLimit($q); } function insert_jskripsi(){ $dataArray = $this->getFieldsAndValues(); $ret = $this->rhlib->insertRecord('jskripsi',$dataArray); return $ret; } function update_jskripsi(){ $fieldsAndValues = $this->getFieldsAndValues(); //UPDATE $this->db->where('kdjskripsi', $_POST['kdjskripsi']); $this->db->update('jskripsi', $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_jskripsi(){ $where['kdjskripsi'] = $_POST['kdjskripsi']; $ret = $this->rhlib->deleteRecord('jskripsi',$where); return $ret; } function getFieldsAndValues(){ $dataArray = array( 'kdjskripsi'=> $_POST['kdjskripsi'], 'nmjskripsi'=> $_POST['nmjskripsi'], ); return $dataArray; } } ?>