From: maxious Date: Tue, 29 Nov 2011 11:52:50 +0000 Subject: Merge branch 'master' of github.com:maxious/ACTBus-ui X-Git-Url: https://maxious.lambdacomplex.org/git/?p=busui.git&a=commitdiff&h=41f2ec6cc9e4fadd923d045047239079a2634368 --- Merge branch 'master' of github.com:maxious/ACTBus-ui --- --- a/include/common-session.inc.php +++ b/include/common-session.inc.php @@ -17,14 +17,6 @@ */ // you have to open the session to be able to modify or remove it session_start(); -if (isset($_REQUEST['service_period'])) { - $_SESSION['service_period'] = filter_var($_REQUEST['service_period'], FILTER_SANITIZE_STRING); - sessionUpdated(); -} -if (isset($_REQUEST['time'])) { - $_SESSION['time'] = filter_var($_REQUEST['time'], FILTER_SANITIZE_STRING); - sessionUpdated(); -} if (isset($_REQUEST['geolocate']) && $_REQUEST['geolocate'] != "Enter co-ordinates or address here") { $geocoded = false; if (isset($_REQUEST['lat']) && isset($_REQUEST['lon'])) { @@ -70,7 +62,7 @@ //debug(print_r($_SESSION, true) , "session"); function current_time() { - return ($_SESSION['time'] ? $_SESSION['time'] : date("H:i:s")); + return ($_REQUEST['time'] ? $_REQUEST['time'] : date("H:i:s")); } ?> --- a/include/common-template.inc.php +++ b/include/common-template.inc.php @@ -212,9 +212,37 @@ } echo "\n"; } - +function timeSettings() { + global $service_periods; +echo '
+

Change Time (' . (isset($_REQUEST['time']) ? $_REQUEST['time'] : "Current Time,") . ' ' . ucwords(service_period()) . ')...

+
+ + + + +
+
+ + + Current Time? +
+
+ + + +
+ + +
+
'; +} function placeSettings() { - global $service_periods; + $geoerror = false; $geoerror = !isset($_SESSION['lat']) || !isset($_SESSION['lat']) || $_SESSION['lat'] == "" || $_SESSION['lon'] == ""; --- a/include/common-transit.inc.php +++ b/include/common-transit.inc.php @@ -26,8 +26,8 @@ } function service_period($date = "") { - if (isset($_SESSION['service_period'])) - return $_SESSION['service_period']; + if (isset($_REQUEST['service_period'])) + return $_REQUEST['service_period']; $override = getServiceOverride($date); if ($override['service_id']) { return service_period_day ($override['service_id']); --- a/include/db/route-dao.inc.php +++ b/include/db/route-dao.inc.php @@ -46,11 +46,11 @@ function getRouteHeadsigns($routeID) { global $conn; - $query = "select stops.stop_name, direction_id,max(service_id) as service_id, count(*) + $query = "select stops.stop_name, trip_headsign, direction_id,max(service_id) as service_id, count(*) from routes join trips on trips.route_id = routes.route_id join stop_times on stop_times.trip_id = trips.trip_id join stops on stop_times.stop_id = stops.stop_id where trips.route_id = :routeID -and stop_times.stop_sequence = 1 group by stops.stop_name, direction_id having count(*) > 2"; +and stop_times.stop_sequence = 1 group by stops.stop_name, trip_headsign, direction_id having count(*) > 2"; debug($query, "database"); $query = $conn->prepare($query); $query->bindParam(":routeID", $routeID); @@ -260,25 +260,24 @@ $service_ids = service_ids($service_period); $sidA = $service_ids[0]; $sidB = $service_ids[1]; + global $conn; $query = "SELECT DISTINCT service_id,trips.route_id,route_short_name,route_long_name FROM stop_times join trips on trips.trip_id = stop_times.trip_id join routes on trips.route_id = routes.route_id join stops on stops.stop_id = stop_times.stop_id -WHERE zone_id LIKE ':suburb AND (service_id=:service_periodA OR service_id=:service_periodB) +WHERE stop_desc LIKE :suburb AND (service_id=:service_periodA OR service_id=:service_periodB) ORDER BY route_short_name"; debug($query, "database"); $query = $conn->prepare($query); $query->bindParam(":service_periodA", $sidA); $query->bindParam(":service_periodB", $sidB); - $query->bindParam(":service_period", $service_period); - $suburb = "%" . $suburb . ";%"; + $suburb = "%Suburb: %" . $suburb . "%"; $query->bindParam(":suburb", $suburb); $query->execute(); - if (!$query) { - databaseError($conn->errorInfo()); - return Array(); - } + + databaseError($conn->errorInfo()); + return $query->fetchAll(); } --- a/routeList.php +++ b/routeList.php @@ -18,6 +18,7 @@ include ('include/common.inc.php'); function navbar() { + echo '
'; +} + +function displayRoutes($routes) { + global $nearby; + echo ' '; -} else if (isset($nearby) || isset($suburb)) { - $routes = Array(); +} else if (isset($suburb)) { + if ($suburb) { include_header($suburb . " - " . ucwords(service_period()), "routeList"); navbar(); - timePlaceSettings(); + timeSettings(); trackEvent("Route Lists", "Routes By Suburb", $suburb); - $routes = getRoutesBySuburb($suburb); + displayRoutes(getRoutesBySuburb($suburb)); } - if (isset($nearby)) { - include_header("Routes Nearby", "routeList", true, true); - trackEvent("Route Lists", "Routes Nearby", $_SESSION['lat'] . "," . $_SESSION['lon']); - navbar(); - placeSettings(); - if (!isset($_SESSION['lat']) || !isset($_SESSION['lat']) || $_SESSION['lat'] == "" || $_SESSION['lon'] == "") { - include_footer(); - die(); - } - $routes = getRoutesNearby($_SESSION['lat'], $_SESSION['lon']); +} else if (isset($nearby)) { + $routes = Array(); + include_header("Routes Nearby", "routeList", true, true); + trackEvent("Route Lists", "Routes Nearby", $_SESSION['lat'] . "," . $_SESSION['lon']); + navbar(); + placeSettings(); + if (!isset($_SESSION['lat']) || !isset($_SESSION['lat']) || $_SESSION['lat'] == "" || $_SESSION['lon'] == "") { + include_footer(); + die(); } - echo '