2 /************************************************************************/
\r
4 /************************************************************************/
\r
5 /* Copyright (c) 2002-2010 */
\r
6 /* Inclusive Design Institute */
\r
7 /* http://atutor.ca */
\r
9 /* This program is free software. You can redistribute it and/or */
\r
10 /* modify it under the terms of the GNU General Public License */
\r
11 /* as published by the Free Software Foundation. */
\r
12 /************************************************************************/
\r
15 define('AT_INCLUDE_PATH', '../../../../include/');
\r
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
\r
18 admin_authenticate(AT_ADMIN_PRIV_FORUMS);
\r
20 if (isset($_GET['edit'], $_GET['id'])) {
\r
21 header('Location: forum_edit.php?forum='.$_GET['id']);
\r
23 } else if (isset($_GET['delete'], $_GET['id'])) {
\r
24 header('Location: forum_delete.php?forum='.$_GET['id']);
\r
26 } else if (isset($_GET['delete']) || isset($_GET['edit'])) {
\r
27 $msg->addError('NO_ITEM_SELECTED');
\r
30 include(AT_INCLUDE_PATH.'../mods/_standard/forums/lib/forums.inc.php');
\r
32 require(AT_INCLUDE_PATH.'header.inc.php');
\r
35 <form name="form" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
\r
36 <table class="data" summary="" rules="groups" style="width: 90%">
\r
39 <th scope="col"> </th>
\r
40 <th scope="col"><?php echo _AT('title'); ?></th>
\r
41 <th scope="col"><?php echo _AT('description'); ?></th>
\r
42 <th scope="col"><?php echo _AT('courses'); ?></th>
\r
47 <td colspan="4"><input type="submit" name="edit" value="<?php echo _AT('edit'); ?>" /> <input type="submit" name="delete" value="<?php echo _AT('delete'); ?>" /></td>
\r
52 <th colspan="4"><?php echo _AT('shared_forums'); ?></th>
\r
57 $all_forums = get_forums(0);
\r
58 $num_shared = count($all_forums['shared']);
\r
59 $num_nonshared = count($all_forums['nonshared']);
\r
62 foreach ($all_forums['shared'] as $forum) {
\r
63 echo '<tr onmousedown="document.form[\'f'.$forum['forum_id'].'\'].checked = true; rowselect(this);" id="r_'.$forum['forum_id'].'">';
\r
64 echo '<td><input type="radio" name="id" value="'. $forum['forum_id'].'" id="f'.$forum['forum_id'].'"></td>';
\r
65 echo ' <td><label for="f'.$forum['forum_id'].'">' . AT_print($forum['title'], 'forums.title') . '</label></td>';
\r
66 echo ' <td>' . AT_print($forum['description'], 'forums.description') . '</td>';
\r
70 $sql = "SELECT F.course_id FROM ".TABLE_PREFIX."forums_courses F WHERE F.forum_id=$forum[forum_id]";
\r
71 $c_result = mysql_query($sql, $db);
\r
72 while ($course = mysql_fetch_assoc($c_result)) {
\r
73 $courses[] = $system_courses[$course['course_id']]['title'];
\r
75 natcasesort($courses);
\r
76 echo implode(', ', $courses);
\r
82 echo ' <td colspan="4"><strong>' . _AT('no_forums') . '</strong></td>';
\r
89 <th colspan="4"><?php echo _AT('unshared_forums'); ?></th>
\r
91 <?php if ($num_nonshared) : ?>
\r
92 <?php foreach ($all_forums['nonshared'] as $forum) : ?>
\r
93 <tr onmousedown="document.form['f<?php echo $forum['forum_id']; ?>'].checked = true; rowselect(this);" id="r_<?php echo $forum['forum_id']; ?>">
\r
94 <td><input type="radio" name="id" value="<?php echo $forum['forum_id']; ?>" id="f<?php echo $forum['forum_id']; ?>" /></td>
\r
95 <td><label for="f<?php echo $forum['forum_id']; ?>"><?php echo AT_print($forum['title'], 'forums.title'); ?></label></td>
\r
96 <td><?php echo AT_print($forum['description'], 'forums.description'); ?></td>
\r
97 <td><?php echo $system_courses[$forum['course_id']]['title']; ?></td>
\r
99 <?php endforeach; ?>
\r
102 <td colspan="4"><strong><?php echo _AT('no_forums'); ?></strong></td>
\r
109 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>