Don't show letters in lists that don't have entries
[busui.git] / stopList.php
blob:a/stopList.php -> blob:b/stopList.php
--- a/stopList.php
+++ b/stopList.php
@@ -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,7 +81,7 @@
         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();
     } 
@@ -94,9 +94,8 @@
         //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
@@ -145,8 +144,9 @@
         }
     }
     echo '</ul>';
-    if (isset($nearby))
-        echo '</span>';
+    if (isset($nearby)) {
+        echo '</div>';
+}
 }
 include_footer();
 ?>