'; echo $stopLinks; if (sizeof($stops) > 0) { + trackEvent("View Stops","View Combined Stops", $stop[1], $stop[0]); + echo '

' . staticmap($stopPositions) . '

'; } else { + trackEvent("View Stops","View Single Stop", $stop[1], $stop[0]); echo '

' . staticmap(Array( 0 => Array( $stop[2], --- a/stopList.php +++ b/stopList.php @@ -48,7 +48,7 @@ else if ($_REQUEST['nearby']) { $listType = 'nearby=yes'; $url = $APIurl . "/json/neareststops?lat={$_SESSION['lat']}&lon={$_SESSION['lon']}&limit=15"; - include_header("Nearby Stops", "stopList"); + include_header("Nearby Stops", "stopList", true, true); navbar(); timePlaceSettings(true); if (!isset($_SESSION['lat']) || !isset($_SESSION['lat']) || $_SESSION['lat'] == "" || $_SESSION['lon'] == "") { @@ -62,6 +62,7 @@ $url = $APIurl . "/json/stopzonesearch?q=" . $suburb; include_header("Stops in " . ucwords($suburb) , "stopList"); navbar(); + trackEvent("Stop Lists","Stops By Suburb", $suburb); } else { $url = $APIurl . "/json/timingpoints"; --- a/trip.php +++ b/trip.php @@ -24,6 +24,7 @@ $routetrips = json_decode(getPage($url)); } include_header("Stops on " . $trips[1]->route_short_name . ' ' . $trips[1]->route_long_name, "trip"); +trackEvent("Route/Trip View","View Route", $trips[1]->route_short_name . ' ' . $trips[1]->route_long_name, $trips[1]->route_id); $url = $APIurl . "/json/tripstoptimes?trip=" . $tripid; $json = json_decode(getPage($url)); $stops = $json[0]; @@ -40,7 +41,7 @@ echo '' . midnight_seconds_to_time($othertrip[0]) . ' '; } echo '

Other directions/timing periods:

'; -$url = $APIurl . "/json/routesearch?routeshortname=" . $trips[1]->route_short_name; +$url = $APIurl . "/json/routesearch?routeshortname=" . rawurlencode($trips[1]->route_short_name); $json = json_decode(getPage($url)); foreach ($json as $row) { if ($row[0] != $routeid) echo '' . $row[2] . ' (' . ucwords($row[3]) . ') '; --- a/tripPlanner.php +++ b/tripPlanner.php @@ -11,6 +11,7 @@ } function tripPlanForm($errorMessage = "") { + global $date, $time, $from, $to; echo "$errorMessage"; echo '
@@ -92,7 +93,17 @@ } echo "" . staticmap($walkStepMarkers, 0, "icong", false) . "
\n"; foreach ($leg->steps->walkSteps as $stepNumber => $step) { - echo "Walking step " . ($stepNumber + 1) . " $step->absoluteDirection / $step->relativeDirection on $step->streetName for " . floor($step->distance) . " meters
\n"; + echo "Walking step " . ($stepNumber + 1) . ": "; + if ($step->relativeDirection == "CONTINUE") { + echo "Continue, "; + } else if ($step->relativeDirection) echo "Turn ".ucwords(strtolower(str_replace("_"," ",$step->relativeDirection))).", "; + echo "Go ".ucwords(strtolower($step->absoluteDirection))." on "; + if (strpos($step->streetName,"from") !== false && strpos($step->streetName,"way") !== false) { + echo "footpath"; + } else { + echo $step->streetName; + } + echo " for " . floor($step->distance) . " meters
\n"; } } } @@ -101,8 +112,14 @@ $fromPlace = (startsWith($from, "-") ? $from : geocode($from, false)); if ($toPlace == "" || $fromPlace == "") { $errorMessage = ""; - if ($toPlace === "") $errorMessage.= urlencode($to) . " not found.
\n"; - if ($fromPlace === "") $errorMessage.= urlencode($from) . " not found.
\n"; + if ($toPlace === "") { + $errorMessage.= urlencode($to) . " not found.
\n"; + trackEvent("Trip Planner","Geocoder Failed", $to); + } + if ($fromPlace === "") { + $errorMessage.= urlencode($from) . " not found.
\n"; + trackEvent("Trip Planner","Geocoder Failed", $from); + } tripPlanForm($errorMessage); } else { @@ -116,9 +133,12 @@ curl_setopt($ch, CURLOPT_TIMEOUT, 5); $page = curl_exec($ch); if (curl_errno($ch)) { - tripPlanForm("Trip planner temporarily unavailable: " . curl_errno($ch) . " " . curl_error($ch)); - } + tripPlanForm("Trip planner temporarily unavailable: " . curl_errno($ch) . " " . curl_error($ch) .(isDebug() ? $url : "")); + trackEvent("Trip Planner","Trip Planner Failed", $url); + } else { + trackEvent("Trip Planner","Plan Trip From", $from); + trackEvent("Trip Planner","Plan Trip To", $to); $tripplan = json_decode($page); debug(print_r($triplan, true)); echo "

From: {$tripplan->plan->from->name} To: {$tripplan->plan->to->name}

";