<?php require_once 'head.html';?>


                    <div class="container">
                        
                        <div class="row">                            
                            <div class="col-md-12">
    
                                <div class="block">
                                    <div class="head">
                                        <h2>全部链接</h2>
                                        <ul class="buttons">
                                            <li><a href="#" class="block_loading"><span class="i-cycle"></span></a></li>
                                            <li><a href="#" class="block_toggle"><span class="i-arrow-down-3"></span></a></li>
                                            <li><a href="#" class="block_remove"><span class="i-cancel-2"></span></a></li>
                                        </ul>                                        
                                    </div>
                                    <div class="content np">
                                     	<?php if(count($Query)){?>
			<table class="table table-striped table-bordered table-condensed">
				<thead>
					<tr>
						<th>序号</th>
						<th>链接</th>
						<th>状态</th>
						<th>查看</th>
						<th>描述</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>

				<?php $i=1;foreach ($Query as $link){?>
				<tr class="list-roles">
					<td><?php echo $i;?></td>
					<td><a href="?c=link&ip=edit&id=<?php echo $link['id'];?>"><?php echo $link['link_title'];?></a></td>
					<td><?php if($link['link_res']){?><a href="?c=link&ip=hidden&res=0&id=<?php echo $link['id'];?>">显示</a><?php }else{?><a href="?c=link&ip=hidden&res=1&id=<?php echo $link['id'];?>">隐藏</a><?php }?></td>
					<td><a href="<?php echo $link['link_url'];?>" target="_blank">查看</a></td>
					<td><?php echo $link['link_content'];?></td>
					<td>
						<div class="btn-group">
							<a class="btn btn-mini dropdown-toggle" data-toggle="dropdown" href="#">操作 <span class="caret"></span></a>
							<ul class="dropdown-menu pull-right">
								<li><a href="?c=link&ip=edit&id=<?php echo $link['id'];?>"><i class="icon-pencil"></i> 编辑</a></li>
								
								<li><a onclick='if (confirm("确定删除？") == true){location.href="?c=link&ip=del&id=<?php echo $link['id'];?>";}'><i class="icon-trash"></i> 删除</a></li>
							</ul>
						</div>
					</td>
				</tr>
				<?php $i++;}?>
				
				</tbody>
			</table>
			<div class="side fr" style="margin-top:6px;">
                                            <ul class="pagination">  
					<?php if($p !== 1){?><li><a href="?c=link&p=<?php echo $break;?>">上页</a></li><?php }?>
		             <?php LinkPage($pageCount, $p, 6);?>
					<?php if($p !== $pageCount){?><li><a href="?c=link&p=<?php echo $next;?>">下页</a></li><?php }?>
				</ul>
			</div>
			<?php }else{?>
			<p>没有任何链接，快速添加一个吧！</p>
			<?php }?>
                                        
                                    </div>
                                </div>                                
                                                       
                                <?php if(empty($_GET['ip'])){?>
                           <form class="form-horizontal" action="?c=link" method="post">
			<div class="block">
                                    <div class="head">
                                        <h2>添加</h2>
                                    </div>
                                    <div class="content np">                                        
                                        <div class="controls-row">
                                            <div class="col-md-3">名称:</div>
                                            <div class="col-md-9">
                                                <input name="link_title" type="text" class="validate[required,minSize[4]] form-control" id="link_title" placeholder="请输入网站名称.."/>
                                                
                                            </div>
                                        </div>
                                         <div class="controls-row">
                                            <div class="col-md-3">地址:</div>
                                            <div class="col-md-9">
                                                <input name="link_url" type="text" class="validate[required,minSize[4]] form-control" id="link_url" placeholder="请输入网站地址.."/>
                                                
                                            </div>
                                        </div>                    
                                             <div class="controls-row">
                                            <div class="col-md-3">描述:</div>
                                            <div class="col-md-9">
                                                <textarea name="link_content" style="width:100%;" class="validate[required,minSize[4]]" id="link_content" placeholder="请输入网站描述.."/></textarea>
                                                
                                            </div>
                                        </div>     
                                        <div class="controls-row">
                                            <div class="col-md-3">添加:</div>
                                            <div class="col-md-9">
                                                <div class="input-group file">
                                                    <div class="input-group-btn">
                                                        <input class="btn btn-default" name="add_link" type="submit" value="添加链接" >
                                                    </div>
                                                    
                                                </div>
                                            </div>
                                        </div>                              
                                    </div>                                    
                                </div>
			</form>           
                         <?php }else{?>
                         
                           <form class="form-horizontal" action="" method="post">
			<div class="block">
                                    <div class="head">
                                        <h2>修改</h2>
                                    </div>
                                    <div class="content np">                                        
                                        <div class="controls-row">
                                            <div class="col-md-3">名称:</div>
                                            <div class="col-md-9">
                                               <input name="link_title" type="text" class="validate[required,minSize[4]] form-control" id="link_title" placeholder="请输入网站名称.." value="<?php echo $LinkNum['link_title'];?>"/>
                                                
                                            </div>
                                        </div>
                                         <div class="controls-row">
                                            <div class="col-md-3">地址:</div>
                                            <div class="col-md-9">
                                                <input name="link_url" type="text" class="validate[required,minSize[4]] form-control" id="link_url" placeholder="请输入网站地址.." value="<?php echo $LinkNum['link_url'];?>"/>
                                                
                                            </div>
                                        </div>                    
                                             <div class="controls-row">
                                            <div class="col-md-3">描述:</div>
                                            <div class="col-md-9">
                                                <textarea name="link_content" style="width:100%;" class="validate[required,minSize[4]] form-control" id="link_content" placeholder="请输入网站描述.."/><?php echo $LinkNum['link_content'];?></textarea>
                                                
                                            </div>
                                        </div>     
                                        <div class="controls-row">
                                            <div class="col-md-3">修改:</div>
                                            <div class="col-md-9">
                                                <div class="input-group file">
                                                    <div class="input-group-btn">
                                                        <input class="btn btn-default" name="edit_link" type="submit" value="保存修改" >
                                                    </div>
                                                    
                                                </div>
                                            </div>
                                        </div>                              
                                    </div>                                    
                                </div>
			</form>           
                         <?php }?>
                                
                                
                            </div>                                
                        </div>
                       
                            

                    </div>                    
                    
                </div>
                
            </div>
            
        </div>

    </div>

    
</body>
</html>
