From: Alexander Sadleir Date: Thu, 24 Nov 2011 13:32:19 +0000 Subject: Add service alert viewer for all users X-Git-Url: http://maxious.lambdacomplex.org/git/?p=busui.git&a=commitdiff&h=ac5bf725c99dc76775d7debaa0e89d340392fe0a --- Add service alert viewer for all users --- --- a/aws/busuidb.sh +++ b/aws/busuidb.sh @@ -11,4 +11,7 @@ #psql -d transitdata -c "GRANT SELECT,INSERT ON TABLE myway_observations,myway_routes,myway_stops,myway_timingdeltas TO transitdata;" #psql -d transitdata -c "GRANT SELECT,INSERT,UPDATE ON TABLE myway_routes,myway_stops TO transitdata;" ##psql -d transitdata -c "GRANT SELECT ON ALL TABLES IN SCHEMA public TO transitdata;" +## INSERT INTO geometry_columns(f_table_catalog, f_table_schema, f_table_name, f_geometry_column, coord_dimension, srid, "type") +##SELECT '', 'public', 'shapes', 'shape_pt', ST_CoordDim(shape_pt), ST_SRID(shape_pt), GeometryType(shape_pt) +##FROM shapes LIMIT 1; php /var/www/updatedb.php --- a/include/db/trip-dao.inc.php +++ b/include/db/trip-dao.inc.php @@ -33,17 +33,31 @@ } return $query->fetch(PDO :: FETCH_ASSOC); } - -function getTripShape($tripID) { - // todo, use shapes table if shape_id specified +function getTripStops($tripID) { global $conn; - $query = "SELECT ST_AsKML(ST_MakeLine(geometry(a.position))) as the_route -FROM (SELECT position, + $query = "SELECT stop_id, stop_name, ST_AsKML(position) as positionkml, stop_sequence, trips.trip_id FROM stop_times join trips on trips.trip_id = stop_times.trip_id join stops on stops.stop_id = stop_times.stop_id -WHERE trips.trip_id = :tripID ORDER BY stop_sequence) as a group by a.trip_id"; +WHERE trips.trip_id = :tripID ORDER BY stop_sequence"; + debug($query, "database"); + $query = $conn->prepare($query); + $query->bindParam(":tripID", $tripID); + $query->execute(); + if (!$query) { + databaseError($conn->errorInfo()); + return Array(); + } + return $query->fetchColumn(0); +} +function getTripShape($tripID) { + // todo, use shapes table if shape_id specified + global $conn; + $query = "SELECT ST_AsKML(ST_MakeLine(geometry(a.shape_pt))) as the_route +FROM (SELECT shapes.shape_id,shape_pt from shapes +inner join trips on shapes.shape_id = trips.shape_id +WHERE trips.trip_id = :tripID ORDER BY shape_pt_sequence) as a group by a.shape_id"; debug($query, "database"); $query = $conn->prepare($query); $query->bindParam(":tripID", $tripID); --- a/servicealerts/index.php +++ b/servicealerts/index.php @@ -2,12 +2,17 @@ include ('../include/common.inc.php'); include_header("Service Alerts", "index"); +echo ''; + ?> +Active and Future Alerts: + + '; + } + ?> +
{$alert['header']}" . substr($alert['description'], 0, 999) . 'View
+{$alert['header']} +

From ".date("c",$alert['start'])." to ".date("c",$alert['end'])."

+{$alert['description']}
+Source: {$alert['url']}
"; + echo "Informed Entities for ID {$_REQUEST['view']}:"; + echo ''; + foreach (getInformedAlerts($_REQUEST['view'], "", "") as $informed) { + echo "'; + } + echo '
{$informed['informed_class']}{$informed['informed_id']}{$informed['informed_action']}" . '
'; +} +include_footer(); +?>