From 468e9a700736166f175b974e185d24d0d2a4f33e Mon Sep 17 00:00:00 2001 From: BlueRaja Date: Sun, 13 Jan 2013 00:48:07 -0600 Subject: db.inc.php now only contains the database login info; the actual connection to the DB has been moved to includes/sqlEmbedded. This was done so we don't need to have the db info in two separate files (one of which is in the repo, derp) --- pages/leaderboard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pages/leaderboard.php') diff --git a/pages/leaderboard.php b/pages/leaderboard.php index 9f40d8b..292de60 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; -- cgit v1.2.3 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(-) (limited to 'pages/leaderboard.php') 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 From 5e0a7d186ceced61f0c3b4c919332aa7b5cd33aa Mon Sep 17 00:00:00 2001 From: BlueRaja Date: Sun, 13 Jan 2013 14:35:35 -0600 Subject: Added a championpoints image to all the pages. You're definitely going to want to change it before releasing, though :) --- images/championpoints.png | Bin 0 -> 1484 bytes pages/faq.php | 4 ++-- pages/leaderboard.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 images/championpoints.png (limited to 'pages/leaderboard.php') diff --git a/images/championpoints.png b/images/championpoints.png new file mode 100644 index 0000000..f6625fe Binary files /dev/null and b/images/championpoints.png differ diff --git a/pages/faq.php b/pages/faq.php index 2cf2709..e9d8e5f 100644 --- a/pages/faq.php +++ b/pages/faq.php @@ -137,8 +137,8 @@ When there's more than one checkpoint, you can completely wall one off.  

What are 'Champion Points?'

- -

Champion Points are a way for us to give you recognition for your skills and dedication. They work like this: + +

