2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2010 */
6 /* Inclusive Design Institute */
8 /* This program is free software. You can redistribute it and/or */
9 /* modify it under the terms of the GNU General Public License */
10 /* as published by the Free Software Foundation. */
11 /************************************************************************/
13 if (!defined('TR_INCLUDE_PATH')) { exit; }
14 include(TR_INCLUDE_PATH.'handbook_pages.inc.php');
16 global $handbook_pages;
19 $merged_array = array();
21 // straighten multi-dimensional array $pages into one-dimension array
22 function merge_page_array($pages_array)
26 if(is_array($pages_array))
28 foreach ($pages_array as $page_key => $page_value)
30 if (is_array($page_value))
32 $merged_array[] = $page_key;
33 merge_page_array($page_value);
37 $merged_array[] = $page_value;
43 merge_page_array($handbook_pages);
45 // find previous and next page of the current page from merged_array
46 if (is_array($merged_array))
48 foreach ($merged_array as $key => $page)
50 if (strcmp($page, $this_page) == 0)
52 if ($key >= 1) $prev_page = $merged_array[$key - 1];
53 if ($key < count($merged_array) - 1) $next_page = $merged_array[$key + 1];
58 if (isset($prev_page)) $savant->assign('prev_page', $prev_page);
59 if (isset($next_page)) $savant->assign('next_page', $next_page);
61 $savant->assign('pages', $_pages);
62 $savant->assign('this_page', $this_page);
63 $savant->assign('base_path', TR_BASE_HREF);
64 $savant->assign('theme', $_SESSION['prefs']['PREF_THEME']);
66 $savant->display('include/handbook_header.tmpl.php');