<?php include $this->admin_tpl('meta', 'admin');?>
<title>会员管理 - YzmCMS内容管理系统</title>
</head>
<body>
<nav class="breadcrumb"><i class="yzm-iconfont yzm-iconai-home"></i> 首页 <span class="c-gray en">&gt;</span> 会员管理 <span class="c-gray en">&gt;</span> 会员列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="yzm-iconfont yzm-iconshuaxin"></i></a></nav>
<div class="page-container">
  <div> 
    <form action="<?php echo U('search');?>" method="get" id="search">
	 <input type="hidden" value="<?php echo ROUTE_M;?>" name="m">
	 <input type="hidden" value="<?php echo ROUTE_C;?>" name="c">
	 <input type="hidden" value="search" name="a">
     注册时间：<input type="text" class="input-text laydate-icon" style="width:170px;height:30px;" id="start" name="start" <?php if(isset($_GET['start']) && $_GET['start'] != '') echo 'value="'.$_GET['start'].'"'; ?>>
     至 <input type="text" class="input-text laydate-icon" style="width:170px;height:30px;" id="end" name="end" value="<?php if(isset($_GET['end']) &&  $_GET['end'] != '') echo $_GET['end']; else echo date('Y-m-d H:i:s'); ?>">
     <span class="select-box inline">
		<select name="status" class="select">
			<option value="99">状态</option>
			<option value="1" <?php if(isset($_GET['status']) && $_GET['status']=='1'){?> selected <?php }?>>正常</option>
			<option value="2" <?php if(isset($_GET['status']) && $_GET['status']=='2'){?> selected <?php }?>>锁定</option>
		</select>
	</span>
     <span class="select-box inline">
		<select name="groupid" class="select">
			<option value="0">会员组</option>
			<?php 
				foreach($member_group as $val){
					$str = $val['groupid']==$groupid ? 'selected' : '';
					echo '<option value="'.$val['groupid'].'" '.$str.'>'.$val['name'].'</option>';
				}
			?>
		</select>
	</span>
	<span class="select-box inline">
		<select name="vip" class="select">
			<option value="99">VIP状态</option>
			<option value="1" <?php if(isset($_GET['vip']) && $_GET['vip']=='1'){?> selected <?php }?>>VIP会员</option>
			<option value="0" <?php if(isset($_GET['vip']) && $_GET['vip']=='0'){?> selected <?php }?>>非VIP</option>
		</select>
	</span>
    <span class="select-box inline">
		<select name="type" class="select">
		<option <?php if(isset($_GET['type']) && $_GET['type']=='1'){?> selected <?php }?> value="1">用户名</option>
		<option <?php if(isset($_GET['type']) && $_GET['type']=='2'){?> selected <?php }?> value="2">用户ID</option>	
		<option <?php if(isset($_GET['type']) && $_GET['type']=='3'){?> selected <?php }?> value="3">邮箱</option>
		<option <?php if(isset($_GET['type']) && $_GET['type']=='4'){?> selected <?php }?> value="4">注册IP</option>
		</select>
	</span>
     <input type="text" name="searinfo" class="input-text" style="width:170px" value="<?php if(isset($_GET['searinfo'])) echo $_GET['searinfo'];?>"><button name="dosubmit" class="btn btn-success btn-search" type="submit" value="1"><i class="yzm-iconfont yzm-iconsousuo"></i> 搜索</button>
     <a href="<?php echo U('init');?>" class="btn btn-primary radius"><i class="yzm-iconfont yzm-iconshuaxin"></i> 重置</a>
	 </form>	
  </div>
  <div class="cl mt-15 tb-top"> <span class="l">
  <a href="javascript:;" onclick="yzm_open('添加用户','<?php echo U('add');?>','630','420')" class="btn btn-primary radius"><i class="yzm-iconfont yzm-icontianjia"></i> 添加用户</a>
  <a href="javascript:;" onclick="yzm_dels('ids', 1)" class="btn btn-danger radius"><i class="yzm-iconfont yzm-iconshanchu2"></i> 批量删除</a> 
  <a href="javascript:;" onclick="lock()" class="btn btn-warning radius"><i class="yzm-iconfont yzm-iconlock-line"></i> 锁定用户</a>
  <a href="javascript:;" onclick="unlock()" class="btn btn-success radius"><i class="yzm-iconfont yzm-iconjiesuo"></i> 解锁用户</a>
  </span> <span class="r">共有数据：<strong><?php echo $total?></strong> 条</span> </div>
  <form method="post" action="<?php echo U('del');?>" id="myform">
  <table class="table table-border table-bg table-hover yzm-table-sort">
    <thead>
      <tr class="text-c">
        <th width="25"><input type="checkbox"></th>
		<th>用户ID<?php echo field_order('userid');?></th>
		<th class="text-l">用户名<?php echo field_order('username');?></th>
		<th class="text-l">邮箱<?php echo field_order('email');?></th>
		<th>用户组<?php echo field_order('groupid');?></th>
		<th>最后登录时间<?php echo field_order('lastdate');?></th>
		<th>登录次数<?php echo field_order('loginnum');?></th>
		<th>账户余额<?php echo field_order('amount');?></th>
		<th>积分<?php echo field_order('point');?></th>
		<th width="100">操作</th>
      </tr>
    </thead>
    <tbody>
		<?php 
		foreach($data as $val){
			$avatar = get_memberavatar($val['userid']);
		?>
		  <tr class="text-c">
			<td><input type="checkbox" value="<?php echo $val['userid']?>" name="ids[]"></td>
			<td><?php echo $val['userid']?></td>
			<td class="text-l">
				<?php if($val['vip']){ ?>
				<img src="<?php echo STATIC_URL; ?>images/vip.png" height="23" title="<?php echo "vip会员\r\n过期时间：".date('Y-m-d H:i:s', $val['overduedate']);?>">
				<?php } ?>
				<?php if($val['status'] == 2){ ?>
				<img src="<?php echo STATIC_URL; ?>images/lock.png" height="18" title="用户已锁定">
				<?php } ?>
				<?php echo '<a href="'.U('edit',array('userid'=>$val['userid'])).'" style="text-decoration:none"><img src="'.$avatar.'" height="25" class="radius" onmouseover="yzm_img_browse(this, \''.$avatar.'\')" onmouseout="layer.closeAll(\'tips\')"> '.$val['username'].'</a>';
				?>
			</td>
			<td class="text-l"><?php echo $val['email_status'] ? $val['email'].' <span style="color:green;text-shadow:1px 1px 3px rgba(0, 0, 0, 0.3);" title="已验证">「验」</span>' : $val['email'];?> <?php if($val['status'] == 0) echo '<span style="color:#c7254e;text-shadow:1px 1px 3px rgba(0, 0, 0, 0.3);" title="待审核">「审」</span>'; ?></td>
			<td><span title="经验：<?php echo $val['experience']?>"><?php echo get_groupname($val['groupid']);?></span></td>
			<td><span title="<?php echo '注册时间：'.date('Y-m-d H:i:s', $val['regdate']).' ('.$val['regip'].")\r\n最后登录：".($val['lastdate'] ? date("Y-m-d H:i:s",$val['lastdate']).' ('.$val['lastip'].')' : '从未登录');?>"><?php echo $val['lastdate'] ? date("Y-m-d H:i:s",$val['lastdate']) : '从未登录';?></span></td>
			<td><?php echo $val['loginnum']?></td>
			<td><?php echo $val['amount']?></td>
			<td><?php echo $val['point']?></td>
			<td>
			<a title="修改资料" href="<?php echo U('edit',array('userid'=>$val['userid']));?>" style="text-decoration:none"><i class="yzm-iconfont yzm-iconbianji2"></i></a> 
			<a title="修改密码" href="javascript:;" onclick="yzm_open('修改密码','<?php echo U('password',array('userid'=>$val['userid']));?>',460,280)"  style="text-decoration:none"><i class="yzm-iconfont yzm-iconyaoshi f14"></i></a>
			<a title="预览主页" href="<?php echo U('member/myhome/init', array('userid'=>$val['userid']));?>" target="_blank" style="text-decoration:none;margin-left:3px;"><i class="yzm-iconfont yzm-iconyulan2"></i></a>
			</td>
		  </tr>		
		<?php 
		}
		?>
    </tbody>
  </table>
  <?php if(!$data){ ?><div class="yzm_no_data"><i class="yzm-iconfont yzm-iconshuoming"></i> 暂无数据</div><?php } ?>
  </form>
  <div id="page"><span class="page_left">共<?php echo $total?>条记录，共<?php echo $page->total()?>页，当前显示第<?php echo $page->getpage()?>页</span>
  <span class="page_right"><?php echo $page->getfull();?></span></div>
</div>
<?php include $this->admin_tpl('footer', 'admin');?>
<script type="text/javascript" src="<?php echo STATIC_URL;?>plugin/laydate/1.1/laydate.js"></script>
<script type="text/javascript">

	function lock(){
		if ($("input[name='ids[]']:checked").length<1){
		   layer.alert('请选择要操作的内容！');
		   return false;
		}	
		document.getElementById('myform').action='<?php echo U('lock')?>';
		document.getElementById('myform').submit();
	}

	function unlock(){
		if ($("input[name='ids[]']:checked").length<1){
		   layer.alert('请选择要操作的内容！');
		   return false;
		}	
		document.getElementById('myform').action='<?php echo U('unlock')?>';
		document.getElementById('myform').submit();
	}


	var start = {elem:'#start',format:'YYYY-MM-DD hh:mm:ss',min:'1999-01-01',max:'2099-01-01',istime:true,istoday:false,choose:function(datas){end.min = datas;end.start = datas}
	};
	var end = {elem:'#end',format:'YYYY-MM-DD hh:mm:ss',min:'1999-01-01',max:'2099-01-01',istime:true,istoday:false,choose:function(datas){start.max = datas;}};
	laydate(start);
	laydate(end);
</script>

</body>
</html>