@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | $Spotter = new Spotter(); |
24 | 24 | $alliances = $Spotter->getAllAllianceNames(); |
25 | 25 | if (!empty($alliances)) { |
26 | - foreach($alliances as $alliance) { |
|
27 | - if (isset($airline_icao) && str_replace('_',' ',$airline_icao) == $alliance['alliance']) { |
|
28 | - print '<option value="'.str_replace(' ','_',$alliance['alliance']).'" selected>'.$alliance['alliance'].'</option>'; |
|
26 | + foreach ($alliances as $alliance) { |
|
27 | + if (isset($airline_icao) && str_replace('_', ' ', $airline_icao) == $alliance['alliance']) { |
|
28 | + print '<option value="'.str_replace(' ', '_', $alliance['alliance']).'" selected>'.$alliance['alliance'].'</option>'; |
|
29 | 29 | } else { |
30 | - print '<option value="'.str_replace(' ','_',$alliance['alliance']).'">'.$alliance['alliance'].'</option>'; |
|
30 | + print '<option value="'.str_replace(' ', '_', $alliance['alliance']).'">'.$alliance['alliance'].'</option>'; |
|
31 | 31 | } |
32 | 32 | } |
33 | 33 | print '<option disabled>──────────</option>'; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $Stats = new Stats(); |
36 | 36 | if (!isset($filter_name)) $filter_name = ''; |
37 | 37 | $airlines = $Stats->getAllAirlineNames($filter_name); |
38 | - foreach($airlines as $airline) { |
|
38 | + foreach ($airlines as $airline) { |
|
39 | 39 | if (isset($airline_icao) && $airline_icao == $airline['airline_icao']) { |
40 | 40 | print '<option value="'.$airline['airline_icao'].'" selected>'.$airline['airline_name'].'</option>'; |
41 | 41 | } else { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | if (!isset($type) || $type == 'aircraft') { |
59 | 59 | ?> |
60 | 60 | <li class="dropdown"> |
61 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#" > |
|
61 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#" > |
|
62 | 62 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
63 | 63 | </a> |
64 | 64 | <ul class="dropdown-menu"> |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | </ul> |
70 | 70 | </li> |
71 | 71 | <li class="dropdown"> |
72 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
72 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
73 | 73 | <?php echo _("Airline"); ?> <span class="caret"></span> |
74 | 74 | </a> |
75 | 75 | <ul class="dropdown-menu" role="menu"> |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | </ul> |
86 | 86 | </li> |
87 | 87 | <li class="dropdown"> |
88 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
88 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
89 | 89 | <?php echo _("Airport"); ?> <span class="caret"></span> |
90 | 90 | </a> |
91 | 91 | <ul class="dropdown-menu" role="menu"> |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | </ul> |
97 | 97 | </li> |
98 | 98 | <li class="dropdown"> |
99 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
99 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
100 | 100 | <?php echo _("Route"); ?> <span class="caret"></span> |
101 | 101 | </a> |
102 | 102 | <ul class="dropdown-menu" role="menu"> |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | </ul> |
106 | 106 | </li> |
107 | 107 | <li class="dropdown"> |
108 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
108 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
109 | 109 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
110 | 110 | </a> |
111 | 111 | <ul class="dropdown-menu" role="menu"> |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) { |
118 | 118 | ?> |
119 | 119 | <li class="dropdown"> |
120 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
120 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
121 | 121 | <?php echo _("Fatalities"); ?> <span class="caret"></span> |
122 | 122 | </a> |
123 | 123 | <ul class="dropdown-menu" role="menu"> |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | } elseif ($type == 'marine' || $type == 'tracker') { |
133 | 133 | ?> |
134 | 134 | <li class="dropdown"> |
135 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
135 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
136 | 136 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
137 | 137 | </a> |
138 | 138 | <ul class="dropdown-menu" role="menu"> |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | if (!isset($type) || $type == 'aircraft') { |
155 | 155 | ?> |
156 | 156 | <li class="dropdown"> |
157 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#" > |
|
157 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#" > |
|
158 | 158 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
159 | 159 | </a> |
160 | 160 | <ul class="dropdown-menu"> |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | </ul> |
166 | 166 | </li> |
167 | 167 | <li class="dropdown"> |
168 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
168 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
169 | 169 | <?php echo _("Airline"); ?> <span class="caret"></span> |
170 | 170 | </a> |
171 | 171 | <ul class="dropdown-menu" role="menu"> |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | </ul> |
182 | 182 | </li> |
183 | 183 | <li class="dropdown"> |
184 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
184 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
185 | 185 | <?php echo _("Airport"); ?> <span class="caret"></span> |
186 | 186 | </a> |
187 | 187 | <ul class="dropdown-menu" role="menu"> |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | </li> |
194 | 194 | <!-- |
195 | 195 | <li class="dropdown"> |
196 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
196 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
197 | 197 | <?php echo _("Route"); ?> <span class="caret"></span> |
198 | 198 | </a> |
199 | 199 | <ul class="dropdown-menu" role="menu"> |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | --> |
205 | 205 | <!-- |
206 | 206 | <li class="dropdown"> |
207 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
207 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
208 | 208 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
209 | 209 | </a> |
210 | 210 | <ul class="dropdown-menu" role="menu"> |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | ?> |
219 | 219 | <!-- |
220 | 220 | <li class="dropdown"> |
221 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
221 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
222 | 222 | <?php echo _("Fatalities"); ?> <span class="caret"></span> |
223 | 223 | </a> |
224 | 224 | <ul class="dropdown-menu" role="menu"> |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | } elseif ($type == 'marine' || $type == 'tracker') { |
235 | 235 | ?> |
236 | 236 | <li class="dropdown"> |
237 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
237 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
238 | 238 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
239 | 239 | </a> |
240 | 240 | <ul class="dropdown-menu" role="menu"> |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | $this->db = $Connection->db(); |
19 | 19 | } |
20 | 20 | |
21 | - public function addLastStatsUpdate($type,$stats_date) { |
|
21 | + public function addLastStatsUpdate($type, $stats_date) { |
|
22 | 22 | $query = "DELETE FROM config WHERE name = :type; |
23 | 23 | INSERT INTO config (name,value) VALUES (:type,:stats_date);"; |
24 | - $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
24 | + $query_values = array('type' => $type, ':stats_date' => $stats_date); |
|
25 | 25 | try { |
26 | 26 | $sth = $this->db->prepare($query); |
27 | 27 | $sth->execute($query_values); |
28 | - } catch(PDOException $e) { |
|
28 | + } catch (PDOException $e) { |
|
29 | 29 | return "error : ".$e->getMessage(); |
30 | 30 | } |
31 | 31 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | try { |
36 | 36 | $sth = $this->db->prepare($query); |
37 | 37 | $sth->execute(array(':type' => $type)); |
38 | - } catch(PDOException $e) { |
|
38 | + } catch (PDOException $e) { |
|
39 | 39 | echo "error : ".$e->getMessage(); |
40 | 40 | } |
41 | 41 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | try { |
56 | 56 | $sth = $this->db->prepare($query); |
57 | 57 | $sth->execute(array(':filter_name' => $filter_name)); |
58 | - } catch(PDOException $e) { |
|
58 | + } catch (PDOException $e) { |
|
59 | 59 | return "error : ".$e->getMessage(); |
60 | 60 | } |
61 | 61 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | try { |
69 | 69 | $sth = $this->db->prepare($query); |
70 | 70 | $sth->execute(); |
71 | - } catch(PDOException $e) { |
|
71 | + } catch (PDOException $e) { |
|
72 | 72 | return "error : ".$e->getMessage(); |
73 | 73 | } |
74 | 74 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | try { |
77 | 77 | $sth = $this->db->prepare($query); |
78 | 78 | $sth->execute(array(':filter_name' => $filter_name)); |
79 | - } catch(PDOException $e) { |
|
79 | + } catch (PDOException $e) { |
|
80 | 80 | return "error : ".$e->getMessage(); |
81 | 81 | } |
82 | 82 | } |
@@ -86,77 +86,77 @@ discard block |
||
86 | 86 | try { |
87 | 87 | $sth = $this->db->prepare($query); |
88 | 88 | $sth->execute(array(':filter_name' => $filter_name)); |
89 | - } catch(PDOException $e) { |
|
89 | + } catch (PDOException $e) { |
|
90 | 90 | echo "error : ".$e->getMessage(); |
91 | 91 | } |
92 | 92 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
93 | 93 | if (empty($all)) { |
94 | 94 | $filters = array(); |
95 | 95 | if ($filter_name != '') { |
96 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
96 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
97 | 97 | } |
98 | 98 | $Spotter = new Spotter($this->db); |
99 | - $all = $Spotter->getAllAirlineNames('',NULL,$filters); |
|
99 | + $all = $Spotter->getAllAirlineNames('', NULL, $filters); |
|
100 | 100 | } |
101 | 101 | return $all; |
102 | 102 | } |
103 | - public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
|
103 | + public function getAllAircraftTypes($stats_airline = '', $filter_name = '') { |
|
104 | 104 | if ($filter_name == '') $filter_name = $this->filter_name; |
105 | 105 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
106 | 106 | try { |
107 | 107 | $sth = $this->db->prepare($query); |
108 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
109 | - } catch(PDOException $e) { |
|
108 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
109 | + } catch (PDOException $e) { |
|
110 | 110 | echo "error : ".$e->getMessage(); |
111 | 111 | } |
112 | 112 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
113 | 113 | return $all; |
114 | 114 | } |
115 | - public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
|
115 | + public function getAllManufacturers($stats_airline = '', $filter_name = '') { |
|
116 | 116 | if ($filter_name == '') $filter_name = $this->filter_name; |
117 | 117 | $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC"; |
118 | 118 | try { |
119 | 119 | $sth = $this->db->prepare($query); |
120 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
121 | - } catch(PDOException $e) { |
|
120 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
121 | + } catch (PDOException $e) { |
|
122 | 122 | echo "error : ".$e->getMessage(); |
123 | 123 | } |
124 | 124 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
125 | 125 | return $all; |
126 | 126 | } |
127 | - public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
|
127 | + public function getAllAirportNames($stats_airline = '', $filter_name = '') { |
|
128 | 128 | if ($filter_name == '') $filter_name = $this->filter_name; |
129 | 129 | $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
130 | 130 | try { |
131 | 131 | $sth = $this->db->prepare($query); |
132 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
133 | - } catch(PDOException $e) { |
|
132 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
133 | + } catch (PDOException $e) { |
|
134 | 134 | echo "error : ".$e->getMessage(); |
135 | 135 | } |
136 | 136 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
137 | 137 | return $all; |
138 | 138 | } |
139 | 139 | |
140 | - public function getAllOwnerNames($stats_airline = '',$filter_name = '') { |
|
140 | + public function getAllOwnerNames($stats_airline = '', $filter_name = '') { |
|
141 | 141 | if ($filter_name == '') $filter_name = $this->filter_name; |
142 | 142 | $query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC"; |
143 | 143 | try { |
144 | 144 | $sth = $this->db->prepare($query); |
145 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
146 | - } catch(PDOException $e) { |
|
145 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
146 | + } catch (PDOException $e) { |
|
147 | 147 | echo "error : ".$e->getMessage(); |
148 | 148 | } |
149 | 149 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
150 | 150 | return $all; |
151 | 151 | } |
152 | 152 | |
153 | - public function getAllPilotNames($stats_airline = '',$filter_name = '') { |
|
153 | + public function getAllPilotNames($stats_airline = '', $filter_name = '') { |
|
154 | 154 | if ($filter_name == '') $filter_name = $this->filter_name; |
155 | 155 | $query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC"; |
156 | 156 | try { |
157 | 157 | $sth = $this->db->prepare($query); |
158 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
159 | - } catch(PDOException $e) { |
|
158 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
159 | + } catch (PDOException $e) { |
|
160 | 160 | echo "error : ".$e->getMessage(); |
161 | 161 | } |
162 | 162 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -164,23 +164,23 @@ discard block |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | |
167 | - public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
167 | + public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
168 | 168 | global $globalStatsFilters; |
169 | 169 | if ($filter_name == '') $filter_name = $this->filter_name; |
170 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
170 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
171 | 171 | $Spotter = new Spotter($this->db); |
172 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
172 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
173 | 173 | $alliance_airlines = array(); |
174 | 174 | foreach ($airlines as $airline) { |
175 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
175 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
176 | 176 | } |
177 | 177 | if ($year == '' && $month == '') { |
178 | - if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
179 | - else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
178 | + if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
179 | + else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
180 | 180 | try { |
181 | 181 | $sth = $this->db->prepare($query); |
182 | 182 | $sth->execute(array(':filter_name' => $filter_name)); |
183 | - } catch(PDOException $e) { |
|
183 | + } catch (PDOException $e) { |
|
184 | 184 | echo "error : ".$e->getMessage(); |
185 | 185 | } |
186 | 186 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -191,29 +191,29 @@ discard block |
||
191 | 191 | else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
192 | 192 | try { |
193 | 193 | $sth = $this->db->prepare($query); |
194 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
195 | - } catch(PDOException $e) { |
|
194 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
195 | + } catch (PDOException $e) { |
|
196 | 196 | echo "error : ".$e->getMessage(); |
197 | 197 | } |
198 | 198 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
199 | 199 | } else $all = array(); |
200 | 200 | } |
201 | 201 | if (empty($all)) { |
202 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
203 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
202 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
203 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
204 | 204 | } else { |
205 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
205 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
206 | 206 | } |
207 | 207 | if ($filter_name != '') { |
208 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
208 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
209 | 209 | } |
210 | 210 | $Spotter = new Spotter($this->db); |
211 | 211 | //$all = $Spotter->countAllAircraftTypes($limit,0,'',$filters,$year,$month); |
212 | - $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters); |
|
212 | + $all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters); |
|
213 | 213 | } |
214 | 214 | return $all; |
215 | 215 | } |
216 | - public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
|
216 | + public function countAllAirlineCountries($limit = true, $filter_name = '', $year = '', $month = '') { |
|
217 | 217 | global $globalStatsFilters; |
218 | 218 | if ($filter_name == '') $filter_name = $this->filter_name; |
219 | 219 | if ($year == '' && $month == '') { |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | try { |
223 | 223 | $sth = $this->db->prepare($query); |
224 | 224 | $sth->execute(array(':filter_name' => $filter_name)); |
225 | - } catch(PDOException $e) { |
|
225 | + } catch (PDOException $e) { |
|
226 | 226 | echo "error : ".$e->getMessage(); |
227 | 227 | } |
228 | 228 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -230,32 +230,32 @@ discard block |
||
230 | 230 | if (empty($all)) { |
231 | 231 | $Spotter = new Spotter($this->db); |
232 | 232 | $filters = array(); |
233 | - $filters = array('year' => $year,'month' => $month); |
|
233 | + $filters = array('year' => $year, 'month' => $month); |
|
234 | 234 | if ($filter_name != '') { |
235 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
235 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
236 | 236 | } |
237 | 237 | //$all = $Spotter->countAllAirlineCountries($limit,$filters,$year,$month); |
238 | - $all = $Spotter->countAllAirlineCountries($limit,$filters); |
|
238 | + $all = $Spotter->countAllAirlineCountries($limit, $filters); |
|
239 | 239 | } |
240 | 240 | return $all; |
241 | 241 | } |
242 | - public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
242 | + public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
243 | 243 | global $globalStatsFilters; |
244 | 244 | if ($filter_name == '') $filter_name = $this->filter_name; |
245 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
245 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
246 | 246 | $Spotter = new Spotter($this->db); |
247 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
247 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
248 | 248 | $alliance_airlines = array(); |
249 | 249 | foreach ($airlines as $airline) { |
250 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
250 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
251 | 251 | } |
252 | 252 | if ($year == '' && $month == '') { |
253 | - if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
254 | - else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
253 | + if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
254 | + else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
255 | 255 | try { |
256 | 256 | $sth = $this->db->prepare($query); |
257 | 257 | $sth->execute(array(':filter_name' => $filter_name)); |
258 | - } catch(PDOException $e) { |
|
258 | + } catch (PDOException $e) { |
|
259 | 259 | echo "error : ".$e->getMessage(); |
260 | 260 | } |
261 | 261 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -266,21 +266,21 @@ discard block |
||
266 | 266 | else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
267 | 267 | try { |
268 | 268 | $sth = $this->db->prepare($query); |
269 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
270 | - } catch(PDOException $e) { |
|
269 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
270 | + } catch (PDOException $e) { |
|
271 | 271 | echo "error : ".$e->getMessage(); |
272 | 272 | } |
273 | 273 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
274 | 274 | } else $all = array(); |
275 | 275 | } |
276 | 276 | if (empty($all)) { |
277 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
278 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
277 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
278 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
279 | 279 | } else { |
280 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
280 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
281 | 281 | } |
282 | 282 | if ($filter_name != '') { |
283 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
283 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
284 | 284 | } |
285 | 285 | $Spotter = new Spotter($this->db); |
286 | 286 | //$all = $Spotter->countAllAircraftManufacturers($filters,$year,$month); |
@@ -289,23 +289,23 @@ discard block |
||
289 | 289 | return $all; |
290 | 290 | } |
291 | 291 | |
292 | - public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
292 | + public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
293 | 293 | global $globalStatsFilters; |
294 | 294 | if ($filter_name == '') $filter_name = $this->filter_name; |
295 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
295 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
296 | 296 | $Spotter = new Spotter($this->db); |
297 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
297 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
298 | 298 | $alliance_airlines = array(); |
299 | 299 | foreach ($airlines as $airline) { |
300 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
300 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
301 | 301 | } |
302 | 302 | if ($year == '' && $month == '') { |
303 | - if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
304 | - else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
303 | + if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
304 | + else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
305 | 305 | try { |
306 | 306 | $sth = $this->db->prepare($query); |
307 | 307 | $sth->execute(array(':filter_name' => $filter_name)); |
308 | - } catch(PDOException $e) { |
|
308 | + } catch (PDOException $e) { |
|
309 | 309 | echo "error : ".$e->getMessage(); |
310 | 310 | } |
311 | 311 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -316,61 +316,61 @@ discard block |
||
316 | 316 | else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
317 | 317 | try { |
318 | 318 | $sth = $this->db->prepare($query); |
319 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
320 | - } catch(PDOException $e) { |
|
319 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
320 | + } catch (PDOException $e) { |
|
321 | 321 | echo "error : ".$e->getMessage(); |
322 | 322 | } |
323 | 323 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
324 | 324 | } else $all = array(); |
325 | 325 | } |
326 | 326 | if (empty($all)) { |
327 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
328 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
327 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
328 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
329 | 329 | } else { |
330 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
330 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
331 | 331 | } |
332 | 332 | if ($filter_name != '') { |
333 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
333 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
334 | 334 | } |
335 | 335 | $Spotter = new Spotter($this->db); |
336 | 336 | //$all = $Spotter->countAllArrivalCountries($limit,$filters,$year,$month); |
337 | - $all = $Spotter->countAllArrivalCountries($limit,$filters); |
|
337 | + $all = $Spotter->countAllArrivalCountries($limit, $filters); |
|
338 | 338 | } |
339 | 339 | return $all; |
340 | 340 | } |
341 | 341 | public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
342 | 342 | global $globalStatsFilters; |
343 | 343 | if ($filter_name == '') $filter_name = $this->filter_name; |
344 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
344 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
345 | 345 | $Spotter = new Spotter($this->db); |
346 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
346 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
347 | 347 | $alliance_airlines = array(); |
348 | 348 | foreach ($airlines as $airline) { |
349 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
349 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
350 | 350 | } |
351 | - if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
352 | - else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
351 | + if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
352 | + else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
353 | 353 | $query_values = array(':filter_name' => $filter_name); |
354 | 354 | } else { |
355 | 355 | if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
356 | 356 | else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
357 | - $query_values = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
357 | + $query_values = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
358 | 358 | } |
359 | 359 | try { |
360 | 360 | $sth = $this->db->prepare($query); |
361 | 361 | $sth->execute($query_values); |
362 | - } catch(PDOException $e) { |
|
362 | + } catch (PDOException $e) { |
|
363 | 363 | echo "error : ".$e->getMessage(); |
364 | 364 | } |
365 | 365 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
366 | 366 | if (empty($all)) { |
367 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
368 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
367 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
368 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
369 | 369 | } else { |
370 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
370 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
371 | 371 | } |
372 | 372 | if ($filter_name != '') { |
373 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
373 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
374 | 374 | } |
375 | 375 | $Spotter = new Spotter($this->db); |
376 | 376 | //$all = $Spotter->countAllDepartureCountries($filters,$year,$month); |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | return $all; |
380 | 380 | } |
381 | 381 | |
382 | - public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
|
382 | + public function countAllAirlines($limit = true, $filter_name = '', $year = '', $month = '') { |
|
383 | 383 | global $globalStatsFilters, $globalVATSIM, $globalIVAO; |
384 | 384 | if ($filter_name == '') $filter_name = $this->filter_name; |
385 | 385 | if ($year == '' && $month == '') { |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | if (isset($forsource)) { |
389 | 389 | if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
390 | 390 | else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC"; |
391 | - $query_values = array(':filter_name' => $filter_name,':forsource' => $forsource); |
|
391 | + $query_values = array(':filter_name' => $filter_name, ':forsource' => $forsource); |
|
392 | 392 | } else { |
393 | 393 | if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
394 | 394 | else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC"; |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | try { |
398 | 398 | $sth = $this->db->prepare($query); |
399 | 399 | $sth->execute($query_values); |
400 | - } catch(PDOException $e) { |
|
400 | + } catch (PDOException $e) { |
|
401 | 401 | echo "error : ".$e->getMessage(); |
402 | 402 | } |
403 | 403 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -405,32 +405,32 @@ discard block |
||
405 | 405 | if (empty($all)) { |
406 | 406 | $Spotter = new Spotter($this->db); |
407 | 407 | $filters = array(); |
408 | - $filters = array('year' => $year,'month' => $month); |
|
408 | + $filters = array('year' => $year, 'month' => $month); |
|
409 | 409 | if ($filter_name != '') { |
410 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
410 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
411 | 411 | } |
412 | 412 | //$all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month); |
413 | - $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
413 | + $all = $Spotter->countAllAirlines($limit, 0, '', $filters); |
|
414 | 414 | } |
415 | 415 | return $all; |
416 | 416 | } |
417 | - public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
417 | + public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
418 | 418 | global $globalStatsFilters; |
419 | 419 | if ($filter_name == '') $filter_name = $this->filter_name; |
420 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
420 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
421 | 421 | $Spotter = new Spotter($this->db); |
422 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
422 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
423 | 423 | $alliance_airlines = array(); |
424 | 424 | foreach ($airlines as $airline) { |
425 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
425 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
426 | 426 | } |
427 | 427 | if ($year == '' && $month == '') { |
428 | - if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
429 | - else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
428 | + if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
429 | + else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
430 | 430 | try { |
431 | 431 | $sth = $this->db->prepare($query); |
432 | 432 | $sth->execute(array(':filter_name' => $filter_name)); |
433 | - } catch(PDOException $e) { |
|
433 | + } catch (PDOException $e) { |
|
434 | 434 | echo "error : ".$e->getMessage(); |
435 | 435 | } |
436 | 436 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -441,45 +441,45 @@ discard block |
||
441 | 441 | else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
442 | 442 | try { |
443 | 443 | $sth = $this->db->prepare($query); |
444 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
445 | - } catch(PDOException $e) { |
|
444 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
445 | + } catch (PDOException $e) { |
|
446 | 446 | echo "error : ".$e->getMessage(); |
447 | 447 | } |
448 | 448 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
449 | 449 | } else $all = array(); |
450 | 450 | } |
451 | 451 | if (empty($all)) { |
452 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
453 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
452 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
453 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
454 | 454 | } else { |
455 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
455 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
456 | 456 | } |
457 | 457 | if ($filter_name != '') { |
458 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
458 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
459 | 459 | } |
460 | 460 | $Spotter = new Spotter($this->db); |
461 | 461 | //$all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters,$year,$month); |
462 | - $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters); |
|
462 | + $all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters); |
|
463 | 463 | } |
464 | 464 | return $all; |
465 | 465 | } |
466 | - public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
466 | + public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
467 | 467 | global $globalStatsFilters; |
468 | 468 | if ($filter_name == '') $filter_name = $this->filter_name; |
469 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
469 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
470 | 470 | $Spotter = new Spotter($this->db); |
471 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
471 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
472 | 472 | $alliance_airlines = array(); |
473 | 473 | foreach ($airlines as $airline) { |
474 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
474 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
475 | 475 | } |
476 | 476 | if ($year == '' && $month == '') { |
477 | - if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
478 | - else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
477 | + if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
478 | + else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
479 | 479 | try { |
480 | 480 | $sth = $this->db->prepare($query); |
481 | 481 | $sth->execute(array(':filter_name' => $filter_name)); |
482 | - } catch(PDOException $e) { |
|
482 | + } catch (PDOException $e) { |
|
483 | 483 | echo "error : ".$e->getMessage(); |
484 | 484 | } |
485 | 485 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -490,46 +490,46 @@ discard block |
||
490 | 490 | else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
491 | 491 | try { |
492 | 492 | $sth = $this->db->prepare($query); |
493 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
494 | - } catch(PDOException $e) { |
|
493 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
494 | + } catch (PDOException $e) { |
|
495 | 495 | echo "error : ".$e->getMessage(); |
496 | 496 | } |
497 | 497 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
498 | 498 | } else $all = array(); |
499 | 499 | } |
500 | 500 | if (empty($all)) { |
501 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
502 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
501 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
502 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
503 | 503 | } else { |
504 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
504 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
505 | 505 | } |
506 | 506 | if ($filter_name != '') { |
507 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
507 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
508 | 508 | } |
509 | 509 | $Spotter = new Spotter($this->db); |
510 | 510 | //$all = $Spotter->countAllCallsigns($limit,0,'',$filters,$year,$month); |
511 | - $all = $Spotter->countAllCallsigns($limit,0,'',$filters); |
|
511 | + $all = $Spotter->countAllCallsigns($limit, 0, '', $filters); |
|
512 | 512 | } |
513 | 513 | return $all; |
514 | 514 | } |
515 | - public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
515 | + public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
516 | 516 | $Connection = new Connection(); |
517 | 517 | if ($filter_name == '') $filter_name = $this->filter_name; |
518 | 518 | if ($Connection->tableExists('countries')) { |
519 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
519 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
520 | 520 | $Spotter = new Spotter($this->db); |
521 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
521 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
522 | 522 | if ($year == '' && $month == '') { |
523 | 523 | $alliance_airlines = array(); |
524 | 524 | foreach ($airlines as $airline) { |
525 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
525 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
526 | 526 | } |
527 | - if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
528 | - else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
527 | + if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
528 | + else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
529 | 529 | try { |
530 | 530 | $sth = $this->db->prepare($query); |
531 | 531 | $sth->execute(array(':filter_name' => $filter_name)); |
532 | - } catch(PDOException $e) { |
|
532 | + } catch (PDOException $e) { |
|
533 | 533 | echo "error : ".$e->getMessage(); |
534 | 534 | } |
535 | 535 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -541,8 +541,8 @@ discard block |
||
541 | 541 | else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
542 | 542 | try { |
543 | 543 | $sth = $this->db->prepare($query); |
544 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
545 | - } catch(PDOException $e) { |
|
544 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
545 | + } catch (PDOException $e) { |
|
546 | 546 | echo "error : ".$e->getMessage(); |
547 | 547 | } |
548 | 548 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | return array(); |
560 | 560 | } |
561 | 561 | } |
562 | - public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') { |
|
562 | + public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
563 | 563 | global $globalStatsFilters; |
564 | 564 | if ($filter_name == '') $filter_name = $this->filter_name; |
565 | 565 | if ($year == '' && $month == '') { |
@@ -567,41 +567,41 @@ discard block |
||
567 | 567 | else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
568 | 568 | try { |
569 | 569 | $sth = $this->db->prepare($query); |
570 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
571 | - } catch(PDOException $e) { |
|
570 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
571 | + } catch (PDOException $e) { |
|
572 | 572 | echo "error : ".$e->getMessage(); |
573 | 573 | } |
574 | 574 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
575 | 575 | } else $all = array(); |
576 | 576 | if (empty($all)) { |
577 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
577 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
578 | 578 | if ($filter_name != '') { |
579 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
579 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
580 | 580 | } |
581 | 581 | $Spotter = new Spotter($this->db); |
582 | 582 | //$all = $Spotter->countAllPilots($limit,0,'',$filters,$year,$month); |
583 | - $all = $Spotter->countAllPilots($limit,0,'',$filters); |
|
583 | + $all = $Spotter->countAllPilots($limit, 0, '', $filters); |
|
584 | 584 | } |
585 | 585 | return $all; |
586 | 586 | } |
587 | 587 | |
588 | - public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') { |
|
588 | + public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
589 | 589 | global $globalStatsFilters; |
590 | 590 | if ($filter_name == '') $filter_name = $this->filter_name; |
591 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
591 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
592 | 592 | $Spotter = new Spotter($this->db); |
593 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
593 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
594 | 594 | if ($year == '' && $month == '') { |
595 | 595 | $alliance_airlines = array(); |
596 | 596 | foreach ($airlines as $airline) { |
597 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
597 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
598 | 598 | } |
599 | - if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
600 | - else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
599 | + if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
600 | + else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
601 | 601 | try { |
602 | 602 | $sth = $this->db->prepare($query); |
603 | 603 | $sth->execute(array(':filter_name' => $filter_name)); |
604 | - } catch(PDOException $e) { |
|
604 | + } catch (PDOException $e) { |
|
605 | 605 | echo "error : ".$e->getMessage(); |
606 | 606 | } |
607 | 607 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -612,45 +612,45 @@ discard block |
||
612 | 612 | else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
613 | 613 | try { |
614 | 614 | $sth = $this->db->prepare($query); |
615 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
616 | - } catch(PDOException $e) { |
|
615 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
616 | + } catch (PDOException $e) { |
|
617 | 617 | echo "error : ".$e->getMessage(); |
618 | 618 | } |
619 | 619 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
620 | 620 | } else $all = array(); |
621 | 621 | } |
622 | 622 | if (empty($all)) { |
623 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
624 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
623 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
624 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
625 | 625 | } else { |
626 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
626 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
627 | 627 | } |
628 | 628 | if ($filter_name != '') { |
629 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
629 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
630 | 630 | } |
631 | 631 | $Spotter = new Spotter($this->db); |
632 | 632 | //$all = $Spotter->countAllOwners($limit,0,'',$filters,$year,$month); |
633 | - $all = $Spotter->countAllOwners($limit,0,'',$filters); |
|
633 | + $all = $Spotter->countAllOwners($limit, 0, '', $filters); |
|
634 | 634 | } |
635 | 635 | return $all; |
636 | 636 | } |
637 | - public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
637 | + public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
638 | 638 | global $globalStatsFilters; |
639 | 639 | if ($filter_name == '') $filter_name = $this->filter_name; |
640 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
640 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
641 | 641 | $Spotter = new Spotter($this->db); |
642 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
642 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
643 | 643 | if ($year == '' && $month == '') { |
644 | 644 | $alliance_airlines = array(); |
645 | 645 | foreach ($airlines as $airline) { |
646 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
646 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
647 | 647 | } |
648 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
649 | - else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
648 | + if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
649 | + else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
650 | 650 | try { |
651 | 651 | $sth = $this->db->prepare($query); |
652 | 652 | $sth->execute(array(':filter_name' => $filter_name)); |
653 | - } catch(PDOException $e) { |
|
653 | + } catch (PDOException $e) { |
|
654 | 654 | echo "error : ".$e->getMessage(); |
655 | 655 | } |
656 | 656 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -661,27 +661,27 @@ discard block |
||
661 | 661 | else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
662 | 662 | try { |
663 | 663 | $sth = $this->db->prepare($query); |
664 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
665 | - } catch(PDOException $e) { |
|
664 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
665 | + } catch (PDOException $e) { |
|
666 | 666 | echo "error : ".$e->getMessage(); |
667 | 667 | } |
668 | 668 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
669 | 669 | } else $all = array(); |
670 | 670 | } |
671 | 671 | if (empty($all)) { |
672 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
673 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
672 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
673 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
674 | 674 | } else { |
675 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
675 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
676 | 676 | } |
677 | 677 | if ($filter_name != '') { |
678 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
678 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
679 | 679 | } |
680 | 680 | $Spotter = new Spotter($this->db); |
681 | 681 | // $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters,$year,$month); |
682 | 682 | // $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters,$year,$month); |
683 | - $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters); |
|
684 | - $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters); |
|
683 | + $pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters); |
|
684 | + $dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters); |
|
685 | 685 | $all = array(); |
686 | 686 | foreach ($pall as $value) { |
687 | 687 | $icao = $value['airport_departure_icao']; |
@@ -697,27 +697,27 @@ discard block |
||
697 | 697 | foreach ($all as $key => $row) { |
698 | 698 | $count[$key] = $row['airport_departure_icao_count']; |
699 | 699 | } |
700 | - array_multisort($count,SORT_DESC,$all); |
|
700 | + array_multisort($count, SORT_DESC, $all); |
|
701 | 701 | } |
702 | 702 | return $all; |
703 | 703 | } |
704 | - public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
704 | + public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
705 | 705 | global $globalStatsFilters; |
706 | 706 | if ($filter_name == '') $filter_name = $this->filter_name; |
707 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
707 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
708 | 708 | $Spotter = new Spotter($this->db); |
709 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
709 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
710 | 710 | if ($year == '' && $month == '') { |
711 | 711 | $alliance_airlines = array(); |
712 | 712 | foreach ($airlines as $airline) { |
713 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
713 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
714 | 714 | } |
715 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
716 | - else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
715 | + if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
716 | + else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
717 | 717 | try { |
718 | 718 | $sth = $this->db->prepare($query); |
719 | 719 | $sth->execute(array(':filter_name' => $filter_name)); |
720 | - } catch(PDOException $e) { |
|
720 | + } catch (PDOException $e) { |
|
721 | 721 | echo "error : ".$e->getMessage(); |
722 | 722 | } |
723 | 723 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -728,27 +728,27 @@ discard block |
||
728 | 728 | else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
729 | 729 | try { |
730 | 730 | $sth = $this->db->prepare($query); |
731 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
732 | - } catch(PDOException $e) { |
|
731 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
732 | + } catch (PDOException $e) { |
|
733 | 733 | echo "error : ".$e->getMessage(); |
734 | 734 | } |
735 | 735 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
736 | 736 | } else $all = array(); |
737 | 737 | } |
738 | 738 | if (empty($all)) { |
739 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
740 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
739 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
740 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
741 | 741 | } else { |
742 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
742 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
743 | 743 | } |
744 | 744 | if ($filter_name != '') { |
745 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
745 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
746 | 746 | } |
747 | 747 | $Spotter = new Spotter($this->db); |
748 | 748 | // $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters,$year,$month); |
749 | 749 | // $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters,$year,$month); |
750 | - $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters); |
|
751 | - $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters); |
|
750 | + $pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters); |
|
751 | + $dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters); |
|
752 | 752 | $all = array(); |
753 | 753 | foreach ($pall as $value) { |
754 | 754 | $icao = $value['airport_arrival_icao']; |
@@ -764,26 +764,26 @@ discard block |
||
764 | 764 | foreach ($all as $key => $row) { |
765 | 765 | $count[$key] = $row['airport_arrival_icao_count']; |
766 | 766 | } |
767 | - array_multisort($count,SORT_DESC,$all); |
|
767 | + array_multisort($count, SORT_DESC, $all); |
|
768 | 768 | } |
769 | 769 | return $all; |
770 | 770 | } |
771 | - public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
|
771 | + public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') { |
|
772 | 772 | global $globalDBdriver, $globalStatsFilters; |
773 | 773 | if ($filter_name == '') $filter_name = $this->filter_name; |
774 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
774 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
775 | 775 | $Spotter = new Spotter($this->db); |
776 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
776 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
777 | 777 | $alliance_airlines = array(); |
778 | 778 | foreach ($airlines as $airline) { |
779 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
779 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
780 | 780 | } |
781 | 781 | if ($globalDBdriver == 'mysql') { |
782 | - if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
783 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
782 | + if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
783 | + else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
784 | 784 | } else { |
785 | - if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
786 | - else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
785 | + if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
786 | + else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
787 | 787 | } |
788 | 788 | $query_data = array(':filter_name' => $filter_name); |
789 | 789 | } else { |
@@ -794,23 +794,23 @@ discard block |
||
794 | 794 | if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
795 | 795 | else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
796 | 796 | } |
797 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
797 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
798 | 798 | } |
799 | 799 | try { |
800 | 800 | $sth = $this->db->prepare($query); |
801 | 801 | $sth->execute($query_data); |
802 | - } catch(PDOException $e) { |
|
802 | + } catch (PDOException $e) { |
|
803 | 803 | echo "error : ".$e->getMessage(); |
804 | 804 | } |
805 | 805 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
806 | 806 | if (empty($all)) { |
807 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
808 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
807 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
808 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
809 | 809 | } else { |
810 | 810 | $filters = array('airlines' => array($stats_airline)); |
811 | 811 | } |
812 | 812 | if ($filter_name != '') { |
813 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
813 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
814 | 814 | } |
815 | 815 | $Spotter = new Spotter($this->db); |
816 | 816 | $all = $Spotter->countAllMonthsLastYear($filters); |
@@ -818,57 +818,57 @@ discard block |
||
818 | 818 | return $all; |
819 | 819 | } |
820 | 820 | |
821 | - public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
|
821 | + public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') { |
|
822 | 822 | global $globalStatsFilters; |
823 | 823 | if ($filter_name == '') $filter_name = $this->filter_name; |
824 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
824 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
825 | 825 | $Spotter = new Spotter($this->db); |
826 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
826 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
827 | 827 | $alliance_airlines = array(); |
828 | 828 | foreach ($airlines as $airline) { |
829 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
829 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
830 | 830 | } |
831 | - $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
831 | + $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
832 | 832 | $query_data = array(':filter_name' => $filter_name); |
833 | 833 | } else { |
834 | 834 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
835 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
835 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
836 | 836 | } |
837 | 837 | try { |
838 | 838 | $sth = $this->db->prepare($query); |
839 | 839 | $sth->execute($query_data); |
840 | - } catch(PDOException $e) { |
|
840 | + } catch (PDOException $e) { |
|
841 | 841 | echo "error : ".$e->getMessage(); |
842 | 842 | } |
843 | 843 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
844 | 844 | if (empty($all)) { |
845 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
846 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
845 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
846 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
847 | 847 | } else { |
848 | 848 | $filters = array('airlines' => array($stats_airline)); |
849 | 849 | } |
850 | 850 | if ($filter_name != '') { |
851 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
851 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
852 | 852 | } |
853 | 853 | $Spotter = new Spotter($this->db); |
854 | 854 | $all = $Spotter->countAllDatesLastMonth($filters); |
855 | 855 | } |
856 | 856 | return $all; |
857 | 857 | } |
858 | - public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
|
858 | + public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') { |
|
859 | 859 | global $globalDBdriver, $globalStatsFilters; |
860 | 860 | if ($filter_name == '') $filter_name = $this->filter_name; |
861 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
861 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
862 | 862 | $Spotter = new Spotter($this->db); |
863 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
863 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
864 | 864 | $alliance_airlines = array(); |
865 | 865 | foreach ($airlines as $airline) { |
866 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
866 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
867 | 867 | } |
868 | 868 | if ($globalDBdriver == 'mysql') { |
869 | - $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
869 | + $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
870 | 870 | } else { |
871 | - $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
871 | + $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
872 | 872 | } |
873 | 873 | $query_data = array(':filter_name' => $filter_name); |
874 | 874 | } else { |
@@ -877,60 +877,60 @@ discard block |
||
877 | 877 | } else { |
878 | 878 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
879 | 879 | } |
880 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
880 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
881 | 881 | } |
882 | 882 | try { |
883 | 883 | $sth = $this->db->prepare($query); |
884 | 884 | $sth->execute($query_data); |
885 | - } catch(PDOException $e) { |
|
885 | + } catch (PDOException $e) { |
|
886 | 886 | echo "error : ".$e->getMessage(); |
887 | 887 | } |
888 | 888 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
889 | 889 | if (empty($all)) { |
890 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
891 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
890 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
891 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
892 | 892 | } else { |
893 | 893 | $filters = array('airlines' => array($stats_airline)); |
894 | 894 | } |
895 | 895 | if ($filter_name != '') { |
896 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
896 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
897 | 897 | } |
898 | 898 | $Spotter = new Spotter($this->db); |
899 | 899 | $all = $Spotter->countAllDatesLast7Days($filters); |
900 | 900 | } |
901 | 901 | return $all; |
902 | 902 | } |
903 | - public function countAllDates($stats_airline = '',$filter_name = '') { |
|
903 | + public function countAllDates($stats_airline = '', $filter_name = '') { |
|
904 | 904 | global $globalStatsFilters; |
905 | 905 | if ($filter_name == '') $filter_name = $this->filter_name; |
906 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
906 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
907 | 907 | $Spotter = new Spotter($this->db); |
908 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
908 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
909 | 909 | $alliance_airlines = array(); |
910 | 910 | foreach ($airlines as $airline) { |
911 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
911 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
912 | 912 | } |
913 | - $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date ORDER BY date_count DESC"; |
|
913 | + $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date ORDER BY date_count DESC"; |
|
914 | 914 | $query_data = array(':filter_name' => $filter_name); |
915 | 915 | } else { |
916 | 916 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date_count DESC"; |
917 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
917 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
918 | 918 | } |
919 | 919 | try { |
920 | 920 | $sth = $this->db->prepare($query); |
921 | 921 | $sth->execute($query_data); |
922 | - } catch(PDOException $e) { |
|
922 | + } catch (PDOException $e) { |
|
923 | 923 | echo "error : ".$e->getMessage(); |
924 | 924 | } |
925 | 925 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
926 | 926 | if (empty($all)) { |
927 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
928 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
927 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
928 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
929 | 929 | } else { |
930 | 930 | $filters = array('airlines' => array($stats_airline)); |
931 | 931 | } |
932 | 932 | if ($filter_name != '') { |
933 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
933 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
934 | 934 | } |
935 | 935 | $Spotter = new Spotter($this->db); |
936 | 936 | $all = $Spotter->countAllDates($filters); |
@@ -945,34 +945,34 @@ discard block |
||
945 | 945 | try { |
946 | 946 | $sth = $this->db->prepare($query); |
947 | 947 | $sth->execute($query_data); |
948 | - } catch(PDOException $e) { |
|
948 | + } catch (PDOException $e) { |
|
949 | 949 | echo "error : ".$e->getMessage(); |
950 | 950 | } |
951 | 951 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
952 | 952 | if (empty($all)) { |
953 | 953 | $filters = array(); |
954 | 954 | if ($filter_name != '') { |
955 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
955 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
956 | 956 | } |
957 | 957 | $Spotter = new Spotter($this->db); |
958 | 958 | $all = $Spotter->countAllDatesByAirlines($filters); |
959 | 959 | } |
960 | 960 | return $all; |
961 | 961 | } |
962 | - public function countAllMonths($stats_airline = '',$filter_name = '') { |
|
962 | + public function countAllMonths($stats_airline = '', $filter_name = '') { |
|
963 | 963 | global $globalStatsFilters, $globalDBdriver; |
964 | 964 | if ($filter_name == '') $filter_name = $this->filter_name; |
965 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
965 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
966 | 966 | $Spotter = new Spotter($this->db); |
967 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
967 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
968 | 968 | $alliance_airlines = array(); |
969 | 969 | foreach ($airlines as $airline) { |
970 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
970 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
971 | 971 | } |
972 | 972 | if ($globalDBdriver == 'mysql') { |
973 | - $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC"; |
|
973 | + $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC"; |
|
974 | 974 | } else { |
975 | - $query = "SELECT EXTRACT(YEAR FROM stats_date) AS year_name,EXTRACT(MONTH FROM stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC"; |
|
975 | + $query = "SELECT EXTRACT(YEAR FROM stats_date) AS year_name,EXTRACT(MONTH FROM stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC"; |
|
976 | 976 | } |
977 | 977 | $query_data = array(':filter_name' => $filter_name); |
978 | 978 | } else { |
@@ -986,18 +986,18 @@ discard block |
||
986 | 986 | try { |
987 | 987 | $sth = $this->db->prepare($query); |
988 | 988 | $sth->execute($query_data); |
989 | - } catch(PDOException $e) { |
|
989 | + } catch (PDOException $e) { |
|
990 | 990 | echo "error : ".$e->getMessage(); |
991 | 991 | } |
992 | 992 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
993 | 993 | if (empty($all)) { |
994 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
995 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
994 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
995 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
996 | 996 | } else { |
997 | 997 | $filters = array('airlines' => array($stats_airline)); |
998 | 998 | } |
999 | 999 | if ($filter_name != '') { |
1000 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1000 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1001 | 1001 | } |
1002 | 1002 | $Spotter = new Spotter($this->db); |
1003 | 1003 | $all = $Spotter->countAllMonths($filters); |
@@ -1014,7 +1014,7 @@ discard block |
||
1014 | 1014 | try { |
1015 | 1015 | $sth = $this->db->prepare($query); |
1016 | 1016 | $sth->execute(); |
1017 | - } catch(PDOException $e) { |
|
1017 | + } catch (PDOException $e) { |
|
1018 | 1018 | echo "error : ".$e->getMessage(); |
1019 | 1019 | } |
1020 | 1020 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1035,7 +1035,7 @@ discard block |
||
1035 | 1035 | try { |
1036 | 1036 | $sth = $this->db->prepare($query); |
1037 | 1037 | $sth->execute(); |
1038 | - } catch(PDOException $e) { |
|
1038 | + } catch (PDOException $e) { |
|
1039 | 1039 | echo "error : ".$e->getMessage(); |
1040 | 1040 | } |
1041 | 1041 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1053,32 +1053,32 @@ discard block |
||
1053 | 1053 | try { |
1054 | 1054 | $sth = $this->db->prepare($query); |
1055 | 1055 | $sth->execute(array(':filter_name' => $filter_name)); |
1056 | - } catch(PDOException $e) { |
|
1056 | + } catch (PDOException $e) { |
|
1057 | 1057 | echo "error : ".$e->getMessage(); |
1058 | 1058 | } |
1059 | 1059 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1060 | 1060 | if (empty($all)) { |
1061 | 1061 | $filters = array(); |
1062 | 1062 | if ($filter_name != '') { |
1063 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1063 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1064 | 1064 | } |
1065 | 1065 | $Spotter = new Spotter($this->db); |
1066 | 1066 | $all = $Spotter->countAllMilitaryMonths($filters); |
1067 | 1067 | } |
1068 | 1068 | return $all; |
1069 | 1069 | } |
1070 | - public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
|
1070 | + public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') { |
|
1071 | 1071 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
1072 | 1072 | if ($filter_name == '') $filter_name = $this->filter_name; |
1073 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1073 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1074 | 1074 | $Spotter = new Spotter($this->db); |
1075 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1075 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1076 | 1076 | $alliance_airlines = array(); |
1077 | 1077 | foreach ($airlines as $airline) { |
1078 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1078 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1079 | 1079 | } |
1080 | - if ($limit) $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1081 | - else $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1080 | + if ($limit) $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1081 | + else $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1082 | 1082 | $query_data = array(':filter_name' => $filter_name); |
1083 | 1083 | } else { |
1084 | 1084 | if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -1096,37 +1096,37 @@ discard block |
||
1096 | 1096 | try { |
1097 | 1097 | $sth = $this->db->prepare($query); |
1098 | 1098 | $sth->execute($query_data); |
1099 | - } catch(PDOException $e) { |
|
1099 | + } catch (PDOException $e) { |
|
1100 | 1100 | echo "error : ".$e->getMessage(); |
1101 | 1101 | } |
1102 | 1102 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1103 | 1103 | if (empty($all)) { |
1104 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1105 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1104 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1105 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1106 | 1106 | } else { |
1107 | 1107 | $filters = array('airlines' => array($stats_airline)); |
1108 | 1108 | } |
1109 | 1109 | if ($filter_name != '') { |
1110 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1110 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1111 | 1111 | } |
1112 | 1112 | $Spotter = new Spotter($this->db); |
1113 | - $all = $Spotter->countAllHours($orderby,$filters); |
|
1113 | + $all = $Spotter->countAllHours($orderby, $filters); |
|
1114 | 1114 | } |
1115 | 1115 | return $all; |
1116 | 1116 | } |
1117 | - public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
|
1117 | + public function countOverallFlights($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
1118 | 1118 | global $globalStatsFilters; |
1119 | 1119 | if ($filter_name == '') $filter_name = $this->filter_name; |
1120 | 1120 | if ($year == '') $year = date('Y'); |
1121 | - $all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1121 | + $all = $this->getSumStats('flights_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1122 | 1122 | if (empty($all)) { |
1123 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1124 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
1123 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1124 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
1125 | 1125 | } else { |
1126 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1126 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
1127 | 1127 | } |
1128 | 1128 | if ($filter_name != '') { |
1129 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1129 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1130 | 1130 | } |
1131 | 1131 | $Spotter = new Spotter($this->db); |
1132 | 1132 | //$all = $Spotter->countOverallFlights($filters,$year,$month); |
@@ -1134,16 +1134,16 @@ discard block |
||
1134 | 1134 | } |
1135 | 1135 | return $all; |
1136 | 1136 | } |
1137 | - public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') { |
|
1137 | + public function countOverallMilitaryFlights($filter_name = '', $year = '', $month = '') { |
|
1138 | 1138 | global $globalStatsFilters; |
1139 | 1139 | if ($filter_name == '') $filter_name = $this->filter_name; |
1140 | 1140 | if ($year == '') $year = date('Y'); |
1141 | - $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
|
1141 | + $all = $this->getSumStats('military_flights_bymonth', $year, '', $filter_name, $month); |
|
1142 | 1142 | if (empty($all)) { |
1143 | 1143 | $filters = array(); |
1144 | - $filters = array('year' => $year,'month' => $month); |
|
1144 | + $filters = array('year' => $year, 'month' => $month); |
|
1145 | 1145 | if ($filter_name != '') { |
1146 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1146 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1147 | 1147 | } |
1148 | 1148 | $Spotter = new Spotter($this->db); |
1149 | 1149 | //$all = $Spotter->countOverallMilitaryFlights($filters,$year,$month); |
@@ -1151,19 +1151,19 @@ discard block |
||
1151 | 1151 | } |
1152 | 1152 | return $all; |
1153 | 1153 | } |
1154 | - public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') { |
|
1154 | + public function countOverallArrival($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
1155 | 1155 | global $globalStatsFilters; |
1156 | 1156 | if ($filter_name == '') $filter_name = $this->filter_name; |
1157 | 1157 | if ($year == '') $year = date('Y'); |
1158 | - $all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1158 | + $all = $this->getSumStats('realarrivals_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1159 | 1159 | if (empty($all)) { |
1160 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1161 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
1160 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1161 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
1162 | 1162 | } else { |
1163 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1163 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
1164 | 1164 | } |
1165 | 1165 | if ($filter_name != '') { |
1166 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1166 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1167 | 1167 | } |
1168 | 1168 | $Spotter = new Spotter($this->db); |
1169 | 1169 | //$all = $Spotter->countOverallArrival($filters,$year,$month); |
@@ -1171,48 +1171,48 @@ discard block |
||
1171 | 1171 | } |
1172 | 1172 | return $all; |
1173 | 1173 | } |
1174 | - public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
|
1174 | + public function countOverallAircrafts($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
1175 | 1175 | global $globalStatsFilters; |
1176 | 1176 | if ($filter_name == '') $filter_name = $this->filter_name; |
1177 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1177 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1178 | 1178 | $Spotter = new Spotter($this->db); |
1179 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1179 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1180 | 1180 | if ($year == '' && $month == '') { |
1181 | 1181 | $alliance_airlines = array(); |
1182 | 1182 | foreach ($airlines as $airline) { |
1183 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1183 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1184 | 1184 | } |
1185 | - $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1185 | + $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1186 | 1186 | try { |
1187 | 1187 | $sth = $this->db->prepare($query); |
1188 | 1188 | $sth->execute(array(':filter_name' => $filter_name)); |
1189 | - } catch(PDOException $e) { |
|
1189 | + } catch (PDOException $e) { |
|
1190 | 1190 | echo "error : ".$e->getMessage(); |
1191 | 1191 | } |
1192 | 1192 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1193 | 1193 | $all = $result[0]['nb']; |
1194 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1194 | + } else $all = $this->getSumStats('aircrafts_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1195 | 1195 | } else { |
1196 | 1196 | if ($year == '' && $month == '') { |
1197 | 1197 | $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
1198 | 1198 | try { |
1199 | 1199 | $sth = $this->db->prepare($query); |
1200 | - $sth->execute(array(':filter_name' => $filter_name,':stats_airline' => $stats_airline)); |
|
1201 | - } catch(PDOException $e) { |
|
1200 | + $sth->execute(array(':filter_name' => $filter_name, ':stats_airline' => $stats_airline)); |
|
1201 | + } catch (PDOException $e) { |
|
1202 | 1202 | echo "error : ".$e->getMessage(); |
1203 | 1203 | } |
1204 | 1204 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1205 | 1205 | $all = $result[0]['nb']; |
1206 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1206 | + } else $all = $this->getSumStats('aircrafts_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1207 | 1207 | } |
1208 | 1208 | if (empty($all)) { |
1209 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1210 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
1209 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1210 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
1211 | 1211 | } else { |
1212 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1212 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
1213 | 1213 | } |
1214 | 1214 | if ($filter_name != '') { |
1215 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1215 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1216 | 1216 | } |
1217 | 1217 | $Spotter = new Spotter($this->db); |
1218 | 1218 | //$all = $Spotter->countOverallAircrafts($filters,$year,$month); |
@@ -1220,7 +1220,7 @@ discard block |
||
1220 | 1220 | } |
1221 | 1221 | return $all; |
1222 | 1222 | } |
1223 | - public function countOverallAirlines($filter_name = '',$year = '',$month = '') { |
|
1223 | + public function countOverallAirlines($filter_name = '', $year = '', $month = '') { |
|
1224 | 1224 | global $globalStatsFilters; |
1225 | 1225 | if ($filter_name == '') $filter_name = $this->filter_name; |
1226 | 1226 | if ($year == '' && $month == '') { |
@@ -1228,17 +1228,17 @@ discard block |
||
1228 | 1228 | try { |
1229 | 1229 | $sth = $this->db->prepare($query); |
1230 | 1230 | $sth->execute(array(':filter_name' => $filter_name)); |
1231 | - } catch(PDOException $e) { |
|
1231 | + } catch (PDOException $e) { |
|
1232 | 1232 | echo "error : ".$e->getMessage(); |
1233 | 1233 | } |
1234 | 1234 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1235 | 1235 | $all = $result[0]['nb_airline']; |
1236 | - } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
1236 | + } else $all = $this->getSumStats('airlines_bymonth', $year, '', $filter_name, $month); |
|
1237 | 1237 | if (empty($all)) { |
1238 | 1238 | $filters = array(); |
1239 | - $filters = array('year' => $year,'month' => $month); |
|
1239 | + $filters = array('year' => $year, 'month' => $month); |
|
1240 | 1240 | if ($filter_name != '') { |
1241 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1241 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1242 | 1242 | } |
1243 | 1243 | $Spotter = new Spotter($this->db); |
1244 | 1244 | //$all = $Spotter->countOverallAirlines($filters,$year,$month); |
@@ -1246,29 +1246,29 @@ discard block |
||
1246 | 1246 | } |
1247 | 1247 | return $all; |
1248 | 1248 | } |
1249 | - public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
|
1249 | + public function countOverallOwners($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
1250 | 1250 | global $globalStatsFilters; |
1251 | 1251 | if ($filter_name == '') $filter_name = $this->filter_name; |
1252 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1252 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1253 | 1253 | $Spotter = new Spotter($this->db); |
1254 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1254 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1255 | 1255 | if ($year == '' && $month == '') { |
1256 | 1256 | $alliance_airlines = array(); |
1257 | 1257 | foreach ($airlines as $airline) { |
1258 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1258 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1259 | 1259 | } |
1260 | - $query = "SELECT count(*) as nb FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1260 | + $query = "SELECT count(*) as nb FROM stats_owner WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1261 | 1261 | $query_values = array(':filter_name' => $filter_name); |
1262 | 1262 | try { |
1263 | 1263 | $sth = $this->db->prepare($query); |
1264 | 1264 | $sth->execute($query_values); |
1265 | - } catch(PDOException $e) { |
|
1265 | + } catch (PDOException $e) { |
|
1266 | 1266 | echo "error : ".$e->getMessage(); |
1267 | 1267 | } |
1268 | 1268 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1269 | 1269 | $all = $result[0]['nb']; |
1270 | 1270 | } else { |
1271 | - $all = $this->getSumStats('owners_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1271 | + $all = $this->getSumStats('owners_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1272 | 1272 | } |
1273 | 1273 | } else { |
1274 | 1274 | if ($year == '' && $month == '') { |
@@ -1277,23 +1277,23 @@ discard block |
||
1277 | 1277 | try { |
1278 | 1278 | $sth = $this->db->prepare($query); |
1279 | 1279 | $sth->execute($query_values); |
1280 | - } catch(PDOException $e) { |
|
1280 | + } catch (PDOException $e) { |
|
1281 | 1281 | echo "error : ".$e->getMessage(); |
1282 | 1282 | } |
1283 | 1283 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1284 | 1284 | $all = $result[0]['nb']; |
1285 | 1285 | } else { |
1286 | - $all = $this->getSumStats('owners_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1286 | + $all = $this->getSumStats('owners_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1287 | 1287 | } |
1288 | 1288 | } |
1289 | 1289 | if (empty($all)) { |
1290 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1291 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
1290 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1291 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
1292 | 1292 | } else { |
1293 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1293 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
1294 | 1294 | } |
1295 | 1295 | if ($filter_name != '') { |
1296 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1296 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1297 | 1297 | } |
1298 | 1298 | $Spotter = new Spotter($this->db); |
1299 | 1299 | //$all = $Spotter->countOverallOwners($filters,$year,$month); |
@@ -1301,7 +1301,7 @@ discard block |
||
1301 | 1301 | } |
1302 | 1302 | return $all; |
1303 | 1303 | } |
1304 | - public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
1304 | + public function countOverallPilots($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
1305 | 1305 | global $globalStatsFilters; |
1306 | 1306 | if ($filter_name == '') $filter_name = $this->filter_name; |
1307 | 1307 | //if ($year == '') $year = date('Y'); |
@@ -1311,18 +1311,18 @@ discard block |
||
1311 | 1311 | try { |
1312 | 1312 | $sth = $this->db->prepare($query); |
1313 | 1313 | $sth->execute($query_values); |
1314 | - } catch(PDOException $e) { |
|
1314 | + } catch (PDOException $e) { |
|
1315 | 1315 | echo "error : ".$e->getMessage(); |
1316 | 1316 | } |
1317 | 1317 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1318 | 1318 | $all = $result[0]['nb']; |
1319 | 1319 | } else { |
1320 | - $all = $this->getSumStats('pilots_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1320 | + $all = $this->getSumStats('pilots_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1321 | 1321 | } |
1322 | 1322 | if (empty($all)) { |
1323 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1323 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
1324 | 1324 | if ($filter_name != '') { |
1325 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1325 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1326 | 1326 | } |
1327 | 1327 | $Spotter = new Spotter($this->db); |
1328 | 1328 | //$all = $Spotter->countOverallPilots($filters,$year,$month); |
@@ -1331,104 +1331,104 @@ discard block |
||
1331 | 1331 | return $all; |
1332 | 1332 | } |
1333 | 1333 | |
1334 | - public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
|
1334 | + public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') { |
|
1335 | 1335 | if ($filter_name == '') $filter_name = $this->filter_name; |
1336 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1336 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1337 | 1337 | $Spotter = new Spotter($this->db); |
1338 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1338 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1339 | 1339 | $alliance_airlines = array(); |
1340 | 1340 | foreach ($airlines as $airline) { |
1341 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1341 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1342 | 1342 | } |
1343 | - $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY date"; |
|
1344 | - $query_values = array(':airport_icao' => $airport_icao,':filter_name' => $filter_name); |
|
1343 | + $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY date"; |
|
1344 | + $query_values = array(':airport_icao' => $airport_icao, ':filter_name' => $filter_name); |
|
1345 | 1345 | } else { |
1346 | 1346 | $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date"; |
1347 | - $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1347 | + $query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1348 | 1348 | } |
1349 | 1349 | try { |
1350 | 1350 | $sth = $this->db->prepare($query); |
1351 | 1351 | $sth->execute($query_values); |
1352 | - } catch(PDOException $e) { |
|
1352 | + } catch (PDOException $e) { |
|
1353 | 1353 | echo "error : ".$e->getMessage(); |
1354 | 1354 | } |
1355 | 1355 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1356 | 1356 | return $all; |
1357 | 1357 | } |
1358 | - public function getStats($type,$stats_airline = '', $filter_name = '') { |
|
1358 | + public function getStats($type, $stats_airline = '', $filter_name = '') { |
|
1359 | 1359 | if ($filter_name == '') $filter_name = $this->filter_name; |
1360 | 1360 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
1361 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1361 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1362 | 1362 | try { |
1363 | 1363 | $sth = $this->db->prepare($query); |
1364 | 1364 | $sth->execute($query_values); |
1365 | - } catch(PDOException $e) { |
|
1365 | + } catch (PDOException $e) { |
|
1366 | 1366 | echo "error : ".$e->getMessage(); |
1367 | 1367 | } |
1368 | 1368 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1369 | 1369 | return $all; |
1370 | 1370 | } |
1371 | - public function deleteStatsByType($type,$stats_airline = '', $filter_name = '') { |
|
1371 | + public function deleteStatsByType($type, $stats_airline = '', $filter_name = '') { |
|
1372 | 1372 | if ($filter_name == '') $filter_name = $this->filter_name; |
1373 | 1373 | $query = "DELETE FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
1374 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1374 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1375 | 1375 | try { |
1376 | 1376 | $sth = $this->db->prepare($query); |
1377 | 1377 | $sth->execute($query_values); |
1378 | - } catch(PDOException $e) { |
|
1378 | + } catch (PDOException $e) { |
|
1379 | 1379 | echo "error : ".$e->getMessage(); |
1380 | 1380 | } |
1381 | 1381 | } |
1382 | - public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
|
1382 | + public function getSumStats($type, $year, $stats_airline = '', $filter_name = '', $month = '') { |
|
1383 | 1383 | if ($filter_name == '') $filter_name = $this->filter_name; |
1384 | 1384 | global $globalArchiveMonths, $globalDBdriver; |
1385 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1385 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1386 | 1386 | $Spotter = new Spotter($this->db); |
1387 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1387 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1388 | 1388 | $alliance_airlines = array(); |
1389 | 1389 | foreach ($airlines as $airline) { |
1390 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1390 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1391 | 1391 | } |
1392 | 1392 | if ($globalDBdriver == 'mysql') { |
1393 | 1393 | if ($month == '') { |
1394 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1394 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1395 | 1395 | $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name); |
1396 | 1396 | } else { |
1397 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1398 | - $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name,':month' => $month); |
|
1397 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1398 | + $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name, ':month' => $month); |
|
1399 | 1399 | } |
1400 | 1400 | } else { |
1401 | 1401 | if ($month == '') { |
1402 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1402 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1403 | 1403 | $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name); |
1404 | 1404 | } else { |
1405 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1406 | - $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name,':month' => $month); |
|
1405 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1406 | + $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name, ':month' => $month); |
|
1407 | 1407 | } |
1408 | 1408 | } |
1409 | 1409 | } else { |
1410 | 1410 | if ($globalDBdriver == 'mysql') { |
1411 | 1411 | if ($month == '') { |
1412 | 1412 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
1413 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1413 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1414 | 1414 | } else { |
1415 | 1415 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
1416 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month); |
|
1416 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month); |
|
1417 | 1417 | } |
1418 | 1418 | } else { |
1419 | 1419 | if ($month == '') { |
1420 | 1420 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
1421 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1421 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1422 | 1422 | } else { |
1423 | 1423 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
1424 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month); |
|
1424 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month); |
|
1425 | 1425 | } |
1426 | 1426 | } |
1427 | 1427 | } |
1428 | 1428 | try { |
1429 | 1429 | $sth = $this->db->prepare($query); |
1430 | 1430 | $sth->execute($query_values); |
1431 | - } catch(PDOException $e) { |
|
1431 | + } catch (PDOException $e) { |
|
1432 | 1432 | echo "error : ".$e->getMessage(); |
1433 | 1433 | } |
1434 | 1434 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1437,17 +1437,17 @@ discard block |
||
1437 | 1437 | public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
1438 | 1438 | global $globalArchiveMonths, $globalDBdriver; |
1439 | 1439 | if ($filter_name == '') $filter_name = $this->filter_name; |
1440 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1440 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1441 | 1441 | $Spotter = new Spotter($this->db); |
1442 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1442 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1443 | 1443 | $alliance_airlines = array(); |
1444 | 1444 | foreach ($airlines as $airline) { |
1445 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1445 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1446 | 1446 | } |
1447 | 1447 | if ($globalDBdriver == 'mysql') { |
1448 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1448 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1449 | 1449 | } else { |
1450 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveMonths." MONTHS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1450 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveMonths." MONTHS' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1451 | 1451 | } |
1452 | 1452 | $query_values = array(':type' => $type, ':filter_name' => $filter_name); |
1453 | 1453 | } else { |
@@ -1461,7 +1461,7 @@ discard block |
||
1461 | 1461 | try { |
1462 | 1462 | $sth = $this->db->prepare($query); |
1463 | 1463 | $sth->execute($query_values); |
1464 | - } catch(PDOException $e) { |
|
1464 | + } catch (PDOException $e) { |
|
1465 | 1465 | echo "error : ".$e->getMessage(); |
1466 | 1466 | } |
1467 | 1467 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1470,17 +1470,17 @@ discard block |
||
1470 | 1470 | public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
1471 | 1471 | global $globalArchiveMonths, $globalDBdriver; |
1472 | 1472 | if ($filter_name == '') $filter_name = $this->filter_name; |
1473 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1473 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1474 | 1474 | $Spotter = new Spotter($this->db); |
1475 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1475 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1476 | 1476 | $alliance_airlines = array(); |
1477 | 1477 | foreach ($airlines as $airline) { |
1478 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1478 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1479 | 1479 | } |
1480 | 1480 | if ($globalDBdriver == 'mysql') { |
1481 | - $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1481 | + $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1482 | 1482 | } else { |
1483 | - $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1483 | + $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1484 | 1484 | } |
1485 | 1485 | } else { |
1486 | 1486 | if ($globalDBdriver == 'mysql') { |
@@ -1492,7 +1492,7 @@ discard block |
||
1492 | 1492 | try { |
1493 | 1493 | $sth = $this->db->prepare($query); |
1494 | 1494 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
1495 | - } catch(PDOException $e) { |
|
1495 | + } catch (PDOException $e) { |
|
1496 | 1496 | echo "error : ".$e->getMessage(); |
1497 | 1497 | } |
1498 | 1498 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1509,7 +1509,7 @@ discard block |
||
1509 | 1509 | try { |
1510 | 1510 | $sth = $this->db->prepare($query); |
1511 | 1511 | $sth->execute(array(':filter_name' => $filter_name)); |
1512 | - } catch(PDOException $e) { |
|
1512 | + } catch (PDOException $e) { |
|
1513 | 1513 | echo "error : ".$e->getMessage(); |
1514 | 1514 | } |
1515 | 1515 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1526,20 +1526,20 @@ discard block |
||
1526 | 1526 | try { |
1527 | 1527 | $sth = $this->db->prepare($query); |
1528 | 1528 | $sth->execute(array(':filter_name' => $filter_name)); |
1529 | - } catch(PDOException $e) { |
|
1529 | + } catch (PDOException $e) { |
|
1530 | 1530 | echo "error : ".$e->getMessage(); |
1531 | 1531 | } |
1532 | 1532 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1533 | 1533 | return $all[0]['total']; |
1534 | 1534 | } |
1535 | - public function getStatsOwner($owner_name,$filter_name = '') { |
|
1535 | + public function getStatsOwner($owner_name, $filter_name = '') { |
|
1536 | 1536 | global $globalArchiveMonths, $globalDBdriver; |
1537 | 1537 | if ($filter_name == '') $filter_name = $this->filter_name; |
1538 | 1538 | $query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name"; |
1539 | 1539 | try { |
1540 | 1540 | $sth = $this->db->prepare($query); |
1541 | - $sth->execute(array(':filter_name' => $filter_name,':owner_name' => $owner_name)); |
|
1542 | - } catch(PDOException $e) { |
|
1541 | + $sth->execute(array(':filter_name' => $filter_name, ':owner_name' => $owner_name)); |
|
1542 | + } catch (PDOException $e) { |
|
1543 | 1543 | echo "error : ".$e->getMessage(); |
1544 | 1544 | } |
1545 | 1545 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1557,20 +1557,20 @@ discard block |
||
1557 | 1557 | try { |
1558 | 1558 | $sth = $this->db->prepare($query); |
1559 | 1559 | $sth->execute(array(':filter_name' => $filter_name)); |
1560 | - } catch(PDOException $e) { |
|
1560 | + } catch (PDOException $e) { |
|
1561 | 1561 | echo "error : ".$e->getMessage(); |
1562 | 1562 | } |
1563 | 1563 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1564 | 1564 | return $all[0]['total']; |
1565 | 1565 | } |
1566 | - public function getStatsPilot($pilot,$filter_name = '') { |
|
1566 | + public function getStatsPilot($pilot, $filter_name = '') { |
|
1567 | 1567 | global $globalArchiveMonths, $globalDBdriver; |
1568 | 1568 | if ($filter_name == '') $filter_name = $this->filter_name; |
1569 | 1569 | $query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)"; |
1570 | 1570 | try { |
1571 | 1571 | $sth = $this->db->prepare($query); |
1572 | - $sth->execute(array(':filter_name' => $filter_name,':pilot' => $pilot)); |
|
1573 | - } catch(PDOException $e) { |
|
1572 | + $sth->execute(array(':filter_name' => $filter_name, ':pilot' => $pilot)); |
|
1573 | + } catch (PDOException $e) { |
|
1574 | 1574 | echo "error : ".$e->getMessage(); |
1575 | 1575 | } |
1576 | 1576 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1578,7 +1578,7 @@ discard block |
||
1578 | 1578 | else return 0; |
1579 | 1579 | } |
1580 | 1580 | |
1581 | - public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
1581 | + public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
1582 | 1582 | global $globalDBdriver; |
1583 | 1583 | if ($filter_name == '') $filter_name = $this->filter_name; |
1584 | 1584 | if ($globalDBdriver == 'mysql') { |
@@ -1586,15 +1586,15 @@ discard block |
||
1586 | 1586 | } else { |
1587 | 1587 | $query = "UPDATE stats SET cnt = :cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1588 | 1588 | } |
1589 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1589 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1590 | 1590 | try { |
1591 | 1591 | $sth = $this->db->prepare($query); |
1592 | 1592 | $sth->execute($query_values); |
1593 | - } catch(PDOException $e) { |
|
1593 | + } catch (PDOException $e) { |
|
1594 | 1594 | return "error : ".$e->getMessage(); |
1595 | 1595 | } |
1596 | 1596 | } |
1597 | - public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
1597 | + public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
1598 | 1598 | global $globalDBdriver; |
1599 | 1599 | if ($filter_name == '') $filter_name = $this->filter_name; |
1600 | 1600 | if ($globalDBdriver == 'mysql') { |
@@ -1603,11 +1603,11 @@ discard block |
||
1603 | 1603 | //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
1604 | 1604 | $query = "UPDATE stats SET cnt = cnt+:cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1605 | 1605 | } |
1606 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1606 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1607 | 1607 | try { |
1608 | 1608 | $sth = $this->db->prepare($query); |
1609 | 1609 | $sth->execute($query_values); |
1610 | - } catch(PDOException $e) { |
|
1610 | + } catch (PDOException $e) { |
|
1611 | 1611 | return "error : ".$e->getMessage(); |
1612 | 1612 | } |
1613 | 1613 | } |
@@ -1631,75 +1631,75 @@ discard block |
||
1631 | 1631 | } |
1632 | 1632 | */ |
1633 | 1633 | |
1634 | - public function getStatsSource($stats_type,$year = '',$month = '',$day = '') { |
|
1634 | + public function getStatsSource($stats_type, $year = '', $month = '', $day = '') { |
|
1635 | 1635 | global $globalDBdriver; |
1636 | 1636 | $query = "SELECT * FROM stats_source WHERE stats_type = :stats_type"; |
1637 | 1637 | $query_values = array(); |
1638 | 1638 | if ($globalDBdriver == 'mysql') { |
1639 | 1639 | if ($year != '') { |
1640 | 1640 | $query .= ' AND YEAR(stats_date) = :year'; |
1641 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1641 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1642 | 1642 | } |
1643 | 1643 | if ($month != '') { |
1644 | 1644 | $query .= ' AND MONTH(stats_date) = :month'; |
1645 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1645 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1646 | 1646 | } |
1647 | 1647 | if ($day != '') { |
1648 | 1648 | $query .= ' AND DAY(stats_date) = :day'; |
1649 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1649 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1650 | 1650 | } |
1651 | 1651 | } else { |
1652 | 1652 | if ($year != '') { |
1653 | 1653 | $query .= ' AND EXTRACT(YEAR FROM stats_date) = :year'; |
1654 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1654 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1655 | 1655 | } |
1656 | 1656 | if ($month != '') { |
1657 | 1657 | $query .= ' AND EXTRACT(MONTH FROM stats_date) = :month'; |
1658 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1658 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1659 | 1659 | } |
1660 | 1660 | if ($day != '') { |
1661 | 1661 | $query .= ' AND EXTRACT(DAY FROM stats_date) = :day'; |
1662 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1662 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1663 | 1663 | } |
1664 | 1664 | } |
1665 | 1665 | $query .= " ORDER BY source_name"; |
1666 | - $query_values = array_merge($query_values,array(':stats_type' => $stats_type)); |
|
1666 | + $query_values = array_merge($query_values, array(':stats_type' => $stats_type)); |
|
1667 | 1667 | try { |
1668 | 1668 | $sth = $this->db->prepare($query); |
1669 | 1669 | $sth->execute($query_values); |
1670 | - } catch(PDOException $e) { |
|
1670 | + } catch (PDOException $e) { |
|
1671 | 1671 | echo "error : ".$e->getMessage(); |
1672 | 1672 | } |
1673 | 1673 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1674 | 1674 | return $all; |
1675 | 1675 | } |
1676 | 1676 | |
1677 | - public function addStatSource($data,$source_name,$stats_type,$date) { |
|
1677 | + public function addStatSource($data, $source_name, $stats_type, $date) { |
|
1678 | 1678 | global $globalDBdriver; |
1679 | 1679 | if ($globalDBdriver == 'mysql') { |
1680 | 1680 | $query = "INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) VALUES (:data,:source_name,:stats_type,:stats_date) ON DUPLICATE KEY UPDATE source_data = :data"; |
1681 | 1681 | } else { |
1682 | 1682 | $query = "UPDATE stats_source SET source_data = :data WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type; INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) SELECT :data,:source_name,:stats_type,:stats_date WHERE NOT EXISTS (SELECT 1 FROM stats_source WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type);"; |
1683 | 1683 | } |
1684 | - $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
1684 | + $query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type); |
|
1685 | 1685 | try { |
1686 | 1686 | $sth = $this->db->prepare($query); |
1687 | 1687 | $sth->execute($query_values); |
1688 | - } catch(PDOException $e) { |
|
1688 | + } catch (PDOException $e) { |
|
1689 | 1689 | return "error : ".$e->getMessage(); |
1690 | 1690 | } |
1691 | 1691 | } |
1692 | - public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
|
1692 | + public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') { |
|
1693 | 1693 | $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
1694 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1694 | + $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1695 | 1695 | try { |
1696 | 1696 | $sth = $this->db->prepare($query); |
1697 | 1697 | $sth->execute($query_values); |
1698 | - } catch(PDOException $e) { |
|
1698 | + } catch (PDOException $e) { |
|
1699 | 1699 | return "error : ".$e->getMessage(); |
1700 | 1700 | } |
1701 | 1701 | } |
1702 | - public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '',$reset = false) { |
|
1702 | + public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
1703 | 1703 | global $globalDBdriver; |
1704 | 1704 | if ($globalDBdriver == 'mysql') { |
1705 | 1705 | if ($reset) { |
@@ -1714,15 +1714,15 @@ discard block |
||
1714 | 1714 | $query = "UPDATE stats_registration SET cnt = cnt+:cnt WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:registration,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_registration WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1715 | 1715 | } |
1716 | 1716 | } |
1717 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1717 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1718 | 1718 | try { |
1719 | 1719 | $sth = $this->db->prepare($query); |
1720 | 1720 | $sth->execute($query_values); |
1721 | - } catch(PDOException $e) { |
|
1721 | + } catch (PDOException $e) { |
|
1722 | 1722 | return "error : ".$e->getMessage(); |
1723 | 1723 | } |
1724 | 1724 | } |
1725 | - public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '', $reset = false) { |
|
1725 | + public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1726 | 1726 | global $globalDBdriver; |
1727 | 1727 | if ($globalDBdriver == 'mysql') { |
1728 | 1728 | if ($reset) { |
@@ -1737,15 +1737,15 @@ discard block |
||
1737 | 1737 | $query = "UPDATE stats_callsign SET cnt = cnt+:cnt WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name; INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) SELECT :callsign_icao,:airline_icao,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_callsign WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name);"; |
1738 | 1738 | } |
1739 | 1739 | } |
1740 | - $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1740 | + $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1741 | 1741 | try { |
1742 | 1742 | $sth = $this->db->prepare($query); |
1743 | 1743 | $sth->execute($query_values); |
1744 | - } catch(PDOException $e) { |
|
1744 | + } catch (PDOException $e) { |
|
1745 | 1745 | return "error : ".$e->getMessage(); |
1746 | 1746 | } |
1747 | 1747 | } |
1748 | - public function addStatCountry($iso2,$iso3,$name,$cnt,$airline_icao = '',$filter_name = '',$reset = false) { |
|
1748 | + public function addStatCountry($iso2, $iso3, $name, $cnt, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1749 | 1749 | global $globalDBdriver; |
1750 | 1750 | if ($globalDBdriver == 'mysql') { |
1751 | 1751 | if ($reset) { |
@@ -1760,15 +1760,15 @@ discard block |
||
1760 | 1760 | $query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name AND stats_airline = :airline; INSERT INTO stats_country (iso2,iso3,name,cnt,stats_airline,filter_name) SELECT :iso2,:iso3,:name,:cnt,:airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name AND stats_airline = :airline);"; |
1761 | 1761 | } |
1762 | 1762 | } |
1763 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name,':airline' => $airline_icao); |
|
1763 | + $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name, ':airline' => $airline_icao); |
|
1764 | 1764 | try { |
1765 | 1765 | $sth = $this->db->prepare($query); |
1766 | 1766 | $sth->execute($query_values); |
1767 | - } catch(PDOException $e) { |
|
1767 | + } catch (PDOException $e) { |
|
1768 | 1768 | return "error : ".$e->getMessage(); |
1769 | 1769 | } |
1770 | 1770 | } |
1771 | - public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
1771 | + public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
1772 | 1772 | global $globalDBdriver; |
1773 | 1773 | if ($globalDBdriver == 'mysql') { |
1774 | 1774 | if ($reset) { |
@@ -1783,15 +1783,15 @@ discard block |
||
1783 | 1783 | $query = "UPDATE stats_aircraft SET cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, filter_name = :filter_name WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_aircraft WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1784 | 1784 | } |
1785 | 1785 | } |
1786 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1786 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':aircraft_name' => $aircraft_name, ':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1787 | 1787 | try { |
1788 | 1788 | $sth = $this->db->prepare($query); |
1789 | 1789 | $sth->execute($query_values); |
1790 | - } catch(PDOException $e) { |
|
1790 | + } catch (PDOException $e) { |
|
1791 | 1791 | return "error : ".$e->getMessage(); |
1792 | 1792 | } |
1793 | 1793 | } |
1794 | - public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '', $reset = false) { |
|
1794 | + public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '', $reset = false) { |
|
1795 | 1795 | global $globalDBdriver; |
1796 | 1796 | if ($globalDBdriver == 'mysql') { |
1797 | 1797 | if ($reset) { |
@@ -1806,15 +1806,15 @@ discard block |
||
1806 | 1806 | $query = "UPDATE stats_airline SET cnt = cnt+:cnt WHERE airline_icao = :airline_icao AND filter_name = :filter_name; INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) SELECT :airline_icao,:airline_name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airline WHERE airline_icao = :airline_icao AND filter_name = :filter_name);"; |
1807 | 1807 | } |
1808 | 1808 | } |
1809 | - $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
1809 | + $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1810 | 1810 | try { |
1811 | 1811 | $sth = $this->db->prepare($query); |
1812 | 1812 | $sth->execute($query_values); |
1813 | - } catch(PDOException $e) { |
|
1813 | + } catch (PDOException $e) { |
|
1814 | 1814 | return "error : ".$e->getMessage(); |
1815 | 1815 | } |
1816 | 1816 | } |
1817 | - public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '', $reset = false) { |
|
1817 | + public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '', $reset = false) { |
|
1818 | 1818 | global $globalDBdriver; |
1819 | 1819 | if ($globalDBdriver == 'mysql') { |
1820 | 1820 | if ($reset) { |
@@ -1829,15 +1829,15 @@ discard block |
||
1829 | 1829 | $query = "UPDATE stats_owner SET cnt = cnt+:cnt WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) SELECT :owner_name,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_owner WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1830 | 1830 | } |
1831 | 1831 | } |
1832 | - $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1832 | + $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1833 | 1833 | try { |
1834 | 1834 | $sth = $this->db->prepare($query); |
1835 | 1835 | $sth->execute($query_values); |
1836 | - } catch(PDOException $e) { |
|
1836 | + } catch (PDOException $e) { |
|
1837 | 1837 | return "error : ".$e->getMessage(); |
1838 | 1838 | } |
1839 | 1839 | } |
1840 | - public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '',$reset = false) { |
|
1840 | + public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '', $format_source = '', $reset = false) { |
|
1841 | 1841 | global $globalDBdriver; |
1842 | 1842 | if ($globalDBdriver == 'mysql') { |
1843 | 1843 | if ($reset) { |
@@ -1852,15 +1852,15 @@ discard block |
||
1852 | 1852 | $query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name,format_source) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name,:format_source WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source);"; |
1853 | 1853 | } |
1854 | 1854 | } |
1855 | - $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name,':format_source' => $format_source); |
|
1855 | + $query_values = array(':pilot_id' => $pilot_id, ':cnt' => $cnt, ':pilot_name' => $pilot_name, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':format_source' => $format_source); |
|
1856 | 1856 | try { |
1857 | 1857 | $sth = $this->db->prepare($query); |
1858 | 1858 | $sth->execute($query_values); |
1859 | - } catch(PDOException $e) { |
|
1859 | + } catch (PDOException $e) { |
|
1860 | 1860 | return "error : ".$e->getMessage(); |
1861 | 1861 | } |
1862 | 1862 | } |
1863 | - public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '',$reset = false) { |
|
1863 | + public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1864 | 1864 | global $globalDBdriver; |
1865 | 1865 | if ($airport_icao != '') { |
1866 | 1866 | if ($globalDBdriver == 'mysql') { |
@@ -1876,16 +1876,16 @@ discard block |
||
1876 | 1876 | $query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; |
1877 | 1877 | } |
1878 | 1878 | } |
1879 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1879 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1880 | 1880 | try { |
1881 | 1881 | $sth = $this->db->prepare($query); |
1882 | 1882 | $sth->execute($query_values); |
1883 | - } catch(PDOException $e) { |
|
1883 | + } catch (PDOException $e) { |
|
1884 | 1884 | return "error : ".$e->getMessage(); |
1885 | 1885 | } |
1886 | 1886 | } |
1887 | 1887 | } |
1888 | - public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
|
1888 | + public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') { |
|
1889 | 1889 | global $globalDBdriver; |
1890 | 1890 | if ($airport_icao != '') { |
1891 | 1891 | if ($globalDBdriver == 'mysql') { |
@@ -1893,16 +1893,16 @@ discard block |
||
1893 | 1893 | } else { |
1894 | 1894 | $query = "UPDATE stats_airport SET departure = :departure WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1895 | 1895 | } |
1896 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1896 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1897 | 1897 | try { |
1898 | 1898 | $sth = $this->db->prepare($query); |
1899 | 1899 | $sth->execute($query_values); |
1900 | - } catch(PDOException $e) { |
|
1900 | + } catch (PDOException $e) { |
|
1901 | 1901 | return "error : ".$e->getMessage(); |
1902 | 1902 | } |
1903 | 1903 | } |
1904 | 1904 | } |
1905 | - public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '',$reset = false) { |
|
1905 | + public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1906 | 1906 | global $globalDBdriver; |
1907 | 1907 | if ($airport_icao != '') { |
1908 | 1908 | if ($globalDBdriver == 'mysql') { |
@@ -1918,16 +1918,16 @@ discard block |
||
1918 | 1918 | $query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; |
1919 | 1919 | } |
1920 | 1920 | } |
1921 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1921 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1922 | 1922 | try { |
1923 | 1923 | $sth = $this->db->prepare($query); |
1924 | 1924 | $sth->execute($query_values); |
1925 | - } catch(PDOException $e) { |
|
1925 | + } catch (PDOException $e) { |
|
1926 | 1926 | return "error : ".$e->getMessage(); |
1927 | 1927 | } |
1928 | 1928 | } |
1929 | 1929 | } |
1930 | - public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
|
1930 | + public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') { |
|
1931 | 1931 | global $globalDBdriver; |
1932 | 1932 | if ($airport_icao != '') { |
1933 | 1933 | if ($globalDBdriver == 'mysql') { |
@@ -1935,11 +1935,11 @@ discard block |
||
1935 | 1935 | } else { |
1936 | 1936 | $query = "UPDATE stats_airport SET arrival = :arrival WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1937 | 1937 | } |
1938 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival, ':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1938 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1939 | 1939 | try { |
1940 | 1940 | $sth = $this->db->prepare($query); |
1941 | 1941 | $sth->execute($query_values); |
1942 | - } catch(PDOException $e) { |
|
1942 | + } catch (PDOException $e) { |
|
1943 | 1943 | return "error : ".$e->getMessage(); |
1944 | 1944 | } |
1945 | 1945 | } |
@@ -1951,7 +1951,7 @@ discard block |
||
1951 | 1951 | try { |
1952 | 1952 | $sth = $this->db->prepare($query); |
1953 | 1953 | $sth->execute($query_values); |
1954 | - } catch(PDOException $e) { |
|
1954 | + } catch (PDOException $e) { |
|
1955 | 1955 | return "error : ".$e->getMessage(); |
1956 | 1956 | } |
1957 | 1957 | } |
@@ -1961,7 +1961,7 @@ discard block |
||
1961 | 1961 | try { |
1962 | 1962 | $sth = $this->db->prepare($query); |
1963 | 1963 | $sth->execute($query_values); |
1964 | - } catch(PDOException $e) { |
|
1964 | + } catch (PDOException $e) { |
|
1965 | 1965 | return "error : ".$e->getMessage(); |
1966 | 1966 | } |
1967 | 1967 | } |
@@ -1971,13 +1971,13 @@ discard block |
||
1971 | 1971 | try { |
1972 | 1972 | $sth = $this->db->prepare($query); |
1973 | 1973 | $sth->execute($query_values); |
1974 | - } catch(PDOException $e) { |
|
1974 | + } catch (PDOException $e) { |
|
1975 | 1975 | return "error : ".$e->getMessage(); |
1976 | 1976 | } |
1977 | 1977 | } |
1978 | 1978 | |
1979 | 1979 | public function addOldStats() { |
1980 | - global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear, $globalAccidents; |
|
1980 | + global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters, $globalDeleteLastYearStats, $globalStatsReset, $globalStatsResetYear, $globalAccidents; |
|
1981 | 1981 | $Common = new Common(); |
1982 | 1982 | $Connection = new Connection(); |
1983 | 1983 | date_default_timezone_set('UTC'); |
@@ -1995,41 +1995,41 @@ discard block |
||
1995 | 1995 | $Spotter = new Spotter($this->db); |
1996 | 1996 | |
1997 | 1997 | if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
1998 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
|
1998 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day); |
|
1999 | 1999 | foreach ($alldata as $number) { |
2000 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset); |
|
2000 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', '', $reset); |
|
2001 | 2001 | } |
2002 | 2002 | if ($globalDebug) echo 'Count all airlines...'."\n"; |
2003 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
|
2003 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day); |
|
2004 | 2004 | foreach ($alldata as $number) { |
2005 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset); |
|
2005 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], '', $reset); |
|
2006 | 2006 | } |
2007 | 2007 | if ($globalDebug) echo 'Count all registrations...'."\n"; |
2008 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
|
2008 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day); |
|
2009 | 2009 | foreach ($alldata as $number) { |
2010 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset); |
|
2010 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', '', $reset); |
|
2011 | 2011 | } |
2012 | 2012 | if ($globalDebug) echo 'Count all callsigns...'."\n"; |
2013 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
|
2013 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day); |
|
2014 | 2014 | foreach ($alldata as $number) { |
2015 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
|
2015 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset); |
|
2016 | 2016 | } |
2017 | 2017 | if ($globalDebug) echo 'Count all owners...'."\n"; |
2018 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
|
2018 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day); |
|
2019 | 2019 | foreach ($alldata as $number) { |
2020 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset); |
|
2020 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], '', '', $reset); |
|
2021 | 2021 | } |
2022 | 2022 | if ($globalDebug) echo 'Count all pilots...'."\n"; |
2023 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
|
2023 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day); |
|
2024 | 2024 | foreach ($alldata as $number) { |
2025 | 2025 | if ($number['pilot_id'] == 0 || $number['pilot_id'] == '') $number['pilot_id'] = $number['pilot_name']; |
2026 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset); |
|
2026 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', '', $number['format_source'], $reset); |
|
2027 | 2027 | } |
2028 | 2028 | |
2029 | 2029 | if ($globalDebug) echo 'Count all departure airports...'."\n"; |
2030 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
|
2030 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day); |
|
2031 | 2031 | if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
2032 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
2032 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day); |
|
2033 | 2033 | if ($globalDebug) echo 'Order departure airports...'."\n"; |
2034 | 2034 | $alldata = array(); |
2035 | 2035 | |
@@ -2047,14 +2047,14 @@ discard block |
||
2047 | 2047 | foreach ($alldata as $key => $row) { |
2048 | 2048 | $count[$key] = $row['airport_departure_icao_count']; |
2049 | 2049 | } |
2050 | - array_multisort($count,SORT_DESC,$alldata); |
|
2050 | + array_multisort($count, SORT_DESC, $alldata); |
|
2051 | 2051 | foreach ($alldata as $number) { |
2052 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'','',$reset); |
|
2052 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', '', $reset); |
|
2053 | 2053 | } |
2054 | 2054 | if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
2055 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
|
2055 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day); |
|
2056 | 2056 | if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
2057 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
2057 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day); |
|
2058 | 2058 | if ($globalDebug) echo 'Order arrival airports...'."\n"; |
2059 | 2059 | $alldata = array(); |
2060 | 2060 | foreach ($pall as $value) { |
@@ -2071,18 +2071,18 @@ discard block |
||
2071 | 2071 | foreach ($alldata as $key => $row) { |
2072 | 2072 | $count[$key] = $row['airport_arrival_icao_count']; |
2073 | 2073 | } |
2074 | - array_multisort($count,SORT_DESC,$alldata); |
|
2074 | + array_multisort($count, SORT_DESC, $alldata); |
|
2075 | 2075 | foreach ($alldata as $number) { |
2076 | - echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset); |
|
2076 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', '', $reset); |
|
2077 | 2077 | } |
2078 | 2078 | if ($Connection->tableExists('countries')) { |
2079 | 2079 | if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
2080 | 2080 | //$SpotterArchive = new SpotterArchive(); |
2081 | 2081 | //$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
2082 | 2082 | $Spotter = new Spotter($this->db); |
2083 | - $alldata = $Spotter->countAllFlightOverCountries(false,0,$last_update_day); |
|
2083 | + $alldata = $Spotter->countAllFlightOverCountries(false, 0, $last_update_day); |
|
2084 | 2084 | foreach ($alldata as $number) { |
2085 | - $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],'','',$reset); |
|
2085 | + $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], '', '', $reset); |
|
2086 | 2086 | } |
2087 | 2087 | } |
2088 | 2088 | |
@@ -2092,12 +2092,12 @@ discard block |
||
2092 | 2092 | $this->deleteStatsByType('fatalities_byyear'); |
2093 | 2093 | $alldata = $Accident->countFatalitiesByYear(); |
2094 | 2094 | foreach ($alldata as $number) { |
2095 | - $this->addStat('fatalities_byyear',$number['count'],date('Y-m-d H:i:s',mktime(0,0,0,1,1,$number['year']))); |
|
2095 | + $this->addStat('fatalities_byyear', $number['count'], date('Y-m-d H:i:s', mktime(0, 0, 0, 1, 1, $number['year']))); |
|
2096 | 2096 | } |
2097 | 2097 | $this->deleteStatsByType('fatalities_bymonth'); |
2098 | 2098 | $alldata = $Accident->countFatalitiesLast12Months(); |
2099 | 2099 | foreach ($alldata as $number) { |
2100 | - $this->addStat('fatalities_bymonth',$number['count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month'],1,$number['year']))); |
|
2100 | + $this->addStat('fatalities_bymonth', $number['count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month'], 1, $number['year']))); |
|
2101 | 2101 | } |
2102 | 2102 | } |
2103 | 2103 | |
@@ -2113,37 +2113,37 @@ discard block |
||
2113 | 2113 | $lastyear = false; |
2114 | 2114 | foreach ($alldata as $number) { |
2115 | 2115 | if ($number['year_name'] != date('Y')) $lastyear = true; |
2116 | - $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
2116 | + $this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
2117 | 2117 | } |
2118 | 2118 | if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
2119 | 2119 | $alldata = $Spotter->countAllMilitaryMonths($filter_last_month); |
2120 | 2120 | foreach ($alldata as $number) { |
2121 | - $this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
2121 | + $this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
2122 | 2122 | } |
2123 | 2123 | if ($globalDebug) echo 'Count all owners by months...'."\n"; |
2124 | 2124 | $alldata = $Spotter->countAllMonthsOwners($filter_last_month); |
2125 | 2125 | foreach ($alldata as $number) { |
2126 | - $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
2126 | + $this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
2127 | 2127 | } |
2128 | 2128 | if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
2129 | 2129 | $alldata = $Spotter->countAllMonthsPilots($filter_last_month); |
2130 | 2130 | foreach ($alldata as $number) { |
2131 | - $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
2131 | + $this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
2132 | 2132 | } |
2133 | 2133 | if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
2134 | 2134 | $alldata = $Spotter->countAllMonthsAirlines($filter_last_month); |
2135 | 2135 | foreach ($alldata as $number) { |
2136 | - $this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
2136 | + $this->addStat('airlines_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
2137 | 2137 | } |
2138 | 2138 | if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
2139 | 2139 | $alldata = $Spotter->countAllMonthsAircrafts($filter_last_month); |
2140 | 2140 | foreach ($alldata as $number) { |
2141 | - $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
2141 | + $this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
2142 | 2142 | } |
2143 | 2143 | if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
2144 | 2144 | $alldata = $Spotter->countAllMonthsRealArrivals($filter_last_month); |
2145 | 2145 | foreach ($alldata as $number) { |
2146 | - $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
2146 | + $this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
2147 | 2147 | } |
2148 | 2148 | if ($globalDebug) echo 'Airports data...'."\n"; |
2149 | 2149 | if ($globalDebug) echo '...Departure'."\n"; |
@@ -2188,7 +2188,7 @@ discard block |
||
2188 | 2188 | } |
2189 | 2189 | $alldata = $pall; |
2190 | 2190 | foreach ($alldata as $number) { |
2191 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']); |
|
2191 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']); |
|
2192 | 2192 | } |
2193 | 2193 | echo '...Arrival'."\n"; |
2194 | 2194 | $pall = $Spotter->getLast7DaysAirportsArrival(); |
@@ -2230,7 +2230,7 @@ discard block |
||
2230 | 2230 | } |
2231 | 2231 | $alldata = $pall; |
2232 | 2232 | foreach ($alldata as $number) { |
2233 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']); |
|
2233 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']); |
|
2234 | 2234 | } |
2235 | 2235 | |
2236 | 2236 | echo 'Flights data...'."\n"; |
@@ -2238,28 +2238,28 @@ discard block |
||
2238 | 2238 | echo '-> countAllDatesLastMonth...'."\n"; |
2239 | 2239 | $alldata = $Spotter->countAllDatesLastMonth($filter_last_month); |
2240 | 2240 | foreach ($alldata as $number) { |
2241 | - $this->addStatFlight('month',$number['date_name'],$number['date_count']); |
|
2241 | + $this->addStatFlight('month', $number['date_name'], $number['date_count']); |
|
2242 | 2242 | } |
2243 | 2243 | echo '-> countAllDates...'."\n"; |
2244 | 2244 | $previousdata = $this->countAllDates(); |
2245 | 2245 | $previousdatabyairlines = $this->countAllDatesByAirlines(); |
2246 | 2246 | $this->deleteStatFlight('date'); |
2247 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter_last_month)); |
|
2247 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter_last_month)); |
|
2248 | 2248 | $values = array(); |
2249 | 2249 | foreach ($alldata as $cnt) { |
2250 | 2250 | $values[] = $cnt['date_count']; |
2251 | 2251 | } |
2252 | - array_multisort($values,SORT_DESC,$alldata); |
|
2253 | - array_splice($alldata,11); |
|
2252 | + array_multisort($values, SORT_DESC, $alldata); |
|
2253 | + array_splice($alldata, 11); |
|
2254 | 2254 | foreach ($alldata as $number) { |
2255 | - $this->addStatFlight('date',$number['date_name'],$number['date_count']); |
|
2255 | + $this->addStatFlight('date', $number['date_name'], $number['date_count']); |
|
2256 | 2256 | } |
2257 | 2257 | |
2258 | 2258 | $this->deleteStatFlight('hour'); |
2259 | 2259 | echo '-> countAllHours...'."\n"; |
2260 | - $alldata = $Spotter->countAllHours('hour',$filter_last_month); |
|
2260 | + $alldata = $Spotter->countAllHours('hour', $filter_last_month); |
|
2261 | 2261 | foreach ($alldata as $number) { |
2262 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count']); |
|
2262 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count']); |
|
2263 | 2263 | } |
2264 | 2264 | |
2265 | 2265 | |
@@ -2270,42 +2270,42 @@ discard block |
||
2270 | 2270 | if ($globalDebug) echo 'Count all flights by countries by airlines...'."\n"; |
2271 | 2271 | $SpotterArchive = new SpotterArchive(); |
2272 | 2272 | //$Spotter = new Spotter($this->db); |
2273 | - $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
|
2273 | + $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false, 0, $last_update_day); |
|
2274 | 2274 | //$alldata = $Spotter->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
2275 | 2275 | foreach ($alldata as $number) { |
2276 | - $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],$number['airline_icao'],'',$reset); |
|
2276 | + $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], $number['airline_icao'], '', $reset); |
|
2277 | 2277 | } |
2278 | 2278 | } |
2279 | 2279 | if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
2280 | 2280 | $Spotter = new Spotter($this->db); |
2281 | - $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
|
2281 | + $alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day); |
|
2282 | 2282 | foreach ($alldata as $number) { |
2283 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset); |
|
2283 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao'], '', $reset); |
|
2284 | 2284 | } |
2285 | 2285 | if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
2286 | - $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
|
2286 | + $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day); |
|
2287 | 2287 | foreach ($alldata as $number) { |
2288 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset); |
|
2288 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao'], '', $reset); |
|
2289 | 2289 | } |
2290 | 2290 | if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
2291 | - $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
|
2291 | + $alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day); |
|
2292 | 2292 | foreach ($alldata as $number) { |
2293 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
|
2293 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset); |
|
2294 | 2294 | } |
2295 | 2295 | if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
2296 | - $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
|
2296 | + $alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day); |
|
2297 | 2297 | foreach ($alldata as $number) { |
2298 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset); |
|
2298 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao'], '', $reset); |
|
2299 | 2299 | } |
2300 | 2300 | if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
2301 | - $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
|
2301 | + $alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day); |
|
2302 | 2302 | foreach ($alldata as $number) { |
2303 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset); |
|
2303 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao'], '', $number['format_source'], $reset); |
|
2304 | 2304 | } |
2305 | 2305 | if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
2306 | - $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
|
2306 | + $pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
2307 | 2307 | if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
2308 | - $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
2308 | + $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
2309 | 2309 | if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
2310 | 2310 | //$alldata = array(); |
2311 | 2311 | foreach ($dall as $value) { |
@@ -2325,12 +2325,12 @@ discard block |
||
2325 | 2325 | } |
2326 | 2326 | $alldata = $pall; |
2327 | 2327 | foreach ($alldata as $number) { |
2328 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset); |
|
2328 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], $number['airline_icao'], '', $reset); |
|
2329 | 2329 | } |
2330 | 2330 | if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
2331 | - $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
|
2331 | + $pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
2332 | 2332 | if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
2333 | - $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
2333 | + $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
2334 | 2334 | if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
2335 | 2335 | //$alldata = array(); |
2336 | 2336 | foreach ($dall as $value) { |
@@ -2350,7 +2350,7 @@ discard block |
||
2350 | 2350 | } |
2351 | 2351 | $alldata = $pall; |
2352 | 2352 | foreach ($alldata as $number) { |
2353 | - if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
|
2353 | + if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], $number['airline_icao'], '', $reset); |
|
2354 | 2354 | } |
2355 | 2355 | if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
2356 | 2356 | $Spotter = new Spotter($this->db); |
@@ -2358,27 +2358,27 @@ discard block |
||
2358 | 2358 | $lastyear = false; |
2359 | 2359 | foreach ($alldata as $number) { |
2360 | 2360 | if ($number['year_name'] != date('Y')) $lastyear = true; |
2361 | - $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
2361 | + $this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
2362 | 2362 | } |
2363 | 2363 | if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
2364 | 2364 | $alldata = $Spotter->countAllMonthsOwnersByAirlines($filter_last_month); |
2365 | 2365 | foreach ($alldata as $number) { |
2366 | - $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
2366 | + $this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
2367 | 2367 | } |
2368 | 2368 | if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
2369 | 2369 | $alldata = $Spotter->countAllMonthsPilotsByAirlines($filter_last_month); |
2370 | 2370 | foreach ($alldata as $number) { |
2371 | - $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
2371 | + $this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
2372 | 2372 | } |
2373 | 2373 | if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
2374 | 2374 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines($filter_last_month); |
2375 | 2375 | foreach ($alldata as $number) { |
2376 | - $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
2376 | + $this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
2377 | 2377 | } |
2378 | 2378 | if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
2379 | 2379 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines($filter_last_month); |
2380 | 2380 | foreach ($alldata as $number) { |
2381 | - $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
2381 | + $this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
2382 | 2382 | } |
2383 | 2383 | if ($globalDebug) echo '...Departure'."\n"; |
2384 | 2384 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
@@ -2401,7 +2401,7 @@ discard block |
||
2401 | 2401 | } |
2402 | 2402 | $alldata = $pall; |
2403 | 2403 | foreach ($alldata as $number) { |
2404 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']); |
|
2404 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], $number['airline_icao']); |
|
2405 | 2405 | } |
2406 | 2406 | if ($globalDebug) echo '...Arrival'."\n"; |
2407 | 2407 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
@@ -2424,32 +2424,32 @@ discard block |
||
2424 | 2424 | } |
2425 | 2425 | $alldata = $pall; |
2426 | 2426 | foreach ($alldata as $number) { |
2427 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']); |
|
2427 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], $number['airline_icao']); |
|
2428 | 2428 | } |
2429 | 2429 | |
2430 | 2430 | if ($globalDebug) echo 'Flights data...'."\n"; |
2431 | 2431 | if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
2432 | 2432 | $alldata = $Spotter->countAllDatesLastMonthByAirlines($filter_last_month); |
2433 | 2433 | foreach ($alldata as $number) { |
2434 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
|
2434 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
2435 | 2435 | } |
2436 | 2436 | if ($globalDebug) echo '-> countAllDates...'."\n"; |
2437 | 2437 | //$previousdata = $this->countAllDatesByAirlines(); |
2438 | - $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines($filter_last_month)); |
|
2438 | + $alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines($filter_last_month)); |
|
2439 | 2439 | $values = array(); |
2440 | 2440 | foreach ($alldata as $cnt) { |
2441 | 2441 | $values[] = $cnt['date_count']; |
2442 | 2442 | } |
2443 | - array_multisort($values,SORT_DESC,$alldata); |
|
2444 | - array_splice($alldata,11); |
|
2443 | + array_multisort($values, SORT_DESC, $alldata); |
|
2444 | + array_splice($alldata, 11); |
|
2445 | 2445 | foreach ($alldata as $number) { |
2446 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
|
2446 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
2447 | 2447 | } |
2448 | 2448 | |
2449 | 2449 | if ($globalDebug) echo '-> countAllHours...'."\n"; |
2450 | - $alldata = $Spotter->countAllHoursByAirlines('hour',$filter_last_month); |
|
2450 | + $alldata = $Spotter->countAllHoursByAirlines('hour', $filter_last_month); |
|
2451 | 2451 | foreach ($alldata as $number) { |
2452 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
|
2452 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']); |
|
2453 | 2453 | } |
2454 | 2454 | |
2455 | 2455 | |
@@ -2473,7 +2473,7 @@ discard block |
||
2473 | 2473 | $last_update_day = date('Y').'-01-01 00:00:00'; |
2474 | 2474 | } |
2475 | 2475 | } |
2476 | - if (isset($filter['DeleteLastYearStats']) && date('Y',strtotime($last_update_day)) != date('Y')) { |
|
2476 | + if (isset($filter['DeleteLastYearStats']) && date('Y', strtotime($last_update_day)) != date('Y')) { |
|
2477 | 2477 | $last_update_day = date('Y').'-01-01 00:00:00'; |
2478 | 2478 | $reset = true; |
2479 | 2479 | } |
@@ -2482,32 +2482,32 @@ discard block |
||
2482 | 2482 | // Count by filter |
2483 | 2483 | if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
2484 | 2484 | $Spotter = new Spotter($this->db); |
2485 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
|
2485 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter); |
|
2486 | 2486 | foreach ($alldata as $number) { |
2487 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name,$reset); |
|
2487 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name, $reset); |
|
2488 | 2488 | } |
2489 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter); |
|
2489 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day, $filter); |
|
2490 | 2490 | foreach ($alldata as $number) { |
2491 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name,$reset); |
|
2491 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], $filter_name, $reset); |
|
2492 | 2492 | } |
2493 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter); |
|
2493 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter); |
|
2494 | 2494 | foreach ($alldata as $number) { |
2495 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name,$reset); |
|
2495 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name, $reset); |
|
2496 | 2496 | } |
2497 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter); |
|
2497 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter); |
|
2498 | 2498 | foreach ($alldata as $number) { |
2499 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name,$reset); |
|
2499 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name, $reset); |
|
2500 | 2500 | } |
2501 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter); |
|
2501 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter); |
|
2502 | 2502 | foreach ($alldata as $number) { |
2503 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name,$reset); |
|
2503 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name, $reset); |
|
2504 | 2504 | } |
2505 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter); |
|
2505 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter); |
|
2506 | 2506 | foreach ($alldata as $number) { |
2507 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source'],$reset); |
|
2507 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name, $number['format_source'], $reset); |
|
2508 | 2508 | } |
2509 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
|
2510 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
2509 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter); |
|
2510 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter); |
|
2511 | 2511 | $alldata = array(); |
2512 | 2512 | foreach ($pall as $value) { |
2513 | 2513 | $icao = $value['airport_departure_icao']; |
@@ -2523,12 +2523,12 @@ discard block |
||
2523 | 2523 | foreach ($alldata as $key => $row) { |
2524 | 2524 | $count[$key] = $row['airport_departure_icao_count']; |
2525 | 2525 | } |
2526 | - array_multisort($count,SORT_DESC,$alldata); |
|
2526 | + array_multisort($count, SORT_DESC, $alldata); |
|
2527 | 2527 | foreach ($alldata as $number) { |
2528 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name,$reset); |
|
2528 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', $filter_name, $reset); |
|
2529 | 2529 | } |
2530 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter); |
|
2531 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter); |
|
2530 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, false, $filter); |
|
2531 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, false, $filter); |
|
2532 | 2532 | $alldata = array(); |
2533 | 2533 | foreach ($pall as $value) { |
2534 | 2534 | $icao = $value['airport_arrival_icao']; |
@@ -2544,40 +2544,40 @@ discard block |
||
2544 | 2544 | foreach ($alldata as $key => $row) { |
2545 | 2545 | $count[$key] = $row['airport_arrival_icao_count']; |
2546 | 2546 | } |
2547 | - array_multisort($count,SORT_DESC,$alldata); |
|
2547 | + array_multisort($count, SORT_DESC, $alldata); |
|
2548 | 2548 | foreach ($alldata as $number) { |
2549 | - echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name,$reset); |
|
2549 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', $filter_name, $reset); |
|
2550 | 2550 | } |
2551 | 2551 | $Spotter = new Spotter($this->db); |
2552 | 2552 | $alldata = $Spotter->countAllMonths($filter); |
2553 | 2553 | $lastyear = false; |
2554 | 2554 | foreach ($alldata as $number) { |
2555 | 2555 | if ($number['year_name'] != date('Y')) $lastyear = true; |
2556 | - $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
2556 | + $this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
2557 | 2557 | } |
2558 | 2558 | $alldata = $Spotter->countAllMonthsOwners($filter); |
2559 | 2559 | foreach ($alldata as $number) { |
2560 | - $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
2560 | + $this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
2561 | 2561 | } |
2562 | 2562 | $alldata = $Spotter->countAllMonthsPilots($filter); |
2563 | 2563 | foreach ($alldata as $number) { |
2564 | - $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
2564 | + $this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
2565 | 2565 | } |
2566 | 2566 | $alldata = $Spotter->countAllMilitaryMonths($filter); |
2567 | 2567 | foreach ($alldata as $number) { |
2568 | - $this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
2568 | + $this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
2569 | 2569 | } |
2570 | 2570 | $alldata = $Spotter->countAllMonthsAircrafts($filter); |
2571 | 2571 | foreach ($alldata as $number) { |
2572 | - $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
2572 | + $this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
2573 | 2573 | } |
2574 | 2574 | $alldata = $Spotter->countAllMonthsRealArrivals($filter); |
2575 | 2575 | foreach ($alldata as $number) { |
2576 | - $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
2576 | + $this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
2577 | 2577 | } |
2578 | 2578 | echo '...Departure'."\n"; |
2579 | - $pall = $Spotter->getLast7DaysAirportsDeparture('',$filter); |
|
2580 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
2579 | + $pall = $Spotter->getLast7DaysAirportsDeparture('', $filter); |
|
2580 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter); |
|
2581 | 2581 | foreach ($dall as $value) { |
2582 | 2582 | $icao = $value['departure_airport_icao']; |
2583 | 2583 | $ddate = $value['date']; |
@@ -2595,11 +2595,11 @@ discard block |
||
2595 | 2595 | } |
2596 | 2596 | $alldata = $pall; |
2597 | 2597 | foreach ($alldata as $number) { |
2598 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],'',$filter_name); |
|
2598 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], '', $filter_name); |
|
2599 | 2599 | } |
2600 | 2600 | echo '...Arrival'."\n"; |
2601 | - $pall = $Spotter->getLast7DaysAirportsArrival('',$filter); |
|
2602 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
2601 | + $pall = $Spotter->getLast7DaysAirportsArrival('', $filter); |
|
2602 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter); |
|
2603 | 2603 | foreach ($dall as $value) { |
2604 | 2604 | $icao = $value['arrival_airport_icao']; |
2605 | 2605 | $ddate = $value['date']; |
@@ -2617,40 +2617,40 @@ discard block |
||
2617 | 2617 | } |
2618 | 2618 | $alldata = $pall; |
2619 | 2619 | foreach ($alldata as $number) { |
2620 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],'',$filter_name); |
|
2620 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], '', $filter_name); |
|
2621 | 2621 | } |
2622 | 2622 | |
2623 | 2623 | echo 'Flights data...'."\n"; |
2624 | 2624 | echo '-> countAllDatesLastMonth...'."\n"; |
2625 | 2625 | $alldata = $Spotter->countAllDatesLastMonth($filter); |
2626 | 2626 | foreach ($alldata as $number) { |
2627 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name); |
|
2627 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name); |
|
2628 | 2628 | } |
2629 | 2629 | echo '-> countAllDates...'."\n"; |
2630 | - $previousdata = $this->countAllDates('',$filter_name); |
|
2631 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter)); |
|
2630 | + $previousdata = $this->countAllDates('', $filter_name); |
|
2631 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter)); |
|
2632 | 2632 | $values = array(); |
2633 | 2633 | foreach ($alldata as $cnt) { |
2634 | 2634 | $values[] = $cnt['date_count']; |
2635 | 2635 | } |
2636 | - array_multisort($values,SORT_DESC,$alldata); |
|
2637 | - array_splice($alldata,11); |
|
2636 | + array_multisort($values, SORT_DESC, $alldata); |
|
2637 | + array_splice($alldata, 11); |
|
2638 | 2638 | foreach ($alldata as $number) { |
2639 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name); |
|
2639 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name); |
|
2640 | 2640 | } |
2641 | 2641 | |
2642 | 2642 | echo '-> countAllHours...'."\n"; |
2643 | - $alldata = $Spotter->countAllHours('hour',$filter); |
|
2643 | + $alldata = $Spotter->countAllHours('hour', $filter); |
|
2644 | 2644 | foreach ($alldata as $number) { |
2645 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name); |
|
2645 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name); |
|
2646 | 2646 | } |
2647 | 2647 | echo 'Insert last stats update date...'."\n"; |
2648 | 2648 | date_default_timezone_set('UTC'); |
2649 | - $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y-m-d G:i:s')); |
|
2649 | + $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y-m-d G:i:s')); |
|
2650 | 2650 | if (isset($filter['DeleteLastYearStats']) && $filter['DeleteLastYearStats'] == true) { |
2651 | - if (date('Y',strtotime($last_update_day)) != date('Y')) { |
|
2651 | + if (date('Y', strtotime($last_update_day)) != date('Y')) { |
|
2652 | 2652 | $this->deleteOldStats($filter_name); |
2653 | - $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y').'-01-01 00:00:00'); |
|
2653 | + $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y').'-01-01 00:00:00'); |
|
2654 | 2654 | } |
2655 | 2655 | } |
2656 | 2656 | |
@@ -2663,16 +2663,16 @@ discard block |
||
2663 | 2663 | // SUM all previous month to put as year |
2664 | 2664 | $previous_year = date('Y'); |
2665 | 2665 | $previous_year--; |
2666 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2667 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2668 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2669 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2666 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2667 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2668 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2669 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2670 | 2670 | $allairlines = $this->getAllAirlineNames(); |
2671 | 2671 | foreach ($allairlines as $data) { |
2672 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2673 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2674 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2675 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2672 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2673 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2674 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2675 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2676 | 2676 | } |
2677 | 2677 | |
2678 | 2678 | if (isset($globalArchiveYear) && $globalArchiveYear) { |
@@ -2681,7 +2681,7 @@ discard block |
||
2681 | 2681 | try { |
2682 | 2682 | $sth = $this->db->prepare($query); |
2683 | 2683 | $sth->execute(); |
2684 | - } catch(PDOException $e) { |
|
2684 | + } catch (PDOException $e) { |
|
2685 | 2685 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
2686 | 2686 | } |
2687 | 2687 | } |
@@ -2690,15 +2690,15 @@ discard block |
||
2690 | 2690 | try { |
2691 | 2691 | $sth = $this->db->prepare($query); |
2692 | 2692 | $sth->execute(); |
2693 | - } catch(PDOException $e) { |
|
2693 | + } catch (PDOException $e) { |
|
2694 | 2694 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
2695 | 2695 | } |
2696 | 2696 | } |
2697 | 2697 | if (isset($globalDeleteLastYearStats) && $globalDeleteLastYearStats) { |
2698 | 2698 | $last_update = $this->getLastStatsUpdate('last_update_stats'); |
2699 | - if (date('Y',strtotime($last_update[0]['value'])) != date('Y')) { |
|
2699 | + if (date('Y', strtotime($last_update[0]['value'])) != date('Y')) { |
|
2700 | 2700 | $this->deleteOldStats(); |
2701 | - $this->addLastStatsUpdate('last_update_stats',date('Y').'-01-01 00:00:00'); |
|
2701 | + $this->addLastStatsUpdate('last_update_stats', date('Y').'-01-01 00:00:00'); |
|
2702 | 2702 | $lastyearupdate = true; |
2703 | 2703 | } |
2704 | 2704 | } |
@@ -2720,7 +2720,7 @@ discard block |
||
2720 | 2720 | try { |
2721 | 2721 | $sth = $this->db->prepare($query); |
2722 | 2722 | $sth->execute(); |
2723 | - } catch(PDOException $e) { |
|
2723 | + } catch (PDOException $e) { |
|
2724 | 2724 | return "error : ".$e->getMessage(); |
2725 | 2725 | } |
2726 | 2726 | } |
@@ -2734,14 +2734,14 @@ discard block |
||
2734 | 2734 | try { |
2735 | 2735 | $sth = $this->db->prepare($query); |
2736 | 2736 | $sth->execute(); |
2737 | - } catch(PDOException $e) { |
|
2737 | + } catch (PDOException $e) { |
|
2738 | 2738 | return "error : ".$e->getMessage(); |
2739 | 2739 | } |
2740 | 2740 | } |
2741 | 2741 | if (!isset($lastyearupdate)) { |
2742 | 2742 | echo 'Insert last stats update date...'."\n"; |
2743 | 2743 | date_default_timezone_set('UTC'); |
2744 | - $this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s')); |
|
2744 | + $this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s')); |
|
2745 | 2745 | } |
2746 | 2746 | if ($globalStatsResetYear) { |
2747 | 2747 | require_once(dirname(__FILE__).'/../install/class.settings.php'); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | if (!isset($filter_name)) $filter_name = ''; |
22 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
22 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
23 | 23 | if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) { |
24 | 24 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
25 | 25 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | if (isset($airline_info[0]['name'])) { |
30 | 30 | $airline_name = $airline_info[0]['name']; |
31 | 31 | } else { |
32 | - $alliances = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',$airline_icao)); |
|
32 | + $alliances = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', $airline_icao)); |
|
33 | 33 | if (!empty($alliances)) { |
34 | 34 | $alliance_name = $airline_icao; |
35 | 35 | $airline_icao = 'alliance_'.$airline_icao; |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | $title = _("Statistics"); |
43 | 43 | } |
44 | 44 | |
45 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
46 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
45 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
46 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
47 | 47 | |
48 | 48 | require_once('header.php'); |
49 | 49 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | date_default_timezone_set('UTC'); |
71 | 71 | $lastupdate = strtotime($last_update[0]['value']); |
72 | 72 | if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
73 | - print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
|
73 | + print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>'; |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | ?> |
@@ -82,31 +82,31 @@ discard block |
||
82 | 82 | <?php |
83 | 83 | if ($type == 'aircraft') { |
84 | 84 | ?> |
85 | - <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Flights"); ?></span> |
|
86 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
87 | - <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
|
88 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
85 | + <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Flights"); ?></span> |
|
86 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
87 | + <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
|
88 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
89 | 89 | <?php |
90 | 90 | if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
91 | 91 | ?> |
92 | - <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span> |
|
93 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
92 | + <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Pilots"); ?></span> |
|
93 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
94 | 94 | <?php |
95 | 95 | } |
96 | 96 | if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
97 | 97 | ?> |
98 | - <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span> |
|
99 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
98 | + <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Owners"); ?></span> |
|
99 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
100 | 100 | <?php |
101 | 101 | } |
102 | 102 | ?> |
103 | - <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
|
104 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
103 | + <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
|
104 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
105 | 105 | <?php |
106 | 106 | if ($airline_icao == '') { |
107 | 107 | ?> |
108 | - <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span> |
|
109 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
108 | + <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name, $year, $month)); ?></span> <?php echo _("Airlines"); ?></span> |
|
109 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
110 | 110 | <?php |
111 | 111 | } |
112 | 112 | ?> |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | if (!(isset($globalVA) && $globalVA) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS) && !(isset($globalVAM) && $globalVAM)) { |
115 | 115 | if ($airline_icao == '' || $airline_icao == 'all') { |
116 | 116 | ?> |
117 | - <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name,$year,$month)); ?></span> <?php echo _("Military"); ?></span> |
|
118 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
117 | + <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name, $year, $month)); ?></span> <?php echo _("Military"); ?></span> |
|
118 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
119 | 119 | <?php |
120 | 120 | } |
121 | 121 | } |
@@ -123,22 +123,22 @@ discard block |
||
123 | 123 | <?php |
124 | 124 | } elseif ($type == 'marine') { |
125 | 125 | ?> |
126 | - <span><span class="badge"><?php print number_format($Marine->countOverallMarine(array(),$year,$month)); ?></span> <?php echo _("Vessels"); ?></span> |
|
127 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
128 | - <span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span> |
|
129 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
126 | + <span><span class="badge"><?php print number_format($Marine->countOverallMarine(array(), $year, $month)); ?></span> <?php echo _("Vessels"); ?></span> |
|
127 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
128 | + <span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span> |
|
129 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
130 | 130 | <?php |
131 | 131 | } elseif ($type == 'tracker') { |
132 | 132 | ?> |
133 | - <span><span class="badge"><?php print number_format($Tracker->countOverallTracker(array(),$year,$month)); ?></span> <?php echo _("Trackers"); ?></span> |
|
134 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
135 | - <span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span> |
|
136 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
133 | + <span><span class="badge"><?php print number_format($Tracker->countOverallTracker(array(), $year, $month)); ?></span> <?php echo _("Trackers"); ?></span> |
|
134 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
135 | + <span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span> |
|
136 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
137 | 137 | <?php |
138 | 138 | } |
139 | 139 | ?> |
140 | 140 | </p> |
141 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
141 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
142 | 142 | <div class="specific-stats"> |
143 | 143 | <?php |
144 | 144 | if ($type == 'aircraft') { |
@@ -147,13 +147,13 @@ discard block |
||
147 | 147 | <div class="col-md-6"> |
148 | 148 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
149 | 149 | <?php |
150 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
|
150 | + $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month); |
|
151 | 151 | if (count($aircraft_array) == 0) { |
152 | 152 | print _("No data available"); |
153 | 153 | } else { |
154 | 154 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
155 | 155 | $aircraft_data = ''; |
156 | - foreach($aircraft_array as $aircraft_item) { |
|
156 | + foreach ($aircraft_array as $aircraft_item) { |
|
157 | 157 | if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
158 | 158 | else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
159 | 159 | } |
@@ -182,16 +182,16 @@ discard block |
||
182 | 182 | ?> |
183 | 183 | </div> |
184 | 184 | </div> |
185 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
185 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
186 | 186 | <?php |
187 | 187 | if ($airline_icao == '' || $airline_icao == 'all') { |
188 | - $airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month); |
|
188 | + $airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month); |
|
189 | 189 | if (count($airline_array) > 0) { |
190 | 190 | print '<div class="col-md-6">'; |
191 | 191 | print '<h2>'._("Top 10 Most Common Airline").'</h2>'; |
192 | 192 | print '<div id="chart2" class="chart" width="100%"></div><script>'; |
193 | 193 | $airline_data = ''; |
194 | - foreach($airline_array as $airline_item) { |
|
194 | + foreach ($airline_array as $airline_item) { |
|
195 | 195 | $airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
196 | 196 | } |
197 | 197 | $airline_data = substr($airline_data, 0, -1); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } |
217 | 217 | ?> |
218 | 218 | </div> |
219 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
219 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
220 | 220 | <?php |
221 | 221 | } |
222 | 222 | } |
@@ -228,12 +228,12 @@ discard block |
||
228 | 228 | <div class="col-md-6"> |
229 | 229 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
230 | 230 | <?php |
231 | - $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month); |
|
231 | + $marine_array = $Marine->countAllMarineTypes(true, 0, '', array(), $year, $month); |
|
232 | 232 | if (count($marine_array) == 0) print _("No data available"); |
233 | 233 | else { |
234 | 234 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
235 | 235 | $marine_data = ''; |
236 | - foreach($marine_array as $marine_item) { |
|
236 | + foreach ($marine_array as $marine_item) { |
|
237 | 237 | $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],'; |
238 | 238 | } |
239 | 239 | $marine_data = substr($marine_data, 0, -1); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | ?> |
264 | 264 | </div> |
265 | 265 | </div> |
266 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
266 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
267 | 267 | <!-- </div>--> |
268 | 268 | <?php |
269 | 269 | } |
@@ -273,12 +273,12 @@ discard block |
||
273 | 273 | <div class="col-md-6"> |
274 | 274 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
275 | 275 | <?php |
276 | - $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month); |
|
276 | + $tracker_array = $Tracker->countAllTrackerTypes(true, 0, '', array(), $year, $month); |
|
277 | 277 | if (count($tracker_array) == 0) print _("No data available"); |
278 | 278 | else { |
279 | 279 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
280 | 280 | $tracker_data = ''; |
281 | - foreach($tracker_array as $tracker_item) { |
|
281 | + foreach ($tracker_array as $tracker_item) { |
|
282 | 282 | $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],'; |
283 | 283 | } |
284 | 284 | $tracker_data = substr($tracker_data, 0, -1); |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | ?> |
309 | 309 | </div> |
310 | 310 | </div> |
311 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
311 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
312 | 312 | <!-- </div>--> |
313 | 313 | <?php |
314 | 314 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | ?> |
317 | 317 | <div class="row column"> |
318 | 318 | <?php |
319 | - $flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month); |
|
319 | + $flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name, $year, $month); |
|
320 | 320 | //if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
321 | 321 | if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
322 | 322 | if (empty($flightover_array)) { |
@@ -327,12 +327,12 @@ discard block |
||
327 | 327 | ?> |
328 | 328 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
329 | 329 | <?php |
330 | - $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
|
330 | + $pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month); |
|
331 | 331 | if (count($pilot_array) == 0) print _("No data available"); |
332 | 332 | else { |
333 | 333 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
334 | 334 | $pilot_data = ''; |
335 | - foreach($pilot_array as $pilot_item) { |
|
335 | + foreach ($pilot_array as $pilot_item) { |
|
336 | 336 | $pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
337 | 337 | } |
338 | 338 | $pilot_data = substr($pilot_data, 0, -1); |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | ?> |
354 | 354 | </div> |
355 | 355 | |
356 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
356 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
357 | 357 | <?php |
358 | 358 | } |
359 | 359 | // else { |
@@ -362,12 +362,12 @@ discard block |
||
362 | 362 | <div class="col-md-6"> |
363 | 363 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
364 | 364 | <?php |
365 | - $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
|
365 | + $owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month); |
|
366 | 366 | if (count($owner_array) == 0) print _("No data available"); |
367 | 367 | else { |
368 | 368 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
369 | 369 | $owner_data = ''; |
370 | - foreach($owner_array as $owner_item) { |
|
370 | + foreach ($owner_array as $owner_item) { |
|
371 | 371 | $owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
372 | 372 | } |
373 | 373 | $owner_data = substr($owner_data, 0, -1); |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | </div> |
387 | 387 | </div> |
388 | 388 | |
389 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
389 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
390 | 390 | <?php |
391 | 391 | } |
392 | 392 | if (!empty($flightover_array)) { |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
401 | 401 | print 'var series = ['; |
402 | 402 | $flightover_data = ''; |
403 | - foreach($flightover_array as $flightover_item) { |
|
403 | + foreach ($flightover_array as $flightover_item) { |
|
404 | 404 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
405 | 405 | } |
406 | 406 | $flightover_data = substr($flightover_data, 0, -1); |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | } |
446 | 446 | ?> |
447 | 447 | </div> |
448 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
448 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
449 | 449 | </div> |
450 | 450 | <?php |
451 | 451 | } |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
462 | 462 | print 'var series = ['; |
463 | 463 | $flightover_data = ''; |
464 | - foreach($flightover_array as $flightover_item) { |
|
464 | + foreach ($flightover_array as $flightover_item) { |
|
465 | 465 | $flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],'; |
466 | 466 | } |
467 | 467 | $flightover_data = substr($flightover_data, 0, -1); |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
519 | 519 | print 'var series = ['; |
520 | 520 | $flightover_data = ''; |
521 | - foreach($flightover_array as $flightover_item) { |
|
521 | + foreach ($flightover_array as $flightover_item) { |
|
522 | 522 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
523 | 523 | } |
524 | 524 | $flightover_data = substr($flightover_data, 0, -1); |
@@ -568,14 +568,14 @@ discard block |
||
568 | 568 | <div class="row column"> |
569 | 569 | <div class="col-md-6"> |
570 | 570 | <?php |
571 | - $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month); |
|
571 | + $airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month); |
|
572 | 572 | if (count($airport_airport_array) > 0) { |
573 | 573 | print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>'; |
574 | 574 | print '<div id="chart3" class="chart" width="100%"></div><script>'; |
575 | 575 | print "\n"; |
576 | 576 | print 'var series = ['; |
577 | 577 | $airport_data = ''; |
578 | - foreach($airport_airport_array as $airport_item) { |
|
578 | + foreach ($airport_airport_array as $airport_item) { |
|
579 | 579 | $airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],'; |
580 | 580 | } |
581 | 581 | $airport_data = substr($airport_data, 0, -1); |
@@ -625,18 +625,18 @@ discard block |
||
625 | 625 | } |
626 | 626 | ?> |
627 | 627 | </div> |
628 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
628 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
629 | 629 | |
630 | 630 | <div class="col-md-6"> |
631 | 631 | <?php |
632 | - $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month); |
|
632 | + $airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month); |
|
633 | 633 | if (count($airport_airport_array2) > 0) { |
634 | 634 | print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>'; |
635 | 635 | print '<div id="chart4" class="chart" width="100%"></div><script>'; |
636 | 636 | print "\n"; |
637 | 637 | print 'var series = ['; |
638 | 638 | $airport_data = ''; |
639 | - foreach($airport_airport_array2 as $airport_item) |
|
639 | + foreach ($airport_airport_array2 as $airport_item) |
|
640 | 640 | { |
641 | 641 | $airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],'; |
642 | 642 | } |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | ?> |
689 | 689 | </div> |
690 | 690 | </div> |
691 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
691 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
692 | 692 | <?php |
693 | 693 | } |
694 | 694 | if ($type == 'aircraft') { |
@@ -700,18 +700,18 @@ discard block |
||
700 | 700 | <div class="col-md-6"> |
701 | 701 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
702 | 702 | <?php |
703 | - $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
703 | + $year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
704 | 704 | if (count($year_array) == 0) print _("No data available"); |
705 | 705 | else { |
706 | 706 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
707 | 707 | $year_data = ''; |
708 | 708 | $year_cnt = ''; |
709 | - foreach($year_array as $year_item) { |
|
709 | + foreach ($year_array as $year_item) { |
|
710 | 710 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
711 | 711 | $year_cnt .= $year_item['date_count'].','; |
712 | 712 | } |
713 | 713 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
714 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
714 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
715 | 715 | print 'c3.generate({ |
716 | 716 | bindto: "#chart8", |
717 | 717 | data: { x: "x", |
@@ -724,22 +724,22 @@ discard block |
||
724 | 724 | <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
725 | 725 | </div> |
726 | 726 | </div> |
727 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
727 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
728 | 728 | <div class="col-md-6"> |
729 | 729 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
730 | 730 | <?php |
731 | - $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
731 | + $month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name); |
|
732 | 732 | if (count($month_array) == 0) print _("No data available"); |
733 | 733 | else { |
734 | 734 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
735 | 735 | $month_data = ''; |
736 | 736 | $month_cnt = ''; |
737 | - foreach($month_array as $month_item) { |
|
737 | + foreach ($month_array as $month_item) { |
|
738 | 738 | $month_data .= '"'.$month_item['date_name'].'",'; |
739 | 739 | $month_cnt .= $month_item['date_count'].','; |
740 | 740 | } |
741 | 741 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
742 | - $month_cnt = "['flights',".substr($month_cnt,0,-1)."]"; |
|
742 | + $month_cnt = "['flights',".substr($month_cnt, 0, -1)."]"; |
|
743 | 743 | print 'c3.generate({ |
744 | 744 | bindto: "#chart9", |
745 | 745 | data: { x: "x", |
@@ -752,23 +752,23 @@ discard block |
||
752 | 752 | <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
753 | 753 | </div> |
754 | 754 | </div> |
755 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
755 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
756 | 756 | |
757 | 757 | <div class="col-md-6"> |
758 | 758 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
759 | 759 | <?php |
760 | - $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
760 | + $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name); |
|
761 | 761 | if (empty($date_array)) print _("No data available"); |
762 | 762 | else { |
763 | 763 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
764 | 764 | $date_data = ''; |
765 | 765 | $date_cnt = ''; |
766 | - foreach($date_array as $date_item) { |
|
766 | + foreach ($date_array as $date_item) { |
|
767 | 767 | $date_data .= '"'.$date_item['date_name'].'",'; |
768 | 768 | $date_cnt .= $date_item['date_count'].','; |
769 | 769 | } |
770 | 770 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
771 | - $date_cnt = "['flights',".substr($date_cnt,0,-1)."]"; |
|
771 | + $date_cnt = "['flights',".substr($date_cnt, 0, -1)."]"; |
|
772 | 772 | print 'c3.generate({ |
773 | 773 | bindto: "#chart5", |
774 | 774 | data: { x: "x", |
@@ -781,22 +781,22 @@ discard block |
||
781 | 781 | <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
782 | 782 | </div> |
783 | 783 | </div> |
784 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
784 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
785 | 785 | <div class="col-md-6"> |
786 | 786 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
787 | 787 | <?php |
788 | - $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
788 | + $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name); |
|
789 | 789 | if (empty($hour_array)) print _("No data available"); |
790 | 790 | else { |
791 | 791 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
792 | 792 | $hour_data = ''; |
793 | 793 | $hour_cnt = ''; |
794 | - foreach($hour_array as $hour_item) { |
|
794 | + foreach ($hour_array as $hour_item) { |
|
795 | 795 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
796 | 796 | $hour_cnt .= $hour_item['hour_count'].','; |
797 | 797 | } |
798 | 798 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
799 | - $hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]"; |
|
799 | + $hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]"; |
|
800 | 800 | print 'c3.generate({ |
801 | 801 | bindto: "#chart6", |
802 | 802 | data: { |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
810 | 810 | </div> |
811 | 811 | </div> |
812 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
812 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
813 | 813 | </div> |
814 | 814 | <?php |
815 | 815 | } |
@@ -825,18 +825,18 @@ discard block |
||
825 | 825 | <div class="col-md-6"> |
826 | 826 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
827 | 827 | <?php |
828 | - $year_array = $Marine->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
828 | + $year_array = $Marine->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
829 | 829 | if (count($year_array) == 0) print _("No data available"); |
830 | 830 | else { |
831 | 831 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
832 | 832 | $year_data = ''; |
833 | 833 | $year_cnt = ''; |
834 | - foreach($year_array as $year_item) { |
|
834 | + foreach ($year_array as $year_item) { |
|
835 | 835 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
836 | 836 | $year_cnt .= $year_item['date_count'].','; |
837 | 837 | } |
838 | 838 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
839 | - $year_cnt = "['vessels',".substr($year_cnt,0,-1)."]"; |
|
839 | + $year_cnt = "['vessels',".substr($year_cnt, 0, -1)."]"; |
|
840 | 840 | print 'c3.generate({ |
841 | 841 | bindto: "#chart8", |
842 | 842 | data: { x: "x", |
@@ -850,22 +850,22 @@ discard block |
||
850 | 850 | </div> |
851 | 851 | </div> |
852 | 852 | |
853 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
853 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
854 | 854 | <div class="col-md-6"> |
855 | 855 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
856 | 856 | <?php |
857 | - $month_array = $Marine->countAllDatesLastMonth($airline_icao,$filter_name); |
|
857 | + $month_array = $Marine->countAllDatesLastMonth($airline_icao, $filter_name); |
|
858 | 858 | if (count($month_array) == 0) print _("No data available"); |
859 | 859 | else { |
860 | 860 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
861 | 861 | $month_data = ''; |
862 | 862 | $month_cnt = ''; |
863 | - foreach($month_array as $month_item) { |
|
863 | + foreach ($month_array as $month_item) { |
|
864 | 864 | $month_data .= '"'.$month_item['date_name'].'",'; |
865 | 865 | $month_cnt .= $month_item['date_count'].','; |
866 | 866 | } |
867 | 867 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
868 | - $month_cnt = "['vessels',".substr($month_cnt,0,-1)."]"; |
|
868 | + $month_cnt = "['vessels',".substr($month_cnt, 0, -1)."]"; |
|
869 | 869 | print 'c3.generate({ |
870 | 870 | bindto: "#chart9", |
871 | 871 | data: { x: "x", |
@@ -878,23 +878,23 @@ discard block |
||
878 | 878 | <a href="<?php print $globalURL; ?>/marine/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
879 | 879 | </div> |
880 | 880 | </div> |
881 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
881 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
882 | 882 | |
883 | 883 | <div class="col-md-6"> |
884 | 884 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
885 | 885 | <?php |
886 | - $date_array = $Marine->countAllDatesLast7Days($airline_icao,$filter_name); |
|
886 | + $date_array = $Marine->countAllDatesLast7Days($airline_icao, $filter_name); |
|
887 | 887 | if (empty($date_array)) print _("No data available"); |
888 | 888 | else { |
889 | 889 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
890 | 890 | $date_data = ''; |
891 | 891 | $date_cnt = ''; |
892 | - foreach($date_array as $date_item) { |
|
892 | + foreach ($date_array as $date_item) { |
|
893 | 893 | $date_data .= '"'.$date_item['date_name'].'",'; |
894 | 894 | $date_cnt .= $date_item['date_count'].','; |
895 | 895 | } |
896 | 896 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
897 | - $date_cnt = "['vessels',".substr($date_cnt,0,-1)."]"; |
|
897 | + $date_cnt = "['vessels',".substr($date_cnt, 0, -1)."]"; |
|
898 | 898 | print 'c3.generate({ |
899 | 899 | bindto: "#chart5", |
900 | 900 | data: { x: "x", |
@@ -907,22 +907,22 @@ discard block |
||
907 | 907 | <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
908 | 908 | </div> |
909 | 909 | </div> |
910 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
910 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
911 | 911 | <div class="col-md-6"> |
912 | 912 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
913 | 913 | <?php |
914 | - $hour_array = $Marine->countAllHours('hour',true,$airline_icao,$filter_name); |
|
914 | + $hour_array = $Marine->countAllHours('hour', true, $airline_icao, $filter_name); |
|
915 | 915 | if (empty($hour_array)) print _("No data available"); |
916 | 916 | else { |
917 | 917 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
918 | 918 | $hour_data = ''; |
919 | 919 | $hour_cnt = ''; |
920 | - foreach($hour_array as $hour_item) { |
|
920 | + foreach ($hour_array as $hour_item) { |
|
921 | 921 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
922 | 922 | $hour_cnt .= $hour_item['hour_count'].','; |
923 | 923 | } |
924 | 924 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
925 | - $hour_cnt = "['vessels',".substr($hour_cnt,0,-1)."]"; |
|
925 | + $hour_cnt = "['vessels',".substr($hour_cnt, 0, -1)."]"; |
|
926 | 926 | print 'c3.generate({ |
927 | 927 | bindto: "#chart6", |
928 | 928 | data: { |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | <a href="<?php print $globalURL; ?>/marine/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
936 | 936 | </div> |
937 | 937 | </div> |
938 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
938 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
939 | 939 | </div> |
940 | 940 | <?php |
941 | 941 | } |
@@ -957,12 +957,12 @@ discard block |
||
957 | 957 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
958 | 958 | $year_data = ''; |
959 | 959 | $year_cnt = ''; |
960 | - foreach($year_array as $year_item) { |
|
960 | + foreach ($year_array as $year_item) { |
|
961 | 961 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
962 | 962 | $year_cnt .= $year_item['date_count'].','; |
963 | 963 | } |
964 | 964 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
965 | - $year_cnt = "['trackers',".substr($year_cnt,0,-1)."]"; |
|
965 | + $year_cnt = "['trackers',".substr($year_cnt, 0, -1)."]"; |
|
966 | 966 | print 'c3.generate({ |
967 | 967 | bindto: "#chart8", |
968 | 968 | data: { x: "x", |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | </div> |
977 | 977 | </div> |
978 | 978 | |
979 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
979 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
980 | 980 | <div class="col-md-6"> |
981 | 981 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
982 | 982 | <?php |
@@ -986,12 +986,12 @@ discard block |
||
986 | 986 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
987 | 987 | $month_data = ''; |
988 | 988 | $month_cnt = ''; |
989 | - foreach($month_array as $month_item) { |
|
989 | + foreach ($month_array as $month_item) { |
|
990 | 990 | $month_data .= '"'.$month_item['date_name'].'",'; |
991 | 991 | $month_cnt .= $month_item['date_count'].','; |
992 | 992 | } |
993 | 993 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
994 | - $month_cnt = "['trackers',".substr($month_cnt,0,-1)."]"; |
|
994 | + $month_cnt = "['trackers',".substr($month_cnt, 0, -1)."]"; |
|
995 | 995 | print 'c3.generate({ |
996 | 996 | bindto: "#chart9", |
997 | 997 | data: { x: "x", |
@@ -1004,7 +1004,7 @@ discard block |
||
1004 | 1004 | <a href="<?php print $globalURL; ?>/tracker/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1005 | 1005 | </div> |
1006 | 1006 | </div> |
1007 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1007 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1008 | 1008 | |
1009 | 1009 | <div class="col-md-6"> |
1010 | 1010 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
@@ -1015,12 +1015,12 @@ discard block |
||
1015 | 1015 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
1016 | 1016 | $date_data = ''; |
1017 | 1017 | $date_cnt = ''; |
1018 | - foreach($date_array as $date_item) { |
|
1018 | + foreach ($date_array as $date_item) { |
|
1019 | 1019 | $date_data .= '"'.$date_item['date_name'].'",'; |
1020 | 1020 | $date_cnt .= $date_item['date_count'].','; |
1021 | 1021 | } |
1022 | 1022 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
1023 | - $date_cnt = "['trackers',".substr($date_cnt,0,-1)."]"; |
|
1023 | + $date_cnt = "['trackers',".substr($date_cnt, 0, -1)."]"; |
|
1024 | 1024 | print 'c3.generate({ |
1025 | 1025 | bindto: "#chart5", |
1026 | 1026 | data: { x: "x", |
@@ -1033,22 +1033,22 @@ discard block |
||
1033 | 1033 | <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1034 | 1034 | </div> |
1035 | 1035 | </div> |
1036 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1036 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1037 | 1037 | <div class="col-md-6"> |
1038 | 1038 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
1039 | 1039 | <?php |
1040 | - $hour_array = $Tracker->countAllHours('hour',true); |
|
1040 | + $hour_array = $Tracker->countAllHours('hour', true); |
|
1041 | 1041 | if (empty($hour_array)) print _("No data available"); |
1042 | 1042 | else { |
1043 | 1043 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
1044 | 1044 | $hour_data = ''; |
1045 | 1045 | $hour_cnt = ''; |
1046 | - foreach($hour_array as $hour_item) { |
|
1046 | + foreach ($hour_array as $hour_item) { |
|
1047 | 1047 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
1048 | 1048 | $hour_cnt .= $hour_item['hour_count'].','; |
1049 | 1049 | } |
1050 | 1050 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
1051 | - $hour_cnt = "['trackers',".substr($hour_cnt,0,-1)."]"; |
|
1051 | + $hour_cnt = "['trackers',".substr($hour_cnt, 0, -1)."]"; |
|
1052 | 1052 | print 'c3.generate({ |
1053 | 1053 | bindto: "#chart6", |
1054 | 1054 | data: { |
@@ -1061,7 +1061,7 @@ discard block |
||
1061 | 1061 | <a href="<?php print $globalURL; ?>/tracker/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1062 | 1062 | </div> |
1063 | 1063 | </div> |
1064 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1064 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1065 | 1065 | </div> |
1066 | 1066 | <?php |
1067 | 1067 | } |
@@ -1083,12 +1083,12 @@ discard block |
||
1083 | 1083 | print '<div id="chart32" class="chart" width="100%"></div><script>'; |
1084 | 1084 | $year_data = ''; |
1085 | 1085 | $year_cnt = ''; |
1086 | - foreach($year_array as $year_item) { |
|
1086 | + foreach ($year_array as $year_item) { |
|
1087 | 1087 | $year_data .= '"'.$year_item['year'].'-01-01",'; |
1088 | 1088 | $year_cnt .= $year_item['count'].','; |
1089 | 1089 | } |
1090 | 1090 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1091 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
1091 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
1092 | 1092 | print 'c3.generate({ |
1093 | 1093 | bindto: "#chart32", |
1094 | 1094 | data: { x: "x", |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1102 | 1102 | </div> |
1103 | 1103 | </div> |
1104 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1104 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1105 | 1105 | |
1106 | 1106 | <div class="row column"> |
1107 | 1107 | <div class="col-md-6"> |
@@ -1113,12 +1113,12 @@ discard block |
||
1113 | 1113 | print '<div id="chart33" class="chart" width="100%"></div><script>'; |
1114 | 1114 | $year_data = ''; |
1115 | 1115 | $year_cnt = ''; |
1116 | - foreach($year_array as $year_item) { |
|
1116 | + foreach ($year_array as $year_item) { |
|
1117 | 1117 | $year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",'; |
1118 | 1118 | $year_cnt .= $year_item['count'].','; |
1119 | 1119 | } |
1120 | 1120 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1121 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
1121 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
1122 | 1122 | print 'c3.generate({ |
1123 | 1123 | bindto: "#chart33", |
1124 | 1124 | data: { x: "x", |
@@ -1131,7 +1131,7 @@ discard block |
||
1131 | 1131 | <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1132 | 1132 | </div> |
1133 | 1133 | </div> |
1134 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1134 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1135 | 1135 | <br/> |
1136 | 1136 | <?php |
1137 | 1137 | } |
@@ -1145,19 +1145,19 @@ discard block |
||
1145 | 1145 | //$polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
1146 | 1146 | if ($year == '' && $month == '') { |
1147 | 1147 | if ($type == 'aircraft') { |
1148 | - $polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d')); |
|
1148 | + $polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d')); |
|
1149 | 1149 | } elseif ($type == 'marine') { |
1150 | - $polar = $Stats->getStatsSource('polar_marine',date('Y'),date('m'),date('d')); |
|
1150 | + $polar = $Stats->getStatsSource('polar_marine', date('Y'), date('m'), date('d')); |
|
1151 | 1151 | } elseif ($type == 'tracker') { |
1152 | - $polar = $Stats->getStatsSource('polar_tracker',date('Y'),date('m'),date('d')); |
|
1152 | + $polar = $Stats->getStatsSource('polar_tracker', date('Y'), date('m'), date('d')); |
|
1153 | 1153 | } |
1154 | 1154 | } else { |
1155 | 1155 | if ($type == 'aircraft') { |
1156 | - $polar = $Stats->getStatsSource('polar',$year,$month); |
|
1156 | + $polar = $Stats->getStatsSource('polar', $year, $month); |
|
1157 | 1157 | } elseif ($type == 'marine') { |
1158 | - $polar = $Stats->getStatsSource('polar_marine',$year,$month); |
|
1158 | + $polar = $Stats->getStatsSource('polar_marine', $year, $month); |
|
1159 | 1159 | } elseif ($type == 'tracker') { |
1160 | - $polar = $Stats->getStatsSource('polar_tracker',$year,$month); |
|
1160 | + $polar = $Stats->getStatsSource('polar_tracker', $year, $month); |
|
1161 | 1161 | } |
1162 | 1162 | } |
1163 | 1163 | if (!empty($polar)) { |
@@ -1166,7 +1166,7 @@ discard block |
||
1166 | 1166 | unset($polar_data); |
1167 | 1167 | $Spotter = new Spotter(); |
1168 | 1168 | $data = json_decode($eachpolar['source_data']); |
1169 | - foreach($data as $value => $key) { |
|
1169 | + foreach ($data as $value => $key) { |
|
1170 | 1170 | $direction = $Spotter->parseDirection(($value*22.5)); |
1171 | 1171 | $distance = $key; |
1172 | 1172 | $unit = 'km'; |
@@ -1186,7 +1186,7 @@ discard block |
||
1186 | 1186 | ?> |
1187 | 1187 | <div class="col-md-6"> |
1188 | 1188 | <h4><?php print $eachpolar['source_name']; ?></h4> |
1189 | - <div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
1189 | + <div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
1190 | 1190 | <script> |
1191 | 1191 | (function() { |
1192 | 1192 | var margin = {top: 100, right: 100, bottom: 100, left: 100}, |
@@ -1210,7 +1210,7 @@ discard block |
||
1210 | 1210 | color: color, |
1211 | 1211 | unit: '<?php echo $unit; ?>' |
1212 | 1212 | }; |
1213 | - RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
1213 | + RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
1214 | 1214 | })(); |
1215 | 1215 | </script> |
1216 | 1216 | </div> |
@@ -1225,19 +1225,19 @@ discard block |
||
1225 | 1225 | //$msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
1226 | 1226 | if ($year == '' && $month == '') { |
1227 | 1227 | if ($type == 'aircraft') { |
1228 | - $msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d')); |
|
1228 | + $msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d')); |
|
1229 | 1229 | } elseif ($type == 'marine') { |
1230 | - $msg = $Stats->getStatsSource('msg_marine',date('Y'),date('m'),date('d')); |
|
1230 | + $msg = $Stats->getStatsSource('msg_marine', date('Y'), date('m'), date('d')); |
|
1231 | 1231 | } elseif ($type == 'tracker') { |
1232 | - $msg = $Stats->getStatsSource('msg_tracker',date('Y'),date('m'),date('d')); |
|
1232 | + $msg = $Stats->getStatsSource('msg_tracker', date('Y'), date('m'), date('d')); |
|
1233 | 1233 | } |
1234 | 1234 | } else { |
1235 | 1235 | if ($type == 'aircraft') { |
1236 | - $msg = $Stats->getStatsSource('msg',$year,$month); |
|
1236 | + $msg = $Stats->getStatsSource('msg', $year, $month); |
|
1237 | 1237 | } elseif ($type == 'marine') { |
1238 | - $msg = $Stats->getStatsSource('msg_marine',$year,$month); |
|
1238 | + $msg = $Stats->getStatsSource('msg_marine', $year, $month); |
|
1239 | 1239 | } elseif ($type == 'tracker') { |
1240 | - $msg = $Stats->getStatsSource('msg_tracker',$year,$month); |
|
1240 | + $msg = $Stats->getStatsSource('msg_tracker', $year, $month); |
|
1241 | 1241 | } |
1242 | 1242 | } |
1243 | 1243 | if (!empty($msg)) { |
@@ -1245,13 +1245,13 @@ discard block |
||
1245 | 1245 | foreach ($msg as $eachmsg) { |
1246 | 1246 | //$eachmsg = $msg[0]; |
1247 | 1247 | $data = $eachmsg['source_data']; |
1248 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
1248 | + if ($data > 500) $max = (round(($data + 100)/100))*100; |
|
1249 | 1249 | else $max = 500; |
1250 | 1250 | ?> |
1251 | - <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
1251 | + <div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
1252 | 1252 | <script> |
1253 | 1253 | var g = new JustGage({ |
1254 | - id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>", |
|
1254 | + id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>", |
|
1255 | 1255 | value: <?php echo $data; ?>, |
1256 | 1256 | min: 0, |
1257 | 1257 | max: <?php print $max; ?>, |
@@ -1273,19 +1273,19 @@ discard block |
||
1273 | 1273 | //$hist = $Stats->getStatsSource(date('Y-m-d'),'hist'); |
1274 | 1274 | if ($year == '' && $month == '') { |
1275 | 1275 | if ($type == 'aircraft') { |
1276 | - $hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d')); |
|
1276 | + $hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d')); |
|
1277 | 1277 | } elseif ($type == 'marine') { |
1278 | - $hist = $Stats->getStatsSource('hist_marine',date('Y'),date('m'),date('d')); |
|
1278 | + $hist = $Stats->getStatsSource('hist_marine', date('Y'), date('m'), date('d')); |
|
1279 | 1279 | } elseif ($type == 'tracker') { |
1280 | - $hist = $Stats->getStatsSource('hist_tracker',date('Y'),date('m'),date('d')); |
|
1280 | + $hist = $Stats->getStatsSource('hist_tracker', date('Y'), date('m'), date('d')); |
|
1281 | 1281 | } |
1282 | 1282 | } else { |
1283 | 1283 | if ($type == 'aircraft') { |
1284 | - $hist = $Stats->getStatsSource('hist',$year,$month); |
|
1284 | + $hist = $Stats->getStatsSource('hist', $year, $month); |
|
1285 | 1285 | } elseif ($type == 'marine') { |
1286 | - $hist = $Stats->getStatsSource('hist_marine',$year,$month); |
|
1286 | + $hist = $Stats->getStatsSource('hist_marine', $year, $month); |
|
1287 | 1287 | } elseif ($type == 'tracker') { |
1288 | - $hist = $Stats->getStatsSource('hist_tracker',$year,$month); |
|
1288 | + $hist = $Stats->getStatsSource('hist_tracker', $year, $month); |
|
1289 | 1289 | } |
1290 | 1290 | } |
1291 | 1291 | foreach ($hist as $hists) { |
@@ -1295,7 +1295,7 @@ discard block |
||
1295 | 1295 | $source = $hists['source_name']; |
1296 | 1296 | $hist_array = json_decode($hists['source_data']); |
1297 | 1297 | $unit = 'km'; |
1298 | - foreach($hist_array as $distance => $nb) { |
|
1298 | + foreach ($hist_array as $distance => $nb) { |
|
1299 | 1299 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
1300 | 1300 | $distance = round($distance*0.539957); |
1301 | 1301 | $unit = 'nm'; |
@@ -1315,18 +1315,18 @@ discard block |
||
1315 | 1315 | $nb_data = "['flights',".substr($nb_data, 0, -1)."]"; |
1316 | 1316 | ?> |
1317 | 1317 | <div class="col-md-6"> |
1318 | - <h2><?php echo sprintf(_("Distance for %s"),$source); ?></h2> |
|
1318 | + <h2><?php echo sprintf(_("Distance for %s"), $source); ?></h2> |
|
1319 | 1319 | <?php |
1320 | - print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
1320 | + print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
1321 | 1321 | print 'c3.generate({ |
1322 | - bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'", |
|
1322 | + bindto: "#charthist-'.str_replace(' ', '_', strtolower($source)).'", |
|
1323 | 1323 | data: { x: "x", |
1324 | 1324 | columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}}, |
1325 | 1325 | axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});'; |
1326 | 1326 | print '</script>'; |
1327 | 1327 | ?> |
1328 | 1328 | </div> |
1329 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1329 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1330 | 1330 | <?php |
1331 | 1331 | } |
1332 | 1332 | ?> |