--- a/stopList.php
+++ b/stopList.php
@@ -22,10 +22,9 @@
echo '
';
@@ -50,12 +49,7 @@
echo '';
} else {
// Timing Points / All stops
- if (isset($allstops)) {
- $listType = 'allstops=yes';
- $stops = getStops();
- include_header("All Stops", "stopList");
- navbar();
- } else if (isset($nearby)) {
+ if (isset($nearby)) {
$listType = 'nearby=yes';
include_header("Nearby Stops", "stopList", true, true);
trackEvent("Stop Lists", "Stops Nearby", $_SESSION['lat'] . "," . $_SESSION['lon']);
@@ -86,10 +80,11 @@
navbar();
trackEvent("Stop Lists", "Stops By Suburb", $suburb);
} else {
- $stops = getStops(true, $firstLetter);
- include_header("Timing Points / Major Stops", "stopList");
+ $listType = 'allstops=yes';
+ $stops = getStops($firstLetter);
+ include_header("Stops by Name", "stopList");
navbar();
- }
+ }
echo ' ';
if (!isset($firstLetter) && !isset($suburb) && !isset($nearby)) {
foreach (range('A', 'Z') as $letter) {
@@ -99,19 +94,19 @@
//var_dump($stops);
$stopsGrouped = Array();
foreach ($stops as $key => $stop) {
- if ((trim(preg_replace("/\(Platform.*/", "", $stops[$key]["stop_name"])) != trim(preg_replace("/\(Platform.*/", "", $stops[$key + 1]["stop_name"]))) || $key + 1 >= sizeof($stops)) {
+ if (stopCompare($stops[$key]["stop_name"])
+ != stopCompare($stops[$key + 1]["stop_name"])
+ || $key + 1 >= sizeof($stops)) {
if (sizeof($stopsGrouped) > 0) {
// print and empty grouped stops
// subsequent duplicates
$stopsGrouped["stop_ids"][] = $stop['stop_id'];
echo '- ';
- if (!startsWith($stopsGrouped['stop_codes'][0], "Wj"))
- echo '';
- echo '';
+ echo '';
if (isset($_SESSION['lat']) && isset($_SESSION['lon'])) {
echo '' . distance($stop['stop_lat'], $stop['stop_lon'], $_SESSION['lat'], $_SESSION['lon'], true) . 'm away';
}
- echo bracketsMeanNewLine(trim(preg_replace("/\(Platform.*/", "", $stop['stop_name'])) . '(' . sizeof($stopsGrouped["stop_ids"]) . ' stops)');
+ echo stopGroupTitle($stop['stop_name'],$stop['stop_desc']) . '
' . sizeof($stopsGrouped["stop_ids"]) . ' stops';
echo " \n";
flush();
@ob_flush();
@@ -119,20 +114,18 @@
} else {
// just a normal stop
echo '- ';
- if (!startsWith($stop['stop_code'], "Wj"))
- echo '';
- echo '';
+ echo '';
if (isset($_SESSION['lat']) && isset($_SESSION['lon'])) {
echo '' . distance($stop['stop_lat'], $stop['stop_lon'], $_SESSION['lat'], $_SESSION['lon'], true) . 'm away';
}
- echo bracketsMeanNewLine($stop['stop_name']);
+ echo $stop['stop_name'];
echo "
\n";
flush();
@ob_flush();
}
} else {
// this is a duplicated line item
- if ($key - 1 <= 0 || (trim(preg_replace("/\(Platform.*/", "", $stops[$key]['stop_name'])) != trim(preg_replace("/\(Platform.*/", "", $stops[$key - 1]['stop_name'])))) {
+ if ($key - 1 <= 0 || stopCompare($stops[$key]['stop_name']) != stopCompare($stops[$key - 1]['stop_name'])) {
// first duplicate
$stopsGrouped = Array(
"name" => trim(preg_replace("/\(Platform.*/", "", $stop['stop_name'])),
@@ -146,7 +139,7 @@
} else {
// subsequent duplicates
$stopsGrouped["stop_ids"][] = $stop['stop_id'];
- ;
+
}
}
}