query (" SELECT hlstats_Players.lastName, hlstats_Players.game FROM hlstats_Players WHERE hlstats_Players.playerId = $player "); if ($db->num_rows() != 1) { error("No such player '$player'."); } $playerdata = $db->fetch_array(); $pl_name = $playerdata['lastName']; if (strlen($pl_name) > 10) { $pl_shortname = substr($pl_name, 0, 8) . "..."; } else { $pl_shortname = $pl_name; } $pl_name = htmlspecialchars($pl_name, ENT_COMPAT); $pl_shortname = htmlspecialchars($pl_shortname, ENT_COMPAT); $game = $playerdata['game']; $db->query (" SELECT hlstats_Games.name FROM hlstats_Games WHERE hlstats_Games.code = '$game' "); if ($db->num_rows() != 1) { $gamename = ucfirst($game); } else { list($gamename) = $db->fetch_row(); } pageHeader ( array ($gamename, 'Awards History', $pl_name), array ( $gamename=>$g_options['scripturl'] . "?game=$game", 'Player Rankings'=>$g_options['scripturl'] . "?mode=players&game=$game", 'Player Details'=>$g_options['scripturl'] . "?mode=playerinfo&player=$player", 'Awards History'=>'' ), $playername ); flush(); $cnttext = 'Earned'; $lnktext = '&link='.urlencode("mode=playerawards&player=".$player."&awardId=%k"); if (isset($_GET['awardId'])) { $awardId = valid_request($_GET['awardId'], true) or error("No clan ID specified."); } $cnttext = 'Kills on Day'; $lnktext = ''; $table = new Table ( array ( new TableColumn ( 'awardTime', (isset($awardId))?'Date':'Date Last Earned', 'width=17' ), new TableColumn( 'name', 'Name', 'width=23' ), new TableColumn( 'verb', 'Description', 'width=50'.$lnktext ), new TableColumn( 'count', $cnttext, 'width=10&align=right' ) ), 'awardId', 'awardTime', 'name', false, 50, 'page', 'sort', 'sortorder' ); $surl = $g_options['scripturl']; if (isset($awardId)) { $result = $db->query (" SELECT hlstats_Players_Awards.awardTime, hlstats_Awards.Name, hlstats_Awards.verb, hlstats_Players_Awards.count, hlstats_Awards.awardId FROM hlstats_Players_Awards INNER JOIN hlstats_Awards ON hlstats_Awards.awardId = hlstats_Players_Awards.awardId WHERE hlstats_Players_Awards.playerId = $player AND hlstats_Players_Awards.awardId = $awardId ORDER BY $table->sort $table->sortorder, $table->sort2 $table->sortorder LIMIT $table->startitem, $table->numperpage "); $resultCount = $db->query (" SELECT COUNT(awardId) FROM hlstats_Players_Awards WHERE hlstats_Players_Awards.playerId = $player AND hlstats_Players_Awards.awardId = $awardId "); } else { $result = $db->query (" SELECT MAX(hlstats_Players_Awards.awardTime) AS awardTime, hlstats_Awards.name, hlstats_Awards.verb, COUNT(verb) AS count, hlstats_Awards.awardId FROM hlstats_Players_Awards INNER JOIN hlstats_Awards ON hlstats_Awards.awardId = hlstats_Players_Awards.awardId WHERE hlstats_Players_Awards.playerId = $player GROUP BY hlstats_Awards.name, hlstats_Awards.verb ORDER BY $table->sort $table->sortorder, $table->sort2 $table->sortorder LIMIT $table->startitem,$table->numperpage "); $resultCount = $db->query (" SELECT COUNT(awardId) FROM hlstats_Players_Awards WHERE hlstats_Players_Awards.playerId = $player GROUP BY hlstats_Players_Awards.awardId "); } list($numitems) = $db->fetch_row($resultCount); ?>