Wrap time/place and map in collapsing regions
[bus.git] / busui / common.inc.php
blob:a/busui/common.inc.php -> blob:b/busui/common.inc.php
--- a/busui/common.inc.php
+++ b/busui/common.inc.php
@@ -226,8 +226,11 @@
         }
        $center = $totalLat/sizeof($mapPoints).",".$totalLon/sizeof($mapPoints);
     }
-    
-    return '<img src="staticmaplite/staticmap.php?center='.$center.'&zoom='.$zoom.'&size='.$width.'x'.$height.'&maptype=mapnik&markers='.$markers.'" width='.$width.' height='.$height.'>';
+    $output = "";
+    $output .= '<div data-role="collapsible" data-collapsed="true"><h3>Open Map...</h3>';
+    $output .= '<center><img src="staticmaplite/staticmap.php?center='.$center.'&zoom='.$zoom.'&size='.$width.'x'.$height.'&maptype=mapnik&markers='.$markers.'" width='.$width.' height='.$height.'></center>';
+    $output .= '</div>';
+    return $output;
 }
 
 function distance($lat1, $lng1, $lat2, $lng2)
@@ -390,4 +393,36 @@
     }
     return implode(", ",$pointNames);
 }
+
+function timePlaceSettings() {
+    global $service_periods;
+    echo '<div data-role="collapsible" data-collapsed="true">
+        <h3>Change Time/Place...</h3>
+        <div class="ui-body"> 
+		<div data-role="fieldcontain">
+	            <label for="geolocate"> Current Location: </label>
+			<input type="text" id="geolocate" name="geolocate" value="Enter co-ordinates or address here"/> <a href="#" style="display:none" name="here" id="here"/>Here?</a>
+	        </div>
+    		<div data-role="fieldcontain">
+		        <label for="time"> Time: </label>
+		    	<input type="time" value="'. date("H:m").'"/> <a href="#" style="display:none" name="currentTime" id="currentTime"/>Current Time?</a>
+	        </div>
+		<div data-role="fieldcontain">
+		    <label for="service_period"> Service Period:  </label>
+			<select name="service_period">';
+
+			   foreach ($service_periods as $service_period) {
+			    echo "<option value=\"$service_period\"".(service_period() === $service_period ? "SELECTED" : "").'>'.ucwords($service_period).'</option>';
+			   }
+			echo '</select>
+			<a href="#" style="display:none" name="currentPeriod" id="currentPeriod"/>Current Period?</a>
+		</div>
+		
+		<input type="submit" value="Update"/>
+            </div></div>';
+echo "	<script>
+$('#here').click(function(event) { $('#geolocate').val(getCookie('geolocate')); return false;});
+$('#here').show();
+        </script>";
+}
 ?>