function show_edit_prems_tpl($id) { $this->load->model('dx_auth/permissions', 'permissions'); $permissions = $this->permissions->get_permission_data($id); $all_perms = $this->get_permissions_table(); // Explode all perms to groups by prefix $groups = array(); foreach ($all_perms as $k => $v) { $tmp = explode('_', $k); $groups[$tmp[0]][$k] = $v; } foreach ($groups as $key => $row) { $count[$key] = count($row); } array_multisort($count, SORT_ASC, $groups); $this->db->select("shop_rbac_roles.*", FALSE); $this->db->select("shop_rbac_roles_i18n.alt_name", FALSE); $this->db->where('locale', BaseAdminController::getCurrentLocale()); $this->db->join("shop_rbac_roles_i18n", "shop_rbac_roles_i18n.id = shop_rbac_roles.id"); $role = $this->db->get('shop_rbac_roles')->result_array(); $this->template->add_array(array('selected_role' => $id, 'roles' => $role, 'all_perms' => $all_perms, 'permissions' => $permissions, 'groups' => $groups, 'group_names' => $this->get_group_names())); }