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