Location: PHPKode > projects > ConPortal > conportal/display_users.php
<?php
/*
 *  ConPortal - Pomona College ITS scheduling appplication
 *  Copyright (C) 2005-2008  Pomona College, Bucknell University, University at Albany SUNY
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of version 2 of the GNU General Public License
 *  as published by the Free Software Foundation.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
require_once('standard.php');
xhtml_header_privileged('Contact Information', 'manage_users');

$users = sortUsersByName(getAllUserDetails());
$i = 0;


?>
<p><?= count($users) ?> users in the database.</p>
<p>Click on a user's name to edit personal/contact information.</p>

<table id='usersTable' class='sortable'>
    <thead>	
    <tr>
        <th>First</th><th>Last</th><th>Consultant Group</th><th>Username</th>
<?php
	if(BUCKNELL_OPTIONS == TRUE)
	{
		echo "<th>Phone</th><th>Cell</th><th>Screen Name</th><th>Supervisor</th><th>Seniority</th><th>Options</th>";
	}
	else
	{
		echo "<th>Phone</th><th>Screen Name</th><th>Supervisor</th><th>Seniority</th><th>Options</th>";
	}
?>
    </tr>
    </thead>
	<tbody>
<?php
foreach ($users as $user)
{
    $group = getGroupDetails($user['primary_group']); 
?>
    <tr class='d<?= $i++ % 2 ?>' onmouseover='javascript:highlight(this)'
        onmouseout='javascript:unhighlight(this)'
<?php
/*
I think this could be kinda spiffy, but also possibly not intuitive...
        onclick='javascript:window.location = "https://127.0.0.1/user_edit.php?user=<?= $user['pid'] ?>"'
*/

?>
        <td><a href="user_edit.php?user=<?= $user['pid'] ?>">
            <?= $user['first'] ?></a></td>
        <td><a href="user_edit.php?user=<?= $user['pid'] ?>">
            <?= $user['last'] ?></a></td>
        <td><?= $group['description'] ?></td><td><?= $user['username'] ?></td>
        <td><?= $user['phone'] ?>&nbsp;</td><td><?= $user['cell'] ?>&nbsp;</td>
        <td><?= $user['screen_name'] ?>&nbsp;</td>
        <td><?= $user['supervisor'] ?>&nbsp;</td>
	<td><?= $user['seniority_level'] ?>&nbsp;</td>
        <td><a href="user_modify.php?user=<?= $user['pid'] ?>">groups</a>
            <a href="user_delete.php?user=<?= $user['pid'] ?>">deactivate</a>
        </td>
    </tr>
<?
}
?>
</tbody>
</table>

<br />
<? 
//I think the word we're looking for is "inactive" :-P
$deactive = sortUsersByName(getAllDeactive());
if (count($deactive) == 0) { }
else {
?>

<b>Inactive Users</b><br>

<table id='usersTable'>
    <tr>
        <th>First</th><th>Last</th><th>Consultant Group</th><th>Username</th>
        <th>Phone</th><th>Screen Name</th><th>Supervisor</th><th>Seniority</th>
    </tr>
<?php
	foreach ($deactive as $user)
	{
   	 $group = getGroupDetails($user['primary_group']);
?>
    <tr class='d<?= $i++ % 2 ?>' onmouseover='javascript:highlight(this)'
        onmouseout='javascript:unhighlight(this)'
<?php /*
I think this could be kinda spiffy, but also possibly not intuitive...
        onclick='javascript:window.location = "https://127.0.0.1/user_edit.php?user=<?= $user['pid'] ?>"'
*/ ?>
        <td><a href="user_edit.php?user=<?= $user['pid'] ?>">
            <?= $user['first'] ?></a></td>
        <td><a href="user_edit.php?user=<?= $user['pid'] ?>">
            <?= $user['last'] ?></a></td>
        <td><?= $group['description'] ?></td><td><?= $user['username'] ?></td>
        <td><?= $user['phone'] ?>&nbsp;</td>
        <td><?= $user['screen_name'] ?>&nbsp;</td>
        <td><?= $user['supervisor'] ?>&nbsp;</td>
	<td><?= $user['seniority_level'] ?>&nbsp;</td>
        <td><a href="user_modify.php?user=<?= $user['pid'] ?>">groups</a>
            <a href="user_activate.php?user=<?= $user['pid'] ?>">activate</a>
        </td>
    </tr>
<?php
	}
} //end else
?>
</table>
<br /><br />
<a href="register_users.php"><h2>Add a New User</h2></a>
<br /><br />
<?php
xhtml_footer();
?>
Return current item: ConPortal