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');
7 if (!isset($_GET['aircraft_type'])) {
8 header('Location: '.$globalURL.'/aircraft');
11 $aircraft_type = filter_input(INPUT_GET
,'aircraft_type',FILTER_SANITIZE_STRING
);
12 $Spotter = new Spotter();
13 $spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type,"0,1","");
16 if (!empty($spotter_array))
18 $title = sprintf(_("Most Common Airlines from %s (%s)"),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']);
19 require_once('header.php');
20 print '<div class="select-item">';
21 print '<form action="'.$globalURL.'/aircraft" method="get">';
22 print '<select name="aircraft_type" class="selectpicker" data-live-search="true">';
23 print '<option></option>';
25 $aircraft_types = $Stats->getAllAircraftTypes();
26 if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes();
27 foreach($aircraft_types as $aircrafttype)
29 if($aircraft_type == $aircrafttype['aircraft_icao'])
31 print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
33 print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
37 print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>';
42 if ($aircraft_type != "NA")
44 print '<div class="info column">';
45 print '<h1>'.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')</h1>';
46 print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['aircraft_name'].'</div>';
47 print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['aircraft_type'].'</div>';
48 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>';
51 print '<div class="alert alert-warning">'._("This special aircraft profile shows all flights in where the aircraft type is unknown.").'</div>';
53 include('aircraft-sub-menu.php');
54 print '<div class="column">';
55 print '<h2>'._("Most Common Airlines").'</h2>';
56 print '<p>'.sprintf(_("The statistic below shows the most common airlines of flights from <strong>%s (%s)</strong>."),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']).'</p>';
58 $airline_array = $Spotter->countAllAirlinesByAircraft($aircraft_type);
60 if (!empty($airline_array))
62 print '<div class="table-responsive">';
63 print '<table class="common-airline">';
67 print '<th>'._("Airline").'</th>';
68 print '<th>'._("Country").'</th>';
69 print '<th>'._("# of times").'</th>';
74 foreach($airline_array as $airline_item)
77 print '<td><strong>'.$i.'</strong></td>';
78 print '<td class="logo">';
79 print '<a href="'.$globalURL.'/airline/'.$airline_item['airline_icao'].'"><img src="';
80 if (@getimagesize
($globalURL.'/images/airlines/'.$airline_item['airline_icao'].'.png'))
82 print $globalURL.'/images/airlines/'.$airline_item['airline_icao'].'.png';
84 print $globalURL.'/images/airlines/placeholder.png';
89 print '<a href="'.$globalURL.'/airline/'.$airline_item['airline_icao'].'">'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')</a>';
92 print '<a href="'.$globalURL.'/country/'.strtolower(str_replace(" ", "-", $airline_item['airline_country'])).'">'.$airline_item['airline_country'].'</a>';
95 print $airline_item['airline_count'];
97 print '<td><a href="'.$globalURL.'/search?airline='.$airline_item['airline_icao'].'&aircraft='.$aircraft_type.'">Search flights</a></td>';
107 $title = "Aircraft Type";
108 require_once('header.php');
109 print '<h1>'._("Error").'</h1>';
110 print '<p>'._("Sorry, the aircraft type does not exist in this database. :(").'</p>';
113 require_once('footer.php');