db->query("SELECT a.id_akun, o.nama_otoritas, a.userid, a.namauser FROM akun_unlasys as a JOIN otoritas as o ON o.id_otoritas = a.id_otoritas WHERE a.id_akun != 1 ORDER BY a.id_akun LIMIT $num OFFSET $offset"); return $query; } public function get_drop_otoritas(){ $query = $this->db->query('SELECT id_otoritas, nama_otoritas FROM otoritas ORDER BY id_otoritas asc')->result(); return $query; } function detail_akun($id_akun){ $query = $this->db->query("SELECT id_akun, userid, id_otoritas, passwd FROM akun_unlasys WHERE id_akun = '$id_akun' "); return $query; } function simpan_akun($data){ $this->db->insert('akun_unlasys', $data); } function update_akun($id, $data){ $this->db->where('id_akun', $id); $this->db->update('akun_unlasys', $data); } function delete_akun($id){ $this->db->where('id_akun',$id); $this->db->delete('akun_unlasys'); } /* otoritas akun */ function list_menu(){ $this->db->select("id_menu, kode_menu, nama_menu, parent_menu, url"); $this->db->from("menu"); $this->db->order_by("kode_menu", "ASC"); return $this->db->get()->result(); } function cek_menu_id($otoritas_id, $menu_id){ $sql = "SELECT COUNT(*) AS hasil FROM otoritas_menu WHERE id_otoritas='$otoritas_id' AND id_menu='$menu_id'"; $query = $this->db->query($sql)->result(); $hasil = ''; foreach ($query as $row){ $hasil = $row->hasil; } if ($hasil>0){ return "ADA"; }else{ return "KOSONG"; } } function cek_ubah($otoritas_id, $menu_id){ $sql = "SELECT ubah FROM otoritas_menu WHERE id_otoritas='$otoritas_id' AND id_menu='$menu_id'"; $query = $this->db->query($sql)->result(); $ubah = ''; foreach ($query as $row){ $ubah = $row->ubah; } if ($ubah=="T"){ return "ADA"; }else if($ubah=="F"){ return "KOSONG"; }else{ return "BELUM"; //--Jika belum di setting TRUE atau FALSE--// } } function cek_hapus($otoritas_id, $menu_id){ $sql = "SELECT hapus FROM otoritas_menu WHERE id_otoritas='$otoritas_id' AND id_menu='$menu_id'"; $query = $this->db->query($sql)->result(); $hapus = ''; foreach ($query as $row){ $hapus = $row->hapus; } if ($hapus=="T"){ return "ADA"; }else if($hapus=="F"){ return "KOSONG"; }else{ return "BELUM"; //--Jika belum di setting TRUE atau FALSE--// } } function simpan_otoritas_akun($data){ $this->db->insert("otoritas_menu", $data); } function delete_otoritas_akun($id_otoritas, $id_menu){ $this->db->where("id_otoritas", $id_otoritas) ->where("id_menu", $id_menu); $this->db->delete("otoritas_menu"); } function update_ubah_hapus($id_otoritas, $id_menu, $data){ $this->db->where("id_otoritas", $id_otoritas) ->where("id_menu", $id_menu) ->update("otoritas_menu", $data); } }