2 require_once('require/class.Connection.php');
3 require_once('require/class.Spotter.php');
4 require_once('require/class.Language.php');
6 if (!isset($_GET['country'])){
7 header('Location: '.$globalURL.'');
9 $Spotter = new Spotter();
10 //calculuation for the pagination
11 if(!isset($_GET['limit']))
15 $absolute_difference = 25;
17 $limit_explode = explode(",", $_GET['limit']);
18 if (isset($limit_explode[1])) {
19 $limit_start = $limit_explode[0];
20 $limit_end = $limit_explode[1];
25 if (!ctype_digit(strval($limit_start)) ||
!ctype_digit(strval($limit_end))) {
30 $absolute_difference = abs($limit_start - $limit_end);
31 $limit_next = $limit_end +
$absolute_difference;
32 $limit_previous_1 = $limit_start - $absolute_difference;
33 $limit_previous_2 = $limit_end - $absolute_difference;
35 $country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET
,'country',FILTER_SANITIZE_STRING
))));
37 $page_url = $globalURL.'/country/'.$_GET['country'];
38 $sort = filter_input(INPUT_GET
,'sort',FILTER_SANITIZE_STRING
);
39 if ($country == 'Na') {
40 $spotter_array = array();
43 $spotter_array = $Spotter->getSpotterDataByCountry($country, $limit_start.",".$absolute_difference, $sort);
45 $spotter_array = $Spotter->getSpotterDataByCountry($country, $limit_start.",".$absolute_difference, '');
49 if (!empty($spotter_array))
51 $title = sprintf(_("Detailed View for Airports & Airlines from %s"),$country);
53 require_once('header.php');
54 print '<div class="select-item">';
55 print '<form action="'.$globalURL.'/country" method="post">';
56 print '<select name="country" class="selectpicker" data-live-search="true">';
57 print '<option></option>';
58 $all_countries = $Spotter->getAllCountries();
59 foreach($all_countries as $all_country)
61 if($country == $all_country['country'])
63 print '<option value="'.strtolower(str_replace(" ", "-", $all_country['country'])).'" selected="selected">'.$all_country['country'].'</option>';
65 print '<option value="'.strtolower(str_replace(" ", "-", $all_country['country'])).'">'.$all_country['country'].'</option>';
69 print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>';
73 if ($_GET['country'] != "NA")
75 print '<div class="info column">';
76 print '<h1>'.sprintf(_("Airports & Airlines from %s"),$country).'</h1>';
79 print '<div class="alert alert-warning">'._("This special country profile shows all flights that do <u>not</u> have a country of a airline or departure/arrival airport associated with them.").'</div>';
82 include('country-sub-menu.php');
83 print '<div class="table column">';
84 print '<p>'.sprintf(_("The table below shows the detailed information of all flights of airports (both departure & arrival) OR airlines from <strong>%s</strong>."),$country).'</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>';
99 $title = _("Country");
100 require_once('header.php');
101 print '<h1>'._("Error").'</h1>';
102 print '<p>'._("Sorry, the country does not exist in this database. :(").'</p>';
106 require_once('footer.php');