dolibarr 24.0.0-beta
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-2026 MDW <mdeweerd@users.noreply.github.com>
7 * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
29// Load Dolibarr environment
30require '../../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
39require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
40
41// Load translation files required by the page
42$langs->loadLangs(array("other", "admin", "uxdocumentation"));
43
44$cancel = GETPOST('cancel', 'alphanohtml'); // We click on a Cancel button
45$confirm = GETPOST('confirm');
46
47if (!$user->admin) {
49}
50
51$dirstandard = array();
52$dirsmartphone = array();
53$dirmenus = array_merge(array("/core/menus/"), (array) $conf->modules_parts['menus']);
54foreach ($dirmenus as $dirmenu) {
55 $dirstandard[] = $dirmenu.'standard';
56 $dirsmartphone[] = $dirmenu.'smartphone';
57}
58
59$action = GETPOST('action', 'aZ09');
60
61$menu = new Menubase($db);
62
63$menu_handler_top = getDolGlobalString('MAIN_MENU_STANDARD');
64$menu_handler_smartphone = getDolGlobalString('MAIN_MENU_SMARTPHONE');
65$menu_handler_top = preg_replace('/_backoffice.php/i', '', $menu_handler_top);
66$menu_handler_top = preg_replace('/_frontoffice.php/i', '', $menu_handler_top);
67$menu_handler_smartphone = preg_replace('/_backoffice.php/i', '', $menu_handler_smartphone);
68$menu_handler_smartphone = preg_replace('/_frontoffice.php/i', '', $menu_handler_smartphone);
69
70$menu_handler = $menu_handler_top;
71
72if (GETPOST("handler_origine")) {
73 $menu_handler = GETPOST("handler_origine");
74}
75if (GETPOST("menu_handler")) {
76 $menu_handler = GETPOST("menu_handler");
77}
78
79
80
81/*
82 * Actions
83 */
84
85if ($action == 'add') {
86 if ($cancel) {
87 header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
88 exit;
89 }
90
91 $leftmenu = '';
92 $mainmenu = '';
93 if (GETPOST('menuIdParent', 'alphanohtml') && !is_numeric(GETPOST('menuIdParent', 'alphanohtml'))) {
94 $tmp = explode('&', GETPOST('menuIdParent', 'alphanohtml'));
95 foreach ($tmp as $s) {
96 if (preg_match('/fk_mainmenu=/', $s)) {
97 $mainmenu = preg_replace('/fk_mainmenu=/', '', $s);
98 }
99 if (preg_match('/fk_leftmenu=/', $s)) {
100 $leftmenu = preg_replace('/fk_leftmenu=/', '', $s);
101 }
102 }
103 }
104
105 $langs->load("errors");
106
107 $error = 0;
108 if (!GETPOST('menu_handler')) {
109 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("MenuHandler")), null, 'errors');
110 $action = 'create';
111 $error++;
112 }
113 if (!$error && !GETPOST('type')) {
114 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Position")), null, 'errors');
115 $action = 'create';
116 $error++;
117 }
118 if (!$error && !GETPOST('url')) {
119 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("URL")), null, 'errors');
120 $action = 'create';
121 $error++;
122 }
123 if (!$error && !GETPOST('titre')) {
124 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Title")), null, 'errors');
125 $action = 'create';
126 $error++;
127 }
128 if (!$error && GETPOST('menuIdParent', 'alphanohtml') && GETPOST('type') == 'top') {
129 setEventMessages($langs->trans("ErrorTopMenuMustHaveAParentWithId0"), null, 'errors');
130 $action = 'create';
131 $error++;
132 }
133 if (!$error && !GETPOST('menuIdParent', 'alphanohtml') && GETPOST('type') == 'left') {
134 setEventMessages($langs->trans("ErrorLeftMenuMustHaveAParentId"), null, 'errors');
135 $action = 'create';
136 $error++;
137 }
138
139 if (!$error) {
140 $menu->menu_handler = preg_replace('/_menu$/', '', GETPOST('menu_handler', 'aZ09'));
141 $menu->type = (string) GETPOST('type', 'alphanohtml');
142 $menu->title = (string) GETPOST('titre', 'alphanohtml');
143 $menu->prefix = (string) GETPOST('picto', 'restricthtmlallowclass');
144 $menu->url = (string) GETPOST('url', 'alphanohtml');
145 $menu->langs = (string) GETPOST('langs', 'alphanohtml');
146 $menu->position = GETPOSTINT('position');
147 $menu->enabled = (string) GETPOST('enabled', 'alphanohtml');
148 $menu->perms = (string) GETPOST('perms', 'alphanohtml');
149 $menu->target = (string) GETPOST('target', 'alphanohtml');
150 $menu->showtopmenuinframe = GETPOSTINT('showtopmenuinframe');
151 $menu->user = GETPOSTINT('user');
152 $menu->mainmenu = (string) GETPOST('propertymainmenu', 'alphanohtml');
153 if (is_numeric(GETPOST('menuIdParent', 'alphanohtml'))) {
154 $menu->fk_menu = (int) GETPOST('menuIdParent', 'alphanohtml');
155 } else {
156 if (GETPOST('type', 'alphanohtml') == 'top') {
157 $menu->fk_menu = 0;
158 } else {
159 $menu->fk_menu = -1;
160 }
161 $menu->fk_mainmenu = $mainmenu;
162 $menu->fk_leftmenu = $leftmenu;
163 }
164
165 $result = $menu->create($user);
166 if ($result > 0) {
167 header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".GETPOST('menu_handler', 'aZ09'));
168 exit;
169 } else {
170 $action = 'create';
171 setEventMessages($menu->error, $menu->errors, 'errors');
172 }
173 }
174}
175
176if ($action == 'update') {
177 if (!$cancel) {
178 $leftmenu = '';
179 $mainmenu = '';
180 if (GETPOST('menuIdParent', 'alphanohtml') && !is_numeric(GETPOST('menuIdParent', 'alphanohtml'))) {
181 $tmp = explode('&', GETPOST('menuIdParent', 'alphanohtml'));
182 foreach ($tmp as $s) {
183 if (preg_match('/fk_mainmenu=/', $s)) {
184 $mainmenu = preg_replace('/fk_mainmenu=/', '', $s);
185 }
186 if (preg_match('/fk_leftmenu=/', $s)) {
187 $leftmenu = preg_replace('/fk_leftmenu=/', '', $s);
188 }
189 }
190 }
191
192 $error = 0;
193 if (!GETPOST('url')) {
194 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("URL")), null, 'errors');
195 $action = 'create';
196 $error++;
197 }
198
199 if (!$error) {
200 $result = $menu->fetch(GETPOSTINT('menuId'));
201 if ($result > 0) {
202 $menu->title = (string) GETPOST('titre', 'alphanohtml');
203 $menu->prefix = (string) GETPOST('picto', 'restricthtmlallowclass');
204 $menu->leftmenu = (string) GETPOST('leftmenu', 'aZ09');
205 $menu->url = (string) GETPOST('url', 'alphanohtml');
206 $menu->langs = (string) GETPOST('langs', 'alphanohtml');
207 $menu->position = GETPOSTINT('position');
208 $menu->enabled = (string) GETPOST('enabled', 'alphanohtml');
209 $menu->perms = (string) GETPOST('perms', 'alphanohtml');
210 $menu->target = (string) GETPOST('target', 'alphanohtml');
211 $menu->user = GETPOSTINT('user');
212 $menu->mainmenu = (string) GETPOST('propertymainmenu', 'alphanohtml');
213 $menu->showtopmenuinframe = GETPOSTINT('showtopmenuinframe');
214
215 if (is_numeric(GETPOST('menuIdParent', 'alphanohtml'))) {
216 $menu->fk_menu = (int) GETPOST('menuIdParent', 'alphanohtml');
217 } else {
218 if (GETPOST('type', 'alphanohtml') == 'top') {
219 $menu->fk_menu = 0;
220 } else {
221 $menu->fk_menu = -1;
222 }
223 $menu->fk_mainmenu = $mainmenu;
224 $menu->fk_leftmenu = $leftmenu;
225 }
226
227 $result = $menu->update($user);
228 if ($result > 0) {
229 setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
230 } else {
231 setEventMessages($menu->error, $menu->errors, 'errors');
232 }
233 } else {
234 setEventMessages($menu->error, $menu->errors, 'errors');
235 }
236
237 $action = "edit";
238
239 header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
240 exit;
241 } else {
242 $action = 'edit';
243 }
244 } else {
245 header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
246 exit;
247 }
248}
249
250
251
252/*
253 * View
254 */
255
256$form = new Form($db);
257$formadmin = new FormAdmin($db);
258
259llxHeader('', $langs->trans('Menu'), '', '', 0, 0, '', '', '', 'mod-admin page-menus_edit');
260
261
262if ($action == 'create') {
263 print '<script type="text/javascript">
264 jQuery(document).ready(function() {
265 function init_topleft()
266 {
267 if (jQuery("#topleft").val() == \'top\')
268 {
269 jQuery("#menuIdParent").prop("disabled", true);
270 jQuery("#menuIdParent").val(\'\');
271 jQuery("#propertymainmenu").removeAttr("disabled");
272 jQuery("#propertymainmenu").val(\'\');
273 }
274 if (jQuery("#topleft").val() == \'left\')
275 {
276 jQuery("#menuIdParent").removeAttr("disabled");
277 jQuery("#propertymainmenu").prop("disabled", true);
278 }
279 }
280 init_topleft();
281 jQuery("#topleft").click(function() {
282 init_topleft();
283 });
284 });
285 </script>';
286
287 print load_fiche_titre($langs->trans("NewMenu"), '', 'title_setup');
288
289 print '<form action="'.DOL_URL_ROOT.'/admin/menus/edit.php?menuId='.GETPOSTINT('menuId').'" method="POST" name="formmenucreate" spellcheck="false">';
290 print '<input type="hidden" name="action" value="add">';
291 print '<input type="hidden" name="token" value="'.newToken().'">';
292
293 print dol_get_fiche_head();
294
295 print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
296 print '<table class="border centpercent">';
297
298 // Id
299 $parent_rowid = GETPOSTINT('menuId');
300 $parent_mainmenu = '';
301 $parent_leftmenu = '';
302 $parent_langs = '';
303 $parent_level = '';
304
305 if (GETPOSTINT('menuId')) {
306 $sql = "SELECT m.rowid, m.mainmenu, m.leftmenu, m.level, m.langs";
307 $sql .= " FROM ".MAIN_DB_PREFIX."menu as m";
308 $sql .= " WHERE m.rowid = ".(GETPOSTINT('menuId'));
309 $res = $db->query($sql);
310 if ($res) {
311 while ($menu = $db->fetch_array($res)) {
312 $parent_rowid = $menu['rowid'];
313 $parent_mainmenu = $menu['mainmenu'];
314 $parent_leftmenu = $menu['leftmenu'];
315 $parent_langs = $menu['langs'];
316 $parent_level = $menu['level'];
317 }
318 }
319 }
320
321 // Handler
322 print '<tr><td class="fieldrequired">'.$form->textwithpicto($langs->trans('MenuHandler'), $langs->trans('DetailMenuHandler')).'</td>';
323 print '<td>';
324 $formadmin->select_menu_families($menu_handler.(preg_match('/_menu/', $menu_handler) ? '' : '_menu'), 'menu_handler', array_merge($dirstandard, $dirsmartphone));
325 print '</td>';
326 print '<td></td></tr>';
327
328 // User
329 print '<tr><td class="nowrap fieldrequired">'.$form->textwithpicto($langs->trans('MenuForUsers'), $langs->trans('DetailUser')).'</td>';
330 print '<td><select class="flat width150" name="user" id="menuuser">';
331 print '<option value="2" selected>'.$langs->trans("AllMenus").'</option>';
332 print '<option value="0">'.$langs->trans('Internal').'</option>';
333 print '<option value="1">'.$langs->trans('External').'</option>';
334 print '</select>';
335 print ajax_combobox('menuuser');
336 print '</td>';
337 print '<td></td></tr>';
338
339 // Type
340 print '<tr><td class="fieldrequired">'.$langs->trans('Position').'</td><td>';
341 if ($parent_rowid) {
342 print $langs->trans('Left');
343 print '<input type="hidden" name="type" value="left">';
344 } else {
345 print '<select name="type" class="flat width150" id="topleft">';
346 print '<option value="">&nbsp;</option>';
347 print '<option value="top"'.(GETPOST("type") == 'top' ? ' selected' : '').'>'.$langs->trans('Top').'</option>';
348 print '<option value="left"'.(GETPOST("type") == 'left' ? ' selected' : '').'>'.$langs->trans('Left').'</option>';
349 print '</select>';
350 print ajax_combobox('topleft');
351
352 print '<script>
353 jQuery(document).ready(function() {
354 jQuery("#topleft").on("change", function() {
355 console.log("We change the type topleft with ");
356 if (jQuery("#topleft").val() == "top") {
357 jQuery(".menuidparent").hide();
358 } else {
359 jQuery(".menuidparent").show();
360 }
361 });
362 });
363 </script>';
364 }
365 print '</td><td>'.$langs->trans('DetailType').'</td></tr>';
366
367 // Mainmenu code
368 print '<tr><td class="fieldrequired">'.$langs->trans('MainMenuCode').'</td>';
369 print '<td><input type="text" class="minwidth300" id="propertymainmenu" name="propertymainmenu" value="'.(GETPOSTISSET("propertymainmenu") ? GETPOST("propertymainmenu", 'alphanohtml') : '').'"></td>';
370 print '<td>';
371 print $langs->trans("Example").': mytopmenukey';
372 print '</td></tr>';
373
374 // MenuId Parent
375 print '<tr class="menuidparent"><td>'.$langs->trans('MenuIdParent').'</td>';
376 if ($parent_rowid) {
377 print '<td>'.$parent_rowid.'<input type="hidden" name="menuIdParent" value="'.$parent_rowid.'"></td>';
378 } else {
379 print '<td><input type="text" class="minwidth300" id="menuIdParent" name="menuIdParent" value="'.(GETPOSTISSET("menuIdParent") ? GETPOST("menuIdParent", 'alphanohtml') : '').'"></td>';
380 }
381 print '<td>'.$langs->trans('DetailMenuIdParent');
382 print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def';
383 print '</td></tr>';
384
385 // Title
386 print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td>';
387 print '<td><input type="text" class="minwidth300" name="titre" value="'.dol_escape_htmltag(GETPOST("titre", 'alphanohtml')).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
388
389 // Langs
390 print '<tr><td>'.$langs->trans('LangFile').'</td>';
391 print '<td><input type="text" class="minwidth300" name="langs" value="'.dol_escape_htmltag($parent_langs).'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
392
393 // Picto
394 print '<tr><td>'.$langs->trans('Image').'</td>';
395 print '<td><input type="text" class="minwidth300" name="picto" value="'.dol_escape_htmltag(GETPOST("picto", 'alphanohtml')).'"></td><td>'.$langs->trans('Example').': fa-globe-americas';
396 print '<span class="opacitymedium small">';
397 print ' &nbsp; &nbsp; ';
398 print dolButtonToOpenUrlInDialogPopup('popup_picto_id', $langs->transnoentitiesnoconv("DocIconsList"), $langs->transnoentitiesnoconv("DocIconsList"), '/admin/tools/ui/components/icons.php?hidenavmenu=1&displayMode=icon-only#img-picto-section-list', '', '');
399 print '</span>';
400 print '</td></tr>';
401
402 // URL
403 print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td>';
404 print '<td><input type="text" class="minwidth500" name="url" value="'.dol_escape_htmltag(GETPOST("url", 'alphanohtml')).'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
405
406 // Target
407 print '<tr><td>'.$langs->trans('OpenLinkInto').'</td><td><select class="flat" name="target" id="target">';
408 print '<option value=""'.(isset($menu->target) && $menu->target == "" ? ' selected' : '').'>'.$langs->trans('SameWindow').'</option>';
409 print '<option value="_blank"'.(isset($menu->target) && $menu->target == "_blank" ? ' selected' : '').'>'.$langs->trans('NewWindow').'</option>';
410 print '</select>';
411 print ajax_combobox("target");
412 print '</td><td></td></tr>';
413
414 // Show URL into a frame
415 if (getDolGlobalString("MAIN_FEATURE_TO_SHOW_TOP_MENU_URL_IN_FRAME")) {
416 print '<tr class="hideforleftmenu"><td>'.$langs->trans('ShowTopMenuURLIntoAFrame').'</td>';
417 print '<td><input type="checkbox" value="1" name="showtopmenuinframe"'.(GETPOSTINT("showtopmenuinframe") ? ' checked="checked"' : '').'"></td><td></td></tr>';
418 }
419
420 // Position
421 print '<tr><td>'.$langs->trans('Position').'</td>';
422 print '<td><input type="number" class="minwidth50 maxwidth75" name="position" value="'.(GETPOSTISSET("position") ? GETPOSTINT("position") : 100).'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
423
424 // Enabled
425 print '<tr><td>'.$langs->trans('Enabled').'</td>';
426 print '<td><input type="text" class="minwidth500" name="enabled" value="'.(GETPOSTISSET('enabled') ? GETPOST("enabled", 'alphanohtml') : '1').'"></td><td>'.$langs->trans('DetailEnabled').'</td></tr>';
427
428 // Perms
429 print '<tr><td>'.$langs->trans('Rights').'</td>';
430 print '<td><input type="text" class="minwidth500" name="perms" value="'.(GETPOSTISSET('perms') ? GETPOST('perms', 'alphanohtml') : '1').'"></td><td>'.$langs->trans('DetailRight').'</td></tr>';
431
432 print '</table>';
433 print '</div>';
434
435 print dol_get_fiche_end();
436
437 print $form->buttonsSaveCancel();
438
439 print '</form>';
440} elseif ($action == 'edit') {
441 print load_fiche_titre($langs->trans("ModifMenu"), '', 'title_setup');
442
443 print '<form action="./edit.php" method="POST" name="formmenuedit" specllcheck="false">';
444 print '<input type="hidden" name="action" value="update">';
445 print '<input type="hidden" name="token" value="'.newToken().'">';
446 print '<input type="hidden" name="handler_origine" value="'.$menu_handler.'">';
447 print '<input type="hidden" name="menuId" value="'.GETPOSTINT('menuId').'">';
448
449 print dol_get_fiche_head();
450
451 print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
452 print '<table class="border centpercent">';
453
454 $menu = new Menubase($db);
455 $result = $menu->fetch(GETPOSTINT('menuId'));
456 //var_dump($menu);
457
458 // Id
459 print '<tr><td>'.$form->textwithpicto($langs->trans('MenuID'), $langs->trans('DetailId')).'</td><td>'.$menu->id.'</td><td></td></tr>';
460
461 // Module
462 print '<tr><td>'.$form->textwithpicto($langs->trans('MenuModule'), $langs->trans('DetailMenuModule')).'</td><td>'.(empty($menu->module) ? 'Core' : $menu->module).'</td><td></td></tr>';
463
464 // Handler
465 if ($menu->menu_handler == 'all') {
466 $handler = $langs->trans('AllMenus');
467 } else {
468 $handler = $menu->menu_handler;
469 }
470 print '<tr><td class="fieldrequired">'.$form->textwithpicto($langs->trans('MenuHandler'), $langs->transnoentitiesnoconv("DetailMenuHandler")).'</td><td>'.$handler.'</td>';
471 print '<td></td></tr>';
472
473 // User
474 print '<tr><td class="nowrap fieldrequired">'.$langs->trans('MenuForUsers').'</td><td>';
475 print '<select class="flat" name="user" id="menuuser">';
476 print '<option value="2"'.($menu->user == 2 ? ' selected' : '').'>'.$langs->trans("AllMenus").'</option>';
477 print '<option value="0"'.($menu->user == 0 ? ' selected' : '').'>'.$langs->trans('Internal').'</option>';
478 print '<option value="1"'.($menu->user == 1 ? ' selected' : '').'>'.$langs->trans('External').'</option>';
479 print '</select>';
480 print ajax_combobox('menuuser');
481 print '</td><td>'.$langs->trans('DetailUser').'</td></tr>';
482
483 // Type
484 print '<tr><td class="fieldrequired">'.$langs->trans('Position').'</td>';
485 print '<td>'.$langs->trans(ucfirst($menu->type));
486 print '<input type="hidden" name="type" value="'.$menu->type.'">';
487 print '</td><td>';
488 print $langs->transnoentitiesnoconv("DetailType");
489 print '</td></tr>';
490
491 // Mainmenu code
492 if ($menu->type == 'top') {
493 print '<tr><td class="fieldrequired">'.$langs->trans('MainMenuCode').'</td>';
494 print '<td><input type="text" class="minwidth300" id="propertymainmenu" name="propertymainmenu" value="'.(GETPOST("propertymainmenu", 'alphanohtml') ? GETPOST("propertymainmenu", 'alphanohtml') : $menu->mainmenu).'"></td>';
495 print '<td>';
496 print $langs->trans("Example").': mytopmenukey';
497 print '</td></tr>';
498 }
499
500 // MenuId Parent
501 print '<tr class="hideforleftmenu"><td class="fieldrequired">'.$langs->trans('MenuIdParent');
502 print '</td>';
503 $valtouse = $menu->fk_menu;
504 if ($menu->fk_mainmenu) {
505 $valtouse = 'fk_mainmenu='.$menu->fk_mainmenu;
506 }
507 if ($menu->fk_leftmenu) {
508 $valtouse .= '&fk_leftmenu='.$menu->fk_leftmenu;
509 }
510 print '<td><input type="text" name="menuIdParent" value="'.dol_escape_htmltag(GETPOSTISSET('menuIdParent') ? GETPOST('menuIdParent') : $valtouse).'" class="minwidth300"></td>';
511 print '<td>'.$langs->trans('DetailMenuIdParent');
512 print ', <span class="opacitymedium">'.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def</span>';
513 print '</td></tr>';
514
515 // Level
516 //print '<tr><td>'.$langs->trans('Level').'</td><td>'.$menu->level.'</td><td>'.$langs->trans('DetailLevel').'</td></tr>';
517
518 // Title
519 print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td>';
520 print '<td><input type="text" class="minwidth300" name="titre" value="'.dol_escape_htmltag($menu->title).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
521
522 // Langs
523 print '<tr><td>'.$langs->trans('LangFile').'</td>';
524 print '<td><input type="text" class="minwidth300" name="langs" value="'.dol_escape_htmltag($menu->langs).'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
525
526 // Picto
527 print '<tr><td>'.$langs->trans('Image').'</td>';
528 print '<td><input type="text" class="minwidth300" name="picto" value="'.dol_escape_htmltag($menu->prefix).'"></td><td>'.$langs->trans('Example').': fa-globe-americas';
529 print '<span class="opacitymedium small">';
530 print ' &nbsp; &nbsp; ';
531 print dolButtonToOpenUrlInDialogPopup('popup_picto_id', $langs->transnoentitiesnoconv("DocIconsList"), $langs->transnoentitiesnoconv("DocIconsList"), '/admin/tools/ui/components/icons.php?hidenavmenu=1&displayMode=icon-only#img-picto-section-list', '', '');
532 print '</span>';
533 print '</td></tr>';
534
535 // URL
536 print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td>';
537 print '<td><input type="text" class="quatrevingtpercent" name="url" value="'.dol_escape_htmltag($menu->url).'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
538
539 // Target
540 print '<tr><td>'.$langs->trans('OpenLinkInto').'</td><td>';
541 print '<select class="flat" id="target" name="target">';
542 print '<option value=""'.($menu->target == "" ? ' selected' : '').'>'.$langs->trans('SameWindow').'</option>';
543 print '<option value="_blank"'.($menu->target == "_blank" ? ' selected' : '').'>'.$langs->trans('NewWindow').'</option>';
544 print '</select>';
545 print ajax_combobox("target");
546 print '</td><td></td></tr>';
547
548 // Show URL into a frame
549 if (getDolGlobalString("MAIN_FEATURE_TO_SHOW_TOP_MENU_URL_IN_FRAME") && $menu->type == 'top') {
550 print '<tr class="hideforleftmenu"><td>'.$langs->trans('ShowTopMenuURLIntoAFrame').'</td>';
551 print '<td><input type="checkbox" value="1" name="showtopmenuinframe" '.($menu->showtopmenuinframe ? ' checked="checked"' : '').'"></td><td></td></tr>';
552 }
553
554 // Position
555 print '<tr><td>'.$langs->trans('Position').'</td>';
556 print '<td><input type="number" class="minwidth50 maxwidth75" name="position" value="'.((int) $menu->position).'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
557
558 // Enabled
559 print '<tr><td>'.$langs->trans('Enabled').'</td>';
560 print '<td><input type="text" class="minwidth500" name="enabled" value="'.dol_escape_htmltag($menu->enabled).'"></td><td>'.$langs->trans('DetailEnabled');
561 if (!empty($menu->enabled)) {
562 print ' <span class="opacitymedium">('.$langs->trans("ConditionIsCurrently").':</span> '.yn((int) dol_eval((string) $menu->enabled, 1, 1, '1') <= 0 ? 0 : 1).')';
563 }
564 print '</td></tr>';
565
566 // Perms
567 print '<tr><td>'.$langs->trans('Rights').'</td>';
568 print '<td><input type="text" class="minwidth500" name="perms" value="'.dol_escape_htmltag($menu->perms).'"></td><td>'.$langs->trans('DetailRight');
569 if (!empty($menu->perms)) {
570 print ' <span class="opacitymedium">('.$langs->trans("ConditionIsCurrently").':</span> '.yn((int) dol_eval((string) $menu->perms, 1, 1, '1') <= 0 ? 0 : 1).')';
571 }
572 print '</td></tr>';
573
574 print '</table>';
575 print '</div>';
576
577 print dol_get_fiche_end();
578
579 print $form->buttonsSaveCancel();
580
581 print '</form>';
582
583 print '<br>';
584}
585
586// End of page
587llxFooter();
588$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:476
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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:73
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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
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, $morecssdiv='')
Show tabs of a record.
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='classlink button bordertransp', $jsonopen='', $jsonclose='', $accesskey='')
Return HTML code to output a button to open a dialog popup box.
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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.