当前位置: 首页>>代码示例>>PHP>>正文


PHP auth_admin::display_role_mask方法代码示例

本文整理汇总了PHP中auth_admin::display_role_mask方法的典型用法代码示例。如果您正苦于以下问题:PHP auth_admin::display_role_mask方法的具体用法?PHP auth_admin::display_role_mask怎么用?PHP auth_admin::display_role_mask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在auth_admin的用法示例。


在下文中一共展示了auth_admin::display_role_mask方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: main


//.........这里部分代码省略.........
                // no break;
            // no break;
            case 'edit':
                if ($action == 'edit') {
                    if (!$role_id) {
                        trigger_error($user->lang['NO_ROLE_SELECTED'] . page_back_link($this->u_action), E_USER_WARNING);
                    }
                    $sql = 'SELECT *
						FROM ' . ACL_ROLES_TABLE . '
						WHERE role_id = ' . $role_id;
                    $result = $db->sql_query($sql);
                    $role_row = $db->sql_fetchrow($result);
                    $db->sql_freeresult($result);
                    $sql = 'SELECT p.auth_option_id, p.auth_setting, o.auth_option
						FROM ' . ACL_ROLES_DATA_TABLE . ' p, ' . ACL_OPTIONS_TABLE . ' o
						WHERE o.auth_option_id = p.auth_option_id
							AND p.role_id = ' . $role_id . '
						ORDER BY p.auth_option_id';
                    $result = $db->sql_query($sql);
                    $auth_options = array();
                    while ($row = $db->sql_fetchrow($result)) {
                        $auth_options[$row['auth_option']] = $row['auth_setting'];
                    }
                    $db->sql_freeresult($result);
                }
                if (!$role_row) {
                    trigger_error($user->lang['NO_ROLE_SELECTED'] . page_back_link($this->u_action), E_USER_WARNING);
                }
                $template->assign_vars(array('S_EDIT' => true, 'U_ACTION' => $this->u_action . "&paction={$action}&role_id={$role_id}", 'U_BACK' => $this->u_action, 'ROLE_NAME' => $role_row['role_name'], 'ROLE_DESCRIPTION' => $role_row['role_description'], 'L_ACL_TYPE' => $user->lang['ACL_TYPE_' . strtoupper($permission_type)]));
                // We need to fill the auth options array with ACL_NO options ;)
                $sql = 'SELECT auth_option_id, auth_option
					FROM ' . ACL_OPTIONS_TABLE . "\n\t\t\t\t\tWHERE auth_option " . $db->sql_like_expression($permission_type . $db->any_char) . "\n\t\t\t\t\t\tAND auth_option <> '{$permission_type}'\n\t\t\t\t\tORDER BY auth_option_id";
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    if (!isset($auth_options[$row['auth_option']])) {
                        $auth_options[$row['auth_option']] = ACL_NO;
                    }
                }
                $db->sql_freeresult($result);
                // Unset global permission option
                unset($auth_options[$permission_type]);
                // Display auth options
                $this->display_auth_options($auth_options);
                // Get users/groups/forums using this preset...
                if ($action == 'edit') {
                    $hold_ary = $auth_admin->get_role_mask($role_id);
                    if (sizeof($hold_ary)) {
                        $role_name = !empty($user->lang[$role_row['role_name']]) ? $user->lang[$role_row['role_name']] : $role_row['role_name'];
                        $template->assign_vars(array('S_DISPLAY_ROLE_MASK' => true, 'L_ROLE_ASSIGNED_TO' => sprintf($user->lang['ROLE_ASSIGNED_TO'], $role_name)));
                        $auth_admin->display_role_mask($hold_ary);
                    }
                }
                return;
                break;
            case 'move_up':
            case 'move_down':
                $order = request_var('order', 0);
                $order_total = $order * 2 + ($action == 'move_up' ? -1 : 1);
                $sql = 'UPDATE ' . ACL_ROLES_TABLE . '
					SET role_order = ' . $order_total . " - role_order\n\t\t\t\t\tWHERE role_type = '" . $db->sql_escape($permission_type) . "'\n\t\t\t\t\t\tAND role_order IN ({$order}, " . ($action == 'move_up' ? $order - 1 : $order + 1) . ')';
                $db->sql_query($sql);
                break;
        }
        // By default, check that role_order is valid and fix it if necessary
        $sql = 'SELECT role_id, role_order
			FROM ' . ACL_ROLES_TABLE . "\n\t\t\tWHERE role_type = '" . $db->sql_escape($permission_type) . "'\n\t\t\tORDER BY role_order ASC";
        $result = $db->sql_query($sql);
        if ($row = $db->sql_fetchrow($result)) {
            $order = 0;
            do {
                $order++;
                if ($row['role_order'] != $order) {
                    $db->sql_query('UPDATE ' . ACL_ROLES_TABLE . " SET role_order = {$order} WHERE role_id = {$row['role_id']}");
                }
            } while ($row = $db->sql_fetchrow($result));
        }
        $db->sql_freeresult($result);
        // Display assigned items?
        $display_item = request_var('display_item', 0);
        // Select existing roles
        $sql = 'SELECT *
			FROM ' . ACL_ROLES_TABLE . "\n\t\t\tWHERE role_type = '" . $db->sql_escape($permission_type) . "'\n\t\t\tORDER BY role_order ASC";
        $result = $db->sql_query($sql);
        $s_role_options = '';
        while ($row = $db->sql_fetchrow($result)) {
            $role_name = !empty($user->lang[$row['role_name']]) ? $user->lang[$row['role_name']] : $row['role_name'];
            $template->assign_block_vars('roles', array('ROLE_NAME' => $role_name, 'ROLE_DESCRIPTION' => !empty($user->lang[$row['role_description']]) ? $user->lang[$row['role_description']] : nl2br($row['role_description']), 'U_EDIT' => $this->u_action . '&amp;paction=edit&amp;role_id=' . $row['role_id'], 'U_REMOVE' => $this->u_action . '&amp;paction=remove&amp;role_id=' . $row['role_id'], 'U_MOVE_UP' => $this->u_action . '&amp;paction=move_up&amp;order=' . $row['role_order'], 'U_MOVE_DOWN' => $this->u_action . '&amp;paction=move_down&amp;order=' . $row['role_order'], 'U_DISPLAY_ITEMS' => $row['role_id'] == $display_item ? '' : $this->u_action . '&amp;display_item=' . $row['role_id'] . '#assigned_to'));
            $s_role_options .= '<option value="' . $row['role_id'] . '">' . $role_name . '</option>';
            if ($display_item == $row['role_id']) {
                $template->assign_vars(array('L_ROLE_ASSIGNED_TO' => sprintf($user->lang['ROLE_ASSIGNED_TO'], $role_name)));
            }
        }
        $db->sql_freeresult($result);
        $template->assign_vars(array('S_ROLE_OPTIONS' => $s_role_options));
        if ($display_item) {
            $template->assign_vars(array('S_DISPLAY_ROLE_MASK' => true));
            $hold_ary = $auth_admin->get_role_mask($display_item);
            $auth_admin->display_role_mask($hold_ary);
        }
    }
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:101,代码来源:class_cms_permissions_roles.php


注:本文中的auth_admin::display_role_mask方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。