<?php 
	$this->display(tpl('head',true));
?>
<style>
	.layui-table thead tr th{
		text-align: center;
	}
</style>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  	<legend>友情链接管理</legend>
</fieldset>
<table class="layui-table" cellspacing="0" cellpadding="0" border="0"  lay-filter="demoEvent">
	<thead>
		<tr>
			<th width="40">Id</th>
			<th>名称</th>
			<th width="100">链接</th>
			<th width="100">所属分类</th>
			<th width="100">站标</th>
			<th width="100">有效期</th>
			<th width="100">显示方式</th>
			<th width="100">状态</th>
			<th width="130">操作</th>
		</tr>
	</thead>
	<tbody>
		<?php foreach($data AS $row) { ?>
			
		<tr>
			<td align="center"><?php echo $row['id'] ?></td>
			<td><?php echo $row['title'] ?></td>
			<td align="center"><?php echo $row['link'] ?></td>
			<td align="center"><?php echo $row['name'] ?></td>
			<td>
				<?php if($row['thumb']){ ?>
				<?php
					if(preg_match('/(http|https):\/\/([\w\d\-_]+[\.\w\d\-_]+)[:\d+]?([\/]?[\w\/\.]+)/', $row['thumb'] )){ 
						$thumb=$row['thumb'];
					}else{ 
						$thumb=get_img_url($row['thumb']);
					}
				?>
				<img src="<?php echo $thumb ?>" width="120" height="35"/>
				<?php } ?>
			</td>
			<td align="center"><?php if($row['vld']) {echo date('Y-m-d',$row['vld']);}else{ echo '长期有效';} ?></td>
			<td align="center">
				<?php $row[is_w] ? $is_w= '文字' : $is_w= '图标' ?>
				<?php echo $is_w ?>
			</td>
			<td align="center">
				<?php if($row[state]==1){ ?>
					<span class="green">已审并显示</span>
				<?php }elseif($row[state]==0){ ?>
					<span class="blue">待审核</span>
				<?php }elseif($row[state]=='-1'){ ?>
					<span class="red">黑名单</span>
				<?php }else{ ?>
					<span class="red">已拒绝</span>
				<?php } ?>
			</td>
			<td align="center">
				<a class="layui-btn layui-btn-sm layui-btn-warm" href="<?php echo PLUGIN_ACTION ?>friend/edit/id_<?php echo $row[id] ?>">编辑</a>
				<a class="layui-btn layui-btn-sm layui-btn-danger" href="<?php echo PLUGIN_ACTION ?>friend/del/id_<?php echo $row[id] ?>">删除</a>
			</td>
		</tr>
		<?php } ?>
	</tbody>
</table>
<div class="page">
	<?php echo $Get_Page ?>
</div>
<?php 
	$this->display(tpl('foot',true));
?>
