本文整理汇总了PHP中Roles::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Roles::getInstance方法的具体用法?PHP Roles::getInstance怎么用?PHP Roles::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Roles
的用法示例。
在下文中一共展示了Roles::getInstance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUserRankById
function setUserRankById($uid, $rid)
{
$ranko = $this->getUserRankById($uid);
//$ranko["rank"]
$rank = Roles::getInstance()->getRoleRankById($rid);
$user_role = $_SESSION["user"]['rid'];
$user_rank = getUserRoleRank();
if ($ranko["rank"] >= $user_rank) {
return -2;
}
updateSingle('users', 'rid', $rid, 'uid = ' . $uid);
return 1;
}
示例2: G
<?php
$p = G("p", 1);
$sort = G("sort", "uid");
$order = G("order", "asc");
$orderx = $order == "asc" ? "desc" : "asc";
$users = new Users();
$usersArr = $users->getAllUser($sort, $order, $p);
$usersCnt = $users->getCntUser();
$r = Roles::getInstance();
$roles = $r->getAll();
$frmUrl = "/setting/role?sort={$sort}&order={$order}";
?>
<div class="row marginCenter">
<form id="frmUserRole" class="setting role" method="post" action="<?php
echo $frmUrl;
?>
">
<div class="form-group">
<table class="table table-hover">
<thead>
<tr>
<td><a href="?sort=uid&order=<?php
echo $sort == "uid" ? $orderx : $order;
?>
" class="<?php
echo $sort == "uid" ? "actived {$order}" : "";
?>
">User ID</a></td>
示例3: getUserRoleRank
function getUserRoleRank()
{
if (isset($_SESSION['user']['rank'])) {
return $_SESSION['user']['rank'];
}
$rid = $_SESSION['user']['rid'];
$r = Roles::getInstance();
$roles = $r->getAll();
foreach ($roles as $k => $v) {
if ($rid == $v['rid']) {
$_SESSION['user']['rank'] = $v['rank'];
return intval($v['rank']);
}
}
return 0;
}