Location: PHPKode > projects > ACollab > group_admin/categories.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: categories.php 236 2004-06-07 20:08:32Z boonhau $

define('AC_INCLUDE_PATH', '../include/');

require(AC_INCLUDE_PATH.'vitals.inc.php');
authenticate(USER_GROUP_ADMIN);

$_SECTION[0][0] = _AC('home');
$_SECTION[0][1] = 'home.php';
$_SECTION[1][0] = _AC('administration');
$_SECTION[1][1] = 'group_admin/';
$_SECTION[2][0] = _AC('categories');
$_SECTION[2][1] = 'group_admin/categories.php';

require(AC_INCLUDE_PATH.'header.inc.php');
print_popup_help('help_create_categories');
echo '<p align="center"><a href="group_admin/categories_create.php" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">ยป '._AC('create_category').'</a></p>';

if ($_GET['f']) {
	print_feedback($_GET['f']);
}

if ($_GET['col']) {
	$col = addslashes($_GET['col']);
} else {
	$col = 'title';
}

if ($_GET['order']) {
	$order = addslashes($_GET['order']);
} else {
	$order = 'desc';
}

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

$categories = get_categories($col, $order);

if ($categories) {
	echo '<table cellspacing="0" cellpadding="2" border="0" bgcolor="white" width="99%" align="center" summary="" class="box2">';
	echo '<tr>';
	
	echo '<th scope="col" class="box" align="left"><small><a href="'.$_SERVER['PHP_SELF'].'?col=title'.SEP.'order=asc" class="nav'.$highlight_title.'" title="'._AC('title_asc').'" onfocus="this.className=\'highlight\'" onblur="this.className=\'nav'.$highlight_title.'\'">'._AC('title').'</a> ';
		if (($col == 'title') && ($order == 'asc')) {
			echo '<a href="'.$_SERVER['PHP_SELF'].'?col=title'.SEP.'order=desc"><img src="images/desc.gif" height="7" width="11" alt="'._AC('title_desc').'" border="0" class="img4" /></a>';
		} else if (($col == 'title') && ($order == 'desc')) {
			echo '<a href="'.$_SERVER['PHP_SELF'].'?col=title'.SEP.'order=asc"><img src="images/asc.gif" height="7" width="11" alt="'._AC('title_asc').'" border="0"  class="img4" /></a>';
		} else {
			echo '<img src="images/clr.gif" height="7" width="11" alt="" />';
		}
	echo '</small></th>';

	echo '<th scope="col" class="box">&nbsp;</th>';

	echo '</tr>';
	foreach ($categories as $row) {
		$counter++;
		$col = ($counter-1)%2;
		echo '<tr>';

		echo '<td class="row'.$col.'"><small>'.$row['title'].'</small></td>';

		echo '<td class="row'.$col.'" align="right"><small><a href="group_admin/categories_edit.php?id='.$row['category_id'].'" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">'._AC('edit').'</a> | <a href="group_admin/categories_delete.php?id='.$row['category_id'].'" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">'._AC('delete').'</a></small></td>';

		echo '</tr>';
	}
	echo '</table>';
	echo '<p><small>'._AC('use_col_headings').'</small></p>';
} else {
	echo '<p>'._AC('no_categories_found').'</p>';
}

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