summaryrefslogtreecommitdiffstats
path: root/pages/challengelist.php
diff options
context:
space:
mode:
authorPatrick Davison <snapwilliam@gmail.com>2013-04-18 01:57:33 -0700
committerPatrick Davison <snapwilliam@gmail.com>2013-04-18 01:57:33 -0700
commit472b605532b16e1b429ab6300b98be7a41e0ba7a (patch)
tree586da77279ca6bd8991789c609b3459df1a3504c /pages/challengelist.php
parente37234b2da5075409d12d345d7cd73b6ea803f5f (diff)
downloadpathery-472b605532b16e1b429ab6300b98be7a41e0ba7a.tar.xz
Challenges AJAX style - progress.
Diffstat (limited to 'pages/challengelist.php')
-rw-r--r--pages/challengelist.php93
1 files changed, 90 insertions, 3 deletions
diff --git a/pages/challengelist.php b/pages/challengelist.php
index 51c8f69..1e199d7 100644
--- a/pages/challengelist.php
+++ b/pages/challengelist.php
@@ -1,6 +1,6 @@
<?php
htmlHeader(
- array('tutorial', 'challenge'), 'Pathery Challenges',
+ array('tutorial', 'challenge', 'stats'), 'Pathery Challenges',
'Challenges', array('scores', 'dateformat')
);
@@ -11,13 +11,98 @@ include_once ('./includes/datas.php');
include_once ('./includes/mapclass.php');
include_once ('./includes/constants.php');
+echo soundManager2();
topbar($Links);
?>
+<script>
+// -display sections labeled..
+// -*click
+// -display levels
+// -*click
+// -display map.
+// -*finish map:
+// -highlight 'Next'
+
+
+function navShowChallengeTiers() {
+
+}
+
+function navShowLevels(tier) {
+ $('#t')
+ .hide()
+ .html("")
+ .slideDown('fast');
+
+ var urlString = 'http://www.mazetd.4xg.net/ajax/challenges.ajax.php?getChallengeIDs=true&userID=3';
+ $.ajax({
+ type: "GET",
+ url: urlString,
+ cache: true,
+ data: '',
+ fail: function() { alert("ajax error - if this persists check your connection."); },
+ complete: function(data) {showLevelsResponse(data.responseText);}
+ });
+}
+
+function showLevelsResponse(response) {
+ var json = decryptJSON(response);
+ $.each(json, function(key, challengeObj) {
+ console.log("tests", key, challengeObj);
+ //$("#thumb_"+mapID).html(formatMapThumbForNav(data.responseText)).show();
+ $("#t").append(formatChallengeThumbnail(challengeObj.mapObject)).show();
+ mapdata[key] = challengeObj.mapObject;
+ });
+ $("#t").append('<div style="float:left; margin:12px; width:200px; height:200px;" class="mapThumbnail">Grayed out Obscured Map Here.</div>').show();
+ $("#t").append('<div style="float:left; margin:12px; width:200px; height:200px;" class="mapThumbnail">Grayed out Obscured Map Here.</div>').show();
+ $("#t").append('<div style="float:left; margin:12px; width:200px; height:200px;" class="mapThumbnail">Grayed out Obscured Map Here.</div>').show();
+}
+
+function formatChallengeThumbnail(map) {
+ return '<div onclick="displayChallengeMap('+map.ID+')" style="float:left; margin:12px;" class="mapThumbnail">'+mapThumbnailHTML(map, 200, false)+'</div>';
+}
+
+function displayChallengeMap(challengeMapID) {
+ $("#t").html(mapAsHTML(mapdata[challengeMapID]));
+}
+
+function hideNav() {
+
+}
+function showNav() {
+
+}
+
+
+
+</script>
+
<div id="challengelist_wrapper" class="wrapper" style='overflow: auto;'>
+<h3>Challenges - Pre-Beta, AKA Alpha.</h3>
+
+<div id='backBtn'><a href=''>Back Btn</a></div>
+<div id='t' style='border:1px solid red; width:99%;overflow: hidden;'>
+ <div onclick='navShowLevels(1);' style='float:left; margin:10px; border:10px solid white;padding:20px'>
+ Easy
+ </div>
+ <div style='float:left; margin:10px; border:10px solid gray;padding:20px'>
+ Normal
+ </div>
+ <div style='float:left; margin:10px; border:10px solid gray;padding:20px'>
+ Hard
+ </div>
+</div>
+
+<div style='clear:both'></div>
+
+
+</div>
<?
+htmlFooter();
+exit;
//Check that the user is allowed to do the challenges
if (!$accepted) {
@@ -44,7 +129,7 @@ if (!hasCompletedTutorial($userID)) {
?>
<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>
+ <br />This game is best played in <a href='http://www.google.com/chrome'>Google Chrome</a>
</noscript>
<?
@@ -65,7 +150,6 @@ htmlFooter();
function getChallengeListHtml($challengeListResultset) {
//First gather data to a more useful form.
- $r = '';
while($data = mysql_fetch_array($challengeListResultset)) {
$tier = $data['challengeTier'];
$challengeSuborder = $data['challengeSuborder'];
@@ -73,6 +157,7 @@ function getChallengeListHtml($challengeListResultset) {
$challenges[$tier][$challengeSuborder][$ordering] = $data;
}
+ $r = '';
$numCompletedChallenges = 0;
foreach ($challenges as $tier => $challengeMap) {
$r .= "<b>Section $tier</b> levels:<div class='challengelist_tier' style='border: 1px solid yellow; overflow: auto;'>";
@@ -229,4 +314,6 @@ function displayChallengeList($challengeListResultset)
echo "</div></div>";
echo "</div>";
}
+
+
?> \ No newline at end of file