-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathhandbook_header.inc.php
68 lines (58 loc) · 2.02 KB
/
handbook_header.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
/************************************************************************/
/* AContent */
/************************************************************************/
/* Copyright (c) 2010 */
/* Inclusive Design Institute */
/* */
/* This program is free software. You can redistribute it and/or */
/* modify it under the terms of the GNU General Public License */
/* as published by the Free Software Foundation. */
/************************************************************************/
if (!defined('TR_INCLUDE_PATH')) { exit; }
include(TR_INCLUDE_PATH.'handbook_pages.inc.php');
global $handbook_pages;
global $merged_array;
$merged_array = array();
// straighten multi-dimensional array $pages into one-dimension array
function merge_page_array($pages_array)
{
global $merged_array;
if(is_array($pages_array))
{
foreach ($pages_array as $page_key => $page_value)
{
if (is_array($page_value))
{
$merged_array[] = $page_key;
merge_page_array($page_value);
}
else
{
$merged_array[] = $page_value;
}
}
}
}
merge_page_array($handbook_pages);
// find previous and next page of the current page from merged_array
if (is_array($merged_array))
{
foreach ($merged_array as $key => $page)
{
if (strcmp($page, $this_page) == 0)
{
if ($key >= 1) $prev_page = $merged_array[$key - 1];
if ($key < count($merged_array) - 1) $next_page = $merged_array[$key + 1];
break;
}
}
}
if (isset($prev_page)) $savant->assign('prev_page', $prev_page);
if (isset($next_page)) $savant->assign('next_page', $next_page);
$savant->assign('pages', $_pages);
$savant->assign('this_page', $this_page);
$savant->assign('base_path', TR_BASE_HREF);
$savant->assign('theme', $_SESSION['prefs']['PREF_THEME']);
$savant->display('include/handbook_header.tmpl.php');
?>