--- a/busui/tripPlanner.php +++ b/busui/tripPlanner.php @@ -1,14 +1,16 @@ $errorMessage"; + global $date,$time,$from,$to; + echo "$errorMessage"; echo '
@@ -86,17 +88,34 @@ } if ($_REQUEST['time']) { - $toPlace = (startsWith($_REQUEST['to'], "-") ? $_REQUEST['to'] : geocode(urlencode($_REQUEST['to']), false)); - $fromPlace = (startsWith($_REQUEST['from'], "-") ? $_REQUEST['from'] : geocode(urlencode($_REQUEST['from']), false)); + $toPlace = (startsWith($to, "-") ? $to : geocode($to, false)); + $fromPlace = (startsWith($from, "-") ? $from : geocode($from, false)); if ($toPlace == "" || $fromPlace == "") { $errorMessage = ""; if ($toPlace === "") - $errorMessage .= urlencode($_REQUEST['to']) . " not found.
\n"; + $errorMessage .= urlencode($to) . " not found.
\n"; if ($fromPlace === "") - $errorMessage .= urlencode($_REQUEST['from']) . " not found.
\n"; + $errorMessage .= urlencode($from) . " not found.
\n"; tripPlanForm($errorMessage); } else { - $url = "http://10.1.0.243:5080/opentripplanner-api-webapp/ws/plan?_dc=1290254798856&arriveBy=false&date=" . urlencode($_REQUEST['date']) . "&time=" . urlencode($_REQUEST['time']) . "&mode=TRANSIT%2CWALK&optimize=QUICK&maxWalkDistance=840&wheelchair=false&toPlace=$toPlace&fromPlace=$fromPlace&intermediatePlaces="; + if (isMetricsOn()) { +// Create a new Instance of the tracker +$owa = new owa_php($config); +// Set the ID of the site being tracked +$owa->setSiteId('bus.lambdacomplex.org'); +// Create a new event object +$event = $owa->makeEvent(); +// Set the Event Type, in this case a "video_play" +$event->setEventType('view_trip_plan'); +// Set a property +$event->set('from',$from); +$event->set('to',$to); +$event->set('time',$time); +$event->set('date',$date); +// Track the event +$owa->trackEvent($event); + } + $url = $otpAPIurl."ws/plan?date=" . urlencode($_REQUEST['date']) . "&time=" . urlencode($_REQUEST['time']) . "&mode=TRANSIT%2CWALK&optimize=QUICK&maxWalkDistance=840&wheelchair=false&toPlace=$toPlace&fromPlace=$fromPlace&intermediatePlaces="; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0);