<!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><?php echo V('-:tpl/title');?>管理后台</title>
<link href="<?php echo W_BASE_URL;?>css/admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?php echo W_BASE_URL;?>js/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo W_BASE_URL;?>js/admin.js"></script>
<script>
	parent.admin.index.selectSubMenu('#userlist', false)
</script>
</head>
<body>
     <!--header-->
     <?php include  "templates/admin/header.tpl.php"?>
     
     <!--content-->
     <div class="wrap">
         
              <div class="con_right">
                   <div class="position">当前位置：帐号设置<em>></em>帐号管理<em>></em><strong>用户列表</strong></div>  
             <!--搜索结果列表-->
            <div class="cr_list">
            <div class="search_box">
                <form action="" method="get" name="form_search" id="form_search">
                    <input type="hidden" name="m" value="admin/user.userlist">
                                 <span>搜索：</span><input class="insert_text" type="text" name="keyword" msg_title="关键字" value="<?php echo V('g:keyword');?>"/> <span class="button"><input type="submit" class="search"  value="搜索"/></span>
                </form>
            </div>
			<form name="form_check" id="form_check" action="" method="post">
                <table cellspacing="0">
				<tr>
                	<th style="text-align:center;width:30px;"></th>
					<th style="text-align:center;width:60px;">ID</th>
			        <th class="text_l" style="text-align:center;width:100px">登录帐号</th>
					<th style="text-align:center;">姓名</th>
					<th style="text-align:center;width:200px;">注册时间</th>
					<th style="text-align:center;width:80px;">状态</th>
                    <th style="text-align:center;width:230px;">操作</th>
                 </tr>
				 <?php if (count($list) > 0) {?>
				  <?php foreach($list as $key => $item) {?>
				 <tr<?php if ($key %2) {?> style="background:#f5f6f3;"<?php }?>>
                 	<td class="table_checkbox"><input name="id[]" type="checkbox" value="<?php echo $item['id'];?>" /></td>
					<td class="text_l" style="text-align:left;"><?php echo $item['id'];?></td>
					
					<td style="text-align:left;"><?php echo $item['name'];?></td>
					<td style="text-align:left;"><?php echo $item['real_name'];?></td>
					<td style="text-align:center;"><?php echo date('Y-m-d H:i:s', $item['add_time']);?></td>
					<td style="text-align:center;"><?php echo $states[$item['state']];?></td>
					<td style="text-align:center;">
						<?php if ($item['id'] == $admin_id || $admin_id == '1') {?><a href="<?php echo URL('admin/user.edit', 'id=' . $item['id']);?>">编辑</a><?php }?>
						<?php if ($admin_id == 1 || $item['id'] == $admin_id) {?><em>|</em><a href="<?php echo URL('admin/user.repassword', 'id='. $item['id']);?>">修改密码</a>
						<?php }?>
						<?php if ($admin_id == '1' && $admin_id != $item['id']) {?>
							<em>|</em><a href="javascript:if(confirm('你确定要删除客户<?php echo $item['name'];?>吗?')) {window.location.href='<?php echo URL('admin/user.del', 'id=' . $item['id']);?>'}">删除</a><em>|</em>
							<?php if ($item['state'] == '0') {?>
								<a href="<?php echo URL('admin/user.state', 'state=1&id=' . $item['id']);?>">禁用</a>
							<?php } else {?>
								<a href="<?php echo URL('admin/user.state', 'state=0&id=' . $item['id']);?>">启用</a>
							<?php }?>
						<?php } else {?>
							
						<?php }?>
						
					</td>
				 </tr>
			    <?php
						}
					} else {
				?>
				
				<tr >
					<td colspan="7" style="text-align:left;padding-left:20px">没有任何记录</td>
			    </tr>
				<?php }?>
              </table>
			</form>
                    </div>

		<?php if (count($list)> 0) {?>
                    <div class="cr_oplist">
                        <div class="right">
                               <?php echo $pager?>
                        </div>
                        <div class="left">
                            <label><input name="checkall" type="checkbox" value="" onclick="checkAll('id[]', this.checked)"/>全选</label>
							<a href="#" onclick="doAction('del','id[]','form_check','<?php echo URL('admin/user.del');?>')">删除所选</a>
                        </div>
                    </div>
					<?php }?>
     </div>  
</body>
</html>
