More between points work + mobile UI work:
[bus.git] / busui / index.php
blob:a/busui/index.php -> blob:b/busui/index.php
--- a/busui/index.php
+++ b/busui/index.php
@@ -1,64 +1,61 @@
 <?php 
-include('common.inc.php'); 
+include('common.inc.php');
+ // remove all the variable in the session 
+ session_unset(); 
+
+ //destroy the session 
+ session_destroy();
+ if (isset($_REQUEST['service_period'])) $_SESSION['service_period'] = $_REQUEST['service_period'];
+ if (isset($_REQUEST['time'])) $_SESSION['time'] = $_REQUEST['time'];
+ // todo take in cellids and crossreference with http://realtimeblog.free.fr/latest/cellular/processed/sqlite/505_sqlite_zones.zip to estimate location
+include_header("bus.lambdacomplex.org",false, true)
 ?>
-<!doctype html>
-<html>
-    <head>
-        <meta charset="UTF-8" />
-        <title>bus.lambdacomplex.org</title>
-	<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.css" />
-	<script src="http://code.jquery.com/jquery-1.4.3.min.js"></script>
-	<script src="http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.js"></script>
-        <!-- <script src="jqtouch/extensions/jqt.location.js" type="application/x-javascript" charset="utf-8"></script>  -->
- 
-<!--        <script type="text/javascript" charset="utf-8">
-            $(function(){
-                function setDisplay(text) {
-                    $('.latlng').empty().append(text)
-                }
-                
-                // We pass "updateLocation" a callback function,
-                // to run once we have the coordinates.
-                // We also set it to a variable, so we can know
-                // right away if it's working or not
-                var lookup = jQT.updateLocation(function(coords){
-                    if (coords) {
-                        setDisplay('Latitude: ' + coords.latitude + '<br />Longitude: ' + coords.longitude);
-			 $('.nearby').empty().append('<a href="list.php?lat=' + coords.latitude + '&lng=' + coords.longitude + '">Nearby List</a>');
-                    } else {
-                        setDisplay('Device not capable of geo-location.');
-                    }
-                });
- 
-                if (lookup) {
-                    setDisplay('Looking up location&hellip;');
-                }
-            });
-        </script> -->
-    </head>
-    <body>
-<div data-role="page" data-theme="b" id="jqm-home"> 
-	<div id="jqm-homeheader"> 
-		<p>bus.lambdacomplex.org</p> 
+<div data-role="page">
+	<div data-role="content">
+			<div id="jqm-homeheader">
+	    	<center><h3 id="jqm-logo"><img src="apple-touch-icon.png" alt="logo" width="64" height="64" /><br>
+		busness time</h3></center>
 	</div> 
-	<div data-role="content"> 
+	    <a href="tripPlanner.php" data-role="button">Launch Trip Planner...</a>
             <ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b">
-                <li data-role="list-divider">Stops</li>
-                <li><a href="stopList.php">All stops List</a></li>
-		<li class="nearby"><a href="">Nearby List</a></li>
-                <li><a href="stopList.php">Favourites List</a></li>
+                <li data-role="list-divider">Timetables - Stops</li>
+                <li><a href="stopList.php">Major (Timing Point) Stops</a></li>
+		<li><a href="stopList.php">All Stops</a></li>
+		<li><a href="stopList.php?nearbyfavs=yes">Nearby/Favourite Stops</a></li>
             </ul>
 	    <ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b">
-                <li data-role="list-divider">Routes</li>
-                <li><a href="routeList.php">All Routes List</a></li>
-		<li class="nearby"><a href="">Nearby List</a></li>
-                <li><a href="routeList.php">Favourites List</a></li>
+                <li data-role="list-divider">Timetables - Routes</li>
+                <li><a href="routeList.php">Routes By Final Destination</a></li>
+		<li><a href="routeList.php?bynumber=yes">Routes By Number</a></li>
+		<li><a href="routeList.php?nearbyfavs=yes">Nearby/Favourites Routes</a></li>
             </ul>
-            <div class="info">
-		<p class="latlng"></p>
-		Time: <?php echo date("H:m"); ?> <br>
-		Service Period: <?php echo ucwords(service_period()); ?> 
+            <div class="ui-body ui-body-c">
+		<h3>Time/Place Settings</h3>
+		<div data-role="fieldcontain">
+	            <label for="geolocate"> Current Location: </label>
+			<input type="text" id="geolocate" name="geolocate"/> <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="<?php echo 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">	
+			   <?php
+			   foreach ($service_periods as $service_period) {
+			    echo "<option value=\"$service_period\"".(service_period() === $service_period ? "SELECTED" : "").'>'.ucwords($service_period).'</option>';
+			   }?>
+			</select>
+			<a href="#" style="display:none" name="currentPeriod" id="currentPeriod"/>Current Period?</a>
+		</div>
+		
+		<input type="submit" value="Update"/>
             </div>
+	<script>
+$('#here').click(function(event) { $('#geolocate').val(getCookie('geolocate')); return false;});
+$('#here').show();
+        </script>
         </div>
    </div>
  </body>