Skip to content
Snippets Groups Projects
Commit 801e89a6 authored by Peter Rotich's avatar Peter Rotich
Browse files

Show the number of departments a group is allowed to access

parent e28e3053
No related branches found
No related tags found
No related merge requests found
...@@ -3,10 +3,13 @@ if(!defined('OSTADMININC') || !$thisstaff || !$thisstaff->isAdmin()) die('Access ...@@ -3,10 +3,13 @@ if(!defined('OSTADMININC') || !$thisstaff || !$thisstaff->isAdmin()) die('Access
$qstr=''; $qstr='';
$sql='SELECT grp.*,count(staff.staff_id) as users ' $sql='SELECT grp.*,count(staff.staff_id) as users, count(dept.dept_id) as depts '
.' FROM '.GROUP_TABLE.' grp LEFT JOIN '.STAFF_TABLE.' staff USING(group_id) '; .' FROM '.GROUP_TABLE.' grp '
$sql.=' WHERE 1'; .' LEFT JOIN '.STAFF_TABLE.' staff ON(staff.group_id=grp.group_id) '
$sortOptions=array('name'=>'grp.group_name','status'=>'grp.group_enabled','users'=>'users','created'=>'grp.created','updated'=>'grp.updated'); .' LEFT JOIN '.GROUP_DEPT_TABLE.' dept ON(dept.group_id=grp.group_id) '
.' WHERE 1';
$sortOptions=array('name'=>'grp.group_name','status'=>'grp.group_enabled',
'users'=>'users', 'depts'=>'depts', 'created'=>'grp.created','updated'=>'grp.updated');
$orderWays=array('DESC'=>'DESC','ASC'=>'ASC'); $orderWays=array('DESC'=>'DESC','ASC'=>'ASC');
$sort=($_REQUEST['sort'] && $sortOptions[strtolower($_REQUEST['sort'])])?strtolower($_REQUEST['sort']):'name'; $sort=($_REQUEST['sort'] && $sortOptions[strtolower($_REQUEST['sort'])])?strtolower($_REQUEST['sort']):'name';
//Sorting options... //Sorting options...
...@@ -49,9 +52,10 @@ else ...@@ -49,9 +52,10 @@ else
<thead> <thead>
<tr> <tr>
<th width="7px">&nbsp;</th> <th width="7px">&nbsp;</th>
<th width="250"><a <?php echo $name_sort; ?> href="groups.php?<?php echo $qstr; ?>&sort=name">Group Name</a></th> <th width="200"><a <?php echo $name_sort; ?> href="groups.php?<?php echo $qstr; ?>&sort=name">Group Name</a></th>
<th width="80"><a <?php echo $status_sort; ?> href="groups.php?<?php echo $qstr; ?>&sort=status">Group Status</a></th> <th width="80"><a <?php echo $status_sort; ?> href="groups.php?<?php echo $qstr; ?>&sort=status">Status</a></th>
<th width="80" style="text-align:center;"><a <?php echo $users_sort; ?>href="groups.php?<?php echo $qstr; ?>&sort=users">Members</a></th> <th width="80" style="text-align:center;"><a <?php echo $users_sort; ?>href="groups.php?<?php echo $qstr; ?>&sort=users">Members</a></th>
<th width="80" style="text-align:center;"><a <?php echo $depts_sort; ?>href="groups.php?<?php echo $qstr; ?>&sort=depts">Departments</a></th>
<th width="100"><a <?php echo $created_sort; ?> href="groups.php?<?php echo $qstr; ?>&sort=created">Created On</a></th> <th width="100"><a <?php echo $created_sort; ?> href="groups.php?<?php echo $qstr; ?>&sort=created">Created On</a></th>
<th width="120"><a <?php echo $updated_sort; ?> href="groups.php?<?php echo $qstr; ?>&sort=updated">Last Updated</a></th> <th width="120"><a <?php echo $updated_sort; ?> href="groups.php?<?php echo $qstr; ?>&sort=updated">Last Updated</a></th>
</tr> </tr>
...@@ -81,6 +85,9 @@ else ...@@ -81,6 +85,9 @@ else
<?php } ?> <?php } ?>
&nbsp; &nbsp;
</td> </td>
<td style="text-align:right;padding-right:30px">&nbsp;&nbsp;
<?php echo $row['depts']; ?>
</td>
<td><?php echo Format::db_date($row['created']); ?>&nbsp;</td> <td><?php echo Format::db_date($row['created']); ?>&nbsp;</td>
<td><?php echo Format::db_datetime($row['updated']); ?>&nbsp;</td> <td><?php echo Format::db_datetime($row['updated']); ?>&nbsp;</td>
</tr> </tr>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment