2 require_once('require/class.Connection.php');
3 require_once('require/class.Spotter.php');
4 require_once('require/class.Stats.php');
5 require_once('require/class.Language.php');
6 if (!isset($_GET['aircraft_type'])) {
7 header('Location: '.$globalURL.'/aircraft');
10 $aircraft_type = filter_input(INPUT_GET
,'aircraft_type',FILTER_SANITIZE_STRING
);
11 $Spotter = new Spotter();
12 $spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type,"0,1","");
15 if (!empty($spotter_array))
17 $title = sprintf(_("Most Common Routes from %s (%s)"),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']);
18 require_once('header.php');
19 print '<div class="select-item">';
20 print '<form action="'.$globalURL.'/aircraft" method="get">';
21 print '<select name="aircraft_type" class="selectpicker" data-live-search="true">';
22 print '<option></option>';
24 $aircraft_types = $Stats->getAllAircraftTypes();
25 if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes();
26 foreach($aircraft_types as $aircrafttype)
28 if($aircraft_type == $aircrafttype['aircraft_icao'])
30 print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
32 print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
36 print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>';
41 if ($aircraft_type != "NA")
43 print '<div class="info column">';
44 print '<h1>'.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')</h1>';
45 print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['aircraft_name'].'</div>';
46 print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['aircraft_type'].'</div>';
47 print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_array[0]['aircraft_manufacturer'])).'">'.$spotter_array[0]['aircraft_manufacturer'].'</a></div>';
50 print '<div class="alert alert-warning">'._("This special aircraft profile shows all flights in where the aircraft type is unknown.").'</div>';
52 include('aircraft-sub-menu.php');
53 print '<div class="column">';
54 print '<h2>'._("Most Common Routes").'</h2>';
55 print '<p>'.sprintf(_("The statistic below shows the most common routes from <strong>%s (%s)</strong>."),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']).'</p>';
57 $route_array = $Spotter->countAllRoutesByAircraft($aircraft_type);
58 if (!empty($route_array))
60 print '<div class="table-responsive">';
61 print '<table class="common-routes">';
64 print '<th>'._("Departure Airport").'</th>';
65 print '<th>'._("Arrival Airport").'</th>';
66 print '<th>'._("# of times").'</th>';
72 foreach($route_array as $route_item)
75 print '<td><strong>'.$i.'</strong></td>';
77 print '<a href="'.$globalURL.'/airport/'.$route_item['airport_departure_icao'].'">'.$route_item['airport_departure_city'].', '.$route_item['airport_departure_country'].' ('.$route_item['airport_departure_icao'].')</a>';
80 print '<a href="'.$globalURL.'/airport/'.$route_item['airport_arrival_icao'].'">'.$route_item['airport_arrival_city'].', '.$route_item['airport_arrival_country'].' ('.$route_item['airport_arrival_icao'].')</a>';
83 print $route_item['route_count'];
86 print '<a href="'.$globalURL.'/search?aircraft='.$aircraft_type.'&departure_airport_route='.$route_item['airport_departure_icao'].'&arrival_airport_route='.$route_item['airport_arrival_icao'].'">Search Flights</a>';
89 print '<a href="'.$globalURL.'/route/'.$route_item['airport_departure_icao'].'/'.$route_item['airport_arrival_icao'].'">Route Profile</a>';
100 $title = _("Aircraft Type");
101 require_once('header.php');
102 print '<h1>'._("Error").'</h1>';
103 print '<p>'._("Sorry, the aircraft type does not exist in this database. :(").'</p>';
106 require_once('footer.php');