Gazelle/sections/tools/managers/permissions_list.php

50 lines
1.4 KiB
PHP
Raw Normal View History

2011-03-28 14:21:28 +00:00
<?
show_header('Manage Permissions');
?>
<script type="text/javascript" language="javascript">
//<![CDATA[
function confirmDelete(id) {
if (confirm("Are you sure you want to remove this permission class?")) {
location.href="tools.php?action=permissions&removeid="+id;
}
return false;
}
//]]>
</script>
<div class="thin">
<div class="linkbox">
[<a href="tools.php?action=permissions&amp;id=new">Create a new permission set</a>]
[<a href="tools.php">Back to Tools</a>]
</div>
<?
2012-03-28 08:00:20 +00:00
$DB->query("SELECT p.ID,p.Name,p.Level,p.Secondary,COUNT(u.ID)+COUNT(DISTINCT l.UserID)
FROM permissions AS p
LEFT JOIN users_main AS u ON u.PermissionID=p.ID
LEFT JOIN users_levels AS l ON l.PermissionID=p.ID
GROUP BY p.ID ORDER BY p.Secondary ASC, p.Level ASC");
2011-03-28 14:21:28 +00:00
if($DB->record_count()) {
?>
<table width="100%">
<tr class="colhead">
<td>Name</td>
<td>Level</td>
<td>User Count</td>
<td class="center">Actions</td>
</tr>
2012-03-28 08:00:20 +00:00
<? while(list($ID,$Name,$Level,$Secondary,$UserCount)=$DB->next_record()) { ?>
2011-03-28 14:21:28 +00:00
<tr>
<td><?=display_str($Name); ?></td>
2012-03-28 08:00:20 +00:00
<td><?=($Secondary?'Secondary':$Level) ?></td>
2011-03-28 14:21:28 +00:00
<td><?=number_format($UserCount); ?></td>
<td class="center">[<a href="tools.php?action=permissions&amp;id=<?=$ID ?>">Edit</a> | <a href="#" onclick="return confirmDelete(<?=$ID?>)">Remove</a>]</td>
</tr>
<? } ?>
</table>
<? } else { ?>
<h2 align="center">There are no permission classes.</h2>
<? } ?>
</div>
<?
show_footer();
?>