load->library('session'); } function nm_field($column,$tbl,$whereb, $wherea){ $q = "SELECT ".$column." as nm FROM ".$tbl." where ".$whereb." = '".$wherea."' " ; $query = $this->db->query($q); $nm= ''; if ($query->num_rows() != 0) { $row = $query->row(); $nm=$row->nm; } return $nm; } function grid(){ //ISTRA $kdstsemester = $this->input->post("kdstsemester"); $nim = $this->input->post("nim"); $KEDUA= $this->load->database('second', TRUE); $where= array(); if($kdstsemester !=''){ $where['kdstsemester']=$kdstsemester; } if($nim !=''){ $where['nim']=$nim; } $KEDUA->select('*'); $KEDUA->from('v_nilai_semester'); $KEDUA->where($where); $q = $KEDUA->get(); $data = array(); if ($q->num_rows() > 0) { $data = $q->result(); } $ttl = count($data); $build_array = array ("success"=>true,"results"=>$ttl,"data"=>array()); foreach($data as $row) { array_push($build_array["data"],array( 'kdmk'=>$row->kdmk, 'nmmk'=>$row->nmmkind, 'jmlsks'=>$row->jmlsks, 'nilaihuruf'=>$row->nilaihuruf, 'bobotnilai'=>$row->bobotnilai, 'mutu'=>$row->mutu,//$row->nmmkind, 'sm'=>(floatval($row->jmlsks) * floatval($row->mutu)),//$row->nmmkind, 'dsnpengampu'=>$row->nmdosdgngelar, )); } echo json_encode($build_array); } function form_mhs(){ //ISTRA $KEDUA= $this->load->database('second', TRUE); /*membuka koneksi database untuk d_mahasiswa*/ // $nama = $this->input->post("nama"); $userid = $this->input->post("userid"); $KEDUA->select("*"); $KEDUA->from("vv_mahasiswa_profile2"); if($userid!=''){ $where['nim']=$userid; $KEDUA->where($where); } $q = $KEDUA->get(); if ($q->num_rows() > 0) { $row = $q->row(); $nim=$row->nim; $nmmhs=$row->nmmhs; $nmfakultas=$row->nmfakultas; $nmprodi=$row->nmprodi; $kdprodi=$row->kdprodi; $idklsmhs=$row->idklsmhs; $tahunmsk=$row->thnmasuk; //in beda $persen='-';//'100', $stbayar='-'; $foto=$row->foto; $idjnssemester=$row->idjnssemester; $kdstsemester=$this->input->post("kdstsemester"); $kdthnakademik=$row->kdthnakademik.' '.$row->nmjnssemester; //$nmstaktivitasmhs=$row->nmstaktivitasmhs; } else { $nim="-"; $nmmhs="-"; $nmfakultas="-"; $nmprodi="-"; $kdprodi="-"; $idklsmhs="-"; $tahunmsk="-"; $persen="-"; $stbayar="-"; $foto="-"; $idjnssemester="-"; $kdstsemester="-"; $kdthnakademik="-"; } $countkhs = $this->count_khs($nim,$kdstsemester); $countkuisioner = $this->count_kuisioner($nim,$kdstsemester); echo '{"nim":"'.$nim.'","nmmhs":"'.$nmmhs.'","nmfakultas":"'.$nmfakultas.'","nmprodi":"'.$nmprodi .'","kdprodi":"'.$kdprodi.'","idklsmhs":"'.$idklsmhs.'","tahunmsk":"'.$tahunmsk.'","persen":"'.$persen .'","stbayar":"'.$stbayar.'","foto":"'.$foto.'","idjnssemester":"'.$idjnssemester .'","kdstsemester":"'.$kdstsemester.'","kdthnakademik":"'.$kdthnakademik .'","countkhs":"'.$countkhs.'","countkuisioner":"'.$countkuisioner.'"}'; } function count_khs($nim,$kdstsemester){ $KEDUA= $this->load->database('second', TRUE); $q =$KEDUA->query("SELECT * FROM nilai WHERE nim = '".$nim."' AND kdstsemester = '".$kdstsemester."' AND idstsetuju=1"); return $q->num_rows(); } function count_kuisioner($nim,$kdstsemester){ $KEDUA= $this->load->database('second', TRUE); $q =$KEDUA->query("SELECT * FROM kuisionerdet WHERE nim = '".$nim."' AND kdstsemester = '".$kdstsemester."' group by kdmk"); return $q->num_rows(); } function kelengkapan(){ $KEDUA= $this->load->database('second', TRUE); $nim = $this->input->post("nim"); $kdprodi = $this->input->post("kdprodi"); $idklsmhs = $this->input->post("idklsmhs"); $tahunmsk = $this->input->post("tahunmsk"); $kdstsemester = $this->input->post("kdstsemester"); $q = "SELECT getkelengkapan('".$nim."','".$kdprodi."','".$idklsmhs."','".$tahunmsk."','".$kdstsemester."') as nm;"; $query = $KEDUA->query($q); $nm= ''; if ($query->num_rows() > 0) { $row = $query->row(); $nm=$row->nm; } echo $nm; } }