diff options
author | Patrick Davison <snapwilliam@gmail.com> | 2011-09-15 00:41:14 -0700 |
---|---|---|
committer | Patrick Davison <snapwilliam@gmail.com> | 2011-09-15 00:41:14 -0700 |
commit | cc2e1384904ff984208cf0236a9a5c6e957ba899 (patch) | |
tree | 78f06be19662c55bebe4aa6da1264b6efaa567d9 /includes/maps.php | |
parent | 5332f68b60f6c37850468ab3922936d0a12d9daf (diff) | |
download | pathery-cc2e1384904ff984208cf0236a9a5c6e957ba899.tar.xz |
Tutorial work
Diffstat (limited to 'includes/maps.php')
-rw-r--r-- | includes/maps.php | 81 |
1 files changed, 70 insertions, 11 deletions
diff --git a/includes/maps.php b/includes/maps.php index c01af22..bef6c63 100644 --- a/includes/maps.php +++ b/includes/maps.php @@ -1,10 +1,19 @@ <?PHP
//Displays the map
-function DisplayMap($mapMatrix, $idprefix = 1, $example = false, $speed = NULL) {
+function DisplayMap($mapMatrix, $idprefix = 1, $style = 'normal', $speed = NULL) {
//Iterate through $mapMatrix and generate the html
$maptable = ""; //The string to return to the database.
$index = 0; //The current number of tiles from the last tile saved.
+ $example = false;
+ if ($style == 'example') {
+ $example = true;
+ }
+
+ $puzzle = false;
+ if ($style == 'puzzle') {
+ $puzzle = true;
+ }
if ($speed == NULL) {
if ($example) {
@@ -150,24 +159,74 @@ function DisplayMap($mapMatrix, $idprefix = 1, $example = false, $speed = NULL) return $output;
}
//$date = date("m-d-y");
+
+
+ //OUTPUT FOR PUZZLE-STYLE MAPS
+ if ($puzzle) {
+ $output = "
+ <div id='$idprefix,outer' class='grid_outer' style='width:".($width+2)."px;height:".($height+60)."px;'>
+
+ <div style='display:none;'>
+ <div id='$idprefix,dspID' title='MapID: $idprefix'>
+ </div>
+
+
+ </div>
+
+
+ <div id='$idprefix,dspbr' class='grid_dsp_left dsp_60'>
+ <div id='$idprefix,dspCount' class='grid_dsp_data'>
+ 0 moves
+ </div>
+ </div>
+
+ <div id='$idprefix,dsptr' class='grid_dsp_right dsp_32'>
+ <span id='$idprefix,dspWalls' class='grid_dsp_data'>
+ ".$mapdata['walls']." walls
+ </span>
+ </div>
+
+
+ $maptable
+
+
+ <div id='$idprefix,dspbl' class='grid_dsp_left dsp_60'>
+ <input id='$idprefix,btn' type='button' onclick='doSend($idprefix)' value='Go!' />
+ Speed:
+ <select onChange='savePref(\"speed\", this.value)' id='$idprefix,speed'>
+ $rOption
+ </select>
+ </div>
+
+ <div class='grid_dsp_mid dsp_24'>
+ $mutebutton
+ </div>
+ $mapdatadiv
+
+ </div>
+ ";
+ return $output;
+ }
+
+ //NORMAL OUTPUT:
$output = "
<div id='$idprefix,outer' class='grid_outer' style='width:".($width+2)."px;height:".($height+60)."px;'>
<div class='grid_dsp_left dsp_60'>
- <div id='$idprefix,dspID' title='MapID: $idprefix'>
- MapID: $idprefix
- </div>
+ <div id='$idprefix,dspID' title='MapID: $idprefix'>
+ MapID: $idprefix
+ </div>
</div>
<div id='$idprefix,dsptr' class='grid_dsp_right dsp_33'>
- <span id='$idprefix,dspWalls' class='grid_dsp_data'>
- ".$mapdata['walls']." walls
- </span>
- <span>
- ( <a href='javascript:resetwalls($idprefix)'>Reset</a> )
- </span>
+ <span id='$idprefix,dspWalls' class='grid_dsp_data'>
+ ".$mapdata['walls']." walls
+ </span>
+ <span>
+ ( <a href='javascript:resetwalls($idprefix)'>Reset</a> )
+ </span>
</div>
@@ -187,7 +246,7 @@ function DisplayMap($mapMatrix, $idprefix = 1, $example = false, $speed = NULL) <div id='$idprefix,dspbr' class='grid_dsp_right dsp_33'>
<div id='$idprefix,dspCount' class='grid_dsp_data'>
- ".$path['moves']." moves
+ 0 moves
</div>
</div>
|