<?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: forums.php 220 2004-06-07 15:38:08Z boonhau $
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('forum_management');
$_SECTION[3][1] = 'forums/';
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('forum_management');
$_SECTION[2][1] = 'forums/';
require(AC_INCLUDE_PATH.'header.inc.php');
}
if (authenticate(USER_GROUP_ADMIN, USER_RETURN_CHECK)) {
echo '<p align="center"><a href="group_admin/forums_create.php" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">'._AC('create_forum').'</a></p>';
}
if (isset($_GET['f'])) {
print_feedback(intval($_GET['f']));
}
$sql = "SELECT * FROM ".TABLE_PREFIX."forums WHERE group_id=$_SESSION[group_id] ORDER BY title";
$result = mysql_query($sql, $db);
if ($row = mysql_fetch_array($result)) {
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>'._AC('forum').'</small></th>';
echo '<th scope="col" class="box" align="left"><small>'._AC('topics').'</small></th>';
echo '<th scope="col" class="box" align="left"><small>'._AC('posts').'</small></th>';
echo '<th scope="col" class="box" align="right"><small>'._AC('last_post').'</small></th>';
echo '<th scope="col" class="box" align="right"> </th>';
echo '</tr>';
$counter = 0;
do {
$counter++;
$col = (($counter-1)%2);
echo '<tr>';
echo '<td class="row'.$col.'"><small><b>'.$row['title'].'</b></small>';
echo '<p><small>'.$row['description'].'</small></p></td>';
echo '<td class="row'.$col.'" align="center"><small>'.$row['num_topics'].'</small></td>';
echo '<td class="row'.$col.'" align="center"><small>'.$row['num_posts'].'</small></td>';
echo '<td class="row'.$col.'" align="right"><small>';
if ($row['last_post'] == '0000-00-00 00:00:00') {
echo ' ';
} else {
echo AT_date(_AC('forum_date_format'), $row['last_post'], AT_DATE_MYSQL_DATETIME);
}
echo '</small></td>';
echo '<td class="row'.$col.'" align="right"><small>';
echo '<a href="group_admin/forums_edit.php?fid='.$row['forum_id'].'" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">'._AC('edit').'</a>';
echo ' | ';
echo '<a href="group_admin/forums_delete.php?fid='.$row['forum_id'].'" onfocus="this.className=\'highlight\'" onblur="this.className=\'\'">'._AC('delete').'</a>';
echo '</small></td>';
echo '</tr>';
} while ($row = mysql_fetch_array($result));
echo '</table>';
} else {
echo '<p><i>'._AC('no_forums').'</i></p>';
}
require(AC_INCLUDE_PATH.'footer.inc.php');
?>