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_manufacturer'])) {
7 header('Location: '.$globalURL.'/manufacturer');
10 $aircraft_manufacturer = urldecode(filter_input(INPUT_GET
,'aircraft_manufacturer',FILTER_SANITIZE_STRING
));
11 $sort = filter_input(INPUT_GET
,'sort',FILTER_SANITIZE_STRING
);
12 $Spotter = new Spotter();
13 $manufacturer = ucwords(str_replace("-", " ", $aircraft_manufacturer));
15 $spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,"0,1", $sort);
17 if (!empty($spotter_array))
19 $title = sprintf(_("Most Common Airlines from %s"),$manufacturer);
21 require_once('header.php');
22 print '<div class="select-item">';
23 print '<form action="'.$globalURL.'/manufacturer" method="post">';
24 print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
26 $all_manufacturers = $Stats->getAllManufacturers();
27 if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
28 foreach($all_manufacturers as $all_manufacturer)
30 if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
32 print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>';
34 print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'">'.$all_manufacturer['aircraft_manufacturer'].'</option>';
38 print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>';
42 print '<div class="info column">';
43 print '<h1>'.$manufacturer.'</h1>';
46 include('manufacturer-sub-menu.php');
47 print '<div class="column">';
48 print '<h2>'._("Most Common Airlines").'</h2>';
49 print '<p>'.sprintf(_("The statistic below shows the most common airlines of flights from <strong>%s</strong>."),$manufacturer).'</p>';
50 $airline_array = $Spotter->countAllAirlinesByManufacturer($manufacturer);
51 if (!empty($airline_array))
53 print '<div class="table-responsive">';
54 print '<table class="common-airline table-striped">';
58 print '<th>'._("Airline").'</th>';
59 print '<th>'._("Country").'</th>';
60 print '<th>'._("# of times").'</th>';
65 foreach($airline_array as $airline_item)
68 print '<td><strong>'.$i.'</strong></td>';
69 print '<td class="logo">';
70 print '<a href="'.$globalURL.'/airline/'.$airline_item['airline_icao'].'"><img src="';
71 if ($globalIVAO && @getimagesize
($globalURL.'/images/airlines/'.$airline_item['airline_icao'].'.gif'))
73 print $globalURL.'/images/airlines/'.$airline_item['airline_icao'].'.gif';
74 } elseif (@getimagesize
($globalURL.'/images/airlines/'.$airline_item['airline_icao'].'.png'))
76 print $globalURL.'/images/airlines/'.$airline_item['airline_icao'].'.png';
78 print $globalURL.'/images/airlines/placeholder.png';
83 print '<a href="'.$globalURL.'/airline/'.$airline_item['airline_icao'].'">'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')</a>';
86 print '<a href="'.$globalURL.'/country/'.strtolower(str_replace(" ", "-", $airline_item['airline_country'])).'">'.$airline_item['airline_country'].'</a>';
89 print $airline_item['airline_count'];
91 print '<td><a href="'.$globalURL.'/search?airline='.$airline_item['airline_icao'].'&manufacturer='.$aircraft_manufacturer.'">'._("Search flights").'</a></td>';
101 $title = _("Manufacturer");
102 require_once('header.php');
103 print '<h1>'._("Error").'</h1>';
104 print '<p>'._("Sorry, the aircraft manufacturer does not exist in this database. :(").'</p>';
107 require_once('footer.php');