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['owner'])) {
6 header('Location: '.$globalURL.'/owner');
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));
18 $spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort,$filter);
20 $spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", '',$filter);
23 if (!empty($spotter_array))
25 $title = sprintf(_("Most Common Aircraft of %s"),$spotter_array[0]['pilot_name']);
26 require_once('header.php');
27 print '<div class="info column">';
28 print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>';
29 // print '<div><span class="label">'._("Ident").'</span>'.$spotter_array[0]['ident'].'</div>';
30 // print '<div><span class="label">'._("Airline").'</span><a href="'.$globalURL.'/airline/'.$spotter_array[0]['airline_icao'].'">'.$spotter_array[0]['airline_name'].'</a></div>';
33 include('pilot-sub-menu.php');
34 print '<div class="column">';
35 print '<h2>'._("Most Common Aircraft").'</h2>';
36 print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights piloted by <strong>%s</strong>."),$spotter_array[0]['pilot_name']).'</p>';
38 $aircraft_array = $Spotter->countAllAircraftTypesByPilot($pilot,$filter);
39 if (!empty($aircraft_array))
41 print '<div class="table-responsive">';
42 print '<table class="common-type table-striped">';
45 print '<th>'._("Aircraft Type").'</th>';
46 print '<th>'._("# of times").'</th>';
50 foreach($aircraft_array as $aircraft_item)
53 print '<td><strong>'.$i.'</strong></td>';
55 print '<a href="'.$globalURL.'/aircraft/'.$aircraft_item['aircraft_icao'].'">'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')</a>';
58 print $aircraft_item['aircraft_icao_count'];
70 require_once('header.php');
71 print '<h1>'._("Error").'</h1>';
72 print '<p>'._("Sorry, this pilot is not in the database. :(").'</p>';
75 require_once('footer.php');