dolibarr 21.0.0-alpha
edit.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
3 * Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2009-2011 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2016 Meziane Sof <virtualsof@yahoo.fr>
6 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
28// Load Dolibarr environment
29require '../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
31require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
32
33// Load translation files required by the page
34$langs->loadLangs(array("other", "admin"));
35
36$cancel = GETPOST('cancel', 'alphanohtml'); // We click on a Cancel button
37$confirm = GETPOST('confirm');
38
39if (!$user->admin) {
41}
42
43$dirstandard = array();
44$dirsmartphone = array();
45$dirmenus = array_merge(array("/core/menus/"), (array) $conf->modules_parts['menus']);
46foreach ($dirmenus as $dirmenu) {
47 $dirstandard[] = $dirmenu.'standard';
48 $dirsmartphone[] = $dirmenu.'smartphone';
49}
50
51$action = GETPOST('action', 'aZ09');
52
53$menu = null;
54$menu_handler_top = getDolGlobalString('MAIN_MENU_STANDARD');
55$menu_handler_smartphone = getDolGlobalString('MAIN_MENU_SMARTPHONE');
56$menu_handler_top = preg_replace('/_backoffice.php/i', '', $menu_handler_top);
57$menu_handler_top = preg_replace('/_frontoffice.php/i', '', $menu_handler_top);
58$menu_handler_smartphone = preg_replace('/_backoffice.php/i', '', $menu_handler_smartphone);
59$menu_handler_smartphone = preg_replace('/_frontoffice.php/i', '', $menu_handler_smartphone);
60
61$menu_handler = $menu_handler_top;
62
63if (GETPOST("handler_origine")) {
64 $menu_handler = GETPOST("handler_origine");
65}
66if (GETPOST("menu_handler")) {
67 $menu_handler = GETPOST("menu_handler");
68}
69
70
71
72/*
73 * Actions
74 */
75
76if ($action == 'add') {
77 if ($cancel) {
78 header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
79 exit;
80 }
81
82 $leftmenu = '';
83 $mainmenu = '';
84 if (GETPOST('menuIdParent', 'alphanohtml') && !is_numeric(GETPOST('menuIdParent', 'alphanohtml'))) {
85 $tmp = explode('&', GETPOST('menuIdParent', 'alphanohtml'));
86 foreach ($tmp as $s) {
87 if (preg_match('/fk_mainmenu=/', $s)) {
88 $mainmenu = preg_replace('/fk_mainmenu=/', '', $s);
89 }
90 if (preg_match('/fk_leftmenu=/', $s)) {
91 $leftmenu = preg_replace('/fk_leftmenu=/', '', $s);
92 }
93 }
94 }
95
96 $langs->load("errors");
97
98 $error = 0;
99 if (!$error && !GETPOST('menu_handler')) {
100 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("MenuHandler")), null, 'errors');
101 $action = 'create';
102 $error++;
103 }
104 if (!$error && !GETPOST('type')) {
105 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Position")), null, 'errors');
106 $action = 'create';
107 $error++;
108 }
109 if (!$error && !GETPOST('url')) {
110 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("URL")), null, 'errors');
111 $action = 'create';
112 $error++;
113 }
114 if (!$error && !GETPOST('titre')) {
115 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Title")), null, 'errors');
116 $action = 'create';
117 $error++;
118 }
119 if (!$error && GETPOST('menuIdParent', 'alphanohtml') && GETPOST('type') == 'top') {
120 setEventMessages($langs->trans("ErrorTopMenuMustHaveAParentWithId0"), null, 'errors');
121 $action = 'create';
122 $error++;
123 }
124 if (!$error && !GETPOST('menuIdParent', 'alphanohtml') && GETPOST('type') == 'left') {
125 setEventMessages($langs->trans("ErrorLeftMenuMustHaveAParentId"), null, 'errors');
126 $action = 'create';
127 $error++;
128 }
129
130 if (!$error) {
131 $menu = new Menubase($db);
132 $menu->menu_handler = preg_replace('/_menu$/', '', GETPOST('menu_handler', 'aZ09'));
133 $menu->type = (string) GETPOST('type', 'alphanohtml');
134 $menu->title = (string) GETPOST('titre', 'alphanohtml');
135 $menu->prefix = (string) GETPOST('picto', 'restricthtmlallowclass');
136 $menu->url = (string) GETPOST('url', 'alphanohtml');
137 $menu->langs = (string) GETPOST('langs', 'alphanohtml');
138 $menu->position = GETPOSTINT('position');
139 $menu->enabled = (string) GETPOST('enabled', 'alphanohtml');
140 $menu->perms = (string) GETPOST('perms', 'alphanohtml');
141 $menu->target = (string) GETPOST('target', 'alphanohtml');
142 $menu->user = GETPOSTINT('user');
143 $menu->mainmenu = (string) GETPOST('propertymainmenu', 'alphanohtml');
144 if (is_numeric(GETPOST('menuIdParent', 'alphanohtml'))) {
145 $menu->fk_menu = (int) GETPOST('menuIdParent', 'alphanohtml');
146 } else {
147 if (GETPOST('type', 'alphanohtml') == 'top') {
148 $menu->fk_menu = 0;
149 } else {
150 $menu->fk_menu = -1;
151 }
152 $menu->fk_mainmenu = $mainmenu;
153 $menu->fk_leftmenu = $leftmenu;
154 }
155
156 $result = $menu->create($user);
157 if ($result > 0) {
158 header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".GETPOST('menu_handler', 'aZ09'));
159 exit;
160 } else {
161 $action = 'create';
162 setEventMessages($menu->error, $menu->errors, 'errors');
163 }
164 }
165}
166
167if ($action == 'update') {
168 if (!$cancel) {
169 $leftmenu = '';
170 $mainmenu = '';
171 if (GETPOST('menuIdParent', 'alphanohtml') && !is_numeric(GETPOST('menuIdParent', 'alphanohtml'))) {
172 $tmp = explode('&', GETPOST('menuIdParent', 'alphanohtml'));
173 foreach ($tmp as $s) {
174 if (preg_match('/fk_mainmenu=/', $s)) {
175 $mainmenu = preg_replace('/fk_mainmenu=/', '', $s);
176 }
177 if (preg_match('/fk_leftmenu=/', $s)) {
178 $leftmenu = preg_replace('/fk_leftmenu=/', '', $s);
179 }
180 }
181 }
182
183 $error = 0;
184 if (!$error && !GETPOST('url')) {
185 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("URL")), null, 'errors');
186 $action = 'create';
187 $error++;
188 }
189
190 if (!$error) {
191 $menu = new Menubase($db);
192 $result = $menu->fetch(GETPOSTINT('menuId'));
193 if ($result > 0) {
194 $menu->title = (string) GETPOST('titre', 'alphanohtml');
195 $menu->prefix = (string) GETPOST('picto', 'restricthtmlallowclass');
196 $menu->leftmenu = (string) GETPOST('leftmenu', 'aZ09');
197 $menu->url = (string) GETPOST('url', 'alphanohtml');
198 $menu->langs = (string) GETPOST('langs', 'alphanohtml');
199 $menu->position = GETPOSTINT('position');
200 $menu->enabled = (string) GETPOST('enabled', 'alphanohtml');
201 $menu->perms = (string) GETPOST('perms', 'alphanohtml');
202 $menu->target = (string) GETPOST('target', 'alphanohtml');
203 $menu->user = GETPOSTINT('user');
204 $menu->mainmenu = (string) GETPOST('propertymainmenu', 'alphanohtml');
205 if (is_numeric(GETPOST('menuIdParent', 'alphanohtml'))) {
206 $menu->fk_menu = (int) GETPOST('menuIdParent', 'alphanohtml');
207 } else {
208 if (GETPOST('type', 'alphanohtml') == 'top') {
209 $menu->fk_menu = 0;
210 } else {
211 $menu->fk_menu = -1;
212 }
213 $menu->fk_mainmenu = $mainmenu;
214 $menu->fk_leftmenu = $leftmenu;
215 }
216
217 $result = $menu->update($user);
218 if ($result > 0) {
219 setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
220 } else {
221 setEventMessages($menu->error, $menu->errors, 'errors');
222 }
223 } else {
224 setEventMessages($menu->error, $menu->errors, 'errors');
225 }
226
227 $action = "edit";
228
229 header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
230 exit;
231 } else {
232 $action = 'edit';
233 }
234 } else {
235 header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
236 exit;
237 }
238}
239
240
241
242/*
243 * View
244 */
245
246$form = new Form($db);
247$formadmin = new FormAdmin($db);
248
249llxHeader('', $langs->trans('Menu'), '', '', 0, 0, '', '', '', 'mod-admin page-menus_edit');
250
251
252if ($action == 'create') {
253 print '<script type="text/javascript">
254 jQuery(document).ready(function() {
255 function init_topleft()
256 {
257 if (jQuery("#topleft").val() == \'top\')
258 {
259 jQuery("#menuIdParent").prop("disabled", true);
260 jQuery("#menuIdParent").val(\'\');
261 jQuery("#propertymainmenu").removeAttr("disabled");
262 jQuery("#propertymainmenu").val(\'\');
263 }
264 if (jQuery("#topleft").val() == \'left\')
265 {
266 jQuery("#menuIdParent").removeAttr("disabled");
267 jQuery("#propertymainmenu").prop("disabled", true);
268 }
269 }
270 init_topleft();
271 jQuery("#topleft").click(function() {
272 init_topleft();
273 });
274 });
275 </script>';
276
277 print load_fiche_titre($langs->trans("NewMenu"), '', 'title_setup');
278
279 print '<form action="'.DOL_URL_ROOT.'/admin/menus/edit.php?menuId='.GETPOSTINT('menuId').'" method="POST" name="formmenucreate">';
280 print '<input type="hidden" name="action" value="add">';
281 print '<input type="hidden" name="token" value="'.newToken().'">';
282
283 print dol_get_fiche_head();
284
285 print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
286 print '<table class="border centpercent">';
287
288 // Id
289 $parent_rowid = GETPOSTINT('menuId');
290 $parent_mainmenu = '';
291 $parent_leftmenu = '';
292 $parent_langs = '';
293 $parent_level = '';
294
295 if (GETPOSTINT('menuId')) {
296 $sql = "SELECT m.rowid, m.mainmenu, m.leftmenu, m.level, m.langs";
297 $sql .= " FROM ".MAIN_DB_PREFIX."menu as m";
298 $sql .= " WHERE m.rowid = ".(GETPOSTINT('menuId'));
299 $res = $db->query($sql);
300 if ($res) {
301 while ($menu = $db->fetch_array($res)) {
302 $parent_rowid = $menu['rowid'];
303 $parent_mainmenu = $menu['mainmenu'];
304 $parent_leftmenu = $menu['leftmenu'];
305 $parent_langs = $menu['langs'];
306 $parent_level = $menu['level'];
307 }
308 }
309 }
310
311 // Handler
312 print '<tr><td class="fieldrequired">'.$langs->trans('MenuHandler').'</td>';
313 print '<td>';
314 $formadmin->select_menu_families($menu_handler.(preg_match('/_menu/', $menu_handler) ? '' : '_menu'), 'menu_handler', array_merge($dirstandard, $dirsmartphone));
315 print '</td>';
316 print '<td>'.$langs->trans('DetailMenuHandler').'</td></tr>';
317
318 // User
319 print '<tr><td class="nowrap fieldrequired">'.$langs->trans('MenuForUsers').'</td>';
320 print '<td><select class="flat" name="user" id="menuuser">';
321 print '<option value="2" selected>'.$langs->trans("AllMenus").'</option>';
322 print '<option value="0">'.$langs->trans('Internal').'</option>';
323 print '<option value="1">'.$langs->trans('External').'</option>';
324 print '</select>';
325 print ajax_combobox('menuuser');
326 print '</td>';
327 print '<td>'.$langs->trans('DetailUser').'</td></tr>';
328
329 // Type
330 print '<tr><td class="fieldrequired">'.$langs->trans('Position').'</td><td>';
331 if ($parent_rowid) {
332 print $langs->trans('Left');
333 print '<input type="hidden" name="type" value="left">';
334 } else {
335 print '<select name="type" class="flat" id="topleft">';
336 print '<option value="">&nbsp;</option>';
337 print '<option value="top"'.(GETPOST("type") == 'top' ? ' selected' : '').'>'.$langs->trans('Top').'</option>';
338 print '<option value="left"'.(GETPOST("type") == 'left' ? ' selected' : '').'>'.$langs->trans('Left').'</option>';
339 print '</select>';
340 print ajax_combobox('topleft');
341 }
342 print '</td><td>'.$langs->trans('DetailType').'</td></tr>';
343
344 // Mainmenu code
345 print '<tr><td class="fieldrequired">'.$langs->trans('MainMenuCode').'</td>';
346 print '<td><input type="text" class="minwidth300" id="propertymainmenu" name="propertymainmenu" value="'.(GETPOSTISSET("propertymainmenu") ? GETPOST("propertymainmenu", 'alphanohtml') : '').'"></td>';
347 print '<td>';
348 print $langs->trans("Example").': mytopmenukey';
349 print '</td></tr>';
350
351 // MenuId Parent
352 print '<tr><td>'.$langs->trans('MenuIdParent').'</td>';
353 if ($parent_rowid) {
354 print '<td>'.$parent_rowid.'<input type="hidden" name="menuIdParent" value="'.$parent_rowid.'"></td>';
355 } else {
356 print '<td><input type="text" class="minwidth300" id="menuIdParent" name="menuIdParent" value="'.(GETPOSTISSET("menuIdParent") ? GETPOST("menuIdParent", 'alphanohtml') : '').'"></td>';
357 }
358 print '<td>'.$langs->trans('DetailMenuIdParent');
359 print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def';
360 print '</td></tr>';
361
362 // Title
363 print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td>';
364 print '<td><input type="text" class="minwidth300" name="titre" value="'.dol_escape_htmltag(GETPOST("titre", 'alphanohtml')).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
365
366 // URL
367 print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td>';
368 print '<td><input type="text" class="minwidth500" name="url" value="'.dol_escape_htmltag(GETPOST("url", 'alphanohtml')).'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
369
370 // Picto
371 print '<tr><td>'.$langs->trans('Image').'</td>';
372 print '<td><input type="text" class="minwidth300" name="picto" value="'.dol_escape_htmltag(GETPOST("picto", 'alphanohtml')).'"></td><td>'.$langs->trans('Example').': fa-global</td></tr>';
373
374 // Langs
375 print '<tr><td>'.$langs->trans('LangFile').'</td>';
376 print '<td><input type="text" class="minwidth300" name="langs" value="'.dol_escape_htmltag($parent_langs).'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
377
378 // Position
379 print '<tr><td>'.$langs->trans('Position').'</td>';
380 print '<td><input type="text" class="width100" name="position" value="'.((int) (GETPOSTISSET("position") ? GETPOSTINT("position") : 100)).'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
381
382 // Enabled
383 print '<tr><td>'.$langs->trans('Enabled').'</td>';
384 print '<td><input type="text" class="minwidth500" name="enabled" value="'.(GETPOSTISSET('enabled') ? GETPOST("enabled", 'alphanohtml') : '1').'"></td><td>'.$langs->trans('DetailEnabled').'</td></tr>';
385
386 // Perms
387 print '<tr><td>'.$langs->trans('Rights').'</td>';
388 print '<td><input type="text" class="minwidth500" name="perms" value="'.(GETPOSTISSET('perms') ? GETPOST('perms', 'alphanohtml') : '1').'"></td><td>'.$langs->trans('DetailRight').'</td></tr>';
389
390 // Target
391 print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target" id="target">';
392 if ($menu instanceof Menubase) {
393 print '<option value=""'.(isset($menu->target) && $menu->target == "" ? ' selected' : '').'>&nbsp;</option>';
394 print '<option value="_blank"'.(isset($menu->target) && $menu->target == "_blank" ? ' selected' : '').'>'.$langs->trans('_blank').'</option>';
395 }
396 print '</select>';
397 print ajax_combobox("target");
398 print '</td></td><td>'.$langs->trans('DetailTarget').'</td></tr>';
399
400 print '</table>';
401 print '</div>';
402
403 print dol_get_fiche_end();
404
405 print $form->buttonsSaveCancel();
406
407 print '</form>';
408} elseif ($action == 'edit') {
409 print load_fiche_titre($langs->trans("ModifMenu"), '', 'title_setup');
410 print '<br>';
411
412 print '<form action="./edit.php" method="POST" name="formmenuedit">';
413 print '<input type="hidden" name="action" value="update">';
414 print '<input type="hidden" name="token" value="'.newToken().'">';
415 print '<input type="hidden" name="handler_origine" value="'.$menu_handler.'">';
416 print '<input type="hidden" name="menuId" value="'.GETPOSTINT('menuId').'">';
417
418 print dol_get_fiche_head();
419
420 print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
421 print '<table class="border centpercent">';
422
423 $menu = new Menubase($db);
424 $result = $menu->fetch(GETPOSTINT('menuId'));
425 //var_dump($menu);
426
427 // Id
428 print '<tr><td>'.$langs->trans('Id').'</td><td>'.$menu->id.'</td><td>'.$langs->trans('DetailId').'</td></tr>';
429
430 // Module
431 print '<tr><td>'.$langs->trans('MenuModule').'</td><td>'.(empty($menu->module) ? 'Core' : $menu->module).'</td><td><span class="opacitymedium">'.$langs->trans('DetailMenuModule').'</span></td></tr>';
432
433 // Handler
434 if ($menu->menu_handler == 'all') {
435 $handler = $langs->trans('AllMenus');
436 } else {
437 $handler = $menu->menu_handler;
438 }
439 print '<tr><td class="fieldrequired">'.$langs->trans('MenuHandler').'</td><td>'.$handler.'</td><td>'.$langs->trans('DetailMenuHandler').'</td></tr>';
440
441 // User
442 print '<tr><td class="nowrap fieldrequired">'.$langs->trans('MenuForUsers').'</td><td>';
443 print '<select class="flat" name="user" id="menuuser">';
444 print '<option value="2"'.($menu->user == 2 ? ' selected' : '').'>'.$langs->trans("AllMenus").'</option>';
445 print '<option value="0"'.($menu->user == 0 ? ' selected' : '').'>'.$langs->trans('Internal').'</option>';
446 print '<option value="1"'.($menu->user == 1 ? ' selected' : '').'>'.$langs->trans('External').'</option>';
447 print '</select>';
448 print ajax_combobox('menuuser');
449 print '</td><td>'.$langs->trans('DetailUser').'</td></tr>';
450
451 // Type
452 print '<tr><td class="fieldrequired">'.$langs->trans('Position').'</td>';
453 print '<td>'.$langs->trans(ucfirst($menu->type)).'</td><td>'.$langs->trans('DetailType').'</td></tr>';
454
455 // Mainmenu code
456 if ($menu->type == 'top') {
457 print '<tr><td class="fieldrequired">'.$langs->trans('MainMenuCode').'</td>';
458 /*if ($parent_rowid)
459 {
460 print '<td>'.$parent_rowid.'<input type="hidden" name="propertyleftmenu" value="'.$parent_rowid.'"></td>';
461 }
462 else
463 {*/
464 print '<td><input type="text" class="minwidth300" id="propertymainmenu" name="propertymainmenu" value="'.(GETPOST("propertymainmenu", 'alphanohtml') ? GETPOST("propertymainmenu", 'alphanohtml') : $menu->mainmenu).'"></td>';
465 //}
466 print '<td>';
467 print $langs->trans("Example").': mytopmenukey';
468 print '</td></tr>';
469 }
470
471 // MenuId Parent
472 print '<tr><td class="fieldrequired">'.$langs->trans('MenuIdParent');
473 print '</td>';
474 $valtouse = $menu->fk_menu;
475 if ($menu->fk_mainmenu) {
476 $valtouse = 'fk_mainmenu='.$menu->fk_mainmenu;
477 }
478 if ($menu->fk_leftmenu) {
479 $valtouse .= '&fk_leftmenu='.$menu->fk_leftmenu;
480 }
481 print '<td><input type="text" name="menuIdParent" value="'.dol_escape_htmltag(GETPOSTISSET('menuIdParent') ? GETPOST('menuIdParent') : $valtouse).'" class="minwidth300"></td>';
482 print '<td>'.$langs->trans('DetailMenuIdParent');
483 print ', <span class="opacitymedium">'.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def</span>';
484 print '</td></tr>';
485
486 // Niveau
487 //print '<tr><td>'.$langs->trans('Level').'</td><td>'.$menu->level.'</td><td>'.$langs->trans('DetailLevel').'</td></tr>';
488
489 // Title
490 print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td>';
491 print '<td><input type="text" class="minwidth300" name="titre" value="'.dol_escape_htmltag($menu->title).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
492
493 // URL
494 print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td>';
495 print '<td><input type="text" class="quatrevingtpercent" name="url" value="'.dol_escape_htmltag($menu->url).'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
496
497 // Picto
498 print '<tr><td class="fieldrequired">'.$langs->trans('Image').'</td>';
499 print '<td><input type="text" class="minwidth300" name="picto" value="'.dol_escape_htmltag($menu->prefix).'"></td><td>'.$langs->trans('Example').': fa-global</td></tr>';
500
501 // Langs
502 print '<tr><td>'.$langs->trans('LangFile').'</td>';
503 print '<td><input type="text" class="minwidth300" name="langs" value="'.dol_escape_htmltag($menu->langs).'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
504
505 // Position
506 print '<tr><td>'.$langs->trans('Position').'</td>';
507 print '<td><input type="text" class="minwidth100" name="position" value="'.((int) $menu->position).'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
508
509 // Enabled
510 print '<tr><td>'.$langs->trans('Enabled').'</td>';
511 print '<td><input type="text" class="minwidth500" name="enabled" value="'.dol_escape_htmltag($menu->enabled).'"></td><td>'.$langs->trans('DetailEnabled');
512 if (!empty($menu->enabled)) {
513 print ' <span class="opacitymedium">('.$langs->trans("ConditionIsCurrently").':</span> '.yn((int) dol_eval($menu->enabled, 1, 1, '1') <= 0 ? 0 : 1).')';
514 }
515 print '</td></tr>';
516
517 // Perms
518 print '<tr><td>'.$langs->trans('Rights').'</td>';
519 print '<td><input type="text" class="minwidth500" name="perms" value="'.dol_escape_htmltag($menu->perms).'"></td><td>'.$langs->trans('DetailRight');
520 if (!empty($menu->perms)) {
521 print ' <span class="opacitymedium">('.$langs->trans("ConditionIsCurrently").':</span> '.yn((int) dol_eval($menu->perms, 1, 1, '1') <= 0 ? 0 : 1).')';
522 }
523 print '</td></tr>';
524
525 // Target
526 print '<tr><td>'.$langs->trans('Target').'</td><td>';
527 print '<select class="flat" id="target" name="target">';
528 print '<option value=""'.($menu->target == "" ? ' selected' : '').'>&nbsp;</option>';
529 print '<option value="_blank"'.($menu->target == "_blank" ? ' selected' : '').'>'.$langs->trans('_blank').'</option>';
530 print '</select>';
531 print ajax_combobox("target");
532 print '</td><td>'.$langs->trans('DetailTarget').'</td></tr>';
533
534 print '</table>';
535 print '</div>';
536
537 print dol_get_fiche_end();
538
539 print $form->buttonsSaveCancel();
540
541 print '</form>';
542
543 print '<br>';
544}
545
546// End of page
547llxFooter();
548$db->close();
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
Definition ajax.lib.php:457
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:70
Class to generate html code for admin pages.
Class to manage generation of HTML components Only common components must be here.
Class to manage menu entries.
llxFooter()
Footer empty.
Definition document.php:107
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.