<?php include $this->admin_tpl('meta', 'admin');?>
<title>广告管理 - YzmCMS内容管理系统</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</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="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
  <div class="cl pd-5 bg-1 bk-gray"> 
	  <span class="l">
	  <a class="btn btn-primary radius" onclick="yzm_open('添加广告','<?php echo U('add');?>','700','500')" href="javascript:;"><i class="Hui-iconfont">&#xe600;</i> 添加广告</a>
	  <a href="javascript:;" onclick="yzm_dels('id')" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>  
	  </span> 
	  <span class="r">共有数据：<strong><?php echo $total?></strong> 条</span> 
  </div>
  <form method="post" action="<?php echo U('del');?>" id="myform">
  <table class="table table-border table-bordered table-bg table-hover table-sort">
    <thead>
      <tr class="text-c">
		<th width="25"><input type="checkbox"></th>
		<th>名称</th>
		<th>类型</th>
		<th>链接地址</th>
		<th>描述</th>
		<th>状态</th>
		<th>添加时间</th>
		<th>管理操作</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['title']?></td>
			<td><?php echo $val['type']==1 ? '文字形式' : ($val['type']==2 ? 'HTML代码' : '图片形式');?></td>
			<td><a href="<?php echo htmlspecialchars($val['url'])?>" target="_blank"><?php echo htmlspecialchars($val['url'])?></a></td>
			<td><?php echo $val['describe'] ? htmlspecialchars($val['describe']) : '无';?></td>
			<td><?php echo $val['end_time']==0 || $val['end_time']>SYS_TIME ? '正常' : '<span class="c-red">已过期</span>';?></td>
			<td><?php echo date('Y-m-d H:i:s', $val['inputtime'])?></td>
			<td>
				<a title="编辑广告" href="javascript:;" onclick="yzm_open('编辑广告','<?php echo U('edit', array('id'=>$val['id']));?>','700','500')" class="yzm-box-img btn-secondary"><i class="Hui-iconfont">&#xe6df;</i> 编辑广告</a> 
				<a title="复制标签" href="javascript:;" onclick="yzm_copy('{adver(<?php echo $val['id']?>)}')" class="yzm-box-img btn-success"><i class="Hui-iconfont">&#xe6ea;</i> 复制标签</a>
			</td>
		  </tr>		
		<?php 
		}
		?>
    </tbody>
  </table>
  <?php if(!$data){ ?><div class="yzm_no_data"><i class="Hui-iconfont">&#xe6e0;</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', 'admin');?>
<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>