if ($loc->name != null || $loc->name != "") { echo "<b>" . $loc->name . "</b><br/>"; } if ($loc->phone != null || $loc->phone != "") { echo " (" . $loc->phone . ")<br/>"; } echo $loc->getAddressString() . "\n<br/><br/>"; echo "<table>\n<tr>\n<td>\n"; echo "<table>\n<tr>\n<td><b>The Three Closest Stations</b></td>\n</tr>\n</table>\n"; echo "</td>\n</tr>\n<tr>\n<td>\n"; echo "<table border=\"1\">\n<thead>\n<tr>\n<td> <b>Show</b> </td>\n<td> <b>Station Name</b></td>\n<td> <b>Subway Lines</b></td>\n</tr>\n</thead>\n"; echo "<tbody>\n"; // display each station foreach ($stations as $station) { echo "<tr>\n"; printStation($station->marker); echo "</tr>\n"; } echo "</tbody>\n</table>\n"; echo "</td>\n</tr>\n</table>\n"; echo "<br/>\n<br/>\n"; $l = $_GET['l']; echo "Directions: [<a href=\"javascript:void(0)\" onclick=\"return _gd('to', '{$l}')\">To Here</a>] [<a href=\"javascript:void(0)\" onclick=\"return _gd('from', '{$l}')\">From Here</a>]\n"; } else { echo "Sorry. Address could not be found. Make sure that it is a valid postal address, not a vanity address.<br/>\n"; } } } else { if ($type == 'dir' || $type == 'dir_alt') { if (count($starts) == 1 && count($ends) == 1) { echo "Start Address:<br/>\n";
echo "</td>\n"; echo "</tr>\n"; $num++; } // list alternate end stations $end_stations = findNearestStations2($ends[0]); $end_station_marker = $path_array[count($path_array) - 1]->m1; echo "<tr>\n<td colspan=\"4\"><b>End Station Choices</b></td>\n</tr>\n"; echo "<tr>\n<td> <b>Show</b> </td>\n"; echo "<td><b>Station Name</b></td>\n"; echo "<td><b>Subway Lines</b></td>\n</tr>\n"; $num = 1; foreach ($end_stations as $station) { $station_marker = $station->marker; echo "<tr>\n"; printStation($station_marker); echo "<td>\n"; if ($end_station_marker->id == $station_marker->id) { echo "<input type=\"radio\" name=\"esta\" value=\"{$station_marker->id}\" checked/>\n"; } else { echo "<input type=\"radio\" name=\"esta\" value=\"{$station_marker->id}\" />\n"; } echo "</td>\n</tr>\n"; $num++; } echo "</tbody>\n</table>\n"; // geocoder leaves out intersections! we have to fill in with the query here correctHiddenValue($start_loc, $saddr, "saddr"); // geocoder leaves out intersections! we have to fill in with the query here correctHiddenValue($end_loc, $daddr, "daddr"); echo "<input type=\"hidden\" name=\"type\" value=\"dir\" />\n";
/** Displays the station choices for choosing alternate stations when using direction finding. @param $url<String> the URL for the form @param $start_location<Location> the starting point for the search @param $end_location<Location> the ending point for the search @param $path_array[]<Segment> the path found in the original search */ function displayStationChoices($url, $start_location, $end_location, $path_array) { $debug = false; if ($debug) { echo $start_location->desc . " to " . $end_location->desc . "<br/>"; } echo "<form id=\"form_pick\" action=\"{$url}\" method=\"get\">\n"; // list alternate stations echo "<table border=\"1\">\n<tbody>\n<tr>\n<td colspan=\"4\"><b>Start Station Choices</b></td>\n</tr>\n<tr>\n<td> <b>Show</b> </td>\n<td><b>Station Name</b></td>\n<td><b>Subway Lines</b></td>\n</tr>\n"; $num = 1; // grab the stations $start_stations = findNearestStations2($start_location); $start_station_marker = $path_array[0]->m2; if ($debug) { echo "start_station_marker->id = " . $start_station_marker->id . "<br/>"; } foreach ($start_stations as $station) { $station_marker = $station->marker; echo "<tr>\n"; printStation($station_marker); echo "<td>\n"; if ($start_station_marker->id == $station_marker->id) { echo "<input type=\"radio\" name=\"start\" value=\"{$station_marker->id}\" checked/>\n"; } else { echo "<input type=\"radio\" name=\"start\" value=\"{$station_marker->id}\" />\n"; } echo "</td>\n"; echo "</tr>\n"; $num++; } // list alternate end stations $end_stations = findNearestStations2($end_location); $end_station_marker = $path_array[count($path_array) - 1]->m1; if ($debug) { echo "end_station_marker->id = " . $end_station_marker->id . "<br/>"; } echo "<tr>\n<td colspan=\"4\"><b>End Station Choices</b></td>\n</tr>\n"; echo "<tr>\n<td> <b>Show</b> </td>\n"; echo "<td><b>Station Name</b></td>\n"; echo "<td><b>Subway Lines</b></td>\n</tr>\n"; $num = 1; foreach ($end_stations as $station) { $station_marker = $station->marker; echo "<tr>\n"; printStation($station_marker); echo "<td>\n"; if ($end_station_marker->id == $station_marker->id) { echo "<input type=\"radio\" name=\"end\" value=\"{$station_marker->id}\" checked/>\n"; } else { echo "<input type=\"radio\" name=\"end\" value=\"{$station_marker->id}\" />\n"; } echo "</td>\n</tr>\n"; $num++; } echo "</tbody>\n</table>\n"; // geocoder leaves out intersections! we have to fill in with the query here //correctHiddenValue($start_loc, $saddr, "saddr"); // geocoder leaves out intersections! we have to fill in with the query here //correctHiddenValue($end_loc, $daddr, "daddr"); echo "<input type=\"hidden\" name=\"type\" value=\"dir_alt\" />\n"; echo "<input type=\"hidden\" name=\"saddr\" value=\"" . $start_location->getAddressString() . "\" />\n"; echo "<input type=\"hidden\" name=\"daddr\" value=\"" . $end_location->getAddressString() . "\" />\n"; echo "<br/>\n"; echo "<input type=\"image\" name=\"submit\" src=\"images/usebutton.png\">\n"; echo "</form><br/>\n"; }