From: maxious Date: Sun, 29 Jan 2012 14:03:09 +0000 Subject: Show two directions and stops on routes/trips KML X-Git-Url: http://maxious.lambdacomplex.org/git/?p=busui.git&a=commitdiff&h=a729b72aef5530891eb99f659453e73fa5b5e5c0 --- Show two directions and stops on routes/trips KML Don't close include files else any trailing whitespace ends up in XML documents --- --- a/geo/route.kml.php +++ b/geo/route.kml.php @@ -1,31 +1,105 @@ '; echo ' - + + + '; + + + '; $route = getRoute($routeid); echo "\n\n"; +$_REQUEST['time'] = "12:00"; +$trip = getRouteNextTrip($routeid, 0); +$link = curPageURL() . "/../trip.php?routeid=" . htmlspecialchars($route["route_id"]. "&directionid=0&tripid=".$trip['trip_id']) ; +echo "" . $route['route_short_name'] . " Direction 0 "; +echo ''; +echo '' . $route['route_short_name'] . " Direction 0]]> "; +echo "#yellowLineYellowPoly"; -$link = curPageURL() . "/../trip.php?routeid=" . htmlspecialchars($route["route_id"]); -echo "" . $route['route_short_name'] . ""; -echo ''; -echo '' . $route['route_short_name'] . " " . $route['route_long_name'] . "]]> "; -echo "#yellowLineGreenPoly"; -$trip = getRouteNextTrip($routeid); echo getTripShape($trip['trip_id']); + echo "\n"; +$stops = Array(); +foreach (getTripStops($trip['trip_id']) as $stop) { + $stop['style'] = "#ylw-pushpin"; + $stops[$stop['stop_id']] = $stop; +} -echo "\n\n"; + +echo "\n\n"; +$trip = getRouteNextTrip($routeid, 1); +$link = curPageURL() . "/../trip.php?routeid=" . htmlspecialchars($route["route_id"]. "&directionid=1&tripid=".$trip['trip_id']) ; +echo "" . $route['route_short_name'] . " Direction 1 "; +echo ''; +echo '' . $route['route_short_name'] . " Direction 1]]> "; +echo "#blueLineBluePoly"; + +echo getTripShape($trip['trip_id']); + echo "\n"; +foreach (getTripStops($trip['trip_id']) as $stop) { + if (isset($stops[$stop['stop_id']])) { + $stop['style'] = "#grn-pushpin"; + } else { + $stop['style'] = "#blue-pushpin"; + } + $stops[$stop['stop_id']] = $stop; +} +foreach ($stops as $stop) { + echo "\n\n"; + $link = curPageURL() . '/../stop.php?stopid=' . htmlspecialchars($stop['stop_id']); + echo "" . htmlspecialchars($stop['stop_name']) . ""; + echo ''; + echo '' . htmlspecialchars($stop['stop_name']) . "]]> "; + echo "" . $stop['style'] . ""; + echo $stop['positionkml']; + echo "\n"; +} + +echo "\n"; ?> --- a/geo/stops.kml.php +++ b/geo/stops.kml.php @@ -1,6 +1,8 @@ "; + $description = 'View stop page
'; // Creates a Placemark and append it to the Document. $node = $dom->createElement('Placemark'); $placeNode = $docNode->appendChild($node); --- a/geo/trip.kml.php +++ b/geo/trip.kml.php @@ -1,10 +1,37 @@ '; echo ' + + +