<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
  	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  	<title>网站后台</title>
  	<link rel="stylesheet" href="<?php echo ADMIN_WEBURL ?>/public/global/layui/css/layui.css">
  	<link rel="stylesheet" href="<?php echo ADMIN_WEBURL ?>/public/admin/images/index.css">
  	<script type="text/javascript" src="/public/global/jquery/1.11.1/jquery.min.js" ></script>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
  	<div class="layui-header">
    	<div class="layui-logo"><img src="/public/admin/images/admin_logo.png"/></div>
    	<ul class="layui-nav layui-layout-left">
      		<li class="layui-nav-item" >
      			<a class="nav" href="../" target="_blank">
	      			<span class="home iconfont icon-index"></span>
	      			<span>网站首页</span>
      			</a>
      		</li>
      		<li class="layui-nav-item"><a class="nav" href="javascript:void('0');" onclick="return system_checked('admin')"><span class="home iconfont icon-houtai"></span><span>主后台</span></a></li>
			
			<li class="layui-nav-item">
				<a class="nav" href="javascript:void('0');" onclick="return system_checked('home')">
					<span class="home iconfont icon-setting"></span><span>home设置</span>
				</a>
			</li>
			
			<li class="layui-nav-item">
				<a class="nav" href="javascript:;"><span class="home iconfont icon-mokuai"></span><span>模块系统</span></a>
				<?php if($modular){ ?>
				<dl class="layui-nav-child">
					<?php foreach($modular AS $key=>$row) { ?>
					<dd><a href="javascript:void('0');" onclick="return system_checked('<?php echo $row['dir'] ?>')"><?php echo $row['name'] ?></a></dd>					
					<?php } ?>
				</dl>
				<?php } ?>
			</li>
			<li class="layui-nav-item">
				<a class="nav" href="javascript:;"><span class="home iconfont icon-chajian"></span><span>插件系统</span></a>
				<?php if($pluginDB){ ?>
				<dl class="layui-nav-child">
					<?php foreach($pluginDB AS $key=>$row) { ?>
					<dd><a href="javascript:void('0');" onclick="return system_checked('<?php echo $row['dir'] ?>')"><?php echo $row['name'] ?></a></dd>					
					<?php } ?>
				</dl>
				<?php } ?>
			</li>
			<li class="layui-nav-item"><a class="nav" id="upgrade_menu" href="javascript:void('0');" onclick="return system_checked('upgrade')"><span class="home iconfont icon-shengji"></span><span>在线升级</span></a></li>
    	</ul>
    	<script>
    		var menu='';
    		function system_checked(a){
    			if(!menu){
    				$('#admin').fadeOut("slow");
    				$('#'+a).fadeIn("slow");
    			}else{
    				$('#'+menu).fadeOut("slow");
    				$('#'+a).fadeIn("slow");	
    			}
    			menu=a;
    		}
    	</script>
		<ul class="layui-nav layui-layout-right">
			<li class="layui-nav-item">
				<a href="/admin/index/out">
					<span class="home iconfont icon-tuichu"></span>
	      			<span>退出</span>
				</a>
			</li>
		</ul>
	</div>
	<div class="layui-side layui-bg-black">
		<div class="layui-side-scroll">
			<!-- 左侧导航区域（可配合layui已有的垂直导航） -->
			<ul class="layui-nav layui-nav-tree" id="admin">
				<li class="layui-nav-item layui-nav-itemed">
					<a class="" href="javascript:;">全局网站设置</a>
					<dl class="layui-nav-child">
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/setting/index" data-id="setting_set">网站设置</a></dd>
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/setting/article" data-id="setting_article">内容参数设置</a></dd>
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/setting/admin" data-id="setting_article">后台登陆限制</a></dd>
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/setting/gd" data-id="setting_gd">水印及缩略图设置</a></dd>
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/setting/stmp" data-id="setting_stmp">邮箱参数设置</a></dd>
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/setting/caching" data-id="setting_cache">高速缓存参数设置</a></dd>
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/setting/mysqlslave" data-id="mysqlslave">MySql主从设置</a></dd>
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/homemenu/index" data-id="homemenu_alllist">网站导航菜单设置</a></dd>
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/setting/Shielding_words" data-id="Setting_Shielding_words">屏蔽词设置</a></dd>
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/setting/trigger_state_words" data-id="trigger_state_words">触发审核词设置</a></dd>
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/Modular/index" data-id="Modular_alllist">模块管理</a></dd>
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/plugin/index" data-id="plugin_alllist">插件管理</a></dd>
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/hook/index" data-id="hook_index">钩子管理</a></dd>
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/setting/allcache" data-id="setting_allcache">一键更新全站缓存</a></dd>
					</dl>
				</li>
				<li class="layui-nav-item layui-nav-itemed">
					<a href="javascript:;" class="menu">云市场</a>
					<dl class="layui-nav-child">
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/cloud/modular" data-id="cloud_modular">模块市场</a></dd>
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/cloud/plugin" data-id="cloud/plugin">插件市场</a></dd>
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/cloud/hook" data-id="cloud/hook">钩子市场</a></dd>
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/cloud/tpl" data-id="cloud/tpl">模板市场</a></dd>
					</dl>
				</li>
				<li class="layui-nav-item layui-nav-itemed">
					<a href="javascript:;">权限管理</a>
					<dl class="layui-nav-child">
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/group/add" data-id="group_add">添加用户组</a></dd>
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/group/power" data-id="group_power">权限管理</a></dd>
					</dl>
				</li>
				<li class="layui-nav-item layui-nav-itemed">
					<a href="javascript:;">用户管理</a>
					<dl class="layui-nav-child">
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/user/add" data-id="user_add">添加用户</a></dd>
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/user/index" data-id="user_list">用户管理</a></dd>
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/renzheng/setting" data-id="user_add">用户认证设置</a></dd>
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/renzheng/index" data-id="user_add">用户认证管理</a></dd>
					</dl>
				</li>
			</ul>
			
			<ul class="layui-nav layui-nav-tree" id="home" style="display: none;">
				<li class="layui-nav-item layui-nav-itemed">
					<a href="javascript:;">设置</a>
					<dl class="layui-nav-child">
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/setting/home" data-id="setting_set">home设置</a></dd>
					</dl>
				</li>
				
				<li class="layui-nav-item layui-nav-itemed">
					<a href="javascript:;">栏目管理</a>
					<dl class="layui-nav-child">
						<dd>
							<a href="javascript:void('0')" class=" site-active" data-url="/admin/category/add" data-id="news_category_add">创建栏目</a>
						</dd>
						<dd>
							<a href="javascript:void('0')" class=" site-active" data-url="/admin/category/index" data-id="news_category_alllist">栏目管理</a>
						</dd>
					</dl>
				</li>
				<li class="layui-nav-item layui-nav-itemed">
					<a href="javascript:;">文章管理</a>
					<dl class="layui-nav-child">
						<dd>
							<a href="javascript:void('0')" class=" site-active" data-url="/admin/articles/add" data-id="news_articles_add">添加文章</a>
						</dd>
						<dd>
							<a href="javascript:void('0')" class=" site-active" data-url="/admin/articles/index" data-id="news_articles_alllist">文章管理</a>
						</dd>
					</dl>
				</li>
				<li class="layui-nav-item layui-nav-itemed">
					<a href="javascript:;">专题管理</a>
					<dl class="layui-nav-child">
						<dd>
							<a href="javascript:void('0')" class=" site-active" data-url="/admin/special/category" data-id="news_special_category">专题分类管理</a>
						</dd>
						<dd>
							<a href="javascript:void('0')" class=" site-active" data-url="/admin/special/index" data-id="news_special_alllist">专题管理</a>
						</dd>
					</dl>
				</li>
				
				<li class="layui-nav-item layui-nav-itemed">
					<a href="javascript:;">评论管理</a>
					<dl class="layui-nav-child">
						<dd>
							<a href="javascript:void('0')" class=" site-active" data-url="/admin/comment/index" data-id="news_comment_alllist">评论管理</a>
						</dd>
					</dl>
				</li>
				
				<li class="layui-nav-item layui-nav-itemed">
					<a href="javascript:;">数据模型</a>
					<dl class="layui-nav-child">
						<dd>
							<a href="javascript:void('0')" class=" site-active" data-url="/admin/module/add" data-id="news_Module_add">创建模型</a>
						</dd>
						<dd>
							<a href="javascript:void('0')" class=" site-active" data-url="/admin/module/index" data-id="news_Module_alllist">模型列表</a>
						</dd>
					</dl>
				</li>
			</ul>
			<ul class="layui-nav layui-nav-tree" id="upgrade" style="display: none;">
				<li class="layui-nav-item layui-nav-itemed">
				<a href="javascript:;">升级检测</a>
				<dl class="layui-nav-child">
					<dd><a href="javascript:void('0')" id="upgrade_all" class="site-active" data-url="/admin/upgrade/all" data-id="upgrade_all">全部检测</a></dd>
					<dd><a href="javascript:void('0')" class="site-active" data-url="/admin/upgrade/mvc" data-id="upgrade_mvc">只检测主程序</a></dd>
					<dd><a href="javascript:void('0')" class="site-active" data-url="/admin/upgrade/modular" data-id="upgrade_modular">只检测模块</a></dd>
					<dd><a href="javascript:void('0')" class="site-active" data-url="/admin/upgrade/plugin" data-id="upgrade_plugin">只检测插件</a></dd>
				</dl>
				</li>
			</ul>
			<?php foreach($Modular_DB AS $key=>$RS) {?>
			<ul class="layui-nav layui-nav-tree" id="<?php echo $RS[dir] ?>" style="display: none;">
				<?php foreach($RS['rute']['POWER'] AS $_key=>$RSS) { ?>
					<?php if($_key=='upfile') continue?>
					<?php if($RSS['list']) { ?>
						<?php foreach($RSS['list'] AS $__key=>$_RSS){?>
						<li class="layui-nav-item layui-nav-itemed">
							<a href="javascript:;"><?php ECHO $_RSS[name] ?></a>
							<dl class="layui-nav-child">
							<?php foreach($_RSS['power'] AS $___key=>$__RSS) { ?>
								<?php 
									if($__RSS[if_show]){ 
										$__RSS['class'] ? $class=$__RSS['class']: $class= $_key;
										$__RSS['method'] ? $method = $__RSS['method'] : $method = $___key;
								?>
									
									<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/index/modular/<?php echo $RS[dir].'/'.$class.'/'.$method.$_RSS['parameter'] ?>" data-id="<?PHP echo $RS[dir].'_'.$__key.'_'.$___key.$_RSS['parameter'] ?>"><?PHP echo $__RSS[name] ?></a></dd>
								<?php } ?>
							<?php } ?>
							</dl>
						</li>
						<?php } ?>
					<?php }else{ ?>
						<li class="layui-nav-item layui-nav-itemed">
							<a href="javascript:;"><?php ECHO $RSS[name] ?></a>
							<dl class="layui-nav-child">
							<?php foreach($RSS['power'] AS $key_=>$_RSS) { ?>
								<?php
									if($_RSS[if_show]){
										$_RSS['class'] ? $class=$_RSS['class']: $class= $_key;
										$_RSS['method'] ? $method = $_RSS['method'] : $method = $key_;
								 ?>
										<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/index/modular/<?php echo $RS[dir].'/'.$class.'/'.$method .$_RSS['parameter']?>" data-id="<?PHP echo $RS[dir].'_'.$_key.'_'.$key_ .$_RSS['parameter']?>"><?PHP echo $_RSS[name] ?></a></dd>
								<?php } ?>
							<?php } ?>
							</dl>
						</li>
					<?php } ?>
				<?php } ?>
			</ul>
			<?php } ?>
			<?php foreach($pluginDB AS $key=>$RS) { ?>
			<ul class="layui-nav layui-nav-tree" id="<?php echo $RS[dir] ?>" style="display: none;">
				<?php foreach($RS['rute']['POWER'] AS $_key=>$RSS) { ?>
				<li class="layui-nav-item layui-nav-itemed">
					<a href="javascript:;"><?php ECHO $RSS[name] ?></a>
					<dl class="layui-nav-child">
					<?php foreach($RSS['power'] AS $key_=>$_RSS) { ?>
						<?php if($_RSS[if_show]){ ?>
						<dd><a href="javascript:void('0')" class=" site-active" data-url="/admin/index/plugin/<?php echo $RS[dir].'/'.$_key.'/'.$key_ ?>" data-id="<?PHP echo $RS[dir].'_'.$_key.'_'.$key_ ?>"><?PHP echo $_RSS[name] ?></a></dd>
						<?php } ?>
					<?php } ?>
					</dl>
				</li>
				<?php } ?>
			</ul>
			<?php } ?>
		</div>
	</div>
	<div class="layui-body">
		<style>
			.layui-body .layui-side{
				width: 86.5%;
			}
			.layui-tab{
				margin: 0;
			}
		</style>
		<div class="layui-tab layui-side" lay-filter="Menu" lay-allowclose="true">
			<ul class="layui-tab-title">
			    <li class="layui-this" lay-id="setting_map" id="setting_map">控制面板</li>
			</ul>
			<div class="layui-tab-content">
			    <div class="layui-tab-item layui-show"><iframe  src="<?php echo $maps ?>"  ></iframe></div>
			</div>
		</div>
		
		
	    <!-- 内容主体区域 -->
	    
	</div>
