<?php include $this->admin_tpl('meta');?>
<title>自定义配置 - YzmCMS内容管理系统</title>
</head>
<body>
<nav class="breadcrumb"><i class="yzm-iconfont yzm-iconai-home"></i> 首页 <span class="c-gray en">&gt;</span> 系统管理 <span class="c-gray en">&gt;</span> 自定义配置 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="yzm-iconfont yzm-iconshuaxin"></i></a></nav>
<div class="page-container">
  <div class="explain light"> 
     <p><span class="yzm-iconfont yzm-iconshuoming"></span>用户可以根据需要自己添加配置，所添加的配置信息与系统配置信息等效.</p>
  </div>
  <div class="cl mt-15 tb-top"> 
	  <span class="l">
	  <a class="btn btn-primary radius" onclick="yzm_open('添加配置','<?php echo U('user_config_add');?>','700','500')" href="javascript:;"><i class="yzm-iconfont yzm-icontianjia"></i> 添加配置</a>
	  <a href="javascript:;" onclick="yzm_dels('id')" class="btn btn-danger radius"><i class="yzm-iconfont yzm-iconshanchu2"></i> 批量删除</a>  
	  <a href="<?php echo U('user_config_export');?>" class="btn btn-success radius"><i class="yzm-iconfont yzm-icondaochu"></i> 导出配置</a>  
	  <a onclick="yzm_open('导入配置','<?php echo U('user_config_import');?>','550','300')" href="javascript:;" class="btn btn-warning radius"><i class="yzm-iconfont yzm-icondaochu"></i> 导入配置</a>  
	  </span> 
	  <span class="r">共有数据：<strong><?php echo $total?></strong> 条</span> 
  </div>
  <form method="post" action="<?php echo U('user_config_del');?>" id="myform">
  <table class="table table-border table-bg table-hover table-sort">
    <thead>
      <tr class="text-c">
	    <th width="30"><input type="checkbox"></th>
		<th>配置名称</th>
        <th>配置类型</th>
        <th>配置值</th>
		<th>简洁说明</th>
        <th>启用</th>
        <th width="200">操作</th>
      </tr>
    </thead>
    <tbody>
		<?php 
		foreach($data as $val){
		?>
		  <tr class="text-c">
		    <td><input type="checkbox" value="<?php echo $val['id']?>" name="id[]"></td>
			<td><?php echo $val['name']?></td>
			<td><?php echo $val['fieldtype']?></td>
			<td>
				<?php 
					if($val['fieldtype'] == 'image'){
						echo '<span style="color:#0a6999;font-size:14px;vertical-align:middle;" onmouseover="yzm_img_browse(this, \''.$val['value'].'\')" onmouseout="layer.closeAll(\'tips\')" class="yzm-iconfont yzm-icontupian1 pointer"></span> '.$val['value'];
					}else{
						echo str_cut($val['value'],80); 
					}
				?>
			</td>
			<td><?php echo $val['title'] ? $val['title'] : '无';?></td>
			<td>
				<?php if($val['status']){ ?>
				<span class="yzm-status-enable" data-field="status" data-id="<?php echo $val['id']?>" onclick="yzm_change_status(this,'<?php echo U('public_change_status');?>')"><i class="yzm-iconfont">&#xe81f;</i>是</span>
				<?php }else{ ?>
				<span class="yzm-status-disable" data-field="status" data-id="<?php echo $val['id']?>" onclick="yzm_change_status(this,'<?php echo U('public_change_status');?>')"><i class="yzm-iconfont">&#xe601;</i>否</span>
				<?php } ?>
			</td>
			<td>
				<a title="编辑配置" href="javascript:;" onclick="yzm_open('编辑配置','<?php echo U('user_config_edit',array('id'=>$val['id']));?>','700','500')" class="yzm-box-img btn-primary"><i class="yzm-iconfont yzm-iconbianji1"></i> 编辑</a> 
				<a title="复制标签" href="javascript:;" onclick="yzm_copy('{$site[<?php echo $val['name']?>]}')" class="yzm-box-img btn-success"><i class="yzm-iconfont yzm-iconfuzhi"></i> 复制</a>
			</td>
		  </tr>		
		<?php 
		}
		?>
    </tbody>
  </table>
  <?php if(!$data){ ?><div class="yzm_no_data"><i class="yzm-iconfont yzm-iconshuoming"></i> 暂无数据</div><?php } ?>
  </form>
  <div id="page"><span class="page_left">共<?php echo $total?>条记录，共<?php echo $page->total()?>页，当前显示第<?php echo $page->getpage()?>页</span>
  <span class="page_right"><?php echo $page->getfull();?></span></div>
</div>
<input id="copytext" type="text" style="width:1px;height:1px;opacity:0">
<?php include $this->admin_tpl('footer');?>
<script type="text/javascript">
	function yzm_copy(val) {
		$("#copytext").val(val).select();
        try { var state = document.execCommand("copy"); } catch (err) { var state = false; }
        if (state) {
            layer.msg('复制成功！', {icon:1,time:1000});
        } else {
            layer.msg('复制失败，请更换浏览器重试！', {icon:2});
        }
	}
</script>
</body>
</html>