7f2cb6428af1d7b6b175b8d01ab9b657608af9bc
[atutor.git] / docs / mods / _standard / sitemap / sitemap.php
1 <?php
2 /****************************************************************/
3 /* ATutor                                                                                                               */
4 /****************************************************************/
5 /* Copyright (c) 2002-2010                                      */
6 /* Inclusive Design Institute                                   */
7 /* http://atutor.ca                                                                                             */
8 /*                                                              */
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 /****************************************************************/
13 // $Id$
14
15 $page = 'sitemap';
16 define('AT_INCLUDE_PATH', '../../../include/');
17 require(AT_INCLUDE_PATH.'vitals.inc.php');
18 require(AT_INCLUDE_PATH.'../mods/_standard/forums/lib/forums.inc.php');
19 require(AT_INCLUDE_PATH.'../mods/_standard/student_tools/classes/StudentToolsUtil.class.php');
20
21 require(AT_INCLUDE_PATH.'header.inc.php');
22
23 function print_one_menu_item($text) {
24         echo '<br />';
25         echo '<img src="images/'.$rtl.'tree/tree_vertline.gif" alt="" class="img-size-tree" />';
26         echo '<img src="images/'.$rtl.'tree/tree_end.gif" alt="" class="img-size-tree" />';
27         echo '<img src="images/'.$rtl.'tree/tree_horizontal.gif" alt="" class="img-size-tree" />';
28         echo '&nbsp;'.$text;
29 }
30 ?>
31 <div id="container" style="padding:2em; width:90%;">
32 <?php
33 echo '<p><a href="index.php">'._AT('home').'</a>';
34
35 $_current_modules = array_slice($_pages[AT_NAV_COURSE], 1);
36 $_current_modules = array_merge((array) $_current_modules, array_diff($_pages[AT_NAV_HOME],$_pages[AT_NAV_COURSE]));
37
38 foreach ($_current_modules as $module) {
39         echo '<br />';
40         echo '<img src="images/'.$rtl.'tree/tree_split.gif" alt="" class="img-size-tree" />  <a href="'.url_rewrite($module).'">' . _AT($_pages[$module]['title_var']) . '</a>';
41
42         if (substr($module, -14) == 'forum/list.php') {
43                 $forums = get_forums($_SESSION['course_id']);
44                 
45                 if (is_array($forums)) {
46                         foreach ($forums as $state=>$rows) {
47                                 $count = 0;
48                                 $num_forums = count($rows);
49                                 foreach ($rows as $row) {
50                                         $count++;
51                                         echo '<br />';
52                                         echo '<img src="images/'.$rtl.'tree/tree_vertline.gif" alt="" class="img-size-tree" />';
53                                         if ($count < $num_forums) {
54                                                 echo '<img src="images/'.$rtl.'tree/tree_split.gif" alt="" class="img-size-tree" />';
55                                         } else {
56                                                 echo '<img src="images/'.$rtl.'tree/tree_end.gif" alt="" class="img-size-tree" />';
57                                         }
58                                         echo '<img src="images/'.$rtl.'tree/tree_horizontal.gif" alt="" class="img-size-tree" />';
59                                         echo ' <a href="'.url_rewrite('mods/_standard/forums/forum/index.php?fid='.$row['forum_id']).'">'.AT_print($row['title'], 'forums.title').'</a>';
60                                 }
61                         } 
62                 } else {
63                         print_one_menu_item(_AT('no_forums'));
64                 }
65         }
66         
67         // display the turned-on student tools
68         if (substr($module, -23) == 'student_tools/index.php') {
69                 $student_tools = StudentToolsUtil::getStudentTools($_SESSION['course_id']);
70                 
71                 if (count($student_tools) == 0) {
72                         print_one_menu_item(_AT("no_student_tools"));
73                 } else {
74                         foreach (get_home_navigation($student_tools) as $link) {
75                                 $text = '<a href="'.$link['url'].'">'. $link['title'].'</a>';
76                                 print_one_menu_item($text);
77                         }
78                 }
79         }
80 }
81
82 echo '<br /><img src="images/'.$rtl.'tree/tree_split.gif" alt="" class="img-size-tree" /> <a href="'.url_rewrite('search.php').'">'._AT('search').'</a><br />';
83 echo '<img src="images/'.$rtl.'tree/tree_split.gif" alt="" class="img-size-tree" /> <a href="help/">'._AT('help').'</a><br />';
84 echo '<img src="images/'.$rtl.'tree/tree_end.gif" alt="" class="img-size-tree" /> '._AT('content').'<br />';
85
86 $contentManager->printSiteMapMenu();
87
88 echo '</p>';
89 ?>
90 </div>
91
92 <?php
93 require(AT_INCLUDE_PATH.'footer.inc.php');
94 ?>