db->where($where,$value); $query=$this->db->get($table); return $query->result(); } function getSelectByid($select,$where,$value,$table){ $this->db->select($select); $this->db->where($where,$value); $query=$this->db->get($table); return $query->result(); } function getWithoutid($where,$value,$table){ // $this->db->where($where,$value); // $query=$this->db->get($table); $q="SELECT * from ".$table." where ".$where." != '".$value."'"; $query = $this->db->query($q); $data = array(); if ($query->num_rows() > 0) { $data = $query->result(); } return $data; } function last_login($nopmb, $data){ $where = "nopmb = '$nopmb'"; $this->db->where($where); $this->db->update("pmb", $data); return $nopmb; /*if($this->db->update("pmb", $data)) { return $nopmb; } else { return FALSE; }*/ } function getAll($table,$order,$desasc) { if($order != ""){ $this->db->order_by($order,$desasc); } if($table=="halaman"){ $this->db->where('idstpublish !=', 0) ; } $query = $this->db->get($table);//'soppmb'); if ($query->num_rows() > 0) { return $query->result(); } else { return array(); } } function getfPageById($tabel, $num, $offset,$where,$value) { $this->db->where($where,$value); $data = $this->db->get($tabel, $num, $offset); return $data->result(); } function getfPage($tabel, $num, $offset) { $data = $this->db->get($tabel, $num, $offset); return $data->result(); } function login_pmb($nopmb,$pass){ $cond = array( 'nopmb' => $this->anti_xss($nopmb, TRUE), 'password' => $this->anti_xss($pass, TRUE) ); $query = $this->db->get_where('v_pmb', $cond); $data = array(); if($query->num_rows() > 0){ $data = $query->result(); } return $data; } function getjadwalpmb($nopmb){ $q = "SELECT getjadwalpmb('".$this->anti_xss($nopmb, TRUE)."') as jdwl;"; $query = $this->db->query($q); $data = array(); if ($query->num_rows() > 0) { $data = $query->result(); } return $data; } function periksausm(){ $q = "SELECT * FROM v_periksausm WHERE nopmb = '".$this->my_usessionpmb->userdata('nopmbunla')."'"; $query = $this->db->query($q); $data = array(); if($query->num_rows() > 0){ $data = $query->result(); } return $data; } function caridata(){ // keperluan e-jurnal $c = $this->input->POST ('nama'); $this->db->like('nmjnsjurnal', $c); $this->db->or_like('issn', $c); $this->db->or_like('judul', $c); $this->db->or_like('penulis', $c); $data = $this->db->get ('v_jurnalpublish'); return $data->result(); } function update_download($kdjurnal,$userid){ // keperluan e-jurnal $download; $query = $this->db->query('SELECT download FROM jurnal WHERE kdjurnal ="'.$kdjurnal.'"'); foreach ($query->result() as $row){ $download = $row->download; } $updownload = $download + 1; $data = array( 'download'=>$updownload, ); $where['kdjurnal']=$kdjurnal; $this->db->where($where); $this->db->update("jurnal", $data); $this->simpandownload($kdjurnal,$userid); } function id_field($column,$tbl,$whereb, $wherea){ // keperluan e-jurnal $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; } function simpandownload($kdjurnal,$userid){ // keperluan e-jurnal $user=$this->id_field('userid', 'pengguna', 'nmlengkap',$userid); $this->db->query("CALL SP_simpan_jurnal_download (?,?)", array( $userid, $kdjurnal, )); } function simpanpesan(){ $date = date("Y-m-d H:i:s"); $ip = $_SERVER['REMOTE_ADDR']; $nmcom = gethostbyaddr($_SERVER['REMOTE_ADDR']); $data = array( 'nama'=>$this->input->POST('nama'), 'email'=>$this->input->POST('email'), 'tlp'=>$this->input->POST('tlp'), 'pesanmsk'=>$this->input->POST('pesan'), 'status'=>"Belum", 'tglpsnmsk'=>$date, 'ipaddresspengirim'=>$ip, 'nmkompengirim'=>$nmcom, ); $this->db->insert('hubkamiinbox', $data); } /* function kerjasama(){ /* $this->db->like('nmjnsjurnal', $c); $this->db->or_like('issn', $c); $this->db->or_like('judul', $c); $this->db->or_like('penulis', $c); $data = $this->db->get ('v_jurnalpublish'); return $data->result(); $this->db->select("*"); $this->db->from("halaman"); $this->db->where("idhalaman = 27 AND kdhalaman = 27"); $q = "SELECT * FROM menuweb WHERE idmenuweb = '33'"; $data=$this->db->query($q); return $data->result(); } */ function jsonFromQueryWLimitPrivate($q){ $KEDUA= $this->load->database('second', TRUE); $start = $_POST['start']; $limit = $_POST['limit']; if ($start==null){ $start = 0; $limit = 50; } $data = array(); $build_array = array ("success"=>false,"results"=>-1,"data"=>array()); $strQuery = $this->getStrQueryWSearch($q); $query1 = $KEDUA->query($strQuery); //query all rows if ($query1->num_rows() == 0){ $build_array["success"]=true; $build_array["results"]= 0; } if ($query1->num_rows() > 0) { $total = $query1->num_rows(); // total data $strQuery .=" LIMIT ".$start.", ".$limit; // query dengan limit $query2 = $KEDUA->query($strQuery); $data = $query2->result(); $build_array["success"]=true; $build_array["results"]=$total; //$build_array["count"]=count($data); $build_array["data"]=$data; } echo json_encode($build_array); } function get_staffFak_byId($id){ $KEDUA = $this->load->database('second', TRUE); $q = "SELECT `d`.`nidu` AS `nidu` , `d`.`nmdosdgngelar` AS `nmdosdgngelar` , `d`.`tptlahir` AS `tptlahir` , `d`.`tgllahir` AS `tgllahir` , `d`.`kdjnskelamin` AS `kdjnskelamin` , `d`.`foto` AS `foto` , `d`.`notelp` AS `notelp` , `d`.`email` AS `email` , `d`.`facebook` AS `facebook` , `d`.`twitter` AS `twitter` , `d`.`website` AS `website` , `f`.`nmfakultas` AS `nmfakultas` , `pd`.`nmprodi` AS `nmprodi` , `j`.`nmjabatan` AS `nmjabatan` , concat(`pt`.`nmkodtbkod`, '/ ', `pt`.`nmdata`) AS `nmpendidikan` , `jb`.`nmkodtbkod` AS `nmjabatankampus` FROM ((((((`dosen` `d` LEFT JOIN `pimpinan` `p` ON ((`p`.`nip` = `d`.`nidu`))) LEFT JOIN `prodi` `pd` ON ((`pd`.`kdprodi` = `d`.`kdprodi`))) LEFT JOIN `fakultas` `f` ON ((`f`.`kdfakultas` = `p`.`kdfakultas`))) LEFT JOIN `jabatan` `j` ON ((`j`.`idjabatan` = `p`.`jabatan`))) LEFT JOIN `tbkod` `pt` ON (((`pt`.`kdkodtbkod` = `d`.`kdpendidikantertinggi`) AND (`pt`.`kdapltbkod` = '01')))) LEFT JOIN `tbkod` `jb` ON (((`jb`.`kdkodtbkod` = `d`.`kdjabakademik`) AND (`jb`.`kdapltbkod` = '02')))) WHERE p.kdfakultas='".$id."' ORDER BY p.jabatan"; $query = $KEDUA->query($q); $data = array(); if($query->num_rows() > 0){ $data = $query->result(); } return $data; } function get_kelompok_byId($id){ $KEDUA= $this->load->database('second', TRUE); $sql = "SELECT m.idmhs , m.no_klp_mpl , m.nim , m.nmmhs , m.tptlahir , m.tgllahir , m.kdjnskelamin , m.kdstawalmhs , k.nmklsmhs , p.nmprodi FROM mahasiswa AS m JOIN prodi AS p ON p.kdprodi = m.kdprodi JOIN klsmhs AS k ON k.idklsmhs = m.idklsmhs WHERE (m.thnmasuk = '2019' or m.no_klp_asal = '2019') and m.nim ='".$id."' ORDER BY m.nim"; $query = $KEDUA->query($sql); return $query; } function get_kelompok_byNoklp($id){ $KEDUA= $this->load->database('second', TRUE); $sql = "SELECT m.idmhs , m.no_klp_mpl , m.nim , m.nmmhs , m.tptlahir , m.tgllahir , m.kdjnskelamin , m.kdstawalmhs , k.nmklsmhs , p.nmprodi FROM mahasiswa AS m JOIN prodi AS p ON p.kdprodi = m.kdprodi JOIN klsmhs AS k ON k.idklsmhs = m.idklsmhs WHERE (m.thnmasuk = '2019' or m.no_klp_asal = '2019') and m.no_klp_mpl ='".$id."' ORDER BY m.nim"; $query = $KEDUA->query($sql); return $query; } function get_staffProd_byId($id){ $KEDUA= $this->load->database('second', TRUE); $q = "SELECT `d`.`nidu` AS `nidu` , `d`.`nidn` AS `nidn` , `d`.`nmdosdgngelar` AS `nmdosdgngelar` , `d`.`tptlahir` AS `tptlahir` , `d`.`tgllahir` AS `tgllahir` , `d`.`kdjnskelamin` AS `kdjnskelamin` , `d`.`foto` AS `foto` , `d`.`notelp` AS `notelp` , `d`.`email` AS `email` , `d`.`facebook` AS `facebook` , `d`.`twitter` AS `twitter` , `d`.`website` AS `website` , concat(`pd`.`nmprodi`,' ',`s`.`nmkodtbkod`) AS `nmprodi` , concat(`pt`.`nmkodtbkod`, '/ ', `pt`.`nmdata`) AS `nmpendidikan` -- , `jb`.`nmkodtbkod` AS `nmjabatankampus` , CASE WHEN pd.nidu = d.nidu THEN 'KETUA PROGRAM STUDI' WHEN pd.nidu <> d.nidu THEN `jb`.`nmkodtbkod` END AS `nmjabatankampus` FROM `dosen` `d` LEFT JOIN `prodi` `pd` ON `pd`.`kdprodi` = `d`.`kdprodi` LEFT JOIN `tbkod` `pt` ON `pt`.`kdkodtbkod` = `d`.`kdpendidikantertinggi` AND `pt`.`kdapltbkod` = '01' LEFT JOIN `tbkod` `jb` ON `jb`.`kdkodtbkod` = `d`.`kdjabakademik` AND `jb`.`kdapltbkod` = '02' LEFT JOIN `tbkod` `s` ON `s`.`kdkodtbkod` = `pd`.`kdjenjangstudi` AND `s`.`kdapltbkod` = '04' WHERE d.kdprodi='".$id."' ORDER BY pd.nidu ASC"; $query = $KEDUA->query($q); $data = array(); if($query->num_rows() > 0){ $data = $query->result(); } return $data; } function getdatafile(){ $c = $this->input->POST ('nama'); if ($c) { $this->db->like('juduluploadfile', $c); $this->db->or_like('deskripsi', $c); $this->db->or_like('fileupload', $c); } $data = $this->db->get ('v_uploadfile'); return $data->result(); } /* ALUMNI */ function get_drop_pekerjaan(){ $KETIGA = $this->load->database('third', TRUE); $q = 'SELECT id_pekerjaan, nama_pekerjaan FROM almn_pekerjaan ORDER BY id_pekerjaan asc'; $query = $KETIGA->query($q); $data = array(); if($query->num_rows() > 0){ $data = $query->result(); } return $data; } function get_drop_bidang(){ $KETIGA = $this->load->database('third', TRUE); $q = 'SELECT id_bidang_kerja, nama_bidang FROM almn_bidang ORDER BY id_bidang_kerja asc'; $query = $KETIGA->query($q); $data = array(); if($query->num_rows() > 0){ $data = $query->result(); } return $data; } function get_drop_instansi(){ $KETIGA = $this->load->database('third', TRUE); $q = 'SELECT id_instansi_kerja, nama_instansi FROM almn_instansi ORDER BY id_instansi_kerja asc'; $query = $KETIGA->query($q); $data = array(); if($query->num_rows() > 0){ $data = $query->result(); } return $data; } function save_daftar($data){ $this->db2 = $this->load->database('third', TRUE); //$q = 'INSERT INTO almn '.$data; $this->db2->insert('almn',$data); } function counter_rekrut(){ $query = $this->db->query('SELECT no FROM ref_counter_rekrut'); foreach ($query->result() as $row){ $counter = $row->no; } $upcounter = $counter + 1; $data = array( 'no'=>$upcounter ); $this->db->update("ref_counter_rekrut", $data); } function counter_pmb(){ $query = $this->db->query('SELECT no FROM ref_counter_pmb'); foreach ($query->result() as $row){ $counter = $row->no; } $upcounter = $counter + 1; $data = array( 'no'=>$upcounter ); $this->db->update("ref_counter_pmb", $data); } } ?>