Merge pull request #481 from paveltar/pav_dev

Added ability to view first and last flights in Flights section
pull/503/head
Joe Prochazka 2019-03-09 05:06:29 -05:00 zatwierdzone przez GitHub
commit 6894c25e1d
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
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> |