/** * 绘制比赛类型option输出栏目 */ function drawMatchTypeSelect($currentType = 0, $defaultAll = 1, $matchTypeList = 0) { $tmpCurrent = 0; if ($defaultAll) { echo '<option value="0">全部比赛</option>'; } if ($matchTypeList == 0) { $matchTypeList = getMatchTypeList(); } foreach ($matchTypeList as $matchType) { echo '<option value="' . $matchType->id . '"'; if ($currentType == $matchType->id) { echo 'selected="selected"'; } else { if (!$currentType && !$tmpCurrent) { $tmpCurrent = intval($matchType->id); } } echo '>' . $matchType->type . '</option>'; } if ($tmpCurrent == 0) { return $currentType; } return $tmpCurrent; }
// Update case 'update': $matchid = intval($_POST['matchid']); $stage = intval($_POST['stageselect']); $succe = updateMatch($matchid, -1, $stage); if ($succe) { echo "修改比赛提交成功"; return; } echo "没有提交更新的比赛数据或发生异常"; break; // Main Page // Main Page default: $currentType = intval($_POST['currentTypeSelect']); $currentStage = intval($_POST['currentStageSelect']); $matchList = getMatchList(-1, $currentType, $currentStage); $tpl->SetVar('currentType', $currentType); $tpl->SetVar('currentStage', $currentStage); $tpl->SetVar('typelist', getMatchTypeList()); $tpl->SetVar('list', $matchList); $tpl->SetVar('paging', count($matchList) / 20); echo '<h2>' . '比赛列表' . '</h2>'; echo $tpl->GetTemplate('matchlist.php'); echo '<h2>' . '添加比赛' . '</h2>'; echo $tpl->GetTemplate('addmatch.php'); break; } ?>
<?php /* Template Name: Rank List */ get_header(); ?> <div class="vsPos"></div> <h2 class="busyTitle margin-t22">选手排行榜</h2> <div class="chaxun"> <form name="currentSelect" method="post"> <select name="currentMatchTypeId" id="currentMatchTypeId" onChange="document.currentSelect.submit();"> <?php $currentMatchTypeId = intval($_POST['currentMatchTypeId']); $matchTypeList = getMatchTypeList(OBJECT_K); $currentMatchTypeId = drawMatchTypeSelect($currentMatchTypeId, 0, $matchTypeList); $rankTypeList = getRankTypeList(-1, $currentMatchTypeId); ?> </select> </form> </div> <p class="margin-t10 margin-l80 font-size14"><?php echo $matchTypeList[$currentMatchTypeId]->type; ?> </p> <div class="flo width-400 margin-l80 font-size14 table"> <table width="800" border="1" cellspacing="0" cellpadding="0"> <tr> <td width="8%" height="24" align="center">排名</td> <td width="8%" height="24" align="center">选手</td>