2011-03-28 14:21:28 +00:00
|
|
|
<?
|
2012-10-11 08:00:15 +00:00
|
|
|
View::show_header('Manage Permissions');
|
2011-03-28 14:21:28 +00:00
|
|
|
?>
|
2013-02-06 08:00:17 +00:00
|
|
|
<script type="text/javascript">//<![CDATA[
|
2011-03-28 14:21:28 +00:00
|
|
|
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">
|
2012-08-19 08:00:19 +00:00
|
|
|
<div class="header">
|
|
|
|
<div class="linkbox">
|
2013-02-09 08:01:01 +00:00
|
|
|
<a href="tools.php?action=permissions&id=new" class="brackets">Create a new permission set</a>
|
|
|
|
<a href="tools.php" class="brackets">Back to tools</a>
|
2012-08-19 08:00:19 +00:00
|
|
|
</div>
|
2011-03-28 14:21:28 +00:00
|
|
|
</div>
|
|
|
|
<?
|
2013-05-02 08:00:23 +00:00
|
|
|
$DB->query("SELECT
|
|
|
|
p.ID,
|
|
|
|
p.Name,
|
|
|
|
p.Level,
|
|
|
|
p.Secondary,
|
|
|
|
COUNT(u.ID)+COUNT(DISTINCT l.UserID)
|
2013-02-06 08:00:17 +00:00
|
|
|
FROM permissions AS p
|
2013-05-02 08:00:23 +00:00
|
|
|
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");
|
|
|
|
if ($DB->record_count()) {
|
2011-03-28 14:21:28 +00:00
|
|
|
?>
|
|
|
|
<table width="100%">
|
|
|
|
<tr class="colhead">
|
|
|
|
<td>Name</td>
|
|
|
|
<td>Level</td>
|
2013-05-02 08:00:23 +00:00
|
|
|
<td>User count</td>
|
2011-03-28 14:21:28 +00:00
|
|
|
<td class="center">Actions</td>
|
|
|
|
</tr>
|
2013-05-02 08:00:23 +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>
|
2013-05-02 08:00:23 +00:00
|
|
|
<td><?=($Secondary ? 'Secondary' : $Level) ?></td>
|
2011-03-28 14:21:28 +00:00
|
|
|
<td><?=number_format($UserCount); ?></td>
|
2013-02-09 08:01:01 +00:00
|
|
|
<td class="center">
|
|
|
|
<a href="tools.php?action=permissions&id=<?=$ID ?>" class="brackets">Edit</a>
|
|
|
|
<a href="#" onclick="return confirmDelete(<?=$ID?>)" class="brackets">Remove</a>
|
|
|
|
</td>
|
2011-03-28 14:21:28 +00:00
|
|
|
</tr>
|
|
|
|
<? } ?>
|
|
|
|
</table>
|
2013-05-02 08:00:23 +00:00
|
|
|
<?
|
|
|
|
} else { ?>
|
2011-03-28 14:21:28 +00:00
|
|
|
<h2 align="center">There are no permission classes.</h2>
|
2013-05-02 08:00:23 +00:00
|
|
|
<?
|
|
|
|
} ?>
|
2011-03-28 14:21:28 +00:00
|
|
|
</div>
|
|
|
|
<?
|
2012-10-11 08:00:15 +00:00
|
|
|
View::show_footer();
|
2011-03-28 14:21:28 +00:00
|
|
|
?>
|