2 require_once('require/class.Connection.php');
3 require_once('require/class.Spotter.php');
4 require_once('require/class.Language.php');
5 //require_once('require/class.Translation.php');
6 require_once('require/class.Stats.php');
7 //require_once('require/class.SpotterLive.php');
8 require_once('require/class.SpotterArchive.php');
10 if (!isset($_GET['owner'])){
11 header('Location: '.$globalURL.'');
13 $Spotter = new Spotter();
14 $SpotterArchive = new SpotterArchive();
15 //$Translation = new Translation();
16 //calculuation for the pagination
17 if(!isset($_GET['limit']))
21 $absolute_difference = 25;
23 $limit_explode = explode(",", $_GET['limit']);
24 if (isset($limit_explode[1])) {
25 $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT
);
26 $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT
);
31 if (!ctype_digit(strval($limit_start)) ||
!ctype_digit(strval($limit_end))) {
36 $absolute_difference = abs($limit_start - $limit_end);
37 $limit_next = $limit_end +
$absolute_difference;
38 $limit_previous_1 = $limit_start - $absolute_difference;
39 $limit_previous_2 = $limit_end - $absolute_difference;
41 $page_url = $globalURL.'/owner/'.$_GET['owner'];
43 $owner = urldecode(filter_input(INPUT_GET
,'owner',FILTER_SANITIZE_STRING
));
44 $sort = filter_input(INPUT_GET
,'sort',FILTER_SANITIZE_STRING
);
45 $year = filter_input(INPUT_GET
,'year',FILTER_SANITIZE_NUMBER_INT
);
46 $month = filter_input(INPUT_GET
,'month',FILTER_SANITIZE_NUMBER_INT
);
48 if ($year != '') $filter = array_merge($filter,array('year' => $year));
49 if ($month != '') $filter = array_merge($filter,array('month' => $month));
50 $spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter);
51 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
52 $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter);
55 if (!empty($spotter_array))
57 $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']);
58 //$ident = $spotter_array[0]['ident'];
59 if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
60 if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
61 require_once('header.php');
62 print '<div class="info column">';
63 print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>';
64 //print '<div><span class="label">'._("Owner").'</span>'.$spotter_array[0]['aircraft_owner'].'</div>';
66 if ($year == '' && $month == '') $flights = $Stats->getStatsOwner($owner);
68 if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner,$filter);
69 print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
70 $aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner,$filter));
71 print '<div><span class="label">'._("Aircraft type").'</span>'.$aircraft_type.'</div>';
72 $aircraft_registration = count($Spotter->countAllAircraftRegistrationByOwner($owner,$filter));
73 print '<div><span class="label">'._("Aircraft").'</span>'.$aircraft_registration.'</div>';
74 $aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByOwner($owner,$filter));
75 print '<div><span class="label">'._("Manufacturers").'</span>'.$aircraft_manufacturer.'</div>';
76 $airlines = count($Spotter->countAllAirlinesByOwner($owner,$filter));
77 print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
78 $duration = $Spotter->getFlightDurationByOwner($owner,$filter);
79 if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
82 include('owner-sub-menu.php');
83 print '<div class="table column">';
84 print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>';
86 include('table-output.php');
87 print '<div class="pagination">';
88 if ($limit_previous_1 >= 0)
90 print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'/'.$sort.'">«'._("Previous Page").'</a>';
92 if ($spotter_array[0]['query_number_rows'] == $absolute_difference)
94 print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'/'.$sort.'">'._("Next Page").'»</a>';
100 require_once('header.php');
101 print '<h1>'._("Error").'</h1>';
102 print '<p>'._("Sorry, this owner is not in the database. :(").'</p>';
105 require_once('footer.php');