{:tpl head}
<table cellpadding="0" cellspacing="1" class="table_list">
 <caption>会员管理</caption>
  <tr>
   <td>
    <strong>管理选项：</strong>
    <a href="?c=member&a=add">添加会员</a> |
    <a href="?c=member">管理会员</a> |
	<a href="?c=member&a=search">会员查找</a>
   </td>
  </tr>
</table>
<!--{:if $a == 'add' || $a == 'edit'}-->
<table cellpadding="0" cellspacing="1" class="table_form">
 <caption>{:if $a == 'add'}添加{:else}修改{:/if}会员</caption>
 <form name="myform" action="?c=member&a={:$a}" method="post">
 <input type="hidden" name="info[userid]" value="{:$data['userid']}" />
 <!--{:if $a == 'edit'}-->
 <input type="hidden" name="forward" value="{:$referer}" />
 <!--{:/if}-->
 <tr>
  <td align="right" width="20%">用户名：</td>
  <td>{:if $a == 'edit'}<input type="text" size="30" name="info[username]" value="{:$data['username']}" readonly>{:else}<input type="text" size="30" name="info[username]" value="" require="true" datatype="limit|username|ajax" url="?c=member&a=check_username" min="{:$config['regminname']}" max="{:$config['regmaxname']}" msg="只能为中文、英文字母、数字及下划线的组合，{:$config['regminname']}-{:$config['regmaxname']}字符|用户名包含非法字符|" msgid="username_info">{:/if} <span class="fred">*</span> <span id="username_info">只能为中文、英文字母、数字及下划线的组合，{:$config['regminname']}-{:$config['regmaxname']}字符</span></td>
 </tr>
 <tr>
  <td align="right">密码：</td>
  <td>{:if $a == 'edit'}<input type="password" size="30" name="info[password]"> <span class="fblue">* 不更改密码请留空！</span>{:else}<input type="password" size="30" name="info[password]" require="true" datatype="require" msg="密码不能为空" msgid="password_info"> <span class="fred">*</span> <span id="password_info"></span>{:/if}</td>
 </tr>
 <tr>
  <td align="right">Email：</td>
  <td><input type="text" size="30" name="info[email]" value="{:$data['email']}">&nbsp;<select name="info[publicemail]"><option value="1"{:Tag::selected($data['publicemail'],1)}>公开</option><option value="0"{:Tag::selected($data['publicemail'],0)}>保密</option></select></td>
 </tr>
 <tr>
  <td align="right">用户组：</td>
  <td>
   <select name="info[groupid]">
    <!--{:loop $group $k $v}-->
    <option value="{:$k}"{:Tag::selected($data['groupid'],$k)}>{:$v['name']}</option>
	<!--{:/loop}-->
   </select>
  </td>
 </tr>
 <tr>
  <td align="right">密码提示问题：</td>
  <td><input type="text" size="30" name="info[question]" value="{:$data['question']}"></td>
 </tr>
 <tr>
  <td align="right">问题答案：</td>
  <td><input type="text" size="30" name="info[answer]" value="{:$data['answer']}"></td>
 </tr>
 <tr>
   <td colspan="2" align="center">
     <button type="submit" name="submit">提交</button>
     <button type="button" name="back" onclick="history.back()">返回</button>
     </td>
 </tr>
 </form>
</table>
<script type="text/javascript" src="../../statics/js/validator.js"></script>
<script type="text/javascript"> 	
$(function(){
	$('form').checkForm(1);
})
</script>
<!--{:elseif $a == 'view'}-->
<table cellpadding="0" cellspacing="1" class="table_form">
 <caption>查看会员资料</caption>
 <tr>
  <td align="right">用户名：</td>
  <td>{:$data['username']} (ID：{:$data['userid']})</td>
 </tr>
 <tr>
  <td align="right">头像：</td>
  <td><img src="{:Tag::avatar($data['userid'], 'b')}" width="180" align="middle" /></td>
 </tr>
 <tr>
  <td align="right">Email：</td>
  <td>{:$data['email']}</td>
 </tr>
 <tr>
  <td align="right">用户组：</td>
  <td>{:$group[$data['groupid']]['name']}</td>
 </tr>
 {:if $data['groupid'] == 1}
 <tr>
  <td align="right">角色：</td>
  <td>{:loop $role $k $v}{:if $k}，{:/if}{:$v['name']}{:/loop}</td>
 </tr>
 {:/if}
 <tr>
  <td align="right">QQ：</td>
  <td>{:$data['qq']}</td>
 </tr>
 <tr>
  <td align="right">MSN：</td>
  <td>{:$data['msn']}</td>
 </tr>
 <tr>
  <td align="right">性别：</td>
  <td>{:if $data['gender'] == 1}男{:elseif $data['gender'] == 2}女{:else}保密{:/if}</td>
 </tr>
 <tr>
  <td align="right">注册时间：</td>
  <td>{:Tag::date($data['regdate'], 2)}</td>
 </tr>
 <tr>
  <td align="right">最后登陆：</td>
  <td>时间: {:Tag::date($data['lastdate'], 2)}&nbsp;&nbsp;IP: {:$data['lastip']}</td>
 </tr>
 <tr>
  <td align="right">统计：</td>
  <td>登录: {:$data['logintimes']}次&nbsp;&nbsp;投稿: {:$data['p_num']}篇&nbsp;&nbsp;评论: {:$data['c_num']}篇</td>
 </tr>
 <tr>
  <td colspan="2" align="center"><button name="back" onclick="history.back()">&nbsp;返回&nbsp;</button></td></tr>
