diff --git a/module/common/model.php b/module/common/model.php index f038d52d53..ccce48f175 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -676,31 +676,27 @@ class commonModel extends model /* Print drop menus. */ if(isset($menuItem->dropMenu)) { - foreach($menuItem->dropMenu as $dropMenuItem) + foreach($menuItem->dropMenu as $dropMenuName => $dropMenuItem) { - if($dropMenuItem->hidden) continue; + if(isset($dropMenuItem->hidden) and $dropMenuItem->hidden) continue; - $subActive = ''; - $subModule = ''; - $subMethod = ''; - $subParams = ''; - $subProgram = ''; - $subLabel = $dropMenuItem->text; - if(isset($dropMenuItem->link['module'])) $subModule = $dropMenuItem->link['module']; - if(isset($dropMenuItem->link['method'])) $subMethod = $dropMenuItem->link['method']; - if(isset($dropMenuItem->link['vars'])) $subParams = $dropMenuItem->link['vars']; + /* Parse drop menu link. */ + $dropMenuLink = $dropMenuItem; + if(is_array($dropMenuItem) and isset($dropMenuItem['link'])) $dropMenuLink = $dropMenuLink['link']; + + list($subLabel, $subModule, $subMethod, $subParams) = explode('|', $dropMenuLink); $subLink = helper::createLink($subModule, $subMethod, $subParams); $subActive = ''; if($currentModule == strtolower($subModule) && $currentMethod == strtolower($subMethod)) { - $activeMenu = $menuItem->name; + $activeMenu = $dropMenuName; $active = 'active'; $subActive = 'active'; $label = $subLabel; } - $dropMenu .= "
  • " . html::a($subLink, $subLabel) . $subProgram . '
  • '; + $dropMenu .= "
  • " . html::a($subLink, $subLabel) . '
  • '; } if(empty($dropMenu)) continue; @@ -785,12 +781,12 @@ class commonModel extends model /* If this is not workflow then use rawModule and rawMethod to judge highlight. */ if($app->isFlow) { - $currentModule = $app->rawModule; - $currentMethod = $app->rawMethod; + $currentModule = $app->rawModule; + $currentMethod = $app->rawMethod; } - if($isTutorialMode and defined('WIZARD_MODULE')) $currentModule = WIZARD_MODULE; - if($isTutorialMode and defined('WIZARD_METHOD')) $currentMethod = WIZARD_METHOD; + if($isTutorialMode and defined('WIZARD_MODULE')) $currentModule = WIZARD_MODULE; + if($isTutorialMode and defined('WIZARD_METHOD')) $currentMethod = WIZARD_METHOD; /* The beginning of the menu. */ echo $isMobile ? '' : "