Start on service alerts api
Binary files /dev/null and b/css/images/warning.png differ
--- /dev/null
+++ b/geo/stops.kml.php
@@ -1,1 +1,36 @@
-
+<?php
+header('Content-type: application/vnd.google-earth.kml+xml');
+//http://wiki.openstreetmap.org/wiki/OpenLayers_Dynamic_KML
+// Creates the KML/XML Document.
+$dom = new DOMDocument('1.0', 'UTF-8');
+// Creates the root KML element and appends it to the root document.
+$node = $dom->createElementNS('http://earth.google.com/kml/2.1', 'kml');
+$parNode = $dom->appendChild($node);
+// Creates a KML Document element and append it to the KML element.
+$dnode = $dom->createElement('Document');
+$docNode = $parNode->appendChild($dnode);
+if ($suburb != "") $result_stops = getStopsBySuburb($suburb);
+else $result_stops = getStops();
+foreach ($result_stops as $stop) {
+ $description = 'http://bus.lambdacomplex.org/' . 'stop.php?stopid=' . $stop['stop_id'] . " <br>";
+ // Creates a Placemark and append it to the Document.
+ $node = $dom->createElement('Placemark');
+ $placeNode = $docNode->appendChild($node);
+ // Creates an id attribute and assign it the value of id column.
+ $placeNode->setAttribute('id', 'placemark' . $stop['stop_id']);
+ // Create name, and description elements and assigns them the values of the name and address columns from the results.
+ $nameNode = $dom->createElement('name', htmlentities($stop['stop_name']));
+ $descriptionNode = $dom->createElement('description', $description);
+ $placeNode->appendChild($nameNode);
+ $placeNode->appendChild($descriptionNode);
+ // Creates a Point element.
+ $pointNode = $dom->createElement('Point');
+ $placeNode->appendChild($pointNode);
+ // Creates a coordinates element and gives it the value of the lng and lat columns from the results.
+ $coorStr = $stop['stop_lon'] . ',' . $stop['stop_lat'];
+ $coorNode = $dom->createElement('coordinates', $coorStr);
+ $pointNode->appendChild($coorNode);
+}
+$kmlOutput = $dom->saveXML();
+echo $kmlOutput;
+?>
--- a/include/common-session.inc.php
+++ b/include/common-session.inc.php
@@ -41,9 +41,6 @@
}
}
}
- if ($_SESSION['lat'] != "" && isAnalyticsOn()) {
- trackEvent("Geolocation", "Updated Location", "Geocoded - " . ($geocoded ? "Yes" : "No"));
- }
sessionUpdated();
}
function sessionUpdated()
@@ -63,3 +60,4 @@
return ($_SESSION['time'] ? $_SESSION['time'] : date("H:i:s"));
}
?>
+
--- a/include/db/stop-dao.inc.php
+++ b/include/db/stop-dao.inc.php
@@ -30,7 +30,7 @@
}
$query.= " order by stop_name;";
$query = $conn->prepare($query);
- $query->bindParam(":firstLetter", $firstLetter);
+ if ($firstLetter != "") $query->bindParam(":firstLetter", $firstLetter);
$query->execute();
if (!$query) {
databaseError($conn->errorInfo());
--- /dev/null
+++ b/servicealerts_api.php
@@ -1,1 +1,54 @@
+<?php
+include ('include/common.inc.php');
+/*
+ also need last modified epoch of client gtfs
+
+ - add,remove,patch
+ - stop
+ - trip
+ - patterns (WHERE=)
+ - route (short_name or route_id)
+ - street
+ - stop
+ - trip */
+/* header {
+ gtrtfs_version: "1"
+ timestamp: 1307926866
+}
+entity {
+ id: "21393"
+ alert {
+ active_period {
+ start: 1307955600
+ end: 1307988000
+ }
+ informed_entity {
+ route_id: "100"
+ route_type: 1
+ }
+ url {
+ translation {
+ text: "http://trimet.org/alerts/"
+ }
+ }
+ description_text {
+ translation {
+ text: "Rose Festival fleet departures will cause bridge lifts until around 10 a.m. Expect delays."
+ }
+ }
+ }
+}*/
+$return = Array();
+header('Content-Type: text/javascript; charset=utf8');
+// header('Access-Control-Allow-Origin: http://bus.lambdacomplex.org/');
+header('Access-Control-Max-Age: 3628800');
+header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
+if (isset($_GET['callback'])) {
+ $json = '(' . json_encode($return) . ');'; //must wrap in parens and end with semicolon
+ print_r($_GET['callback'] . $json); //callback is prepended for json-p
+
+}
+else echo json_encode($return);
+ ?>
+