--- a/busui/stopList.php
+++ b/busui/stopList.php
@@ -1,33 +1,59 @@
';
+echo'
+
+ ';
+// By suburb
+if (isset($_REQUEST['suburbs'])) {
+ echo ' ';
+ foreach ($suburbs as $suburb) {
+ echo '- '.$suburb.'
';
+ }
+echo '
';
+} else {
+// Timing Points / All stops
+ echo ' Go to letter: ';
+foreach(range('A','Z') as $letter)
+{
+ echo "
$letter ";
+}
+echo "
+ ";
+echo ' ';
$url = $APIurl."/json/timingpoints";
if ($_REQUEST['allstops']) $url = $APIurl."/json/stops";
-if ($_REQUEST['lat'] && $_REQUEST['lon']) $url = $APIurl."/json/neareststops?lat={$_REQUEST['lat']}&lon={$_REQUEST['lon']}&limit=15";
+if ($_REQUEST['nearby']) $url = $APIurl."/json/neareststops?lat={$_REQUEST['lat']}&lon={$_REQUEST['lon']}&limit=15";
+if ($_REQUEST['suburb']) $url = $APIurl."/json/stopzonesearch?q={$_REQUEST['suburb']}";
$contents = json_decode(getPage($url));
+debug(print_r($contents,true));
foreach ($contents as $key => $row) {
$stopName[$key] = $row[1];
}
-// Sort the data with volume descending, edition ascending
-// Add $data as the last parameter, to sort by the common key
+// Sort the stops by name
array_multisort($stopName, SORT_ASC, $contents);
+$firstletter = "";
foreach ($contents as $row)
{
-
- echo '- '.$row[1].'
';
+ if (substr($row[1],0,1) != $firstletter){
+ echo "";
+ $firstletter = substr($row[1],0,1);
+ }
+ echo '- '.bracketsMeanNewLine($row[1]).'
';
}
echo '
';
-echo'
-
-
-
- ';
+}
include_footer();
?>