2 require_once('require/class.Connection.php');
3 require_once('require/class.Spotter.php');
4 require_once('require/class.SpotterArchive.php');
5 require_once('require/class.Language.php');
6 if (!isset($_GET['owner'])) {
7 header('Location: '.$globalURL.'/owner');
10 $Spotter = new Spotter();
11 $SpotterArchive = new SpotterArchive();
12 $sort = filter_input(INPUT_GET
,'sort',FILTER_SANITIZE_STRING
);
13 $owner = urldecode(filter_input(INPUT_GET
,'owner',FILTER_SANITIZE_STRING
));
14 $year = filter_input(INPUT_GET
,'year',FILTER_SANITIZE_NUMBER_INT
);
15 $month = filter_input(INPUT_GET
,'month',FILTER_SANITIZE_NUMBER_INT
);
17 if ($year != '') $filter = array_merge($filter,array('year' => $year));
18 if ($month != '') $filter = array_merge($filter,array('month' => $month));
20 $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
21 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
23 $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
25 if (!empty($spotter_array))
27 $title = sprintf(_("Most Common Routes of %s"),$spotter_array[0]['aircraft_owner']);
28 require_once('header.php');
29 print '<div class="info column">';
30 print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>';
31 // print '<div><span class="label">'._("Ident").'</span>'.$spotter_array[0]['ident'].'</div>';
32 // print '<div><span class="label">'._("Airline").'</span><a href="'.$globalURL.'/airline/'.$spotter_array[0]['airline_icao'].'">'.$spotter_array[0]['airline_name'].'</a></div>';
35 include('owner-sub-menu.php');
36 print '<div class="column">';
37 print '<h2>'._("Most Common Routes").'</h2>';
38 print '<p>'.sprintf(_("The statistic below shows the most common routes from flights owner by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>';
39 if ($archive === false) {
40 $route_array = $Spotter->countAllRoutesByOwner($owner,$filter);
42 $route_array = $SpotterArchive->countAllRoutesByOwner($owner,$filter);
44 if (!empty($route_array))
46 print '<div class="table-responsive">';
47 print '<table class="common-routes table-striped">';
50 print '<th>'._("Departure Airport").'</th>';
51 print '<th>'._("Arrival Airport").'</th>';
52 print '<th>'._("# of times").'</th>';
58 foreach($route_array as $route_item)
61 print '<td><strong>'.$i.'</strong></td>';
63 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>';
66 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>';
69 print $route_item['route_count'];
72 print '<a href="'.$globalURL.'/search?owner='.$owner.'&departure_airport_route='.$route_item['airport_departure_icao'].'&arrival_airport_route='.$route_item['airport_arrival_icao'].'">Search Flights</a>';
75 print '<a href="'.$globalURL.'/route/'.$route_item['airport_departure_icao'].'/'.$route_item['airport_arrival_icao'].'">'._("Route Profile").'</a>';
87 require_once('header.php');
88 print '<h1>'._("Error").'</h1>';
89 print '<p>'._("Sorry, this owner is not in the database. :(").'</p>';
92 require_once('footer.php');