diff options
author | BlueRaja <BlueRaja.admin@gmail.com> | 2012-10-01 14:50:10 -0500 |
---|---|---|
committer | BlueRaja <BlueRaja.admin@gmail.com> | 2012-10-01 14:50:10 -0500 |
commit | 7a60127a4b17e74860a80a62cdfc53ca37cbff19 (patch) | |
tree | b305eae77397d71dc1f3dd6c6519f5a261887fa2 | |
parent | 526f8dc4b3ce81b5589d2f8a9bdcfab14151dfaf (diff) | |
download | pathery-7a60127a4b17e74860a80a62cdfc53ca37cbff19.tar.xz |
Added a challenge-listing page, and skeleton code for the listing itself
-rw-r--r-- | includes/datas.php | 10 | ||||
-rw-r--r-- | index.php | 4 | ||||
-rw-r--r-- | pages/challenge.php | 14 | ||||
-rw-r--r-- | pages/challengelist.php | 63 |
4 files changed, 87 insertions, 4 deletions
diff --git a/includes/datas.php b/includes/datas.php index 952f903..e8d5871 100644 --- a/includes/datas.php +++ b/includes/datas.php @@ -941,6 +941,16 @@ function loadChallengesForMap($mapIdUnsanitized, $userIdUnsanitized) } /** + * Loads a listing of all maps and challenges for display, along with which ones the user has completed + * @param type $userIdUnsanitized The userID. Assumed to be unsanitized. + * @return Returns a MySQL resultset with the columns listed in the code, or NULL if nothing found + */ +function loadChallengeListing($userIdUnsanitized) +{ + //TODO: Implement +} + +/** * Returns the map "code" for the given mapId */ function loadMapCode($mapIdUnsanitized) @@ -130,6 +130,10 @@ switch ($request) { require 'pages/challenge.php';
break;
+ case "challengelist":
+ require 'pages/challengelist.php';
+ break;
+
case "home":
//No break here
Default:
diff --git a/pages/challenge.php b/pages/challenge.php index 9690edd..2ab279d 100644 --- a/pages/challenge.php +++ b/pages/challenge.php @@ -83,14 +83,14 @@ if (!$accepted) { if(!isset($_GET["mapID"]))
{
- //TODO: Redirect to challenge listing
+ redirectToChallengeListing();
return;
}
$mapCode = loadMapCode($_GET["mapID"]);
if($mapCode === NULL)
{
- //TODO: Redirect to challenge listing also
+ redirectToChallengeListing();
return;
}
@@ -98,7 +98,7 @@ $mapContent = displayMap(GenerateMapByCode($mapCode), $_GET["mapID"]); $challengeResultset = loadChallengesForMap($_GET["mapID"], $userID);
if($challengeResultset === NULL)
{
- //TODO: Redirect to challenge listing also
+ redirectToChallengeListing();
return;
}
@@ -131,7 +131,7 @@ htmlFooter(); function displayChallenges($challengeResultset)
{
echo '<div id="challenges">';
- echo '<div id="challenges_title">Challenges</div>'; //TODO: remove number
+ echo '<div id="challenges_title">Challenges</div>';
echo '<div id="challenges_listing"><ol>';
while($challenge = mysql_fetch_array($challengeResultset))
{
@@ -234,4 +234,10 @@ function getChallengeDisplayString($challenge) $returnMe .= ".";
return $returnMe;
}
+
+function redirectToChallengeListing()
+{
+ header("Location: /challengelist");
+ die();
+}
?>
\ No newline at end of file diff --git a/pages/challengelist.php b/pages/challengelist.php new file mode 100644 index 0000000..e7ade3c --- /dev/null +++ b/pages/challengelist.php @@ -0,0 +1,63 @@ +<?php +ob_start("ob_gzhandler"); +htmlHeader( + array('tutorial', 'challenge'), 'Pathery Challenges', + 'Challenges', array('scores', 'dateformat') +); + +include_once ('./includes/maps.php'); +include_once ('./includes/mapoftheday.php'); +include_once ('./includes/db.inc.php'); +include_once ('./includes/datas.php'); + +topbar($Links); +?> + +<div id="challengelist_wrapper" class="wrapper"> + +<? + +//Check that the user is allowed to do the challenges +if (!$accepted) { + echo "<center>Please <a href='login'>login</a> to do the challenges!</div>"; + htmlFooter(); + return; +} + +//TODO: Uncomment +//if (!hasCompletedTutorial($userID)) { +// echo "<center>Please <a href='tutorial'>complete the tutorial</a> to unlock Challenge mode!</div>"; +// htmlFooter(); +// return; +//} + +?> + <noscript>Sorry, this game requires scripts to run. Please enable javascript and <a href='home'>Reload this site</a> + <br />This game is best viewed in <a href='http://www.google.com/chrome'>Google Chrome</a> + </noscript> +<? + +//Display the actual challenge list +$challengeListResultset = loadChallengeListing($userID); +displayChallengeList($challengeListResultset); + +?> +</div> + +<div id="copy" style='width:100%;clear: both'> + Copyright © 2011-2012 pathery.com +</div> + +<?php +htmlFooter(); +?> + +<?php +/** + * Outputs the list of all challenges to the page + */ +function displayChallengeList($challengeListResultset) +{ + //TODO: implement +} +?>
\ No newline at end of file |