fea92984642522120c67c1d6bcb078eb11d7e86d
[acontent.git] / docs / documentation / handbook_header.inc.php
1 <?php
2 /************************************************************************/
3 /* AContent                                                             */
4 /************************************************************************/
5 /* Copyright (c) 2010                                                   */
6 /* Inclusive Design Institute                                           */
7 /*                                                                      */
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 /************************************************************************/
12
13 if (!defined('TR_INCLUDE_PATH')) { exit; } 
14 include(TR_INCLUDE_PATH.'handbook_pages.inc.php');
15
16 global $handbook_pages;
17 global $merged_array;
18
19 $merged_array = array();
20
21 // straighten multi-dimensional array $pages into one-dimension array
22 function merge_page_array($pages_array)
23 {
24         global $merged_array;
25         
26         if(is_array($pages_array))
27         {
28                 foreach ($pages_array as $page_key => $page_value) 
29                 {
30                         if (is_array($page_value))
31                         {
32                                 $merged_array[] = $page_key;
33                                 merge_page_array($page_value);
34                         }
35                         else 
36                         {
37                                 $merged_array[] = $page_value;
38                         }
39                 }
40         }
41         
42 }
43 merge_page_array($handbook_pages);
44
45 // find previous and next page of the current page from merged_array
46 if (is_array($merged_array))
47 {
48         foreach ($merged_array as $key => $page)
49         {
50                 if (strcmp($page, $this_page) == 0)
51                 {
52                         if ($key >= 1) $prev_page = $merged_array[$key - 1];
53                         if ($key < count($merged_array) - 1) $next_page = $merged_array[$key + 1];
54                         break;
55                 }
56         }
57 }
58 if (isset($prev_page)) $savant->assign('prev_page', $prev_page);
59 if (isset($next_page)) $savant->assign('next_page', $next_page);
60
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']);
65
66 $savant->display('include/handbook_header.tmpl.php');
67
68 ?>