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['airport'])) {
7 header('Location: '.$globalURL.'/airport');
10 $airport = filter_input(INPUT_GET
,'airport',FILTER_SANITIZE_STRING
);
11 $Spotter = new Spotter();
12 $airport_array = $Spotter->getAllAirportInfo($airport);
14 if (!empty($airport_array))
16 //$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
17 $title = sprintf(_("Most Common Aircraft by Registration to/from %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']);
19 require_once('header.php');
20 print '<div class="select-item">';
21 print '<form action="'.$globalURL.'/airport" method="post">';
22 print '<select name="airport" class="selectpicker" data-live-search="true">';
23 print '<option></option>';
25 $airport_names = $Stats->getAllAirportNames();
26 if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames();
27 ksort($airport_names);
28 foreach($airport_names as $airport_name)
30 if($_GET['airport'] == $airport_name['airport_icao'])
32 print '<option value="'.$airport_name['airport_icao'].'" selected="selected">'.$airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')</option>';
34 print '<option value="'.$airport_name['airport_icao'].'">'.$airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')</option>';
38 print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>';
45 print '<div class="info column">';
46 print '<h1>'.$airport_array[0]['city'].', '.$airport_array[0]['name'].' ('.$airport_array[0]['icao'].')</h1>';
47 print '<div><span class="label">'._("Name").'</span>'.$airport_array[0]['name'].'</div>';
48 print '<div><span class="label">'._("City").'</span>'.$airport_array[0]['city'].'</div>';
49 print '<div><span class="label">'._("Country").'</span>'.$airport_array[0]['country'].'</div>';
50 print '<div><span class="label">'._("ICAO").'</span>'.$airport_array[0]['icao'].'</div>';
51 print '<div><span class="label">'._("IATA").'</span>'.$airport_array[0]['iata'].'</div>';
52 print '<div><span class="label">'._("Altitude").'</span>'.$airport_array[0]['altitude'].'</div>';
53 print '<div><span class="label">'._("Coordinates").'</span><a href="http://maps.google.ca/maps?z=10&t=k&q='.$airport_array[0]['latitude'].','.$airport_array[0]['longitude'].'" target="_blank">Google Map<i class="fa fa-angle-double-right"></i></a></div>';
56 print '<div class="alert alert-warning">'._("This special airport profile shows all flights that do <u>not</u> have a departure and/or arrival airport associated with them.").'</div>';
59 include('airport-sub-menu.php');
60 print '<div class="column">';
61 print '<h2>'._("Most Common Aircraft by Registration").'</h2>';
62 print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights to/from <strong>%s, %s (%s)</strong>."),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']).'</p>';
64 $aircraft_array = $Spotter->countAllAircraftRegistrationByAirport($airport);
65 if (!empty($aircraft_array))
67 print '<div class="table-responsive">';
68 print '<table class="common-type table-striped">';
72 print '<th>'._("Registration").'</th>';
73 print '<th>'._("Aircraft Type").'</th>';
74 print '<th>'._("# of times").'</th>';
79 foreach($aircraft_array as $aircraft_item)
82 print '<td><strong>'.$i.'</strong></td>';
83 if ($aircraft_item['image_thumbnail'] != "")
85 print '<td class="aircraft_thumbnail">';
86 if (isset($aircraft_item['aircraft_type'])) {
87 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>';
89 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>';
93 print '<td class="aircraft_thumbnail">';
94 if (isset($aircraft_item['aircraft_type'])) {
95 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>';
97 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>';
102 print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'">'.$aircraft_item['registration'].'</a>';
105 print '<a href="'.$globalURL.'/aircraft/'.$aircraft_item['aircraft_icao'].'">'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')</a>';
108 print $aircraft_item['registration_count'];
110 print '<td><a href="'.$globalURL.'/search?registration='.$aircraft_item['registration'].'&airport='.$airport.'">'._("Search flights").'</a></td>';
120 $title = _("Airport");
121 require_once('header.php');
122 print '<h1>'._("Error").'</h1>';
123 print '<p>'._("Sorry, the airport does not exist in this database. :(").'</p>';
126 require_once('footer.php');