本文整理汇总了PHP中ACL::getAllRoles方法的典型用法代码示例。如果您正苦于以下问题:PHP ACL::getAllRoles方法的具体用法?PHP ACL::getAllRoles怎么用?PHP ACL::getAllRoles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACL
的用法示例。
在下文中一共展示了ACL::getAllRoles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
<a href="perms.php" class="permissions">Permissions</a>
</li>
<li>
<a href="admin_index.php" class="user_admin">User Admin</a>
</li>
</ul>
</div>
<div id="table-content">
<div id="page">
<?php
if ($_GET['action'] == '') {
?>
<h2>Select a Role to Manage:</h2>
<?php
$roles = $myACL->getAllRoles('full');
foreach ($roles as $k => $v) {
echo "<a href=\"?action=role&roleID=" . $v['ID'] . "\">" . $v['Name'] . "</a><br />";
}
if (count($roles) < 1) {
echo "No roles yet.<br />";
}
?>
<input type="button" name="New" value="New Role" onclick="window.location='?action=role'" />
<?php
}
if ($_GET['action'] == 'role') {
if ($_GET['roleID'] == '') {
?>
<h2>New Role:</h2>
<?php
示例2: ACL
?>
<?php
if ($_GET['action'] == 'roles') {
?>
<h2>Manage User Roles: (<?php
echo $myACL->getUsername($_GET['userID']);
?>
)</h2>
<form action="users.php" method="post">
<table border="0" cellpadding="5" cellspacing="0">
<tr>
<th></th><th>Member</th><th>Not Member</th>
</tr>
<?php
$roleACL = new ACL($_GET['userID']);
$roles = $roleACL->getAllRoles('full');
foreach ($roles as $k => $v) {
echo "\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<td><label>" . $v['Name'] . "</label></td>";
echo "<td>\n\t\t\t\t\t\t\t\t\t\t<input type=\"radio\" name=\"role_" . $v['ID'] . "\" id=\"role_" . $v['ID'] . "_1\" value=\"1\"";
if ($roleACL->userHasRole($v['ID'])) {
echo " checked=\"checked\"";
}
echo " /></td>";
echo "<td>\n\t\t\t\t\t\t\t\t\t\t<input type=\"radio\" name=\"role_" . $v['ID'] . "\" id=\"role_" . $v['ID'] . "_0\" value=\"0\"";
if (!$roleACL->userHasRole($v['ID'])) {
echo " checked=\"checked\"";
}
echo " /></td>";
echo "\n\t\t\t\t\t\t\t\t\t</tr>";
}
?>