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['aircraft_manufacturer'])) {
7 header('Location: '.$globalURL.'/manufacturer');
10 $Spotter = new Spotter();
11 $manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET
,'aircraft_manufacturer',FILTER_SANITIZE_STRING
))));
12 $sort = filter_input(INPUT_GET
,'sort',FILTER_SANITIZE_STRING
);
14 $spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,"0,1", $sort);
16 if (!empty($spotter_array))
18 $title = sprintf(_("Most Common Routes from %s"),$manufacturer);
20 require_once('header.php');
21 print '<div class="select-item">';
22 print '<form action="'.$globalURL.'/manufacturer" method="post">';
23 print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
25 $all_manufacturers = $Stats->getAllManufacturers();
26 if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
27 foreach($all_manufacturers as $all_manufacturer)
29 if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
31 print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>';
33 print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'">'.$all_manufacturer['aircraft_manufacturer'].'</option>';
37 print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>';
41 print '<div class="info column">';
42 print '<h1>'.$manufacturer.'</h1>';
45 include('manufacturer-sub-menu.php');
46 print '<div class="column">';
47 print '<h2>'._("Most Common Routes").'</h2>';
48 print '<p>'.sprintf(_("The statistic below shows the most common routes from <strong>%s</strong>."),$manufacturer).'</p>';
50 $route_array = $Spotter->countAllRoutesByManufacturer($manufacturer);
51 if (!empty($route_array))
53 print '<div class="table-responsive">';
54 print '<table class="common-routes table-striped">';
57 print '<th>'._("Departure Airport").'</th>';
58 print '<th>'._("Arrival Airport").'</th>';
59 print '<th>'._("# of times").'</th>';
65 foreach($route_array as $route_item)
68 print '<td><strong>'.$i.'</strong></td>';
70 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>';
73 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>';
76 print $route_item['route_count'];
79 print '<a href="'.$globalURL.'/search?manufacturer='.$manufacturer.'&departure_airport_route='.$route_item['airport_departure_icao'].'&arrival_airport_route='.$route_item['airport_arrival_icao'].'">'._("Search Flights").'</a>';
82 print '<a href="'.$globalURL.'/route/'.$route_item['airport_departure_icao'].'/'.$route_item['airport_arrival_icao'].'">'._("Route History").'</a>';
93 $title = _("Manufacturer");
94 require_once('header.php');
95 print '<h1>'._("Error").'</h1>';
96 print '<p>'._("Sorry, the aircraft manufacturer does not exist in this database. :(").'</p>';
99 require_once('footer.php');