Location: PHPKode > projects > ACollab > admin/users.php
<?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                                                               */
/****************************************************************************************/
// $Id: users.php 250 2004-06-08 15:23:30Z boonhau $

define('AC_INCLUDE_PATH', '../include/');
require(AC_INCLUDE_PATH.'vitals.inc.php');
authenticate(USER_ADMIN);

$_SECTION[0][0] = _AC('administration');
$_SECTION[0][1] = 'admin/';
$_SECTION[1][0] = _AC('user_management');
$_SECTION[1][1] = 'admin/';

require(AC_INCLUDE_PATH.'admin/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';
}

${'highlight_'.$col} = ' u';


$_GET['L'] = '';
?>
<p align="center"><b><a href="admin/user_create.php" onfocus="this.className='highlight'" onblur="this.className=''"> <?php echo _AC('create_account'); ?></a></b></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"><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">&nbsp;</th>
</tr>
<?php
$sql	= "SELECT * FROM ".TABLE_PREFIX."members ORDER BY $col $order";

$result = mysql_query($sql,$db);

if (($row = mysql_fetch_assoc($result))) {
	/* get how many groups each member belongs to */
	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'].'&nbsp;</small></td>';
		echo '<td class="row'.$col.'"><small>'.$row['last_name'].'&nbsp;</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.'"><small>';
		echo '<a href="admin/user_edit.php?id='.$row['member_id'].'" 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_assoc($result));
	echo '</table>';
} else {
	echo '</table></p>';
	echo _AC('no_members_found');
}


	require(AC_INCLUDE_PATH.'admin/footer.inc.php');
?>
Return current item: ACollab