1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
---|
3 | # |
---|
4 | # This file is part of Dotclear 2. |
---|
5 | # |
---|
6 | # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear |
---|
7 | # Licensed under the GPL version 2.0 license. |
---|
8 | # See LICENSE file or |
---|
9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
10 | # |
---|
11 | # -- END LICENSE BLOCK ----------------------------------------- |
---|
12 | if (!defined('DC_CONTEXT_ADMIN')) { return; } |
---|
13 | |
---|
14 | dcPage::check('admin'); |
---|
15 | |
---|
16 | $page_title = __('Simple menu'); |
---|
17 | |
---|
18 | # Url de base |
---|
19 | $p_url = 'plugin.php?p=simpleMenu'; |
---|
20 | |
---|
21 | # Url du blog |
---|
22 | $blog_url = html::stripHostURL($core->blog->url); |
---|
23 | |
---|
24 | # Liste des catégories |
---|
25 | $categories_combo = array(); |
---|
26 | $categories_label = array(); |
---|
27 | try { |
---|
28 | $rs = $core->blog->getCategories(array('post_type'=>'post')); |
---|
29 | while ($rs->fetch()) { |
---|
30 | $categories_combo[] = new formSelectOption( |
---|
31 | str_repeat(' ',$rs->level-1).($rs->level-1 == 0 ? '' : '• ').html::escapeHTML($rs->cat_title), |
---|
32 | $rs->cat_url |
---|
33 | ); |
---|
34 | $categories_label[$rs->cat_url] = html::escapeHTML($rs->cat_title); |
---|
35 | } |
---|
36 | } catch (Exception $e) { } |
---|
37 | |
---|
38 | # Liste des langues utilisées |
---|
39 | $langs_combo = array(); |
---|
40 | try { |
---|
41 | $rs = $core->blog->getLangs(array('order'=>'asc')); |
---|
42 | if ($rs->count() > 1) |
---|
43 | { |
---|
44 | $all_langs = l10n::getISOcodes(0,1); |
---|
45 | while ($rs->fetch()) { |
---|
46 | $lang_name = isset($all_langs[$rs->post_lang]) ? $all_langs[$rs->post_lang] : $rs->post_lang; |
---|
47 | $langs_combo[$lang_name] = $rs->post_lang; |
---|
48 | } |
---|
49 | unset($all_langs); |
---|
50 | } |
---|
51 | unset($rs); |
---|
52 | } catch (Exception $e) { } |
---|
53 | |
---|
54 | # Liste des mois d'archive |
---|
55 | $months_combo = array(); |
---|
56 | try { |
---|
57 | $rs = $core->blog->getDates(array('type'=>'month')); |
---|
58 | $months_combo[__('All months')] = '-'; |
---|
59 | $first_year = $last_year = 0; |
---|
60 | while ($rs->fetch()) { |
---|
61 | $months_combo[dt::str('%B %Y',$rs->ts())] = $rs->year().$rs->month(); |
---|
62 | if (($first_year == 0) || ($rs->year() < $first_year)) $first_year = $rs->year(); |
---|
63 | if (($last_year == 0) || ($rs->year() > $last_year)) $last_year = $rs->year(); |
---|
64 | } |
---|
65 | unset($rs); |
---|
66 | } catch (Exception $e) { } |
---|
67 | |
---|
68 | # Liste des pages -- Doit être pris en charge plus tard par le plugin ? |
---|
69 | $pages_combo = array(); |
---|
70 | try { |
---|
71 | $rs = $core->blog->getPosts(array('post_type'=>'page')); |
---|
72 | while ($rs->fetch()) { |
---|
73 | $pages_combo[$rs->post_title] = $rs->getURL(); |
---|
74 | } |
---|
75 | unset($rs); |
---|
76 | } catch (Exception $e) { } |
---|
77 | |
---|
78 | # Liste des tags -- Doit être pris en charge plus tard par le plugin ? |
---|
79 | $tags_combo = array(); |
---|
80 | try { |
---|
81 | $rs = $core->meta->getMetadata(array('meta_type' => 'tag')); |
---|
82 | $tags_combo[__('All tags')] = '-'; |
---|
83 | while ($rs->fetch()) { |
---|
84 | $tags_combo[$rs->meta_id] = $rs->meta_id; |
---|
85 | } |
---|
86 | unset($rs); |
---|
87 | } catch (Exception $e) { } |
---|
88 | |
---|
89 | # Liste des types d'item de menu |
---|
90 | $items = new ArrayObject(); |
---|
91 | $items['home'] = new ArrayObject(array(__('Home'),false)); |
---|
92 | |
---|
93 | if (count($langs_combo) > 1) { |
---|
94 | $items['lang'] = new ArrayObject(array(__('Language'),true)); |
---|
95 | } |
---|
96 | if (count($categories_combo)) { |
---|
97 | $items['category'] = new ArrayObject(array(__('Category'),true)); |
---|
98 | } |
---|
99 | if (count($months_combo) > 1) { |
---|
100 | $items['archive'] = new ArrayObject(array(__('Archive'),true)); |
---|
101 | } |
---|
102 | if ($core->plugins->moduleExists('pages')) { |
---|
103 | if(count($pages_combo)) |
---|
104 | $items['pages'] = new ArrayObject(array(__('Page'),true)); |
---|
105 | } |
---|
106 | if ($core->plugins->moduleExists('tags')) { |
---|
107 | if (count($tags_combo) > 1) |
---|
108 | $items['tags'] = new ArrayObject(array(__('Tags'),true)); |
---|
109 | } |
---|
110 | |
---|
111 | # --BEHAVIOR-- adminSimpleMenuAddType |
---|
112 | # Should add an item to $items[<id>] as an array(<label>,<optional step (true or false)>) |
---|
113 | $core->callBehavior('adminSimpleMenuAddType',$items); |
---|
114 | |
---|
115 | $items['special'] = new ArrayObject(array(__('User defined'),false)); |
---|
116 | |
---|
117 | $items_combo = array(); |
---|
118 | foreach ($items as $k => $v) { |
---|
119 | $items_combo[$v[0]] = $k; |
---|
120 | } |
---|
121 | |
---|
122 | # Lecture menu existant |
---|
123 | $menu = $core->blog->settings->system->get('simpleMenu'); |
---|
124 | $menu = @unserialize($menu); |
---|
125 | if (!is_array($menu)) { |
---|
126 | $menu = array(); |
---|
127 | } |
---|
128 | |
---|
129 | # Récupération paramètres postés |
---|
130 | $item_type = isset($_POST['item_type']) ? $_POST['item_type'] : ''; |
---|
131 | $item_select = isset($_POST['item_select']) ? $_POST['item_select'] : ''; |
---|
132 | $item_label = isset($_POST['item_label']) ? $_POST['item_label'] : ''; |
---|
133 | $item_descr = isset($_POST['item_descr']) ? $_POST['item_descr'] : ''; |
---|
134 | $item_url = isset($_POST['item_url']) ? $_POST['item_url'] : ''; |
---|
135 | |
---|
136 | # Traitement |
---|
137 | $step = (!empty($_GET['add']) ? (integer) $_GET['add'] : 0); |
---|
138 | if (($step > 4) || ($step < 0)) $step = 0; |
---|
139 | if ($step) { |
---|
140 | |
---|
141 | # Récupération libellés des choix |
---|
142 | $item_type_label = isset($items[$item_type]) ? $items[$item_type][0] : ''; |
---|
143 | |
---|
144 | switch ($step) { |
---|
145 | case 1: |
---|
146 | // First step, menu item type to be selected |
---|
147 | $item_type = $item_select = ''; |
---|
148 | break; |
---|
149 | case 2: |
---|
150 | if ($items[$item_type][1]) { |
---|
151 | // Second step (optional), menu item sub-type to be selected |
---|
152 | $item_select = ''; |
---|
153 | break; |
---|
154 | } |
---|
155 | case 3: |
---|
156 | // Third step, menu item attributes to be changed or completed if necessary |
---|
157 | $item_select_label = ''; |
---|
158 | $item_label = __('Label'); |
---|
159 | $item_descr = __('Description'); |
---|
160 | $item_url = $blog_url; |
---|
161 | switch ($item_type) { |
---|
162 | case 'home': |
---|
163 | $item_label = __('Home'); |
---|
164 | $item_descr = __('Recent posts'); |
---|
165 | break; |
---|
166 | case 'lang': |
---|
167 | $item_select_label = array_search($item_select,$langs_combo); |
---|
168 | $item_label = $item_select_label; |
---|
169 | $item_descr = sprintf(__('Switch to %s language'),$item_select_label); |
---|
170 | $item_url .= $core->url->getURLFor('lang',$item_select); |
---|
171 | break; |
---|
172 | case 'category': |
---|
173 | $item_select_label = $categories_label[$item_select]; |
---|
174 | $item_label = $item_select_label; |
---|
175 | $item_descr = __('Recent Posts from this category'); |
---|
176 | $item_url .= $core->url->getURLFor('category',$item_select); |
---|
177 | break; |
---|
178 | case 'archive': |
---|
179 | $item_select_label = array_search($item_select,$months_combo); |
---|
180 | if ($item_select == '-') { |
---|
181 | $item_label = __('Archives'); |
---|
182 | $item_descr = $first_year.($first_year != $last_year ? ' - '.$last_year : ''); |
---|
183 | $item_url .= $core->url->getURLFor('archive'); |
---|
184 | } else { |
---|
185 | $item_label = $item_select_label; |
---|
186 | $item_descr = sprintf(__('Posts from %s'),$item_select_label); |
---|
187 | $item_url .= $core->url->getURLFor('archive',substr($item_select,0,4).'/'.substr($item_select,-2)); |
---|
188 | } |
---|
189 | break; |
---|
190 | case 'pages': |
---|
191 | $item_select_label = array_search($item_select,$pages_combo); |
---|
192 | $item_label = $item_select_label; |
---|
193 | $item_descr = ''; |
---|
194 | $item_url = html::stripHostURL($item_select); |
---|
195 | break; |
---|
196 | case 'tags': |
---|
197 | $item_select_label = array_search($item_select,$tags_combo); |
---|
198 | if ($item_select == '-') { |
---|
199 | $item_label = __('All tags'); |
---|
200 | $item_descr = ''; |
---|
201 | $item_url .= $core->url->getURLFor('tags'); |
---|
202 | } else { |
---|
203 | $item_label = $item_select_label; |
---|
204 | $item_descr = sprintf(__('Recent posts for %s tag'),$item_select_label); |
---|
205 | $item_url .= $core->url->getURLFor('tag',$item_select); |
---|
206 | } |
---|
207 | break; |
---|
208 | case 'special': |
---|
209 | break; |
---|
210 | default: |
---|
211 | # --BEHAVIOR-- adminSimpleMenuBeforeEdit |
---|
212 | # Should modify if necessary $item_label, $item_descr and $item_url |
---|
213 | # Should set if necessary $item_select_label (displayed on further admin step only) |
---|
214 | $core->callBehavior('adminSimpleMenuBeforeEdit',$item_type,$item_select, |
---|
215 | array(&$item_label,&$item_descr,&$item_url,&$item_select_label)); |
---|
216 | break; |
---|
217 | } |
---|
218 | break; |
---|
219 | case 4: |
---|
220 | // Fourth step, menu item to be added |
---|
221 | try { |
---|
222 | if (($item_label != '') && ($item_url != '')) |
---|
223 | { |
---|
224 | // Add new item menu in menu array |
---|
225 | $menu[] = array( |
---|
226 | 'label' => $item_label, |
---|
227 | 'descr' => $item_descr, |
---|
228 | 'url' => $item_url |
---|
229 | ); |
---|
230 | // Save menu in blog settings |
---|
231 | $core->blog->settings->system->put('simpleMenu',serialize($menu)); |
---|
232 | $core->blog->triggerBlog(); |
---|
233 | |
---|
234 | // All done successfully, return to menu items list |
---|
235 | http::redirect($p_url.'&added=1'); |
---|
236 | } else { |
---|
237 | throw new Exception(__('Label and URL of menu item are mandatory.')); |
---|
238 | } |
---|
239 | } |
---|
240 | catch (Exception $e) { |
---|
241 | $core->error->add($e->getMessage()); |
---|
242 | } |
---|
243 | break; |
---|
244 | } |
---|
245 | } else { |
---|
246 | |
---|
247 | # Remove selected menu items |
---|
248 | if (!empty($_POST['removeaction'])) |
---|
249 | { |
---|
250 | try { |
---|
251 | if (!empty($_POST['items_selected'])) { |
---|
252 | foreach ($_POST['items_selected'] as $k => $v) { |
---|
253 | $menu[$v]['label'] = ''; |
---|
254 | } |
---|
255 | $newmenu = array(); |
---|
256 | foreach ($menu as $k => $v) { |
---|
257 | if ($v['label']) { |
---|
258 | $newmenu[] = array( |
---|
259 | 'label' => $v['label'], |
---|
260 | 'descr' => $v['descr'], |
---|
261 | 'url' => $v['url']); |
---|
262 | } |
---|
263 | } |
---|
264 | $menu = $newmenu; |
---|
265 | // Save menu in blog settings |
---|
266 | $core->blog->settings->system->put('simpleMenu',serialize($menu)); |
---|
267 | $core->blog->triggerBlog(); |
---|
268 | |
---|
269 | // All done successfully, return to menu items list |
---|
270 | http::redirect($p_url.'&removed=1'); |
---|
271 | } else { |
---|
272 | throw new Exception(__('No menu items selected.')); |
---|
273 | } |
---|
274 | } |
---|
275 | catch (Exception $e) { |
---|
276 | $core->error->add($e->getMessage()); |
---|
277 | } |
---|
278 | } |
---|
279 | |
---|
280 | # Update menu items |
---|
281 | if (!empty($_POST['updateaction'])) |
---|
282 | { |
---|
283 | try { |
---|
284 | foreach ($_POST['items_label'] as $k => $v) { |
---|
285 | if (!$v) throw new Exception(__('Label is mandatory.')); |
---|
286 | } |
---|
287 | foreach ($_POST['items_url'] as $k => $v) { |
---|
288 | if (!$v) throw new Exception(__('URL is mandatory.')); |
---|
289 | } |
---|
290 | $newmenu = array(); |
---|
291 | for ($i = 0; $i < count($_POST['items_label']); $i++) |
---|
292 | { |
---|
293 | $newmenu[] = array( |
---|
294 | 'label' => $_POST['items_label'][$i], |
---|
295 | 'descr' => $_POST['items_descr'][$i], |
---|
296 | 'url' => $_POST['items_url'][$i]); |
---|
297 | } |
---|
298 | $menu = $newmenu; |
---|
299 | // Save menu in blog settings |
---|
300 | $core->blog->settings->system->put('simpleMenu',serialize($menu)); |
---|
301 | $core->blog->triggerBlog(); |
---|
302 | |
---|
303 | // All done successfully, return to menu items list |
---|
304 | http::redirect($p_url.'&updated=1'); |
---|
305 | } |
---|
306 | catch (Exception $e) { |
---|
307 | $core->error->add($e->getMessage()); |
---|
308 | } |
---|
309 | } |
---|
310 | |
---|
311 | # Order menu items |
---|
312 | $order = array(); |
---|
313 | if (empty($_POST['im_order']) && !empty($_POST['order'])) { |
---|
314 | $order = $_POST['order']; |
---|
315 | asort($order); |
---|
316 | $order = array_keys($order); |
---|
317 | } elseif (!empty($_POST['im_order'])) { |
---|
318 | $order = $_POST['im_order']; |
---|
319 | if (substr($order,-1) == ',') { |
---|
320 | $order = substr($order,0,strlen($order)-1); |
---|
321 | } |
---|
322 | $order = explode(',',$order); |
---|
323 | } |
---|
324 | |
---|
325 | if (!empty($_POST['updateaction']) && !empty($order)) |
---|
326 | { |
---|
327 | try { |
---|
328 | $newmenu = array(); |
---|
329 | foreach ($order as $i => $k) { |
---|
330 | $newmenu[] = array( |
---|
331 | 'label' => $menu[$k]['label'], |
---|
332 | 'descr' => $menu[$k]['descr'], |
---|
333 | 'url' => $menu[$k]['url']); |
---|
334 | } |
---|
335 | $menu = $newmenu; |
---|
336 | // Save menu in blog settings |
---|
337 | $core->blog->settings->system->put('simpleMenu',serialize($menu)); |
---|
338 | $core->blog->triggerBlog(); |
---|
339 | |
---|
340 | // All done successfully, return to menu items list |
---|
341 | http::redirect($p_url.'&neworder=1'); |
---|
342 | } |
---|
343 | catch (Exception $e) { |
---|
344 | $core->error->add($e->getMessage()); |
---|
345 | } |
---|
346 | } |
---|
347 | |
---|
348 | } |
---|
349 | |
---|
350 | # Display |
---|
351 | ?> |
---|
352 | |
---|
353 | <html> |
---|
354 | <head> |
---|
355 | <title><?php echo $page_title; ?></title> |
---|
356 | <?php |
---|
357 | $core->auth->user_prefs->addWorkspace('accessibility'); |
---|
358 | if (!$core->auth->user_prefs->accessibility->nodragdrop) { |
---|
359 | echo |
---|
360 | dcPage::jsLoad('js/jquery/jquery-ui.custom.js'). |
---|
361 | dcPage::jsLoad('index.php?pf=simpleMenu/simplemenu.js'); |
---|
362 | } |
---|
363 | ?> |
---|
364 | </head> |
---|
365 | |
---|
366 | <body> |
---|
367 | |
---|
368 | <?php |
---|
369 | |
---|
370 | if ($step) { |
---|
371 | echo dcPage::breadcrumb( |
---|
372 | array( |
---|
373 | html::escapeHTML($core->blog->name) => '', |
---|
374 | $page_title => $p_url, |
---|
375 | '<span class="page-title">'.__('Add item').'</span>' => '' |
---|
376 | )); |
---|
377 | } else { |
---|
378 | echo dcPage::breadcrumb( |
---|
379 | array( |
---|
380 | html::escapeHTML($core->blog->name) => '', |
---|
381 | '<span class="page-title">'.$page_title.'</span>' => '' |
---|
382 | )); |
---|
383 | } |
---|
384 | |
---|
385 | if (!empty($_GET['added'])) { |
---|
386 | dcPage::message(__('Menu item has been successfully added.')); |
---|
387 | } |
---|
388 | if (!empty($_GET['removed'])) { |
---|
389 | dcPage::message(__('Menu items have been successfully removed.')); |
---|
390 | } |
---|
391 | if (!empty($_GET['neworder'])) { |
---|
392 | dcPage::message(__('Menu items have been successfully updated.')); |
---|
393 | } |
---|
394 | if (!empty($_GET['updated'])) { |
---|
395 | dcPage::message(__('Menu items have been successfully updated.')); |
---|
396 | } |
---|
397 | |
---|
398 | if ($step) |
---|
399 | { |
---|
400 | // Formulaire d'ajout d'un item |
---|
401 | switch ($step) { |
---|
402 | case 1: |
---|
403 | // Selection du type d'item |
---|
404 | echo '<form id="additem" action="'.$p_url.'&add=2" method="post">'; |
---|
405 | echo '<fieldset><legend>'.__('Select type').'</legend>'; |
---|
406 | echo '<p class="field"><label for="item_type" class="classic">'.__('Type of item menu:').'</label>'.form::combo('item_type',$items_combo,'').'</p>'; |
---|
407 | echo '<p>'.$core->formNonce().'<input type="submit" name="appendaction" value="'.__('Continue...').'" />'.'</p>'; |
---|
408 | echo '</fieldset>'; |
---|
409 | echo '</form>'; |
---|
410 | break; |
---|
411 | case 2: |
---|
412 | if ($items[$item_type][1]) { |
---|
413 | // Choix à faire |
---|
414 | echo '<form id="additem" action="'.$p_url.'&add=3" method="post">'; |
---|
415 | echo '<fieldset><legend>'.$item_type_label.'</legend>'; |
---|
416 | switch ($item_type) { |
---|
417 | case 'lang': |
---|
418 | echo '<p class="field"><label for="item_select" class="classic">'.__('Select language:').'</label>'. |
---|
419 | form::combo('item_select',$langs_combo,''); |
---|
420 | break; |
---|
421 | case 'category': |
---|
422 | echo '<p class="field"><label for="item_select" class="classic">'.__('Select category:').'</label>'. |
---|
423 | form::combo('item_select',$categories_combo,''); |
---|
424 | break; |
---|
425 | case 'archive': |
---|
426 | echo '<p class="field"><label for="item_select" class="classic">'.__('Select month (if necessary):').'</label>'. |
---|
427 | form::combo('item_select',$months_combo,''); |
---|
428 | break; |
---|
429 | case 'pages': |
---|
430 | echo '<p class="field"><label for="item_select" class="classic">'.__('Select page:').'</label>'. |
---|
431 | form::combo('item_select',$pages_combo,''); |
---|
432 | break; |
---|
433 | case 'tags': |
---|
434 | echo '<p class="field"><label for="item_select" class="classic">'.__('Select tag (if necessary):').'</label>'. |
---|
435 | form::combo('item_select',$tags_combo,''); |
---|
436 | break; |
---|
437 | default: |
---|
438 | echo |
---|
439 | # --BEHAVIOR-- adminSimpleMenuSelect |
---|
440 | # Optional step once $item_type known : should provide a field using 'item_select' as id |
---|
441 | $core->callBehavior('adminSimpleMenuSelect',$item_type,'item_select'); |
---|
442 | } |
---|
443 | echo form::hidden('item_type',$item_type); |
---|
444 | echo '<p>'.$core->formNonce().'<input type="submit" name="appendaction" value="'.__('Continue...').'" /></p>'; |
---|
445 | echo '</fieldset>'; |
---|
446 | echo '</form>'; |
---|
447 | break; |
---|
448 | } |
---|
449 | case 3: |
---|
450 | // Libellé et description |
---|
451 | echo '<form id="additem" action="'.$p_url.'&add=4" method="post">'; |
---|
452 | echo '<fieldset><legend>'.$item_type_label.($item_select_label != '' ? ' ('.$item_select_label.')' : '').'</legend>'; |
---|
453 | echo '<p class="field"><label for="item_label" class="classic required"><abbr title="'.__('Required field').'">*</abbr> '. |
---|
454 | __('Label of item menu:').'</label>'.form::field('item_label',20,255,$item_label).'</p>'; |
---|
455 | echo '<p class="field"><label for="item_descr" class="classic">'. |
---|
456 | __('Description of item menu:').'</label>'.form::field('item_descr',30,255,$item_descr).'</p>'; |
---|
457 | echo '<p class="field"><label for="item_url" class="classic required"><abbr title="'.__('Required field').'">*</abbr> '. |
---|
458 | __('URL of item menu:').'</label>'.form::field('item_url',40,255,$item_url).'</p>'; |
---|
459 | echo form::hidden('item_type',$item_type).form::hidden('item_select',$item_select); |
---|
460 | echo '<p>'.$core->formNonce().'<input type="submit" name="appendaction" value="'.__('Add this item').'" /></p>'; |
---|
461 | echo '</fieldset>'; |
---|
462 | echo '</form>'; |
---|
463 | break; |
---|
464 | } |
---|
465 | } |
---|
466 | |
---|
467 | // Liste des items |
---|
468 | if (!$step) { |
---|
469 | echo '<form id="menuitemsappend" action="'.$p_url.'&add=1" method="post">'; |
---|
470 | echo '<p class="top-add">'.$core->formNonce().'<input class="button add" type="submit" name="appendaction" value="'.__('Add an item').'" /></p>'; |
---|
471 | echo '</form>'; |
---|
472 | } |
---|
473 | |
---|
474 | if (count($menu)) { |
---|
475 | if (!$step) { |
---|
476 | echo '<form id="menuitems" action="'.$p_url.'" method="post">'; |
---|
477 | } |
---|
478 | // Entête table |
---|
479 | echo |
---|
480 | '<table class="maximal dragable">'. |
---|
481 | '<caption>'.__('Menu items list').'</caption>'. |
---|
482 | '<thead>'. |
---|
483 | '<tr>'; |
---|
484 | if (!$step) { |
---|
485 | echo '<th scope="col"></th>'; |
---|
486 | echo '<th scope="col"></th>'; |
---|
487 | } |
---|
488 | echo |
---|
489 | '<th scope="col">'.__('Label').'</th>'. |
---|
490 | '<th scope="col">'.__('Description').'</th>'. |
---|
491 | '<th scope="col">'.__('URL').'</th>'. |
---|
492 | '</tr>'. |
---|
493 | '</thead>'. |
---|
494 | '<tbody id="menuitemslist">'; |
---|
495 | $count = 0; |
---|
496 | foreach ($menu as $i => $m) { |
---|
497 | echo '<tr class="line" id="l_'.$i.'">'; |
---|
498 | if (!$step) { |
---|
499 | $count++; |
---|
500 | echo '<td class="handle minimal">'.form::field(array('order['.$i.']'),2,3,$count,'position','',false,'title="'.sprintf(__('position of %s'),__($m['label'])).'"'). |
---|
501 | form::hidden(array('dynorder[]','dynorder-'.$i),$i).'</td>'; |
---|
502 | echo '<td class="minimal">'.form::checkbox(array('items_selected[]','ims-'.$i),$i).'</td>'; |
---|
503 | echo '<td class="nowrap" scope="row">'.form::field(array('items_label[]','iml-'.$i),20,255,__($m['label'])).'</td>'; |
---|
504 | echo '<td class="nowrap">'.form::field(array('items_descr[]','imd-'.$i),30,255,__($m['descr'])).'</td>'; |
---|
505 | echo '<td class="nowrap">'.form::field(array('items_url[]','imu-'.$i),40,255,$m['url']).'</td>'; |
---|
506 | } else { |
---|
507 | echo '<td class="nowrap" scope="row">'.__($m['label']).'</td>'; |
---|
508 | echo '<td class="nowrap">'.__($m['descr']).'</td>'; |
---|
509 | echo '<td class="nowrap">'.$m['url'].'</td>'; |
---|
510 | } |
---|
511 | echo '</tr>'; |
---|
512 | } |
---|
513 | echo '</tbody>'. |
---|
514 | '</table>'; |
---|
515 | if (!$step) { |
---|
516 | echo '<div class="two-cols">'; |
---|
517 | echo '<p class="col">'.form::hidden('im_order','').$core->formNonce(); |
---|
518 | echo '<input type="submit" name="updateaction" value="'.__('Update menu').'" />'.'</p>'; |
---|
519 | echo '<p class="col right">'.'<input type="submit" class="delete" name="removeaction" '. |
---|
520 | 'value="'.__('Delete selected menu items').'" '. |
---|
521 | 'onclick="return window.confirm(\''.html::escapeJS(__('Are you sure you want to remove selected menu items?')).'\');" />'. |
---|
522 | '</p>'; |
---|
523 | echo '</div>'; |
---|
524 | echo '</form>'; |
---|
525 | } |
---|
526 | } else { |
---|
527 | echo |
---|
528 | '<p>'.__('Currently no menu items').'</p>'; |
---|
529 | } |
---|
530 | |
---|
531 | dcPage::helpBlock('simpleMenu'); |
---|
532 | ?> |
---|
533 | |
---|
534 | </body> |
---|
535 | </html> |
---|