load->library('session'); } function lookup_mhs_aktif(){ $start = $this->input->post("start"); $limit = $this->input->post("limit"); $fields = $this->input->post("fields"); $query = $this->input->post("query"); $kdprodi = $this->input->post("kdprodi"); $kdstsemester = $this->input->post("thnakademik"); $id = $this->input->post("idnya"); $keywordnya = $this->input->post("keyword"); $this->db->select("*"); $this->db->from("v_pesertasidang"); if($fields!="" || $query !=""){ $k=array('[',']','"'); $r=str_replace($k, '', $fields); $b=explode(',', $r); $c=count($b); for($i=0;$i<$c;$i++){ $d[$b[$i]]=$query; } $this->db->or_like($d, $query); } if ($id == 'NPM'){ $this->db->like('nim', $keywordnya); }else if ($id== 'Nama Mahasiswa'){ $this->db->like('nmmhs', $keywordnya); }else if ($id == '(L/P)'){ $this->db->like('kdjnskelamin', $keywordnya); }else if ($id == 'Tgl. Lahir'){ $this->db->like('tgllahir', $keywordnya); }else if ($id == 'Status Awal Masuk'){ $this->db->like('nmstawalmhs', $keywordnya); }else if ($id == 'Angkatan'){ $this->db->like('thnmasuk', $keywordnya); }else if ($id == 'Status Aktivitas'){ $this->db->like('nmstaktivitasmhs', $keywordnya); } if($kdprodi != ''){ $where['kdprodi'] = $kdprodi; $where['total_syaratsidang'] = 0; } if($kdstsemester != ''){ $where['kdstsemester'] = $kdstsemester; $where['total_syaratsidang'] = 0; } // $where['total_syaratsidang'] = 0; //if($kdprodi !='' || $kdstsemester !=''){ $this->db->where($where); //} if ($start!=null){ $this->db->limit($limit,$start); }else{ $this->db->limit(50,0); } $q = $this->db->get(); // $q = $this->db->get(); $data = array(); if ($q->num_rows() > 0) { $data = $q->result(); } $datax = count($data); $ttl = $datax; //====================================================================== $build_array = array ("success"=>true,"results"=>$ttl,"data"=>array()); foreach($data as $row) { array_push($build_array["data"],array( 'nim'=>$row->nim, 'nmmhs'=>$row->nmmhs, 'kdjnskelamin'=>$row->kdjnskelamin, 'tgllahir'=>$row->tgllahir, 'nmstawalmhs'=>$row->nmstawalmhs, 'thnmasuk'=>$row->thnmasuk, 'nmstaktivitasmhs'=>$row->nmstaktivitasmhs, )); } echo json_encode($build_array); } function lookup_mhs_lulus(){ $start = $this->input->post("start"); $limit = $this->input->post("limit"); $fields = $this->input->post("fields"); $query = $this->input->post("query"); $kdprodi = $this->input->post("kdprodi"); $kdstsemester = $this->input->post("thnakademik"); $id = $this->input->post("idnya"); $keywordnya = $this->input->post("keyword"); $this->db->select("*"); $this->db->from("v_mhs_lulus"); if($fields!="" || $query !=""){ $k=array('[',']','"'); $r=str_replace($k, '', $fields); $b=explode(',', $r); $c=count($b); for($i=0;$i<$c;$i++){ $d[$b[$i]]=$query; } $this->db->or_like($d, $query); } $where = array(); if ($id == 'NIM'){ $this->db->like('nim', $keywordnya); }else if ($id== 'Nama Mahasiswa'){ $this->db->like('nmmhs', $keywordnya); }else if ($id == '(L/P)'){ $this->db->like('kdjnskelamin', $keywordnya); }else if ($id == 'Tgl. Lahir'){ $this->db->like('tgllahir', $keywordnya); }else if ($id == 'Angkatan'){ $this->db->like('thnmasuk', $keywordnya); }else if ($id == 'Jenis Kelas'){ $this->db->like('nmklsmhs', $keywordnya); }else if ($id == 'No. SKL'){ $this->db->like('noskl', $keywordnya); }else if ($id == 'Tgl. SKL'){ $this->db->like('tglskl', $keywordnya); }else if ($id == 'Tgl. Pengesahan'){ $this->db->like('tglpengesahanskl', $keywordnya); }else if ($id == 'Rektor/Pimpinan'){ $this->db->like('nmpimpinan', $keywordnya); } if($kdprodi != ''){ $where['kdprodi'] = $kdprodi; } if($kdstsemester != ''){ $where['kdstsemester'] = $kdstsemester; } //if($kdprodi !='' || $kdstsemester !=''){ $this->db->where($where); //} if ($start!=null){ $this->db->limit($limit,$start); }else{ $this->db->limit(50,0); } $q = $this->db->get(); // $q = $this->db->get(); $data = array(); if ($q->num_rows() > 0) { $data = $q->result(); } $datax = count($data); $ttl = $datax; //====================================================================== $build_array = array ("success"=>true,"results"=>$ttl,"data"=>array()); foreach($data as $row) { array_push($build_array["data"],array( 'nim'=>$row->nim, 'nmmhs'=>$row->nmmhs, 'kdjnskelamin'=>$row->kdjnskelamin, 'tgllahir'=>$row->tgllahir, 'thnmasuk'=>$row->thnmasuk, 'nmklsmhs'=>$row->nmklsmhs, 'noskl'=>$row->noskl, 'tglskl'=>$row->tglskl, 'tglpengesahanskl'=>$row->tglpengesahanskl, 'nmpimpinan'=>$row->nmpimpinan, )); } echo json_encode($build_array); } function simpan_lulus(){ // ISTRA $data=$this->input->post("selectmhs"); $this->db->trans_begin(); $rows = explode(";",$data); $row_count = count($rows); for($ri=0;$ri<$row_count;$ri++){ $rows2 = explode("x",$rows[$ri]); // $row_count2 = count($rows2); // $x=0; // for($rd=$x;$rd<=$row_count2;$rd++){ $this->db->query("CALL SP_simpan_lulus (?,?,?)",array($rows2[0],$rows2[1],$rows2[2])); // } } if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); $return["success"]=false; $return["message"]="Ubah Data gagal"; } else { $this->db->trans_commit(); $return["success"]=true; $return["message"]="Ubah Data Berhasil"; } return $return; } function update_lulus(){ // ISTRA $nimnya=$this->input->post("nim"); $nosklnya=$this->input->post("noskl"); $tglsklnya=$this->input->post("tglskl"); $tglsahnya=$this->input->post("tglsah"); $pimpinnya=$this->input->post("pimpin"); $data = array( 'noskl'=> $nosklnya, 'tgllulus'=> (!$tglsklnya) ? null:$tglsklnya, 'tglskl'=> (!$tglsklnya) ? null:$tglsklnya, 'tglpengesahanskl'=> (!$tglsahnya) ? null:$tglsahnya, 'idpimpinan1'=> (!$pimpinnya) ? null:$this->id_field('idpimpinan', 'pimpinan', 'nmpimpinan',$pimpinnya) ); $this->db->trans_begin(); $where['nim']=$nimnya; $this->db->where($where); $this->db->update("mahasiswa", $data); if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); $return["success"]=false; $return["message"]="Ubah Data gagal"; } else { $this->db->trans_commit(); $return["success"]=true; $return["message"]="Ubah Data Berhasil"; } return $return; } function batal_lulus(){ // ISTRA $nim=$this->input->post("nim"); $kdstsemester=$this->input->post("kdstsemester"); $this->db->trans_begin(); $this->db->query("CALL SP_batal_lulus (?,?)",array($nim,$kdstsemester)); if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); $return["success"]=false; $return["message"]="Ubah Data gagal"; } else { $this->db->trans_commit(); $return["success"]=true; $return["message"]="Ubah Data Berhasil"; } return $return; } function id_field($column,$tbl,$whereb, $wherea){ $q = "SELECT ".$column." as id FROM ".$tbl." where ".$whereb." = '".$wherea."' " ; $query = $this->db->query($q); $id = ''; if ($query->num_rows() != 0) { $row = $query->row(); $id=$row->id; } return $id; } } ?>