Champion Points are a way to give you recognition for your skills and dedication. They work like this:

  • Just for attempting a map, you get points. That's points a day just for clicking go!
  • If you tie the high score, you get anywhere between and points, depending on how many people tied or didn't tie the high score.
  • diff --git a/pages/leaderboard.php b/pages/leaderboard.php index a256f1c..62cc54d 100644 --- a/pages/leaderboard.php +++ b/pages/leaderboard.php @@ -307,7 +307,7 @@ function displaystats($result, $caption = NULL) { $r = ''; if($championPoints != null) { - $r .= "
    Points earned: $championPoints
    "; + $r .= "
    Points earned: $championPoints
    "; } $r .= "
$caption
"; $r .= ""; -- cgit v1.2.3 From 3917765f10b0a3024634bef1ff0c49d700abdfa1 Mon Sep 17 00:00:00 2001 From: BlueRaja Date: Sun, 13 Jan 2013 14:41:12 -0600 Subject: Fixed minor CSS issue with leaderboard page --- css/stats.css | 4 ++-- pages/leaderboard.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'pages/leaderboard.php') diff --git a/css/stats.css b/css/stats.css index 23a6003..d262a75 100644 --- a/css/stats.css +++ b/css/stats.css @@ -112,13 +112,13 @@ td, th { white-space:nowrap; } -.wrapper .col1 #myPoints +.wrapper .col1 .myPoints { text-align: center; color: #00DDFF; } -.wrapper .col1 #myPoints #myPointsValue +.wrapper .col1 .myPoints .myPointsValue { font-weight: bold; } \ No newline at end of file diff --git a/pages/leaderboard.php b/pages/leaderboard.php index 62cc54d..4636429 100644 --- a/pages/leaderboard.php +++ b/pages/leaderboard.php @@ -307,7 +307,7 @@ function displaystats($result, $caption = NULL) { $r = ''; if($championPoints != null) { - $r .= "
Points earned: $championPoints
"; + $r .= "
Points earned: $championPoints
"; } $r .= "
$caption
"; $r .= ""; -- cgit v1.2.3 From 994998fcca96e69bfbd7eed09e3c0023aadc2ce1 Mon Sep 17 00:00:00 2001 From: BlueRaja Date: Sun, 13 Jan 2013 15:57:36 -0600 Subject: Updated CSS of leaderboard page to not get ridiculously large with long names, and not make the points-string off-center --- css/stats.css | 26 +++++++++++++++++++++++--- pages/leaderboard.php | 12 ++++++------ 2 files changed, 29 insertions(+), 9 deletions(-) (limited to 'pages/leaderboard.php') diff --git a/css/stats.css b/css/stats.css index d262a75..28d6842 100644 --- a/css/stats.css +++ b/css/stats.css @@ -9,7 +9,7 @@ margin-right: 0px; margin-left: 12px; float: left; - width: 300px; + max-width: 340px; height: auto; } .col { @@ -37,6 +37,26 @@ table { td, th { padding: 3px; } + +.leaderboardHeaders .leaderboardHeadersRank, +.leaderboardHeaders .leaderboardHeadersName, +.leaderboardHeaders .leaderboardHeadersMoves, +.leaderboardHeaders .leaderboardHeadersTime +{ + border:1px solid #ccc; +} + +.leaderboardHeaders .leaderboardHeadersRank { width: 40px; } +.leaderboardHeaders .leaderboardHeadersName, +.leaderboardName +{ + max-width: 140px; + text-overflow: ellipsis; + overflow: hidden; +} +.leaderboardHeaders .leaderboardHeadersMoves { width: 45px; } +.leaderboardHeaders .leaderboardHeadersTime { width: 85px; } + .lbrow { /* Temporary adjust for font changes */ font-size:105%; @@ -112,13 +132,13 @@ td, th { white-space:nowrap; } -.wrapper .col1 .myPoints +.myPoints { text-align: center; color: #00DDFF; } -.wrapper .col1 .myPoints .myPointsValue +.myPoints .myPointsValue { font-weight: bold; } \ No newline at end of file diff --git a/pages/leaderboard.php b/pages/leaderboard.php index 4636429..1c6ef89 100644 --- a/pages/leaderboard.php +++ b/pages/leaderboard.php @@ -256,11 +256,11 @@ function displayPastMaze($mapType, $name, $daysAgo = 1) { function displaystats($result, $caption = NULL) { //Get names. - $headers = ""; - $headers .= ""; - $headers .= ""; - $headers .= ""; - $headers .= ""; + $headers = ""; + $headers .= ""; + $headers .= ""; + $headers .= ""; + $headers .= ""; $headers .= ""; //Start table //$r .= "
$caption
RankNameMovesTime taken
RankNameMovesTime taken
"; @@ -288,7 +288,7 @@ function displaystats($result, $caption = NULL) { $x = "\n"; $x .= ""; - $x .= ""; + $x .= ""; //$x .= "'; $x .= ''; $x .= ''; -- cgit v1.2.3 From 35307251560e459615f2a3e5ab6572b3f80cfdd9 Mon Sep 17 00:00:00 2001 From: BlueRaja Date: Sun, 13 Jan 2013 16:14:51 -0600 Subject: Fixed champion points not showing up correctly in leaderboards weekly/monthly view --- pages/leaderboard.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pages/leaderboard.php') diff --git a/pages/leaderboard.php b/pages/leaderboard.php index 1c6ef89..b5e3a76 100644 --- a/pages/leaderboard.php +++ b/pages/leaderboard.php @@ -110,7 +110,9 @@ function getStat ($type, $daysAgo = 1) { userData.wallEmblem, userData.displayColor, users.ID as userID, - solutions.championPointsWorth + SUM(CASE WHEN solutions.dateModified < CURDATE() + THEN solutions.championPointsWorth + ELSE 0 END) AS championPointsWorth FROM `maps` JOIN `solutions` ON maps.ID = solutions.mapID @@ -305,7 +307,7 @@ function displaystats($result, $caption = NULL) { } $r = ''; - if($championPoints != null) + if($championPoints != null && $championPoints > 0) { $r .= "
Points earned: $championPoints
"; } -- cgit v1.2.3
$i$displayName$displayName" . $row['Name'] . '' . $row['Moves'] . '' . $row['Timetaken'] . '