</div>
<style>
	iframe {
		width:100%;
		margin:0 0 1em;
		border:0;
	}
</style>
<script type="text/javascript" src="/public/global/layui/layui.js"></script>
<script>
	layui.use(['element'], function(){
		var $ = layui.jquery
		,element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块
		var active = {
		    tabAdd: function(){
		    	var a=$(".layui-tab-title").children('li')
		    	for(i=0;i< a.length ;i++){
		    		if($(this).data('id')===a[i].getAttribute("lay-id")){
		    			document.getElementById('iframe_'+$(this).data('id')).src=$(this).data('url');
		    			element.tabChange('Menu', $(this).data('id')); //切换到：用户管理
		    			return false;
		    		}
		    	}
		      	//新增一个Tab项
			    element.tabAdd('Menu', {
			        title: this.innerHTML
			        ,content: '<iframe id="iframe_'+$(this).data('id')+'" src="'+$(this).data('url')+'"></iframe>'
			        ,id: $(this).data('id') //实际使用一般是规定好的id，这里以时间戳模拟下
			    })
		       	element.tabChange('Menu', $(this).data('id')); //切换到：用户管理
		       	//iframe自适应
			    $(window).on('resize', function () {
			        var content = $('.layui-side .layui-tab-content');
			        content.height($(this).height() - 147);
			        content.find('iframe').each(function () {
			            $(this).height(content.height());
			            //console.log(content.height());
			        });
			    }).resize();
		    }
		    
		};
		$('#setting_map i').hide();
		$('.site-active').on('click', function(){
		    var othis = $(this);
		    active['tabAdd'] ? active['tabAdd'].call(this, othis) : '';
		});
		show_tab();
		function show_tab(){
			var content = $('.layui-side .layui-tab-content');
			content.height($(this).height() - 147);
			content.find('iframe').each(function () {
				$(this).height(content.height());
			});
		}
		
	});
	function upgarde(){
		$('#upgrade_menu').click();
	    $('#upgrade_all').click();
	}
</script>
</body>
</html>
