From 53aebeb85f95d71f5034238b49b97e1a11ae6699 Mon Sep 17 00:00:00 2001 From: Pavel T Date: Sat, 15 Dec 2018 21:04:51 +0200 Subject: [PATCH] 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 --- build/portal/html/plot.php | 24 +++++++++++++++++-- .../portal/html/templates/default/flights.tpl | 4 ++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/build/portal/html/plot.php b/build/portal/html/plot.php index 1ef4ba8..1b6158a 100644 --- a/build/portal/html/plot.php +++ b/build/portal/html/plot.php @@ -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"; } diff --git a/build/portal/html/templates/default/flights.tpl b/build/portal/html/templates/default/flights.tpl index b43dae0..5279ce5 100644 --- a/build/portal/html/templates/default/flights.tpl +++ b/build/portal/html/templates/default/flights.tpl @@ -34,8 +34,8 @@ {foreach page:flights as flight} {flight->flight} - {flight->lastSeen} - {flight->firstSeen} + {flight->lastSeen} + {flight->firstSeen} FlightAware | Planefinder |