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['airline'])) {
7 header('Location: '.$globalURL.'/airline');
10 $airline = urldecode(filter_input(INPUT_GET
,'airline',FILTER_SANITIZE_STRING
));
11 $Spotter = new Spotter();
13 if (strpos($airline,'alliance_') !== FALSE) {
16 $spotter_array = $Spotter->getSpotterDataByAirline($airline,"0,1","");
19 if (!empty($spotter_array) ||
$alliance === true)
22 $title = sprintf(_("Most Common Routes from %s"),str_replace('_',' ',str_replace('alliance_','',$airline)));
24 $title = sprintf(_("Most Common Routes from %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']);
26 require_once('header.php');
27 print '<div class="select-item">';
28 print '<form action="'.$globalURL.'/airline" method="post">';
29 print '<select name="airline" class="selectpicker" data-live-search="true">';
30 print '<option></option>';
31 $alliances = $Spotter->getAllAllianceNames();
32 if (!empty($alliances)) {
33 foreach ($alliances as $al) {
34 if ($alliance && str_replace('_',' ',str_replace('alliance_','',$airline)) == $al['alliance']) {
35 print '<option value="alliance_'.str_replace(' ','_',$al['alliance']).'" selected>'.$al['alliance'].'</option>';
37 print '<option value="alliance_'.str_replace(' ','_',$al['alliance']).'">'.$al['alliance'].'</option>';
40 print '<option disabled>───────────────────</option>';
43 $airline_names = $Stats->getAllAirlineNames();
44 if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames();
45 foreach($airline_names as $airline_name)
47 if($airline == $airline_name['airline_icao'])
49 print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>';
51 print '<option value="'.$airline_name['airline_icao'].'">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>';
55 print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>';
62 if ($alliance === false) {
63 print '<div class="info column">';
64 print '<h1>'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')</h1>';
65 if ($globalIVAO && @getimagesize
($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif'))
67 print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
69 elseif (@getimagesize
($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
71 print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
73 print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['airline_name'].'</div>';
74 print '<div><span class="label">'._("Country").'</span>'.$spotter_array[0]['airline_country'].'</div>';
75 print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['airline_icao'].'</div>';
76 print '<div><span class="label">'._("IATA").'</span>'.$spotter_array[0]['airline_iata'].'</div>';
77 print '<div><span class="label">'._("Callsign").'</span>'.$spotter_array[0]['airline_callsign'].'</div>';
78 print '<div><span class="label">'._("Type").'</span>'.ucwords($spotter_array[0]['airline_type']).'</div>';
81 print '<div class="info column">';
82 print '<h1>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</h1>';
83 if (@getimagesize
($globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png') || @getimagesize
('images/airlines/'.str_replace('alliance_','',$airline).'.png'))
85 print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png" alt="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" title="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" class="logo" />';
87 print '<div><span class="label">'._("Name").'</span>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</div>';
91 print '<div class="alert alert-warning">'._("This special airline profile shows all flights that do <u>not</u> have a airline associated with them.").'</div>';
94 include('airline-sub-menu.php');
95 print '<div class="column">';
96 print '<h2>'._("Most Common Routes").'</h2>';
98 print '<p>'.sprintf(_("The statistic below shows the most common routes from <strong>%s</strong>."),str_replace('_',' ',str_replace('alliance_','',$airline))).'</p>';
100 print '<p>'.sprintf(_("The statistic below shows the most common routes from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>';
103 $route_array = $Spotter->countAllRoutesByAirline('',array('alliance' => str_replace('_',' ',str_replace('alliance_','',$airline))));
105 $route_array = $Spotter->countAllRoutesByAirline($airline);
107 if (!empty($route_array))
109 print '<div class="table-responsive">';
110 print '<table class="common-routes table-striped">';
113 print '<th>'._("Departure Airport").'</th>';
114 print '<th>'._("Arrival Airport").'</th>';
115 print '<th>'._("# of times").'</th>';
121 foreach($route_array as $route_item)
124 print '<td><strong>'.$i.'</strong></td>';
126 print '<a href="'.$globalURL.'/airport/'.$route_item['airport_departure_icao'].'">'.$route_item['airport_departure_city'].', '.$route_item['airport_departure_country'].' ('.$route_item['airport_departure_icao'].')</a>';
129 print '<a href="'.$globalURL.'/airport/'.$route_item['airport_arrival_icao'].'">'.$route_item['airport_arrival_city'].', '.$route_item['airport_arrival_country'].' ('.$route_item['airport_arrival_icao'].')</a>';
132 print $route_item['route_count'];
135 print '<a href="'.$globalURL.'/search?airline='.$airline.'&departure_airport_route='.$route_item['airport_departure_icao'].'&arrival_airport_route='.$route_item['airport_arrival_icao'].'">'._("Search Flights").'</a>';
138 print '<a href="'.$globalURL.'/route/'.$route_item['airport_departure_icao'].'/'.$route_item['airport_arrival_icao'].'">'._("Route Profile").'</a>';
149 $title = _("Airline Statistic");
150 require_once('header.php');
151 print '<h1>'._("Error").'</h1>';
152 print '<p>'._("Sorry, the airline does not exist in this database. :(").'</p>';
154 require_once('footer.php');