function permission() { $this->system->add_breadcrumb('Data group', '_cpanel/admin/user/groups'); $this->system->add_breadcrumb('Edit permission'); $groupId = (int) $_GET['id']; $allresources = $this->adodb->GetAll("SELECT id,name FROM sys_resources"); $r_resources = array(); foreach ((array) $allresources as $sources) { $r_resources[$sources['id']] = $sources['name']; } $arrRule = array(); if (isset($_POST['change_permission'])) { $post_allow = $_POST['allow']; foreach ((array) $post_allow as $id => $allow) { $is_allow = $allow == 1 ? TRUE : FALSE; $permission_name = $r_resources[$id]; $this->permissions->set_permission_value($groupId, $permission_name, $is_allow); } $data['msg'] = "<div class=\"message success-msg\">Permission berhasil disimpan</div>"; } $permission_data = $this->permissions->get_permission_data($groupId); $this->load->config('cpanel'); $data['resources'] = array_resources(); $data['permission'] = $permission_data; $data['group_id'] = $groupId; $data['module'] = '_cpanel'; $data['page'] = 'layout_permission'; $this->load->view($this->layout_content, $data); }
function edit() { $this->system->add_breadcrumb('Data resources', '_cpanel/admin/resources/data'); $this->system->add_breadcrumb('Edit resources'); $id = (int) $_GET['id']; $edit = $this->adodb->GetROw("SELECT * FROM sys_resources WHERE id = {$id} LIMIT 1"); $data['edit'] = $edit; $data['resources'] = array_resources(); $data['module'] = "_cpanel"; $data['page'] = "layout_edit_resources"; $this->load->view($this->layout_content, $data); }