2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
9 /* This program is free software. You can redistribute it and/or */
10 /* modify it under the terms of the GNU General Public License */
11 /* as published by the Free Software Foundation. */
12 /************************************************************************/
15 define('AT_INCLUDE_PATH', '../../../../include/');
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
18 admin_authenticate(AT_ADMIN_PRIV_FORUMS);
20 if (isset($_GET['edit'], $_GET['id'])) {
21 header('Location: forum_edit.php?forum='.$_GET['id']);
23 } else if (isset($_GET['delete'], $_GET['id'])) {
24 header('Location: forum_delete.php?forum='.$_GET['id']);
26 } else if (isset($_GET['delete']) || isset($_GET['edit'])) {
27 $msg->addError('NO_ITEM_SELECTED');
30 include(AT_INCLUDE_PATH.'../mods/_standard/forums/lib/forums.inc.php');
32 require(AT_INCLUDE_PATH.'header.inc.php');
36 $all_forums = get_forums(0);
37 $num_shared = count($all_forums['shared']);
38 $num_nonshared = count($all_forums['nonshared']);
40 $shared_forums = array();
44 foreach ($all_forums['shared'] as $forum) {
45 $shared_forums[$i]["id"] = $forum['forum_id'];
46 $shared_forums[$i]["title"] = AT_print($forum['title'], 'forums.title');
47 $shared_forums[$i]["desc"] = AT_print($forum['description'], 'forums.description');
49 $courses = array();//create an empty array
50 $sql = "SELECT F.course_id FROM ".TABLE_PREFIX."forums_courses F WHERE F.forum_id=$forum[forum_id]";
51 $c_result = mysql_query($sql, $db);
52 while ($course = mysql_fetch_assoc($c_result)) {
53 $courses[] = $system_courses[$course['course_id']]['title'];
55 natcasesort($courses);
56 $shared_forums[$i]["courses"] = $courses;
63 echo ' <td colspan="4"><strong>' . _AT('no_forums') . '</strong></td>';
67 $nonshared_forums = array();
71 foreach ($all_forums['nonshared'] as $forum) {
72 $nonshared_forums[$i]["forum_id"] = $forum['forum_id'];
73 $nonshared_forums[$i]["title"] = AT_print($forum['title'], 'forums.title');
74 $nonshared_forums[$i]["desc"] = AT_print($forum['description'], 'forums.description');
80 $savant->assign('system_courses', $system_courses);
81 $savant->assign('num_nonshared', $num_nonshared);
82 $savant->assign('courses', $courses);
83 $savant->assign('shared_forums', $shared_forums);
84 $savant->assign('nonshared_forums', $nonshared_forums);
85 $savant->assign('all_forums', $all_forums);
86 $savant->display('admin/courses/forums.tmpl.php');
87 require(AT_INCLUDE_PATH.'footer.inc.php'); ?>