The tag for ATutor 2.0.3 release.
[atutor.git] / mods / _standard / forums / index.php
1 <?php\r
2 /****************************************************************/\r
3 /* ATutor                                                                                                               */\r
4 /****************************************************************/\r
5 /* Copyright (c) 2002-2010                                      */\r
6 /* Inclusive Design Institute                                   */\r
7 /* http://atutor.ca                                                                                             */\r
8 /*                                                              */\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
13 // $Id$\r
14 \r
15 $page = 'tools';\r
16 define('AT_INCLUDE_PATH', '../../../include/');\r
17 require(AT_INCLUDE_PATH.'vitals.inc.php');\r
18 authenticate(AT_PRIV_FORUMS);\r
19 \r
20 if (isset($_GET['edit'], $_GET['id'])) {\r
21         header('Location: '.AT_BASE_HREF.'mods/_standard/forums/edit_forum.php?fid='.intval($_GET['id']));\r
22         exit;\r
23 } else if (isset($_GET['delete'], $_GET['id'])) {\r
24         header('Location: '.AT_BASE_HREF.'mods/_standard/forums/delete_forum.php?fid='.intval($_GET['id']));\r
25         exit;\r
26 } else if (isset($_GET['edit']) || isset($_GET['delete'])) {\r
27         $msg->addError('NO_ITEM_SELECTED');\r
28 }\r
29 \r
30 require(AT_INCLUDE_PATH.'../mods/_standard/forums/lib/forums.inc.php');\r
31 \r
32 require(AT_INCLUDE_PATH.'header.inc.php');\r
33 \r
34 \r
35 $all_forums = get_forums($_SESSION['course_id']);\r
36 ?>\r
37 <form name="form" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">\r
38 \r
39 <table class="data" summary="" rules="cols">\r
40 <thead>\r
41 <tr>\r
42         <th scope="col">&nbsp;</th>\r
43         <th scope="col"><?php echo _AT('title'); ?></th>\r
44         <th scope="col"><?php echo _AT('description'); ?></th>\r
45         <th scope="col"><?php echo _AT('allow_editing'); ?></th>\r
46 </tr>\r
47 </thead>\r
48 <tfoot>\r
49 <tr>\r
50         <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
51 </tr>\r
52 </tfoot>\r
53 <tbody>\r
54 <?php if ($all_forums['nonshared']): ?>\r
55         <?php foreach($all_forums['nonshared'] as $row): ?>\r
56                 <tr onmousedown="document.form['f<?php echo $row['forum_id']; ?>'].checked = true; rowselect(this);" id="r_<?php echo $row['forum_id']; ?>">\r
57                         <td width="10"><input type="radio" name="id" value="<?php echo $row['forum_id']; ?>" id="f<?php echo $row['forum_id']; ?>" /></td>\r
58                         <td><label for="f<?php echo $row['forum_id']; ?>"><?php echo AT_print($row['title'], 'forums.title'); ?></label></td>\r
59                         <td><?php echo AT_print($row['description'], 'forums.description'); ?></td>\r
60                         <td>\r
61                                 <?php if (!$row['mins_to_edit']): ?>\r
62                                         <?php echo _AT('no'); ?>\r
63                                 <?php else: ?>\r
64                                         <?php echo  _AT('minutes', $row['mins_to_edit']); ?>\r
65                                 <?php endif; ?>\r
66                         </td>\r
67                 </tr>\r
68         <?php endforeach; ?>\r
69 <?php else: ?>\r
70         <tr>\r
71                 <td colspan="4"><?php echo _AT('none_found'); ?></td>\r
72         </tr>\r
73 <?php endif; ?>\r
74 </tbody>\r
75 </table>\r
76 </form>\r
77 \r
78 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>