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_tipekelas(){ $q = "SELECT * FROM tipekelas ORDER BY kdtipekelas"; $this->rhlib->jsonFromQueryWLimit($q); } function insert_tipekelas(){ $dataArray = $this->getFieldsAndValues(); $ret = $this->rhlib->insertRecord('tipekelas',$dataArray); //$this->rhlib->insertRecordPublic('tipekelas',$dataArray); return $ret; } function update_tipekelas(){ $fieldsAndValues = $this->getFieldsAndValues(); //UPDATE //$where['idtipekelas'] = $_POST['idtipekelas']; $this->db->where('idtipekelas', $_POST['idtipekelas']); $this->db->update('tipekelas', $fieldsAndValues); if($this->db->affected_rows()){ $ret["success"]=true; $ret["msg"]='Update Data Berhasil'; //$this->rhlib->updateRecordPublic('jslta',$fieldsAndValues,$where); }else{ $ret["success"]=false; $ret["msg"]= 'Update Data Gagal'; } return $ret; } function delete_tipekelas(){ $where['idtipekelas'] = $_POST['idtipekelas']; $ret = $this->rhlib->deleteRecord('tipekelas',$where); //$this->rhlib->deleteRecordPublic('tipekelas',$where); return $ret; } function getFieldsAndValues(){ $dataArray = array( //'idtipekelas'=> $_POST['idtipekelas'], 'kdtipekelas'=> $_POST['kdtipekelas'], 'nmtipekelas'=> $_POST['nmtipekelas'] ); return $dataArray; } } ?>