<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:68:"D:\AQBox\www\mycms\public/../application/admin\view\index_index.html";i:1554777642;s:70:"D:\AQBox\www\mycms\public/../application/admin\view\public_header.html";i:1496819543;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>管理中心</title>
    <script type="text/javascript" src="__PUBLIC__/js/jquery.min.js"></script><script type="text/javascript" src="__COMMON__/js/common.js"></script><script type="text/javascript" src="__PUBLIC__/js/global.js"></script><script type="text/javascript" src="__COMMON__/js/layer.js"></script><script type="text/javascript" src="__PUBLIC__/plugin/date/jquery.datetimepicker.js"></script><script type="text/javascript" src="__PUBLIC__/js/wang.js"></script>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/css/public.css" /><link rel="stylesheet" type="text/css" href="__PUBLIC__/css/admin.css" /><link rel="stylesheet" type="text/css" href="__PUBLIC__/plugin/date/jquery.datetimepicker.css" />
</head>


<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/public.css" />
<script type="text/javascript">
    var cache = "<?php echo url('index/clear'); ?>";
    var logout_url = "<?php echo url('login/logout'); ?>";
    
    //无刷新重载栏目
    var reload_category = function (){
        var cate_html = '';
        $.get("<?php echo url('common/reloadCategory'); ?>",function(data){
            for(var k in data){
                var nav = data[k];
                var url_cls = get_url_by_modelid(nav.modelid, nav.url);
                //外链判断
                if (nav.type == 1){
                    cate_html += '<li><a href="'+ nav.url +'" target="_blank"><i class="nav"></i><em>'+ nav.name +'</em></a></li>';
                }else{
                    if (url_cls.status == 1) {
                        var furl = url_cls.url + '?id=' + nav.id;
                        cate_html += '<li><a href="'+ furl +'" target="main"><i class="'+ url_cls.cls +'"></i><em>'+ nav.name +'</em></a></li>';
                    }
                }
                //遍历子栏目
                if (typeof(nav.children) != 'undefined'){
                    for (var ck in nav.children){
                        var snav = nav.children[ck];
                        var url_cls2 = get_url_by_modelid(snav.modelid, snav.url);
                        if (snav.type == 1){
                            cate_html += '<li><a href="'+ snav.url +'" target="_blank"><i class="nav"></i><em>'+ snav.name +'</em></a></li>';
                        }else{
                            if (url_cls2.status == 1) {
                                var surl = url_cls2.url + '?id=' + snav.id;
                                cate_html += '<li><a href="'+ surl +'" target="main"><i class="'+ url_cls2.cls +'"></i><em>&nbsp;&nbsp;├&nbsp;&nbsp;'+ snav.name +'</em></a></li>'; 
                            }
                        }
                        //三级栏目
                        if (typeof(snav.children) != 'undefined'){
                            for (var ck in snav.children){
                                var tnav = snav.children[ck];
                                var url_cls3 = get_url_by_modelid(tnav.modelid, tnav.url);
                                if (tnav.type == 1){
                                    cate_html += '<li><a href="'+ tnav.url +'" target="_blank"><i class="nav"></i><em>'+ tnav.name +'</em></a></li>';
                                }else{
                                    if (url_cls3.status == 1) {
                                        var turl = url_cls3.url + '?id=' + tnav.id;
                                        cate_html += '<li><a href="'+ turl +'" target="main"><i class="'+ url_cls3.cls +'"></i><em>&nbsp;&nbsp;&nbsp;&nbsp;├&nbsp;&nbsp;'+ tnav.name +'</em></a></li>'; 
                                    }
                                }
                                
                            }
                        }
                    }
                }
            }
            $('#second-nav').html(cate_html);
        },'json');

        //根据modelid获取url 
        function get_url_by_modelid(modelid, url) {
            var url_cls = {};
            switch(modelid){
                    case 0:
                        url_cls.url = url;
                        url_cls.cls = 'articleCat';
                        url_cls.status = 1;
                        break;
                    case 1:
                        url_cls.url = "<?php echo url('article/index'); ?>";
                        url_cls.cls = 'articleCat';
                        url_cls.status = <?php echo has_auth_by_route('article/index'); ?>;
                        break;
                    case 2:
                        url_cls.url = "<?php echo url('page/edit'); ?>";
                        url_cls.cls = 'articleCat';
                        url_cls.status = <?php echo has_auth_by_route('page/edit'); ?>;
                        break;
                    case 3:
                    case 4:
                        url_cls.url = "<?php echo url('product/index'); ?>";
                        url_cls.cls = 'productCat';
                        url_cls.status = <?php echo has_auth_by_route('product/index'); ?>;
                        break;
                    default :
                        url_cls.url = "<?php echo url('comment/index'); ?>";
                        url_cls.cls = 'announcement';
                        url_cls.status = <?php echo has_auth_by_route('comment/index'); ?>;
                }

            return url_cls;
        }
        
    }
    reload_category();
