<?php include $this->admin_tpl('meta', 'admin');?>
<title>选择文章 - YzmCMS内容管理系统</title>
</head>
<body>
<div class="page-container">
  <div> 
    <form action="<?php echo U(ROUTE_A);?>" method="get" id="search">
    内容标题：
     <input type="text" name="searinfo" class="input-text" style="width:200px" value="<?php if(isset($_GET['searinfo'])) echo $_GET['searinfo'];?>"><button name="dosubmit" class="btn btn-success" type="submit" value="1"><i class="Hui-iconfont">&#xe665;</i> 搜索</button> 
	 </form>	
  </div>
  <form method="post" action="" id="myform">
  <table class="table table-border table-bordered table-bg table-hover mt-10">
    <thead>
      <tr class="text-c">
        <th width="25"><input type="checkbox"></th>
		<th width="40">ID</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="ids[]"></td>
			<td><?php echo $val['id']?></td>
			<td class="text-l">
			<?php 
			if($val['thumb']){
				echo '<span style="color:#0a6999;margin-right:3px" onmouseover="yzm_img_browse(this, \''.$val['thumb'].'\')" onmouseout="layer.closeAll(\'tips\')"><i class="Hui-iconfont">&#xe646;</i></span>';
			}
			?>
			<a href="<?php echo $val['url'];?>" target="_blank" ><?php echo $val['title'];?></a>
			<?php
			if(strpos($val['flag'], '1') !== false){
				echo '<span class="yzm-font-style" title="置顶">顶</span>';
			}
			if(strpos($val['flag'], '2') !== false){
				echo '<span class="yzm-font-style" title="头条">头</span>';
			}
			if(strpos($val['flag'], '3') !== false){
				echo '<span class="yzm-font-style" title="特荐">特</span>';
			}
			if(strpos($val['flag'], '4') !== false){
				echo '<span class="yzm-font-style" title="推荐">推</span>';
			}
			if(strpos($val['flag'], '5') !== false){
				echo '<span class="yzm-font-style" title="热点">热</span>';
			}
			if(strpos($val['flag'], '6') !== false){
				echo '<span class="yzm-font-style" title="幻灯">幻</span>';
			}
			if(strpos($val['flag'], '7') !== false){
				echo '<span class="yzm-font-style" title="跳转">跳</span>';
			}
			if($val['readpoint']){
				echo '<span class="yzm-font-style" title="付费">付</span>';
			}			
			?>	
			</td>
			<td><?php echo get_catname($val['catid']);?></td>
			<td><?php echo date('Y-m-d H:i:s', $val['updatetime'])?></td>
		  </tr>		
		<?php 
		}
		?>
    </tbody>
  </table>
  <input class="dosubmit w_120 btn-primary radius mt-10" name="dosubmit" type="button" onclick="dosub()" value="确定">
  </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', 'admin');?>

<script type="text/javascript">

	function dosub(){
		var ids = $("input[name='ids[]']:checked");
		if (ids.length<1){
		   layer.alert('请选择文章！');
		   return false;
		}	
		
		var str = '';
		$.each(ids,function(){
			if(this.checked){
				str += $(this).val() + ',';
			}
         });
		str = str.substr(0,str.length-1);
		
		var index = parent.layer.getFrameIndex(window.name);
		parent.$("#relation_id").val(str);
		parent.layer.close(index);
	}
</script> 

</body>
</html>