{include file='public/meta'}
<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 btn-refresh" 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">
	<!--search -->
     广告位已经固定,不能自由添加广告位
	<!-- end search -->
	<div class="cl pd-5 bg-1 bk-gray mt-20">
		<span class="l">
			<a class="btn btn-primary size-S radius" href="<?php echo url('admin/adv/publish');?>">发布</a>
		</span>
		
	</div>
	<div class="mt-20">
		<table class="table table-border table-bordered table-hover table-bg">
			<thead>
				<tr class="text-c">
					<th width="25"><input type="checkbox" class='checkbox' ></th>
					<th>ID</th>
					<th>标题</th>
					<th>位置</th>
					<th>创建时间</th>
					<th>更新时间</th>
					<th>状态</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<?php 
				foreach($rows as $key=>$value){
				$place = get_one_by_item($places,'id',$value['place']);
				?>
				<tr class="text-c">
					<td><input type="checkbox" value="<?php echo $value['id'];?>" name="ids"></td>
					<td><?php echo $value['id'];?></td>
					<td><?php echo $value['title'];?></td>
					<td><?php echo $place['name'];?></td>
					<td><?php echo date('Y-m-d H:i',$value['ctime']);?></td>
					<td><?php echo date('Y-m-d H:i',$value['mtime']);?></td>
					<td><?php echo 1==$value['is_active']? '有效':'无效';?></td>
					<td class="f-14" >
			        	<a title="编辑" href="<?php echo url('admin/adv/edit',['id'=>$value['id']]);?>" class='btn size-MINI' style="text-decoration:none">编辑</a>
						<a title="删除" href="javascript:;" class='btn size-MINI' onclick="del(this,'<?php echo $value['id'];?>')" class="ml-5" style="text-decoration:none">删除</a>
			        </td>
				</tr>
				<?php }?>
			</tbody>
		</table>
		<div><?php echo $rows->render();?></div>
	</div>
</div>
{include file='public/footer'}

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__LIB__/laydate/laydate.js"></script>
<script type="text/javascript" src="__LIB__/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript">
/*系统-栏目-删除*/
function del(obj,id){
	layer.confirm('确认要删除吗？',function(index){
		$.post(
			"<?php echo url('admin/adv/delete');?>",
			{"id":id},
			function(data){
				layer.msg(data.msg,{icon:1,time:1000});
				if(0==data.error){
					$(obj).parents("tr").remove();
				}
			},'json'
		)
	});
}


function delmul(obj,id){
	var vals= getCheckVals('ids');
	if(vals.length==0){
		layer.msg('请选择数据');
		return false;
	}
	layer.confirm('确认要删除吗？',function(index){
		$.post(
			"<?php echo url('admin/adv/deletemul');?>",
			{"ids":vals},
			function(data){
				layer.msg(data.msg,{icon:1,time:1000});
				if(0==data.error){
					setTimeout(function(){
						location.reload();
					},1000)
				}
			},'json'
		)
	});
}

</script>
</body>
</html>