26 require
'../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
30 $action =
GETPOST(
'action',
'aZ09');
31 $cancel =
GETPOST(
'cancel',
'alpha');
34 $langs->loadLangs(array(
"companies",
"products",
"admin",
"users",
"other"));
41 $dirstandard = array();
42 $dirsmartphone = array();
43 $dirmenus = array_merge(array(
"/core/menus/"), (array) $conf->modules_parts[
'menus']);
44 foreach ($dirmenus as $dirmenu) {
45 $dirstandard[] = $dirmenu.
'standard';
46 $dirsmartphone[] = $dirmenu.
'smartphone';
53 $err = error_reporting();
57 error_reporting($err);
64 if ($action ==
'update' && !$cancel) {
65 $_SESSION[
"mainmenu"] =
"home";
68 dolibarr_set_const($db,
"MAIN_MENU_SMARTPHONE",
GETPOST(
'MAIN_MENU_SMARTPHONE',
'alpha'),
'chaine', 0,
'', $conf->entity);
70 dolibarr_set_const($db,
"MAIN_MENUFRONT_STANDARD",
GETPOST(
'MAIN_MENUFRONT_STANDARD',
'alpha'),
'chaine', 0,
'', $conf->entity);
71 dolibarr_set_const($db,
"MAIN_MENUFRONT_SMARTPHONE",
GETPOST(
'MAIN_MENUFRONT_SMARTPHONE',
'alpha'),
'chaine', 0,
'', $conf->entity);
74 $listofmenuhandler = array();
75 $listofmenuhandler[preg_replace(
'/(_backoffice|_frontoffice|_menu)?\.php/i',
'',
GETPOST(
'MAIN_MENU_STANDARD',
'alpha'))] = 1;
76 $listofmenuhandler[preg_replace(
'/(_backoffice|_frontoffice|_menu)?\.php/i',
'',
GETPOST(
'MAIN_MENUFRONT_STANDARD',
'alpha'))] = 1;
77 if (
GETPOST(
'MAIN_MENU_SMARTPHONE',
'alpha')) {
78 $listofmenuhandler[preg_replace(
'/(_backoffice|_frontoffice|_menu)?\.php/i',
'',
GETPOST(
'MAIN_MENU_SMARTPHONE',
'alpha'))] = 1;
80 if (
GETPOST(
'MAIN_MENUFRONT_SMARTPHONE',
'alpha')) {
81 $listofmenuhandler[preg_replace(
'/(_backoffice|_frontoffice|_menu)?\.php/i',
'',
GETPOST(
'MAIN_MENUFRONT_SMARTPHONE',
'alpha'))] = 1;
85 foreach ($listofmenuhandler as $key => $val) {
87 $dirmenus = array_merge(array(
"/core/menus/"), (array) $conf->modules_parts[
'menus']);
88 foreach ($dirmenus as $dirmenu) {
89 $file =
'init_menu_'.$key.
'.sql';
93 if (file_exists($fullpath)) {
96 $result =
run_sql($fullpath, 1,
'', 1, $key,
'none');
101 setEventMessages($langs->trans(
"FailedToInitializeMenu").
' '.$key,
null,
'errors');
112 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
125 $wikihelp =
'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
133 $head[$h][0] = DOL_URL_ROOT.
"/admin/menus.php";
134 $head[$h][1] = $langs->trans(
"MenuHandlers");
135 $head[$h][2] =
'handler';
138 $head[$h][0] = DOL_URL_ROOT.
"/admin/menus/index.php";
139 $head[$h][1] = $langs->trans(
"MenuAdmin");
140 $head[$h][2] =
'editor';
143 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
144 print
'<input type="hidden" name="token" value="'.newToken().
'">';
145 print
'<input type="hidden" name="action" value="update">';
149 print
'<span class="opacitymedium">'.$langs->trans(
"MenusDesc").
"</span><br>\n";
156 print
'<table class="noborder centpercent">';
157 print
'<tr class="liste_titre"><td width="35%">'.$langs->trans(
"Menu").
'</td>';
159 print
$form->textwithpicto($langs->trans(
"InternalUsers"), $langs->trans(
"InternalExternalDesc"));
162 print
$form->textwithpicto($langs->trans(
"ExternalUsers"), $langs->trans(
"InternalExternalDesc"));
167 print
'<tr class="oddeven"><td>'.$langs->trans(
"DefaultMenuManager").
'</td>';
169 $formadmin->select_menu(empty($conf->global->MAIN_MENU_STANDARD_FORCED) ? $conf->global->MAIN_MENU_STANDARD : $conf->global->MAIN_MENU_STANDARD_FORCED,
'MAIN_MENU_STANDARD', $dirstandard, empty($conf->global->MAIN_MENU_STANDARD_FORCED) ?
'' :
' disabled');
172 $formadmin->select_menu(empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED) ? $conf->global->MAIN_MENUFRONT_STANDARD : $conf->global->MAIN_MENUFRONT_STANDARD_FORCED,
'MAIN_MENUFRONT_STANDARD', $dirstandard, empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED) ?
'' :
' disabled');
177 print
'<tr class="oddeven"><td>'.$langs->trans(
"DefaultMenuSmartphoneManager").
'</td>';
179 $formadmin->select_menu(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED) ? $conf->global->MAIN_MENU_SMARTPHONE : $conf->global->MAIN_MENU_SMARTPHONE_FORCED,
'MAIN_MENU_SMARTPHONE', array_merge($dirstandard, $dirsmartphone), empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED) ?
'' :
' disabled');
181 if (!empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED) && preg_match(
'/smartphone/', $conf->global->MAIN_MENU_SMARTPHONE_FORCED)
182 || (empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED) && !empty($conf->global->MAIN_MENU_SMARTPHONE) && preg_match(
'/smartphone/', $conf->global->MAIN_MENU_SMARTPHONE))) {
183 print
' '.img_warning($langs->transnoentitiesnoconv(
"ThisForceAlsoTheme"));
188 $formadmin->select_menu(empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED) ? $conf->global->MAIN_MENUFRONT_SMARTPHONE : $conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED,
'MAIN_MENUFRONT_SMARTPHONE', array_merge($dirstandard, $dirsmartphone), empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED) ?
'' :
' disabled');
190 if (!empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED) && preg_match(
'/smartphone/', $conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED)
191 || (empty($conf->global->MAIN_MENUFRONT_SMARTPHONE_FORCED) && !empty($conf->global->MAIN_MENU_SMARTPHONE) && preg_match(
'/smartphone/', $conf->global->MAIN_MENUFRONT_SMARTPHONE))) {
192 print
' '.img_warning($langs->transnoentitiesnoconv(
"ThisForceAlsoTheme"));
202 print
'<div class="center">';
203 print
'<input class="button button-save" type="submit" name="save" value="'.$langs->trans(
"Save").
'">';