function module_menu($pages, $return = false) { $module = $GLOBALS["APP"]["INSTANCE"]->GetController()->GetModule(); $menu = ''; foreach ($pages as $title => $name) { if (!is_array($name) && strtolower($name) == strtolower($module)) { $class = ' class="active"'; $sr = '<span class="sr-only">(current)</span>'; } else { $class = $sr = ''; } $menu_item = ''; if (is_array($name)) { $menu_item .= '<li class="dropdown">'; $menu_item .= ' <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">' . ucfirst($title) . ' <span class="caret"></span></a>'; $menu_item .= ' <ul class="dropdown-menu">'; $menu_item .= module_menu($name, true); $menu_item .= ' </ul>'; $menu_item .= '</li>'; } else { $menu_item = "<li{$class}><a href=\"/{$name}\">" . ucfirst($name) . "{$sr}</a></li>"; } $menu .= $menu_item; } if ($return) { return $menu; } else { echo $menu; } }
<div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="#">Arbor Solutions</a> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <?php module_menu(array("Select Module" => array_keys(array_flip($GLOBALS["APP"]["MODULE_MAP"])))); ?> </ul> <ul class="nav navbar-nav"> <?php nav_menu($GLOBALS["APP"]["NAVIGATION"][strtolower($GLOBALS["APP"]["INSTANCE"]->_controller->GetModule())]); ?> </ul> <ul class="nav navbar-nav navbar-right"> <?php user_options_menu(); ?> </ul> </div><!-- /.navbar-collapse --> </div><!-- /.container-fluid --> </nav>
function showmenu($menudb) { global $jj, $part, $menu_partDB, $Smenu, $db, $pre, $userdb; foreach ($menudb as $key1 => $value2) { if (!in_array($key1, $menu_partDB[$part])) { continue; } $jj++; $show .= leftlink($value2, $key1); } $system_menu = module_menu(); if ($system_menu) { $_r = $db->get_one("SELECT adminmember FROM {$pre}module WHERE pre='{$Smenu}'"); $detail = explode("\r\n", $_r[adminmember]); if ($userdb[groupid] == 3 || $userdb[username] && in_array($userdb[username], $detail)) { foreach ($system_menu as $path => $menudb) { foreach ($menudb as $key1 => $value2) { $jj++; $show .= leftlink($value2, $key1, $path); } } } } return $show; }