<?php
# Subroutine: adm_rank.php called by Admin.php
# Xinfeng Chen, 2002.11.22
# Input: NONE

require_once('bin/config.php');
require_once('admin/adm.inc');

#--- Validate dministrator ---
include('admin/adm_validate.php');
if(!$adm_validated){jumpTo('admin.php?cmd=logon'); exit;}

#--- Start Processing ---
require_once('core/class_forum_base.php');
CForumBase::setFileBase("$filepath");
require_once('core/base_memo_file.php');
require_once('core/class_rank.php');

#--- Prepare rank info ---
$oRnk=new CRank;
$oRnk->load();
$rsize=count($oRnk->level);

page_header();

print <<<EOT
<h1>用户等级管理</h1>
<p>定义用户等级、相应经验要求，定义特殊用户等级。</p>
<form name="form1" method="post" action="?cmd=rank_add">
<table width=100% cellpadding=4 cellspacing=1 border=0 class="forumline">
<tr> 
 <th class="thHead">等级名字</th>
 <th class="thHead">特殊用户</th>
 <th class="thHead">经验要求</th>
 <th class="thHead">&nbsp;</b></th>
</tr>
EOT;

#--- Print rank list ---
if($rsize<=0){
 print <<<EOT
<tr> 
 <td class="row1" colspan=3>无用户等级</td>
 <td class="row2">---</td>
</tr>
EOT;
}

foreach($oRnk->level as $key=>$val){
 print "<tr><td class='row1'>$key</td>";
 if($val>=0){
  print "<td class='row1'>&nbsp;</td><td class='row1'>$val</td>";
 }else{
  print "<td class='row1'>YES</td><td class='row1'>&nbsp;</td>";
 }
 print"<td class='row1'><a href='?cmd=rank_remove&name=$key'>删除</a></td></tr>";
}

#--- Print add-rank form ---
print <<<EOT
<tr> 
 <th class="thHead" colspan=4>增加用户等级</th>
</tr>
<tr> 
 <td class="row3" colspan=3>
  等级名称: <input type="text" size=10 name="f_name">&nbsp;
  经验要求: <input type="text" size=6 name="f_level">&nbsp;
  特殊用户: 
  <input type="radio" name="f_special" value="0" checked>否
  <input type="radio" name="f_special" value="1">是
 </td>
 <td class="row3">
  <input type="submit" name="Submit" value="添加">
 </td>
</tr>
</table>
</form>
EOT;

page_footer();
exit;

?>