<?php if (!defined('APP_PATH')) exit;?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="http://127.0.0.5/Magic/Data/Public/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://127.0.0.5/Magic/Data/Public/js/jquery.js"></script>
<script src="http://127.0.0.5/Magic/Data/Public/js/main.js"></script>
</head>
<body>
<div class="place">
	<span>位置：</span>
	<ul class="placeul">
		<li>首页</li>
		<li>内容管理</li>
		<li>模型管理</li>
	</ul>
</div>
<div class="rightinfo">
    <div class="tools">
		<ul class="toolbar">
			<li><a href="javascript:" onclick="load('添加模型','?r=model-index-edit','480px','450px')" ><span><img src="http://127.0.0.5/Magic/Data/Public/images/t01.png" /></span>添加模型</a></li>
		</ul>
    </div>  
   <div class="formtitle1"><span>模型列表</span></div>
   <iframe id="blank" name="blank"  style="display:none" ></iframe>
    <table class="tablelist">
		<thead>
    	<tr>
				<th height="35" width="120" align="center">ID</th>
				<th height="35" width="120"align="center">&nbsp;&nbsp;模型名称</th>
				<th height="35" width="150" align="center">数据表名</th>
				<th height="35" align="center">描述</th>
				<th height="35" width="100" align="center">状态</th>
				<th height="35" width="250" align="center">操作</th>
			</tr>
        </thead>
		<tbody>
			<?php if (empty($list)){ ?>
				<tr><td colspan="8" align="center" height="35" style="color:#f00">暂无记录!</td></tr>
			<?php }else{ ?>
			<?php foreach ($list as $k=>$vo){?>
			<tr>
				<td height="40" width="120" align="center"><?php echo $vo['id'];?></td>
				<td height="40" width="120" align="center" ><?php echo $vo['model'];?></td>
				<td height="40" width="120" align="center"><?php echo $vo['value'];?></td>
				<td height="40" align="left"><?php echo $vo['description'];?></td>
				<td height="40" width="100" align="center">
				<?php if($vo['id']==1){ ?> 
				<img src="http://127.0.0.5/Magic/Data/Public/images/ico-0<?php echo $vo['status'];?>.png" width="15" height="15">
				<?php }else{ ?>
				<a href="javascript:void(0)" onclick="ajaxSub('?r=model-index-status','id=<?php echo $vo['id'];?>&status=<?php if($vo['status']==0){ ?>1<?php }else{ ?>0<?php }?>','GET',0)" ><img src="http://127.0.0.5/Magic/Data/Public/images/ico-0<?php echo $vo['status'];?>.png" width="15" height="15"><a>
				<?php }?>
				</td>
				<td height="40" width="250" align="center"> <a href="?r=fields&type=model&value=<?php echo $vo['value'];?>">字段管理</a> | 
				<?php if($vo['id']==1){ ?> 
				<font style="color:#ccc">禁用</font> 
				<?php }else{ ?>
				<?php if($vo['status']==1){ ?>
				<a href="?r=model-index-status&id=<?php echo $vo['id'];?>&status=0&value=<?php echo $vo['value'];?>"  target="blank">禁用<a>
				<?php }else{ ?>
				<a href="?r=model-index-status&id=<?php echo $vo['id'];?>&status=1&value=<?php echo $vo['value'];?>" target="blank">启用<a>
				<?php }?>
				<?php }?>
				| <a href="javascript:" onclick="load('编辑模型','?r=model-index-edit&id=<?php echo $vo['id'];?>','480px','400px')";>编辑</a> | 
				<?php if($vo['id']==1){ ?>
				<font style="color:#ccc">删除</font>
				<?php }else{ ?>
				<a href="javascript:" onclick="confirms('模型删除后将无法恢复，<br>请谨慎操作，确认删除？','?r=model-index-del&value=<?php echo $vo['value'];?>&id=<?php echo $vo['id'];?>')" >删除</a>
				<?php }?>
				</td>
			</tr>
			<?php }?>
			<?php }?>
			 </tbody>
		</table>
</div>
<script type="text/javascript">$('.tablelist tbody tr:odd').addClass('odd');</script>
</body>
</html>
