summaryrefslogtreecommitdiffstats
path: root/pages/challenge.php
diff options
context:
space:
mode:
authorPatrick Davison <snapwilliam@gmail.com>2013-01-08 01:53:05 -0800
committerPatrick Davison <snapwilliam@gmail.com>2013-01-08 01:53:05 -0800
commit6b8c58ac2d4de502421acef48f4434bee605633f (patch)
treeb6ed4553388d0058952a987734a317ecfaea13f9 /pages/challenge.php
parenta431308aa3c6c698d23b45bf5e1f905123e0cba5 (diff)
downloadpathery-6b8c58ac2d4de502421acef48f4434bee605633f.tar.xz
Challenges Implementation. LOTS of stuff
Fixed an issue with loading best solution from logged out to logged in state. Commented out a lot of firephp stuff; feel free to uncomment.
Diffstat (limited to 'pages/challenge.php')
-rw-r--r--pages/challenge.php17
1 files changed, 9 insertions, 8 deletions
diff --git a/pages/challenge.php b/pages/challenge.php
index 2ab279d..8d312d1 100644
--- a/pages/challenge.php
+++ b/pages/challenge.php
@@ -1,5 +1,4 @@
<?php
-ob_start("ob_gzhandler");
htmlHeader(
array('tutorial', 'challenge'), 'Pathery Challenges',
'Challenges', array('scores', 'dateformat')
@@ -94,8 +93,11 @@ if($mapCode === NULL)
return;
}
+// TODO: !! Sanitize mapid
+$mapID = $_GET["mapID"];
+
$mapContent = displayMap(GenerateMapByCode($mapCode), $_GET["mapID"]);
-$challengeResultset = loadChallengesForMap($_GET["mapID"], $userID);
+$challengeResultset = loadChallengesForMap($mapID, $userID);
if($challengeResultset === NULL)
{
redirectToChallengeListing();
@@ -112,9 +114,6 @@ if($challengeResultset === NULL)
?>
</div>
-<div id="copy" style='width:100%;clear: both'>
- Copyright &copy; 2011-2012 pathery.com
-</div>
<script src="sounds/script/soundmanager.js"></script>
<script type="text/javascript">soundManagerInit();</script>
@@ -135,13 +134,15 @@ function displayChallenges($challengeResultset)
echo '<div id="challenges_listing"><ol>';
while($challenge = mysql_fetch_array($challengeResultset))
{
+ $mapID = $_GET["mapID"];
$challengeId = $challenge["challengeID"];
echo "<li>";
if($challenge["dateSolved"] !== NULL)
$cssClass = "challenge_complete";
else
$cssClass = "challenge_incomplete";
- echo "<span class='$cssClass' id='challenge_id_$challengeId'>" . getChallengeDisplayString($challenge) . "</span>";
+ $loadSolutionString = "<a href='javascript:requestChallengeSolution(\"$mapID\", \"$challengeId\");'> Load this solution</a>";
+ echo "<span class='$cssClass' id='challenge_id_$challengeId'>" . getChallengeDisplayString($challenge) . " $loadSolutionString </span>";
echo "</li>";
}
echo "</ol></div></div>";
@@ -157,7 +158,7 @@ function getChallengeDisplayString($challenge)
if($challenge["goal"] == 0)
$returnMe .= "Complete the maze";
else if ($challenge['inequality'] == "greater than")
- $returnMe .= "Get " . $challenge['goal'];
+ $returnMe .= "Get " . $challenge['goal'] . ' or more';
else if ($challenge['inequality'] == "less than")
$returnMe .= "Get LESS THAN " . $challenge['goal'];
else //inequality == "equal"
@@ -169,7 +170,7 @@ function getChallengeDisplayString($challenge)
//Wall-count restriction
if($challenge['restrictWallCount'] !== NULL)
{
- $restrictions[] = "at most " . $challenge['restrictWallCount'] . " wall" . ($challenge['restrictWallCount'] == 1 ? "" : "s");
+ $restrictions[] = "only " . $challenge['restrictWallCount'] . " wall" . ($challenge['restrictWallCount'] == 1 ? "" : "s");
$addUsingToText = true;
}