</script>
<body style="height: 100%;overflow: hidden;background-color: #EEEEEE;">
    <div class="head">
        <div id="head">
            <div class="logo" style="background-color: #025088; height: 32px; padding-top: 8px"><a target="main" style="margin-left: 20px; margin-top: 15px; font-size: 18px; color: #fff">MyCMS后台管理</a></div>
            <div class="nav">
                <ul>
                    <li class="M"><a href="JavaScript:void(0);" class="topAdd">新建</a>
                        <div class="drop mTopad"><a href="<?php echo url('product/add'); ?>" target="main">产品</a> <a href="<?php echo url('article/add'); ?>" target="main">文章</a> <a href="<?php echo url('nav/add'); ?>" target="main">导航</a> <!--<a href="../show.html">首页幻灯</a>--> <a href="<?php echo url('page/add'); ?>" target="main">单页面</a> <a href="<?php echo url('admin/add'); ?>" target="main">管理员</a> <a href="#"></a> </div>
                    </li>
                    <li><a href="<?php echo $web_site; ?>" target="_blank">查看站点</a></li>
                    <?php if(has_auth_by_route('index/clear')): ?><li><a id="clear-cache" href="javascript:void(0);">清除缓存</a></li><?php endif; ?>
                    <li><a href="//www.zhmykj.com" target="_blank">帮助</a></li>
                    <!-- <li class="noRight"><a href="<?php echo url('nav/add'); ?>" target="main"> +</a></li> -->
                </ul>
                <ul class="navRight">
                    <li class="M noLeft"><a href="JavaScript:void(0);">您好，<?php echo $username; ?></a>
                        <div class="drop mUser">
                            <a href="<?php echo url('admin/edit',['id' => $userid]); ?>" target="main">编辑我的个人资料</a>
                            <a href="<?php echo url('admin/add'); ?>" target="main">添加账户</a>
                        </div>
                    </li>
                    <li class="noRight" id="logout"><a href="JavaScript:void(0);">退出</a></li>
                </ul>
            </div>
        </div>
    </div><!-- dcHead 结束 -->
    <!--包含公共模版-->
    <iframe src=""></iframe>
    <div class="left">
        <div id="menu">
            <ul class="top">
                <li><a href="<?php echo url('main/index'); ?>" target="main"><i class="home"></i><em>管理首页</em></a></li>
            </ul>
            <ul>
                <?php if(has_auth_by_route('index/system')): ?><li><a href="<?php echo url('index/system'); ?>" target="main"><i class="system" ></i><em>系统设置</em></a></li><?php endif; if(has_auth_by_route('nav/index')): ?><li><a href="<?php echo url('nav/index'); ?>" target="main"><i class="nav"></i><em>自定义导航栏</em></a></li><?php endif; if(has_auth_by_route('banner/index')): ?><li><a href="<?php echo url('banner/index'); ?>" target="main"><i class="show" ></i><em>幻灯广告</em></a></li><?php endif; if(has_auth_by_route('page/index')): ?><li><a href="<?php echo url('page/index'); ?>" target="main"><i class="page"></i><em>单页面管理</em></a></li><?php endif; ?>
            </ul>
            <ul>
                <li class="nav-manage top-nav"><a><i class="nav-nav"></i><em>栏目管理</em><span class="arrow"></span></a></li>
            </ul>
            <ul class="second-nav" id="second-nav">
                
            </ul>
            
            <ul class="bot">
                <!--<li><a href="backup.html" target="main"><i class="backup"></i><em>数据备份</em></a></li>-->
                <?php if(has_auth_by_route('admin/index')): ?><li><a href="<?php echo url('admin/index'); ?>" target="main"><i class="manager"></i><em>管理员</em></a></li><?php endif; if(has_auth_by_route('role/index')): ?><li><a href="<?php echo url('role/index'); ?>" target="main"><i class="role"></i><em>角色管理</em></a></li><?php endif; if(has_auth_by_route('flink/index')): ?><li><a href="<?php echo url('flink/index'); ?>" target="main"><i class="flink"></i><em>友情链接</em></a></li><?php endif; if(has_auth_by_route('flink/annindex')): ?> <li><a href="<?php echo url('flink/annindex'); ?>" target="main"><i class=""></i><em>公告管理</em></a></li><?php endif; if(has_auth_by_route('comment/index')): ?><li><a href="<?php echo url('comment/index'); ?>" target="main"><i class="announcement"></i><em>留言管理</em></a></li><?php endif; if(has_auth_by_route('log/index')): ?><li><a href="<?php echo url('log/index'); ?>" target="main"><i class="managerLog"></i><em>操作记录</em></a></li><?php endif; if(has_auth_by_route('article/copy')): ?><li><a href="<?php echo url('article/copy'); ?>" target="main"><i class="page"></i><em>转载文章</em></a></li><?php endif; ?>
            </ul>

        </div>
    </div>
    <div class="right"> <!-- 当前位置 -->
        <iframe id="main" name="main" class="rightContent" frameborder="0" scrolling="yes" src="<?php echo url('main/index'); ?>" ></iframe>
    </div>
</body>
<script type="text/javascript">
    $('.top-nav').click(function(){
        $('.second-nav').toggle(100);
        $('.arrow').toggleClass('active');
    })
</script>
</html>
