Add analytics
[bus.git] / busui / stop.php
blob:a/busui/stop.php -> blob:b/busui/stop.php
<?php <?php
include('common.inc.php'); include('common.inc.php');
$url = $APIurl."/json/stop?stop_id=".$_REQUEST['stopid']; $url = $APIurl."/json/stop?stop_id=".$_REQUEST['stopid'];
$stop = json_decode(getPage($url)); $stop = json_decode(getPage($url));
   
include_header($stop[1]); include_header($stop[1],"stop");
  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_stop');
  // Set a property
  $event->set('stop_id',$_REQUEST['stopid']);
  // Track the event
  $owa->trackEvent($event);
  }
timePlaceSettings(); timePlaceSettings();
echo '<div data-role="content" class="ui-content" role="main"><p>'.staticmap(Array(0 => Array($stop[2],$stop[3]))).'</p>'; echo '<div data-role="content" class="ui-content" role="main"><p>'.staticmap(Array(0 => Array($stop[2],$stop[3]))).'</p>';
echo ' <ul data-role="listview" data-inset="true">'; echo ' <ul data-role="listview" data-inset="true">';
$url = $APIurl."/json/stoptrips?stop=".$_REQUEST['stopid']."&time=".midnight_seconds()."&service_period=".service_period(); $url = $APIurl."/json/stoptrips?stop=".$_REQUEST['stopid']."&time=".midnight_seconds()."&service_period=".service_period();
$trips = json_decode(getPage($url)); $trips = json_decode(getPage($url));
debug(print_r($trips,true)); debug(print_r($trips,true));
foreach ($trips as $row) foreach ($trips as $row)
{ {
echo '<li>'; echo '<li>';
echo '<h3><a href="trip.php?stopid='.$_REQUEST['stopid'].'&tripid='.$row[1][0].'">'.$row[1][1]; echo '<h3><a href="trip.php?stopid='.$_REQUEST['stopid'].'&tripid='.$row[1][0].'">'.$row[1][1];
echo '<br><small>Via: '.viaPointNames($row[1][0],$_REQUEST['stopid']).'</small> </a></h3>'; echo '<br><small>Via: '.viaPointNames($row[1][0],$_REQUEST['stopid']).'</small> </a></h3>';
echo '<p class="ui-li-aside"><strong>'.midnight_seconds_to_time($row[0]).'</strong></p>'; echo '<p class="ui-li-aside"><strong>'.midnight_seconds_to_time($row[0]).'</strong></p>';
echo '</li>'; echo '</li>';
} }
if (sizeof($trips) == 0) echo "<li> <center>No trips in the near future.</center> </li>"; if (sizeof($trips) == 0) echo "<li> <center>No trips in the near future.</center> </li>";
echo '</ul></div>'; echo '</ul></div>';
include_footer(); include_footer();
?> ?>