Skip to content

Commit

Permalink
The default submenu of all top menus is always the first submenu
Browse files Browse the repository at this point in the history
  • Loading branch information
sonertari committed Oct 24, 2017
1 parent 6b62024 commit 24f3fde
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/View/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,22 +122,31 @@
?>
<ul>
<?php
$SelectedStyleSet= FALSE;
foreach ($TopMenuConf['SubMenu'] as $SubMenuName => $Caption) {
$LiStyle= '';
$AStyle= '';
if (($TopMenu == $TopMenuName) && ($Submenu == $SubMenuName)) {
$LiStyle= ACTIVE_LI_STYLE;
$AStyle= ACTIVE_A_STYLE;
} else {
if (!$SelectedStyleSet) {
// The default model is the module
$MenuModel= $View->Module;
// But some top menus may define different models
if (isset($TopMenuConf['Model'])) {
$MenuModel= $TopMenuConf['Model'];
}
if (isset($_SESSION[$MenuModel][$TopMenuName]['submenu']) && $_SESSION[$MenuModel][$TopMenuName]['submenu'] == $SubMenuName) {

if (($TopMenu == $TopMenuName) && ($Submenu == $SubMenuName)) {
// The active submenu of the active topmenu
// @attention This should be the first if condition, otherwise the selected style is applied instead of the active one
$LiStyle= ACTIVE_LI_STYLE;
$AStyle= ACTIVE_A_STYLE;
$SelectedStyleSet= TRUE;
} else if (!isset($_SESSION[$MenuModel][$TopMenuName]['submenu']) ||
$_SESSION[$MenuModel][$TopMenuName]['submenu'] == $SubMenuName) {
// The default submenu of all top menus is always the first submenu,
// or we set the last visited submenu of all top menus
$LiStyle= SELECTED_LI_STYLE;
$AStyle= SELECTED_A_STYLE;
$SelectedStyleSet= TRUE;
}
}
?>
Expand Down

0 comments on commit 24f3fde

Please sign in to comment.