dolibarr 21.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 MDW <mdeweerd@users.noreply.github.com>
7 * Copyright (C) 2024 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';
31require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
32require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
33
42// Load translation files required by the page
43$langs->loadLangs(array("other", "admin"));
44
45$cancel = GETPOST('cancel', 'alphanohtml'); // We click on a Cancel button
46$confirm = GETPOST('confirm');
47
48if (!$user->admin) {
50}
51
52$dirstandard = array();
53$dirsmartphone = array();
54$dirmenus = array_merge(array("/core/menus/"), (array) $conf->modules_parts['menus']);
55foreach ($dirmenus as $dirmenu) {
56 $dirstandard[] = $dirmenu.'standard';
57 $dirsmartphone[] = $dirmenu.'smartphone';
58}
59
60$action = GETPOST('action', 'aZ09');
61
62$menu = null;
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 (!$error && !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 = new Menubase($db);
141 $menu->menu_handler = preg_replace('/_menu$/', '', GETPOST('menu_handler', 'aZ09'));
142 $menu->type = (string) GETPOST('type', 'alphanohtml');
143 $menu->title = (string) GETPOST('titre', 'alphanohtml');
144 $menu->prefix = (string) GETPOST('picto', 'restricthtmlallowclass');
145 $menu->url = (string) GETPOST('url', 'alphanohtml');
146 $menu->langs = (string) GETPOST('langs', 'alphanohtml');
147 $menu->position = GETPOSTINT('position');
148 $menu->enabled = (string) GETPOST('enabled', 'alphanohtml');
149 $menu->perms = (string) GETPOST('perms', 'alphanohtml');
150 $menu->target = (string) GETPOST('target', 'alphanohtml');
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 (!$error && !GETPOST('url')) {
194 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("URL")), null, 'errors');
195 $action = 'create';
196 $error++;
197 }
198
199 if (!$error) {
200 $menu = new Menubase($db);
201 $result = $menu->fetch(GETPOSTINT('menuId'));
202 if ($result > 0) {
203 $menu->title = (string) GETPOST('titre', 'alphanohtml');
204 $menu->prefix = (string) GETPOST('picto', 'restricthtmlallowclass');
205 $menu->leftmenu = (string) GETPOST('leftmenu', 'aZ09');
206 $menu->url = (string) GETPOST('url', 'alphanohtml');
207 $menu->langs = (string) GETPOST('langs', 'alphanohtml');
208 $menu->position = GETPOSTINT('position');
209 $menu->enabled = (string) GETPOST('enabled', 'alphanohtml');
210 $menu->perms = (string) GETPOST('perms', 'alphanohtml');
211 $menu->target = (string) GETPOST('target', 'alphanohtml');
212 $menu->user = GETPOSTINT('user');
213 $menu->mainmenu = (string) GETPOST('propertymainmenu', 'alphanohtml');
214 if (is_numeric(GETPOST('menuIdParent', 'alphanohtml'))) {
215 $menu->fk_menu = (int) GETPOST('menuIdParent', 'alphanohtml');
216 } else {
217 if (GETPOST('type', 'alphanohtml') == 'top') {
218 $menu->fk_menu = 0;
219 } else {
220 $menu->fk_menu = -1;
221 }
222 $menu->fk_mainmenu = $mainmenu;
223 $menu->fk_leftmenu = $leftmenu;
224 }
225
226 $result = $menu->update($user);
227 if ($result > 0) {
228 setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
229 } else {
230 setEventMessages($menu->error, $menu->errors, 'errors');
231 }
232 } else {
233 setEventMessages($menu->error, $menu->errors, 'errors');
234 }
235
236 $action = "edit";
237
238 header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
239 exit;
240 } else {
241 $action = 'edit';
242 }
243 } else {
244 header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
245 exit;
246 }
247}
248
249
250
251/*
252 * View
253 */
254
255$form = new Form($db);
256$formadmin = new FormAdmin($db);
257
258llxHeader('', $langs->trans('Menu'), '', '', 0, 0, '', '', '', 'mod-admin page-menus_edit');
259
260
261if ($action == 'create') {
262 print '<script type="text/javascript">
263 jQuery(document).ready(function() {
264 function init_topleft()
265 {
266 if (jQuery("#topleft").val() == \'top\')
267 {
268 jQuery("#menuIdParent").prop("disabled", true);
269 jQuery("#menuIdParent").val(\'\');
270 jQuery("#propertymainmenu").removeAttr("disabled");
271 jQuery("#propertymainmenu").val(\'\');
272 }
273 if (jQuery("#topleft").val() == \'left\')
274 {
275 jQuery("#menuIdParent").removeAttr("disabled");
276 jQuery("#propertymainmenu").prop("disabled", true);
277 }
278 }
279 init_topleft();
280 jQuery("#topleft").click(function() {
281 init_topleft();
282 });
283 });
284 </script>';
285
286 print load_fiche_titre($langs->trans("NewMenu"), '', 'title_setup');
287
288 print '<form action="'.DOL_URL_ROOT.'/admin/menus/edit.php?menuId='.GETPOSTINT('menuId').'" method="POST" name="formmenucreate">';
289 print '<input type="hidden" name="action" value="add">';
290 print '<input type="hidden" name="token" value="'.newToken().'">';
291
292 print dol_get_fiche_head();
293
294 print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
295 print '<table class="border centpercent">';
296
297 // Id
298 $parent_rowid = GETPOSTINT('menuId');
299 $parent_mainmenu = '';
300 $parent_leftmenu = '';
301 $parent_langs = '';
302 $parent_level = '';
303
304 if (GETPOSTINT('menuId')) {
305 $sql = "SELECT m.rowid, m.mainmenu, m.leftmenu, m.level, m.langs";
306 $sql .= " FROM ".MAIN_DB_PREFIX."menu as m";
307 $sql .= " WHERE m.rowid = ".(GETPOSTINT('menuId'));
308 $res = $db->query($sql);
309 if ($res) {
310 while ($menu = $db->fetch_array($res)) {
311 $parent_rowid = $menu['rowid'];
312 $parent_mainmenu = $menu['mainmenu'];
313 $parent_leftmenu = $menu['leftmenu'];
314 $parent_langs = $menu['langs'];
315 $parent_level = $menu['level'];
316 }
317 }
318 }
319
320 // Handler
321 print '<tr><td class="fieldrequired">'.$langs->trans('MenuHandler').'</td>';
322 print '<td>';
323 $formadmin->select_menu_families($menu_handler.(preg_match('/_menu/', $menu_handler) ? '' : '_menu'), 'menu_handler', array_merge($dirstandard, $dirsmartphone));
324 print '</td>';
325 print '<td>'.$langs->trans('DetailMenuHandler').'</td></tr>';
326
327 // User
328 print '<tr><td class="nowrap fieldrequired">'.$langs->trans('MenuForUsers').'</td>';
329 print '<td><select class="flat" name="user" id="menuuser">';
330 print '<option value="2" selected>'.$langs->trans("AllMenus").'</option>';
331 print '<option value="0">'.$langs->trans('Internal').'</option>';
332 print '<option value="1">'.$langs->trans('External').'</option>';
333 print '</select>';
334 print ajax_combobox('menuuser');
335 print '</td>';
336 print '<td>'.$langs->trans('DetailUser').'</td></tr>';
337
338 // Type
339 print '<tr><td class="fieldrequired">'.$langs->trans('Position').'</td><td>';
340 if ($parent_rowid) {
341 print $langs->trans('Left');
342 print '<input type="hidden" name="type" value="left">';
343 } else {
344 print '<select name="type" class="flat" id="topleft">';
345 print '<option value="">&nbsp;</option>';
346 print '<option value="top"'.(GETPOST("type") == 'top' ? ' selected' : '').'>'.$langs->trans('Top').'</option>';
347 print '<option value="left"'.(GETPOST("type") == 'left' ? ' selected' : '').'>'.$langs->trans('Left').'</option>';
348 print '</select>';
349 print ajax_combobox('topleft');
350 }
351 print '</td><td>'.$langs->trans('DetailType').'</td></tr>';
352
353 // Mainmenu code
354 print '<tr><td class="fieldrequired">'.$langs->trans('MainMenuCode').'</td>';
355 print '<td><input type="text" class="minwidth300" id="propertymainmenu" name="propertymainmenu" value="'.(GETPOSTISSET("propertymainmenu") ? GETPOST("propertymainmenu", 'alphanohtml') : '').'"></td>';
356 print '<td>';
357 print $langs->trans("Example").': mytopmenukey';
358 print '</td></tr>';
359
360 // MenuId Parent
361 print '<tr><td>'.$langs->trans('MenuIdParent').'</td>';
362 if ($parent_rowid) {
363 print '<td>'.$parent_rowid.'<input type="hidden" name="menuIdParent" value="'.$parent_rowid.'"></td>';
364 } else {
365 print '<td><input type="text" class="minwidth300" id="menuIdParent" name="menuIdParent" value="'.(GETPOSTISSET("menuIdParent") ? GETPOST("menuIdParent", 'alphanohtml') : '').'"></td>';
366 }
367 print '<td>'.$langs->trans('DetailMenuIdParent');
368 print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def';
369 print '</td></tr>';
370
371 // Title
372 print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td>';
373 print '<td><input type="text" class="minwidth300" name="titre" value="'.dol_escape_htmltag(GETPOST("titre", 'alphanohtml')).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
374
375 // URL
376 print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td>';
377 print '<td><input type="text" class="minwidth500" name="url" value="'.dol_escape_htmltag(GETPOST("url", 'alphanohtml')).'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
378
379 // Picto
380 print '<tr><td>'.$langs->trans('Image').'</td>';
381 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>';
382
383 // Langs
384 print '<tr><td>'.$langs->trans('LangFile').'</td>';
385 print '<td><input type="text" class="minwidth300" name="langs" value="'.dol_escape_htmltag($parent_langs).'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
386
387 // Position
388 print '<tr><td>'.$langs->trans('Position').'</td>';
389 print '<td><input type="text" class="width100" name="position" value="'.((int) (GETPOSTISSET("position") ? GETPOSTINT("position") : 100)).'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
390
391 // Enabled
392 print '<tr><td>'.$langs->trans('Enabled').'</td>';
393 print '<td><input type="text" class="minwidth500" name="enabled" value="'.(GETPOSTISSET('enabled') ? GETPOST("enabled", 'alphanohtml') : '1').'"></td><td>'.$langs->trans('DetailEnabled').'</td></tr>';
394
395 // Perms
396 print '<tr><td>'.$langs->trans('Rights').'</td>';
397 print '<td><input type="text" class="minwidth500" name="perms" value="'.(GETPOSTISSET('perms') ? GETPOST('perms', 'alphanohtml') : '1').'"></td><td>'.$langs->trans('DetailRight').'</td></tr>';
398
399 // Target
400 print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target" id="target">';
401 if ($menu instanceof Menubase) {
402 print '<option value=""'.(isset($menu->target) && $menu->target == "" ? ' selected' : '').'>&nbsp;</option>';
403 print '<option value="_blank"'.(isset($menu->target) && $menu->target == "_blank" ? ' selected' : '').'>'.$langs->trans('_blank').'</option>';
404 }
405 print '</select>';
406 print ajax_combobox("target");
407 print '</td></td><td>'.$langs->trans('DetailTarget').'</td></tr>';
408
409 print '</table>';
410 print '</div>';
411
412 print dol_get_fiche_end();
413
414 print $form->buttonsSaveCancel();
415
416 print '</form>';
417} elseif ($action == 'edit') {
418 print load_fiche_titre($langs->trans("ModifMenu"), '', 'title_setup');
419 print '<br>';
420
421 print '<form action="./edit.php" method="POST" name="formmenuedit">';
422 print '<input type="hidden" name="action" value="update">';
423 print '<input type="hidden" name="token" value="'.newToken().'">';
424 print '<input type="hidden" name="handler_origine" value="'.$menu_handler.'">';
425 print '<input type="hidden" name="menuId" value="'.GETPOSTINT('menuId').'">';
426
427 print dol_get_fiche_head();
428
429 print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
430 print '<table class="border centpercent">';
431
432 $menu = new Menubase($db);
433 $result = $menu->fetch(GETPOSTINT('menuId'));
434 //var_dump($menu);
435
436 // Id
437 print '<tr><td>'.$langs->trans('Id').'</td><td>'.$menu->id.'</td><td>'.$langs->trans('DetailId').'</td></tr>';
438
439 // Module
440 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>';
441
442 // Handler
443 if ($menu->menu_handler == 'all') {
444 $handler = $langs->trans('AllMenus');
445 } else {
446 $handler = $menu->menu_handler;
447 }
448 print '<tr><td class="fieldrequired">'.$langs->trans('MenuHandler').'</td><td>'.$handler.'</td><td>'.$langs->trans('DetailMenuHandler').'</td></tr>';
449
450 // User
451 print '<tr><td class="nowrap fieldrequired">'.$langs->trans('MenuForUsers').'</td><td>';
452 print '<select class="flat" name="user" id="menuuser">';
453 print '<option value="2"'.($menu->user == 2 ? ' selected' : '').'>'.$langs->trans("AllMenus").'</option>';
454 print '<option value="0"'.($menu->user == 0 ? ' selected' : '').'>'.$langs->trans('Internal').'</option>';
455 print '<option value="1"'.($menu->user == 1 ? ' selected' : '').'>'.$langs->trans('External').'</option>';
456 print '</select>';
457 print ajax_combobox('menuuser');
458 print '</td><td>'.$langs->trans('DetailUser').'</td></tr>';
459
460 // Type
461 print '<tr><td class="fieldrequired">'.$langs->trans('Position').'</td>';
462 print '<td>'.$langs->trans(ucfirst($menu->type)).'</td><td>'.$langs->trans('DetailType').'</td></tr>';
463
464 // Mainmenu code
465 if ($menu->type == 'top') {
466 print '<tr><td class="fieldrequired">'.$langs->trans('MainMenuCode').'</td>';
467 /*if ($parent_rowid)
468 {
469 print '<td>'.$parent_rowid.'<input type="hidden" name="propertyleftmenu" value="'.$parent_rowid.'"></td>';
470 }
471 else
472 {*/
473 print '<td><input type="text" class="minwidth300" id="propertymainmenu" name="propertymainmenu" value="'.(GETPOST("propertymainmenu", 'alphanohtml') ? GETPOST("propertymainmenu", 'alphanohtml') : $menu->mainmenu).'"></td>';
474 //}
475 print '<td>';
476 print $langs->trans("Example").': mytopmenukey';
477 print '</td></tr>';
478 }
479
480 // MenuId Parent
481 print '<tr><td class="fieldrequired">'.$langs->trans('MenuIdParent');
482 print '</td>';
483 $valtouse = $menu->fk_menu;
484 if ($menu->fk_mainmenu) {
485 $valtouse = 'fk_mainmenu='.$menu->fk_mainmenu;
486 }
487 if ($menu->fk_leftmenu) {
488 $valtouse .= '&fk_leftmenu='.$menu->fk_leftmenu;
489 }
490 print '<td><input type="text" name="menuIdParent" value="'.dol_escape_htmltag(GETPOSTISSET('menuIdParent') ? GETPOST('menuIdParent') : $valtouse).'" class="minwidth300"></td>';
491 print '<td>'.$langs->trans('DetailMenuIdParent');
492 print ', <span class="opacitymedium">'.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def</span>';
493 print '</td></tr>';
494
495 // Niveau
496 //print '<tr><td>'.$langs->trans('Level').'</td><td>'.$menu->level.'</td><td>'.$langs->trans('DetailLevel').'</td></tr>';
497
498 // Title
499 print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td>';
500 print '<td><input type="text" class="minwidth300" name="titre" value="'.dol_escape_htmltag($menu->title).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
501
502 // URL
503 print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td>';
504 print '<td><input type="text" class="quatrevingtpercent" name="url" value="'.dol_escape_htmltag($menu->url).'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
505
506 // Picto
507 print '<tr><td class="fieldrequired">'.$langs->trans('Image').'</td>';
508 print '<td><input type="text" class="minwidth300" name="picto" value="'.dol_escape_htmltag($menu->prefix).'"></td><td>'.$langs->trans('Example').': fa-global</td></tr>';
509
510 // Langs
511 print '<tr><td>'.$langs->trans('LangFile').'</td>';
512 print '<td><input type="text" class="minwidth300" name="langs" value="'.dol_escape_htmltag($menu->langs).'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
513
514 // Position
515 print '<tr><td>'.$langs->trans('Position').'</td>';
516 print '<td><input type="text" class="minwidth100" name="position" value="'.((int) $menu->position).'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
517
518 // Enabled
519 print '<tr><td>'.$langs->trans('Enabled').'</td>';
520 print '<td><input type="text" class="minwidth500" name="enabled" value="'.dol_escape_htmltag($menu->enabled).'"></td><td>'.$langs->trans('DetailEnabled');
521 if (!empty($menu->enabled)) {
522 print ' <span class="opacitymedium">('.$langs->trans("ConditionIsCurrently").':</span> '.yn((int) dol_eval($menu->enabled, 1, 1, '1') <= 0 ? 0 : 1).')';
523 }
524 print '</td></tr>';
525
526 // Perms
527 print '<tr><td>'.$langs->trans('Rights').'</td>';
528 print '<td><input type="text" class="minwidth500" name="perms" value="'.dol_escape_htmltag($menu->perms).'"></td><td>'.$langs->trans('DetailRight');
529 if (!empty($menu->perms)) {
530 print ' <span class="opacitymedium">('.$langs->trans("ConditionIsCurrently").':</span> '.yn((int) dol_eval($menu->perms, 1, 1, '1') <= 0 ? 0 : 1).')';
531 }
532 print '</td></tr>';
533
534 // Target
535 print '<tr><td>'.$langs->trans('Target').'</td><td>';
536 print '<select class="flat" id="target" name="target">';
537 print '<option value=""'.($menu->target == "" ? ' selected' : '').'>&nbsp;</option>';
538 print '<option value="_blank"'.($menu->target == "_blank" ? ' selected' : '').'>'.$langs->trans('_blank').'</option>';
539 print '</select>';
540 print ajax_combobox("target");
541 print '</td><td>'.$langs->trans('DetailTarget').'</td></tr>';
542
543 print '</table>';
544 print '</div>';
545
546 print dol_get_fiche_end();
547
548 print $form->buttonsSaveCancel();
549
550 print '</form>';
551
552 print '<br>';
553}
554
555// End of page
556llxFooter();
557$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:459
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:71
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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.