|
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 = array(); |
|
30
|
|
|
public $_menutabs = array(); |
|
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; |
|
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
|
|
|
$menuItems[$currentoption] = 'current'; |
|
184
|
|
|
$menu = "<div id='buttontop_mod'>"; |
|
185
|
|
|
$menu .= "<table style='width: 100%; padding: 0;' cellspacing='0'>\n<tr>"; |
|
186
|
|
|
$menu .= "<td style='font-size: 10px; text-align: left; color: #2F5376; padding: 0 6px; line-height: 18px;'>"; |
|
187
|
|
|
foreach ($this->_menutop as $k => $v) { |
|
|
|
|
|
|
188
|
|
|
$menu .= " <a href=\"$k\">$v</a> |"; |
|
189
|
|
|
} |
|
190
|
|
|
$menu = substr($menu, 0, -1); |
|
191
|
|
|
|
|
192
|
|
|
$menu .= '</td>'; |
|
193
|
|
|
$menu .= "<td style='text-align: right;'><strong>" . $this->_obj->getVar('name') . '</strong> : ' . $breadcrumb . '</td>'; |
|
|
|
|
|
|
194
|
|
|
$menu .= "</tr>\n</table>\n"; |
|
195
|
|
|
$menu .= "</div>\n"; |
|
196
|
|
|
$menu .= "<div id='buttonbar_mod'><ul>"; |
|
197
|
|
|
foreach ($this->_menutabs as $k => $v) { |
|
198
|
|
|
$menu .= "<li id='" . $menuItems[$i] . "'><a href='" . XOOPS_URL . '/modules/' . $this->_obj->getVar('dirname') . '/' . $k . "'><span>$v</span></a></li>\n"; |
|
|
|
|
|
|
199
|
|
|
++$i; |
|
200
|
|
|
} |
|
201
|
|
|
$menu .= "</ul>\n</div>\n"; |
|
202
|
|
|
if ($this->_header) { |
|
203
|
|
|
$menu .= "<h4 class='admin_header'>"; |
|
204
|
|
|
if (isset($modversion['name'])) { |
|
205
|
|
|
if ($modversion['image'] && $this->_obj->getVar('mid') == 1) { |
|
206
|
|
|
$system_image = XOOPS_URL . '/modules/system/images/system/' . $modversion['image']; |
|
207
|
|
|
} else { |
|
208
|
|
|
$system_image = XOOPS_URL . '/modules/' . $_dirname . '/images/' . $modversion['image']; |
|
209
|
|
|
} |
|
210
|
|
|
$menu .= "<img src='$system_image' align='middle' height='32' width='32' alt='' />"; |
|
211
|
|
|
$menu .= ' ' . $modversion['name'] . "</h4>\n"; |
|
212
|
|
|
} else { |
|
213
|
|
|
$menu .= ' ' . $this->_header . "</h4>\n"; |
|
214
|
|
|
} |
|
215
|
|
|
} |
|
216
|
|
|
if ($this->_subheader) { |
|
217
|
|
|
$menu .= "<div class='admin_subheader'>" . $this->_subheader . "</div>\n"; |
|
218
|
|
|
} |
|
219
|
|
|
$menu .= '<div class="clear"> </div>'; |
|
220
|
|
|
unset($this->_obj); |
|
221
|
|
|
if ($display === true) { |
|
222
|
|
|
echo $menu; |
|
223
|
|
|
} else { |
|
224
|
|
|
return $menu; |
|
225
|
|
|
} |
|
226
|
|
|
|
|
227
|
|
|
return null; |
|
228
|
|
|
} |
|
229
|
|
|
} |
|
230
|
|
|
|
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.