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


PHP Roles::get_role_name方法代码示例

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


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

示例1: array

    $u_roles = Roles::get_user_roles($user_id, DB_FETCHMODE_ASSOC, array('type' => 'group', 'gid' => $group_id));
} else {
    // show network and user personal pages roles
    $g_roles = array();
    $u_roles = array();
    $net_roles = array();
    $g_roles = Roles::get_user_roles($user_id, DB_FETCHMODE_ASSOC, array('type' => 'group', 'gid' => $group_id));
    $u_roles = Roles::get_user_roles($user_id, DB_FETCHMODE_ASSOC, array('type' => 'user'));
    $net_roles = Roles::get_user_roles($user_id, DB_FETCHMODE_ASSOC, array('type' => 'network'));
    $u_roles = array_merge($u_roles, $net_roles);
    $u_roles = array_merge($u_roles, $g_roles);
}
foreach ($u_roles as $role) {
    $role_id = $role['role_id'];
    $role_type = $role['type'];
    $role_name = Roles::get_role_name($role_id);
    $role_tasks = Roles::get_tasks_of_role($role_id);
    $role_extra = unserialize($role['extra']);
    $role_info = array('role_id' => $role_id, 'name' => $role_name, 'type' => $role_type, 'extra' => $role_extra, 'tasks' => $role_tasks);
    $user_roles[$role_id] = $role_info;
    if ($role_id == $sel_role_id) {
        $selected_role = $role_info;
    }
}
?>

<form action="" class="inputrow" method="post" name="assign_role_form" id="assign_role_form">
  <input type="hidden" name="uid" id = "user_role_id" />
  <fieldset>
  <legend> <?php 
echo __('Edit/Assign Role for user: ') . $user->login_name;
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:31,代码来源:user_roles.php

示例2: array

                }
            }
            $extra['groups'] = $_groups;
        }
    }
    $user_roles = array();
    $role = new Roles();
    $_extra = serialize(array('user' => true, 'network' => true, 'groups' => array()));
    if (!empty($role_extra[$role_id])) {
        $_extra = serialize($role_extra[$role_id]);
    } else {
        if ($group_id) {
            $_extra = array('user' => false, 'network' => false, 'groups' => array($group_id));
            $_extra = serialize($_extra);
        }
    }
    $user_roles[] = array('role_id' => $role_id, 'extra' => $_extra);
    if ($_POST['roles_action'] == 'delete') {
        $role->delete_user_roles($uid, $user_roles, $group_id);
    } else {
        $role->assign_role_to_user($user_roles, $uid);
    }
    $names = array();
    $r_params = $group_id ? array('type' => 'group', 'gid' => $group_id) : null;
    $saved_roles = Roles::get_user_roles($uid, DB_FETCHMODE_OBJECT, $r_params);
    foreach ($saved_roles as $s_role) {
        $names[] = Roles::get_role_name($s_role->role_id);
    }
    $msg = implode("<br />", $names);
    echo $msg;
}
开发者ID:Cyberspace-Networks,项目名称:PeopleAggregator,代码行数:31,代码来源:assign_role.php


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