ceklog(); $this->load->library('session'); $this->load->library('rhlib'); } function ceklog() { $user = $this->session->userdata("usernameunlaprivate"); if($user==""){ redirect('auth/login'); } } function retValOrNull($val){ //especially for combo & looukup with no item selected $val = ($val=='')? null : $val; return $val; } function get_srtpernyataan(){ $kdprodi = $_POST['kdprodi']; $kdstsemester = $_POST['kdstsemester']; $q = "SELECT * FROM v_srtpernyataan WHERE kdprodi='".$kdprodi."' AND kdstsemester='".$kdstsemester."'"; $this->rhlib->jsonFromQueryWLimit($q); } function insert_srtpernyataan(){ $dataArray = $this->getFieldsAndValues(); $ret = $this->rhlib->insertRecord('srtpernyataan',$dataArray); return $ret; } function update_srtpernyataan(){ $dataArray = $this->getFieldsAndValues(); //UPDATE $this->db->where('idsrtpernyataan', $_POST['idsrtpernyataan']); $this->db->update('srtpernyataan', $dataArray); 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_srtpernyataan(){ $where['idsrtpernyataan'] = $_POST['idsrtpernyataan']; $ret = $this->rhlib->deleteRecord('srtpernyataan',$where); return $ret; } function getFieldsAndValues(){ $dataArray = array( //'idsrtpindahmhs'=> $_POST['idsrtpindahmhs'], 'tglpermohonan'=> $_POST['tglpermohonan'], 'kdstsemester' => $_POST['kdstsemester'], 'idsemester'=> $_POST['idsemester'], 'nim'=> $_POST['nim'], 'nmortu'=> $_POST['nmortu'] ? $_POST['nmortu'] : null, 'alamatortu'=> $_POST['alamatortu'] ? $_POST['alamatortu'] : null, 'idpekerjaanortu'=> $_POST['idpekerjaanortu'] ? $_POST['idpekerjaanortu'] : null, 'idjnsbiaya' => $_POST['idjnsbiaya'] ? $_POST['idjnsbiaya'] : null, 'idstsetuju' => $_POST['idstsetuju'], 'idpimpinan' => $_POST['idpimpinan'], 'tglpelunasan' => $_POST['tglpelunasan'], 'tglpersetujuan' => ($_POST['tglpersetujuan']) ? $_POST['tglpersetujuan'] : null, 'biayakuliah' => $_POST['biayakuliah'], 'sisabiaya' => $_POST['sisabiaya'], ); return $dataArray; } function setbiaya(){ $kode = $_POST['kdprodi']; $q = "SELECT * from setbiaya where kdprodi='".$kode."'"; $query = $this->db->query($q); $id= ''; $by= ''; if ($query->num_rows() != 0) { $row = $query->row(); $id=$row->idsetbiaya; $by=$row->biaya; } echo '{"idsetbiaya":"'.$id.'","biaya":"'.$by.'"}'; } }