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 $Spotter = new Spotter();
8 if (!isset($_GET['aircraft_type'])){
9 header('Location: '.$globalURL.'/aircraft');
11 //calculuation for the pagination
12 if(!isset($_GET['limit']) ||
count(explode(",", $_GET['limit'])) < 2)
16 $absolute_difference = 25;
18 $limit_explode = explode(",", $_GET['limit']);
19 $limit_start = $limit_explode[0];
20 $limit_end = $limit_explode[1];
21 if (!ctype_digit(strval($limit_start)) ||
!ctype_digit(strval($limit_end))) {
26 $absolute_difference = abs($limit_start - $limit_end);
27 $limit_next = $limit_end +
$absolute_difference;
28 $limit_previous_1 = $limit_start - $absolute_difference;
29 $limit_previous_2 = $limit_end - $absolute_difference;
31 $aircraft_type = filter_input(INPUT_GET
,'aircraft_type',FILTER_SANITIZE_STRING
);
32 $page_url = $globalURL.'/aircraft/'.$aircraft_type;
34 $sort = htmlspecialchars(filter_input(INPUT_GET
,'sort',FILTER_SANITIZE_STRING
));
35 $spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type,$limit_start.",".$absolute_difference, $sort);
37 $aircraft_info = $Spotter->getAllAircraftInfo($aircraft_type);
38 if (!empty($spotter_array) ||
!empty($aircraft_info))
40 if (!empty($aircraft_info)) {
41 $title = sprintf(_("Detailed View for %s (%s)"),$aircraft_info[0]['type'],$aircraft_info[0]['icao']);
43 $title = sprintf(_("Detailed View for %s (%s)"),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']);
45 require_once('header.php');
47 print '<div class="select-item">';
48 print '<form action="'.$globalURL.'/aircraft" method="get">';
49 print '<select name="aircraft_type" class="selectpicker" data-live-search="true">';
50 print '<option></option>';
52 $aircraft_types = $Stats->getAllAircraftTypes();
53 if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes();
54 foreach($aircraft_types as $aircrafttype)
56 if($aircraft_type == $aircrafttype['aircraft_icao'])
58 print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_manufacturer'].' '.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
60 print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_manufacturer'].' '.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
64 print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>';
68 if ($aircraft_type != "NA")
70 print '<div class="info column">';
71 if (!empty($aircraft_info)) {
72 print '<h1>'.$aircraft_info[0]['type'].' ('.$aircraft_info[0]['icao'].')</h1>';
73 print '<div><span class="label">'._("Name").'</span>'.$aircraft_info[0]['type'].'</div>';
74 print '<div><span class="label">'._("ICAO").'</span>'.$aircraft_info[0]['icao'].'</div>';
75 print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $aircraft_info[0]['manufacturer'])).'">'.$aircraft_info[0]['manufacturer'].'</a></div>';
76 if ($aircraft_info[0]['aircraft_description'] != '' && $aircraft_info[0]['aircraft_description'] != 'None') print '<div><span class="label">'._("Description").'</span>'.$aircraft_info[0]['aircraft_description'].'</div>';
77 if ($aircraft_info[0]['engine_type'] != '' && $aircraft_info[0]['engine_type'] != 'None') print '<div><span class="label">'._("Engine").'</span>'.$aircraft_info[0]['engine_type'].'</div>';
78 if ($aircraft_info[0]['engine_count'] != '' && $aircraft_info[0]['engine_count'] != 0) print '<div><span class="label">'._("Engine count").'</span>'.$aircraft_info[0]['engine_count'].'</div>';
80 print '<h1>'.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')</h1>';
81 print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['aircraft_name'].'</div>';
82 print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['aircraft_type'].'</div>';
83 if (isset($spotter_array[0]['aircraft_manufacturer'])) 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>';
87 print '<div class="alert alert-warning">'._("This special aircraft profile shows all flights in where the aircraft type is unknown.").'</div>';
90 if (!empty($spotter_array)) {
91 include('aircraft-sub-menu.php');
92 print '<div class="table column">';
93 print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s (%s)</strong>."),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']).'</p>';
94 include('table-output.php');
95 print '<div class="pagination">';
96 if ($limit_previous_1 >= 0)
98 print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'/'.$sort.'">«'._("Previous Page").'</a>';
100 if ($spotter_array[0]['query_number_rows'] == $absolute_difference)
102 print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'/'.$sort.'">'._("Next Page").'»</a>';
107 print '<p>'._("No flights of this aircraft type exist in this database.").'</p>';
110 $title = _("Aircraft");
111 require_once('header.php');
112 print '<h1>'._("Errors").'</h1>';
113 print '<p>'._("Sorry, the aircraft type does not exist in this database. :(").'</p>';
116 require_once('footer.php');