/** * 添加用户比赛得分 */ function addUserRank($uid, $matchTypeId, $rid, $value, $verify = 0, $submitId = 0) { global $wpdb; $userRank = getUserRankList($uid, $matchTypeId, $rid, -1, -1, $submitId); if (!empty($userRank) && intval($userRank)) { $result = updateUserRank($uid, $matchTypeId, $rid, $value); } else { $result = $wpdb->insert('wp_likedome_match_user_rank', array('uid' => $uid, 'matchTypeId' => $matchTypeId, 'rid' => $rid, 'value' => $value, 'verify' => $verify, 'submitId' => $submitId)); } return $result; }
$rankTypeList = getRankTypeList(-1, $matchTypeId); foreach ($rankTypeList as $rankType) { addUserRank($userId, $matchTypeId, $rankType->id, intval($_POST['rank-' . $rankType->id])); } echo "提交选手成绩完成"; break; // Main Page // Main Page default: $username = trim($_POST['username']); if (!empty($username)) { $user = get_user_by('login', $username); $userid = $user->ID; } $currentRankTypeSelect = intval($_POST['currentRankTypeSelect']); $currentType = intval($_POST['currentTypeSelect']); if ($currentRankTypeSelect < 1) { $currentRankTypeSelect = 1; } if ($currentType < 1) { $currentType = 1; } $userRankList = getUserRankList(-1, $currentType, -1, -1, 1); $tpl->SetVar('userRankList', $userRankList); $tpl->SetVar('currentRankTypeSelect', $currentRankTypeSelect); $tpl->SetVar('currentType', $currentType); $tpl->SetVar('rankTypeList', getRankTypeList(-1, $currentType)); echo '<h2>' . '数据排行' . '</h2>'; echo $tpl->GetTemplate('ranklist.php'); break; }
sort($usersRanks); foreach ($usersRanks as $user) { ?> <tr id="poll-5" class="highlight"> <td height="24" align="center"><?php echo ++$i; ?> </td> <td height="24" align="center"><?php $userprofile = getUserProfile($user->uid); echo $userprofile[0]->realname; ?> </td> <?php foreach ($rankTypeList as $rankType) { $userRanks = getUserRankList($user->uid, $currentMatchTypeId, $rankType->id); echo '<td height="24" align="center">' . $userRanks[0]->value . '</td>'; } ?> </tr> <?php } ?> </table> </div> <div class="clear"></div> <!-- <div class="pageNo margin-t18"> --> <!-- <span class="firstpage"><a href="#">首页</a></span><span class="prepage"><a --> <!-- href="#">上一页</a></span><a href="#">1</a><strong>2</strong><a href="#">3</a><a --> <!-- href="#">4</a><a href="#">5</a><a href="#">6</a><a href="#">20</a><span -->