diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 7c70c3173ffaee6e22ae1eab7042c3c2cfbb6a17..18ffe81ecddb7e6db7f30ae4665b070fe0f98185 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -84,9 +84,9 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu) } else if ($showmode == 2) $classname='class="tmenu"'; - print_start_menu_entry_auguria($idsel,$classname); + print_start_menu_entry_auguria($idsel,$classname,$showmode); print_text_menu_entry_auguria($newTabMenu[$i]['titre'], $showmode, $url, $id, $idsel, $classname, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget)); - print_end_menu_entry_auguria(); + print_end_menu_entry_auguria($showmode); } print_end_menu_array_auguria(); @@ -111,12 +111,16 @@ function print_start_menu_array_auguria() * * @param string $idsel Text * @param string $classname String to add a css class + * @param int $showmode 0 = hide, 1 = allowed or 2 = not allowed * @return void */ -function print_start_menu_entry_auguria($idsel,$classname) +function print_start_menu_entry_auguria($idsel,$classname,$showmode) { - print '<li '.$classname.' id="mainmenutd_'.$idsel.'">'; - print '<div class="tmenuleft"></div><div class="tmenucenter">'; + if ($showmode) + { + print '<li '.$classname.' id="mainmenutd_'.$idsel.'">'; + print '<div class="tmenuleft"></div><div class="tmenucenter">'; + } } /** @@ -160,12 +164,16 @@ function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $cla /** * Output end menu entry * + * @param int $showmode 0 = hide, 1 = allowed or 2 = not allowed * @return void */ -function print_end_menu_entry_auguria() +function print_end_menu_entry_auguria($showmode) { - print '</div></li>'; - print "\n"; + if ($showmode) + { + print '</div></li>'; + print "\n"; + } } /** diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 64f415ac085083552bbbc76798dffdb912ee69f7..f7e5143344aa9586a7ca9177248b584fe28084cc 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -55,9 +55,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) else $classname = 'class="tmenu"'; $idsel='home'; - if (empty($noout)) print_start_menu_entry($idsel,$classname); + if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); if (empty($noout)) print_text_menu_entry($langs->trans("Home"), 1, DOL_URL_ROOT.'/index.php?mainmenu=home&leftmenu=', $id, $idsel, $classname, $atarget); - if (empty($noout)) print_end_menu_entry(); + if (empty($noout)) print_end_menu_entry($showmode); $menu->add('/index.php?mainmenu=home&leftmenu=', $langs->trans("Home"), 0, $showmode, $atarget, "home", ''); // Third parties @@ -73,9 +73,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) else $classname = 'class="tmenu"'; $idsel='companies'; - if (empty($noout)) print_start_menu_entry($idsel,$classname); + if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); if (empty($noout)) print_text_menu_entry($langs->trans("ThirdParties"), $showmode, DOL_URL_ROOT.'/societe/index.php?mainmenu=companies&leftmenu=', $id, $idsel, $classname, $atarget); - if (empty($noout)) print_end_menu_entry(); + if (empty($noout)) print_end_menu_entry($showmode); $menu->add('/societe/index.php?mainmenu=companies&leftmenu=', $langs->trans("ThirdParties"), 0, $showmode, $atarget, "companies", ''); } @@ -102,9 +102,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) $chaine.=$langs->trans("Services"); } - if (empty($noout)) print_start_menu_entry($idsel,$classname); + if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); if (empty($noout)) print_text_menu_entry($chaine, $showmode, DOL_URL_ROOT.'/product/index.php?mainmenu=products&leftmenu=', $id, $idsel, $classname, $atarget); - if (empty($noout)) print_end_menu_entry(); + if (empty($noout)) print_end_menu_entry($showmode); $menu->add('/product/index.php?mainmenu=products&leftmenu=', $chaine, 0, $showmode, $atarget, "products", ''); } @@ -126,9 +126,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) else $classname = 'class="tmenu"'; $idsel='commercial'; - if (empty($noout)) print_start_menu_entry($idsel,$classname); + if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); if (empty($noout)) print_text_menu_entry($langs->trans("Commercial"), $showmode, DOL_URL_ROOT.'/comm/index.php?mainmenu=commercial&leftmenu=', $id, $idsel, $classname, $atarget); - if (empty($noout)) print_end_menu_entry(); + if (empty($noout)) print_end_menu_entry($showmode); $menu->add('/comm/index.php?mainmenu=commercial&leftmenu=', $langs->trans("Commercial"), 0, $showmode, $atarget, "commercial", ""); } @@ -146,9 +146,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) else $classname = 'class="tmenu"'; $idsel='accountancy'; - if (empty($noout)) print_start_menu_entry($idsel,$classname); + if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); if (empty($noout)) print_text_menu_entry($langs->trans("MenuFinancial"), $showmode, DOL_URL_ROOT.'/compta/index.php?mainmenu=accountancy&leftmenu=', $id, $idsel, $classname, $atarget); - if (empty($noout)) print_end_menu_entry(); + if (empty($noout)) print_end_menu_entry($showmode); $menu->add('/compta/index.php?mainmenu=accountancy&leftmenu=', $langs->trans("MenuFinancial"), 0, $showmode, $atarget, "accountancy", ''); } @@ -167,9 +167,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) else $classname = 'class="tmenu"'; $idsel='bank'; - if (empty($noout)) print_start_menu_entry($idsel,$classname); + if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); if (empty($noout)) print_text_menu_entry($langs->trans("MenuBankCash"), $showmode, DOL_URL_ROOT.'/compta/bank/index.php?mainmenu=bank&leftmenu=', $id, $idsel, $classname, $atarget); - if (empty($noout)) print_end_menu_entry(); + if (empty($noout)) print_end_menu_entry($showmode); $menu->add('/compta/bank/index.php?mainmenu=bank&leftmenu=', $langs->trans("MenuBankCash"), 0, $showmode, $atarget, "bank", ''); } @@ -187,9 +187,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) else $classname = 'class="tmenu"'; $idsel='project'; - if (empty($noout)) print_start_menu_entry($idsel,$classname); + if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); if (empty($noout)) print_text_menu_entry($langs->trans("Projects"), $showmode, DOL_URL_ROOT.'/projet/index.php?mainmenu=project&leftmenu=', $id, $idsel, $classname, $atarget); - if (empty($noout)) print_end_menu_entry(); + if (empty($noout)) print_end_menu_entry($showmode); $menu->add('/projet/index.php?mainmenu=project&leftmenu=', $langs->trans("Projects"), 0, $showmode, $atarget, "project", ''); } @@ -207,9 +207,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) else $classname = 'class="tmenu"'; $idsel='tools'; - if (empty($noout)) print_start_menu_entry($idsel,$classname); + if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); if (empty($noout)) print_text_menu_entry($langs->trans("Tools"), $showmode, DOL_URL_ROOT.'/core/tools.php?mainmenu=tools&leftmenu=', $id, $idsel, $classname, $atarget); - if (empty($noout)) print_end_menu_entry(); + if (empty($noout)) print_end_menu_entry($showmode); $menu->add('/core/tools.php?mainmenu=tools&leftmenu=', $langs->trans("Tools"), 0, $showmode, $atarget, "tools", ''); } @@ -227,9 +227,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) else $classname = 'class="tmenu"'; $idsel='shop'; - if (empty($noout)) print_start_menu_entry($idsel,$classname); + if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); if (empty($noout)) print_text_menu_entry($langs->trans("OSCommerce"), $showmode, DOL_URL_ROOT.'/boutique/index.php?mainmenu=shop&leftmenu=', $id, $idsel, $classname, $atarget); - if (empty($noout)) print_end_menu_entry(); + if (empty($noout)) print_end_menu_entry($showmode); $menu->add('/boutique/index.php?mainmenu=shop&leftmenu=', $langs->trans("OSCommerce"), 0, $showmode, $atarget, "shop", ''); } @@ -245,9 +245,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) else $classname = 'class="tmenu"'; $idsel='members'; - if (empty($noout)) print_start_menu_entry($idsel,$classname); + if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); if (empty($noout)) print_text_menu_entry($langs->trans("MenuMembers"), $showmode, DOL_URL_ROOT.'/adherents/index.php?mainmenu=members&leftmenu=', $id, $idsel, $classname, $atarget); - if (empty($noout)) print_end_menu_entry(); + if (empty($noout)) print_end_menu_entry($showmode); $menu->add('/adherents/index.php?mainmenu=members&leftmenu=', $langs->trans("MenuMembers"), 0, $showmode, $atarget, "members", ''); } @@ -281,7 +281,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) } $url=preg_replace('/__LOGIN__/',$user->login,$url); $shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl); - + // Define the class (top menu selected or not) if (! empty($_SESSION['idmenu']) && $newTabMenu[$i]['rowid'] == $_SESSION['idmenu']) $classname='class="tmenusel"'; else if (! empty($_SESSION["mainmenu"]) && $newTabMenu[$i]['mainmenu'] == $_SESSION["mainmenu"]) $classname='class="tmenusel"'; @@ -289,9 +289,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0) } else if ($showmode == 2) $classname='class="tmenu"'; - if (empty($noout)) print_start_menu_entry($idsel,$classname); + if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); if (empty($noout)) print_text_menu_entry($newTabMenu[$i]['titre'], $showmode, $url, $id, $idsel, $classname, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget)); - if (empty($noout)) print_end_menu_entry(); + if (empty($noout)) print_end_menu_entry($showmode); $menu->add($shorturl, $newTabMenu[$i]['titre'], 0, $showmode, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget), ($newTabMenu[$i]['mainmenu']?$newTabMenu[$i]['mainmenu']:$newTabMenu[$i]['rowid']), ''); } @@ -315,19 +315,23 @@ function print_start_menu_array() * * @param string $idsel Text * @param string $classname String to add a css class + * @param int $showmode 0 = hide, 1 = allowed or 2 = not allowed * @return void */ -function print_start_menu_entry($idsel,$classname) +function print_start_menu_entry($idsel,$classname,$showmode) { - print '<li '.$classname.' id="mainmenutd_'.$idsel.'">'; - print '<div class="tmenuleft"></div><div class="tmenucenter">'; + if ($showmode) + { + print '<li '.$classname.' id="mainmenutd_'.$idsel.'">'; + print '<div class="tmenuleft"></div><div class="tmenucenter">'; + } } /** * Output menu entry * * @param string $text Text - * @param int $showmode 1 = allowed or 2 = not allowed + * @param int $showmode 0 = hide, 1 = allowed or 2 = not allowed * @param string $url Url * @param string $id Id * @param string $idsel Id sel @@ -364,11 +368,15 @@ function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname, /** * Output end menu entry * + * @param int $showmode 0 = hide, 1 = allowed or 2 = not allowed * @return void */ -function print_end_menu_entry() +function print_end_menu_entry($showmode) { - print '</div></li>'; + if ($showmode) + { + print '</div></li>'; + } print "\n"; } @@ -396,7 +404,7 @@ function print_end_menu_array() * @param array &$menu Object Menu to return back list of menu entries * @param int $noout Disable output (Initialise &$menu only). * @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x' - * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all) + * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all) * @return void */ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu,&$menu,$noout=0,$forcemainmenu='',$forceleftmenu='') @@ -1172,7 +1180,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $showmenu=true; if (! empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($menu_array[$i]['enabled'])) $showmenu=false; - + $alt++; if (empty($menu_array[$i]['level']) && $showmenu) { @@ -1185,7 +1193,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu print '<div class="blockvmenupair">'."\n"; } } - + // Place tabulation $tabstring=''; $tabul=($menu_array[$i]['level'] - 1); @@ -1196,12 +1204,12 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $tabstring.=' '; } } - + // For external modules $url = dol_buildpath($menu_array[$i]['url'], 1); - + print '<!-- Add menu entry with mainmenu='.$menu_array[$i]['mainmenu'].', leftmenu='.$menu_array[$i]['leftmenu'].', level='.$menu_array[$i]['level'].' -->'."\n"; - + // Menu niveau 0 if ($menu_array[$i]['level'] == 0) { @@ -1234,7 +1242,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu print '<div class="menu_contenu">'.$tabstring.'<font class="vsmenudisabled">'.$menu_array[$i]['titre'].'</font><br></div>'."\n"; } } - + // If next is a new block or end if (empty($menu_array[$i+1]['level'])) { @@ -1244,7 +1252,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu } } } - + return count($menu_array); } diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index ab63a03ae1289128ea2561ccd7eebbfac8c8a369..2e401e3cf103efa7ae84892a09f7ae901049fe0b 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -53,9 +53,9 @@ class MenuManager */ function loadMenu() { - - } - + + } + /** * Show menu @@ -71,17 +71,19 @@ class MenuManager require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php'; $this->menu=new Menu(); - + if ($mode == 'top') { print_start_menu_array_empty(); + // Home + $showmode=1; $idsel='home'; $classname='class="tmenusel"'; - print_start_menu_entry_empty($idsel, $classname); + print_start_menu_entry_empty($idsel, $classname, $showmode); print_text_menu_entry_empty($langs->trans("Home"), 1, dol_buildpath('/index.php',1).'?mainmenu=home&leftmenu=', $id, $idsel, $classname, $this->atarget); - print_end_menu_entry_empty(); + print_end_menu_entry_empty($showmode); print_end_menu_array_empty(); } @@ -190,12 +192,16 @@ function print_start_menu_array_empty() * * @param string $idsel Text * @param string $classname String to add a css class + * @param int $showmode 0 = hide, 1 = allowed or 2 = not allowed * @return void */ -function print_start_menu_entry_empty($idsel,$classname) +function print_start_menu_entry_empty($idsel,$classname,$showmode) { - print '<li '.$classname.' id="mainmenutd_'.$idsel.'">'; - print '<div class="tmenuleft"></div><div class="tmenucenter">'; + if ($showmode) + { + print '<li '.$classname.' id="mainmenutd_'.$idsel.'">'; + print '<div class="tmenuleft"></div><div class="tmenucenter">'; + } } /** @@ -235,12 +241,16 @@ function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $class /** * Output end menu entry * + * @param int $showmode 0 = hide, 1 = allowed or 2 = not allowed * @return void */ -function print_end_menu_entry_empty() +function print_end_menu_entry_empty($showmode) { - print '</div></li>'; - print "\n"; + if ($showmode) + { + print '</div></li>'; + print "\n"; + } } /**