Restrict displayed via points to shops/schools etc.
[busui.git] / stopList.php
blob:a/stopList.php -> blob:b/stopList.php
--- a/stopList.php
+++ b/stopList.php
@@ -36,8 +36,8 @@
     navbar();
     echo '  <ul data-role="listview" data-filter="true" data-inset="true" >';
     if (!isset($firstLetter)) {
-        foreach (range('A', 'Z') as $letter) {
-            echo "<li><a href=\"stopList.php?firstLetter=$letter&amp;bysuburbs=yes\">$letter...</a></li>\n";
+        foreach (range('A', 'Y') as $letter) { // no suburbs start with J, Q, U, V, X or Z
+            if ($letter != "J" && $letter != "Q" && $letter != "U" && $letter != "V" && $letter != "X") echo "<li><a href=\"stopList.php?firstLetter=$letter&amp;bysuburbs=yes\">$letter...</a></li>\n";
         }
     } else {
         foreach ($suburbs as $suburb) {
@@ -60,7 +60,7 @@
             die();
         }
         $stops = getNearbyStops($_SESSION['lat'], $_SESSION['lon'], 15);
-        echo '<span class="content-secondary">';
+        echo '<div class="content-secondary">';
         $stopPositions[] = Array(
             $_SESSION['lat'],
             $_SESSION['lon']
@@ -73,7 +73,7 @@
         }
         echo staticmap($stopPositions, true, true);
         placeSettings();
-        echo '</span><span class="content-primary">';
+        echo '</div><div class="content-primary">';
     } else if (isset($suburb)) {
         $stops = getStopsBySuburb($suburb);
         include_header("Stops in " . ucwords($suburb), "stopList");
@@ -81,28 +81,27 @@
         trackEvent("Stop Lists", "Stops By Suburb", $suburb);
     } else {
         $listType = 'allstops=yes';
-        $stops = getStops($firstLetter);
+        $stops = getStops((isset($firstLetter)? $firstLetter : ""));
         include_header("Stops by Name", "stopList");
         navbar();
     } 
     echo '  <ul data-role="listview" data-filter="true" data-inset="true" >';
-    if (!isset($firstLetter) && !isset($suburb) && !isset($nearby)) {
-        foreach (range('A', 'Z') as $letter) {
-            echo "<li><a href=\"stopList.php?firstLetter=$letter&amp;$listType\">$letter...</a></li>\n";
+    if (!isset($firstLetter) && !isset($suburb) && !isset($nearby)) { // all stops by letter
+        foreach (range('A', 'Y') as $letter) { // no streets start with X or Z
+            if ($letter != "X") echo "<li><a href=\"stopList.php?firstLetter=$letter&amp;$listType\">$letter...</a></li>\n";
         }
     } else {
         //var_dump($stops);
         $stopsGrouped = Array();
         foreach ($stops as $key => $stop) {
-            if (stopCompare($stops[$key]["stop_name"]) 
-                    != stopCompare($stops[$key + 1]["stop_name"])
-                    || $key + 1 >= sizeof($stops)) {
+            if ($key + 1 >= sizeof($stops) || 
+                    stopCompare($stops[$key]["stop_name"]) != stopCompare($stops[$key + 1]["stop_name"])) {
                 if (sizeof($stopsGrouped) > 0) {
                     // print and empty grouped stops
                     // subsequent duplicates
                     $stopsGrouped["stop_ids"][] = $stop['stop_id'];
                     echo '<li>';
-                    echo '<a href="stop.php?stopids=' . implode(",", $stopsGrouped['stop_ids']) . '">';
+                    echo '<a href="stop.php?stopids=' . implode(",", $stopsGrouped['stop_ids']) . '&stopcodes=' . implode(",", $stopsGrouped['stop_codes']) . '">';
                     if (isset($_SESSION['lat']) && isset($_SESSION['lon'])) {
                         echo '<span class="ui-li-count">' . distance($stop['stop_lat'], $stop['stop_lon'], $_SESSION['lat'], $_SESSION['lon'], true) . 'm away</span>';
                     }
@@ -145,8 +144,9 @@
         }
     }
     echo '</ul>';
-    if (isset($nearby))
-        echo '</span>';
+    if (isset($nearby)) {
+        echo '</div>';
+}
 }
 include_footer();
 ?>