?'); } else { w('' . $text . ''); } } } function candidate(...$c) { foreach ($c as &$i) { if (!is_null($i)) { return $i; } } } enum SeatType: String { case Window = "Window"; case Middle = "Middle"; case Aisle = "Aisle"; case Other = "Other"; } enum EmbarkType: String { case Bridge = "Bridge"; case Stairs = "Stairs"; case Other = "Other"; } class FromDestBlock { public $chock = null; public $ad = null; public $ad_iata = null; public $bay = null; public $taxi = null; public $rwy = null; public $proc = null; public $trans = null; public $metar = null; public $atis = null; public function __construct($chock, $ad, $ad_iata, $bay, $taxi, $rwy, $proc, $trans, $metar, $atis) { $this->chock = $chock; $this->ad = $ad; $this->ad_iata = $ad_iata; $this->bay = $bay; $this->taxi = $taxi; $this->rwy = $rwy; $this->proc = $proc; $this->trans = $trans; $this->metar = $metar; $this->atis = $atis; } public static function parse($row, $key_chock, $key_prefix) { return new FromDestBlock( $row[$key_chock], $row[$key_prefix . 'ad'], $row[$key_prefix . 'ad_iata'], $row[$key_prefix . 'bay'], $row[$key_prefix . 'taxi'], $row[$key_prefix . 'rwy'], $row[$key_prefix . 'proc'], $row[$key_prefix . 'proc_trans'], $row[$key_prefix . 'metar'], $row[$key_prefix . 'atis'], ); } function p_ad() { w($this->ad . '
'); if (!is_null($this->metar)) { w('
METAR' . $this->metar . '
'); } if (!is_null($this->atis)) { w('
ATIS' . $this->atis . '
'); } } function p_taxi() { w(''); if (!is_null($this->bay)) { w('Bay ' . $this->bay . w('
')); } if (!is_null($this->chock)) w('Chock: ' . (strval($this->chock) . 'Z
')); if (!is_null($this->taxi)) { w('
Taxi' . $this->taxi . '
'); } w(''); } function p_rwy() { } } class Aircraft { public $type = null; public $reg = null; public $link = null; public function __construct($type, $reg, $link) { $this->type = $type; $this->reg = $reg; // $this->link = candidate($link, 'https://www.flightradar24.com/data/aircraft/' . strtolower($reg)); $this->link = $link; } public static function parse($row) { return new Aircraft($row['aircraft'], $row['registration'], $row['aircraft_link'] ); } function p() { w(''); w($this->type . '
'); a($this->link, $this->reg); w(''); } } class Flight { public $date = null; // Flight public $airline = null; public $flight_no = null; public $fr24_link = null; public $fa_link = null; // Aircraft public $aircraft = null; // From public $clearance = null; public $from = null; // Dest public $dest = null; public $approach_via = null; // Seat public $cabin = null; public $seat = null; public $seat_type = null; public $embark = null; public $disembark = null; // Enroute public $duration = null; public $distance = null; public $route = null; public $crz_alt = null; public $crz_speed = null; // Performance public $takeoff_weight = null; public $pax = null; public $payload = null; public $fuel = null; public $fuel_trip = null; public $v1 = null; public $vr = null; public $v2 = null; public $vref = null; // MISC public $notes = null; } class DB extends SQLite3 { private const STMT_SEL_ALL = " select datetime, airline, flight_no, fr24_link, fa_link, aircraft, registration, aircraft_link, from_ad, from_ad_iata, from_atis, from_metar, off_chock, from_bay, from_taxi, from_rwy, from_proc, from_proc_trans, dest_ad, dest_ad_iata, dest_atis, dest_metar, on_chock, dest_bay, dest_taxi, dest_rwy, dest_proc, dest_proc_trans, dest_approach, dest_approach_via, cabin, seat, seat_type, embark, disembark, duration, distance, route, clearance, crz_alt, crz_speed, takeoff_weight, pax, payload, fuel, fuel_trip, v1, vr, v2, vref, notes from flights order by datetime asc;"; private $stmt_sel_all; private const STMT_SORT_AIRCRAFT = " SELECT aircraft t, COUNT(*) c FROM flights WHERE aircraft NOT LIKE '%?%' GROUP BY aircraft ORDER BY COUNT(*) DESC;"; private $stmt_sort_aircraft; private const STMT_COUNT = " SELECT COUNT(*) n, SUM(distance) d, SUM(duration) t FROM flights;"; private $stmt_count; function __construct() { $this->open('./flights.sqlite', SQLITE3_OPEN_READONLY); $this->stmt_sel_all = $this->prepare(self::STMT_SEL_ALL); $this->stmt_sort_aircraft = $this->prepare(self::STMT_SORT_AIRCRAFT); $this->stmt_count = $this->prepare(self::STMT_COUNT); } function map($row) { $r = new Flight(); $r->date = $row['datetime']; $r->airline = $row['airline']; $r->flight_no = $row['flight_no']; $r->fr24_link = $row['fr24_link']; $r->fa_link = $row['fa_link']; $r->aircraft = Aircraft::parse($row); $r->clearance = $row['clearance']; $r->from = FromDestBlock::parse($row, 'off_chock', 'from_'); $r->dest = FromDestBlock::parse($row, 'on_chock', 'dest_'); $r->approach = $row['dest_approach']; $r->approach_via = $row['dest_approach_via']; $r->cabin = $row['cabin']; $r->seat = $row['seat']; if (is_null($row['seat_type'])) { $r->seat_type = null; } else { switch ($row['seat_type']) { case "WINDOW": $r->seat_type = SeatType::Window; break; case "MIDDLE": $r->seat_type = SeatType::Middle; break; case "AISLE": $r->seat_type = SeatType::Aisle; break; default: $r->seat_type = SeatType::Other; break; } } if (is_null($row['embark'])) { $r->embark = null; } else { switch ($row['embark']) { case "BRIDGE": $r->embark = EmbarkType::Bridge; break; case "STAIRS": $r->embark = EmbarkType::Stairs; break; default: $r->embark = EmbarkType::Other; break; } } if (is_null($row['disembark'])) { $r->disembark = null; } else { switch ($row['disembark']) { case "BRIDGE": $r->disembark = EmbarkType::Bridge; break; case "STAIRS": $r->disembark = EmbarkType::Stairs; break; default: $r->disembark = EmbarkType::Other; break; } } $r->duration = $row['duration']; $r->distance = $row['distance']; $r->route = $row['route']; $r->crz_alt = $row['crz_alt']; $r->crz_speed = $row['crz_speed']; $r->takeoff_weight = $row['takeoff_weight']; $r->pax = $row['pax']; $r->payload = $row['payload']; $r->fuel = $row['fuel']; $r->fuel_trip = $row['fuel_trip']; $r->v1 = $row['v1']; $r->vr = $row['vr']; $r->v2 = $row['v2']; $r->vref = $row['vref']; $r->notes = $row['notes']; return $r; } function getAll() { $res = $this->stmt_sel_all->execute(); $ra = array(); while ($r = $res->fetchArray()) { $d = $this->map($r); array_push($ra, $d); } $res->finalize(); return $ra; } function sortByAircraft() { $res = $this->stmt_sort_aircraft->execute(); $ra = array(); while ($r = $res->fetchArray()) { $d = array('aircraft' => $r['t'], 'count' => $r['c']); array_push($ra, $d); } $res->finalize(); return $ra; } function countAll() { $res = $this->stmt_count->execute(); $ra = array(); $r = $res->fetchArray(); $d = array('count' => $r['n'], 'distance' => $r['d'], 'duration' => $r['t']); $res->finalize(); return $d; } } $db = new DB(); ?> Flights

