From 159992a5fa3456e036888c9e9d8a06409f272db6 Mon Sep 17 00:00:00 2001 From: BlueRaja Date: Sun, 13 Jan 2013 02:46:45 -0600 Subject: Added champion points to leaderboard page --- css/stats.css | 10 ++++++++++ includes/championPoints.php | 7 ++++--- pages/leaderboard.php | 15 ++++++++++++--- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/css/stats.css b/css/stats.css index ab4cb96..23a6003 100644 --- a/css/stats.css +++ b/css/stats.css @@ -112,3 +112,13 @@ td, th { white-space:nowrap; } +.wrapper .col1 #myPoints +{ + text-align: center; + color: #00DDFF; +} + +.wrapper .col1 #myPoints #myPointsValue +{ + font-weight: bold; +} \ No newline at end of file diff --git a/includes/championPoints.php b/includes/championPoints.php index e824c0c..b99fde3 100644 --- a/includes/championPoints.php +++ b/includes/championPoints.php @@ -107,9 +107,9 @@ function addPlayerChampionPointsForMapsOfTheDay($fromDate) $sql3 = " -- Add the points for doing the weekly maps UPDATE solutions - SET championPointsWorth = + SET championPointsWorth = championPointsWorth + ( - SELECT SUM(".CP_MAX_WORTH_WEEKLY." * + SELECT IFNULL(SUM(".CP_MAX_WORTH_WEEKLY." * ( SELECT COUNT(*) FROM (SELECT * FROM solutions) AS s2 @@ -119,11 +119,12 @@ function addPlayerChampionPointsForMapsOfTheDay($fromDate) SELECT GREATEST(COUNT(*)-1, 1) FROM (SELECT * FROM solutions) AS s2 WHERE s2.mapID = mapOfTheDay.mapID - ) + ".CP_MIN_WORTH_WEEKLY.") + ) + ".CP_MIN_WORTH_WEEKLY."), 0) FROM mapOfTheDay INNER JOIN (SELECT * FROM solutions) AS usersSolutions ON usersSolutions.mapID = mapOfTheDay.mapID WHERE usersSolutions.ID = solutions.ID AND mapOfTheDay.mapType = 5 + AND mapOfTheDay.mapDate >= '$fromDate' ); "; diff --git a/pages/leaderboard.php b/pages/leaderboard.php index 292de60..a256f1c 100644 --- a/pages/leaderboard.php +++ b/pages/leaderboard.php @@ -109,7 +109,8 @@ function getStat ($type, $daysAgo = 1) { userData.wallColor, userData.wallEmblem, userData.displayColor, - users.ID as userID + users.ID as userID, + solutions.championPointsWorth FROM `maps` JOIN `solutions` ON maps.ID = solutions.mapID @@ -198,7 +199,8 @@ function displayPastMaze($mapType, $name, $daysAgo = 1) { userData.wallColor, userData.wallEmblem, userData.displayColor, - users.ID as userID + users.ID as userID, + solutions.championPointsWorth FROM `maps` JOIN `solutions` ON maps.ID = solutions.mapID @@ -269,6 +271,7 @@ function displaystats($result, $caption = NULL) { //$r .= ""; $i = 1; + $championPoints = null; while ($row = mysql_fetch_assoc($result)) { $rowcontent = ''; $mapid = $row['mapID']; @@ -293,6 +296,7 @@ function displaystats($result, $caption = NULL) { if ($userID == $_SESSION['userID']) { $promotedContent .= $x; + $championPoints = $row['championPointsWorth']; } else { $content .= $x; } @@ -300,7 +304,12 @@ function displaystats($result, $caption = NULL) { $i++; } - $r = ""; + $r = ''; + if($championPoints != null) + { + $r .= "
Points earned: $championPoints
"; + } + $r .= "
"; $r .= ""; $r .= $headers; $r .= $promotedContent; -- cgit v1.2.3
$caption