summaryrefslogtreecommitdiffstats
path: root/ajax
diff options
context:
space:
mode:
Diffstat (limited to 'ajax')
-rw-r--r--ajax/challenges.ajax.php28
1 files changed, 4 insertions, 24 deletions
diff --git a/ajax/challenges.ajax.php b/ajax/challenges.ajax.php
index 77a788d..f27f3bb 100644
--- a/ajax/challenges.ajax.php
+++ b/ajax/challenges.ajax.php
@@ -16,7 +16,7 @@ if ($_GET['getChallengeMap'] == 'true') {
}
if ($_GET['getChallenges'] == 'true') {
- echo displayChallenges($_GET['challengeMapID']);
+ echo json_encode(getChallenges($_GET['challengeMapID'], $_GET['userID']));
exit;
}
@@ -89,34 +89,14 @@ function getChallengesByTier($userIdUnsanitized) {
}
-function displayChallenges($mapIdUnsanitized) {
- $result = loadChallengesForMap($mapIdUnsanitized, 3);
- while($challenge = mysql_fetch_array($result)) {
+function getChallenges($mapIdUnsanitized, $userIdUnsanitized) {
+ $result = loadChallengesForMap($mapIdUnsanitized, $userIdUnsanitized);
+ while($challenge = mysql_fetch_assoc($result)) {
$data[] = $challenge;
}
return $data;
}
-function displayChallengesHTML($challengeResultset)
-{
- echo '<div id="challenges">';
- echo '<div id="challenges_title">Challenges</div>';
- echo '<div id="challenges_listing"><ul class="challenge_ulist">';
- while($challenge = mysql_fetch_array($challengeResultset))
- {
- $challengeMapID = $_GET["challengeMapID"];
- $challengeId = $challenge["challengeID"];
- if($challenge["dateSolved"] !== NULL)
- $cssClass = "challenge_complete";
- else
- $cssClass = "challenge_incomplete";
- $loadSolutionString = "<a href='javascript:requestChallengeSolution(\"$challengeMapID\", \"$challengeId\");'> Load this solution</a>";
- echo "<li class='$cssClass' id='challenge_id_$challengeId'>" . getChallengeDisplayString($challenge) . " $loadSolutionString </li>";
- }
- echo "</ul></div></div>";
-}
-
-
/**
* Returns a MySQL resultset for all challenges for the given mapID