public function __construct($params) { $CI =& get_instance(); $CI->load->library('session'); //if($CI->session->userdata('groupname')=='SA') { if (is_super_admin()) { $this->create = TRUE; $this->read = TRUE; $this->update = TRUE; $this->delete = TRUE; $this->exec = TRUE; $this->upload = TRUE; } else { //if(!$CI->session->userdata('groupid')=='') { $qry = "select gm.reads, gm.writes, gm.deletes, gm.inserts \r\n\t\t\t\t\t\tfrom group_modules gm\r\n\t\t\t\t\t\tinner join modules m on m.id=gm.module_id\r\n\t\t\t\t\t\twhere 1=1\r\n\t\t\t\t\t\tand gm.group_id=" . sipkd_group_id() . "\r\n\t\t\t\t\t\t--and gm.module_id=1\t\r\n\t\t\t\t\t\tand m.kode='" . $params['module'] . "'\r\n\t\t\t\t\t\tand m.app_id=" . sipkd_app_id() . "; "; $auth = $CI->db->query($qry); if ($auth->num_rows() !== 0) { $auth1 = $auth->row(); $this->create = $auth1->inserts == 1 ? TRUE : FALSE; $this->read = $auth1->reads == 1 ? TRUE : FALSE; $this->update = $auth1->writes == 1 ? TRUE : FALSE; $this->delete = $auth1->deletes == 1 ? TRUE : FALSE; //$this->exec = ($auth1->execute ==1 ? TRUE : FALSE); //$this->upload = ($auth1->upload ==1 ? TRUE : FALSE); } //} } }
function update_stat() { $userid = $this->uri->segment(4); $ppat_id = $this->uri->segment(5); $val = $this->uri->segment(6); if ($val == 0) { if ($uid == sipkd_user_id() && $gid == sipkd_group_id()) { // ga bisa } else { $this->db->where('userid', $userid); $this->db->where('ppat_id', $ppat_id); $this->db->delete('bphtb_user'); } } else { $data = array('userid' => $userid, 'ppat_id' => $ppat_id); $this->db->insert('bphtb_user', $data); } }