<?php include $this->admin_tpl('meta');?>
<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 href="javascript:;" onclick="yzm_dels('ids')" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a> <a href="javascript:;" onclick="adopt()" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe6a7;</i> 通过审核</a> <a href="javascript:;" onclick="show_mess()" class="btn btn-warning radius"><i class="Hui-iconfont">&#xe6dd;</i> 退稿</a></span> <span class="r">共有数据：<strong><?php echo $total?></strong> 条</span> </div>
  <form method="post" action="<?php echo U('del');?>" id="myform">
	<table cellpadding='0' cellspacing='1' style="border:1px solid #006699;margin:5px 0;display:none;width:30%" id="mess"><tr><td colspan='2'><textarea name="content_c" style="width:300px;height:60px;margin:5px;padding:2px;border:1px solid #888"  onfocus="if(this.value == this.defaultValue) this.value = ''" onblur="if(this.value.replace(' ','') == '') this.value = this.defaultValue;">请输入退稿理由，退稿理由将会以短消息方式发送！</textarea></td><td><input type="button" value='发送' class="orderbutton btn-primary radius" onclick="rejection()">&nbsp;</td></tr>
	</table>
  <table class="table table-border table-bordered table-bg table-hover yzm-table-sort">
    <thead>
      <tr class="text-c">
        <th width="25"><input type="checkbox"></th>
		<th>标题</th>
		<th width="120">发布人<?php echo field_order('userid');?></th>
		<th width="135">更新时间<?php echo field_order('updatetime');?></th>
		<th width="110">内容分类<?php echo field_order('catid');?></th>
		<th width="70">所属模型</th>
		<th width="50">状态<?php echo field_order('status');?></th>
		<th width="55">管理操作</th>
      </tr>
    </thead>
    <tbody>
		<?php 
		foreach($data as $val){
		list($val['modelid'], $val['id']) = explode('_', $val['checkid']);
		?>
		  <tr class="text-c">
			<td><input type="checkbox" value="<?php echo $val['checkid']?>" name="ids[]"></td>
			<td class="text-l">
			<a href="<?php echo U('public_preview', array('catid'=>$val['catid'], 'id'=>$val['id']));?>" target="_blank" ><?php echo $val['title'];?></a>	
			</td>
			<td><?php echo $val['username'];?></td>
			<td><?php echo date('Y-m-d H:i:s', $val['updatetime'])?></td>
			<td><?php echo get_catname($val['catid']);?></td>
			<td><?php echo get_model($val['modelid'], 'name')?></td>
			<td><?php echo $val['status']=='0' ? '<span class="label radius">未审核</span>' : ($val['status']=='1' ? '<span class="label label-success radius">已通过</span>' :'<span class="label label-danger radius">已退稿</span>');?></td>
			<td>
				<a title="编辑" href="javascript:;" onclick="yzm_open_full('编辑内容','<?php echo U('admin/content/edit',array('modelid'=>$val['modelid'],'id'=>$val['id'],'is_draft'=>1));?>')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a> 
				<a title="预览" href="<?php echo U('public_preview', array('catid'=>$val['catid'], 'id'=>$val['id']));?>" class="ml-5" target="_blank" style="text-decoration:none"><i class="Hui-iconfont">&#xe695;</i></a>
			</td>
		  </tr>		
		<?php 
		}
		?>
    </tbody>
  </table>
  </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>
<?php include $this->admin_tpl('footer');?>
<script type="text/javascript">
//通过审核
function adopt(){
	if ($("input[name='ids[]']:checked").length<1){
	   layer.alert('请勾选信息！');
	   return false;
	}	
	document.getElementById('myform').action='<?php echo U('adopt');?>';
	document.getElementById('myform').submit();
}

function show_mess(){
   $("#mess").toggle();
}

//退稿
function rejection(){
	if ($("input[name='ids[]']:checked").length<1){
	   layer.alert('请勾选信息！');
	   return false;
	}	
	document.getElementById('myform').action='<?php echo U('rejection');?>';
	document.getElementById('myform').submit();
}
</script>

</body>
</html>