|
@@ -15,10 +15,14 @@ discard block |
|
|
block discarded – undo |
|
15
|
15
|
|
|
16
|
16
|
public function __construct($dbc = null) { |
|
17
|
17
|
global $globalFilterName; |
|
18
|
|
- if (isset($globalFilterName)) $this->filter_name = $globalFilterName; |
|
|
18
|
+ if (isset($globalFilterName)) { |
|
|
19
|
+ $this->filter_name = $globalFilterName; |
|
|
20
|
+ } |
|
19
|
21
|
$Connection = new Connection($dbc); |
|
20
|
22
|
$this->db = $Connection->db(); |
|
21
|
|
- if ($this->db === null) die('Error: No DB connection. (Stats)'); |
|
|
23
|
+ if ($this->db === null) { |
|
|
24
|
+ die('Error: No DB connection. (Stats)'); |
|
|
25
|
+ } |
|
22
|
26
|
} |
|
23
|
27
|
|
|
24
|
28
|
public function addLastStatsUpdate($type,$stats_date) { |
|
@@ -86,7 +90,9 @@ discard block |
|
|
block discarded – undo |
|
86
|
90
|
|
|
87
|
91
|
public function getAllAirlineNames($filter_name = '') { |
|
88
|
92
|
global $globalStatsFilters; |
|
89
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
93
|
+ if ($filter_name == '') { |
|
|
94
|
+ $filter_name = $this->filter_name; |
|
|
95
|
+ } |
|
90
|
96
|
$query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
|
91
|
97
|
try { |
|
92
|
98
|
$sth = $this->db->prepare($query); |
|
@@ -106,7 +112,9 @@ discard block |
|
|
block discarded – undo |
|
106
|
112
|
return $all; |
|
107
|
113
|
} |
|
108
|
114
|
public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
|
109
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
115
|
+ if ($filter_name == '') { |
|
|
116
|
+ $filter_name = $this->filter_name; |
|
|
117
|
+ } |
|
110
|
118
|
$query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
|
111
|
119
|
try { |
|
112
|
120
|
$sth = $this->db->prepare($query); |
|
@@ -118,7 +126,9 @@ discard block |
|
|
block discarded – undo |
|
118
|
126
|
return $all; |
|
119
|
127
|
} |
|
120
|
128
|
public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
|
121
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
129
|
+ if ($filter_name == '') { |
|
|
130
|
+ $filter_name = $this->filter_name; |
|
|
131
|
+ } |
|
122
|
132
|
$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"; |
|
123
|
133
|
try { |
|
124
|
134
|
$sth = $this->db->prepare($query); |
|
@@ -130,7 +140,9 @@ discard block |
|
|
block discarded – undo |
|
130
|
140
|
return $all; |
|
131
|
141
|
} |
|
132
|
142
|
public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
|
133
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
143
|
+ if ($filter_name == '') { |
|
|
144
|
+ $filter_name = $this->filter_name; |
|
|
145
|
+ } |
|
134
|
146
|
$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"; |
|
135
|
147
|
try { |
|
136
|
148
|
$sth = $this->db->prepare($query); |
|
@@ -143,7 +155,9 @@ discard block |
|
|
block discarded – undo |
|
143
|
155
|
} |
|
144
|
156
|
|
|
145
|
157
|
public function getAllOwnerNames($stats_airline = '',$filter_name = '') { |
|
146
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
158
|
+ if ($filter_name == '') { |
|
|
159
|
+ $filter_name = $this->filter_name; |
|
|
160
|
+ } |
|
147
|
161
|
$query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC"; |
|
148
|
162
|
try { |
|
149
|
163
|
$sth = $this->db->prepare($query); |
|
@@ -156,7 +170,9 @@ discard block |
|
|
block discarded – undo |
|
156
|
170
|
} |
|
157
|
171
|
|
|
158
|
172
|
public function getAllPilotNames($stats_airline = '',$filter_name = '') { |
|
159
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
173
|
+ if ($filter_name == '') { |
|
|
174
|
+ $filter_name = $this->filter_name; |
|
|
175
|
+ } |
|
160
|
176
|
$query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC"; |
|
161
|
177
|
try { |
|
162
|
178
|
$sth = $this->db->prepare($query); |
|
@@ -171,7 +187,9 @@ discard block |
|
|
block discarded – undo |
|
171
|
187
|
|
|
172
|
188
|
public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
173
|
189
|
global $globalStatsFilters; |
|
174
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
190
|
+ if ($filter_name == '') { |
|
|
191
|
+ $filter_name = $this->filter_name; |
|
|
192
|
+ } |
|
175
|
193
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
176
|
194
|
$Spotter = new Spotter($this->db); |
|
177
|
195
|
$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
@@ -180,8 +198,11 @@ discard block |
|
|
block discarded – undo |
|
180
|
198
|
$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
181
|
199
|
} |
|
182
|
200
|
if ($year == '' && $month == '') { |
|
183
|
|
- 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 aircraft_icao <> 'NA' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
184
|
|
- else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
|
201
|
+ if ($limit) { |
|
|
202
|
+ $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
|
203
|
+ } else { |
|
|
204
|
+ $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
|
205
|
+ } |
|
185
|
206
|
try { |
|
186
|
207
|
$sth = $this->db->prepare($query); |
|
187
|
208
|
$sth->execute(array(':filter_name' => $filter_name)); |
|
@@ -189,11 +210,16 @@ discard block |
|
|
block discarded – undo |
|
189
|
210
|
echo "error : ".$e->getMessage(); |
|
190
|
211
|
} |
|
191
|
212
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
192
|
|
- } else $all = array(); |
|
|
213
|
+ } else { |
|
|
214
|
+ $all = array(); |
|
|
215
|
+ } |
|
193
|
216
|
} else { |
|
194
|
217
|
if ($year == '' && $month == '') { |
|
195
|
|
- 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 aircraft_icao <> 'NA' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
196
|
|
- else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
|
218
|
+ if ($limit) { |
|
|
219
|
+ $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
|
220
|
+ } else { |
|
|
221
|
+ $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
|
222
|
+ } |
|
197
|
223
|
try { |
|
198
|
224
|
$sth = $this->db->prepare($query); |
|
199
|
225
|
$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
@@ -201,7 +227,9 @@ discard block |
|
|
block discarded – undo |
|
201
|
227
|
echo "error : ".$e->getMessage(); |
|
202
|
228
|
} |
|
203
|
229
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
204
|
|
- } else $all = array(); |
|
|
230
|
+ } else { |
|
|
231
|
+ $all = array(); |
|
|
232
|
+ } |
|
205
|
233
|
} |
|
206
|
234
|
if (empty($all)) { |
|
207
|
235
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
@@ -220,10 +248,15 @@ discard block |
|
|
block discarded – undo |
|
220
|
248
|
} |
|
221
|
249
|
public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
|
222
|
250
|
global $globalStatsFilters; |
|
223
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
251
|
+ if ($filter_name == '') { |
|
|
252
|
+ $filter_name = $this->filter_name; |
|
|
253
|
+ } |
|
224
|
254
|
if ($year == '' && $month == '') { |
|
225
|
|
- if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
226
|
|
- else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC"; |
|
|
255
|
+ if ($limit) { |
|
|
256
|
+ $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
|
257
|
+ } else { |
|
|
258
|
+ $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC"; |
|
|
259
|
+ } |
|
227
|
260
|
try { |
|
228
|
261
|
$sth = $this->db->prepare($query); |
|
229
|
262
|
$sth->execute(array(':filter_name' => $filter_name)); |
|
@@ -231,7 +264,9 @@ discard block |
|
|
block discarded – undo |
|
231
|
264
|
echo "error : ".$e->getMessage(); |
|
232
|
265
|
} |
|
233
|
266
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
234
|
|
- } else $all = array(); |
|
|
267
|
+ } else { |
|
|
268
|
+ $all = array(); |
|
|
269
|
+ } |
|
235
|
270
|
if (empty($all)) { |
|
236
|
271
|
$Spotter = new Spotter($this->db); |
|
237
|
272
|
$filters = array(); |
|
@@ -246,7 +281,9 @@ discard block |
|
|
block discarded – undo |
|
246
|
281
|
} |
|
247
|
282
|
public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
248
|
283
|
global $globalStatsFilters; |
|
249
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
284
|
+ if ($filter_name == '') { |
|
|
285
|
+ $filter_name = $this->filter_name; |
|
|
286
|
+ } |
|
250
|
287
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
251
|
288
|
$Spotter = new Spotter($this->db); |
|
252
|
289
|
$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
@@ -255,8 +292,11 @@ discard block |
|
|
block discarded – undo |
|
255
|
292
|
$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
256
|
293
|
} |
|
257
|
294
|
if ($year == '' && $month == '') { |
|
258
|
|
- 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"; |
|
259
|
|
- 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"; |
|
|
295
|
+ if ($limit) { |
|
|
296
|
+ $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"; |
|
|
297
|
+ } else { |
|
|
298
|
+ $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"; |
|
|
299
|
+ } |
|
260
|
300
|
try { |
|
261
|
301
|
$sth = $this->db->prepare($query); |
|
262
|
302
|
$sth->execute(array(':filter_name' => $filter_name)); |
|
@@ -264,11 +304,16 @@ discard block |
|
|
block discarded – undo |
|
264
|
304
|
echo "error : ".$e->getMessage(); |
|
265
|
305
|
} |
|
266
|
306
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
267
|
|
- } else $all = array(); |
|
|
307
|
+ } else { |
|
|
308
|
+ $all = array(); |
|
|
309
|
+ } |
|
268
|
310
|
} else { |
|
269
|
311
|
if ($year == '' && $month == '') { |
|
270
|
|
- if ($limit) $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 LIMIT 10 OFFSET 0"; |
|
271
|
|
- 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"; |
|
|
312
|
+ if ($limit) { |
|
|
313
|
+ $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 LIMIT 10 OFFSET 0"; |
|
|
314
|
+ } else { |
|
|
315
|
+ $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"; |
|
|
316
|
+ } |
|
272
|
317
|
try { |
|
273
|
318
|
$sth = $this->db->prepare($query); |
|
274
|
319
|
$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
@@ -276,7 +321,9 @@ discard block |
|
|
block discarded – undo |
|
276
|
321
|
echo "error : ".$e->getMessage(); |
|
277
|
322
|
} |
|
278
|
323
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
279
|
|
- } else $all = array(); |
|
|
324
|
+ } else { |
|
|
325
|
+ $all = array(); |
|
|
326
|
+ } |
|
280
|
327
|
} |
|
281
|
328
|
if (empty($all)) { |
|
282
|
329
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
@@ -296,7 +343,9 @@ discard block |
|
|
block discarded – undo |
|
296
|
343
|
|
|
297
|
344
|
public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
298
|
345
|
global $globalStatsFilters; |
|
299
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
346
|
+ if ($filter_name == '') { |
|
|
347
|
+ $filter_name = $this->filter_name; |
|
|
348
|
+ } |
|
300
|
349
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
301
|
350
|
$Spotter = new Spotter($this->db); |
|
302
|
351
|
$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
@@ -305,8 +354,11 @@ discard block |
|
|
block discarded – undo |
|
305
|
354
|
$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
306
|
355
|
} |
|
307
|
356
|
if ($year == '' && $month == '') { |
|
308
|
|
- 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"; |
|
309
|
|
- 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"; |
|
|
357
|
+ if ($limit) { |
|
|
358
|
+ $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"; |
|
|
359
|
+ } else { |
|
|
360
|
+ $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"; |
|
|
361
|
+ } |
|
310
|
362
|
try { |
|
311
|
363
|
$sth = $this->db->prepare($query); |
|
312
|
364
|
$sth->execute(array(':filter_name' => $filter_name)); |
|
@@ -314,11 +366,16 @@ discard block |
|
|
block discarded – undo |
|
314
|
366
|
echo "error : ".$e->getMessage(); |
|
315
|
367
|
} |
|
316
|
368
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
317
|
|
- } else $all = array(); |
|
|
369
|
+ } else { |
|
|
370
|
+ $all = array(); |
|
|
371
|
+ } |
|
318
|
372
|
} else { |
|
319
|
373
|
if ($year == '' && $month == '') { |
|
320
|
|
- 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 = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
321
|
|
- 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"; |
|
|
374
|
+ if ($limit) { |
|
|
375
|
+ $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 = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
|
376
|
+ } else { |
|
|
377
|
+ $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"; |
|
|
378
|
+ } |
|
322
|
379
|
try { |
|
323
|
380
|
$sth = $this->db->prepare($query); |
|
324
|
381
|
$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
@@ -326,7 +383,9 @@ discard block |
|
|
block discarded – undo |
|
326
|
383
|
echo "error : ".$e->getMessage(); |
|
327
|
384
|
} |
|
328
|
385
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
329
|
|
- } else $all = array(); |
|
|
386
|
+ } else { |
|
|
387
|
+ $all = array(); |
|
|
388
|
+ } |
|
330
|
389
|
} |
|
331
|
390
|
if (empty($all)) { |
|
332
|
391
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
@@ -345,7 +404,9 @@ discard block |
|
|
block discarded – undo |
|
345
|
404
|
} |
|
346
|
405
|
public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
347
|
406
|
global $globalStatsFilters; |
|
348
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
407
|
+ if ($filter_name == '') { |
|
|
408
|
+ $filter_name = $this->filter_name; |
|
|
409
|
+ } |
|
349
|
410
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
350
|
411
|
$Spotter = new Spotter($this->db); |
|
351
|
412
|
$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
@@ -353,12 +414,18 @@ discard block |
|
|
block discarded – undo |
|
353
|
414
|
foreach ($airlines as $airline) { |
|
354
|
415
|
$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
355
|
416
|
} |
|
356
|
|
- 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"; |
|
357
|
|
- 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"; |
|
|
417
|
+ if ($limit) { |
|
|
418
|
+ $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"; |
|
|
419
|
+ } else { |
|
|
420
|
+ $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"; |
|
|
421
|
+ } |
|
358
|
422
|
$query_values = array(':filter_name' => $filter_name); |
|
359
|
423
|
} else { |
|
360
|
|
- 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"; |
|
361
|
|
- 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"; |
|
|
424
|
+ if ($limit) { |
|
|
425
|
+ $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"; |
|
|
426
|
+ } else { |
|
|
427
|
+ $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"; |
|
|
428
|
+ } |
|
362
|
429
|
$query_values = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
363
|
430
|
} |
|
364
|
431
|
try { |
|
@@ -386,17 +453,29 @@ discard block |
|
|
block discarded – undo |
|
386
|
453
|
|
|
387
|
454
|
public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
|
388
|
455
|
global $globalStatsFilters, $globalVATSIM, $globalIVAO; |
|
389
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
456
|
+ if ($filter_name == '') { |
|
|
457
|
+ $filter_name = $this->filter_name; |
|
|
458
|
+ } |
|
390
|
459
|
if ($year == '' && $month == '') { |
|
391
|
|
- if ($globalVATSIM) $forsource = 'vatsim'; |
|
392
|
|
- if ($globalIVAO) $forsource = 'ivao'; |
|
|
460
|
+ if ($globalVATSIM) { |
|
|
461
|
+ $forsource = 'vatsim'; |
|
|
462
|
+ } |
|
|
463
|
+ if ($globalIVAO) { |
|
|
464
|
+ $forsource = 'ivao'; |
|
|
465
|
+ } |
|
393
|
466
|
if (isset($forsource)) { |
|
394
|
|
- 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"; |
|
395
|
|
- 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"; |
|
|
467
|
+ if ($limit) { |
|
|
468
|
+ $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"; |
|
|
469
|
+ } else { |
|
|
470
|
+ $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"; |
|
|
471
|
+ } |
|
396
|
472
|
$query_values = array(':filter_name' => $filter_name,':forsource' => $forsource); |
|
397
|
473
|
} else { |
|
398
|
|
- 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"; |
|
399
|
|
- 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"; |
|
|
474
|
+ if ($limit) { |
|
|
475
|
+ $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"; |
|
|
476
|
+ } else { |
|
|
477
|
+ $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"; |
|
|
478
|
+ } |
|
400
|
479
|
$query_values = array(':filter_name' => $filter_name); |
|
401
|
480
|
} |
|
402
|
481
|
try { |
|
@@ -406,7 +485,9 @@ discard block |
|
|
block discarded – undo |
|
406
|
485
|
echo "error : ".$e->getMessage(); |
|
407
|
486
|
} |
|
408
|
487
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
409
|
|
- } else $all = array(); |
|
|
488
|
+ } else { |
|
|
489
|
+ $all = array(); |
|
|
490
|
+ } |
|
410
|
491
|
if (empty($all)) { |
|
411
|
492
|
$Spotter = new Spotter($this->db); |
|
412
|
493
|
$filters = array(); |
|
@@ -421,7 +502,9 @@ discard block |
|
|
block discarded – undo |
|
421
|
502
|
} |
|
422
|
503
|
public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
423
|
504
|
global $globalStatsFilters; |
|
424
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
505
|
+ if ($filter_name == '') { |
|
|
506
|
+ $filter_name = $this->filter_name; |
|
|
507
|
+ } |
|
425
|
508
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
426
|
509
|
$Spotter = new Spotter($this->db); |
|
427
|
510
|
$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
@@ -430,8 +513,11 @@ discard block |
|
|
block discarded – undo |
|
430
|
513
|
$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
431
|
514
|
} |
|
432
|
515
|
if ($year == '' && $month == '') { |
|
433
|
|
- if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS 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 registration_count DESC LIMIT 10 OFFSET 0"; |
|
434
|
|
- else $query = "SELECT s.aircraft_icao, s.cnt AS 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 registration_count DESC"; |
|
|
516
|
+ if ($limit) { |
|
|
517
|
+ $query = "SELECT s.aircraft_icao, s.cnt AS 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 registration_count DESC LIMIT 10 OFFSET 0"; |
|
|
518
|
+ } else { |
|
|
519
|
+ $query = "SELECT s.aircraft_icao, s.cnt AS 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 registration_count DESC"; |
|
|
520
|
+ } |
|
435
|
521
|
try { |
|
436
|
522
|
$sth = $this->db->prepare($query); |
|
437
|
523
|
$sth->execute(array(':filter_name' => $filter_name)); |
|
@@ -439,11 +525,16 @@ discard block |
|
|
block discarded – undo |
|
439
|
525
|
echo "error : ".$e->getMessage(); |
|
440
|
526
|
} |
|
441
|
527
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
442
|
|
- } else $all = array(); |
|
|
528
|
+ } else { |
|
|
529
|
+ $all = array(); |
|
|
530
|
+ } |
|
443
|
531
|
} else { |
|
444
|
532
|
if ($year == '' && $month == '') { |
|
445
|
|
- if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS 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 = :stats_airline AND filter_name = :filter_name ORDER BY registration_count DESC LIMIT 10 OFFSET 0"; |
|
446
|
|
- else $query = "SELECT s.aircraft_icao, s.cnt AS 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 registration_count DESC"; |
|
|
533
|
+ if ($limit) { |
|
|
534
|
+ $query = "SELECT s.aircraft_icao, s.cnt AS 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 = :stats_airline AND filter_name = :filter_name ORDER BY registration_count DESC LIMIT 10 OFFSET 0"; |
|
|
535
|
+ } else { |
|
|
536
|
+ $query = "SELECT s.aircraft_icao, s.cnt AS 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 registration_count DESC"; |
|
|
537
|
+ } |
|
447
|
538
|
try { |
|
448
|
539
|
$sth = $this->db->prepare($query); |
|
449
|
540
|
$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
@@ -451,7 +542,9 @@ discard block |
|
|
block discarded – undo |
|
451
|
542
|
echo "error : ".$e->getMessage(); |
|
452
|
543
|
} |
|
453
|
544
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
454
|
|
- } else $all = array(); |
|
|
545
|
+ } else { |
|
|
546
|
+ $all = array(); |
|
|
547
|
+ } |
|
455
|
548
|
} |
|
456
|
549
|
if (empty($all)) { |
|
457
|
550
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
@@ -470,7 +563,9 @@ discard block |
|
|
block discarded – undo |
|
470
|
563
|
} |
|
471
|
564
|
public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
472
|
565
|
global $globalStatsFilters; |
|
473
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
566
|
+ if ($filter_name == '') { |
|
|
567
|
+ $filter_name = $this->filter_name; |
|
|
568
|
+ } |
|
474
|
569
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
475
|
570
|
$Spotter = new Spotter($this->db); |
|
476
|
571
|
$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
@@ -479,8 +574,11 @@ discard block |
|
|
block discarded – undo |
|
479
|
574
|
$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
480
|
575
|
} |
|
481
|
576
|
if ($year == '' && $month == '') { |
|
482
|
|
- 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"; |
|
483
|
|
- 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"; |
|
|
577
|
+ if ($limit) { |
|
|
578
|
+ $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"; |
|
|
579
|
+ } else { |
|
|
580
|
+ $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"; |
|
|
581
|
+ } |
|
484
|
582
|
try { |
|
485
|
583
|
$sth = $this->db->prepare($query); |
|
486
|
584
|
$sth->execute(array(':filter_name' => $filter_name)); |
|
@@ -488,11 +586,16 @@ discard block |
|
|
block discarded – undo |
|
488
|
586
|
echo "error : ".$e->getMessage(); |
|
489
|
587
|
} |
|
490
|
588
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
491
|
|
- } else $all = array(); |
|
|
589
|
+ } else { |
|
|
590
|
+ $all = array(); |
|
|
591
|
+ } |
|
492
|
592
|
} else { |
|
493
|
593
|
if ($year == '' && $month == '') { |
|
494
|
|
- 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 = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
495
|
|
- 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"; |
|
|
594
|
+ if ($limit) { |
|
|
595
|
+ $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 LIMIT 10 OFFSET 0"; |
|
|
596
|
+ } else { |
|
|
597
|
+ $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"; |
|
|
598
|
+ } |
|
496
|
599
|
try { |
|
497
|
600
|
$sth = $this->db->prepare($query); |
|
498
|
601
|
$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
@@ -500,7 +603,9 @@ discard block |
|
|
block discarded – undo |
|
500
|
603
|
echo "error : ".$e->getMessage(); |
|
501
|
604
|
} |
|
502
|
605
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
503
|
|
- } else $all = array(); |
|
|
606
|
+ } else { |
|
|
607
|
+ $all = array(); |
|
|
608
|
+ } |
|
504
|
609
|
} |
|
505
|
610
|
if (empty($all)) { |
|
506
|
611
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
@@ -519,7 +624,9 @@ discard block |
|
|
block discarded – undo |
|
519
|
624
|
} |
|
520
|
625
|
public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
521
|
626
|
$Connection = new Connection($this->db); |
|
522
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
627
|
+ if ($filter_name == '') { |
|
|
628
|
+ $filter_name = $this->filter_name; |
|
|
629
|
+ } |
|
523
|
630
|
if ($Connection->tableExists('countries')) { |
|
524
|
631
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
525
|
632
|
$Spotter = new Spotter($this->db); |
|
@@ -529,8 +636,11 @@ discard block |
|
|
block discarded – undo |
|
529
|
636
|
foreach ($airlines as $airline) { |
|
530
|
637
|
$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
531
|
638
|
} |
|
532
|
|
- 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"; |
|
533
|
|
- 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"; |
|
|
639
|
+ if ($limit) { |
|
|
640
|
+ $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"; |
|
|
641
|
+ } else { |
|
|
642
|
+ $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"; |
|
|
643
|
+ } |
|
534
|
644
|
try { |
|
535
|
645
|
$sth = $this->db->prepare($query); |
|
536
|
646
|
$sth->execute(array(':filter_name' => $filter_name)); |
|
@@ -539,11 +649,16 @@ discard block |
|
|
block discarded – undo |
|
539
|
649
|
} |
|
540
|
650
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
541
|
651
|
return $all; |
|
542
|
|
- } else return array(); |
|
|
652
|
+ } else { |
|
|
653
|
+ return array(); |
|
|
654
|
+ } |
|
543
|
655
|
} else { |
|
544
|
656
|
if ($year == '' && $month == '') { |
|
545
|
|
- 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 = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
546
|
|
- 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"; |
|
|
657
|
+ if ($limit) { |
|
|
658
|
+ $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 LIMIT 20 OFFSET 0"; |
|
|
659
|
+ } else { |
|
|
660
|
+ $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"; |
|
|
661
|
+ } |
|
547
|
662
|
try { |
|
548
|
663
|
$sth = $this->db->prepare($query); |
|
549
|
664
|
$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
@@ -552,19 +667,28 @@ discard block |
|
|
block discarded – undo |
|
552
|
667
|
} |
|
553
|
668
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
554
|
669
|
return $all; |
|
555
|
|
- } else return array(); |
|
|
670
|
+ } else { |
|
|
671
|
+ return array(); |
|
|
672
|
+ } |
|
556
|
673
|
} |
|
557
|
674
|
$Spotter = new Spotter($this->db); |
|
558
|
675
|
return $Spotter->countAllFlightOverCountries($limit); |
|
559
|
|
- } else return array(); |
|
|
676
|
+ } else { |
|
|
677
|
+ return array(); |
|
|
678
|
+ } |
|
560
|
679
|
} |
|
561
|
680
|
public function countAllMarineOverCountries($limit = true, $filter_name = '',$year = '',$month = '') { |
|
562
|
681
|
$Connection = new Connection($this->db); |
|
563
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
682
|
+ if ($filter_name == '') { |
|
|
683
|
+ $filter_name = $this->filter_name; |
|
|
684
|
+ } |
|
564
|
685
|
if ($Connection->tableExists('countries')) { |
|
565
|
686
|
if ($year == '' && $month == '') { |
|
566
|
|
- if ($limit) $query = "SELECT countries.iso3 as marine_country_iso3, countries.iso2 as marine_country_iso2, countries.name as marine_country, cnt as marine_count, lat as marine_country_latitude, lon as marine_country_longitude FROM stats_marine_country, countries WHERE stats_marine_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY marine_count DESC LIMIT 20 OFFSET 0"; |
|
567
|
|
- else $query = "SELECT countries.iso3 as marine_country_iso3, countries.iso2 as marine_country_iso2, countries.name as marine_country, cnt as marine_count, lat as marine_country_latitude, lon as marine_country_longitude FROM stats_marine_country, countries WHERE stats_marine_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY marine_count DESC"; |
|
|
687
|
+ if ($limit) { |
|
|
688
|
+ $query = "SELECT countries.iso3 as marine_country_iso3, countries.iso2 as marine_country_iso2, countries.name as marine_country, cnt as marine_count, lat as marine_country_latitude, lon as marine_country_longitude FROM stats_marine_country, countries WHERE stats_marine_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY marine_count DESC LIMIT 20 OFFSET 0"; |
|
|
689
|
+ } else { |
|
|
690
|
+ $query = "SELECT countries.iso3 as marine_country_iso3, countries.iso2 as marine_country_iso2, countries.name as marine_country, cnt as marine_count, lat as marine_country_latitude, lon as marine_country_longitude FROM stats_marine_country, countries WHERE stats_marine_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY marine_count DESC"; |
|
|
691
|
+ } |
|
568
|
692
|
try { |
|
569
|
693
|
$sth = $this->db->prepare($query); |
|
570
|
694
|
$sth->execute(array(':filter_name' => $filter_name)); |
|
@@ -580,15 +704,22 @@ discard block |
|
|
block discarded – undo |
|
580
|
704
|
} |
|
581
|
705
|
$Marine = new Marine($this->db); |
|
582
|
706
|
return $Marine->countAllMarineOverCountries($limit,$filters,$year,$month); |
|
583
|
|
- } else return array(); |
|
|
707
|
+ } else { |
|
|
708
|
+ return array(); |
|
|
709
|
+ } |
|
584
|
710
|
} |
|
585
|
711
|
public function countAllTrackerOverCountries($limit = true, $filter_name = '',$year = '',$month = '') { |
|
586
|
712
|
$Connection = new Connection($this->db); |
|
587
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
713
|
+ if ($filter_name == '') { |
|
|
714
|
+ $filter_name = $this->filter_name; |
|
|
715
|
+ } |
|
588
|
716
|
if ($Connection->tableExists('countries')) { |
|
589
|
717
|
if ($year == '' && $month == '') { |
|
590
|
|
- if ($limit) $query = "SELECT countries.iso3 as tracker_country_iso3, countries.iso2 as tracker_country_iso2, countries.name as tracker_country, cnt as tracker_count, lat as tracker_country_latitude, lon as tracker_country_longitude FROM stats_tracker_country, countries WHERE stats_tracker_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY tracker_count DESC LIMIT 20 OFFSET 0"; |
|
591
|
|
- else $query = "SELECT countries.iso3 as tracker_country_iso3, countries.iso2 as tracker_country_iso2, countries.name as tracker_country, cnt as tracker_count, lat as tracker_country_latitude, lon as tracker_country_longitude FROM stats_tracker_country, countries WHERE stats_tracker_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY tracker_count DESC"; |
|
|
718
|
+ if ($limit) { |
|
|
719
|
+ $query = "SELECT countries.iso3 as tracker_country_iso3, countries.iso2 as tracker_country_iso2, countries.name as tracker_country, cnt as tracker_count, lat as tracker_country_latitude, lon as tracker_country_longitude FROM stats_tracker_country, countries WHERE stats_tracker_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY tracker_count DESC LIMIT 20 OFFSET 0"; |
|
|
720
|
+ } else { |
|
|
721
|
+ $query = "SELECT countries.iso3 as tracker_country_iso3, countries.iso2 as tracker_country_iso2, countries.name as tracker_country, cnt as tracker_count, lat as tracker_country_latitude, lon as tracker_country_longitude FROM stats_tracker_country, countries WHERE stats_tracker_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY tracker_count DESC"; |
|
|
722
|
+ } |
|
592
|
723
|
try { |
|
593
|
724
|
$sth = $this->db->prepare($query); |
|
594
|
725
|
$sth->execute(array(':filter_name' => $filter_name)); |
|
@@ -600,14 +731,21 @@ discard block |
|
|
block discarded – undo |
|
600
|
731
|
} |
|
601
|
732
|
$Tracker = new Tracker($this->db); |
|
602
|
733
|
return $Tracker->countAllTrackerOverCountries($limit,$filters,$year,$month); |
|
603
|
|
- } else return array(); |
|
|
734
|
+ } else { |
|
|
735
|
+ return array(); |
|
|
736
|
+ } |
|
604
|
737
|
} |
|
605
|
738
|
public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') { |
|
606
|
739
|
global $globalStatsFilters; |
|
607
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
740
|
+ if ($filter_name == '') { |
|
|
741
|
+ $filter_name = $this->filter_name; |
|
|
742
|
+ } |
|
608
|
743
|
if ($year == '' && $month == '') { |
|
609
|
|
- if ($limit) $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 LIMIT 10 OFFSET 0"; |
|
610
|
|
- 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"; |
|
|
744
|
+ if ($limit) { |
|
|
745
|
+ $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 LIMIT 10 OFFSET 0"; |
|
|
746
|
+ } else { |
|
|
747
|
+ $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"; |
|
|
748
|
+ } |
|
611
|
749
|
try { |
|
612
|
750
|
$sth = $this->db->prepare($query); |
|
613
|
751
|
$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
@@ -615,7 +753,9 @@ discard block |
|
|
block discarded – undo |
|
615
|
753
|
echo "error : ".$e->getMessage(); |
|
616
|
754
|
} |
|
617
|
755
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
618
|
|
- } else $all = array(); |
|
|
756
|
+ } else { |
|
|
757
|
+ $all = array(); |
|
|
758
|
+ } |
|
619
|
759
|
if (empty($all)) { |
|
620
|
760
|
$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
621
|
761
|
if ($filter_name != '') { |
|
@@ -630,7 +770,9 @@ discard block |
|
|
block discarded – undo |
|
630
|
770
|
|
|
631
|
771
|
public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') { |
|
632
|
772
|
global $globalStatsFilters; |
|
633
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
773
|
+ if ($filter_name == '') { |
|
|
774
|
+ $filter_name = $this->filter_name; |
|
|
775
|
+ } |
|
634
|
776
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
635
|
777
|
$Spotter = new Spotter($this->db); |
|
636
|
778
|
$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
@@ -639,8 +781,11 @@ discard block |
|
|
block discarded – undo |
|
639
|
781
|
foreach ($airlines as $airline) { |
|
640
|
782
|
$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
641
|
783
|
} |
|
642
|
|
- 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"; |
|
643
|
|
- 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"; |
|
|
784
|
+ if ($limit) { |
|
|
785
|
+ $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"; |
|
|
786
|
+ } else { |
|
|
787
|
+ $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"; |
|
|
788
|
+ } |
|
644
|
789
|
try { |
|
645
|
790
|
$sth = $this->db->prepare($query); |
|
646
|
791
|
$sth->execute(array(':filter_name' => $filter_name)); |
|
@@ -648,11 +793,16 @@ discard block |
|
|
block discarded – undo |
|
648
|
793
|
echo "error : ".$e->getMessage(); |
|
649
|
794
|
} |
|
650
|
795
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
651
|
|
- } else $all = array(); |
|
|
796
|
+ } else { |
|
|
797
|
+ $all = array(); |
|
|
798
|
+ } |
|
652
|
799
|
} else { |
|
653
|
800
|
if ($year == '' && $month == '') { |
|
654
|
|
- if ($limit) $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 LIMIT 10 OFFSET 0"; |
|
655
|
|
- 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"; |
|
|
801
|
+ if ($limit) { |
|
|
802
|
+ $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 LIMIT 10 OFFSET 0"; |
|
|
803
|
+ } else { |
|
|
804
|
+ $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"; |
|
|
805
|
+ } |
|
656
|
806
|
try { |
|
657
|
807
|
$sth = $this->db->prepare($query); |
|
658
|
808
|
$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
@@ -660,7 +810,9 @@ discard block |
|
|
block discarded – undo |
|
660
|
810
|
echo "error : ".$e->getMessage(); |
|
661
|
811
|
} |
|
662
|
812
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
663
|
|
- } else $all = array(); |
|
|
813
|
+ } else { |
|
|
814
|
+ $all = array(); |
|
|
815
|
+ } |
|
664
|
816
|
} |
|
665
|
817
|
if (empty($all)) { |
|
666
|
818
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
@@ -679,7 +831,9 @@ discard block |
|
|
block discarded – undo |
|
679
|
831
|
} |
|
680
|
832
|
public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
681
|
833
|
global $globalStatsFilters; |
|
682
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
834
|
+ if ($filter_name == '') { |
|
|
835
|
+ $filter_name = $this->filter_name; |
|
|
836
|
+ } |
|
683
|
837
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
684
|
838
|
$Spotter = new Spotter($this->db); |
|
685
|
839
|
$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
@@ -688,8 +842,11 @@ discard block |
|
|
block discarded – undo |
|
688
|
842
|
foreach ($airlines as $airline) { |
|
689
|
843
|
$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
690
|
844
|
} |
|
691
|
|
- if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,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"; |
|
692
|
|
- else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,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"; |
|
|
845
|
+ if ($limit) { |
|
|
846
|
+ $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,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"; |
|
|
847
|
+ } else { |
|
|
848
|
+ $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,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"; |
|
|
849
|
+ } |
|
693
|
850
|
try { |
|
694
|
851
|
$sth = $this->db->prepare($query); |
|
695
|
852
|
$sth->execute(array(':filter_name' => $filter_name)); |
|
@@ -697,11 +854,16 @@ discard block |
|
|
block discarded – undo |
|
697
|
854
|
echo "error : ".$e->getMessage(); |
|
698
|
855
|
} |
|
699
|
856
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
700
|
|
- } else $all = array(); |
|
|
857
|
+ } else { |
|
|
858
|
+ $all = array(); |
|
|
859
|
+ } |
|
701
|
860
|
} else { |
|
702
|
861
|
if ($year == '' && $month == '') { |
|
703
|
|
- if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,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 LIMIT 10 OFFSET 0"; |
|
704
|
|
- else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,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"; |
|
|
862
|
+ if ($limit) { |
|
|
863
|
+ $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,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 LIMIT 10 OFFSET 0"; |
|
|
864
|
+ } else { |
|
|
865
|
+ $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,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"; |
|
|
866
|
+ } |
|
705
|
867
|
try { |
|
706
|
868
|
$sth = $this->db->prepare($query); |
|
707
|
869
|
$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
@@ -709,7 +871,9 @@ discard block |
|
|
block discarded – undo |
|
709
|
871
|
echo "error : ".$e->getMessage(); |
|
710
|
872
|
} |
|
711
|
873
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
712
|
|
- } else $all = array(); |
|
|
874
|
+ } else { |
|
|
875
|
+ $all = array(); |
|
|
876
|
+ } |
|
713
|
877
|
} |
|
714
|
878
|
if (empty($all)) { |
|
715
|
879
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
@@ -734,7 +898,9 @@ discard block |
|
|
block discarded – undo |
|
734
|
898
|
$icao = $value['airport_departure_icao']; |
|
735
|
899
|
if (isset($all[$icao])) { |
|
736
|
900
|
$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
737
|
|
- } else $all[$icao] = $value; |
|
|
901
|
+ } else { |
|
|
902
|
+ $all[$icao] = $value; |
|
|
903
|
+ } |
|
738
|
904
|
} |
|
739
|
905
|
$count = array(); |
|
740
|
906
|
foreach ($all as $key => $row) { |
|
@@ -746,7 +912,9 @@ discard block |
|
|
block discarded – undo |
|
746
|
912
|
} |
|
747
|
913
|
public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
748
|
914
|
global $globalStatsFilters; |
|
749
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
915
|
+ if ($filter_name == '') { |
|
|
916
|
+ $filter_name = $this->filter_name; |
|
|
917
|
+ } |
|
750
|
918
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
751
|
919
|
$Spotter = new Spotter($this->db); |
|
752
|
920
|
$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
@@ -755,8 +923,11 @@ discard block |
|
|
block discarded – undo |
|
755
|
923
|
foreach ($airlines as $airline) { |
|
756
|
924
|
$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
757
|
925
|
} |
|
758
|
|
- if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, 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"; |
|
759
|
|
- else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, 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"; |
|
|
926
|
+ if ($limit) { |
|
|
927
|
+ $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, 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"; |
|
|
928
|
+ } else { |
|
|
929
|
+ $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, 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"; |
|
|
930
|
+ } |
|
760
|
931
|
try { |
|
761
|
932
|
$sth = $this->db->prepare($query); |
|
762
|
933
|
$sth->execute(array(':filter_name' => $filter_name)); |
|
@@ -764,11 +935,16 @@ discard block |
|
|
block discarded – undo |
|
764
|
935
|
echo "error : ".$e->getMessage(); |
|
765
|
936
|
} |
|
766
|
937
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
767
|
|
- } else $all = array(); |
|
|
938
|
+ } else { |
|
|
939
|
+ $all = array(); |
|
|
940
|
+ } |
|
768
|
941
|
} else { |
|
769
|
942
|
if ($year == '' && $month == '') { |
|
770
|
|
- if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, 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 LIMIT 10 OFFSET 0"; |
|
771
|
|
- else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, 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"; |
|
|
943
|
+ if ($limit) { |
|
|
944
|
+ $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, 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 LIMIT 10 OFFSET 0"; |
|
|
945
|
+ } else { |
|
|
946
|
+ $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, 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"; |
|
|
947
|
+ } |
|
772
|
948
|
try { |
|
773
|
949
|
$sth = $this->db->prepare($query); |
|
774
|
950
|
$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
@@ -776,7 +952,9 @@ discard block |
|
|
block discarded – undo |
|
776
|
952
|
echo "error : ".$e->getMessage(); |
|
777
|
953
|
} |
|
778
|
954
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
779
|
|
- } else $all = array(); |
|
|
955
|
+ } else { |
|
|
956
|
+ $all = array(); |
|
|
957
|
+ } |
|
780
|
958
|
} |
|
781
|
959
|
if (empty($all)) { |
|
782
|
960
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
@@ -801,7 +979,9 @@ discard block |
|
|
block discarded – undo |
|
801
|
979
|
$icao = $value['airport_arrival_icao']; |
|
802
|
980
|
if (isset($all[$icao])) { |
|
803
|
981
|
$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
804
|
|
- } else $all[$icao] = $value; |
|
|
982
|
+ } else { |
|
|
983
|
+ $all[$icao] = $value; |
|
|
984
|
+ } |
|
805
|
985
|
} |
|
806
|
986
|
$count = array(); |
|
807
|
987
|
foreach ($all as $key => $row) { |
|
@@ -813,7 +993,9 @@ discard block |
|
|
block discarded – undo |
|
813
|
993
|
} |
|
814
|
994
|
public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
|
815
|
995
|
global $globalDBdriver, $globalStatsFilters; |
|
816
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
996
|
+ if ($filter_name == '') { |
|
|
997
|
+ $filter_name = $this->filter_name; |
|
|
998
|
+ } |
|
817
|
999
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
818
|
1000
|
$Spotter = new Spotter($this->db); |
|
819
|
1001
|
$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
@@ -822,20 +1004,32 @@ discard block |
|
|
block discarded – undo |
|
822
|
1004
|
$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
823
|
1005
|
} |
|
824
|
1006
|
if ($globalDBdriver == 'mysql') { |
|
825
|
|
- 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"; |
|
826
|
|
- 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"; |
|
|
1007
|
+ if ($limit) { |
|
|
1008
|
+ $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"; |
|
|
1009
|
+ } else { |
|
|
1010
|
+ $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"; |
|
|
1011
|
+ } |
|
827
|
1012
|
} else { |
|
828
|
|
- 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"; |
|
829
|
|
- 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"; |
|
|
1013
|
+ if ($limit) { |
|
|
1014
|
+ $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"; |
|
|
1015
|
+ } else { |
|
|
1016
|
+ $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"; |
|
|
1017
|
+ } |
|
830
|
1018
|
} |
|
831
|
1019
|
$query_data = array(':filter_name' => $filter_name); |
|
832
|
1020
|
} else { |
|
833
|
1021
|
if ($globalDBdriver == 'mysql') { |
|
834
|
|
- if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
835
|
|
- else $query = "SELECT MONTH(stats_date) as month_name, YEAR(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"; |
|
|
1022
|
+ if ($limit) { |
|
|
1023
|
+ $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
|
1024
|
+ } else { |
|
|
1025
|
+ $query = "SELECT MONTH(stats_date) as month_name, YEAR(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"; |
|
|
1026
|
+ } |
|
836
|
1027
|
} else { |
|
837
|
|
- 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"; |
|
838
|
|
- 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"; |
|
|
1028
|
+ if ($limit) { |
|
|
1029
|
+ $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"; |
|
|
1030
|
+ } else { |
|
|
1031
|
+ $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"; |
|
|
1032
|
+ } |
|
839
|
1033
|
} |
|
840
|
1034
|
$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
841
|
1035
|
} |
|
@@ -863,7 +1057,9 @@ discard block |
|
|
block discarded – undo |
|
863
|
1057
|
|
|
864
|
1058
|
public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
|
865
|
1059
|
global $globalStatsFilters; |
|
866
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1060
|
+ if ($filter_name == '') { |
|
|
1061
|
+ $filter_name = $this->filter_name; |
|
|
1062
|
+ } |
|
867
|
1063
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
868
|
1064
|
$Spotter = new Spotter($this->db); |
|
869
|
1065
|
$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
@@ -900,7 +1096,9 @@ discard block |
|
|
block discarded – undo |
|
900
|
1096
|
} |
|
901
|
1097
|
public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
|
902
|
1098
|
global $globalDBdriver, $globalStatsFilters; |
|
903
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1099
|
+ if ($filter_name == '') { |
|
|
1100
|
+ $filter_name = $this->filter_name; |
|
|
1101
|
+ } |
|
904
|
1102
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
905
|
1103
|
$Spotter = new Spotter($this->db); |
|
906
|
1104
|
$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
@@ -945,7 +1143,9 @@ discard block |
|
|
block discarded – undo |
|
945
|
1143
|
} |
|
946
|
1144
|
public function countAllDates($stats_airline = '',$filter_name = '') { |
|
947
|
1145
|
global $globalStatsFilters; |
|
948
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1146
|
+ if ($filter_name == '') { |
|
|
1147
|
+ $filter_name = $this->filter_name; |
|
|
1148
|
+ } |
|
949
|
1149
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
950
|
1150
|
$Spotter = new Spotter($this->db); |
|
951
|
1151
|
$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
@@ -982,7 +1182,9 @@ discard block |
|
|
block discarded – undo |
|
982
|
1182
|
} |
|
983
|
1183
|
public function countAllDatesMarine($filter_name = '') { |
|
984
|
1184
|
global $globalStatsFilters; |
|
985
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1185
|
+ if ($filter_name == '') { |
|
|
1186
|
+ $filter_name = $this->filter_name; |
|
|
1187
|
+ } |
|
986
|
1188
|
$query = "SELECT marine_date as date_name, cnt as date_count FROM stats_marine WHERE stats_type = 'date' AND filter_name = :filter_name ORDER BY date_count DESC"; |
|
987
|
1189
|
$query_data = array(':filter_name' => $filter_name); |
|
988
|
1190
|
try { |
|
@@ -1004,7 +1206,9 @@ discard block |
|
|
block discarded – undo |
|
1004
|
1206
|
} |
|
1005
|
1207
|
public function countAllDatesTracker($filter_name = '') { |
|
1006
|
1208
|
global $globalStatsFilters; |
|
1007
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1209
|
+ if ($filter_name == '') { |
|
|
1210
|
+ $filter_name = $this->filter_name; |
|
|
1211
|
+ } |
|
1008
|
1212
|
$query = "SELECT tracker_date as date_name, cnt as date_count FROM stats_tracker WHERE stats_type = 'date' AND filter_name = :filter_name ORDER BY date_count DESC"; |
|
1009
|
1213
|
$query_data = array(':filter_name' => $filter_name); |
|
1010
|
1214
|
try { |
|
@@ -1026,7 +1230,9 @@ discard block |
|
|
block discarded – undo |
|
1026
|
1230
|
} |
|
1027
|
1231
|
public function countAllDatesByAirlines($filter_name = '') { |
|
1028
|
1232
|
global $globalStatsFilters; |
|
1029
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1233
|
+ if ($filter_name == '') { |
|
|
1234
|
+ $filter_name = $this->filter_name; |
|
|
1235
|
+ } |
|
1030
|
1236
|
$query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name"; |
|
1031
|
1237
|
$query_data = array('filter_name' => $filter_name); |
|
1032
|
1238
|
try { |
|
@@ -1048,7 +1254,9 @@ discard block |
|
|
block discarded – undo |
|
1048
|
1254
|
} |
|
1049
|
1255
|
public function countAllMonths($stats_airline = '',$filter_name = '') { |
|
1050
|
1256
|
global $globalStatsFilters, $globalDBdriver; |
|
1051
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1257
|
+ if ($filter_name == '') { |
|
|
1258
|
+ $filter_name = $this->filter_name; |
|
|
1259
|
+ } |
|
1052
|
1260
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1053
|
1261
|
$Spotter = new Spotter($this->db); |
|
1054
|
1262
|
$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
@@ -1133,7 +1341,9 @@ discard block |
|
|
block discarded – undo |
|
1133
|
1341
|
} |
|
1134
|
1342
|
public function countAllMilitaryMonths($filter_name = '') { |
|
1135
|
1343
|
global $globalStatsFilters; |
|
1136
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1344
|
+ if ($filter_name == '') { |
|
|
1345
|
+ $filter_name = $this->filter_name; |
|
|
1346
|
+ } |
|
1137
|
1347
|
$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name"; |
|
1138
|
1348
|
try { |
|
1139
|
1349
|
$sth = $this->db->prepare($query); |
|
@@ -1154,7 +1364,9 @@ discard block |
|
|
block discarded – undo |
|
1154
|
1364
|
} |
|
1155
|
1365
|
public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
|
1156
|
1366
|
global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
|
1157
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1367
|
+ if ($filter_name == '') { |
|
|
1368
|
+ $filter_name = $this->filter_name; |
|
|
1369
|
+ } |
|
1158
|
1370
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1159
|
1371
|
$Spotter = new Spotter($this->db); |
|
1160
|
1372
|
$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
@@ -1162,12 +1374,18 @@ discard block |
|
|
block discarded – undo |
|
1162
|
1374
|
foreach ($airlines as $airline) { |
|
1163
|
1375
|
$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1164
|
1376
|
} |
|
1165
|
|
- 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"; |
|
1166
|
|
- 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"; |
|
|
1377
|
+ if ($limit) { |
|
|
1378
|
+ $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"; |
|
|
1379
|
+ } else { |
|
|
1380
|
+ $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"; |
|
|
1381
|
+ } |
|
1167
|
1382
|
$query_data = array(':filter_name' => $filter_name); |
|
1168
|
1383
|
} else { |
|
1169
|
|
- 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"; |
|
1170
|
|
- else $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"; |
|
|
1384
|
+ if ($limit) { |
|
|
1385
|
+ $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"; |
|
|
1386
|
+ } else { |
|
|
1387
|
+ $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"; |
|
|
1388
|
+ } |
|
1171
|
1389
|
$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1172
|
1390
|
} |
|
1173
|
1391
|
if ($orderby == 'hour') { |
|
@@ -1177,7 +1395,9 @@ discard block |
|
|
block discarded – undo |
|
1177
|
1395
|
$query .= " ORDER BY CAST(flight_date AS integer) ASC"; |
|
1178
|
1396
|
} |
|
1179
|
1397
|
} |
|
1180
|
|
- if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
|
|
1398
|
+ if ($orderby == 'count') { |
|
|
1399
|
+ $query .= " ORDER BY hour_count DESC"; |
|
|
1400
|
+ } |
|
1181
|
1401
|
try { |
|
1182
|
1402
|
$sth = $this->db->prepare($query); |
|
1183
|
1403
|
$sth->execute($query_data); |
|
@@ -1201,8 +1421,12 @@ discard block |
|
|
block discarded – undo |
|
1201
|
1421
|
} |
|
1202
|
1422
|
public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
|
1203
|
1423
|
global $globalStatsFilters; |
|
1204
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
1205
|
|
- if ($year == '') $year = date('Y'); |
|
|
1424
|
+ if ($filter_name == '') { |
|
|
1425
|
+ $filter_name = $this->filter_name; |
|
|
1426
|
+ } |
|
|
1427
|
+ if ($year == '') { |
|
|
1428
|
+ $year = date('Y'); |
|
|
1429
|
+ } |
|
1206
|
1430
|
$all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1207
|
1431
|
if (empty($all)) { |
|
1208
|
1432
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
@@ -1221,8 +1445,12 @@ discard block |
|
|
block discarded – undo |
|
1221
|
1445
|
} |
|
1222
|
1446
|
public function countOverallMarine($filter_name = '',$year = '',$month = '') { |
|
1223
|
1447
|
global $globalStatsFilters; |
|
1224
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
1225
|
|
- if ($year == '') $year = date('Y'); |
|
|
1448
|
+ if ($filter_name == '') { |
|
|
1449
|
+ $filter_name = $this->filter_name; |
|
|
1450
|
+ } |
|
|
1451
|
+ if ($year == '') { |
|
|
1452
|
+ $year = date('Y'); |
|
|
1453
|
+ } |
|
1226
|
1454
|
$all = $this->getSumStats('marine_bymonth',$year,'',$filter_name,$month); |
|
1227
|
1455
|
if (empty($all)) { |
|
1228
|
1456
|
$filters = array('year' => $year,'month' => $month); |
|
@@ -1237,8 +1465,12 @@ discard block |
|
|
block discarded – undo |
|
1237
|
1465
|
} |
|
1238
|
1466
|
public function countOverallTracker($filter_name = '',$year = '',$month = '') { |
|
1239
|
1467
|
global $globalStatsFilters; |
|
1240
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
1241
|
|
- if ($year == '') $year = date('Y'); |
|
|
1468
|
+ if ($filter_name == '') { |
|
|
1469
|
+ $filter_name = $this->filter_name; |
|
|
1470
|
+ } |
|
|
1471
|
+ if ($year == '') { |
|
|
1472
|
+ $year = date('Y'); |
|
|
1473
|
+ } |
|
1242
|
1474
|
$all = $this->getSumStats('tracker_bymonth',$year,'',$filter_name,$month); |
|
1243
|
1475
|
if (empty($all)) { |
|
1244
|
1476
|
$filters = array('year' => $year,'month' => $month); |
|
@@ -1253,8 +1485,12 @@ discard block |
|
|
block discarded – undo |
|
1253
|
1485
|
} |
|
1254
|
1486
|
public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') { |
|
1255
|
1487
|
global $globalStatsFilters; |
|
1256
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
1257
|
|
- if ($year == '') $year = date('Y'); |
|
|
1488
|
+ if ($filter_name == '') { |
|
|
1489
|
+ $filter_name = $this->filter_name; |
|
|
1490
|
+ } |
|
|
1491
|
+ if ($year == '') { |
|
|
1492
|
+ $year = date('Y'); |
|
|
1493
|
+ } |
|
1258
|
1494
|
$all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
|
1259
|
1495
|
if (empty($all)) { |
|
1260
|
1496
|
$filters = array(); |
|
@@ -1270,8 +1506,12 @@ discard block |
|
|
block discarded – undo |
|
1270
|
1506
|
} |
|
1271
|
1507
|
public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') { |
|
1272
|
1508
|
global $globalStatsFilters; |
|
1273
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
1274
|
|
- if ($year == '') $year = date('Y'); |
|
|
1509
|
+ if ($filter_name == '') { |
|
|
1510
|
+ $filter_name = $this->filter_name; |
|
|
1511
|
+ } |
|
|
1512
|
+ if ($year == '') { |
|
|
1513
|
+ $year = date('Y'); |
|
|
1514
|
+ } |
|
1275
|
1515
|
$all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1276
|
1516
|
if (empty($all)) { |
|
1277
|
1517
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
@@ -1290,7 +1530,9 @@ discard block |
|
|
block discarded – undo |
|
1290
|
1530
|
} |
|
1291
|
1531
|
public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
|
1292
|
1532
|
global $globalStatsFilters; |
|
1293
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1533
|
+ if ($filter_name == '') { |
|
|
1534
|
+ $filter_name = $this->filter_name; |
|
|
1535
|
+ } |
|
1294
|
1536
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1295
|
1537
|
$Spotter = new Spotter($this->db); |
|
1296
|
1538
|
$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
@@ -1308,7 +1550,9 @@ discard block |
|
|
block discarded – undo |
|
1308
|
1550
|
} |
|
1309
|
1551
|
$result = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
1310
|
1552
|
$all = $result[0]['nb']; |
|
1311
|
|
- } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
|
1553
|
+ } else { |
|
|
1554
|
+ $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
|
1555
|
+ } |
|
1312
|
1556
|
} else { |
|
1313
|
1557
|
if ($year == '' && $month == '') { |
|
1314
|
1558
|
$query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
@@ -1320,7 +1564,9 @@ discard block |
|
|
block discarded – undo |
|
1320
|
1564
|
} |
|
1321
|
1565
|
$result = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
1322
|
1566
|
$all = $result[0]['nb']; |
|
1323
|
|
- } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
|
1567
|
+ } else { |
|
|
1568
|
+ $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
|
1569
|
+ } |
|
1324
|
1570
|
} |
|
1325
|
1571
|
if (empty($all)) { |
|
1326
|
1572
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
@@ -1339,7 +1585,9 @@ discard block |
|
|
block discarded – undo |
|
1339
|
1585
|
} |
|
1340
|
1586
|
public function countOverallAirlines($filter_name = '',$year = '',$month = '') { |
|
1341
|
1587
|
global $globalStatsFilters; |
|
1342
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1588
|
+ if ($filter_name == '') { |
|
|
1589
|
+ $filter_name = $this->filter_name; |
|
|
1590
|
+ } |
|
1343
|
1591
|
if ($year == '' && $month == '') { |
|
1344
|
1592
|
$query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name"; |
|
1345
|
1593
|
try { |
|
@@ -1350,7 +1598,9 @@ discard block |
|
|
block discarded – undo |
|
1350
|
1598
|
} |
|
1351
|
1599
|
$result = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
1352
|
1600
|
$all = $result[0]['nb_airline']; |
|
1353
|
|
- } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
|
1601
|
+ } else { |
|
|
1602
|
+ $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
|
1603
|
+ } |
|
1354
|
1604
|
if (empty($all)) { |
|
1355
|
1605
|
$filters = array(); |
|
1356
|
1606
|
$filters = array('year' => $year,'month' => $month); |
|
@@ -1365,7 +1615,9 @@ discard block |
|
|
block discarded – undo |
|
1365
|
1615
|
} |
|
1366
|
1616
|
public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
|
1367
|
1617
|
global $globalStatsFilters; |
|
1368
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1618
|
+ if ($filter_name == '') { |
|
|
1619
|
+ $filter_name = $this->filter_name; |
|
|
1620
|
+ } |
|
1369
|
1621
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1370
|
1622
|
$Spotter = new Spotter($this->db); |
|
1371
|
1623
|
$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
@@ -1420,7 +1672,9 @@ discard block |
|
|
block discarded – undo |
|
1420
|
1672
|
} |
|
1421
|
1673
|
public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
1422
|
1674
|
global $globalStatsFilters; |
|
1423
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1675
|
+ if ($filter_name == '') { |
|
|
1676
|
+ $filter_name = $this->filter_name; |
|
|
1677
|
+ } |
|
1424
|
1678
|
//if ($year == '') $year = date('Y'); |
|
1425
|
1679
|
if ($year == '' && $month == '') { |
|
1426
|
1680
|
$query = "SELECT count(*) as nb FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
@@ -1449,7 +1703,9 @@ discard block |
|
|
block discarded – undo |
|
1449
|
1703
|
} |
|
1450
|
1704
|
|
|
1451
|
1705
|
public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
|
1452
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1706
|
+ if ($filter_name == '') { |
|
|
1707
|
+ $filter_name = $this->filter_name; |
|
|
1708
|
+ } |
|
1453
|
1709
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1454
|
1710
|
$Spotter = new Spotter($this->db); |
|
1455
|
1711
|
$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
@@ -1473,7 +1729,9 @@ discard block |
|
|
block discarded – undo |
|
1473
|
1729
|
return $all; |
|
1474
|
1730
|
} |
|
1475
|
1731
|
public function getStats($type,$stats_airline = '', $filter_name = '') { |
|
1476
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1732
|
+ if ($filter_name == '') { |
|
|
1733
|
+ $filter_name = $this->filter_name; |
|
|
1734
|
+ } |
|
1477
|
1735
|
$query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
|
1478
|
1736
|
$query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1479
|
1737
|
try { |
|
@@ -1486,7 +1744,9 @@ discard block |
|
|
block discarded – undo |
|
1486
|
1744
|
return $all; |
|
1487
|
1745
|
} |
|
1488
|
1746
|
public function deleteStatsByType($type,$stats_airline = '', $filter_name = '') { |
|
1489
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1747
|
+ if ($filter_name == '') { |
|
|
1748
|
+ $filter_name = $this->filter_name; |
|
|
1749
|
+ } |
|
1490
|
1750
|
$query = "DELETE FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
1491
|
1751
|
$query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1492
|
1752
|
try { |
|
@@ -1497,7 +1757,9 @@ discard block |
|
|
block discarded – undo |
|
1497
|
1757
|
} |
|
1498
|
1758
|
} |
|
1499
|
1759
|
public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
|
1500
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1760
|
+ if ($filter_name == '') { |
|
|
1761
|
+ $filter_name = $this->filter_name; |
|
|
1762
|
+ } |
|
1501
|
1763
|
global $globalArchiveMonths, $globalDBdriver; |
|
1502
|
1764
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1503
|
1765
|
$Spotter = new Spotter($this->db); |
|
@@ -1553,7 +1815,9 @@ discard block |
|
|
block discarded – undo |
|
1553
|
1815
|
} |
|
1554
|
1816
|
public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
|
1555
|
1817
|
global $globalArchiveMonths, $globalDBdriver; |
|
1556
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1818
|
+ if ($filter_name == '') { |
|
|
1819
|
+ $filter_name = $this->filter_name; |
|
|
1820
|
+ } |
|
1557
|
1821
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1558
|
1822
|
$Spotter = new Spotter($this->db); |
|
1559
|
1823
|
$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
@@ -1586,7 +1850,9 @@ discard block |
|
|
block discarded – undo |
|
1586
|
1850
|
} |
|
1587
|
1851
|
public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
|
1588
|
1852
|
global $globalArchiveMonths, $globalDBdriver; |
|
1589
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1853
|
+ if ($filter_name == '') { |
|
|
1854
|
+ $filter_name = $this->filter_name; |
|
|
1855
|
+ } |
|
1590
|
1856
|
if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1591
|
1857
|
$Spotter = new Spotter($this->db); |
|
1592
|
1858
|
$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
@@ -1617,7 +1883,9 @@ discard block |
|
|
block discarded – undo |
|
1617
|
1883
|
} |
|
1618
|
1884
|
public function getStatsAirlineTotal($filter_name = '') { |
|
1619
|
1885
|
global $globalArchiveMonths, $globalDBdriver; |
|
1620
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1886
|
+ if ($filter_name == '') { |
|
|
1887
|
+ $filter_name = $this->filter_name; |
|
|
1888
|
+ } |
|
1621
|
1889
|
if ($globalDBdriver == 'mysql') { |
|
1622
|
1890
|
$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
|
1623
|
1891
|
} else { |
|
@@ -1634,7 +1902,9 @@ discard block |
|
|
block discarded – undo |
|
1634
|
1902
|
} |
|
1635
|
1903
|
public function getStatsOwnerTotal($filter_name = '') { |
|
1636
|
1904
|
global $globalArchiveMonths, $globalDBdriver; |
|
1637
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1905
|
+ if ($filter_name == '') { |
|
|
1906
|
+ $filter_name = $this->filter_name; |
|
|
1907
|
+ } |
|
1638
|
1908
|
if ($globalDBdriver == 'mysql') { |
|
1639
|
1909
|
$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
|
1640
|
1910
|
} else { |
|
@@ -1651,7 +1921,9 @@ discard block |
|
|
block discarded – undo |
|
1651
|
1921
|
} |
|
1652
|
1922
|
public function getStatsOwner($owner_name,$filter_name = '') { |
|
1653
|
1923
|
global $globalArchiveMonths, $globalDBdriver; |
|
1654
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1924
|
+ if ($filter_name == '') { |
|
|
1925
|
+ $filter_name = $this->filter_name; |
|
|
1926
|
+ } |
|
1655
|
1927
|
$query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name"; |
|
1656
|
1928
|
try { |
|
1657
|
1929
|
$sth = $this->db->prepare($query); |
|
@@ -1660,12 +1932,17 @@ discard block |
|
|
block discarded – undo |
|
1660
|
1932
|
echo "error : ".$e->getMessage(); |
|
1661
|
1933
|
} |
|
1662
|
1934
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
1663
|
|
- if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
1664
|
|
- else return 0; |
|
|
1935
|
+ if (isset($all[0]['cnt'])) { |
|
|
1936
|
+ return $all[0]['cnt']; |
|
|
1937
|
+ } else { |
|
|
1938
|
+ return 0; |
|
|
1939
|
+ } |
|
1665
|
1940
|
} |
|
1666
|
1941
|
public function getStatsPilotTotal($filter_name = '') { |
|
1667
|
1942
|
global $globalArchiveMonths, $globalDBdriver; |
|
1668
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1943
|
+ if ($filter_name == '') { |
|
|
1944
|
+ $filter_name = $this->filter_name; |
|
|
1945
|
+ } |
|
1669
|
1946
|
if ($globalDBdriver == 'mysql') { |
|
1670
|
1947
|
$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
1671
|
1948
|
} else { |
|
@@ -1682,7 +1959,9 @@ discard block |
|
|
block discarded – undo |
|
1682
|
1959
|
} |
|
1683
|
1960
|
public function getStatsPilot($pilot,$filter_name = '') { |
|
1684
|
1961
|
global $globalArchiveMonths, $globalDBdriver; |
|
1685
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1962
|
+ if ($filter_name == '') { |
|
|
1963
|
+ $filter_name = $this->filter_name; |
|
|
1964
|
+ } |
|
1686
|
1965
|
$query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)"; |
|
1687
|
1966
|
try { |
|
1688
|
1967
|
$sth = $this->db->prepare($query); |
|
@@ -1691,13 +1970,18 @@ discard block |
|
|
block discarded – undo |
|
1691
|
1970
|
echo "error : ".$e->getMessage(); |
|
1692
|
1971
|
} |
|
1693
|
1972
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
1694
|
|
- if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
1695
|
|
- else return 0; |
|
|
1973
|
+ if (isset($all[0]['cnt'])) { |
|
|
1974
|
+ return $all[0]['cnt']; |
|
|
1975
|
+ } else { |
|
|
1976
|
+ return 0; |
|
|
1977
|
+ } |
|
1696
|
1978
|
} |
|
1697
|
1979
|
|
|
1698
|
1980
|
public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
1699
|
1981
|
global $globalDBdriver; |
|
1700
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
1982
|
+ if ($filter_name == '') { |
|
|
1983
|
+ $filter_name = $this->filter_name; |
|
|
1984
|
+ } |
|
1701
|
1985
|
if ($globalDBdriver == 'mysql') { |
|
1702
|
1986
|
$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt"; |
|
1703
|
1987
|
} else { |
|
@@ -1713,7 +1997,9 @@ discard block |
|
|
block discarded – undo |
|
1713
|
1997
|
} |
|
1714
|
1998
|
public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
1715
|
1999
|
global $globalDBdriver; |
|
1716
|
|
- if ($filter_name == '') $filter_name = $this->filter_name; |
|
|
2000
|
+ if ($filter_name == '') { |
|
|
2001
|
+ $filter_name = $this->filter_name; |
|
|
2002
|
+ } |
|
1717
|
2003
|
if ($globalDBdriver == 'mysql') { |
|
1718
|
2004
|
$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
|
1719
|
2005
|
} else { |
|
@@ -2186,27 +2472,37 @@ discard block |
|
|
block discarded – undo |
|
2186
|
2472
|
date_default_timezone_set('UTC'); |
|
2187
|
2473
|
if ((isset($globalMarine) && $globalMarine) || (isset($globalMasterServer) && $globalMasterServer)) { |
|
2188
|
2474
|
$last_update = $this->getLastStatsUpdate('last_update_stats_marine'); |
|
2189
|
|
- if ($globalDebug) echo '!!! Update Marine stats !!!'."\n"; |
|
|
2475
|
+ if ($globalDebug) { |
|
|
2476
|
+ echo '!!! Update Marine stats !!!'."\n"; |
|
|
2477
|
+ } |
|
2190
|
2478
|
if (isset($last_update[0]['value'])) { |
|
2191
|
2479
|
$last_update_day = $last_update[0]['value']; |
|
2192
|
|
- } else $last_update_day = '2012-12-12 12:12:12'; |
|
|
2480
|
+ } else { |
|
|
2481
|
+ $last_update_day = '2012-12-12 12:12:12'; |
|
|
2482
|
+ } |
|
2193
|
2483
|
$reset = false; |
|
2194
|
2484
|
$Marine = new Marine($this->db); |
|
2195
|
2485
|
$filtername = 'marine'; |
|
2196
|
2486
|
if ($Connection->tableExists('countries')) { |
|
2197
|
|
- if ($globalDebug) echo 'Count all vessels by countries...'."\n"; |
|
|
2487
|
+ if ($globalDebug) { |
|
|
2488
|
+ echo 'Count all vessels by countries...'."\n"; |
|
|
2489
|
+ } |
|
2198
|
2490
|
$alldata = $Marine->countAllMarineOverCountries(false,0,$last_update_day); |
|
2199
|
2491
|
foreach ($alldata as $number) { |
|
2200
|
2492
|
$this->addStatCountryMarine($number['marine_country_iso2'],$number['marine_country_iso3'],$number['marine_country'],$number['marine_count'],'','',$reset); |
|
2201
|
2493
|
} |
|
2202
|
2494
|
} |
|
2203
|
|
- if ($globalDebug) echo 'Count all vessels by months...'."\n"; |
|
|
2495
|
+ if ($globalDebug) { |
|
|
2496
|
+ echo 'Count all vessels by months...'."\n"; |
|
|
2497
|
+ } |
|
2204
|
2498
|
$last_month = date('Y-m-01 00:00:00', strtotime('-1 month', strtotime($last_update_day))); |
|
2205
|
2499
|
$filter_last_month = array('since_date' => $last_month); |
|
2206
|
2500
|
$alldata = $Marine->countAllMonths($filter_last_month); |
|
2207
|
2501
|
$lastyear = false; |
|
2208
|
2502
|
foreach ($alldata as $number) { |
|
2209
|
|
- if ($number['year_name'] != date('Y')) $lastyear = true; |
|
|
2503
|
+ if ($number['year_name'] != date('Y')) { |
|
|
2504
|
+ $lastyear = true; |
|
|
2505
|
+ } |
|
2210
|
2506
|
$this->addStat('marine_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
2211
|
2507
|
} |
|
2212
|
2508
|
echo 'Marine data...'."\n"; |
|
@@ -2242,26 +2538,36 @@ discard block |
|
|
block discarded – undo |
|
2242
|
2538
|
} |
|
2243
|
2539
|
if ((isset($globalTracker) && $globalTracker) || (isset($globalMasterServer) && $globalMasterServer)) { |
|
2244
|
2540
|
$last_update = $this->getLastStatsUpdate('last_update_stats_tracker'); |
|
2245
|
|
- if ($globalDebug) echo '!!! Update tracker stats !!!'."\n"; |
|
|
2541
|
+ if ($globalDebug) { |
|
|
2542
|
+ echo '!!! Update tracker stats !!!'."\n"; |
|
|
2543
|
+ } |
|
2246
|
2544
|
if (isset($last_update[0]['value'])) { |
|
2247
|
2545
|
$last_update_day = $last_update[0]['value']; |
|
2248
|
|
- } else $last_update_day = '2012-12-12 12:12:12'; |
|
|
2546
|
+ } else { |
|
|
2547
|
+ $last_update_day = '2012-12-12 12:12:12'; |
|
|
2548
|
+ } |
|
2249
|
2549
|
$reset = false; |
|
2250
|
2550
|
$Tracker = new Tracker($this->db); |
|
2251
|
2551
|
if ($Connection->tableExists('countries')) { |
|
2252
|
|
- if ($globalDebug) echo 'Count all trackers by countries...'."\n"; |
|
|
2552
|
+ if ($globalDebug) { |
|
|
2553
|
+ echo 'Count all trackers by countries...'."\n"; |
|
|
2554
|
+ } |
|
2253
|
2555
|
$alldata = $Tracker->countAllTrackerOverCountries(false,0,$last_update_day); |
|
2254
|
2556
|
foreach ($alldata as $number) { |
|
2255
|
2557
|
$this->addStatCountryTracker($number['tracker_country_iso2'],$number['tracker_country_iso3'],$number['tracker_country'],$number['tracker_count'],'','',$reset); |
|
2256
|
2558
|
} |
|
2257
|
2559
|
} |
|
2258
|
|
- if ($globalDebug) echo 'Count all vessels by months...'."\n"; |
|
|
2560
|
+ if ($globalDebug) { |
|
|
2561
|
+ echo 'Count all vessels by months...'."\n"; |
|
|
2562
|
+ } |
|
2259
|
2563
|
$last_month = date('Y-m-01 00:00:00', strtotime('-1 month', strtotime($last_update_day))); |
|
2260
|
2564
|
$filter_last_month = array('since_date' => $last_month); |
|
2261
|
2565
|
$alldata = $Tracker->countAllMonths($filter_last_month); |
|
2262
|
2566
|
$lastyear = false; |
|
2263
|
2567
|
foreach ($alldata as $number) { |
|
2264
|
|
- if ($number['year_name'] != date('Y')) $lastyear = true; |
|
|
2568
|
+ if ($number['year_name'] != date('Y')) { |
|
|
2569
|
+ $lastyear = true; |
|
|
2570
|
+ } |
|
2265
|
2571
|
$this->addStat('tracker_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
2266
|
2572
|
} |
|
2267
|
2573
|
echo 'Tracker data...'."\n"; |
|
@@ -2298,10 +2604,14 @@ discard block |
|
|
block discarded – undo |
|
2298
|
2604
|
|
|
2299
|
2605
|
if (!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft) || (isset($globalMasterServer) && $globalMasterServer)) { |
|
2300
|
2606
|
$last_update = $this->getLastStatsUpdate('last_update_stats'); |
|
2301
|
|
- if ($globalDebug) echo '!!! Update aicraft stats !!!'."\n"; |
|
|
2607
|
+ if ($globalDebug) { |
|
|
2608
|
+ echo '!!! Update aicraft stats !!!'."\n"; |
|
|
2609
|
+ } |
|
2302
|
2610
|
if (isset($last_update[0]['value'])) { |
|
2303
|
2611
|
$last_update_day = $last_update[0]['value']; |
|
2304
|
|
- } else $last_update_day = '2012-12-12 12:12:12'; |
|
|
2612
|
+ } else { |
|
|
2613
|
+ $last_update_day = '2012-12-12 12:12:12'; |
|
|
2614
|
+ } |
|
2305
|
2615
|
$reset = false; |
|
2306
|
2616
|
//if ($globalStatsResetYear && date('Y',strtotime($last_update_day)) != date('Y')) { |
|
2307
|
2617
|
if ($globalStatsResetYear) { |
|
@@ -2310,43 +2620,63 @@ discard block |
|
|
block discarded – undo |
|
2310
|
2620
|
} |
|
2311
|
2621
|
$Spotter = new Spotter($this->db); |
|
2312
|
2622
|
|
|
2313
|
|
- if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
|
|
2623
|
+ if ($globalDebug) { |
|
|
2624
|
+ echo 'Count all aircraft types...'."\n"; |
|
|
2625
|
+ } |
|
2314
|
2626
|
$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
|
2315
|
2627
|
foreach ($alldata as $number) { |
|
2316
|
2628
|
$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset); |
|
2317
|
2629
|
} |
|
2318
|
|
- if ($globalDebug) echo 'Count all airlines...'."\n"; |
|
|
2630
|
+ if ($globalDebug) { |
|
|
2631
|
+ echo 'Count all airlines...'."\n"; |
|
|
2632
|
+ } |
|
2319
|
2633
|
$alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
|
2320
|
2634
|
foreach ($alldata as $number) { |
|
2321
|
2635
|
$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset); |
|
2322
|
2636
|
} |
|
2323
|
|
- if ($globalDebug) echo 'Count all registrations...'."\n"; |
|
|
2637
|
+ if ($globalDebug) { |
|
|
2638
|
+ echo 'Count all registrations...'."\n"; |
|
|
2639
|
+ } |
|
2324
|
2640
|
$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
|
2325
|
2641
|
foreach ($alldata as $number) { |
|
2326
|
2642
|
$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset); |
|
2327
|
2643
|
} |
|
2328
|
|
- if ($globalDebug) echo 'Count all callsigns...'."\n"; |
|
|
2644
|
+ if ($globalDebug) { |
|
|
2645
|
+ echo 'Count all callsigns...'."\n"; |
|
|
2646
|
+ } |
|
2329
|
2647
|
$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
|
2330
|
2648
|
foreach ($alldata as $number) { |
|
2331
|
2649
|
$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
|
2332
|
2650
|
} |
|
2333
|
|
- if ($globalDebug) echo 'Count all owners...'."\n"; |
|
|
2651
|
+ if ($globalDebug) { |
|
|
2652
|
+ echo 'Count all owners...'."\n"; |
|
|
2653
|
+ } |
|
2334
|
2654
|
$alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
|
2335
|
2655
|
foreach ($alldata as $number) { |
|
2336
|
2656
|
$this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset); |
|
2337
|
2657
|
} |
|
2338
|
|
- if ($globalDebug) echo 'Count all pilots...'."\n"; |
|
|
2658
|
+ if ($globalDebug) { |
|
|
2659
|
+ echo 'Count all pilots...'."\n"; |
|
|
2660
|
+ } |
|
2339
|
2661
|
$alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
|
2340
|
2662
|
foreach ($alldata as $number) { |
|
2341
|
|
- if ($number['pilot_id'] == 0 || $number['pilot_id'] == '') $number['pilot_id'] = $number['pilot_name']; |
|
|
2663
|
+ if ($number['pilot_id'] == 0 || $number['pilot_id'] == '') { |
|
|
2664
|
+ $number['pilot_id'] = $number['pilot_name']; |
|
|
2665
|
+ } |
|
2342
|
2666
|
$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset); |
|
2343
|
2667
|
} |
|
2344
|
2668
|
|
|
2345
|
|
- if ($globalDebug) echo 'Count all departure airports...'."\n"; |
|
|
2669
|
+ if ($globalDebug) { |
|
|
2670
|
+ echo 'Count all departure airports...'."\n"; |
|
|
2671
|
+ } |
|
2346
|
2672
|
$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
|
2347
|
|
- if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
|
|
2673
|
+ if ($globalDebug) { |
|
|
2674
|
+ echo 'Count all detected departure airports...'."\n"; |
|
|
2675
|
+ } |
|
2348
|
2676
|
$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
2349
|
|
- if ($globalDebug) echo 'Order departure airports...'."\n"; |
|
|
2677
|
+ if ($globalDebug) { |
|
|
2678
|
+ echo 'Order departure airports...'."\n"; |
|
|
2679
|
+ } |
|
2350
|
2680
|
$alldata = array(); |
|
2351
|
2681
|
foreach ($pall as $value) { |
|
2352
|
2682
|
$icao = $value['airport_departure_icao']; |
|
@@ -2356,7 +2686,9 @@ discard block |
|
|
block discarded – undo |
|
2356
|
2686
|
$icao = $value['airport_departure_icao']; |
|
2357
|
2687
|
if (isset($alldata[$icao])) { |
|
2358
|
2688
|
$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
2359
|
|
- } else $alldata[$icao] = $value; |
|
|
2689
|
+ } else { |
|
|
2690
|
+ $alldata[$icao] = $value; |
|
|
2691
|
+ } |
|
2360
|
2692
|
} |
|
2361
|
2693
|
$count = array(); |
|
2362
|
2694
|
foreach ($alldata as $key => $row) { |
|
@@ -2366,11 +2698,17 @@ discard block |
|
|
block discarded – undo |
|
2366
|
2698
|
foreach ($alldata as $number) { |
|
2367
|
2699
|
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); |
|
2368
|
2700
|
} |
|
2369
|
|
- if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
|
|
2701
|
+ if ($globalDebug) { |
|
|
2702
|
+ echo 'Count all arrival airports...'."\n"; |
|
|
2703
|
+ } |
|
2370
|
2704
|
$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
|
2371
|
|
- if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
|
|
2705
|
+ if ($globalDebug) { |
|
|
2706
|
+ echo 'Count all detected arrival airports...'."\n"; |
|
|
2707
|
+ } |
|
2372
|
2708
|
$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
2373
|
|
- if ($globalDebug) echo 'Order arrival airports...'."\n"; |
|
|
2709
|
+ if ($globalDebug) { |
|
|
2710
|
+ echo 'Order arrival airports...'."\n"; |
|
|
2711
|
+ } |
|
2374
|
2712
|
$alldata = array(); |
|
2375
|
2713
|
foreach ($pall as $value) { |
|
2376
|
2714
|
$icao = $value['airport_arrival_icao']; |
|
@@ -2380,7 +2718,9 @@ discard block |
|
|
block discarded – undo |
|
2380
|
2718
|
$icao = $value['airport_arrival_icao']; |
|
2381
|
2719
|
if (isset($alldata[$icao])) { |
|
2382
|
2720
|
$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
2383
|
|
- } else $alldata[$icao] = $value; |
|
|
2721
|
+ } else { |
|
|
2722
|
+ $alldata[$icao] = $value; |
|
|
2723
|
+ } |
|
2384
|
2724
|
} |
|
2385
|
2725
|
$count = array(); |
|
2386
|
2726
|
foreach ($alldata as $key => $row) { |
|
@@ -2391,7 +2731,9 @@ discard block |
|
|
block discarded – undo |
|
2391
|
2731
|
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); |
|
2392
|
2732
|
} |
|
2393
|
2733
|
if ($Connection->tableExists('countries')) { |
|
2394
|
|
- if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
|
|
2734
|
+ if ($globalDebug) { |
|
|
2735
|
+ echo 'Count all flights by countries...'."\n"; |
|
|
2736
|
+ } |
|
2395
|
2737
|
//$SpotterArchive = new SpotterArchive(); |
|
2396
|
2738
|
//$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
|
2397
|
2739
|
$Spotter = new Spotter($this->db); |
|
@@ -2402,7 +2744,9 @@ discard block |
|
|
block discarded – undo |
|
2402
|
2744
|
} |
|
2403
|
2745
|
|
|
2404
|
2746
|
if (isset($globalAccidents) && $globalAccidents) { |
|
2405
|
|
- if ($globalDebug) echo 'Count fatalities stats...'."\n"; |
|
|
2747
|
+ if ($globalDebug) { |
|
|
2748
|
+ echo 'Count fatalities stats...'."\n"; |
|
|
2749
|
+ } |
|
2406
|
2750
|
$Accident = new Accident($this->db); |
|
2407
|
2751
|
$this->deleteStatsByType('fatalities_byyear'); |
|
2408
|
2752
|
$alldata = $Accident->countFatalitiesByYear(); |
|
@@ -2418,48 +2762,68 @@ discard block |
|
|
block discarded – undo |
|
2418
|
2762
|
|
|
2419
|
2763
|
// Add by month using getstat if month finish... |
|
2420
|
2764
|
//if (date('m',strtotime($last_update_day)) != date('m')) { |
|
2421
|
|
- if ($globalDebug) echo 'Count all flights by months...'."\n"; |
|
|
2765
|
+ if ($globalDebug) { |
|
|
2766
|
+ echo 'Count all flights by months...'."\n"; |
|
|
2767
|
+ } |
|
2422
|
2768
|
$last_month = date('Y-m-01 00:00:00', strtotime('-1 month', strtotime($last_update_day))); |
|
2423
|
2769
|
$filter_last_month = array('since_date' => $last_month); |
|
2424
|
2770
|
$Spotter = new Spotter($this->db); |
|
2425
|
2771
|
$alldata = $Spotter->countAllMonths($filter_last_month); |
|
2426
|
2772
|
$lastyear = false; |
|
2427
|
2773
|
foreach ($alldata as $number) { |
|
2428
|
|
- if ($number['year_name'] != date('Y')) $lastyear = true; |
|
|
2774
|
+ if ($number['year_name'] != date('Y')) { |
|
|
2775
|
+ $lastyear = true; |
|
|
2776
|
+ } |
|
2429
|
2777
|
$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']))); |
|
2430
|
2778
|
} |
|
2431
|
|
- if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
|
|
2779
|
+ if ($globalDebug) { |
|
|
2780
|
+ echo 'Count all military flights by months...'."\n"; |
|
|
2781
|
+ } |
|
2432
|
2782
|
$alldata = $Spotter->countAllMilitaryMonths($filter_last_month); |
|
2433
|
2783
|
foreach ($alldata as $number) { |
|
2434
|
2784
|
$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']))); |
|
2435
|
2785
|
} |
|
2436
|
|
- if ($globalDebug) echo 'Count all owners by months...'."\n"; |
|
|
2786
|
+ if ($globalDebug) { |
|
|
2787
|
+ echo 'Count all owners by months...'."\n"; |
|
|
2788
|
+ } |
|
2437
|
2789
|
$alldata = $Spotter->countAllMonthsOwners($filter_last_month); |
|
2438
|
2790
|
foreach ($alldata as $number) { |
|
2439
|
2791
|
$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']))); |
|
2440
|
2792
|
} |
|
2441
|
|
- if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
|
|
2793
|
+ if ($globalDebug) { |
|
|
2794
|
+ echo 'Count all pilots by months...'."\n"; |
|
|
2795
|
+ } |
|
2442
|
2796
|
$alldata = $Spotter->countAllMonthsPilots($filter_last_month); |
|
2443
|
2797
|
foreach ($alldata as $number) { |
|
2444
|
2798
|
$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']))); |
|
2445
|
2799
|
} |
|
2446
|
|
- if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
|
|
2800
|
+ if ($globalDebug) { |
|
|
2801
|
+ echo 'Count all airlines by months...'."\n"; |
|
|
2802
|
+ } |
|
2447
|
2803
|
$alldata = $Spotter->countAllMonthsAirlines($filter_last_month); |
|
2448
|
2804
|
foreach ($alldata as $number) { |
|
2449
|
2805
|
$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']))); |
|
2450
|
2806
|
} |
|
2451
|
|
- if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
|
|
2807
|
+ if ($globalDebug) { |
|
|
2808
|
+ echo 'Count all aircrafts by months...'."\n"; |
|
|
2809
|
+ } |
|
2452
|
2810
|
$alldata = $Spotter->countAllMonthsAircrafts($filter_last_month); |
|
2453
|
2811
|
foreach ($alldata as $number) { |
|
2454
|
2812
|
$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']))); |
|
2455
|
2813
|
} |
|
2456
|
|
- if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
|
|
2814
|
+ if ($globalDebug) { |
|
|
2815
|
+ echo 'Count all real arrivals by months...'."\n"; |
|
|
2816
|
+ } |
|
2457
|
2817
|
$alldata = $Spotter->countAllMonthsRealArrivals($filter_last_month); |
|
2458
|
2818
|
foreach ($alldata as $number) { |
|
2459
|
2819
|
$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']))); |
|
2460
|
2820
|
} |
|
2461
|
|
- if ($globalDebug) echo 'Airports data...'."\n"; |
|
2462
|
|
- if ($globalDebug) echo '...Departure'."\n"; |
|
|
2821
|
+ if ($globalDebug) { |
|
|
2822
|
+ echo 'Airports data...'."\n"; |
|
|
2823
|
+ } |
|
|
2824
|
+ if ($globalDebug) { |
|
|
2825
|
+ echo '...Departure'."\n"; |
|
|
2826
|
+ } |
|
2463
|
2827
|
$this->deleteStatAirport('daily'); |
|
2464
|
2828
|
// $pall = $Spotter->getLast7DaysAirportsDeparture(); |
|
2465
|
2829
|
// $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
|
@@ -2577,7 +2941,9 @@ discard block |
|
|
block discarded – undo |
|
2577
|
2941
|
// Count by airlines |
|
2578
|
2942
|
echo '--- Stats by airlines ---'."\n"; |
|
2579
|
2943
|
if ($Connection->tableExists('countries')) { |
|
2580
|
|
- if ($globalDebug) echo 'Count all flights by countries by airlines...'."\n"; |
|
|
2944
|
+ if ($globalDebug) { |
|
|
2945
|
+ echo 'Count all flights by countries by airlines...'."\n"; |
|
|
2946
|
+ } |
|
2581
|
2947
|
$SpotterArchive = new SpotterArchive($this->db); |
|
2582
|
2948
|
//$Spotter = new Spotter($this->db); |
|
2583
|
2949
|
$alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
|
@@ -2586,37 +2952,53 @@ discard block |
|
|
block discarded – undo |
|
2586
|
2952
|
$this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],$number['airline_icao'],'',$reset); |
|
2587
|
2953
|
} |
|
2588
|
2954
|
} |
|
2589
|
|
- if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
|
|
2955
|
+ if ($globalDebug) { |
|
|
2956
|
+ echo 'Count all aircraft types by airlines...'."\n"; |
|
|
2957
|
+ } |
|
2590
|
2958
|
$Spotter = new Spotter($this->db); |
|
2591
|
2959
|
$alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
|
2592
|
2960
|
foreach ($alldata as $number) { |
|
2593
|
2961
|
$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset); |
|
2594
|
2962
|
} |
|
2595
|
|
- if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
|
|
2963
|
+ if ($globalDebug) { |
|
|
2964
|
+ echo 'Count all aircraft registrations by airlines...'."\n"; |
|
|
2965
|
+ } |
|
2596
|
2966
|
$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
|
2597
|
2967
|
foreach ($alldata as $number) { |
|
2598
|
2968
|
$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset); |
|
2599
|
2969
|
} |
|
2600
|
|
- if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
|
|
2970
|
+ if ($globalDebug) { |
|
|
2971
|
+ echo 'Count all callsigns by airlines...'."\n"; |
|
|
2972
|
+ } |
|
2601
|
2973
|
$alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
|
2602
|
2974
|
foreach ($alldata as $number) { |
|
2603
|
2975
|
$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
|
2604
|
2976
|
} |
|
2605
|
|
- if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
|
|
2977
|
+ if ($globalDebug) { |
|
|
2978
|
+ echo 'Count all owners by airlines...'."\n"; |
|
|
2979
|
+ } |
|
2606
|
2980
|
$alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
|
2607
|
2981
|
foreach ($alldata as $number) { |
|
2608
|
2982
|
$this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset); |
|
2609
|
2983
|
} |
|
2610
|
|
- if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
|
|
2984
|
+ if ($globalDebug) { |
|
|
2985
|
+ echo 'Count all pilots by airlines...'."\n"; |
|
|
2986
|
+ } |
|
2611
|
2987
|
$alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
|
2612
|
2988
|
foreach ($alldata as $number) { |
|
2613
|
2989
|
$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset); |
|
2614
|
2990
|
} |
|
2615
|
|
- if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
|
|
2991
|
+ if ($globalDebug) { |
|
|
2992
|
+ echo 'Count all departure airports by airlines...'."\n"; |
|
|
2993
|
+ } |
|
2616
|
2994
|
$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
|
2617
|
|
- if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
|
|
2995
|
+ if ($globalDebug) { |
|
|
2996
|
+ echo 'Count all detected departure airports by airlines...'."\n"; |
|
|
2997
|
+ } |
|
2618
|
2998
|
$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
2619
|
|
- if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
|
|
2999
|
+ if ($globalDebug) { |
|
|
3000
|
+ echo 'Order detected departure airports by airlines...'."\n"; |
|
|
3001
|
+ } |
|
2620
|
3002
|
//$alldata = array(); |
|
2621
|
3003
|
foreach ($dall as $value) { |
|
2622
|
3004
|
$icao = $value['airport_departure_icao']; |
|
@@ -2637,11 +3019,17 @@ discard block |
|
|
block discarded – undo |
|
2637
|
3019
|
foreach ($alldata as $number) { |
|
2638
|
3020
|
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); |
|
2639
|
3021
|
} |
|
2640
|
|
- if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
|
|
3022
|
+ if ($globalDebug) { |
|
|
3023
|
+ echo 'Count all arrival airports by airlines...'."\n"; |
|
|
3024
|
+ } |
|
2641
|
3025
|
$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
|
2642
|
|
- if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
|
|
3026
|
+ if ($globalDebug) { |
|
|
3027
|
+ echo 'Count all detected arrival airports by airlines...'."\n"; |
|
|
3028
|
+ } |
|
2643
|
3029
|
$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
2644
|
|
- if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
|
|
3030
|
+ if ($globalDebug) { |
|
|
3031
|
+ echo 'Order arrival airports by airlines...'."\n"; |
|
|
3032
|
+ } |
|
2645
|
3033
|
//$alldata = array(); |
|
2646
|
3034
|
foreach ($dall as $value) { |
|
2647
|
3035
|
$icao = $value['airport_arrival_icao']; |
|
@@ -2660,37 +3048,53 @@ discard block |
|
|
block discarded – undo |
|
2660
|
3048
|
} |
|
2661
|
3049
|
$alldata = $pall; |
|
2662
|
3050
|
foreach ($alldata as $number) { |
|
2663
|
|
- 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); |
|
|
3051
|
+ if ($number['airline_icao'] != '') { |
|
|
3052
|
+ 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); |
|
|
3053
|
+ } |
|
|
3054
|
+ } |
|
|
3055
|
+ if ($globalDebug) { |
|
|
3056
|
+ echo 'Count all flights by months by airlines...'."\n"; |
|
2664
|
3057
|
} |
|
2665
|
|
- if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
|
2666
|
3058
|
$Spotter = new Spotter($this->db); |
|
2667
|
3059
|
$alldata = $Spotter->countAllMonthsByAirlines($filter_last_month); |
|
2668
|
3060
|
$lastyear = false; |
|
2669
|
3061
|
foreach ($alldata as $number) { |
|
2670
|
|
- if ($number['year_name'] != date('Y')) $lastyear = true; |
|
|
3062
|
+ if ($number['year_name'] != date('Y')) { |
|
|
3063
|
+ $lastyear = true; |
|
|
3064
|
+ } |
|
2671
|
3065
|
$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']); |
|
2672
|
3066
|
} |
|
2673
|
|
- if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
|
|
3067
|
+ if ($globalDebug) { |
|
|
3068
|
+ echo 'Count all owners by months by airlines...'."\n"; |
|
|
3069
|
+ } |
|
2674
|
3070
|
$alldata = $Spotter->countAllMonthsOwnersByAirlines($filter_last_month); |
|
2675
|
3071
|
foreach ($alldata as $number) { |
|
2676
|
3072
|
$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']); |
|
2677
|
3073
|
} |
|
2678
|
|
- if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
|
|
3074
|
+ if ($globalDebug) { |
|
|
3075
|
+ echo 'Count all pilots by months by airlines...'."\n"; |
|
|
3076
|
+ } |
|
2679
|
3077
|
$alldata = $Spotter->countAllMonthsPilotsByAirlines($filter_last_month); |
|
2680
|
3078
|
foreach ($alldata as $number) { |
|
2681
|
3079
|
$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']); |
|
2682
|
3080
|
} |
|
2683
|
|
- if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
|
|
3081
|
+ if ($globalDebug) { |
|
|
3082
|
+ echo 'Count all aircrafts by months by airlines...'."\n"; |
|
|
3083
|
+ } |
|
2684
|
3084
|
$alldata = $Spotter->countAllMonthsAircraftsByAirlines($filter_last_month); |
|
2685
|
3085
|
foreach ($alldata as $number) { |
|
2686
|
3086
|
$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']); |
|
2687
|
3087
|
} |
|
2688
|
|
- if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
|
|
3088
|
+ if ($globalDebug) { |
|
|
3089
|
+ echo 'Count all real arrivals by months by airlines...'."\n"; |
|
|
3090
|
+ } |
|
2689
|
3091
|
$alldata = $Spotter->countAllMonthsRealArrivalsByAirlines($filter_last_month); |
|
2690
|
3092
|
foreach ($alldata as $number) { |
|
2691
|
3093
|
$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']); |
|
2692
|
3094
|
} |
|
2693
|
|
- if ($globalDebug) echo '...Departure'."\n"; |
|
|
3095
|
+ if ($globalDebug) { |
|
|
3096
|
+ echo '...Departure'."\n"; |
|
|
3097
|
+ } |
|
2694
|
3098
|
$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
|
2695
|
3099
|
$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
|
2696
|
3100
|
foreach ($dall as $value) { |
|
@@ -2713,7 +3117,9 @@ discard block |
|
|
block discarded – undo |
|
2713
|
3117
|
foreach ($alldata as $number) { |
|
2714
|
3118
|
$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']); |
|
2715
|
3119
|
} |
|
2716
|
|
- if ($globalDebug) echo '...Arrival'."\n"; |
|
|
3120
|
+ if ($globalDebug) { |
|
|
3121
|
+ echo '...Arrival'."\n"; |
|
|
3122
|
+ } |
|
2717
|
3123
|
$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
|
2718
|
3124
|
$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
|
2719
|
3125
|
foreach ($dall as $value) { |
|
@@ -2737,13 +3143,19 @@ discard block |
|
|
block discarded – undo |
|
2737
|
3143
|
$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']); |
|
2738
|
3144
|
} |
|
2739
|
3145
|
|
|
2740
|
|
- if ($globalDebug) echo 'Flights data...'."\n"; |
|
2741
|
|
- if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
|
|
3146
|
+ if ($globalDebug) { |
|
|
3147
|
+ echo 'Flights data...'."\n"; |
|
|
3148
|
+ } |
|
|
3149
|
+ if ($globalDebug) { |
|
|
3150
|
+ echo '-> countAllDatesLastMonth...'."\n"; |
|
|
3151
|
+ } |
|
2742
|
3152
|
$alldata = $Spotter->countAllDatesLastMonthByAirlines($filter_last_month); |
|
2743
|
3153
|
foreach ($alldata as $number) { |
|
2744
|
3154
|
$this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
|
2745
|
3155
|
} |
|
2746
|
|
- if ($globalDebug) echo '-> countAllDates...'."\n"; |
|
|
3156
|
+ if ($globalDebug) { |
|
|
3157
|
+ echo '-> countAllDates...'."\n"; |
|
|
3158
|
+ } |
|
2747
|
3159
|
//$previousdata = $this->countAllDatesByAirlines(); |
|
2748
|
3160
|
$alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines($filter_last_month)); |
|
2749
|
3161
|
$values = array(); |
|
@@ -2756,14 +3168,18 @@ discard block |
|
|
block discarded – undo |
|
2756
|
3168
|
$this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
|
2757
|
3169
|
} |
|
2758
|
3170
|
|
|
2759
|
|
- if ($globalDebug) echo '-> countAllHours...'."\n"; |
|
|
3171
|
+ if ($globalDebug) { |
|
|
3172
|
+ echo '-> countAllHours...'."\n"; |
|
|
3173
|
+ } |
|
2760
|
3174
|
$alldata = $Spotter->countAllHoursByAirlines('hour',$filter_last_month); |
|
2761
|
3175
|
foreach ($alldata as $number) { |
|
2762
|
3176
|
$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
|
2763
|
3177
|
} |
|
2764
|
3178
|
|
|
2765
|
3179
|
// Stats by filters |
|
2766
|
|
- if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array(); |
|
|
3180
|
+ if (!isset($globalStatsFilters) || $globalStatsFilters == '') { |
|
|
3181
|
+ $globalStatsFilters = array(); |
|
|
3182
|
+ } |
|
2767
|
3183
|
foreach ($globalStatsFilters as $name => $filter) { |
|
2768
|
3184
|
if (!empty($filter)) { |
|
2769
|
3185
|
//$filter_name = $filter['name']; |
|
@@ -2771,7 +3187,9 @@ discard block |
|
|
block discarded – undo |
|
2771
|
3187
|
$reset = false; |
|
2772
|
3188
|
$last_update = $this->getLastStatsUpdate('last_update_stats_'.$filter_name); |
|
2773
|
3189
|
if (isset($filter['resetall']) && isset($last_update[0]['value']) && strtotime($filter['resetall']) > strtotime($last_update[0]['value'])) { |
|
2774
|
|
- if ($globalDebug) echo '!!! Delete stats for filter '.$filter_name.' !!!'."\n"; |
|
|
3190
|
+ if ($globalDebug) { |
|
|
3191
|
+ echo '!!! Delete stats for filter '.$filter_name.' !!!'."\n"; |
|
|
3192
|
+ } |
|
2775
|
3193
|
$this->deleteOldStats($filter_name); |
|
2776
|
3194
|
unset($last_update); |
|
2777
|
3195
|
} |
|
@@ -2788,39 +3206,55 @@ discard block |
|
|
block discarded – undo |
|
2788
|
3206
|
$reset = true; |
|
2789
|
3207
|
} |
|
2790
|
3208
|
// Count by filter |
|
2791
|
|
- if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
|
3209
|
+ if ($globalDebug) { |
|
|
3210
|
+ echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
|
3211
|
+ } |
|
2792
|
3212
|
$Spotter = new Spotter($this->db); |
|
2793
|
|
- if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
|
|
3213
|
+ if ($globalDebug) { |
|
|
3214
|
+ echo 'Count all aircraft types...'."\n"; |
|
|
3215
|
+ } |
|
2794
|
3216
|
$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
|
2795
|
3217
|
foreach ($alldata as $number) { |
|
2796
|
3218
|
$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name,$reset); |
|
2797
|
3219
|
} |
|
2798
|
|
- if ($globalDebug) echo 'Count all airlines...'."\n"; |
|
|
3220
|
+ if ($globalDebug) { |
|
|
3221
|
+ echo 'Count all airlines...'."\n"; |
|
|
3222
|
+ } |
|
2799
|
3223
|
$alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter); |
|
2800
|
3224
|
foreach ($alldata as $number) { |
|
2801
|
3225
|
$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name,$reset); |
|
2802
|
3226
|
} |
|
2803
|
|
- if ($globalDebug) echo 'Count all aircraft registrations...'."\n"; |
|
|
3227
|
+ if ($globalDebug) { |
|
|
3228
|
+ echo 'Count all aircraft registrations...'."\n"; |
|
|
3229
|
+ } |
|
2804
|
3230
|
$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter); |
|
2805
|
3231
|
foreach ($alldata as $number) { |
|
2806
|
3232
|
$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name,$reset); |
|
2807
|
3233
|
} |
|
2808
|
|
- if ($globalDebug) echo 'Count all callsigns...'."\n"; |
|
|
3234
|
+ if ($globalDebug) { |
|
|
3235
|
+ echo 'Count all callsigns...'."\n"; |
|
|
3236
|
+ } |
|
2809
|
3237
|
$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter); |
|
2810
|
3238
|
foreach ($alldata as $number) { |
|
2811
|
3239
|
$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name,$reset); |
|
2812
|
3240
|
} |
|
2813
|
|
- if ($globalDebug) echo 'Count all owners...'."\n"; |
|
|
3241
|
+ if ($globalDebug) { |
|
|
3242
|
+ echo 'Count all owners...'."\n"; |
|
|
3243
|
+ } |
|
2814
|
3244
|
$alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter); |
|
2815
|
3245
|
foreach ($alldata as $number) { |
|
2816
|
3246
|
$this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name,$reset); |
|
2817
|
3247
|
} |
|
2818
|
|
- if ($globalDebug) echo 'Count all pilots...'."\n"; |
|
|
3248
|
+ if ($globalDebug) { |
|
|
3249
|
+ echo 'Count all pilots...'."\n"; |
|
|
3250
|
+ } |
|
2819
|
3251
|
$alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter); |
|
2820
|
3252
|
foreach ($alldata as $number) { |
|
2821
|
3253
|
$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source'],$reset); |
|
2822
|
3254
|
} |
|
2823
|
|
- if ($globalDebug) echo 'Count departure airports...'."\n"; |
|
|
3255
|
+ if ($globalDebug) { |
|
|
3256
|
+ echo 'Count departure airports...'."\n"; |
|
|
3257
|
+ } |
|
2824
|
3258
|
$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
|
2825
|
3259
|
$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
2826
|
3260
|
$alldata = array(); |
|
@@ -2832,7 +3266,9 @@ discard block |
|
|
block discarded – undo |
|
2832
|
3266
|
$icao = $value['airport_departure_icao']; |
|
2833
|
3267
|
if (isset($alldata[$icao])) { |
|
2834
|
3268
|
$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
2835
|
|
- } else $alldata[$icao] = $value; |
|
|
3269
|
+ } else { |
|
|
3270
|
+ $alldata[$icao] = $value; |
|
|
3271
|
+ } |
|
2836
|
3272
|
} |
|
2837
|
3273
|
$count = array(); |
|
2838
|
3274
|
foreach ($alldata as $key => $row) { |
|
@@ -2842,7 +3278,9 @@ discard block |
|
|
block discarded – undo |
|
2842
|
3278
|
foreach ($alldata as $number) { |
|
2843
|
3279
|
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); |
|
2844
|
3280
|
} |
|
2845
|
|
- if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
|
|
3281
|
+ if ($globalDebug) { |
|
|
3282
|
+ echo 'Count all arrival airports...'."\n"; |
|
|
3283
|
+ } |
|
2846
|
3284
|
$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter); |
|
2847
|
3285
|
$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter); |
|
2848
|
3286
|
$alldata = array(); |
|
@@ -2854,7 +3292,9 @@ discard block |
|
|
block discarded – undo |
|
2854
|
3292
|
$icao = $value['airport_arrival_icao']; |
|
2855
|
3293
|
if (isset($alldata[$icao])) { |
|
2856
|
3294
|
$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
2857
|
|
- } else $alldata[$icao] = $value; |
|
|
3295
|
+ } else { |
|
|
3296
|
+ $alldata[$icao] = $value; |
|
|
3297
|
+ } |
|
2858
|
3298
|
} |
|
2859
|
3299
|
$count = array(); |
|
2860
|
3300
|
foreach ($alldata as $key => $row) { |
|
@@ -2864,35 +3304,49 @@ discard block |
|
|
block discarded – undo |
|
2864
|
3304
|
foreach ($alldata as $number) { |
|
2865
|
3305
|
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); |
|
2866
|
3306
|
} |
|
2867
|
|
- if ($globalDebug) echo 'Count all months...'."\n"; |
|
|
3307
|
+ if ($globalDebug) { |
|
|
3308
|
+ echo 'Count all months...'."\n"; |
|
|
3309
|
+ } |
|
2868
|
3310
|
$Spotter = new Spotter($this->db); |
|
2869
|
3311
|
$alldata = $Spotter->countAllMonths($filter); |
|
2870
|
3312
|
$lastyear = false; |
|
2871
|
3313
|
foreach ($alldata as $number) { |
|
2872
|
|
- if ($number['year_name'] != date('Y')) $lastyear = true; |
|
|
3314
|
+ if ($number['year_name'] != date('Y')) { |
|
|
3315
|
+ $lastyear = true; |
|
|
3316
|
+ } |
|
2873
|
3317
|
$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); |
|
2874
|
3318
|
} |
|
2875
|
|
- if ($globalDebug) echo 'Count all owners by months...'."\n"; |
|
|
3319
|
+ if ($globalDebug) { |
|
|
3320
|
+ echo 'Count all owners by months...'."\n"; |
|
|
3321
|
+ } |
|
2876
|
3322
|
$alldata = $Spotter->countAllMonthsOwners($filter); |
|
2877
|
3323
|
foreach ($alldata as $number) { |
|
2878
|
3324
|
$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); |
|
2879
|
3325
|
} |
|
2880
|
|
- if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
|
|
3326
|
+ if ($globalDebug) { |
|
|
3327
|
+ echo 'Count all pilots by months...'."\n"; |
|
|
3328
|
+ } |
|
2881
|
3329
|
$alldata = $Spotter->countAllMonthsPilots($filter); |
|
2882
|
3330
|
foreach ($alldata as $number) { |
|
2883
|
3331
|
$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); |
|
2884
|
3332
|
} |
|
2885
|
|
- if ($globalDebug) echo 'Count all military by months...'."\n"; |
|
|
3333
|
+ if ($globalDebug) { |
|
|
3334
|
+ echo 'Count all military by months...'."\n"; |
|
|
3335
|
+ } |
|
2886
|
3336
|
$alldata = $Spotter->countAllMilitaryMonths($filter); |
|
2887
|
3337
|
foreach ($alldata as $number) { |
|
2888
|
3338
|
$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); |
|
2889
|
3339
|
} |
|
2890
|
|
- if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
|
|
3340
|
+ if ($globalDebug) { |
|
|
3341
|
+ echo 'Count all aircrafts by months...'."\n"; |
|
|
3342
|
+ } |
|
2891
|
3343
|
$alldata = $Spotter->countAllMonthsAircrafts($filter); |
|
2892
|
3344
|
foreach ($alldata as $number) { |
|
2893
|
3345
|
$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); |
|
2894
|
3346
|
} |
|
2895
|
|
- if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
|
|
3347
|
+ if ($globalDebug) { |
|
|
3348
|
+ echo 'Count all real arrivals by months...'."\n"; |
|
|
3349
|
+ } |
|
2896
|
3350
|
$alldata = $Spotter->countAllMonthsRealArrivals($filter); |
|
2897
|
3351
|
foreach ($alldata as $number) { |
|
2898
|
3352
|
$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); |