<?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: groups.php 235 2004-06-07 19:55:47Z 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('groups');
$_SECTION[1][1] = 'admin/groups.php';
$_SESSION['course_id'] = 0;
require(AC_INCLUDE_PATH.'admin/header.inc.php');
print_popup_help('help_admin_groups');
echo '<p align="center"><a href="admin/groups_create.php" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">ยป '._AC('create_group').'</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 = 'asc';
}
${'highlight_'.$col} = ' u';
if (defined('AT_PATH') && AT_PATH) {
$sql = "SELECT G.*,C.title AS c_title, C.course_id FROM ".TABLE_PREFIX."groups G LEFT JOIN ".AT_TABLE_PREFIX."courses C USING (course_id) ORDER BY G.$col $order";
} else {
$sql = "SELECT * FROM ".TABLE_PREFIX."groups ORDER BY $col $order";
}
$result = mysql_query($sql, $db);
while ($row = @mysql_fetch_assoc($result)) {
$groups[] = $row;
}
if ($groups) {
echo '<table cellspacing="0" cellpadding="2" border="0" bgcolor="white" width="70%" 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>';
if (defined('AT_PATH') && AT_PATH) {
echo '<th scope="col" class="box" align="right">'._AC('course').'</th>';
}
echo '<th scope="col" class="box" align="right"> </th>';
echo '</tr>';
foreach ($groups as $group) {
$counter++;
$col = ($counter-1)%2;
echo '<tr>';
echo '<td class="row'.$col.'"><small>'.$group['title'].'</small></td>';
if (defined('AT_PATH') && AT_PATH) {
echo '<td class="row'.$col.'"><small>';
if ($group['c_title']) {
echo $group['c_title'];
} else {
echo _AC('na');
}
echo '</small></td>';
}
echo '<td class="row'.$col.'" align="right"><a href="index.php?id='.$group['group_id'].SEP.'p='.urlencode('group_admin/index.php').SEP.'cid='.$group['course_id'].'">'._AC('manage_group').'</a></td>';
echo '</tr>';
}
echo '</table>';
echo '<p><small>'._AC('use_col_headings').'</small></p>';
} else {
echo '<p>'._AC('no_groups_found').'</p>';
}
require(AC_INCLUDE_PATH.'admin/footer.inc.php');
?>