2 require_once('require/class.Connection.php');
3 require_once('require/class.Spotter.php');
4 require_once('require/class.Language.php');
5 if (!isset($_GET['pilot'])) {
6 header('Location: '.$globalURL.'/pilot');
9 $Spotter = new Spotter();
10 $sort = filter_input(INPUT_GET
,'sort',FILTER_SANITIZE_STRING
);
11 $pilot = filter_input(INPUT_GET
,'pilot',FILTER_SANITIZE_STRING
);
12 $year = filter_input(INPUT_GET
,'year',FILTER_SANITIZE_NUMBER_INT
);
13 $month = filter_input(INPUT_GET
,'month',FILTER_SANITIZE_NUMBER_INT
);
15 if ($year != '') $filter = array_merge($filter,array('year' => $year));
16 if ($month != '') $filter = array_merge($filter,array('month' => $month));
17 $spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort,$filter);
19 if (!empty($spotter_array))
21 $title = sprintf(_("Most Common Airlines of %s"),$spotter_array[0]['pilot_name']);
22 require_once('header.php');
23 print '<div class="info column">';
24 print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>';
25 // print '<div><span class="label">'._("Ident").'</span>'.$spotter_array[0]['ident'].'</div>';
26 // print '<div><span class="label">'._("Airline").'</span><a href="'.$globalURL.'/airline/'.$spotter_array[0]['airline_icao'].'">'.$spotter_array[0]['airline_name'].'</a></div>';
29 include('pilot-sub-menu.php');
30 print '<div class="column">';
31 print '<h2>'._("Most Common Airlines").'</h2>';
32 print '<p>'.sprintf(_("The statistic below shows the most common airlines of flights owned by <strong>%s</strong>."),$spotter_array[0]['pilot_name']).'</p>';
34 $airline_array = $Spotter->countAllAirlinesByPilot($pilot,$filter);
35 if (!empty($airline_array))
37 print '<div class="table-responsive">';
38 print '<table class="common-airline table-striped">';
42 print '<th>'._("Airline").'</th>';
43 print '<th>'._("Country").'</th>';
44 print '<th>'._("# of times").'</th>';
49 foreach($airline_array as $airline_item)
52 print '<td><strong>'.$i.'</strong></td>';
53 print '<td class="logo">';
54 print '<a href="'.$globalURL.'/airline/'.$airline_item['airline_icao'].'"><img src="';
55 if ($globalIVAO && @getimagesize
($globalURL.'/images/airlines/'.$airline_item['airline_icao'].'.gif'))
57 print $globalURL.'/images/airlines/'.$airline_item['airline_icao'].'.gif';
58 } elseif (@getimagesize
($globalURL.'/images/airlines/'.$airline_item['airline_icao'].'.png'))
60 print $globalURL.'/images/airlines/'.$airline_item['airline_icao'].'.png';
62 print $globalURL.'/images/airlines/placeholder.png';
67 print '<a href="'.$globalURL.'/airline/'.$airline_item['airline_icao'].'">'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')</a>';
70 print '<a href="'.$globalURL.'/country/'.strtolower(str_replace(" ", "-", $airline_item['airline_country'])).'">'.$airline_item['airline_country'].'</a>';
73 print $airline_item['airline_count'];
75 print '<td><a href="'.$globalURL.'/search?airline='.$airline_item['airline_icao'].'&pilot_name='.$spotter_array[0]['pilot_name'].'">'._("Search flights").'</a></td>';
86 require_once('header.php');
87 print '<h1>'._("Error").'</h1>';
88 print '<p>'._("Sorry, this pilot is not in the database. :(").'</p>';
91 require_once('footer.php');