/** * 构造框架左侧菜单页面 * * @param array $leftMenu : 菜单配置数组 * @return void stdout */ function leftMenu($leftMenu) { if (!is_array($leftMenu)) { exit('leftMenu must be array'); } //返回允许的方法 $action_list = returnAction(); $menuLinks = ''; $menucount = 0; $collapse = isset($_COOKIE['collapse']) ? $_COOKIE['collapse'] : ''; $topMenu = array_keys($leftMenu); if (is_array($topMenu)) { foreach ($topMenu as $key => $menuDiv) { $menuLinks .= $key ? '</div><div id="' . $menuDiv . '" style="display: none">' : '<div id="' . $menuDiv . '">'; $subMenu = array_keys($leftMenu[$menuDiv]); foreach ($subMenu as $subMenuKey) { $menuLinks .= '<table width="146" border="0" cellspacing="0" align="center" cellpadding="0" class="leftmenulist" style="margin-bottom: 5px;">'; $menus = $leftMenu[$menuDiv][$subMenuKey]['array']; $menucount++; $collapsed = preg_match("/\\[{$menucount}\\]/", $collapse); $menuLinks .= '<tr class="leftmenutext"><td><a href="###" onclick="collapse_change(' . $menucount . ')"><img id="menuimg_' . $menucount . '" src="./' . MOOPHP_ADMIN_DIR . '/images/menu_' . ($collapsed ? 'add' : 'reduce') . '.gif" border="0"/></a> ' . '<a href="###" onclick="collapse_change(' . $menucount . ')">' . $leftMenu[$menuDiv][$subMenuKey]['name'] . '</a></td></tr>' . '<tbody id="menu_' . $menucount . '" style="display:' . ($collapsed ? 'none' : '') . '">' . '<tr class="leftmenutd"><td><table border="0" cellspacing="0" cellpadding="0" class="leftmenuinfo">'; foreach ($menus as $menuData) { if (in_array($menuData['navcode'], $action_list)) { $menuLinks .= $menuData['title'] ? '<tr><td><a href="' . $menuData['url'] . '" target="main">' . $menuData['title'] . '</a></td></tr>' : ''; } else { $menuLinks .= $menuData['title'] ? '<tr style="display:none;"><td><a href="' . $menuData['url'] . '" target="main">' . $menuData['title'] . '</a></td></tr>' : ''; } //$menuLinks .= $menuData['title'] ? '<tr><td><a href="'.$menuData['url'].'" target="main">'.$menuData['title'].'</a></td></tr>' : ''; } $menuLinks .= '</table></td></tr></tbody>'; $menuLinks .= "</table>\n"; } } $menuLinks .= '</div>'; } $param = array('menuLinks' => $menuLinks); echo $this->getHTML('leftHtml', $param); exit; }
//print_r($str);exit; $groupid = $GLOBALS['groupid']; if (in_array($groupid, $GLOBALS['admin_service_pre'])) { $pass = "******"; } else { $pass = "******"; } require_once adminTemplate('admin_index'); } /***********************************************控制层(C)*****************************************/ //左侧分类列表 $type_list = array(); //登录组应该显示的菜单,即大分类 $allow_nav = returnNav(); //返回允许的方法,即子分类 $allow_action_list = returnAction(); //权限拥有的左侧列表 foreach ($allow_nav as $k => $v1) { if (isset($leftMenu[$v1])) { foreach ($leftMenu[$v1] as $k2 => $v2) { foreach ($allow_action_list as $k3 => $v3) { if ($k2 != $v3) { unset($leftMenu[$k2]); } else { $type_list[$k]['typename'] = $menu_nav_arr[$v1]; //大分类 $type_list[$k]['subname'][$k3]['title'] = $leftMenu[$v1][$v3]['title']; //子分类 $type_list[$k]['subname'][$k3]['url'] = $leftMenu[$v1][$v3]['url']; //子分类链接 }