<?php
	!defined('DIRCMS_MANAGE') && exit('Access Denied!');
?>
<!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>
<title>模型管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<link rel="stylesheet" type="text/css" href="admin/template/css/style.css" />
<script type="text/javascript" src="images/js/jquery.min.js"></script>
<script type="text/javascript" src="admin/template/js/admin.js"></script>
<script src="images/js/menu.js"></script>
</head>
<body>
<div id="wrap">
	<div class="tab">
		<ul>
			<li><a href="javascript:void(0);" class="on">模型管理</a></li>
			<li><a href="?file=membermodel&action=add">安装模型</a></li>	
		</ul>
	</div>
	<div class="main">
		<fieldset>
		<legend>操作提示</legend>
		您可以通过安装模型，添加，修改字段等，来满足您的所有需求。
		</fieldset>
		<table cellspacing="0" class="datalist" id="list">
		<tr>
			<th width="80" class="firstcol">模型名称</th>
			<th width="97">数据表</th>
			<th width="178">搜索结果页模板</th>
			<th width="154">模型状态</th>
			<th width="133">开通黄页</th>
			<th width="131">开放注册</th>
			<th width="167">管理</th>
		</tr>
		<form action="" method="post" name="myform">
		<input type="hidden" name="do_submit" value="1" />
		<?php if($result){foreach($result as $val){?>
		<tr>
		  <td width="80" align="center"><input type="hidden" name="id[]" value="<?php echo $val['id'];?>" /><input type="text" size="6" name="modelname[<?php echo $val['id'];?>]" value="<?php echo $val['modelname'];?>" /></td>
			<td width="97" align="left"><a href="<?php echo ADMIN_FILE;?>?file=membermodel&action=manage_fields&modelid=<?php echo $val['id'];?>"><?php echo DB_PRE.$val['name'];?></a></td>
			<td width="178" align="center">
			<a href="javascript:void(0);" onclick="javascript:poptemplate('search_','stemplate',<?php echo $val['id'];?>,'<?php echo $val['stemplate'];?>','member');" title="重新设置模板"><u>设置</u></a> <a href="<?php echo ADMIN_FILE;?>?file=template&action=edit&id=<?php echo $val['stemplate'];?>" title="修改模板"><u>修改</u></a>			</td>
			<td width="154" align="center"><?php echo $val['isinstall']=='0'?'<font color="#999999">已卸载</font> <a href="'.ADMIN_FILE.'?file=membermodel&action=install&isinstall=1&id='.$val['id'].'"><u>安装</u></a>':'已安装 <a href="'.ADMIN_FILE.'?file=membermodel&action=install&isinstall=0&id='.$val['id'].'"><u>卸载</u></a>';?></td>
			<td width="133" align="center"><?php echo $val['iscompany']?'√ <a href="'.ADMIN_FILE.'?file=membermodel&action=iscompany&iscompany=0&id='.$val['id'].'"><u>禁止</u></a>':'× <a href="'.ADMIN_FILE.'?file=membermodel&action=iscompany&iscompany=1&id='.$val['id'].'"><u>允许</u></a>';?></td>
			<td width="131" align="center"><?php if($val['register_enabled']==1){echo '允许 <a href="'.ADMIN_FILE.'?file=membermodel&action=register_enabled&register_enabled=0&id='.$val['id'].'"><u>禁止</u></a> <a href="'.ADMIN_FILE.'?file=membermodel&action=register_enabled&register_enabled=2&id='.$val['id'].'"><u>审核</u></a>';}else if($val['register_enabled']==0){echo '<a href="'.ADMIN_FILE.'?file=membermodel&action=register_enabled&register_enabled=1&id='.$val['id'].'"><u>允许</u></a> 禁止 <a href="'.ADMIN_FILE.'?file=membermodel&action=register_enabled&register_enabled=2&id='.$val['id'].'"><u>审核</u></a>';}else{echo '<a href="'.ADMIN_FILE.'?file=membermodel&action=register_enabled&register_enabled=1&id='.$val['id'].'"><u>允许</u></a> <a href="'.ADMIN_FILE.'?file=membermodel&action=register_enabled&register_enabled=0&id='.$val['id'].'"><u>禁止</u></a> 审核';}?></td>
			<td width="167" align="center"><a href="<?php echo ADMIN_FILE;?>?file=membermodel&action=manage_fields&modelid=<?php echo $val['id'];?>"><font color="#FF0000"><u>字段管理</u></font></a> &nbsp;<a href="<?php echo ADMIN_FILE;?>?file=membermodel&action=preview&modelid=<?php echo $val['id'];?>">预览</a> &nbsp;<a href="javascript:confirmUrl('这是一个需要特别谨慎的操作，且不可逆，确实要删除会员模型【<?php echo $val['modelname'];?>】吗？\n\n提示：不要对个人会员，企业会员2个系统自带模型进行此操作。','<?php echo ADMIN_FILE;?>?file=membermodel&action=delete&id=<?php echo $val['id'];?>&tbname=<?php echo DB_PRE.$val['name'];?>')">删除</a></td>
		</tr>
		<?php }?>
		<tr>
			<td colspan="7" align="left">
			 &nbsp;<input type="button" onclick="this.form.submit();" class="submit" value="修改名称" />
			</td>
		</tr>
		</form>
		<?php }else{?>
		<tr><td colspan="7">目前尚未安装任何模型...</td></tr>	
		<?php }?>
		</table>
	</div>
</div>
</body>
</html>