本文整理汇总了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;
示例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;
}