diff options
Diffstat (limited to 'pages/leaderboard.php')
-rw-r--r-- | pages/leaderboard.php | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/pages/leaderboard.php b/pages/leaderboard.php index 9f40d8b..b5e3a76 100644 --- a/pages/leaderboard.php +++ b/pages/leaderboard.php @@ -11,7 +11,7 @@ include('./includes/maps.php'); //include('./includes/mapoftheday.php');
include('./includes/datas.php');
-include_once ('./includes/db.inc.php');
+include_once ('./includes/sqlEmbedded.php');
function day_diff($date1, $date2) {
$current = $date1;
@@ -109,7 +109,10 @@ function getStat ($type, $daysAgo = 1) { userData.wallColor,
userData.wallEmblem,
userData.displayColor,
- users.ID as userID
+ users.ID as userID,
+ SUM(CASE WHEN solutions.dateModified < CURDATE()
+ THEN solutions.championPointsWorth
+ ELSE 0 END) AS championPointsWorth
FROM `maps`
JOIN `solutions`
ON maps.ID = solutions.mapID
@@ -198,7 +201,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
@@ -254,11 +258,11 @@ function displayPastMaze($mapType, $name, $daysAgo = 1) { function displaystats($result, $caption = NULL) {
//Get names.
- $headers = "<tr>";
- $headers .= "<th style='border:1px solid #ccc'>Rank</th>";
- $headers .= "<th style='border:1px solid #ccc'>Name</th>";
- $headers .= "<th style='border:1px solid #ccc'>Moves</th>";
- $headers .= "<th style='border:1px solid #ccc'>Time taken</th>";
+ $headers = "<tr class='leaderboardHeaders'>";
+ $headers .= "<th class='leaderboardHeadersRank'>Rank</th>";
+ $headers .= "<th class='leaderboardHeadersName'>Name</th>";
+ $headers .= "<th class='leaderboardHeadersMoves'>Moves</th>";
+ $headers .= "<th class='leaderboardHeadersTime'>Time taken</th>";
$headers .= "</th>";
//Start table
//$r .= "<table style='border:1px solid #FFF'>";
@@ -269,6 +273,7 @@ function displaystats($result, $caption = NULL) { //$r .= "</tr>";
$i = 1;
+ $championPoints = null;
while ($row = mysql_fetch_assoc($result)) {
$rowcontent = '';
$mapid = $row['mapID'];
@@ -285,7 +290,7 @@ function displaystats($result, $caption = NULL) { $x = "<tr class='lbrow' onmouseover='changeWallEmblem(\"$wallEmblem\"); changeWallColor(\"$wallColor\"); loadSol(\"$mapid:$solution\");'>\n";
$x .= "<td>$i</td>";
- $x .= "<td><span title='UserID: $userID'><a href='achievements?id=$userID' style='color:$displayColor'>$displayName</a></span></td>";
+ $x .= "<td class='leaderboardName'><span title='UserID: $userID'><a href='achievements?id=$userID' style='color:$displayColor'>$displayName</a></span></td>";
//$x .= "<td style='color:$displayColor';>" . $row['Name'] . '</td>';
$x .= '<td><a href="javascript:void(0)">' . $row['Moves'] . '</a></td>';
$x .= '<td>' . $row['Timetaken'] . '</td>';
@@ -293,6 +298,7 @@ function displaystats($result, $caption = NULL) { if ($userID == $_SESSION['userID']) {
$promotedContent .= $x;
+ $championPoints = $row['championPointsWorth'];
} else {
$content .= $x;
}
@@ -300,7 +306,12 @@ function displaystats($result, $caption = NULL) { $i++;
}
- $r = "<table style='border:1px solid #FFF'>";
+ $r = '';
+ if($championPoints != null && $championPoints > 0)
+ {
+ $r .= "<div class='myPoints'>Points earned: <span class='myPointsValue'>$championPoints</span> <img src='../images/championpoints.png' width='16px' height='16px'></img></div>";
+ }
+ $r .= "<table style='border:1px solid #FFF'>";
$r .= "<caption>$caption</caption>";
$r .= $headers;
$r .= $promotedContent;
|