More between points work + mobile UI work:
[bus.git] / busui / stop.php
blob:a/busui/stop.php -> blob:b/busui/stop.php
--- a/busui/stop.php
+++ b/busui/stop.php
@@ -4,14 +4,22 @@
 $stop = json_decode(getPage($url));
 
 include_header("Trips passing ".$stop[1]);
-echo '  <ul data-role="listview" >';
-$url = $APIurl."/json/stoptrips?stop=".$_REQUEST['stopid']."&time=".midnight_seconds();
-$page = getPage($url);
-foreach (json_decode($page) as $row)
+echo '<div data-role="content" class="ui-content" role="main"><p>'.staticmap(Array(0 => Array($stop[2],$stop[3]))).'</p>';
+// change date/time/service_period
+echo '  <ul data-role="listview"  data-inset="true">';
+$url = $APIurl."/json/stoptrips?stop=".$_REQUEST['stopid']."&time=".midnight_seconds()."&service_period=".service_period();
+$trips = json_decode(getPage($url));
+debug(print_r($trips,true));
+foreach ($trips as $row)
 {
-if ($row[1][2] === service_period()) echo  '<li>'.midnight_seconds_to_time($row[0]).' <a href="trip.php?stopid='.$_REQUEST['stopid'].'&tripid='.$row[1][0].'">'.$row[1][1].'</a></li>';        
+echo  '<li>';
+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 '<p class="ui-li-aside"><strong>'.midnight_seconds_to_time($row[0]).'</strong></p>';
+echo '</li>';  
 }
-echo '</ul>';
+if (sizeof($trips) == 0) echo "<li> <center>No trips in the near future.</center> </li>";
+echo '</ul></div>';
 include_footer();
 ?>