Added ability to view first and last flights in Flights section, and ability to pass an index as a GET parameter to view specific flightpath

pull/481/head
Pavel T 2018-12-15 21:04:51 +02:00
rodzic 5ac8dc11c9
commit 53aebeb85f
2 zmienionych plików z 24 dodań i 4 usunięć

Wyświetl plik

@ -137,9 +137,29 @@
// Pass the number of seen paths which is equal to the last flight ID.
$pageData['pathsSeen'] = $pathsSeen;
if (count($flightPaths) > 0) {
$countFlightPaths = count($flightPaths);
if ($countFlightPaths > 0) {
$pageData['flightPathsAvailable'] = "TRUE";
$pageData['flightPaths'] = $flightPaths;
$selectedFlightPath = $flightPaths;
if (isset($_GET["index"])) {
switch ($_GET["index"]) {
case "first":
$selectedFlightPath = [$flightPaths[0]];
break;
case "last":
$selectedFlightPath = [$flightPaths[$countFlightPaths - 1]];
break;
default:
if (is_numeric($_GET["index"])) {
$selectedFlightPath = [$flightPaths[$_GET["index"]]];
}
break;
}
}
$pageData['flightPaths'] = $selectedFlightPath;
} else {
$pageData['flightPathsAvailable'] = "FALSE";
}

Wyświetl plik

@ -34,8 +34,8 @@
{foreach page:flights as flight}
<tr>
<td><a href="plot.php?flight={flight->flight}">{flight->flight}</a></td>
<td>{flight->lastSeen}</td>
<td>{flight->firstSeen}</td>
<td><a href="plot.php?flight={flight->flight}&index=last">{flight->lastSeen}</a></td>
<td><a href="plot.php?flight={flight->flight}&index=first">{flight->firstSeen}</a></td>
<td>
<a href="http://flightaware.com/live/flight/{flight->flight}" target="_blank">FlightAware</a> |
<a href="https://planefinder.net/flight/{flight->flight}" target="_blank">Planefinder</a> |