1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @name ElkArte Forum |
5
|
|
|
* @copyright ElkArte Forum contributors |
6
|
|
|
* @license BSD http://opensource.org/licenses/BSD-3-Clause |
7
|
|
|
* |
8
|
|
|
* This file contains code covered by: |
9
|
|
|
* copyright: 2011 Simple Machines (http://www.simplemachines.org) |
10
|
|
|
* license: BSD, See included LICENSE.TXT for terms and conditions. |
11
|
|
|
* |
12
|
|
|
* @version 2.0 dev |
13
|
|
|
* |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* The sidebar menu option. Used for all admin, moderation, profile and PM pages. |
18
|
|
|
*/ |
19
|
|
|
function template_generic_menu_sidebar_above() |
20
|
|
|
{ |
21
|
|
|
global $context; |
22
|
|
|
|
23
|
|
|
// This is the main table - we need it so we can keep the content to the right of it. |
24
|
|
|
echo ' |
25
|
|
|
<div id="main_container"> |
26
|
|
|
<div id="menu_sidebar">'; |
27
|
|
|
|
28
|
|
|
// What one are we rendering? |
29
|
|
|
$context['cur_menu_id'] = isset($context['cur_menu_id']) ? $context['cur_menu_id'] + 1 : 1; |
30
|
|
|
$menu_context = &$context['menu_data_' . $context['cur_menu_id']]; |
31
|
|
|
|
32
|
|
|
// For every section that appears on the sidebar... |
33
|
|
|
foreach ($menu_context['sections'] as $section) |
34
|
|
|
{ |
35
|
|
|
// Show the section header - and pump up the line spacing for readability. |
36
|
|
|
echo ' |
37
|
|
|
<h2 class="category_header">', $section['label'], '</h2> |
38
|
|
|
<ul class="sidebar_menu">'; |
39
|
|
|
|
40
|
|
|
// For every area of this section show a link to that area (bold if it's currently selected.) |
41
|
|
View Code Duplication |
foreach ($section['areas'] as $i => $area) |
42
|
|
|
{ |
43
|
|
|
// Not supposed to be printed? |
44
|
|
|
if (empty($area['label'])) |
45
|
|
|
continue; |
46
|
|
|
|
47
|
|
|
echo ' |
48
|
|
|
<li class="listlevel1', !empty($area['subsections']) ? ' subsections" aria-haspopup="true"' : '"', '> |
49
|
|
|
<a class="linklevel1', !empty($area['selected']) ? ' chosen' : '', '" href="', $area['url'], '">', $area['label'], '</a>'; |
50
|
|
|
|
51
|
|
|
// Are there any subsections? |
52
|
|
|
if (!empty($area['subsections'])) |
53
|
|
|
{ |
54
|
|
|
echo ' |
55
|
|
|
<ul class="menulevel2">'; |
56
|
|
|
|
57
|
|
|
foreach ($area['subsections'] as $sub) |
58
|
|
|
{ |
59
|
|
|
if (!empty($sub['disabled'])) |
60
|
|
|
continue; |
61
|
|
|
|
62
|
|
|
echo ' |
63
|
|
|
<li class="listlevel2"> |
64
|
|
|
<a class="linklevel2', !empty($sub['selected']) ? ' chosen' : '', '" href="', $sub['url'], '">', $sub['label'], '</a> |
65
|
|
|
</li>'; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
echo ' |
69
|
|
|
</ul>'; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
echo ' |
73
|
|
|
</li>'; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
echo ' |
77
|
|
|
</ul>'; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
// This is where the actual "main content" area for the admin section starts. |
81
|
|
|
echo ' |
82
|
|
|
</div> |
83
|
|
|
<div id="main_admsection">'; |
84
|
|
|
|
85
|
|
|
// If there are any "tabs" setup, this is the place to shown them. |
86
|
|
|
if (empty($context['force_disable_tabs'])) |
87
|
|
|
template_generic_menu_tabs($menu_context['tab_data']); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Part of the sidebar layer - closes off the main bit. |
92
|
|
|
*/ |
93
|
|
|
function template_generic_menu_sidebar_below() |
94
|
|
|
{ |
95
|
|
|
echo ' |
96
|
|
|
</div> |
97
|
|
|
</div>'; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* The drop menu option. Used for all admin, moderation, profile and PM pages. |
102
|
|
|
*/ |
103
|
|
|
function template_generic_menu_dropdown_above() |
104
|
|
|
{ |
105
|
|
|
global $context; |
106
|
|
|
|
107
|
|
|
// Which menu are we rendering? |
108
|
|
|
$context['cur_menu_id'] = isset($context['cur_menu_id']) ? $context['cur_menu_id'] + 1 : 1; |
109
|
|
|
$menu_context = &$context['menu_data_' . $context['cur_menu_id']]; |
110
|
|
|
|
111
|
|
|
echo ' |
112
|
|
|
<ul class="admin_menu" id="dropdown_menu_', $context['cur_menu_id'], '">'; |
113
|
|
|
|
114
|
|
|
// Main areas first. |
115
|
|
|
foreach ($menu_context['sections'] as $section) |
116
|
|
|
{ |
117
|
|
|
echo ' |
118
|
|
|
<li class="listlevel1', !empty($section['areas']) ? ' subsections" aria-haspopup="true"' : '"', '> |
119
|
|
|
<a class="linklevel1', !empty($section['selected']) ? ' active' : '', '" href="', $section['url'], $menu_context['extra_parameters'], '">', $section['label'], '</a> |
120
|
|
|
<ul class="menulevel2">'; |
121
|
|
|
|
122
|
|
|
// For every area of this section show a link to that area (bold if it's currently selected.) |
123
|
|
|
// @todo Code for additional_items class was deprecated and has been removed. Suggest following up in Sources if required. |
124
|
|
View Code Duplication |
foreach ($section['areas'] as $area) |
125
|
|
|
{ |
126
|
|
|
// Not supposed to be printed? |
127
|
|
|
if (empty($area['label'])) |
128
|
|
|
continue; |
129
|
|
|
|
130
|
|
|
echo ' |
131
|
|
|
<li class="listlevel2', !empty($area['subsections']) ? ' subsections" aria-haspopup="true"' : '"', '> |
132
|
|
|
<a class="linklevel2', !empty($area['selected']) ? ' chosen' : '', '" href="', $area['url'], '">', $area['icon'], $area['label'], '</a>'; |
133
|
|
|
|
134
|
|
|
// Are there any subsections? |
135
|
|
|
if (!empty($area['subsections'])) |
136
|
|
|
{ |
137
|
|
|
echo ' |
138
|
|
|
<ul class="menulevel3">'; |
139
|
|
|
|
140
|
|
|
foreach ($area['subsections'] as $sub) |
141
|
|
|
{ |
142
|
|
|
if (!empty($sub['disabled'])) |
143
|
|
|
continue; |
144
|
|
|
|
145
|
|
|
echo ' |
146
|
|
|
<li class="listlevel3"> |
147
|
|
|
<a class="linklevel3', !empty($sub['selected']) ? ' chosen ' : '', '" href="', $sub['url'], '">', $sub['label'], '</a> |
148
|
|
|
</li>'; |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
echo ' |
152
|
|
|
</ul>'; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
echo ' |
156
|
|
|
</li>'; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
echo ' |
160
|
|
|
</ul> |
161
|
|
|
</li>'; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
echo ' |
165
|
|
|
</ul>'; |
166
|
|
|
|
167
|
|
|
// This is the main table - we need it so we can keep the content to the right of it. |
168
|
|
|
echo ' |
169
|
|
|
<div id="admin_content">'; |
170
|
|
|
|
171
|
|
|
// It's possible that some pages have their own tabs they wanna force... |
172
|
|
|
template_generic_menu_tabs($menu_context['tab_data']); |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
/** |
176
|
|
|
* Part of the admin layer - used with admin_above to close the table started in it. |
177
|
|
|
*/ |
178
|
|
|
function template_generic_menu_dropdown_below() |
179
|
|
|
{ |
180
|
|
|
echo ' |
181
|
|
|
</div>'; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* Some code for showing a tabbed view. |
186
|
|
|
* |
187
|
|
|
* @param array $tab_context |
188
|
|
|
*/ |
189
|
|
|
function template_generic_menu_tabs($tab_context) |
190
|
|
|
{ |
191
|
|
|
global $settings, $scripturl, $txt; |
192
|
|
|
|
193
|
|
|
if (!empty($tab_context['title'])) |
194
|
|
|
{ |
195
|
|
|
echo ' |
196
|
|
|
<div class="category_header"> |
197
|
|
|
<h3 class="floatleft">'; |
198
|
|
|
|
199
|
|
|
// Show an icon and/or a help item? |
200
|
|
|
if (!empty($tab_context['icon'])) |
201
|
|
|
echo ' |
202
|
|
|
<img src="', $settings['images_url'], '/icons/', $tab_context['icon'], '" alt="" class="icon" />'; |
203
|
|
|
|
204
|
|
|
elseif (!empty($tab_context['class'])) |
205
|
|
|
echo ' |
206
|
|
|
<span class="hdicon cat_img_', $tab_context['class'], '"></span>'; |
207
|
|
|
|
208
|
|
|
if (!empty($tab_context['help'])) |
209
|
|
|
echo ' |
210
|
|
|
<a class="hdicon cat_img_helptopics help" href="', $scripturl, '?action=quickhelp;help=', $tab_context['help'], '" onclick="return reqOverlayDiv(this.href);" label="', $txt['help'], '"></a>'; |
211
|
|
|
|
212
|
|
|
echo ' |
213
|
|
|
', $tab_context['title'], ' |
214
|
|
|
</h3>'; |
215
|
|
|
|
216
|
|
|
// The function is in Admin.template.php, but since this template is used elsewhere, |
217
|
|
|
// we need to check if the function is available. |
218
|
|
|
if (function_exists('template_admin_quick_search')) |
219
|
|
|
template_admin_quick_search(); |
220
|
|
|
echo ' |
221
|
|
|
</div>'; |
222
|
|
|
} |
223
|
|
|
|
224
|
|
|
if (!empty($tab_context['description'])) |
225
|
|
|
echo ' |
226
|
|
|
<p class="description"> |
227
|
|
|
', $tab_context['description'], ' |
228
|
|
|
</p>'; |
229
|
|
|
|
230
|
|
|
// Print out all the items in this tab (if any). |
231
|
|
|
if (!empty($tab_context['tabs'])) |
232
|
|
|
{ |
233
|
|
|
// The admin tabs. |
234
|
|
|
echo ' |
235
|
|
|
<ul id="adm_submenus">'; |
236
|
|
|
|
237
|
|
|
foreach ($tab_context['tabs'] as $tab) |
238
|
|
|
{ |
239
|
|
|
if (!empty($tab['disabled'])) |
240
|
|
|
continue; |
241
|
|
|
|
242
|
|
|
echo ' |
243
|
|
|
<li class="listlevel1"> |
244
|
|
|
<a class="linklevel1', !empty($tab['selected']) ? ' active' : '', '" href="', $tab['url'], $tab['add_params'] ?? '', '">', $tab['label'], '</a> |
245
|
|
|
</li>'; |
246
|
|
|
} |
247
|
|
|
|
248
|
|
|
// the end of tabs |
249
|
|
|
echo ' |
250
|
|
|
</ul>'; |
251
|
|
|
} |
252
|
|
|
} |