<?php
/*
* 控制面板菜单
* @author: moufer<moufer@163.com>
* @version: 1.0.0
* @copyright: www.modoer.com
* @Date: 2007-10-11 v1.0.0
*/
(!defined('IN_ADMIN') || !defined('IN_MUDDER')) && exit('Access Denied');

$tabmenu = empty($tab) || empty($arr_main[$tab]) ? 'arr_menu' : 'arr_'.$tab;
$showmenu = '';
$items = 0;
foreach($$tabmenu as $menuvalue) {
    $showmenu .= "<dl>\r\n";
    foreach($menuvalue as $k => $y) {
        $m_action = $m_caption = $m_file = $m_op = '';
        if($k === 'module') continue;
        if($k === 'title') {
            $items++;
            $showmenu .= "\t<dt><a href=\"###\" onclick=\"showHide('items$items');\" target=\"_self\">$y</a></dt>\r\n";
            $showmenu .= "\t<dd id=\"items$items\" style=\"display:block;\">\r\n";
            $showmenu .= "\t\t<ul>\r\n";
        } else {
            list($m_action,$m_caption,$m_file,$m_op) = explode('|', $y);
            $params = array('action='.$m_action);
            $m_file && $params[] = 'file='.$m_file;
            $m_op && $params[] = 'op='.$m_op;
            $showmenu .= "\t\t\t".'<li><a href="admincp.php?'.implode('&amp;',$params).'" target="main">'.$m_caption.'</a></li>'."\r\n";
            unset($params);
        }
    }
    $showmenu .= "\t\t<ul>\r\n";
    $showmenu .= "\t<dd>\r\n";
    $showmenu .= "</dl>\r\n";
}
/*
<dl>
    <dt><a href="###" onclick="showHide('items8');" target="_self">自动任务</a></dt>
    <dd id="items8" style="display:block;">
        <ul>
            <li><a href='makehtml_all.php' target='main'>一键更新网站</a></li>
            <li><a href='makehtml_task.php' target='main'>系统计划任务</a></li>
        </ul>
    </dd>
</dl>


foreach($arr_main as $menu_key => $menu_value) {
    $display = ($action == $menu_key) ? 'style="display:block;"' : 'style="display:none;"';
    $showmenu .= '<div id="menu_'.$menu_key.'" '.$display.'>'."\r\n";
    $menus = 'arr_' . $menu_key;
    foreach($$menus as $menu) {
        foreach($menu as $k => $y) {
            $m_action = $m_caption = $m_file = $m_op = '';
            if($k === 'title') {
                $showmenu .= '<ul class="sub_menu">'."\r\n\t\t".'<span>'.$y.'</span>'."\r\n";
            } else {
                list($m_action,$m_caption,$m_file,$m_op) = explode('|', $y);
                $showmenu .= "\t\t".'<li><a href="admincp.php?action='.$m_action.'&file='.$m_file.'&op='.$m_op.'" target="main">'.$m_caption.'</a></li>'."\r\n";
            }
        }
        $showmenu .= "\t".'</ul>'."\r\n";
    }
    $showmenu .= "\t".'</div>'."\r\n";
}
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=<?=$charset?>" />
<link rel="stylesheet" type="text/css" id="css" href="./images/admin/admin.css">
</head>
<script type="text/javascript">

function getObject(objectId) {
 if(document.getElementById && document.getElementById(objectId)) {
 // W3C DOM
 return document.getElementById(objectId);
 }
 else if (document.all && document.all(objectId)) {
 // MSIE 4 DOM
 return document.all(objectId);
 }
 else if (document.layers && document.layers[objectId]) {
 // NN 4 DOM.. note: this won't find nested layers
 return document.layers[objectId];
 }
 else {
 return false;
 }
}

function showHide(objname){
    var obj = getObject(objname);
    if(obj.style.display == "none"){
		obj.style.display = "block";
	}else{
		obj.style.display = "none";
	}
}
</script>
<body>
<div id="left_menu">
    <?=$showmenu?>
</div>
</body>
</html>