<?php
/****************************************************************************************/
/* ACollab */
/****************************************************************************************/
/* Copyright (c) 2002-2004 Adaptive Technology Resource Centre / University of Toronto */
/* */
/* http://atutor.ca/acollab */
/* */
/* This program is free software. You may redistribute it and/or */
/* modify it under the terms of the GNU General Public License */
/* as published by the Free Software Foundation; either version 2 of the License, */
/* or (at your option) any later version. */
/* */
/* 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 may access the GNU General Public License at: */
/* http://www.opensource.org/licenses/gpl-license.php */
/* */
/* You may contact the Adaptive Technology Resource Centre at */
/* Robarts Library, University of Toronto */
/* 130 St. George Street, Toronto, Ontario, Canada M5S 1A5 */
/* Further contact information is available at http://www.utoronto.ca/atrc/ */
/****************************************************************************************/
/* Programmer: */
/* Joel Kronenberg - ATRC */
/* Heidi Hazelton - ATRC */
/****************************************************************************************/
// $Id: users.php 236 2004-06-07 20:08:32Z boonhau $
exit('no longer used');
define('AC_INCLUDE_PATH', '../include/');
require(AC_INCLUDE_PATH.'vitals.inc.php');
authenticate(USER_GROUP_ADMIN);
if (authenticate(USER_ADMIN, USER_RETURN_CHECK)) {
$group_info = get_group($_SESSION['group_id']);
$_SECTION[0][0] = _AC('administration');
$_SECTION[0][1] = 'admin/index.php';
$_SECTION[1][0] = _AC('groups');
$_SECTION[1][1] = 'admin/groups.php';
$_SECTION[2][0] = $group_info['title'];
$_SECTION[2][1] = 'group_admin/index.php';
$_SECTION[3][0] = _AC('user_management');
require(AC_INCLUDE_PATH.'admin/header.inc.php');
} else {
$_SECTION[0][0] = _AC('home');
$_SECTION[0][1] = 'home.php';
$_SECTION[1][0] = _AC('administration');
$_SECTION[1][1] = 'group_admin/';
$_SECTION[2][0] = _AC('user_management');
$_SECTION[2][1] = 'admin/';
require(AC_INCLUDE_PATH.'header.inc.php');
}
if (isset($_GET['f'])) {
print_feedback(intval($_GET['f']));
}
if ($_GET['col']) {
$col = addslashes($_GET['col']);
} else {
$col = 'login';
}
if ($_GET['order']) {
$order = addslashes($_GET['order']);
} else {
$order = 'asc';
}
$h = intval($_GET['h']);
$j = intval($_GET['j']);
$d = intval($_GET['d']);
if ($h > 0) {
$group = get_group($h);
echo '<h2>'._AC('members_of_group').': '.$group['title'].'</h2>';
}
if ($j > 0) {
$jurisdiction = get_jurisdiction($j);
echo '<h2>'._AC('members_of_jurisdiction').': '.$jurisdiction['title'].'</h2>';
}
if ($d > 0) {
$department = get_department($d);
echo '<h2>'._AC('members_of_department').': '.$department['title'].'</h2>';
}
${'highlight_'.$col} = ' u';
$_GET['L'] = '';
?>
<p align="center"><b><a href="group_admin/group_assign.php" onfocus="this.className='highlight'" onblur="this.className=''"> <?php echo _AC('at_assign_users'); ?></a></b></p>
<p><table cellspacing="0" cellpadding="2" border="0" bgcolor="white" width="99%" align="center" summary="" class="box2">
<tr>
<th scope="col" class="box" align="left"><a name="list"></a><small><a href="<?php echo $_SERVER['PHP_SELF'].'?col=login'.SEP.'order=asc'.SEP.'L='.$_GET['L']; ?>#list" class="nav <?php echo $highlight_login; ?>" title="<?php echo _AC('username'); ?>" onfocus="this.className='highlight'" onblur="this.className='nav <?php echo $highlight_login; ?>'"><?php echo _AC('username'); ?></a> <?php
if (($col == 'login') && ($order == 'asc')) {
echo '<a href="'.$_SERVER['PHP_SELF'].'?col=login'.SEP.'order=desc'.SEP.'L='.$_GET['L'].'#list"><img src="images/desc.gif" height="7" width="11" alt="'._AC('username_desc').'" border="0" /></a>';
} else if (($col == 'login') && ($order == 'desc')) {
echo '<a href="'.$_SERVER['PHP_SELF'].'?col=login'.SEP.'order=asc'.SEP.'L='.$_GET['L'].'#list"><img src="images/asc.gif" height="7" width="11" alt="'._AC('username_asc').'" border="0" /></a>';
} else {
echo '<img src="images/clr.gif" height="7" width="11" alt="" />';
}
?></small></th>
<th scope="col" class="box" align="left"><small><a href="<?php echo $_SERVER['PHP_SELF'].'?col=first_name'.SEP.'order=asc'.SEP.'L='.$_GET['L']; ?>#list" class="nav <?php echo $highlight_first_name; ?>" title="<?php echo _AC('first_name_asc'); ?>" onfocus="this.className='highlight'" onblur="this.className='nav <?php echo $highlight_first_name; ?>'"><?php echo _AC('first_name'); ?></a> <?php
if (($col == 'first_name') && ($order == 'asc')) {
echo '<a href="'.$_SERVER['PHP_SELF'].'?col=first_name'.SEP.'order=desc'.SEP.'L='.$_GET['L'].'#list"><img src="images/desc.gif" height="7" width="11" alt="'._AC('first_name_desc').'" border="0" /></a>';
} else if (($col == 'first_name') && ($order == 'desc')) {
echo '<a href="'.$_SERVER['PHP_SELF'].'?col=first_name'.SEP.'order=asc'.SEP.'L='.$_GET['L'].'#list"><img src="images/asc.gif" height="7" width="11" alt="'._AC('first_name_asc').'" border="0" /></a>';
} else {
echo '<img src="images/clr.gif" height="7" width="11" alt="" />';
}
?></small></th>
<th scope="col" class="box" align="left"><small><a href="<?php echo $_SERVER['PHP_SELF'].'?col=last_name'.SEP.'order=asc'.SEP.'L='.$_GET['L']; ?>#list" class="nav <?php echo $highlight_last_name; ?>" title="<?php echo _AC('last_name_asc'); ?>" onfocus="this.className='highlight'" onblur="this.className='nav <?php echo $highlight_last_name;?>'"><?php echo _AC('last_name'); ?></a> <?php
if (($col == 'last_name') && ($order == 'asc')) {
echo '<a href="'.$_SERVER['PHP_SELF'].'?col=last_name'.SEP.'order=desc'.SEP.'L='.$_GET['L'].'#list"><img src="images/desc.gif" height="7" width="11" alt="'._AC('last_name_desc').'" border="0" /></a>';
} else if (($col == 'last_name') && ($order == 'desc')) {
echo '<a href="'.$_SERVER['PHP_SELF'].'?col=last_name'.SEP.'order=asc'.SEP.'L='.$_GET['L'].'#list"><img src="images/asc.gif" height="7" width="11" alt="'._AC('last_name_asc').'" border="0" /></a>';
} else {
echo '<img src="images/clr.gif" height="7" width="11" alt="" />';
}
?></small></th>
<th scope="col" class="box" align="left"><small><a href="<?php echo $_SERVER['PHP_SELF'].'?col=status'.SEP.'order=asc'.SEP.'L='.$_GET['L']; ?>#list" class="nav <?php echo $highlight_status; ?>" title="<?php echo _AC('account_type_asc'); ?>" onfocus="this.className='highlight'" onblur="this.className='nav <?php echo $highlight_status; ?>'"><?php echo _AC('account_type'); ?></a> <?php
if (($col == 'status') && ($order == 'asc')) {
echo '<a href="'.$_SERVER['PHP_SELF'].'?col=status'.SEP.'order=desc'.SEP.'L='.$_GET['L'].'#list"><img src="images/desc.gif" height="7" width="11" alt="'._AC('account_type_desc').'" border="0" /></a>';
} else if (($col == 'status') && ($order == 'desc')) {
echo '<a href="'.$_SERVER['PHP_SELF'].'?col=status'.SEP.'order=asc'.SEP.'L='.$_GET['L'].'#list"><img src="images/asc.gif" height="7" width="11" alt="'._AC('account_type_asc').'" border="0" /></a>';
} else {
echo '<img src="images/clr.gif" height="7" width="11" alt="" />';
}
?></small></th>
<th scope="col" class="box"><small><a href="<?php echo $_SERVER['PHP_SELF'].'?col=creation_date'.SEP.'order=asc'.SEP.'L='.$_GET['L']; ?>#list" class="nav <?php echo $highlight_creation_date; ?>" title="<?php echo _AC('creation_date_asc'); ?>" onfocus="this.className='highlight'" onblur="this.className='nav <?php echo $highlight_creation_date;?>'"><?php echo _AC('creation_date'); ?></a> <?php
if (($col == 'creation_date') && ($order == 'asc')) {
echo '<a href="'.$_SERVER['PHP_SELF'].'?col=creation_date'.SEP.'order=desc'.SEP.'L='.$_GET['L'].'#list"><img src="images/desc.gif" height="7" width="11" alt="'._AC('creation_date_desc').'" border="0" /></a>';
} else if (($col == 'creation_date') && ($order == 'desc')) {
echo '<a href="'.$_SERVER['PHP_SELF'].'?col=creation_date'.SEP.'order=asc'.SEP.'L='.$_GET['L'].'#list"><img src="images/asc.gif" height="7" width="11" alt="'._AC('creation_date_asc').'" border="0" /></a>';
} else {
echo '<img src="images/clr.gif" height="7" width="11" alt="" />';
}
?></small></th>
<?php if (EUSA) { ?>
<th scope="col" class="box"><small><a href="<?php echo $_SERVER['PHP_SELF'].'?col=eusa'.SEP.'order=asc'.SEP.'L='.$_GET['L']; ?>#list" class="nav <?php echo $highlight_eusa; ?>" title="<?php echo _AC('accepted_date_asc'); ?>" onfocus="this.className='highlight'" onblur="this.className='nav <?php echo $highlight_eusa;?>'"><?php echo _AC('accepted_date'); ?></a> <?php
if (($col == 'eusa') && ($order == 'asc')) {
echo '<a href="'.$_SERVER['PHP_SELF'].'?col=eusa'.SEP.'order=desc'.SEP.'L='.$_GET['L'].'#list"><img src="images/desc.gif" height="7" width="11" alt="'._AC('accepted_date_desc').'" border="0" /></a>';
} else if (($col == 'eusa') && ($order == 'desc')) {
echo '<a href="'.$_SERVER['PHP_SELF'].'?col=eusa'.SEP.'order=asc'.SEP.'L='.$_GET['L'].'#list"><img src="images/asc.gif" height="7" width="11" alt="'._AC('accepted_date_asc').'" border="0" /></a>';
} else {
echo '<img src="images/clr.gif" height="7" width="11" alt="" />';
}
?></small></th>
<?php } ?>
<th scope="col" class="box"><?php echo _AC('num_groups'); ?></th>
<th scope="col" class="box"> </th>
</tr>
<?php
$h = $_SESSION['group_id'];
if ($h > 0) {
$sql = "SELECT M.*, H.privileges FROM ".MEMBERS_TABLE_PREFIX."members M, ".TABLE_PREFIX."groups_members H WHERE M.member_id=H.member_id AND H.group_id=$h ORDER BY $col $order";
$group_encoding = urlencode('h='.$h);
} else {
$sql = "SELECT * FROM ".MEMBERS_TABLE_PREFIX."members ORDER BY $col $order";
}
$result = mysql_query($sql, $db);
if (($row = mysql_fetch_array($result))) {
/* get how many groups each member belongs to */
$group_counts = array();
$sql = "SELECT COUNT(*) AS cnt, member_id FROM ".TABLE_PREFIX."groups_members GROUP BY member_id";
$result2 = mysql_query($sql, $db);
while ($row2 = mysql_fetch_assoc($result2)) {
$group_counts[$row2['member_id']] = $row2['cnt'];
}
do {
$counter++;
$col = ($counter-1)%2;
echo '<tr>';
echo '<td class="row'.$col.'"><small><b>'.$row['login'].'</b></small></td>';
echo '<td class="row'.$col.'"><small>'.$row['first_name'].' </small></td>';
echo '<td class="row'.$col.'"><small>'.$row['last_name'].' </small></td>';
echo '<td class="row'.$col.'"><small>';
if ($row['status'] == USER_ADMIN) {
echo _AC('admin');
} else if ($row['privileges'] == USER_GROUP_ADMIN) {
echo _AC('group_admin');
} else {
echo _AC('regular');
}
echo '</small></td>';
echo '<td class="row'.$col.'" align="center"><small>'.substr($row['creation_date'],0,-3).'</small></td>';
if (EUSA) {
echo '<td class="row'.$col.'" align="center"><small>';
if ($row['eusa'] != '0000-00-00') {
echo $row['eusa'];
} else {
echo _AC('not_yet');
}
echo '</small></td>';
}
echo '<td class="row'.$col.'" align="center"><small>'.($group_counts[$row['member_id']] ? $group_counts[$row['member_id']] : 0).'</small></td>';
echo '<td class="row'.$col.'"><small>';
echo '<a href="admin/user_edit.php?id='.$row['member_id'].SEP.'group='.$group_encoding.'" title="'._AC('edit').'" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">'._AC('edit').'</a>';
if ($row['member_id'] != $_SESSION['member_id']) {
echo ' | <a href="admin/user_delete.php?id='.$row['member_id'].'" title="'._AC('delete').'" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">'._AC('delete').'</a>';
}
echo '</small></td>';
echo '</tr>';
} while ($row = mysql_fetch_array($result));
echo '</table></p>';
} else {
echo '</table></p>';
echo _AC('no_group_members');
}
require(AC_INCLUDE_PATH.'footer.inc.php');
?>