move code up one directory
[atutor.git] / mods / _core / groups / groups.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 define('AT_INCLUDE_PATH', '../../../include/');\r
16 require(AT_INCLUDE_PATH.'vitals.inc.php');\r
17 \r
18 require(AT_INCLUDE_PATH.'header.inc.php');\r
19 \r
20 if (!$_SESSION['groups']) {\r
21         $msg->printErrors('NOT_IN_ANY_GROUPS');\r
22         require(AT_INCLUDE_PATH.'footer.inc.php');\r
23         exit;\r
24 }\r
25 $group_list = implode(',', $_SESSION['groups']);\r
26 $sql = "SELECT group_id, title, modules FROM ".TABLE_PREFIX."groups WHERE group_id IN ($group_list) ORDER BY title";\r
27 $result = mysql_query($sql, $db);\r
28 \r
29 echo '<ol id="tools">';\r
30 \r
31 while ($row = mysql_fetch_assoc($result)) {\r
32         echo '<li class="top-tool">'.AT_print($row['title'], 'groups.title') . ' ';\r
33 \r
34         $modules = explode('|', $row['modules']);\r
35         asort($modules);\r
36 \r
37         if ($modules) {\r
38                 echo '<ul class="child-top-tool">';\r
39                 foreach ($modules as $module_name) {\r
40                         $fn = basename($module_name) . '_get_group_url';\r
41                         $module =& $moduleFactory->getModule($module_name);\r
42                         if ($module->isEnabled() && function_exists($fn)) {\r
43                                 echo '<li class="child-tool"><a href="'. url_rewrite($fn($row['group_id'])) .'">'._AT($_pages[$module->getGroupTool()]['title_var']).'</a></li>';\r
44                         }\r
45                 }\r
46                 echo '</ul>';\r
47         }\r
48         echo '</li>';\r
49 }\r
50 echo '</ol>';\r
51 \r
52 require(AT_INCLUDE_PATH.'footer.inc.php');\r
53 ?>