Add feeback form/layar API
Add feeback form/layar API

--- a/busui/about.php
+++ b/busui/about.php
@@ -1,23 +1,24 @@
 <?php
 include('common.inc.php');
+include_header("About")
 ?>
 <p>
-    Busness Time - An ACT bus timetable webapp
-Based on the maxious-canberra-transit-feed
-Uses jQuery Mobile, PHP, Ruby, Python, Google Transit Feed Specification tools, OpenTripPlanner, OpenLayers, OpenStreetMap, Cloudmade Geocoder and Tile Service
-
-Feedback encouraged; contact maxious@lambdacomplex.org
-    
-Some icons by Joseph Wain / glyphish.com
-
-
-Disclaimer: The content of this website is of a general and informative nature. Please check with printed timetables or those available on http://action.act.gov.au before your trip.
+Busness Time - An ACT bus timetable webapp<br />
+Based on the maxious-canberra-transit-feed (<a href="cbrfeed.zip">download</a>, last updated <?php echo date("F d Y.", @filemtime('cbrfeed.zip')); ?>)<br />
+Source code for the transit feed and this site @ <a href="http://maxious.lambdacomplex.org/git">http://maxious.lambdacomplex.org/git</a><br />
+Uses jQuery Mobile, PHP, Ruby, Python, Google Transit Feed Specification tools, OpenTripPlanner, OpenLayers, OpenStreetMap, Cloudmade Geocoder and Tile Service<br />
+<br />
+Feedback encouraged; contact maxious@lambdacomplex.org<br />
+    <br />
+Some icons by Joseph Wain / glyphish.com<br />
+<br />
+<small>Disclaimer: The content of this website is of a general and informative nature. Please check with printed timetables or those available on http://action.act.gov.au before your trip.
 Whilst every effort has been made to ensure the high quality and accuracy of the Site, the Author makes no warranty, 
 express or implied concerning the topicality, correctness, completeness or quality of the information, which is provided 
 "as is". The Author expressly disclaims all warranties, including but not limited to warranties of fitness for a particular purpose and warranties of merchantability. 
 All offers are not binding and without obligation. The Author expressly reserves the right, in his discretion, to suspend, 
 change, modify, add or remove portions of the Site and to restrict or terminate the use and accessibility of the Site 
-without prior notice. 
+without prior notice. </small>
 <?
 include_footer();
 ?>

--- a/busui/common.inc.php
+++ b/busui/common.inc.php
@@ -73,6 +73,13 @@
     .ui-listview-filter {
         margin: 0 !important;
      }
+    #footer {
+        text-size: 0.75em;
+        text-align: center;
+    }
+    body {
+        background-color: #F0F0F0;
+    }
 </style>
 <meta name="apple-mobile-web-app-capable" content="yes" />
  <meta name="apple-mobile-web-app-status-bar-style" content="black" />
@@ -118,7 +125,8 @@
 $('#here').show();
 </script>";
     }
-     echo '</div>';
+    echo '<div id="footer"><a href="about.php">About/Contact Us</a>&nbsp;<a href="feedback.php">Feedback/Bug Report</a></a>';
+    echo '</div>';
 }
 
 $service_periods = Array ('sunday','saturday','weekday');

 Binary files /dev/null and b/busui/css/images/ajax-loader.png differ
 Binary files /dev/null and b/busui/css/images/form-check-off.png differ
 Binary files /dev/null and b/busui/css/images/form-check-on.png differ
 Binary files /dev/null and b/busui/css/images/form-radio-off.png differ
 Binary files /dev/null and b/busui/css/images/form-radio-on.png differ
 Binary files /dev/null and b/busui/css/images/icon-search-black.png differ
 Binary files /dev/null and b/busui/css/images/icons-18-black.png differ
 Binary files /dev/null and b/busui/css/images/icons-18-white.png differ
 Binary files /dev/null and b/busui/css/images/icons-36-black.png differ
 Binary files /dev/null and b/busui/css/images/icons-36-white.png differ
--- /dev/null
+++ b/busui/feedback.php
@@ -1,1 +1,18 @@
+<?php
+include('common.inc.php');
+include_header("Feedback")
+?>
+<h3>Add/Move/Delete a Bus Stop Location</h3>
+StopID:
+or StopCode:
 
+Suggested Stop Location (lat/long or words):
+
+<h3>Bug Report/Feedback</h3>
+<textarea id="extrainfo">
+    Referrer URL
+    User Agent
+    User host/IP
+    Current date/time
+    Dump of $_SESSION
+</textarea>

--- a/busui/index.php
+++ b/busui/index.php
@@ -21,9 +21,8 @@
 		<li><a href="routeList.php?bynumber=yes">Routes By Number</a></li>
 		<li><a class="nearby" href="routeList.php?nearby=yes">Nearby Routes</a></li>
             </ul>
-<?php echo timePlaceSettings();?>
+<?php
+echo timePlaceSettings();
+include_footer(true)
+?>
         
-   </div>
- </body>
-</html>
-

--- /dev/null
+++ b/busui/layar_api.php
@@ -1,1 +1,43 @@
+<?php
+include('common.inc.php');
+$output = Array();
+$output['hotspots'] = Array();
+$output['layer'] = "canberrabusstops";
 
+$url = $APIurl."/json/neareststops?lat={$_REQUEST['lat']}&lon={$_REQUEST['lon']}&limit=5";
+$contents = json_decode(getPage($url));
+debug(print_r($contents,true));
+foreach ($contents as $row)
+{
+    $hotspot = Array();
+    $hotspot['id'] = $row[0];
+    $hotspot['title'] = $row[1];
+    $hotspot['type'] = 0;
+    $hotspot['lat'] = floor($row[2]*1000000);
+    $hotspot['lon'] = floor($row[3]*1000000);
+    $hotspot['distance'] = distance($row[2], $row[3], $_REQUEST['lat'], $_REQUEST['lon']);
+    if (!isset($_REQUEST['radius']) || $hotspot['distance'] < $_REQUEST['radius']) {
+        $hotspot['actions'] = Array(Array("label" => 'Visit Webpage', 'uri' => 'http://bus.lambdacomplex.org/'.'stop.php?stopid='.$row[0]));
+        $url = $APIurl."/json/stoptrips?stop=".$row[0]."&time=".midnight_seconds()."&service_period=".service_period();
+        $trips = json_decode(getPage($url));
+        debug(print_r($trips,true));
+        foreach ($trips as $key => $row)
+        {
+            if ($key > 3) {
+                $hotspot['line'.$key+2]= $row[1][1] .' @ ' .midnight_seconds_to_time($row[0]);
+            }
+        }
+        if (sizeof($trips) == 0) $hotspot['line2'] = 'No trips in the near future.';
+        $hotspot['imageURL'] = null;
+        $output['hotspots'][] = $hotspot;
+    }
+}
+if (sizeof($hotspot) > 0) {
+    $output['errorString'] = 'ok';
+    $output['errorCode'] = 0;
+    } else {
+    $output['errorString'] = 'no results, try increasing range';
+    $output['errorCode'] = 21;
+}
+echo json_encode($output);
+?>