1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Class for tab navigation |
4
|
|
|
* |
5
|
|
|
* You may not change or alter any portion of this comment or credits |
6
|
|
|
* of supporting developers from this source code or any supporting source code |
7
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
8
|
|
|
* This program is distributed in the hope that it will be useful, |
9
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
10
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
11
|
|
|
* |
12
|
|
|
* @copyright (c) 2000-2016 XOOPS Project (www.xoops.org) |
13
|
|
|
* @license GNU GPL 2 (https://www.gnu.org/licenses/gpl-2.0.html) |
14
|
|
|
* @author John Neill (AKA Catzwolf) |
15
|
|
|
* @author Andricq Nicolas (AKA MusS) |
16
|
|
|
*/ |
17
|
|
|
|
18
|
|
|
// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Class SystemMenuHandler |
22
|
|
|
*/ |
23
|
|
|
class SystemMenuHandler |
24
|
|
|
{ |
25
|
|
|
/** |
26
|
|
|
* |
27
|
|
|
* @var string |
28
|
|
|
*/ |
29
|
|
|
public $_menutop = []; |
30
|
|
|
public $_menutabs = []; |
31
|
|
|
public $_obj; |
32
|
|
|
public $_header; |
33
|
|
|
public $_subheader; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Constructor |
37
|
|
|
*/ |
38
|
|
|
public function __construct() |
39
|
|
|
{ |
40
|
|
|
global $xoopsModule; |
41
|
|
|
$this->_obj = $xoopsModule; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @param $addon |
46
|
|
|
*/ |
47
|
|
|
public function getAddon($addon) |
48
|
|
|
{ |
49
|
|
|
$this->_obj =& $addon; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @param $value |
54
|
|
|
* @param string $name |
55
|
|
|
*/ |
56
|
|
|
public function addMenuTop($value, $name = '') |
57
|
|
|
{ |
58
|
|
|
if ($name !== '') { |
59
|
|
|
$this->_menutop[$value] = $name; |
60
|
|
|
} else { |
61
|
|
|
$this->_menutop[$value] = $value; |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @param $options |
67
|
|
|
* @param bool $multi |
68
|
|
|
*/ |
69
|
|
|
public function addMenuTopArray($options, $multi = true) |
70
|
|
|
{ |
71
|
|
|
if (is_array($options)) { |
72
|
|
|
if ($multi === true) { |
73
|
|
|
foreach ($options as $k => $v) { |
74
|
|
|
$this->addOptionTop($k, $v); |
|
|
|
|
75
|
|
|
} |
76
|
|
|
} else { |
77
|
|
|
foreach ($options as $k) { |
78
|
|
|
$this->addOptiontop($k, $k); |
|
|
|
|
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @param $value |
86
|
|
|
* @param string $name |
87
|
|
|
*/ |
88
|
|
|
public function addMenuTabs($value, $name = '') |
89
|
|
|
{ |
90
|
|
|
if ($name !== '') { |
91
|
|
|
$this->_menutabs[$value] = $name; |
92
|
|
|
} else { |
93
|
|
|
$this->_menutabs[$value] = $value; |
94
|
|
|
} |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @param $options |
99
|
|
|
* @param bool $multi |
100
|
|
|
*/ |
101
|
|
|
public function addMenuTabsArray($options, $multi = true) |
102
|
|
|
{ |
103
|
|
|
if (is_array($options)) { |
104
|
|
|
if ($multi === true) { |
105
|
|
|
foreach ($options as $k => $v) { |
106
|
|
|
$this->addMenuTabsTop($k, $v); |
|
|
|
|
107
|
|
|
} |
108
|
|
|
} else { |
109
|
|
|
foreach ($options as $k) { |
110
|
|
|
$this->addMenuTabsTop($k, $k); |
111
|
|
|
} |
112
|
|
|
} |
113
|
|
|
} |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @param $value |
118
|
|
|
*/ |
119
|
|
|
public function addHeader($value) |
120
|
|
|
{ |
121
|
|
|
$this->_header = $value; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @param $value |
126
|
|
|
*/ |
127
|
|
|
public function addSubHeader($value) |
128
|
|
|
{ |
129
|
|
|
$this->_subheader = $value; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @param string $basename |
134
|
|
|
* |
135
|
|
|
* @return string |
136
|
|
|
*/ |
137
|
|
|
public function breadcrumb_nav($basename = 'Home') |
138
|
|
|
{ |
139
|
|
|
global $bc_site, $bc_label; |
140
|
|
|
$site = $bc_site; |
141
|
|
|
$return_str = "<a href=\"/\">$basename</a>"; |
142
|
|
|
$str = substr(dirname(xoops_getenv('PHP_SELF')), 1); |
143
|
|
|
|
144
|
|
|
$arr = explode('/', $str); |
145
|
|
|
$num = count($arr); |
146
|
|
|
|
147
|
|
|
if ($num > 1) { |
148
|
|
|
foreach ($arr as $val) { |
149
|
|
|
$return_str .= ' > <a href="' . $site . $val . '/">' . $bc_label[$val] . '</a>'; |
150
|
|
|
$site .= $val . '/'; |
151
|
|
|
} |
152
|
|
|
} elseif ($num == 1) { |
153
|
|
|
$arr = $str; |
154
|
|
|
$return_str .= ' > <a href="' . $bc_site . $arr . '/">' . $bc_label[$arr] . '</a>'; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
return $return_str; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* @param int $currentoption |
162
|
|
|
* @param bool $display |
163
|
|
|
* |
164
|
|
|
* @return string |
165
|
|
|
*/ |
166
|
|
|
public function render($currentoption = 1, $display = true) |
|
|
|
|
167
|
|
|
{ |
168
|
|
|
global $modversion, $xoopsTpl; |
169
|
|
|
$_dirname = $this->_obj->getVar('dirname'); |
|
|
|
|
170
|
|
|
$i = 0; |
|
|
|
|
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* Select current menu tab, sets id names for menu tabs |
174
|
|
|
*/ |
175
|
|
|
$j=0; |
176
|
|
|
foreach ($this->_menutabs as $k => $menus) { |
177
|
|
|
if ($j == $currentoption) { |
178
|
|
|
$breadcrumb = $menus; |
179
|
|
|
} |
180
|
|
|
$menuItems[] = 'modmenu_' . $j++; |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
$xoopsTpl->assign('module_name', $this->_obj->getVar('name')); |
184
|
|
|
$xoopsTpl->assign('module_dirname', $this->_obj->getVar('dirname')); |
185
|
|
|
$xoopsTpl->assign('page', $breadcrumb); |
|
|
|
|
186
|
|
|
$xoopsTpl->assign('menutop', $this->_menutop); |
187
|
|
|
$xoopsTpl->assign('menutabs', $this->_menutabs); |
188
|
|
|
// Display Module Menu |
189
|
|
|
$xoopsTpl->display('db:system_modules_menu.tpl'); |
190
|
|
|
} |
191
|
|
|
} |
192
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.