Flights

This web page lists Yuuta's flights.

Statistics

All Flights

'); $d = strval($data->date); w(substr($d, 0, 4) . '-' . substr($d, 4, 2) . '-' . substr($d, 6, 2)); w('
'); if (!is_null($data->airline)) { w($data->airline . ((!is_null($data->flight_no) && $data->flight_no != 0) ? strval ($data->flight_no) : '')); w('
'); } w(candidate($data->from->ad_iata, $data->from->ad) . ' → ' . candidate($data->dest->ad_iata, $data->dest->ad)); w(''); } function p_embark($data) { if (is_null($data->embark) && is_null($data->disembark)) { w(''); return; } w(''); } function p_seat($data) { w(''); } function p_enr($data) { w(''); } function p_dest_ad($data) { w(''); w(''); } function p_dest_taxi($data) { w(''); } function p_perf_weight($data) { w(''); } function p_perf_fuel($data) { w(''); } function p_links($data) { $pdf = 'charts/' . strval($data->date) . '_' . $data->from->ad . '_' . $data->dest->ad . '.pdf'; w(''); } function p($data) { w(''); p_flight($data); $data->aircraft->p(); p_seat($data); w(''); $data->from->p_taxi(); w(''); p_enr($data); w(''); w(''); $data->dest->p_taxi(); p_perf_weight($data); p_perf_fuel($data); p_links($data); w(''); } foreach ($db->getAll() as &$data) { p($data); } ?>
Flight Seat From Enroute Dest Performance Links
Flight Aircraft Seat Aerodrome Taxi Takeoff Route Aerodrome Landing Taxi Weight Fuel / Trip Links
?'); a(null, is_null($data->embark) ? '?' : $data->embark->value); w('
'); a(null, is_null($data->disembark) ? '?' : $data->disembark->value); w('
'); if (!is_null($data->cabin)) w('Cabin ' . $data->cabin . '
'); if (!is_null($data->seat)) w($data->seat . '
'); if (!is_null($data->seat_type)) w($data->seat_type->value); w('
'); if (!is_null($data->duration)) { w(strval(intdiv($data->duration, 60)) . 'h' . strval($data->duration % 60) . 'm'); w(" "); } if (!is_null($data->distance)) { w(strval($data->distance) . 'NM'); } if (!is_null($data->duration) || !is_null($data->distance)) { w("
"); } if (!is_null($data->crz_alt)) { a(null, $data->crz_alt); if (!is_null($data->crz_speed)) { w(" "); } } if (!is_null($data->crz_speed)) { w(strval($data->crz_speed) . 'ktFiled'); } if (!is_null($data->crz_alt) || !is_null($data->crz_speed)) { w("
"); } if (!is_null($data->route)) { w('
Route' . $data->route . '
'); } w('
'); $data->dest_ad->a(); w(' '); $data->dest_bay->a(); w('
'); a(null, $data->dest_rwy); w(' '); $data->dest_proc->a(); w('
'); w('On: ' . (is_null($data->off_chock) ? '?' : (strval($data->off_chock) . 'Z')) . '
'); if (is_null($data->dest_taxi)) { w('?'); } else { w('
Taxi'); $data->dest_taxi->a(); w('
'); } w('
'); if (!is_null($data->takeoff_weight)) w('TOW: ' . strval($data->takeoff_weight) . 'T
'); if (!is_null($data->pax)) w('PAX: ' . strval($data->pax) . '
'); if (!is_null($data->payload)) w('PLD: ' . strval($data->payload) . 'T'); w('
'); if (!is_null($data->fuel)) w('Fuel: ' . strval($data->fuel) . 'T' . '
'); if (!is_null($data->fuel_trip)) w('Trip: ' . strval($data->fuel_trip) . 'T'); w('
'); if (!is_null($data->fr24_link)) { a($data->fr24_link, "R"); } if (!is_null($data->fa_link)) { a($data->fa_link, "A"); } if (!is_null($data->fr24_link)) { // https://www.flightradar24.com/data/flights/cx888#36a2ab06 if (preg_match('/https:\\/\\/.*flightradar24\\.com\\/data\\/flights\\/(.*)#(.*)/', $data->fr24_link, $matches, PREG_OFFSET_CAPTURE)) { w(' '); a('kmls/' . strtoupper($matches[1][0]) . '-' . $matches[2][0] . '.kml', 'K'); } } if (file_exists($pdf)) { a($pdf, '
Images'); } w('
'); $data->from->p_ad(); if (!is_null($data->clearance)) { w('
Clearance' . $data->clearance . '
'); } w('
'); if (!is_null($data->from->rwy)) { w('RWY ' . $data->from->rwy . ''); } if (!is_null($data->from->proc)) { w('
SID ' . $data->from->proc . ''); if (!is_null($data->from->trans)) { w('
TRANS ' . $data->from->trans . ''); } } if (!is_null($data->v1) || !is_null($data->vr) || !is_null($data->v2)) w('
'); if (!is_null($data->v1)) w(strval($data->v1) . 'ktV1 '); if (!is_null($data->vr)) w(strval($data->vr) . 'ktVr '); if (!is_null($data->v2)) w(strval($data->v2) . 'ktV2 '); w('
'); $data->dest->p_ad(); w(''); if (!is_null($data->dest->rwy)) { w('APPR '); if (!is_null($data->approach)) { w('' . $data->approach . ' '); } w('' . $data->dest->rwy . ''); if (!is_null($data->approach_via)) { w('
VIA ' . $data->approach_via . ''); } } if (!is_null($data->dest->proc)) { w('
STAR ' . $data->dest->proc . ''); if (!is_null($data->dest->trans)) { w('
TRANS ' . $data->dest->trans . ''); } } if (!is_null($data->vref)) w('
'); if (!is_null($data->vref)) w(strval($data->vref) . 'ktVref '); w('
Flight Aircraft Seat Aerodrome Taxi Takeoff Route Aerodrome Landing Taxi Weight Fuel / Trip Links
Flight Seat From Enroute Dest Performance Links

More Actions

Yuuta 2024 - 2025: All rights reserved.