made a copy
[atutor.git] / include / lib / menu_pages.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                                                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2008 by Greg Gay, Joel Kronenberg & Heidi Hazelton*/
6 /* Adaptive Technology Resource Centre / University of Toronto                  */
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 if (!defined('AT_INCLUDE_PATH')) { exit; }
15 global $_config;
16 global $_pages;
17
18 /*
19         5 sections: public, my_start_page, course, admin, home
20 */
21 if (isset($_pages[AT_NAV_ADMIN])) {
22         array_unshift($_pages[AT_NAV_ADMIN], 'admin/index.php', 'admin/modules/index.php');
23 }
24
25 if($_config['allow_browse'] && $_config['just_social'] != "1"){
26         $browse_tab = "browse.php";
27 }
28 if($_config['allow_registration']){
29         $reg_tab = "registration.php";
30 }
31
32 if($_config['just_social']){
33
34 $_pages[AT_NAV_START]  = array_merge(array('users/profile.php', 'users/preferences.php'), (isset($_pages[AT_NAV_START]) ? (array) $_pages[AT_NAV_START] : array()));
35
36 }else{
37
38 $_pages[AT_NAV_START]  = array_merge(array('users/index.php' , 'users/profile.php', 'users/preferences.php'), (isset($_pages[AT_NAV_START]) ? (array) $_pages[AT_NAV_START] : array()));
39
40 }
41 $_pages[AT_NAV_PUBLIC] = array_merge(array('login.php',$reg_tab,$browse_tab), (isset($_pages[AT_NAV_PUBLIC]) ? $_pages[AT_NAV_PUBLIC] : array()));
42
43
44 //$_pages[AT_NAV_START]  = array_merge(array($my_tab , 'users/profile.php', 'users/preferences.php'), (isset($_pages[AT_NAV_START]) ? (array) $_pages[AT_NAV_START] : array()));
45 $_pages[AT_NAV_COURSE] = array('index.php');
46 $_pages[AT_NAV_HOME]   = array();
47
48 if (isset($_SESSION['course_id']) && $_SESSION['course_id'] > 0) {
49         $main_links = $home_links = $side_menu = array();
50
51         if ($system_courses[$_SESSION['course_id']]['main_links']) {
52                 $main_links = explode('|', $system_courses[$_SESSION['course_id']]['main_links']);
53                 foreach ($main_links as $link) {
54                         if (isset($_pages[$link])) {
55                                 $_pages[$link]['parent'] = AT_NAV_COURSE;
56                         }
57                 }
58                 $_pages[AT_NAV_COURSE] = array_merge($_pages[AT_NAV_COURSE], $main_links);
59         }
60
61         if ($system_courses[$_SESSION['course_id']]['home_links']) {
62                 $home_links = explode('|', $system_courses[$_SESSION['course_id']]['home_links']);
63                 foreach ($home_links as $link) {
64                         if (isset($_pages[$link])) {
65                                 $_pages[AT_NAV_HOME][] = $link;
66                         }
67                 }
68         }
69
70         if (authenticate(AT_PRIV_ADMIN, AT_PRIV_RETURN)) {
71                 $_pages[AT_NAV_COURSE][] = 'tools/index.php';           
72         } else if ($_SESSION['privileges']) {
73                 
74                 /**
75                  * the loop and all this module priv checking is done to hide the Manage tab
76                  * when this student has privileges, but no items linked from the Manage tab.
77                  * Example: the File Storage privilege does not have a Manage tab item.
78                  * In the best case it stops after the first found link.
79                  * In the worst case it goes through all the modules and doesn't find a link.
80                  */
81                 $module_list = $moduleFactory->getModules(AT_MODULE_STATUS_ENABLED, 0, TRUE);
82                 $keys = array_keys($module_list);
83
84                 foreach ($keys as $module_name) {
85                         $module =& $module_list[$module_name];
86                         if ($module->getPrivilege() && authenticate($module->getPrivilege(), AT_PRIV_RETURN) && ($module->getChildPage('tools/index.php'))) {
87                                 $_pages[AT_NAV_COURSE][] = 'tools/index.php';
88                                 break;
89                         }
90                 }
91         }
92 } else if (isset($_SESSION['course_id']) && $_SESSION['course_id'] == -1) {
93         /* admin pages */
94
95         $_pages['admin/index.php']['title_var'] = 'home';
96         $_pages['admin/index.php']['parent']    = AT_NAV_ADMIN;
97         $_pages['admin/index.php']['guide']     = 'admin/?p=configuration.php';
98         $_pages['admin/index.php']['children'] = array_merge(array('admin/admins/my_edit.php', 'admin/admins/my_password.php'), isset($_pages['admin/index.php']['children']) ?  $_pages['admin/index.php']['children'] : array());
99
100         $_pages['admin/admins/my_edit.php']['title_var'] = 'my_account';
101         $_pages['admin/admins/my_edit.php']['parent']    = 'admin/index.php';
102         $_pages['admin/admins/my_edit.php']['guide']     = 'admin/?p=my_account.php';
103
104         $_pages['admin/admins/my_password.php']['title_var'] = 'change_password';
105         $_pages['admin/admins/my_password.php']['parent']    = 'admin/index.php';
106
107         if (admin_authenticate(AT_ADMIN_PRIV_USERS, AT_PRIV_RETURN)) {
108                 $_pages[AT_NAV_ADMIN][] = 'admin/config_edit.php';
109
110                 $_pages['admin/config_edit.php']['title_var'] = 'system_preferences';
111                 $_pages['admin/config_edit.php']['parent']    = AT_NAV_ADMIN;
112                 $_pages['admin/config_edit.php']['guide']     = 'admin/?p=system_preferences.php';
113                 $_pages['admin/config_edit.php']['children']  = array_merge((array) $_pages['admin/config_edit.php']['children'], array('admin/error_logging.php'));
114         }
115         $_pages['admin/fix_content.php']['title_var'] = 'fix_content_ordering';
116         $_pages['admin/fix_content.php']['parent']    = 'admin/index.php';
117
118         $_pages['admin/error_logging.php']['title_var'] = 'error_logging';
119         $_pages['admin/error_logging.php']['parent']    = 'admin/config_edit.php';
120         $_pages['admin/error_logging.php']['guide']     = 'admin/?p=error_logging.php';
121         $_pages['admin/error_logging.php']['children']  = array_merge(array('admin/error_logging_bundle.php', 'admin/error_logging_reset.php'), isset($_pages['admin/error_logging.php']['children']) ? $_pages['admin/error_logging.php']['children'] : array());
122
123         $_pages['admin/error_logging_reset.php']['title_var'] = 'reset_log';
124         $_pages['admin/error_logging_reset.php']['parent']    = 'admin/error_logging.php';
125
126         $_pages['admin/error_logging_bundle.php']['title_var'] = 'report_errors';
127         $_pages['admin/error_logging_bundle.php']['parent']    = 'admin/error_logging.php';
128
129         $_pages['admin/error_logging_details.php']['title_var'] = 'viewing_profile_bugs';
130         $_pages['admin/error_logging_details.php']['parent']    = 'admin/error_logging.php';
131
132         $_pages['admin/error_logging_view.php']['title_var'] = 'viewing_errors';
133         $_pages['admin/error_logging_view.php']['parent']    = 'admin/error_logging_details.php';
134
135         if (admin_authenticate(AT_ADMIN_PRIV_ADMIN, TRUE)) {
136                 // hide modules from non-super admins
137                 $_pages['admin/modules/index.php']['title_var'] = 'modules';
138                 $_pages['admin/modules/index.php']['parent']    = AT_NAV_ADMIN;
139                 $_pages['admin/modules/index.php']['guide']     = 'admin/?p=modules.php';
140                 $_pages['admin/modules/index.php']['children']  = array('admin/modules/install_modules.php');
141
142                 $_pages['admin/modules/details.php']['title_var'] = 'details';
143                 $_pages['admin/modules/details.php']['parent']    = 'admin/modules/index.php';
144
145                 $_pages['admin/modules/module_uninstall_step_1.php']['title_var'] = 'module_uninstall';
146                 $_pages['admin/modules/module_uninstall_step_1.php']['parent']    = 'admin/modules/index.php';
147
148                 $_pages['admin/modules/module_uninstall_step_2.php']['title_var'] = 'module_uninstall';
149                 $_pages['admin/modules/module_uninstall_step_2.php']['parent']    = 'admin/modules/index.php';
150
151                 $_pages['admin/modules/module_uninstall_step_3.php']['title_var'] = 'module_uninstall';
152                 $_pages['admin/modules/module_uninstall_step_3.php']['parent']    = 'admin/modules/index.php';
153
154                 $_pages['admin/modules/install_modules.php']['title_var'] = 'install_modules';
155                 $_pages['admin/modules/install_modules.php']['parent']    = 'admin/modules/index.php';
156                 $_pages['admin/modules/install_modules.php']['guide']     = 'admin/?p=modules.php';
157
158                 $_pages['admin/modules/version_history.php']['title_var'] = 'version_history';
159                 $_pages['admin/modules/version_history.php']['parent']    = 'admin/modules/install_modules.php';
160
161                 $_pages['admin/modules/module_install_step_1.php']['title_var'] = 'details';
162                 $_pages['admin/modules/module_install_step_1.php']['parent']    = 'admin/modules/install_modules.php';
163
164                 $_pages['admin/modules/module_install_step_2.php']['title_var'] = 'details';
165                 $_pages['admin/modules/module_install_step_2.php']['parent']    = 'admin/modules/install_modules.php';
166
167                 $_pages['admin/modules/module_install_step_3.php']['title_var'] = 'details';
168                 $_pages['admin/modules/module_install_step_3.php']['parent']    = 'admin/modules/install_modules.php';
169
170                         $_pages['admin/modules/confirm.php']['title_var'] = 'confirm';
171                         $_pages['admin/modules/confirm.php']['parent']    = 'admin/modules/add_new.php';
172
173                 $_pages['admin/cron_config.php']['title_var'] = 'cron_config';
174                 $_pages['admin/cron_config.php']['parent']    = 'admin/config_edit.php';
175                 $_pages['admin/cron_config.php']['guide']     = 'admin/?p=cron_setup.php';
176                 $_pages['admin/config_edit.php']['children']  = array_merge((array) $_pages['admin/config_edit.php']['children'], array('admin/cron_config.php'));
177
178                 $_pages['admin/auto_enroll.php']['title_var'] = 'auto_enroll';
179                 $_pages['admin/auto_enroll.php']['parent']    = 'admin/config_edit.php';
180                 $_pages['admin/auto_enroll.php']['guide']     = 'admin/?p=auto_enroll.php';
181                 $_pages['admin/auto_enroll.php']['children']  = array_merge(array('admin/auto_enroll_edit.php'));
182                 $_pages['admin/config_edit.php']['children']  = array_merge((array) $_pages['admin/config_edit.php']['children'], array('admin/auto_enroll.php'));
183
184                 $_pages['admin/auto_enroll_edit.php']['title_var'] = 'auto_enroll_edit';
185                 $_pages['admin/auto_enroll_edit.php']['parent']    = 'admin/auto_enroll.php';
186         
187                 $_pages['admin/auto_enroll_delete.php']['title_var'] = 'auto_enroll_delete';
188                 $_pages['admin/auto_enroll_delete.php']['parent']    = 'admin/auto_enroll.php';
189         
190         }
191 }
192
193
194 /* public pages */
195 $_pages['registration.php']['title_var'] = 'register';
196 $_pages['registration.php']['parent']    = AT_NAV_PUBLIC;
197 $_pages['registration.php']['children']  = isset($_pages['browse.php']['children']) ? $_pages['browse.php']['children'] : array();
198 $_pages['registration.php']['guide']     = 'general/?p=register.php';
199
200 $_pages['browse.php']['title_var'] = 'browse_courses';
201 $_pages['browse.php']['parent']    = AT_NAV_PUBLIC;
202 $_pages['browse.php']['children']  = isset($_pages['browse.php']['children']) ? $_pages['browse.php']['children'] : array();
203 $_pages['browse.php']['guide']     = 'general/?p=browse_courses.php';
204
205 $_pages['login.php']['title_var'] = 'login';
206 $_pages['login.php']['parent']    = AT_NAV_PUBLIC;
207 $_pages['login.php']['children']  = array_merge(array('password_reminder.php'), isset($_pages['login.php']['children']) ? $_pages['login.php']['children'] : array());
208 $_pages['login.php']['guide']     = 'general/?p=login.php';
209
210 $_pages['confirm.php']['title_var'] = 'confirm';
211 $_pages['confirm.php']['parent']    = AT_NAV_PUBLIC;
212
213 $_pages['password_reminder.php']['title_var'] = 'password_reminder';
214 $_pages['password_reminder.php']['parent']    = 'login.php';
215 $_pages['password_reminder.php']['guide']     = 'general/?p=password_reminder.php';
216
217 $_pages['logout.php']['title_var'] = 'logout';
218 $_pages['logout.php']['parent']    = AT_NAV_PUBLIC;
219
220 /* my start page pages */
221 $_pages['users/index.php']['title_var'] = 'my_courses';
222 $_pages['users/index.php']['parent']    = AT_NAV_START;
223 $_pages['users/index.php']['guide']     = 'general/?p=my_courses.php';
224 if (isset($_SESSION['member_id']) && $_SESSION['member_id'] && (!isset($_SESSION['course_id']) || !$_SESSION['course_id'])) {
225         if ((get_instructor_status() === FALSE) && (!defined('ALLOW_INSTRUCTOR_REQUESTS') || !ALLOW_INSTRUCTOR_REQUESTS)) {
226                 $_pages['users/index.php']['children']  = array_merge(array('users/browse.php'), (array) $_pages['users/index.php']['children']);
227         } else {
228                 $_pages['users/index.php']['children']  = array_merge(array('users/browse.php', 'users/create_course.php'), isset($_pages['users/index.php']['children']) ? $_pages['users/index.php']['children'] : array());
229         }
230 }
231         
232         $_pages['users/browse.php']['title_var'] = 'browse_courses';
233         $_pages['users/browse.php']['parent']    = 'users/index.php';
234         $_pages['users/browse.php']['guide']     = 'general/?p=browse_courses.php';
235         
236         $_pages['users/create_course.php']['title_var'] = 'create_course';
237         $_pages['users/create_course.php']['parent']    = 'users/index.php';
238         $_pages['users/create_course.php']['guide']    = 'instructor/?p=creating_courses.php';
239
240         $_pages['users/private_enroll.php']['title_var'] = 'enroll';
241         $_pages['users/private_enroll.php']['parent']    = 'users/index.php';
242
243         $_pages['users/remove_course.php']['title_var'] = 'unenroll';
244         $_pages['users/remove_course.php']['parent']    = 'users/index.php';
245
246 $_pages['users/profile.php']['title_var']    = 'profile';
247 $_pages['users/profile.php']['parent']   = AT_NAV_START;
248 $_pages['users/profile.php']['guide']     = 'general/?p=profile.php';
249 $_pages['users/profile.php']['children']  = array_merge(array('users/password_change.php', 'users/email_change.php'), (array) $_pages['users/profile.php']['children']);
250
251         $_pages['users/password_change.php']['title_var'] = 'change_password';
252         $_pages['users/password_change.php']['parent']    = 'users/profile.php';
253         //$_pages['users/password_change.php']['guide']    = 'instructor/?p=creating_courses.php';
254
255         $_pages['users/email_change.php']['title_var'] = 'change_email';
256         $_pages['users/email_change.php']['parent']    = 'users/profile.php';
257
258 $_pages['users/preferences.php']['title_var']  = 'preferences';
259 $_pages['users/preferences.php']['parent'] = AT_NAV_START;
260 $_pages['users/preferences.php']['guide']  = 'general/?p=preferences.php';
261
262
263 /* course pages */
264 $_pages['index.php']['title_var']  = 'home';
265 $_pages['index.php']['parent'] = AT_NAV_COURSE;
266
267 $_pages['enroll.php']['title_var']  = 'enroll';
268 $_pages['enroll.php']['parent'] = AT_NAV_COURSE;
269
270 /* instructor pages: */
271 $_pages['tools/index.php']['title_var'] = 'manage';
272 $_pages['tools/index.php']['parent']    = AT_NAV_COURSE;
273
274 $_pages['inbox/index.php']['title_var'] = 'inbox';
275 $_pages['inbox/index.php']['children']  = array_merge(array('inbox/sent_messages.php', 'inbox/send_message.php', 'inbox/export.php'), isset($_pages['inbox/index.php']['children']) ? $_pages['inbox/index.php']['children'] : array());
276
277         $_pages['inbox/sent_messages.php']['title_var'] = 'sent_messages';
278         $_pages['inbox/sent_messages.php']['parent']    = 'inbox/index.php';
279
280         $_pages['inbox/send_message.php']['title_var'] = 'send_message';
281         $_pages['inbox/send_message.php']['parent']    = 'inbox/index.php';
282
283         $_pages['inbox/export.php']['title_var'] = 'export';
284         $_pages['inbox/export.php']['parent']    = 'inbox/index.php';
285
286 $_pages['profile.php']['title_var'] = 'profile';
287 $_pages['profile.php']['parent']    = 'index.php';
288
289
290 /* global pages */
291 $_pages['about.php']['title_var']  = 'about_atutor';
292
293 $_pages['404.php']['title_var']  = '404';
294
295 $_pages['help/index.php']['title_var']  = 'help';
296 $_pages['help/index.php']['children'] = array_merge(array('help/accessibility.php', 'help/contact_support.php'), isset($_pages['help/index.php']['children']) ? $_pages['help/index.php']['children'] : array());
297
298         $_pages['help/accessibility.php']['title_var']  = 'accessibility';
299         $_pages['help/accessibility.php']['parent'] = 'help/index.php';
300
301         $_pages['help/contact_support.php']['title_var']  = 'contact_support';
302         $_pages['help/contact_support.php']['parent'] = 'help/index.php';
303
304
305 $_pages['contact_instructor.php']['title_var']  = 'contact_instructor';
306
307 $current_page = substr($_SERVER['PHP_SELF'], strlen($_base_path));
308
309 function get_num_new_messages() {
310         global $db;
311         static $num_messages;
312
313         if (isset($num_messages)) {
314                 return $num_messages;
315         }
316         $sql    = "SELECT COUNT(*) AS cnt FROM ".TABLE_PREFIX."messages WHERE to_member_id=$_SESSION[member_id] AND new=1";
317         $result = mysql_query($sql, $db);
318         $row    = mysql_fetch_assoc($result);
319         $num_messages = $row['cnt'];
320
321         return $num_messages;
322 }
323
324 function get_main_navigation($current_page) {
325         global $_pages, $_base_path;
326
327         $parent_page = $_pages[$current_page]['parent'];
328         $_top_level_pages = array();
329
330         if (isset($parent_page) && defined($parent_page)) {
331                 foreach($_pages[$parent_page] as $page) {
332                         if (isset($_pages[$page])) {
333                                 if (isset($_pages[$page]['title'])) {
334                                         $_page_title = $_pages[$page]['title'];
335                                 } else {
336                                         $_page_title = _AT($_pages[$page]['title_var']);
337                                 }
338                                 
339                                 $_top_level_pages[] = array('url' => $_base_path . url_rewrite($page), 'title' => $_page_title, 'img' => $_base_path.$_pages[$page]['img'], 'tool_file' => $tool_file);
340                         }
341                 }
342         } else if (isset($parent_page)) {
343                 return get_main_navigation($parent_page);
344         }
345
346         return $_top_level_pages;
347 }
348
349 function get_current_main_page($current_page) {
350         global $_pages, $_base_path;
351
352         $parent_page = $_pages[$current_page]['parent'];
353
354         if (isset($parent_page) && defined($parent_page)) {
355                 return $_base_path . url_rewrite($current_page);
356         } else if (isset($parent_page)) {
357                 return get_current_main_page($parent_page);
358         }
359 }
360
361 function get_sub_navigation($current_page) {
362         global $_pages, $_base_path;
363
364         if (isset($current_page) && defined($current_page)) {
365                 // reached the top
366                 return array();
367         } else if (isset($_pages[$current_page]['children'])) {
368                 if (isset($_pages[$current_page]['title'])) {
369                         $_page_title = $_pages[$current_page]['title'];
370                 } else {
371                         $_page_title = _AT($_pages[$current_page]['title_var']);
372                 }
373
374                 $_sub_level_pages[] = array('url' => $_base_path . $current_page, 'title' => $_page_title);
375                 foreach ($_pages[$current_page]['children'] as $child) {
376
377                         if (isset($_pages[$child]['title'])) {
378                                 $_page_title = $_pages[$child]['title'];
379                         } else {
380                                 $_page_title = _AT($_pages[$child]['title_var']);
381                         }
382
383                         $_sub_level_pages[] = array('url' => $_base_path . $child, 'title' => $_page_title, 'has_children' => isset($_pages[$child]['children']));
384                 }
385         } else if (isset($_pages[$current_page]['parent'])) {
386                 // no children
387
388                 $parent_page = $_pages[$current_page]['parent'];
389                 return get_sub_navigation($parent_page);
390         }
391
392         return $_sub_level_pages;
393 }
394
395 function get_current_sub_navigation_page($current_page) {
396         global $_pages, $_base_path;
397
398         $parent_page = $_pages[$current_page]['parent'];
399
400         if (isset($parent_page) && defined($parent_page)) {
401                 return $_base_path . $current_page;
402         } else {
403                 return $_base_path . $current_page;
404         }
405 }
406
407 function get_path($current_page) {
408         global $_pages, $_base_path;
409
410         $parent_page = $_pages[$current_page]['parent'];
411
412         if (isset($_pages[$current_page]['title'])) {
413                 $_page_title = $_pages[$current_page]['title'];
414         } else {
415                 $_page_title = _AT($_pages[$current_page]['title_var']);
416         }
417
418         if (isset($parent_page) && defined($parent_page)) {
419                 $path[] = array('url' => $_base_path . url_rewrite($current_page), 'title' => $_page_title);
420                 return $path;
421         } else if (isset($parent_page)) {
422                 $path[] = array('url' => $_base_path . url_rewrite($current_page), 'title' => $_page_title);
423                 $path = array_merge((array) $path, get_path($parent_page));
424         } else {
425                 $path[] = array('url' => $_base_path . url_rewrite($current_page), 'title' => $_page_title);
426         }
427         
428         return $path;
429 }
430
431 function get_home_navigation($home_array='') {
432         global $_pages, $_list, $_base_path;
433                 
434         // set default home_array to course index navigation array
435         if (!is_array($home_array)) $home_array = $_pages[AT_NAV_HOME];
436         
437         $home_links = array();
438         foreach ($home_array as $child) {                                       //esecuzione del ciclo fin quando non saranno terminati i moduli presenti nella home-page del corso
439                 if (isset($_pages[$child])) {
440                         // initialization
441                         $title = $icon = $sub_file = $image = $text = $tool_file = '';
442                         
443                         if (isset($_pages[$child]['title'])) {                          //viene prelevato il titolo che dovrà poi essere utilizzato nella visualizzazione
444                                 $title = $_pages[$child]['title'];      
445                         } else {
446                                 $title = _AT($_pages[$child]['title_var']);     
447                         }
448                         if(isset($_pages[$child]['icon'])){                                     //si controlla se è presente l'icona inserita nel modulo di rifrimento. si ricorda che l'icona è inserita solo per i moduli che prevedono possibili sottocontenuti.
449                                 $icon = $_base_path.$_pages[$child]['icon'];    //in caso positivo viene prelevata e inserita in una variabile di appoggio che poi sarà a sua volta inserita all'interno dell'array finale home_links[]
450                         } else if(isset($_pages[$child]['text'])){                      //nel caso in cui non sia presente un' icona associata si controlla se è stato settata il testo (per moduli privi di sottocontenuti).
451                                 $text = $_pages[$child]['text'];                                //il testo viene inserito in una variabile d'appoggio e successivamente nell'array.
452                         }
453                         
454                         if (isset($_list[$_pages[$child]['title_var']]))        //viene prelevato il path del file che dovrà poi essere richiamato nella visualizzazione dei sottocontenuti. solo i moduli che prevedono sottocontenuti avranno un file di riferimento.
455                                 $sub_file = $_list[$_pages[$child]['title_var']]['file'];
456                         
457                         $real_image_in_theme = AT_INCLUDE_PATH.'../themes/'.$_SESSION['prefs']['PREF_THEME'].'/'.$_pages[$child]['img'];
458                         $image_in_theme = $_base_path.'themes/'.$_SESSION['prefs']['PREF_THEME'].'/'.$_pages[$child]['img'];
459                         
460                         // look for images in theme folder. If not exists, use images relative to ATutor root folder
461                         if (file_exists($real_image_in_theme))
462                                 $image = $image_in_theme;
463                         else
464                                 $image = $_base_path.$_pages[$child]['img'];
465                                 
466                         // inclusion of all data necessary for displaying the modules on the home-page. Set by default to check the visible because the modules will be loaded all visible in the home.
467                         $home_links[] = array('url' => $_base_path . url_rewrite($child), 'title' => $title, 'img' => $image, 'icon' => $icon, 'text' => $text, 'sub_file' => $sub_file, 'tool_file' => $tool_file, 'check'=> 'visible');
468                 }
469         }
470         return $home_links;
471 }
472
473 ?>