</table>
<!--{:elseif $a == 'set_role'}-->
<table cellpadding="0" cellspacing="1" class="table_form">
 <caption>设置角色</caption>
 <form name="myform" action="?c=member&a=set_role" method="post">
 <input type="hidden" name="userid" value="{:$data['userid']}" />
 <input type="hidden" name="forward" value="{:$referer}" />
 <tr>
  <td align="right" width="30%">用 户 名：</td>
  <td>{:$data['username']}</td>
 </tr>
 <tr>
  <td align="right">所属角色：</td>
  <td>
  {:loop $role $k $v}
  <input type="checkbox" name="roleids[]" value="{:$k}"{:if in_array($k, $roleids)} checked{:/if} />{:$v['name']}（{:$v['description']}）<br />
  {:/loop}
  </td>
 </tr>
 <tr>
  <td colspan="2" align="center"><button type="submit" name="submit">提交</button><button type="button" onclick="history.back()">返回</button></td>
 </tr>
 </form>
</table>
<!--{:elseif $a == 'search'}-->
<table cellpadding="0" cellspacing="1" class="table_form">
 <caption>查找会员</caption>
 <form name="myform" method="get">
  <input type="hidden" name="c" value="member" />
 <tr>
  <td align="right">用户名包含(可使用通配符 "*")：</td>
  <td><input type="text" size="20" name="username">&nbsp;<select name="matching"><option value="0">模糊匹配</option><option value="1">精确匹配</option></select></td>
 </tr>
 <tr>
  <td align="right">Email(可使用通配符 "*")：</td>
  <td><input type="text" size="20" name="email"></td>
 </tr>
 <tr>
  <td align="right">最后登录IP(可使用通配符 "*")：</td>
  <td><input type="text" size="20" name="lastip"></td>
 </tr>
 <tr>
  <td align="right">注册时间大于：</td>
  <td>
   <select name="regdate">
    <option value="0">不限制</option>
    <option value="86400">一天</option>
    <option value="172800">二天</option>
    <option value="604800">一星期</option>
    <option value="2592000">一个月</option>
    <option value="7776000">三个月</option>
    <option value="15552000">六个月</option>
    <option value="31536000">一年</option>
   </select>
  </td>
 </tr>
 <tr>
  <td align="right">多久未登录：</td>
  <td>
   <select name="lastdate">
    <option value="0">不限制</option>
    <option value="86400">一天</option>
    <option value="172800">二天</option>
    <option value="604800">一星期</option>
    <option value="2592000">一个月</option>
    <option value="7776000">三个月</option>
    <option value="15552000">六个月</option>
    <option value="31536000">一年</option>
   </select>
  </td>
 </tr>
 <tr>
  <td align="right">排序：</td>
  <td>
   <select name="orderway">
    <option value="regdate">注册时间</option>
    <option value="lastdate">最后登录</option>
   </select>
   &nbsp;
   <select name="asc">
    <option value="DESC">降序</option>
    <option value="ASC">升序</option>
   </select>
  </td>
 </tr>
 <tr>
  <td align="right">每页显示行数：</td>
  <td><input type="text" size="5" name="perpage" value="50"></td>
 </tr>
 <tr>
  <td colspan="2" height="30" align="center"><button type="submit" name="submit">提交</button></td>
 </tr>
 </form>
</table>
<!--{:elseif $a == 'defaults'}-->
<table cellpadding="0" cellspacing="1" class="table_list">
 <caption>管理会员</caption>
 <form name="myform" method="post">
 <input type="hidden" value='' name="selids" />
 <tr align=center>
  <th width="5%"><input name="checkbox" type="checkbox" onclick="checkorno(this,this.form.names)" /></th>
  <th width="10%">用户名</th>
  <th width="13%">Email</th>
  <th width="6%">性别</th>
  <th width="10%">QQ</th>
  <th width="10%">会员组</th>
  <th>最后登录(时间|IP)</th>
  <th width="21%">管理操作</th>
 </tr>
 {:loop $data $v}
 <tr align="center">
  <td><input name="ids" type="checkbox" value="{:$v['userid']}" /></td>
  <td><a href="space.php?userid={:$v['userid']}" target="_blank">{:$v['username']}</a></td>
  <td align="left">{:$v['email']}</td>
  <td>{:$gender[$v['gender']]}</td>
  <td>{:$v['qq']}</td>
  <td><a href="?c=member&groupid={:$v['groupid']}">{:$group[$v['groupid']]['name']}</a></td>
  <td align="left">{:Tag::date($v['lastdate'],2)} | {:$v['lastip']}</td>
  <td>
   {:if $v['groupid'] == 1}
   <a href="?c=member&a=set_role&userid={:$v['userid']}">设置角色</a>|
   {:else}
   <span class="fgray">设置角色</span>|
   {:/if}
   <a href="?c=member&a=view&userid={:$v['userid']}">查看</a>|
   <a href="?c=member&a=edit&userid={:$v['userid']}">修改</a>|
   <a href="?c=member&a=del&selids={:$v['userid']}">删除</a></td>
 </tr>
 {:/loop}
 <tr>
  <td height="20" colspan="8" align="center">
   <button name="select1" onclick="selAll(this.form.ids)" type="button">全选</button>
   <button name="select2" onclick="noSelAll(this.form.ids)" type="button">反选</button>
   <button name="submitsc" type="button" onClick="subform(this.form,this.form.ids,'?c=member&a=del','确认删除吗？此操作不可恢复。')">删除</button>
  </td>
 </tr>
 </form>
</table>
{:if $pages}<div class="pages">{:$pages}</div>{:/if}
<!--{:/if}-->
{:tpl foot}