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 $Spotter = new Spotter();
11 $manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET
,'aircraft_manufacturer',FILTER_SANITIZE_STRING
))));
12 $sort = filter_input(INPUT_GET
,'sort',FILTER_SANITIZE_STRING
);
13 $spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,"0,1", $sort);
15 if (!empty($spotter_array))
17 $title = sprintf(_("Most Common Aircraft by Registration from %s"),$manufacturer);
18 require_once('header.php');
20 print '<div class="select-item">';
21 print '<form action="'.$globalURL.'/manufacturer" method="post">';
22 print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
24 $all_manufacturers = $Stats->getAllManufacturers();
25 if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
26 foreach($all_manufacturers as $all_manufacturer)
28 if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
30 print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>';
32 print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'">'.$all_manufacturer['aircraft_manufacturer'].'</option>';
36 print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>';
40 print '<div class="info column">';
41 print '<h1>'.$manufacturer.'</h1>';
44 include('manufacturer-sub-menu.php');
45 print '<div class="column">';
46 print '<h2>'._("Most Common Aircraft by Registration").'</h2>';
47 print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights from <strong>%s</strong>."),$manufacturer).'</p>';
49 $aircraft_array = $Spotter->countAllAircraftRegistrationByManufacturer($manufacturer);
50 if (!empty($aircraft_array))
52 print '<div class="table-responsive">';
53 print '<table class="common-type table-striped">';
57 print '<th>'._("Registration").'</th>';
58 print '<th>'._("Aircraft Type").'</th>';
59 print '<th>'._("# of times").'</th>';
64 foreach($aircraft_array as $aircraft_item)
67 print '<td><strong>'.$i.'</strong></td>';
68 if ($aircraft_item['image_thumbnail'] != "")
70 print '<td class="aircraft_thumbnail">';
71 if (isset($aircraft_item['aircraft_type'])) {
72 print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$aircraft_item['image_thumbnail'].'" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_type'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:").' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>';
74 print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$aircraft_item['image_thumbnail'].'" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:").' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>';
78 print '<td class="aircraft_thumbnail">';
79 if (isset($aircraft_item['aircraft_type'])) {
80 print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_type'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:").' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>';
82 print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:").' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>';
87 print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'">'.$aircraft_item['registration'].'</a>';
90 print '<a href="'.$globalURL.'/aircraft/'.$aircraft_item['aircraft_icao'].'">'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')</a>';
93 print $aircraft_item['registration_count'];
95 print '<td><a href="'.$globalURL.'/search?registration='.$aircraft_item['registration'].'&manufacturer='.$manufacturer.'">'._("Search flights").'</a></td>';
105 $title = _("Manufacturer");
106 require_once('header.php');
107 print '<h1>'._("Error").'</h1>';
108 print '<p>'._("Sorry, the aircraft manufacturer does not exist in this database. :(").'</p>';
111 require_once('footer.php');