|
@@ -18,14 +18,14 @@ discard block |
|
|
block discarded – undo |
18
|
18
|
$this->db = $Connection->db(); |
19
|
19
|
} |
20
|
20
|
|
21
|
|
- public function addLastStatsUpdate($type,$stats_date) { |
|
21
|
+ public function addLastStatsUpdate($type, $stats_date) { |
22
|
22
|
$query = "DELETE FROM config WHERE name = :type; |
23
|
23
|
INSERT INTO config (name,value) VALUES (:type,:stats_date);"; |
24
|
|
- $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
24
|
+ $query_values = array('type' => $type, ':stats_date' => $stats_date); |
25
|
25
|
try { |
26
|
26
|
$sth = $this->db->prepare($query); |
27
|
27
|
$sth->execute($query_values); |
28
|
|
- } catch(PDOException $e) { |
|
28
|
+ } catch (PDOException $e) { |
29
|
29
|
return "error : ".$e->getMessage(); |
30
|
30
|
} |
31
|
31
|
} |
|
@@ -35,7 +35,7 @@ discard block |
|
|
block discarded – undo |
35
|
35
|
try { |
36
|
36
|
$sth = $this->db->prepare($query); |
37
|
37
|
$sth->execute(array(':type' => $type)); |
38
|
|
- } catch(PDOException $e) { |
|
38
|
+ } catch (PDOException $e) { |
39
|
39
|
echo "error : ".$e->getMessage(); |
40
|
40
|
} |
41
|
41
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -56,7 +56,7 @@ discard block |
|
|
block discarded – undo |
56
|
56
|
try { |
57
|
57
|
$sth = $this->db->prepare($query); |
58
|
58
|
$sth->execute(array(':filter_name' => $filter_name)); |
59
|
|
- } catch(PDOException $e) { |
|
59
|
+ } catch (PDOException $e) { |
60
|
60
|
return "error : ".$e->getMessage(); |
61
|
61
|
} |
62
|
62
|
} |
|
@@ -69,14 +69,14 @@ discard block |
|
|
block discarded – undo |
69
|
69
|
try { |
70
|
70
|
$sth = $this->db->prepare($query); |
71
|
71
|
$sth->execute(); |
72
|
|
- } catch(PDOException $e) { |
|
72
|
+ } catch (PDOException $e) { |
73
|
73
|
return "error : ".$e->getMessage(); |
74
|
74
|
} |
75
|
75
|
$query = "DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;"; |
76
|
76
|
try { |
77
|
77
|
$sth = $this->db->prepare($query); |
78
|
78
|
$sth->execute(array(':filter_name' => $filter_name)); |
79
|
|
- } catch(PDOException $e) { |
|
79
|
+ } catch (PDOException $e) { |
80
|
80
|
return "error : ".$e->getMessage(); |
81
|
81
|
} |
82
|
82
|
} |
|
@@ -88,77 +88,77 @@ discard block |
|
|
block discarded – undo |
88
|
88
|
try { |
89
|
89
|
$sth = $this->db->prepare($query); |
90
|
90
|
$sth->execute(array(':filter_name' => $filter_name)); |
91
|
|
- } catch(PDOException $e) { |
|
91
|
+ } catch (PDOException $e) { |
92
|
92
|
echo "error : ".$e->getMessage(); |
93
|
93
|
} |
94
|
94
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
95
|
95
|
if (empty($all)) { |
96
|
96
|
$filters = array(); |
97
|
97
|
if ($filter_name != '') { |
98
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
98
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
99
|
99
|
} |
100
|
100
|
$Spotter = new Spotter($this->db); |
101
|
|
- $all = $Spotter->getAllAirlineNames('',NULL,$filters); |
|
101
|
+ $all = $Spotter->getAllAirlineNames('', NULL, $filters); |
102
|
102
|
} |
103
|
103
|
return $all; |
104
|
104
|
} |
105
|
|
- public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
|
105
|
+ public function getAllAircraftTypes($stats_airline = '', $filter_name = '') { |
106
|
106
|
if ($filter_name == '') $filter_name = $this->filter_name; |
107
|
107
|
$query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
108
|
108
|
try { |
109
|
109
|
$sth = $this->db->prepare($query); |
110
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
111
|
|
- } catch(PDOException $e) { |
|
110
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
111
|
+ } catch (PDOException $e) { |
112
|
112
|
echo "error : ".$e->getMessage(); |
113
|
113
|
} |
114
|
114
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
115
|
115
|
return $all; |
116
|
116
|
} |
117
|
|
- public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
|
117
|
+ public function getAllManufacturers($stats_airline = '', $filter_name = '') { |
118
|
118
|
if ($filter_name == '') $filter_name = $this->filter_name; |
119
|
119
|
$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"; |
120
|
120
|
try { |
121
|
121
|
$sth = $this->db->prepare($query); |
122
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
123
|
|
- } catch(PDOException $e) { |
|
122
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
123
|
+ } catch (PDOException $e) { |
124
|
124
|
echo "error : ".$e->getMessage(); |
125
|
125
|
} |
126
|
126
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
127
|
127
|
return $all; |
128
|
128
|
} |
129
|
|
- public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
|
129
|
+ public function getAllAirportNames($stats_airline = '', $filter_name = '') { |
130
|
130
|
if ($filter_name == '') $filter_name = $this->filter_name; |
131
|
131
|
$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"; |
132
|
132
|
try { |
133
|
133
|
$sth = $this->db->prepare($query); |
134
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
135
|
|
- } catch(PDOException $e) { |
|
134
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
135
|
+ } catch (PDOException $e) { |
136
|
136
|
echo "error : ".$e->getMessage(); |
137
|
137
|
} |
138
|
138
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
139
|
139
|
return $all; |
140
|
140
|
} |
141
|
141
|
|
142
|
|
- public function getAllOwnerNames($stats_airline = '',$filter_name = '') { |
|
142
|
+ public function getAllOwnerNames($stats_airline = '', $filter_name = '') { |
143
|
143
|
if ($filter_name == '') $filter_name = $this->filter_name; |
144
|
144
|
$query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC"; |
145
|
145
|
try { |
146
|
146
|
$sth = $this->db->prepare($query); |
147
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
148
|
|
- } catch(PDOException $e) { |
|
147
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
148
|
+ } catch (PDOException $e) { |
149
|
149
|
echo "error : ".$e->getMessage(); |
150
|
150
|
} |
151
|
151
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
152
|
152
|
return $all; |
153
|
153
|
} |
154
|
154
|
|
155
|
|
- public function getAllPilotNames($stats_airline = '',$filter_name = '') { |
|
155
|
+ public function getAllPilotNames($stats_airline = '', $filter_name = '') { |
156
|
156
|
if ($filter_name == '') $filter_name = $this->filter_name; |
157
|
157
|
$query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC"; |
158
|
158
|
try { |
159
|
159
|
$sth = $this->db->prepare($query); |
160
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
161
|
|
- } catch(PDOException $e) { |
|
160
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
161
|
+ } catch (PDOException $e) { |
162
|
162
|
echo "error : ".$e->getMessage(); |
163
|
163
|
} |
164
|
164
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -166,23 +166,23 @@ discard block |
|
|
block discarded – undo |
166
|
166
|
} |
167
|
167
|
|
168
|
168
|
|
169
|
|
- public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
169
|
+ public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
170
|
170
|
global $globalStatsFilters; |
171
|
171
|
if ($filter_name == '') $filter_name = $this->filter_name; |
172
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
172
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
173
|
173
|
$Spotter = new Spotter($this->db); |
174
|
|
- $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
174
|
+ $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
175
|
175
|
$alliance_airlines = array(); |
176
|
176
|
foreach ($airlines as $airline) { |
177
|
|
- $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
177
|
+ $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
178
|
178
|
} |
179
|
179
|
if ($year == '' && $month == '') { |
180
|
|
- if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
181
|
|
- else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
180
|
+ if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
181
|
+ else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
182
|
182
|
try { |
183
|
183
|
$sth = $this->db->prepare($query); |
184
|
184
|
$sth->execute(array(':filter_name' => $filter_name)); |
185
|
|
- } catch(PDOException $e) { |
|
185
|
+ } catch (PDOException $e) { |
186
|
186
|
echo "error : ".$e->getMessage(); |
187
|
187
|
} |
188
|
188
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -193,29 +193,29 @@ discard block |
|
|
block discarded – undo |
193
|
193
|
else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
194
|
194
|
try { |
195
|
195
|
$sth = $this->db->prepare($query); |
196
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
197
|
|
- } catch(PDOException $e) { |
|
196
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
197
|
+ } catch (PDOException $e) { |
198
|
198
|
echo "error : ".$e->getMessage(); |
199
|
199
|
} |
200
|
200
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
201
|
201
|
} else $all = array(); |
202
|
202
|
} |
203
|
203
|
if (empty($all)) { |
204
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
205
|
|
- $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
204
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
205
|
+ $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
206
|
206
|
} else { |
207
|
|
- $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
207
|
+ $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
208
|
208
|
} |
209
|
209
|
if ($filter_name != '') { |
210
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
210
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
211
|
211
|
} |
212
|
212
|
$Spotter = new Spotter($this->db); |
213
|
213
|
//$all = $Spotter->countAllAircraftTypes($limit,0,'',$filters,$year,$month); |
214
|
|
- $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters); |
|
214
|
+ $all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters); |
215
|
215
|
} |
216
|
216
|
return $all; |
217
|
217
|
} |
218
|
|
- public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
|
218
|
+ public function countAllAirlineCountries($limit = true, $filter_name = '', $year = '', $month = '') { |
219
|
219
|
global $globalStatsFilters; |
220
|
220
|
if ($filter_name == '') $filter_name = $this->filter_name; |
221
|
221
|
if ($year == '' && $month == '') { |
|
@@ -224,7 +224,7 @@ discard block |
|
|
block discarded – undo |
224
|
224
|
try { |
225
|
225
|
$sth = $this->db->prepare($query); |
226
|
226
|
$sth->execute(array(':filter_name' => $filter_name)); |
227
|
|
- } catch(PDOException $e) { |
|
227
|
+ } catch (PDOException $e) { |
228
|
228
|
echo "error : ".$e->getMessage(); |
229
|
229
|
} |
230
|
230
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -232,32 +232,32 @@ discard block |
|
|
block discarded – undo |
232
|
232
|
if (empty($all)) { |
233
|
233
|
$Spotter = new Spotter($this->db); |
234
|
234
|
$filters = array(); |
235
|
|
- $filters = array('year' => $year,'month' => $month); |
|
235
|
+ $filters = array('year' => $year, 'month' => $month); |
236
|
236
|
if ($filter_name != '') { |
237
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
237
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
238
|
238
|
} |
239
|
239
|
//$all = $Spotter->countAllAirlineCountries($limit,$filters,$year,$month); |
240
|
|
- $all = $Spotter->countAllAirlineCountries($limit,$filters); |
|
240
|
+ $all = $Spotter->countAllAirlineCountries($limit, $filters); |
241
|
241
|
} |
242
|
242
|
return $all; |
243
|
243
|
} |
244
|
|
- public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
244
|
+ public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
245
|
245
|
global $globalStatsFilters; |
246
|
246
|
if ($filter_name == '') $filter_name = $this->filter_name; |
247
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
247
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
248
|
248
|
$Spotter = new Spotter($this->db); |
249
|
|
- $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
249
|
+ $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
250
|
250
|
$alliance_airlines = array(); |
251
|
251
|
foreach ($airlines as $airline) { |
252
|
|
- $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
252
|
+ $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
253
|
253
|
} |
254
|
254
|
if ($year == '' && $month == '') { |
255
|
|
- 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"; |
256
|
|
- else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
255
|
+ 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"; |
|
256
|
+ 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"; |
257
|
257
|
try { |
258
|
258
|
$sth = $this->db->prepare($query); |
259
|
259
|
$sth->execute(array(':filter_name' => $filter_name)); |
260
|
|
- } catch(PDOException $e) { |
|
260
|
+ } catch (PDOException $e) { |
261
|
261
|
echo "error : ".$e->getMessage(); |
262
|
262
|
} |
263
|
263
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -268,21 +268,21 @@ discard block |
|
|
block discarded – undo |
268
|
268
|
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"; |
269
|
269
|
try { |
270
|
270
|
$sth = $this->db->prepare($query); |
271
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
272
|
|
- } catch(PDOException $e) { |
|
271
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
272
|
+ } catch (PDOException $e) { |
273
|
273
|
echo "error : ".$e->getMessage(); |
274
|
274
|
} |
275
|
275
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
276
|
276
|
} else $all = array(); |
277
|
277
|
} |
278
|
278
|
if (empty($all)) { |
279
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
280
|
|
- $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
279
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
280
|
+ $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
281
|
281
|
} else { |
282
|
|
- $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
282
|
+ $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
283
|
283
|
} |
284
|
284
|
if ($filter_name != '') { |
285
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
285
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
286
|
286
|
} |
287
|
287
|
$Spotter = new Spotter($this->db); |
288
|
288
|
//$all = $Spotter->countAllAircraftManufacturers($filters,$year,$month); |
|
@@ -291,23 +291,23 @@ discard block |
|
|
block discarded – undo |
291
|
291
|
return $all; |
292
|
292
|
} |
293
|
293
|
|
294
|
|
- public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
294
|
+ public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
295
|
295
|
global $globalStatsFilters; |
296
|
296
|
if ($filter_name == '') $filter_name = $this->filter_name; |
297
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
297
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
298
|
298
|
$Spotter = new Spotter($this->db); |
299
|
|
- $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
299
|
+ $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
300
|
300
|
$alliance_airlines = array(); |
301
|
301
|
foreach ($airlines as $airline) { |
302
|
|
- $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
302
|
+ $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
303
|
303
|
} |
304
|
304
|
if ($year == '' && $month == '') { |
305
|
|
- 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"; |
306
|
|
- else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
305
|
+ 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"; |
|
306
|
+ 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"; |
307
|
307
|
try { |
308
|
308
|
$sth = $this->db->prepare($query); |
309
|
309
|
$sth->execute(array(':filter_name' => $filter_name)); |
310
|
|
- } catch(PDOException $e) { |
|
310
|
+ } catch (PDOException $e) { |
311
|
311
|
echo "error : ".$e->getMessage(); |
312
|
312
|
} |
313
|
313
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -318,61 +318,61 @@ discard block |
|
|
block discarded – undo |
318
|
318
|
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"; |
319
|
319
|
try { |
320
|
320
|
$sth = $this->db->prepare($query); |
321
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
322
|
|
- } catch(PDOException $e) { |
|
321
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
322
|
+ } catch (PDOException $e) { |
323
|
323
|
echo "error : ".$e->getMessage(); |
324
|
324
|
} |
325
|
325
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
326
|
326
|
} else $all = array(); |
327
|
327
|
} |
328
|
328
|
if (empty($all)) { |
329
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
330
|
|
- $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
329
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
330
|
+ $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
331
|
331
|
} else { |
332
|
|
- $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
332
|
+ $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
333
|
333
|
} |
334
|
334
|
if ($filter_name != '') { |
335
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
335
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
336
|
336
|
} |
337
|
337
|
$Spotter = new Spotter($this->db); |
338
|
338
|
//$all = $Spotter->countAllArrivalCountries($limit,$filters,$year,$month); |
339
|
|
- $all = $Spotter->countAllArrivalCountries($limit,$filters); |
|
339
|
+ $all = $Spotter->countAllArrivalCountries($limit, $filters); |
340
|
340
|
} |
341
|
341
|
return $all; |
342
|
342
|
} |
343
|
343
|
public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
344
|
344
|
global $globalStatsFilters; |
345
|
345
|
if ($filter_name == '') $filter_name = $this->filter_name; |
346
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
346
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
347
|
347
|
$Spotter = new Spotter($this->db); |
348
|
|
- $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
348
|
+ $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
349
|
349
|
$alliance_airlines = array(); |
350
|
350
|
foreach ($airlines as $airline) { |
351
|
|
- $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
351
|
+ $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
352
|
352
|
} |
353
|
|
- 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"; |
354
|
|
- else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
353
|
+ 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"; |
|
354
|
+ 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"; |
355
|
355
|
$query_values = array(':filter_name' => $filter_name); |
356
|
356
|
} else { |
357
|
357
|
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"; |
358
|
358
|
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"; |
359
|
|
- $query_values = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
359
|
+ $query_values = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
360
|
360
|
} |
361
|
361
|
try { |
362
|
362
|
$sth = $this->db->prepare($query); |
363
|
363
|
$sth->execute($query_values); |
364
|
|
- } catch(PDOException $e) { |
|
364
|
+ } catch (PDOException $e) { |
365
|
365
|
echo "error : ".$e->getMessage(); |
366
|
366
|
} |
367
|
367
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
368
|
368
|
if (empty($all)) { |
369
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
370
|
|
- $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
369
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
370
|
+ $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
371
|
371
|
} else { |
372
|
|
- $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
372
|
+ $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
373
|
373
|
} |
374
|
374
|
if ($filter_name != '') { |
375
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
375
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
376
|
376
|
} |
377
|
377
|
$Spotter = new Spotter($this->db); |
378
|
378
|
//$all = $Spotter->countAllDepartureCountries($filters,$year,$month); |
|
@@ -381,7 +381,7 @@ discard block |
|
|
block discarded – undo |
381
|
381
|
return $all; |
382
|
382
|
} |
383
|
383
|
|
384
|
|
- public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
|
384
|
+ public function countAllAirlines($limit = true, $filter_name = '', $year = '', $month = '') { |
385
|
385
|
global $globalStatsFilters, $globalVATSIM, $globalIVAO; |
386
|
386
|
if ($filter_name == '') $filter_name = $this->filter_name; |
387
|
387
|
if ($year == '' && $month == '') { |
|
@@ -390,7 +390,7 @@ discard block |
|
|
block discarded – undo |
390
|
390
|
if (isset($forsource)) { |
391
|
391
|
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"; |
392
|
392
|
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"; |
393
|
|
- $query_values = array(':filter_name' => $filter_name,':forsource' => $forsource); |
|
393
|
+ $query_values = array(':filter_name' => $filter_name, ':forsource' => $forsource); |
394
|
394
|
} else { |
395
|
395
|
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"; |
396
|
396
|
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"; |
|
@@ -399,7 +399,7 @@ discard block |
|
|
block discarded – undo |
399
|
399
|
try { |
400
|
400
|
$sth = $this->db->prepare($query); |
401
|
401
|
$sth->execute($query_values); |
402
|
|
- } catch(PDOException $e) { |
|
402
|
+ } catch (PDOException $e) { |
403
|
403
|
echo "error : ".$e->getMessage(); |
404
|
404
|
} |
405
|
405
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -407,32 +407,32 @@ discard block |
|
|
block discarded – undo |
407
|
407
|
if (empty($all)) { |
408
|
408
|
$Spotter = new Spotter($this->db); |
409
|
409
|
$filters = array(); |
410
|
|
- $filters = array('year' => $year,'month' => $month); |
|
410
|
+ $filters = array('year' => $year, 'month' => $month); |
411
|
411
|
if ($filter_name != '') { |
412
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
412
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
413
|
413
|
} |
414
|
414
|
//$all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month); |
415
|
|
- $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
415
|
+ $all = $Spotter->countAllAirlines($limit, 0, '', $filters); |
416
|
416
|
} |
417
|
417
|
return $all; |
418
|
418
|
} |
419
|
|
- public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
419
|
+ public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
420
|
420
|
global $globalStatsFilters; |
421
|
421
|
if ($filter_name == '') $filter_name = $this->filter_name; |
422
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
422
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
423
|
423
|
$Spotter = new Spotter($this->db); |
424
|
|
- $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
424
|
+ $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
425
|
425
|
$alliance_airlines = array(); |
426
|
426
|
foreach ($airlines as $airline) { |
427
|
|
- $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
427
|
+ $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
428
|
428
|
} |
429
|
429
|
if ($year == '' && $month == '') { |
430
|
|
- if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
431
|
|
- else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
430
|
+ if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
431
|
+ else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
432
|
432
|
try { |
433
|
433
|
$sth = $this->db->prepare($query); |
434
|
434
|
$sth->execute(array(':filter_name' => $filter_name)); |
435
|
|
- } catch(PDOException $e) { |
|
435
|
+ } catch (PDOException $e) { |
436
|
436
|
echo "error : ".$e->getMessage(); |
437
|
437
|
} |
438
|
438
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -443,45 +443,45 @@ discard block |
|
|
block discarded – undo |
443
|
443
|
else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
444
|
444
|
try { |
445
|
445
|
$sth = $this->db->prepare($query); |
446
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
447
|
|
- } catch(PDOException $e) { |
|
446
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
447
|
+ } catch (PDOException $e) { |
448
|
448
|
echo "error : ".$e->getMessage(); |
449
|
449
|
} |
450
|
450
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
451
|
451
|
} else $all = array(); |
452
|
452
|
} |
453
|
453
|
if (empty($all)) { |
454
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
455
|
|
- $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
454
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
455
|
+ $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
456
|
456
|
} else { |
457
|
|
- $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
457
|
+ $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
458
|
458
|
} |
459
|
459
|
if ($filter_name != '') { |
460
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
460
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
461
|
461
|
} |
462
|
462
|
$Spotter = new Spotter($this->db); |
463
|
463
|
//$all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters,$year,$month); |
464
|
|
- $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters); |
|
464
|
+ $all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters); |
465
|
465
|
} |
466
|
466
|
return $all; |
467
|
467
|
} |
468
|
|
- public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
468
|
+ public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
469
|
469
|
global $globalStatsFilters; |
470
|
470
|
if ($filter_name == '') $filter_name = $this->filter_name; |
471
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
471
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
472
|
472
|
$Spotter = new Spotter($this->db); |
473
|
|
- $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
473
|
+ $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
474
|
474
|
$alliance_airlines = array(); |
475
|
475
|
foreach ($airlines as $airline) { |
476
|
|
- $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
476
|
+ $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
477
|
477
|
} |
478
|
478
|
if ($year == '' && $month == '') { |
479
|
|
- 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"; |
480
|
|
- else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
479
|
+ 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"; |
|
480
|
+ 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"; |
481
|
481
|
try { |
482
|
482
|
$sth = $this->db->prepare($query); |
483
|
483
|
$sth->execute(array(':filter_name' => $filter_name)); |
484
|
|
- } catch(PDOException $e) { |
|
484
|
+ } catch (PDOException $e) { |
485
|
485
|
echo "error : ".$e->getMessage(); |
486
|
486
|
} |
487
|
487
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -492,46 +492,46 @@ discard block |
|
|
block discarded – undo |
492
|
492
|
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"; |
493
|
493
|
try { |
494
|
494
|
$sth = $this->db->prepare($query); |
495
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
496
|
|
- } catch(PDOException $e) { |
|
495
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
496
|
+ } catch (PDOException $e) { |
497
|
497
|
echo "error : ".$e->getMessage(); |
498
|
498
|
} |
499
|
499
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
500
|
500
|
} else $all = array(); |
501
|
501
|
} |
502
|
502
|
if (empty($all)) { |
503
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
504
|
|
- $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
503
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
504
|
+ $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
505
|
505
|
} else { |
506
|
|
- $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
506
|
+ $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
507
|
507
|
} |
508
|
508
|
if ($filter_name != '') { |
509
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
509
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
510
|
510
|
} |
511
|
511
|
$Spotter = new Spotter($this->db); |
512
|
512
|
//$all = $Spotter->countAllCallsigns($limit,0,'',$filters,$year,$month); |
513
|
|
- $all = $Spotter->countAllCallsigns($limit,0,'',$filters); |
|
513
|
+ $all = $Spotter->countAllCallsigns($limit, 0, '', $filters); |
514
|
514
|
} |
515
|
515
|
return $all; |
516
|
516
|
} |
517
|
|
- public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
517
|
+ public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
518
|
518
|
$Connection = new Connection(); |
519
|
519
|
if ($filter_name == '') $filter_name = $this->filter_name; |
520
|
520
|
if ($Connection->tableExists('countries')) { |
521
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
521
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
522
|
522
|
$Spotter = new Spotter($this->db); |
523
|
|
- $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
523
|
+ $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
524
|
524
|
if ($year == '' && $month == '') { |
525
|
525
|
$alliance_airlines = array(); |
526
|
526
|
foreach ($airlines as $airline) { |
527
|
|
- $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
527
|
+ $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
528
|
528
|
} |
529
|
|
- 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"; |
530
|
|
- else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
529
|
+ 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"; |
|
530
|
+ 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"; |
531
|
531
|
try { |
532
|
532
|
$sth = $this->db->prepare($query); |
533
|
533
|
$sth->execute(array(':filter_name' => $filter_name)); |
534
|
|
- } catch(PDOException $e) { |
|
534
|
+ } catch (PDOException $e) { |
535
|
535
|
echo "error : ".$e->getMessage(); |
536
|
536
|
} |
537
|
537
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -543,8 +543,8 @@ discard block |
|
|
block discarded – undo |
543
|
543
|
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"; |
544
|
544
|
try { |
545
|
545
|
$sth = $this->db->prepare($query); |
546
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
547
|
|
- } catch(PDOException $e) { |
|
546
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
547
|
+ } catch (PDOException $e) { |
548
|
548
|
echo "error : ".$e->getMessage(); |
549
|
549
|
} |
550
|
550
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -561,7 +561,7 @@ discard block |
|
|
block discarded – undo |
561
|
561
|
return array(); |
562
|
562
|
} |
563
|
563
|
} |
564
|
|
- public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') { |
|
564
|
+ public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
565
|
565
|
global $globalStatsFilters; |
566
|
566
|
if ($filter_name == '') $filter_name = $this->filter_name; |
567
|
567
|
if ($year == '' && $month == '') { |
|
@@ -569,41 +569,41 @@ discard block |
|
|
block discarded – undo |
569
|
569
|
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"; |
570
|
570
|
try { |
571
|
571
|
$sth = $this->db->prepare($query); |
572
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
573
|
|
- } catch(PDOException $e) { |
|
572
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
573
|
+ } catch (PDOException $e) { |
574
|
574
|
echo "error : ".$e->getMessage(); |
575
|
575
|
} |
576
|
576
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
577
|
577
|
} else $all = array(); |
578
|
578
|
if (empty($all)) { |
579
|
|
- $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
579
|
+ $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
580
|
580
|
if ($filter_name != '') { |
581
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
581
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
582
|
582
|
} |
583
|
583
|
$Spotter = new Spotter($this->db); |
584
|
584
|
//$all = $Spotter->countAllPilots($limit,0,'',$filters,$year,$month); |
585
|
|
- $all = $Spotter->countAllPilots($limit,0,'',$filters); |
|
585
|
+ $all = $Spotter->countAllPilots($limit, 0, '', $filters); |
586
|
586
|
} |
587
|
587
|
return $all; |
588
|
588
|
} |
589
|
589
|
|
590
|
|
- public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') { |
|
590
|
+ public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
591
|
591
|
global $globalStatsFilters; |
592
|
592
|
if ($filter_name == '') $filter_name = $this->filter_name; |
593
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
593
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
594
|
594
|
$Spotter = new Spotter($this->db); |
595
|
|
- $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
595
|
+ $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
596
|
596
|
if ($year == '' && $month == '') { |
597
|
597
|
$alliance_airlines = array(); |
598
|
598
|
foreach ($airlines as $airline) { |
599
|
|
- $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
599
|
+ $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
600
|
600
|
} |
601
|
|
- 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"; |
602
|
|
- else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
601
|
+ 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"; |
|
602
|
+ 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"; |
603
|
603
|
try { |
604
|
604
|
$sth = $this->db->prepare($query); |
605
|
605
|
$sth->execute(array(':filter_name' => $filter_name)); |
606
|
|
- } catch(PDOException $e) { |
|
606
|
+ } catch (PDOException $e) { |
607
|
607
|
echo "error : ".$e->getMessage(); |
608
|
608
|
} |
609
|
609
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -614,45 +614,45 @@ discard block |
|
|
block discarded – undo |
614
|
614
|
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"; |
615
|
615
|
try { |
616
|
616
|
$sth = $this->db->prepare($query); |
617
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
618
|
|
- } catch(PDOException $e) { |
|
617
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
618
|
+ } catch (PDOException $e) { |
619
|
619
|
echo "error : ".$e->getMessage(); |
620
|
620
|
} |
621
|
621
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
622
|
622
|
} else $all = array(); |
623
|
623
|
} |
624
|
624
|
if (empty($all)) { |
625
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
626
|
|
- $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
625
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
626
|
+ $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
627
|
627
|
} else { |
628
|
|
- $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
628
|
+ $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
629
|
629
|
} |
630
|
630
|
if ($filter_name != '') { |
631
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
631
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
632
|
632
|
} |
633
|
633
|
$Spotter = new Spotter($this->db); |
634
|
634
|
//$all = $Spotter->countAllOwners($limit,0,'',$filters,$year,$month); |
635
|
|
- $all = $Spotter->countAllOwners($limit,0,'',$filters); |
|
635
|
+ $all = $Spotter->countAllOwners($limit, 0, '', $filters); |
636
|
636
|
} |
637
|
637
|
return $all; |
638
|
638
|
} |
639
|
|
- public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
639
|
+ public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
640
|
640
|
global $globalStatsFilters; |
641
|
641
|
if ($filter_name == '') $filter_name = $this->filter_name; |
642
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
642
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
643
|
643
|
$Spotter = new Spotter($this->db); |
644
|
|
- $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
644
|
+ $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
645
|
645
|
if ($year == '' && $month == '') { |
646
|
646
|
$alliance_airlines = array(); |
647
|
647
|
foreach ($airlines as $airline) { |
648
|
|
- $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
648
|
+ $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
649
|
649
|
} |
650
|
|
- if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
651
|
|
- else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
650
|
+ if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
651
|
+ else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
652
|
652
|
try { |
653
|
653
|
$sth = $this->db->prepare($query); |
654
|
654
|
$sth->execute(array(':filter_name' => $filter_name)); |
655
|
|
- } catch(PDOException $e) { |
|
655
|
+ } catch (PDOException $e) { |
656
|
656
|
echo "error : ".$e->getMessage(); |
657
|
657
|
} |
658
|
658
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -663,27 +663,27 @@ discard block |
|
|
block discarded – undo |
663
|
663
|
else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
664
|
664
|
try { |
665
|
665
|
$sth = $this->db->prepare($query); |
666
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
667
|
|
- } catch(PDOException $e) { |
|
666
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
667
|
+ } catch (PDOException $e) { |
668
|
668
|
echo "error : ".$e->getMessage(); |
669
|
669
|
} |
670
|
670
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
671
|
671
|
} else $all = array(); |
672
|
672
|
} |
673
|
673
|
if (empty($all)) { |
674
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
675
|
|
- $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
674
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
675
|
+ $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
676
|
676
|
} else { |
677
|
|
- $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
677
|
+ $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
678
|
678
|
} |
679
|
679
|
if ($filter_name != '') { |
680
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
680
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
681
|
681
|
} |
682
|
682
|
$Spotter = new Spotter($this->db); |
683
|
683
|
// $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters,$year,$month); |
684
|
684
|
// $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters,$year,$month); |
685
|
|
- $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters); |
686
|
|
- $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters); |
|
685
|
+ $pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters); |
|
686
|
+ $dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters); |
687
|
687
|
$all = array(); |
688
|
688
|
foreach ($pall as $value) { |
689
|
689
|
$icao = $value['airport_departure_icao']; |
|
@@ -699,27 +699,27 @@ discard block |
|
|
block discarded – undo |
699
|
699
|
foreach ($all as $key => $row) { |
700
|
700
|
$count[$key] = $row['airport_departure_icao_count']; |
701
|
701
|
} |
702
|
|
- array_multisort($count,SORT_DESC,$all); |
|
702
|
+ array_multisort($count, SORT_DESC, $all); |
703
|
703
|
} |
704
|
704
|
return $all; |
705
|
705
|
} |
706
|
|
- public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
706
|
+ public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
707
|
707
|
global $globalStatsFilters; |
708
|
708
|
if ($filter_name == '') $filter_name = $this->filter_name; |
709
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
709
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
710
|
710
|
$Spotter = new Spotter($this->db); |
711
|
|
- $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
711
|
+ $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
712
|
712
|
if ($year == '' && $month == '') { |
713
|
713
|
$alliance_airlines = array(); |
714
|
714
|
foreach ($airlines as $airline) { |
715
|
|
- $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
715
|
+ $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
716
|
716
|
} |
717
|
|
- if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
718
|
|
- else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
717
|
+ if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
718
|
+ else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
719
|
719
|
try { |
720
|
720
|
$sth = $this->db->prepare($query); |
721
|
721
|
$sth->execute(array(':filter_name' => $filter_name)); |
722
|
|
- } catch(PDOException $e) { |
|
722
|
+ } catch (PDOException $e) { |
723
|
723
|
echo "error : ".$e->getMessage(); |
724
|
724
|
} |
725
|
725
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -730,27 +730,27 @@ discard block |
|
|
block discarded – undo |
730
|
730
|
else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
731
|
731
|
try { |
732
|
732
|
$sth = $this->db->prepare($query); |
733
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
734
|
|
- } catch(PDOException $e) { |
|
733
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
734
|
+ } catch (PDOException $e) { |
735
|
735
|
echo "error : ".$e->getMessage(); |
736
|
736
|
} |
737
|
737
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
738
|
738
|
} else $all = array(); |
739
|
739
|
} |
740
|
740
|
if (empty($all)) { |
741
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
742
|
|
- $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
741
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
742
|
+ $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
743
|
743
|
} else { |
744
|
|
- $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
744
|
+ $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
745
|
745
|
} |
746
|
746
|
if ($filter_name != '') { |
747
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
747
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
748
|
748
|
} |
749
|
749
|
$Spotter = new Spotter($this->db); |
750
|
750
|
// $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters,$year,$month); |
751
|
751
|
// $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters,$year,$month); |
752
|
|
- $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters); |
753
|
|
- $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters); |
|
752
|
+ $pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters); |
|
753
|
+ $dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters); |
754
|
754
|
$all = array(); |
755
|
755
|
foreach ($pall as $value) { |
756
|
756
|
$icao = $value['airport_arrival_icao']; |
|
@@ -766,26 +766,26 @@ discard block |
|
|
block discarded – undo |
766
|
766
|
foreach ($all as $key => $row) { |
767
|
767
|
$count[$key] = $row['airport_arrival_icao_count']; |
768
|
768
|
} |
769
|
|
- array_multisort($count,SORT_DESC,$all); |
|
769
|
+ array_multisort($count, SORT_DESC, $all); |
770
|
770
|
} |
771
|
771
|
return $all; |
772
|
772
|
} |
773
|
|
- public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
|
773
|
+ public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') { |
774
|
774
|
global $globalDBdriver, $globalStatsFilters; |
775
|
775
|
if ($filter_name == '') $filter_name = $this->filter_name; |
776
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
776
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
777
|
777
|
$Spotter = new Spotter($this->db); |
778
|
|
- $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
778
|
+ $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
779
|
779
|
$alliance_airlines = array(); |
780
|
780
|
foreach ($airlines as $airline) { |
781
|
|
- $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
781
|
+ $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
782
|
782
|
} |
783
|
783
|
if ($globalDBdriver == 'mysql') { |
784
|
|
- 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"; |
785
|
|
- else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
784
|
+ 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"; |
|
785
|
+ 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"; |
786
|
786
|
} else { |
787
|
|
- 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"; |
788
|
|
- else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
787
|
+ 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"; |
|
788
|
+ 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"; |
789
|
789
|
} |
790
|
790
|
$query_data = array(':filter_name' => $filter_name); |
791
|
791
|
} else { |
|
@@ -796,23 +796,23 @@ discard block |
|
|
block discarded – undo |
796
|
796
|
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"; |
797
|
797
|
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"; |
798
|
798
|
} |
799
|
|
- $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
799
|
+ $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
800
|
800
|
} |
801
|
801
|
try { |
802
|
802
|
$sth = $this->db->prepare($query); |
803
|
803
|
$sth->execute($query_data); |
804
|
|
- } catch(PDOException $e) { |
|
804
|
+ } catch (PDOException $e) { |
805
|
805
|
echo "error : ".$e->getMessage(); |
806
|
806
|
} |
807
|
807
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
808
|
808
|
if (empty($all)) { |
809
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
810
|
|
- $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
809
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
810
|
+ $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
811
|
811
|
} else { |
812
|
812
|
$filters = array('airlines' => array($stats_airline)); |
813
|
813
|
} |
814
|
814
|
if ($filter_name != '') { |
815
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
815
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
816
|
816
|
} |
817
|
817
|
$Spotter = new Spotter($this->db); |
818
|
818
|
$all = $Spotter->countAllMonthsLastYear($filters); |
|
@@ -820,57 +820,57 @@ discard block |
|
|
block discarded – undo |
820
|
820
|
return $all; |
821
|
821
|
} |
822
|
822
|
|
823
|
|
- public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
|
823
|
+ public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') { |
824
|
824
|
global $globalStatsFilters; |
825
|
825
|
if ($filter_name == '') $filter_name = $this->filter_name; |
826
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
826
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
827
|
827
|
$Spotter = new Spotter($this->db); |
828
|
|
- $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
828
|
+ $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
829
|
829
|
$alliance_airlines = array(); |
830
|
830
|
foreach ($airlines as $airline) { |
831
|
|
- $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
831
|
+ $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
832
|
832
|
} |
833
|
|
- $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
833
|
+ $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
834
|
834
|
$query_data = array(':filter_name' => $filter_name); |
835
|
835
|
} else { |
836
|
836
|
$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
837
|
|
- $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
837
|
+ $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
838
|
838
|
} |
839
|
839
|
try { |
840
|
840
|
$sth = $this->db->prepare($query); |
841
|
841
|
$sth->execute($query_data); |
842
|
|
- } catch(PDOException $e) { |
|
842
|
+ } catch (PDOException $e) { |
843
|
843
|
echo "error : ".$e->getMessage(); |
844
|
844
|
} |
845
|
845
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
846
|
846
|
if (empty($all)) { |
847
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
848
|
|
- $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
847
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
848
|
+ $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
849
|
849
|
} else { |
850
|
850
|
$filters = array('airlines' => array($stats_airline)); |
851
|
851
|
} |
852
|
852
|
if ($filter_name != '') { |
853
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
853
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
854
|
854
|
} |
855
|
855
|
$Spotter = new Spotter($this->db); |
856
|
856
|
$all = $Spotter->countAllDatesLastMonth($filters); |
857
|
857
|
} |
858
|
858
|
return $all; |
859
|
859
|
} |
860
|
|
- public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
|
860
|
+ public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') { |
861
|
861
|
global $globalDBdriver, $globalStatsFilters; |
862
|
862
|
if ($filter_name == '') $filter_name = $this->filter_name; |
863
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
863
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
864
|
864
|
$Spotter = new Spotter($this->db); |
865
|
|
- $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
865
|
+ $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
866
|
866
|
$alliance_airlines = array(); |
867
|
867
|
foreach ($airlines as $airline) { |
868
|
|
- $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
868
|
+ $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
869
|
869
|
} |
870
|
870
|
if ($globalDBdriver == 'mysql') { |
871
|
|
- $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
871
|
+ $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
872
|
872
|
} else { |
873
|
|
- $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
873
|
+ $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
874
|
874
|
} |
875
|
875
|
$query_data = array(':filter_name' => $filter_name); |
876
|
876
|
} else { |
|
@@ -879,60 +879,60 @@ discard block |
|
|
block discarded – undo |
879
|
879
|
} else { |
880
|
880
|
$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
881
|
881
|
} |
882
|
|
- $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
882
|
+ $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
883
|
883
|
} |
884
|
884
|
try { |
885
|
885
|
$sth = $this->db->prepare($query); |
886
|
886
|
$sth->execute($query_data); |
887
|
|
- } catch(PDOException $e) { |
|
887
|
+ } catch (PDOException $e) { |
888
|
888
|
echo "error : ".$e->getMessage(); |
889
|
889
|
} |
890
|
890
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
891
|
891
|
if (empty($all)) { |
892
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
893
|
|
- $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
892
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
893
|
+ $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
894
|
894
|
} else { |
895
|
895
|
$filters = array('airlines' => array($stats_airline)); |
896
|
896
|
} |
897
|
897
|
if ($filter_name != '') { |
898
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
898
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
899
|
899
|
} |
900
|
900
|
$Spotter = new Spotter($this->db); |
901
|
901
|
$all = $Spotter->countAllDatesLast7Days($filters); |
902
|
902
|
} |
903
|
903
|
return $all; |
904
|
904
|
} |
905
|
|
- public function countAllDates($stats_airline = '',$filter_name = '') { |
|
905
|
+ public function countAllDates($stats_airline = '', $filter_name = '') { |
906
|
906
|
global $globalStatsFilters; |
907
|
907
|
if ($filter_name == '') $filter_name = $this->filter_name; |
908
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
908
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
909
|
909
|
$Spotter = new Spotter($this->db); |
910
|
|
- $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
910
|
+ $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
911
|
911
|
$alliance_airlines = array(); |
912
|
912
|
foreach ($airlines as $airline) { |
913
|
|
- $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
913
|
+ $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
914
|
914
|
} |
915
|
|
- $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date ORDER BY date_count DESC"; |
|
915
|
+ $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date ORDER BY date_count DESC"; |
916
|
916
|
$query_data = array(':filter_name' => $filter_name); |
917
|
917
|
} else { |
918
|
918
|
$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date_count DESC"; |
919
|
|
- $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
919
|
+ $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
920
|
920
|
} |
921
|
921
|
try { |
922
|
922
|
$sth = $this->db->prepare($query); |
923
|
923
|
$sth->execute($query_data); |
924
|
|
- } catch(PDOException $e) { |
|
924
|
+ } catch (PDOException $e) { |
925
|
925
|
echo "error : ".$e->getMessage(); |
926
|
926
|
} |
927
|
927
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
928
|
928
|
if (empty($all)) { |
929
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
930
|
|
- $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
929
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
930
|
+ $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
931
|
931
|
} else { |
932
|
932
|
$filters = array('airlines' => array($stats_airline)); |
933
|
933
|
} |
934
|
934
|
if ($filter_name != '') { |
935
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
935
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
936
|
936
|
} |
937
|
937
|
$Spotter = new Spotter($this->db); |
938
|
938
|
$all = $Spotter->countAllDates($filters); |
|
@@ -947,34 +947,34 @@ discard block |
|
|
block discarded – undo |
947
|
947
|
try { |
948
|
948
|
$sth = $this->db->prepare($query); |
949
|
949
|
$sth->execute($query_data); |
950
|
|
- } catch(PDOException $e) { |
|
950
|
+ } catch (PDOException $e) { |
951
|
951
|
echo "error : ".$e->getMessage(); |
952
|
952
|
} |
953
|
953
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
954
|
954
|
if (empty($all)) { |
955
|
955
|
$filters = array(); |
956
|
956
|
if ($filter_name != '') { |
957
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
957
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
958
|
958
|
} |
959
|
959
|
$Spotter = new Spotter($this->db); |
960
|
960
|
$all = $Spotter->countAllDatesByAirlines($filters); |
961
|
961
|
} |
962
|
962
|
return $all; |
963
|
963
|
} |
964
|
|
- public function countAllMonths($stats_airline = '',$filter_name = '') { |
|
964
|
+ public function countAllMonths($stats_airline = '', $filter_name = '') { |
965
|
965
|
global $globalStatsFilters, $globalDBdriver; |
966
|
966
|
if ($filter_name == '') $filter_name = $this->filter_name; |
967
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
967
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
968
|
968
|
$Spotter = new Spotter($this->db); |
969
|
|
- $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
969
|
+ $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
970
|
970
|
$alliance_airlines = array(); |
971
|
971
|
foreach ($airlines as $airline) { |
972
|
|
- $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
972
|
+ $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
973
|
973
|
} |
974
|
974
|
if ($globalDBdriver == 'mysql') { |
975
|
|
- $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC"; |
|
975
|
+ $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC"; |
976
|
976
|
} else { |
977
|
|
- $query = "SELECT EXTRACT(YEAR FROM stats_date) AS year_name,EXTRACT(MONTH FROM stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC"; |
|
977
|
+ $query = "SELECT EXTRACT(YEAR FROM stats_date) AS year_name,EXTRACT(MONTH FROM stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC"; |
978
|
978
|
} |
979
|
979
|
$query_data = array(':filter_name' => $filter_name); |
980
|
980
|
} else { |
|
@@ -988,18 +988,18 @@ discard block |
|
|
block discarded – undo |
988
|
988
|
try { |
989
|
989
|
$sth = $this->db->prepare($query); |
990
|
990
|
$sth->execute($query_data); |
991
|
|
- } catch(PDOException $e) { |
|
991
|
+ } catch (PDOException $e) { |
992
|
992
|
echo "error : ".$e->getMessage(); |
993
|
993
|
} |
994
|
994
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
995
|
995
|
if (empty($all)) { |
996
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
997
|
|
- $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
996
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
997
|
+ $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
998
|
998
|
} else { |
999
|
999
|
$filters = array('airlines' => array($stats_airline)); |
1000
|
1000
|
} |
1001
|
1001
|
if ($filter_name != '') { |
1002
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1002
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
1003
|
1003
|
} |
1004
|
1004
|
$Spotter = new Spotter($this->db); |
1005
|
1005
|
$all = $Spotter->countAllMonths($filters); |
|
@@ -1016,7 +1016,7 @@ discard block |
|
|
block discarded – undo |
1016
|
1016
|
try { |
1017
|
1017
|
$sth = $this->db->prepare($query); |
1018
|
1018
|
$sth->execute(); |
1019
|
|
- } catch(PDOException $e) { |
|
1019
|
+ } catch (PDOException $e) { |
1020
|
1020
|
echo "error : ".$e->getMessage(); |
1021
|
1021
|
} |
1022
|
1022
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -1036,7 +1036,7 @@ discard block |
|
|
block discarded – undo |
1036
|
1036
|
try { |
1037
|
1037
|
$sth = $this->db->prepare($query); |
1038
|
1038
|
$sth->execute(); |
1039
|
|
- } catch(PDOException $e) { |
|
1039
|
+ } catch (PDOException $e) { |
1040
|
1040
|
echo "error : ".$e->getMessage(); |
1041
|
1041
|
} |
1042
|
1042
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -1053,32 +1053,32 @@ discard block |
|
|
block discarded – undo |
1053
|
1053
|
try { |
1054
|
1054
|
$sth = $this->db->prepare($query); |
1055
|
1055
|
$sth->execute(array(':filter_name' => $filter_name)); |
1056
|
|
- } catch(PDOException $e) { |
|
1056
|
+ } catch (PDOException $e) { |
1057
|
1057
|
echo "error : ".$e->getMessage(); |
1058
|
1058
|
} |
1059
|
1059
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1060
|
1060
|
if (empty($all)) { |
1061
|
1061
|
$filters = array(); |
1062
|
1062
|
if ($filter_name != '') { |
1063
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1063
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
1064
|
1064
|
} |
1065
|
1065
|
$Spotter = new Spotter($this->db); |
1066
|
1066
|
$all = $Spotter->countAllMilitaryMonths($filters); |
1067
|
1067
|
} |
1068
|
1068
|
return $all; |
1069
|
1069
|
} |
1070
|
|
- public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
|
1070
|
+ public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') { |
1071
|
1071
|
global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
1072
|
1072
|
if ($filter_name == '') $filter_name = $this->filter_name; |
1073
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1073
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
1074
|
1074
|
$Spotter = new Spotter($this->db); |
1075
|
|
- $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1075
|
+ $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
1076
|
1076
|
$alliance_airlines = array(); |
1077
|
1077
|
foreach ($airlines as $airline) { |
1078
|
|
- $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1078
|
+ $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
1079
|
1079
|
} |
1080
|
|
- if ($limit) $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
1081
|
|
- else $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1080
|
+ if ($limit) $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1081
|
+ else $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
1082
|
1082
|
$query_data = array(':filter_name' => $filter_name); |
1083
|
1083
|
} else { |
1084
|
1084
|
if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
@@ -1096,37 +1096,37 @@ discard block |
|
|
block discarded – undo |
1096
|
1096
|
try { |
1097
|
1097
|
$sth = $this->db->prepare($query); |
1098
|
1098
|
$sth->execute($query_data); |
1099
|
|
- } catch(PDOException $e) { |
|
1099
|
+ } catch (PDOException $e) { |
1100
|
1100
|
echo "error : ".$e->getMessage(); |
1101
|
1101
|
} |
1102
|
1102
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1103
|
1103
|
if (empty($all)) { |
1104
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
1105
|
|
- $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1104
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1105
|
+ $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
1106
|
1106
|
} else { |
1107
|
1107
|
$filters = array('airlines' => array($stats_airline)); |
1108
|
1108
|
} |
1109
|
1109
|
if ($filter_name != '') { |
1110
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1110
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
1111
|
1111
|
} |
1112
|
1112
|
$Spotter = new Spotter($this->db); |
1113
|
|
- $all = $Spotter->countAllHours($orderby,$filters); |
|
1113
|
+ $all = $Spotter->countAllHours($orderby, $filters); |
1114
|
1114
|
} |
1115
|
1115
|
return $all; |
1116
|
1116
|
} |
1117
|
|
- public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
|
1117
|
+ public function countOverallFlights($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
1118
|
1118
|
global $globalStatsFilters; |
1119
|
1119
|
if ($filter_name == '') $filter_name = $this->filter_name; |
1120
|
1120
|
if ($year == '') $year = date('Y'); |
1121
|
|
- $all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1121
|
+ $all = $this->getSumStats('flights_bymonth', $year, $stats_airline, $filter_name, $month); |
1122
|
1122
|
if (empty($all)) { |
1123
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
1124
|
|
- $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
1123
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1124
|
+ $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
1125
|
1125
|
} else { |
1126
|
|
- $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1126
|
+ $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
1127
|
1127
|
} |
1128
|
1128
|
if ($filter_name != '') { |
1129
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1129
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
1130
|
1130
|
} |
1131
|
1131
|
$Spotter = new Spotter($this->db); |
1132
|
1132
|
//$all = $Spotter->countOverallFlights($filters,$year,$month); |
|
@@ -1134,16 +1134,16 @@ discard block |
|
|
block discarded – undo |
1134
|
1134
|
} |
1135
|
1135
|
return $all; |
1136
|
1136
|
} |
1137
|
|
- public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') { |
|
1137
|
+ public function countOverallMilitaryFlights($filter_name = '', $year = '', $month = '') { |
1138
|
1138
|
global $globalStatsFilters; |
1139
|
1139
|
if ($filter_name == '') $filter_name = $this->filter_name; |
1140
|
1140
|
if ($year == '') $year = date('Y'); |
1141
|
|
- $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
|
1141
|
+ $all = $this->getSumStats('military_flights_bymonth', $year, '', $filter_name, $month); |
1142
|
1142
|
if (empty($all)) { |
1143
|
1143
|
$filters = array(); |
1144
|
|
- $filters = array('year' => $year,'month' => $month); |
|
1144
|
+ $filters = array('year' => $year, 'month' => $month); |
1145
|
1145
|
if ($filter_name != '') { |
1146
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1146
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
1147
|
1147
|
} |
1148
|
1148
|
$Spotter = new Spotter($this->db); |
1149
|
1149
|
//$all = $Spotter->countOverallMilitaryFlights($filters,$year,$month); |
|
@@ -1151,19 +1151,19 @@ discard block |
|
|
block discarded – undo |
1151
|
1151
|
} |
1152
|
1152
|
return $all; |
1153
|
1153
|
} |
1154
|
|
- public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') { |
|
1154
|
+ public function countOverallArrival($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
1155
|
1155
|
global $globalStatsFilters; |
1156
|
1156
|
if ($filter_name == '') $filter_name = $this->filter_name; |
1157
|
1157
|
if ($year == '') $year = date('Y'); |
1158
|
|
- $all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1158
|
+ $all = $this->getSumStats('realarrivals_bymonth', $year, $stats_airline, $filter_name, $month); |
1159
|
1159
|
if (empty($all)) { |
1160
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
1161
|
|
- $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
1160
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1161
|
+ $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
1162
|
1162
|
} else { |
1163
|
|
- $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1163
|
+ $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
1164
|
1164
|
} |
1165
|
1165
|
if ($filter_name != '') { |
1166
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1166
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
1167
|
1167
|
} |
1168
|
1168
|
$Spotter = new Spotter($this->db); |
1169
|
1169
|
//$all = $Spotter->countOverallArrival($filters,$year,$month); |
|
@@ -1171,48 +1171,48 @@ discard block |
|
|
block discarded – undo |
1171
|
1171
|
} |
1172
|
1172
|
return $all; |
1173
|
1173
|
} |
1174
|
|
- public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
|
1174
|
+ public function countOverallAircrafts($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
1175
|
1175
|
global $globalStatsFilters; |
1176
|
1176
|
if ($filter_name == '') $filter_name = $this->filter_name; |
1177
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1177
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
1178
|
1178
|
$Spotter = new Spotter($this->db); |
1179
|
|
- $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1179
|
+ $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
1180
|
1180
|
if ($year == '' && $month == '') { |
1181
|
1181
|
$alliance_airlines = array(); |
1182
|
1182
|
foreach ($airlines as $airline) { |
1183
|
|
- $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1183
|
+ $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
1184
|
1184
|
} |
1185
|
|
- $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1185
|
+ $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
1186
|
1186
|
try { |
1187
|
1187
|
$sth = $this->db->prepare($query); |
1188
|
1188
|
$sth->execute(array(':filter_name' => $filter_name)); |
1189
|
|
- } catch(PDOException $e) { |
|
1189
|
+ } catch (PDOException $e) { |
1190
|
1190
|
echo "error : ".$e->getMessage(); |
1191
|
1191
|
} |
1192
|
1192
|
$result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1193
|
1193
|
$all = $result[0]['nb']; |
1194
|
|
- } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1194
|
+ } else $all = $this->getSumStats('aircrafts_bymonth', $year, $stats_airline, $filter_name, $month); |
1195
|
1195
|
} else { |
1196
|
1196
|
if ($year == '' && $month == '') { |
1197
|
1197
|
$query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
1198
|
1198
|
try { |
1199
|
1199
|
$sth = $this->db->prepare($query); |
1200
|
|
- $sth->execute(array(':filter_name' => $filter_name,':stats_airline' => $stats_airline)); |
1201
|
|
- } catch(PDOException $e) { |
|
1200
|
+ $sth->execute(array(':filter_name' => $filter_name, ':stats_airline' => $stats_airline)); |
|
1201
|
+ } catch (PDOException $e) { |
1202
|
1202
|
echo "error : ".$e->getMessage(); |
1203
|
1203
|
} |
1204
|
1204
|
$result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1205
|
1205
|
$all = $result[0]['nb']; |
1206
|
|
- } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1206
|
+ } else $all = $this->getSumStats('aircrafts_bymonth', $year, $stats_airline, $filter_name, $month); |
1207
|
1207
|
} |
1208
|
1208
|
if (empty($all)) { |
1209
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
1210
|
|
- $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
1209
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1210
|
+ $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
1211
|
1211
|
} else { |
1212
|
|
- $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1212
|
+ $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
1213
|
1213
|
} |
1214
|
1214
|
if ($filter_name != '') { |
1215
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1215
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
1216
|
1216
|
} |
1217
|
1217
|
$Spotter = new Spotter($this->db); |
1218
|
1218
|
//$all = $Spotter->countOverallAircrafts($filters,$year,$month); |
|
@@ -1220,7 +1220,7 @@ discard block |
|
|
block discarded – undo |
1220
|
1220
|
} |
1221
|
1221
|
return $all; |
1222
|
1222
|
} |
1223
|
|
- public function countOverallAirlines($filter_name = '',$year = '',$month = '') { |
|
1223
|
+ public function countOverallAirlines($filter_name = '', $year = '', $month = '') { |
1224
|
1224
|
global $globalStatsFilters; |
1225
|
1225
|
if ($filter_name == '') $filter_name = $this->filter_name; |
1226
|
1226
|
if ($year == '' && $month == '') { |
|
@@ -1228,17 +1228,17 @@ discard block |
|
|
block discarded – undo |
1228
|
1228
|
try { |
1229
|
1229
|
$sth = $this->db->prepare($query); |
1230
|
1230
|
$sth->execute(array(':filter_name' => $filter_name)); |
1231
|
|
- } catch(PDOException $e) { |
|
1231
|
+ } catch (PDOException $e) { |
1232
|
1232
|
echo "error : ".$e->getMessage(); |
1233
|
1233
|
} |
1234
|
1234
|
$result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1235
|
1235
|
$all = $result[0]['nb_airline']; |
1236
|
|
- } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
1236
|
+ } else $all = $this->getSumStats('airlines_bymonth', $year, '', $filter_name, $month); |
1237
|
1237
|
if (empty($all)) { |
1238
|
1238
|
$filters = array(); |
1239
|
|
- $filters = array('year' => $year,'month' => $month); |
|
1239
|
+ $filters = array('year' => $year, 'month' => $month); |
1240
|
1240
|
if ($filter_name != '') { |
1241
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1241
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
1242
|
1242
|
} |
1243
|
1243
|
$Spotter = new Spotter($this->db); |
1244
|
1244
|
//$all = $Spotter->countOverallAirlines($filters,$year,$month); |
|
@@ -1246,29 +1246,29 @@ discard block |
|
|
block discarded – undo |
1246
|
1246
|
} |
1247
|
1247
|
return $all; |
1248
|
1248
|
} |
1249
|
|
- public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
|
1249
|
+ public function countOverallOwners($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
1250
|
1250
|
global $globalStatsFilters; |
1251
|
1251
|
if ($filter_name == '') $filter_name = $this->filter_name; |
1252
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1252
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
1253
|
1253
|
$Spotter = new Spotter($this->db); |
1254
|
|
- $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1254
|
+ $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
1255
|
1255
|
if ($year == '' && $month == '') { |
1256
|
1256
|
$alliance_airlines = array(); |
1257
|
1257
|
foreach ($airlines as $airline) { |
1258
|
|
- $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1258
|
+ $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
1259
|
1259
|
} |
1260
|
|
- $query = "SELECT count(*) as nb FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1260
|
+ $query = "SELECT count(*) as nb FROM stats_owner WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
1261
|
1261
|
$query_values = array(':filter_name' => $filter_name); |
1262
|
1262
|
try { |
1263
|
1263
|
$sth = $this->db->prepare($query); |
1264
|
1264
|
$sth->execute($query_values); |
1265
|
|
- } catch(PDOException $e) { |
|
1265
|
+ } catch (PDOException $e) { |
1266
|
1266
|
echo "error : ".$e->getMessage(); |
1267
|
1267
|
} |
1268
|
1268
|
$result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1269
|
1269
|
$all = $result[0]['nb']; |
1270
|
1270
|
} else { |
1271
|
|
- $all = $this->getSumStats('owners_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1271
|
+ $all = $this->getSumStats('owners_bymonth', $year, $stats_airline, $filter_name, $month); |
1272
|
1272
|
} |
1273
|
1273
|
} else { |
1274
|
1274
|
if ($year == '' && $month == '') { |
|
@@ -1277,23 +1277,23 @@ discard block |
|
|
block discarded – undo |
1277
|
1277
|
try { |
1278
|
1278
|
$sth = $this->db->prepare($query); |
1279
|
1279
|
$sth->execute($query_values); |
1280
|
|
- } catch(PDOException $e) { |
|
1280
|
+ } catch (PDOException $e) { |
1281
|
1281
|
echo "error : ".$e->getMessage(); |
1282
|
1282
|
} |
1283
|
1283
|
$result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1284
|
1284
|
$all = $result[0]['nb']; |
1285
|
1285
|
} else { |
1286
|
|
- $all = $this->getSumStats('owners_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1286
|
+ $all = $this->getSumStats('owners_bymonth', $year, $stats_airline, $filter_name, $month); |
1287
|
1287
|
} |
1288
|
1288
|
} |
1289
|
1289
|
if (empty($all)) { |
1290
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
1291
|
|
- $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
1290
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1291
|
+ $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
1292
|
1292
|
} else { |
1293
|
|
- $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1293
|
+ $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
1294
|
1294
|
} |
1295
|
1295
|
if ($filter_name != '') { |
1296
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1296
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
1297
|
1297
|
} |
1298
|
1298
|
$Spotter = new Spotter($this->db); |
1299
|
1299
|
//$all = $Spotter->countOverallOwners($filters,$year,$month); |
|
@@ -1301,7 +1301,7 @@ discard block |
|
|
block discarded – undo |
1301
|
1301
|
} |
1302
|
1302
|
return $all; |
1303
|
1303
|
} |
1304
|
|
- public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
1304
|
+ public function countOverallPilots($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
1305
|
1305
|
global $globalStatsFilters; |
1306
|
1306
|
if ($filter_name == '') $filter_name = $this->filter_name; |
1307
|
1307
|
//if ($year == '') $year = date('Y'); |
|
@@ -1311,18 +1311,18 @@ discard block |
|
|
block discarded – undo |
1311
|
1311
|
try { |
1312
|
1312
|
$sth = $this->db->prepare($query); |
1313
|
1313
|
$sth->execute($query_values); |
1314
|
|
- } catch(PDOException $e) { |
|
1314
|
+ } catch (PDOException $e) { |
1315
|
1315
|
echo "error : ".$e->getMessage(); |
1316
|
1316
|
} |
1317
|
1317
|
$result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1318
|
1318
|
$all = $result[0]['nb']; |
1319
|
1319
|
} else { |
1320
|
|
- $all = $this->getSumStats('pilots_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1320
|
+ $all = $this->getSumStats('pilots_bymonth', $year, $stats_airline, $filter_name, $month); |
1321
|
1321
|
} |
1322
|
1322
|
if (empty($all)) { |
1323
|
|
- $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1323
|
+ $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
1324
|
1324
|
if ($filter_name != '') { |
1325
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1325
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
1326
|
1326
|
} |
1327
|
1327
|
$Spotter = new Spotter($this->db); |
1328
|
1328
|
//$all = $Spotter->countOverallPilots($filters,$year,$month); |
|
@@ -1331,104 +1331,104 @@ discard block |
|
|
block discarded – undo |
1331
|
1331
|
return $all; |
1332
|
1332
|
} |
1333
|
1333
|
|
1334
|
|
- public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
|
1334
|
+ public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') { |
1335
|
1335
|
if ($filter_name == '') $filter_name = $this->filter_name; |
1336
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1336
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
1337
|
1337
|
$Spotter = new Spotter($this->db); |
1338
|
|
- $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1338
|
+ $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
1339
|
1339
|
$alliance_airlines = array(); |
1340
|
1340
|
foreach ($airlines as $airline) { |
1341
|
|
- $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1341
|
+ $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
1342
|
1342
|
} |
1343
|
|
- $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY date"; |
1344
|
|
- $query_values = array(':airport_icao' => $airport_icao,':filter_name' => $filter_name); |
|
1343
|
+ $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY date"; |
|
1344
|
+ $query_values = array(':airport_icao' => $airport_icao, ':filter_name' => $filter_name); |
1345
|
1345
|
} else { |
1346
|
1346
|
$query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date"; |
1347
|
|
- $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1347
|
+ $query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
1348
|
1348
|
} |
1349
|
1349
|
try { |
1350
|
1350
|
$sth = $this->db->prepare($query); |
1351
|
1351
|
$sth->execute($query_values); |
1352
|
|
- } catch(PDOException $e) { |
|
1352
|
+ } catch (PDOException $e) { |
1353
|
1353
|
echo "error : ".$e->getMessage(); |
1354
|
1354
|
} |
1355
|
1355
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1356
|
1356
|
return $all; |
1357
|
1357
|
} |
1358
|
|
- public function getStats($type,$stats_airline = '', $filter_name = '') { |
|
1358
|
+ public function getStats($type, $stats_airline = '', $filter_name = '') { |
1359
|
1359
|
if ($filter_name == '') $filter_name = $this->filter_name; |
1360
|
1360
|
$query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
1361
|
|
- $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1361
|
+ $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
1362
|
1362
|
try { |
1363
|
1363
|
$sth = $this->db->prepare($query); |
1364
|
1364
|
$sth->execute($query_values); |
1365
|
|
- } catch(PDOException $e) { |
|
1365
|
+ } catch (PDOException $e) { |
1366
|
1366
|
echo "error : ".$e->getMessage(); |
1367
|
1367
|
} |
1368
|
1368
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1369
|
1369
|
return $all; |
1370
|
1370
|
} |
1371
|
|
- public function deleteStatsByType($type,$stats_airline = '', $filter_name = '') { |
|
1371
|
+ public function deleteStatsByType($type, $stats_airline = '', $filter_name = '') { |
1372
|
1372
|
if ($filter_name == '') $filter_name = $this->filter_name; |
1373
|
1373
|
$query = "DELETE FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
1374
|
|
- $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1374
|
+ $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
1375
|
1375
|
try { |
1376
|
1376
|
$sth = $this->db->prepare($query); |
1377
|
1377
|
$sth->execute($query_values); |
1378
|
|
- } catch(PDOException $e) { |
|
1378
|
+ } catch (PDOException $e) { |
1379
|
1379
|
echo "error : ".$e->getMessage(); |
1380
|
1380
|
} |
1381
|
1381
|
} |
1382
|
|
- public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
|
1382
|
+ public function getSumStats($type, $year, $stats_airline = '', $filter_name = '', $month = '') { |
1383
|
1383
|
if ($filter_name == '') $filter_name = $this->filter_name; |
1384
|
1384
|
global $globalArchiveMonths, $globalDBdriver; |
1385
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1385
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
1386
|
1386
|
$Spotter = new Spotter($this->db); |
1387
|
|
- $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1387
|
+ $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
1388
|
1388
|
$alliance_airlines = array(); |
1389
|
1389
|
foreach ($airlines as $airline) { |
1390
|
|
- $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1390
|
+ $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
1391
|
1391
|
} |
1392
|
1392
|
if ($globalDBdriver == 'mysql') { |
1393
|
1393
|
if ($month == '') { |
1394
|
|
- $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1394
|
+ $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
1395
|
1395
|
$query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name); |
1396
|
1396
|
} else { |
1397
|
|
- $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
1398
|
|
- $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name,':month' => $month); |
|
1397
|
+ $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1398
|
+ $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name, ':month' => $month); |
1399
|
1399
|
} |
1400
|
1400
|
} else { |
1401
|
1401
|
if ($month == '') { |
1402
|
|
- $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1402
|
+ $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
1403
|
1403
|
$query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name); |
1404
|
1404
|
} else { |
1405
|
|
- $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
1406
|
|
- $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name,':month' => $month); |
|
1405
|
+ $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1406
|
+ $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name, ':month' => $month); |
1407
|
1407
|
} |
1408
|
1408
|
} |
1409
|
1409
|
} else { |
1410
|
1410
|
if ($globalDBdriver == 'mysql') { |
1411
|
1411
|
if ($month == '') { |
1412
|
1412
|
$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
1413
|
|
- $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1413
|
+ $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
1414
|
1414
|
} else { |
1415
|
1415
|
$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
1416
|
|
- $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month); |
|
1416
|
+ $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month); |
1417
|
1417
|
} |
1418
|
1418
|
} else { |
1419
|
1419
|
if ($month == '') { |
1420
|
1420
|
$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
1421
|
|
- $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1421
|
+ $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
1422
|
1422
|
} else { |
1423
|
1423
|
$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
1424
|
|
- $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month); |
|
1424
|
+ $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month); |
1425
|
1425
|
} |
1426
|
1426
|
} |
1427
|
1427
|
} |
1428
|
1428
|
try { |
1429
|
1429
|
$sth = $this->db->prepare($query); |
1430
|
1430
|
$sth->execute($query_values); |
1431
|
|
- } catch(PDOException $e) { |
|
1431
|
+ } catch (PDOException $e) { |
1432
|
1432
|
echo "error : ".$e->getMessage(); |
1433
|
1433
|
} |
1434
|
1434
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -1437,17 +1437,17 @@ discard block |
|
|
block discarded – undo |
1437
|
1437
|
public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
1438
|
1438
|
global $globalArchiveMonths, $globalDBdriver; |
1439
|
1439
|
if ($filter_name == '') $filter_name = $this->filter_name; |
1440
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1440
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
1441
|
1441
|
$Spotter = new Spotter($this->db); |
1442
|
|
- $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1442
|
+ $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
1443
|
1443
|
$alliance_airlines = array(); |
1444
|
1444
|
foreach ($airlines as $airline) { |
1445
|
|
- $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1445
|
+ $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
1446
|
1446
|
} |
1447
|
1447
|
if ($globalDBdriver == 'mysql') { |
1448
|
|
- $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1448
|
+ $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
1449
|
1449
|
} else { |
1450
|
|
- $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveMonths." MONTHS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1450
|
+ $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveMonths." MONTHS' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
1451
|
1451
|
} |
1452
|
1452
|
$query_values = array(':type' => $type, ':filter_name' => $filter_name); |
1453
|
1453
|
} else { |
|
@@ -1461,7 +1461,7 @@ discard block |
|
|
block discarded – undo |
1461
|
1461
|
try { |
1462
|
1462
|
$sth = $this->db->prepare($query); |
1463
|
1463
|
$sth->execute($query_values); |
1464
|
|
- } catch(PDOException $e) { |
|
1464
|
+ } catch (PDOException $e) { |
1465
|
1465
|
echo "error : ".$e->getMessage(); |
1466
|
1466
|
} |
1467
|
1467
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -1470,17 +1470,17 @@ discard block |
|
|
block discarded – undo |
1470
|
1470
|
public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
1471
|
1471
|
global $globalArchiveMonths, $globalDBdriver; |
1472
|
1472
|
if ($filter_name == '') $filter_name = $this->filter_name; |
1473
|
|
- if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1473
|
+ if (strpos($stats_airline, 'alliance_') !== FALSE) { |
1474
|
1474
|
$Spotter = new Spotter($this->db); |
1475
|
|
- $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1475
|
+ $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
1476
|
1476
|
$alliance_airlines = array(); |
1477
|
1477
|
foreach ($airlines as $airline) { |
1478
|
|
- $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1478
|
+ $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
1479
|
1479
|
} |
1480
|
1480
|
if ($globalDBdriver == 'mysql') { |
1481
|
|
- $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1481
|
+ $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
1482
|
1482
|
} else { |
1483
|
|
- $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1483
|
+ $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
1484
|
1484
|
} |
1485
|
1485
|
} else { |
1486
|
1486
|
if ($globalDBdriver == 'mysql') { |
|
@@ -1492,7 +1492,7 @@ discard block |
|
|
block discarded – undo |
1492
|
1492
|
try { |
1493
|
1493
|
$sth = $this->db->prepare($query); |
1494
|
1494
|
$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
1495
|
|
- } catch(PDOException $e) { |
|
1495
|
+ } catch (PDOException $e) { |
1496
|
1496
|
echo "error : ".$e->getMessage(); |
1497
|
1497
|
} |
1498
|
1498
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -1509,7 +1509,7 @@ discard block |
|
|
block discarded – undo |
1509
|
1509
|
try { |
1510
|
1510
|
$sth = $this->db->prepare($query); |
1511
|
1511
|
$sth->execute(array(':filter_name' => $filter_name)); |
1512
|
|
- } catch(PDOException $e) { |
|
1512
|
+ } catch (PDOException $e) { |
1513
|
1513
|
echo "error : ".$e->getMessage(); |
1514
|
1514
|
} |
1515
|
1515
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -1526,20 +1526,20 @@ discard block |
|
|
block discarded – undo |
1526
|
1526
|
try { |
1527
|
1527
|
$sth = $this->db->prepare($query); |
1528
|
1528
|
$sth->execute(array(':filter_name' => $filter_name)); |
1529
|
|
- } catch(PDOException $e) { |
|
1529
|
+ } catch (PDOException $e) { |
1530
|
1530
|
echo "error : ".$e->getMessage(); |
1531
|
1531
|
} |
1532
|
1532
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1533
|
1533
|
return $all[0]['total']; |
1534
|
1534
|
} |
1535
|
|
- public function getStatsOwner($owner_name,$filter_name = '') { |
|
1535
|
+ public function getStatsOwner($owner_name, $filter_name = '') { |
1536
|
1536
|
global $globalArchiveMonths, $globalDBdriver; |
1537
|
1537
|
if ($filter_name == '') $filter_name = $this->filter_name; |
1538
|
1538
|
$query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name"; |
1539
|
1539
|
try { |
1540
|
1540
|
$sth = $this->db->prepare($query); |
1541
|
|
- $sth->execute(array(':filter_name' => $filter_name,':owner_name' => $owner_name)); |
1542
|
|
- } catch(PDOException $e) { |
|
1541
|
+ $sth->execute(array(':filter_name' => $filter_name, ':owner_name' => $owner_name)); |
|
1542
|
+ } catch (PDOException $e) { |
1543
|
1543
|
echo "error : ".$e->getMessage(); |
1544
|
1544
|
} |
1545
|
1545
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -1557,20 +1557,20 @@ discard block |
|
|
block discarded – undo |
1557
|
1557
|
try { |
1558
|
1558
|
$sth = $this->db->prepare($query); |
1559
|
1559
|
$sth->execute(array(':filter_name' => $filter_name)); |
1560
|
|
- } catch(PDOException $e) { |
|
1560
|
+ } catch (PDOException $e) { |
1561
|
1561
|
echo "error : ".$e->getMessage(); |
1562
|
1562
|
} |
1563
|
1563
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1564
|
1564
|
return $all[0]['total']; |
1565
|
1565
|
} |
1566
|
|
- public function getStatsPilot($pilot,$filter_name = '') { |
|
1566
|
+ public function getStatsPilot($pilot, $filter_name = '') { |
1567
|
1567
|
global $globalArchiveMonths, $globalDBdriver; |
1568
|
1568
|
if ($filter_name == '') $filter_name = $this->filter_name; |
1569
|
1569
|
$query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)"; |
1570
|
1570
|
try { |
1571
|
1571
|
$sth = $this->db->prepare($query); |
1572
|
|
- $sth->execute(array(':filter_name' => $filter_name,':pilot' => $pilot)); |
1573
|
|
- } catch(PDOException $e) { |
|
1572
|
+ $sth->execute(array(':filter_name' => $filter_name, ':pilot' => $pilot)); |
|
1573
|
+ } catch (PDOException $e) { |
1574
|
1574
|
echo "error : ".$e->getMessage(); |
1575
|
1575
|
} |
1576
|
1576
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -1578,7 +1578,7 @@ discard block |
|
|
block discarded – undo |
1578
|
1578
|
else return 0; |
1579
|
1579
|
} |
1580
|
1580
|
|
1581
|
|
- public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
1581
|
+ public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
1582
|
1582
|
global $globalDBdriver; |
1583
|
1583
|
if ($filter_name == '') $filter_name = $this->filter_name; |
1584
|
1584
|
if ($globalDBdriver == 'mysql') { |
|
@@ -1586,15 +1586,15 @@ discard block |
|
|
block discarded – undo |
1586
|
1586
|
} else { |
1587
|
1587
|
$query = "UPDATE stats SET cnt = :cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1588
|
1588
|
} |
1589
|
|
- $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1589
|
+ $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
1590
|
1590
|
try { |
1591
|
1591
|
$sth = $this->db->prepare($query); |
1592
|
1592
|
$sth->execute($query_values); |
1593
|
|
- } catch(PDOException $e) { |
|
1593
|
+ } catch (PDOException $e) { |
1594
|
1594
|
return "error : ".$e->getMessage(); |
1595
|
1595
|
} |
1596
|
1596
|
} |
1597
|
|
- public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
1597
|
+ public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
1598
|
1598
|
global $globalDBdriver; |
1599
|
1599
|
if ($filter_name == '') $filter_name = $this->filter_name; |
1600
|
1600
|
if ($globalDBdriver == 'mysql') { |
|
@@ -1603,11 +1603,11 @@ discard block |
|
|
block discarded – undo |
1603
|
1603
|
//$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
1604
|
1604
|
$query = "UPDATE stats SET cnt = cnt+:cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1605
|
1605
|
} |
1606
|
|
- $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1606
|
+ $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
1607
|
1607
|
try { |
1608
|
1608
|
$sth = $this->db->prepare($query); |
1609
|
1609
|
$sth->execute($query_values); |
1610
|
|
- } catch(PDOException $e) { |
|
1610
|
+ } catch (PDOException $e) { |
1611
|
1611
|
return "error : ".$e->getMessage(); |
1612
|
1612
|
} |
1613
|
1613
|
} |
|
@@ -1631,75 +1631,75 @@ discard block |
|
|
block discarded – undo |
1631
|
1631
|
} |
1632
|
1632
|
*/ |
1633
|
1633
|
|
1634
|
|
- public function getStatsSource($stats_type,$year = '',$month = '',$day = '') { |
|
1634
|
+ public function getStatsSource($stats_type, $year = '', $month = '', $day = '') { |
1635
|
1635
|
global $globalDBdriver; |
1636
|
1636
|
$query = "SELECT * FROM stats_source WHERE stats_type = :stats_type"; |
1637
|
1637
|
$query_values = array(); |
1638
|
1638
|
if ($globalDBdriver == 'mysql') { |
1639
|
1639
|
if ($year != '') { |
1640
|
1640
|
$query .= ' AND YEAR(stats_date) = :year'; |
1641
|
|
- $query_values = array_merge($query_values,array(':year' => $year)); |
|
1641
|
+ $query_values = array_merge($query_values, array(':year' => $year)); |
1642
|
1642
|
} |
1643
|
1643
|
if ($month != '') { |
1644
|
1644
|
$query .= ' AND MONTH(stats_date) = :month'; |
1645
|
|
- $query_values = array_merge($query_values,array(':month' => $month)); |
|
1645
|
+ $query_values = array_merge($query_values, array(':month' => $month)); |
1646
|
1646
|
} |
1647
|
1647
|
if ($day != '') { |
1648
|
1648
|
$query .= ' AND DAY(stats_date) = :day'; |
1649
|
|
- $query_values = array_merge($query_values,array(':day' => $day)); |
|
1649
|
+ $query_values = array_merge($query_values, array(':day' => $day)); |
1650
|
1650
|
} |
1651
|
1651
|
} else { |
1652
|
1652
|
if ($year != '') { |
1653
|
1653
|
$query .= ' AND EXTRACT(YEAR FROM stats_date) = :year'; |
1654
|
|
- $query_values = array_merge($query_values,array(':year' => $year)); |
|
1654
|
+ $query_values = array_merge($query_values, array(':year' => $year)); |
1655
|
1655
|
} |
1656
|
1656
|
if ($month != '') { |
1657
|
1657
|
$query .= ' AND EXTRACT(MONTH FROM stats_date) = :month'; |
1658
|
|
- $query_values = array_merge($query_values,array(':month' => $month)); |
|
1658
|
+ $query_values = array_merge($query_values, array(':month' => $month)); |
1659
|
1659
|
} |
1660
|
1660
|
if ($day != '') { |
1661
|
1661
|
$query .= ' AND EXTRACT(DAY FROM stats_date) = :day'; |
1662
|
|
- $query_values = array_merge($query_values,array(':day' => $day)); |
|
1662
|
+ $query_values = array_merge($query_values, array(':day' => $day)); |
1663
|
1663
|
} |
1664
|
1664
|
} |
1665
|
1665
|
$query .= " ORDER BY source_name"; |
1666
|
|
- $query_values = array_merge($query_values,array(':stats_type' => $stats_type)); |
|
1666
|
+ $query_values = array_merge($query_values, array(':stats_type' => $stats_type)); |
1667
|
1667
|
try { |
1668
|
1668
|
$sth = $this->db->prepare($query); |
1669
|
1669
|
$sth->execute($query_values); |
1670
|
|
- } catch(PDOException $e) { |
|
1670
|
+ } catch (PDOException $e) { |
1671
|
1671
|
echo "error : ".$e->getMessage(); |
1672
|
1672
|
} |
1673
|
1673
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1674
|
1674
|
return $all; |
1675
|
1675
|
} |
1676
|
1676
|
|
1677
|
|
- public function addStatSource($data,$source_name,$stats_type,$date) { |
|
1677
|
+ public function addStatSource($data, $source_name, $stats_type, $date) { |
1678
|
1678
|
global $globalDBdriver; |
1679
|
1679
|
if ($globalDBdriver == 'mysql') { |
1680
|
1680
|
$query = "INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) VALUES (:data,:source_name,:stats_type,:stats_date) ON DUPLICATE KEY UPDATE source_data = :data"; |
1681
|
1681
|
} else { |
1682
|
1682
|
$query = "UPDATE stats_source SET source_data = :data WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type; INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) SELECT :data,:source_name,:stats_type,:stats_date WHERE NOT EXISTS (SELECT 1 FROM stats_source WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type);"; |
1683
|
1683
|
} |
1684
|
|
- $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
1684
|
+ $query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type); |
1685
|
1685
|
try { |
1686
|
1686
|
$sth = $this->db->prepare($query); |
1687
|
1687
|
$sth->execute($query_values); |
1688
|
|
- } catch(PDOException $e) { |
|
1688
|
+ } catch (PDOException $e) { |
1689
|
1689
|
return "error : ".$e->getMessage(); |
1690
|
1690
|
} |
1691
|
1691
|
} |
1692
|
|
- public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
|
1692
|
+ public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') { |
1693
|
1693
|
$query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
1694
|
|
- $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1694
|
+ $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
1695
|
1695
|
try { |
1696
|
1696
|
$sth = $this->db->prepare($query); |
1697
|
1697
|
$sth->execute($query_values); |
1698
|
|
- } catch(PDOException $e) { |
|
1698
|
+ } catch (PDOException $e) { |
1699
|
1699
|
return "error : ".$e->getMessage(); |
1700
|
1700
|
} |
1701
|
1701
|
} |
1702
|
|
- public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '',$reset = false) { |
|
1702
|
+ public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '', $reset = false) { |
1703
|
1703
|
global $globalDBdriver; |
1704
|
1704
|
if ($globalDBdriver == 'mysql') { |
1705
|
1705
|
if ($reset) { |
|
@@ -1714,15 +1714,15 @@ discard block |
|
|
block discarded – undo |
1714
|
1714
|
$query = "UPDATE stats_registration SET cnt = cnt+:cnt WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:registration,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_registration WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1715
|
1715
|
} |
1716
|
1716
|
} |
1717
|
|
- $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1717
|
+ $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
1718
|
1718
|
try { |
1719
|
1719
|
$sth = $this->db->prepare($query); |
1720
|
1720
|
$sth->execute($query_values); |
1721
|
|
- } catch(PDOException $e) { |
|
1721
|
+ } catch (PDOException $e) { |
1722
|
1722
|
return "error : ".$e->getMessage(); |
1723
|
1723
|
} |
1724
|
1724
|
} |
1725
|
|
- public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '', $reset = false) { |
|
1725
|
+ public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '', $reset = false) { |
1726
|
1726
|
global $globalDBdriver; |
1727
|
1727
|
if ($globalDBdriver == 'mysql') { |
1728
|
1728
|
if ($reset) { |
|
@@ -1737,15 +1737,15 @@ discard block |
|
|
block discarded – undo |
1737
|
1737
|
$query = "UPDATE stats_callsign SET cnt = cnt+:cnt WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name; INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) SELECT :callsign_icao,:airline_icao,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_callsign WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name);"; |
1738
|
1738
|
} |
1739
|
1739
|
} |
1740
|
|
- $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1740
|
+ $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name); |
1741
|
1741
|
try { |
1742
|
1742
|
$sth = $this->db->prepare($query); |
1743
|
1743
|
$sth->execute($query_values); |
1744
|
|
- } catch(PDOException $e) { |
|
1744
|
+ } catch (PDOException $e) { |
1745
|
1745
|
return "error : ".$e->getMessage(); |
1746
|
1746
|
} |
1747
|
1747
|
} |
1748
|
|
- public function addStatCountry($iso2,$iso3,$name,$cnt,$airline_icao = '',$filter_name = '',$reset = false) { |
|
1748
|
+ public function addStatCountry($iso2, $iso3, $name, $cnt, $airline_icao = '', $filter_name = '', $reset = false) { |
1749
|
1749
|
global $globalDBdriver; |
1750
|
1750
|
if ($globalDBdriver == 'mysql') { |
1751
|
1751
|
if ($reset) { |
|
@@ -1760,15 +1760,15 @@ discard block |
|
|
block discarded – undo |
1760
|
1760
|
$query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name AND stats_airline = :airline; INSERT INTO stats_country (iso2,iso3,name,cnt,stats_airline,filter_name) SELECT :iso2,:iso3,:name,:cnt,:airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name AND stats_airline = :airline);"; |
1761
|
1761
|
} |
1762
|
1762
|
} |
1763
|
|
- $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name,':airline' => $airline_icao); |
|
1763
|
+ $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name, ':airline' => $airline_icao); |
1764
|
1764
|
try { |
1765
|
1765
|
$sth = $this->db->prepare($query); |
1766
|
1766
|
$sth->execute($query_values); |
1767
|
|
- } catch(PDOException $e) { |
|
1767
|
+ } catch (PDOException $e) { |
1768
|
1768
|
return "error : ".$e->getMessage(); |
1769
|
1769
|
} |
1770
|
1770
|
} |
1771
|
|
- public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
1771
|
+ public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
1772
|
1772
|
global $globalDBdriver; |
1773
|
1773
|
if ($globalDBdriver == 'mysql') { |
1774
|
1774
|
if ($reset) { |
|
@@ -1783,15 +1783,15 @@ discard block |
|
|
block discarded – undo |
1783
|
1783
|
$query = "UPDATE stats_aircraft SET cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, filter_name = :filter_name WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_aircraft WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1784
|
1784
|
} |
1785
|
1785
|
} |
1786
|
|
- $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1786
|
+ $query_values = array(':aircraft_icao' => $aircraft_icao, ':aircraft_name' => $aircraft_name, ':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
1787
|
1787
|
try { |
1788
|
1788
|
$sth = $this->db->prepare($query); |
1789
|
1789
|
$sth->execute($query_values); |
1790
|
|
- } catch(PDOException $e) { |
|
1790
|
+ } catch (PDOException $e) { |
1791
|
1791
|
return "error : ".$e->getMessage(); |
1792
|
1792
|
} |
1793
|
1793
|
} |
1794
|
|
- public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '', $reset = false) { |
|
1794
|
+ public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '', $reset = false) { |
1795
|
1795
|
global $globalDBdriver; |
1796
|
1796
|
if ($globalDBdriver == 'mysql') { |
1797
|
1797
|
if ($reset) { |
|
@@ -1806,15 +1806,15 @@ discard block |
|
|
block discarded – undo |
1806
|
1806
|
$query = "UPDATE stats_airline SET cnt = cnt+:cnt WHERE airline_icao = :airline_icao AND filter_name = :filter_name; INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) SELECT :airline_icao,:airline_name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airline WHERE airline_icao = :airline_icao AND filter_name = :filter_name);"; |
1807
|
1807
|
} |
1808
|
1808
|
} |
1809
|
|
- $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
1809
|
+ $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
1810
|
1810
|
try { |
1811
|
1811
|
$sth = $this->db->prepare($query); |
1812
|
1812
|
$sth->execute($query_values); |
1813
|
|
- } catch(PDOException $e) { |
|
1813
|
+ } catch (PDOException $e) { |
1814
|
1814
|
return "error : ".$e->getMessage(); |
1815
|
1815
|
} |
1816
|
1816
|
} |
1817
|
|
- public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '', $reset = false) { |
|
1817
|
+ public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '', $reset = false) { |
1818
|
1818
|
global $globalDBdriver; |
1819
|
1819
|
if ($globalDBdriver == 'mysql') { |
1820
|
1820
|
if ($reset) { |
|
@@ -1829,15 +1829,15 @@ discard block |
|
|
block discarded – undo |
1829
|
1829
|
$query = "UPDATE stats_owner SET cnt = cnt+:cnt WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) SELECT :owner_name,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_owner WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1830
|
1830
|
} |
1831
|
1831
|
} |
1832
|
|
- $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1832
|
+ $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
1833
|
1833
|
try { |
1834
|
1834
|
$sth = $this->db->prepare($query); |
1835
|
1835
|
$sth->execute($query_values); |
1836
|
|
- } catch(PDOException $e) { |
|
1836
|
+ } catch (PDOException $e) { |
1837
|
1837
|
return "error : ".$e->getMessage(); |
1838
|
1838
|
} |
1839
|
1839
|
} |
1840
|
|
- public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '',$reset = false) { |
|
1840
|
+ public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '', $format_source = '', $reset = false) { |
1841
|
1841
|
global $globalDBdriver; |
1842
|
1842
|
if ($globalDBdriver == 'mysql') { |
1843
|
1843
|
if ($reset) { |
|
@@ -1852,15 +1852,15 @@ discard block |
|
|
block discarded – undo |
1852
|
1852
|
$query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name,format_source) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name,:format_source WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source);"; |
1853
|
1853
|
} |
1854
|
1854
|
} |
1855
|
|
- $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name,':format_source' => $format_source); |
|
1855
|
+ $query_values = array(':pilot_id' => $pilot_id, ':cnt' => $cnt, ':pilot_name' => $pilot_name, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':format_source' => $format_source); |
1856
|
1856
|
try { |
1857
|
1857
|
$sth = $this->db->prepare($query); |
1858
|
1858
|
$sth->execute($query_values); |
1859
|
|
- } catch(PDOException $e) { |
|
1859
|
+ } catch (PDOException $e) { |
1860
|
1860
|
return "error : ".$e->getMessage(); |
1861
|
1861
|
} |
1862
|
1862
|
} |
1863
|
|
- public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '',$reset = false) { |
|
1863
|
+ public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '', $reset = false) { |
1864
|
1864
|
global $globalDBdriver; |
1865
|
1865
|
if ($airport_icao != '') { |
1866
|
1866
|
if ($globalDBdriver == 'mysql') { |
|
@@ -1876,16 +1876,16 @@ discard block |
|
|
block discarded – undo |
1876
|
1876
|
$query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; |
1877
|
1877
|
} |
1878
|
1878
|
} |
1879
|
|
- $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1879
|
+ $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
1880
|
1880
|
try { |
1881
|
1881
|
$sth = $this->db->prepare($query); |
1882
|
1882
|
$sth->execute($query_values); |
1883
|
|
- } catch(PDOException $e) { |
|
1883
|
+ } catch (PDOException $e) { |
1884
|
1884
|
return "error : ".$e->getMessage(); |
1885
|
1885
|
} |
1886
|
1886
|
} |
1887
|
1887
|
} |
1888
|
|
- public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
|
1888
|
+ public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') { |
1889
|
1889
|
global $globalDBdriver; |
1890
|
1890
|
if ($airport_icao != '') { |
1891
|
1891
|
if ($globalDBdriver == 'mysql') { |
|
@@ -1893,16 +1893,16 @@ discard block |
|
|
block discarded – undo |
1893
|
1893
|
} else { |
1894
|
1894
|
$query = "UPDATE stats_airport SET departure = :departure WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1895
|
1895
|
} |
1896
|
|
- $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1896
|
+ $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
1897
|
1897
|
try { |
1898
|
1898
|
$sth = $this->db->prepare($query); |
1899
|
1899
|
$sth->execute($query_values); |
1900
|
|
- } catch(PDOException $e) { |
|
1900
|
+ } catch (PDOException $e) { |
1901
|
1901
|
return "error : ".$e->getMessage(); |
1902
|
1902
|
} |
1903
|
1903
|
} |
1904
|
1904
|
} |
1905
|
|
- public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '',$reset = false) { |
|
1905
|
+ public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '', $reset = false) { |
1906
|
1906
|
global $globalDBdriver; |
1907
|
1907
|
if ($airport_icao != '') { |
1908
|
1908
|
if ($globalDBdriver == 'mysql') { |
|
@@ -1918,16 +1918,16 @@ discard block |
|
|
block discarded – undo |
1918
|
1918
|
$query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; |
1919
|
1919
|
} |
1920
|
1920
|
} |
1921
|
|
- $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1921
|
+ $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
1922
|
1922
|
try { |
1923
|
1923
|
$sth = $this->db->prepare($query); |
1924
|
1924
|
$sth->execute($query_values); |
1925
|
|
- } catch(PDOException $e) { |
|
1925
|
+ } catch (PDOException $e) { |
1926
|
1926
|
return "error : ".$e->getMessage(); |
1927
|
1927
|
} |
1928
|
1928
|
} |
1929
|
1929
|
} |
1930
|
|
- public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
|
1930
|
+ public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') { |
1931
|
1931
|
global $globalDBdriver; |
1932
|
1932
|
if ($airport_icao != '') { |
1933
|
1933
|
if ($globalDBdriver == 'mysql') { |
|
@@ -1935,11 +1935,11 @@ discard block |
|
|
block discarded – undo |
1935
|
1935
|
} else { |
1936
|
1936
|
$query = "UPDATE stats_airport SET arrival = :arrival WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1937
|
1937
|
} |
1938
|
|
- $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival, ':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1938
|
+ $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
1939
|
1939
|
try { |
1940
|
1940
|
$sth = $this->db->prepare($query); |
1941
|
1941
|
$sth->execute($query_values); |
1942
|
|
- } catch(PDOException $e) { |
|
1942
|
+ } catch (PDOException $e) { |
1943
|
1943
|
return "error : ".$e->getMessage(); |
1944
|
1944
|
} |
1945
|
1945
|
} |
|
@@ -1951,7 +1951,7 @@ discard block |
|
|
block discarded – undo |
1951
|
1951
|
try { |
1952
|
1952
|
$sth = $this->db->prepare($query); |
1953
|
1953
|
$sth->execute($query_values); |
1954
|
|
- } catch(PDOException $e) { |
|
1954
|
+ } catch (PDOException $e) { |
1955
|
1955
|
return "error : ".$e->getMessage(); |
1956
|
1956
|
} |
1957
|
1957
|
} |
|
@@ -1961,7 +1961,7 @@ discard block |
|
|
block discarded – undo |
1961
|
1961
|
try { |
1962
|
1962
|
$sth = $this->db->prepare($query); |
1963
|
1963
|
$sth->execute($query_values); |
1964
|
|
- } catch(PDOException $e) { |
|
1964
|
+ } catch (PDOException $e) { |
1965
|
1965
|
return "error : ".$e->getMessage(); |
1966
|
1966
|
} |
1967
|
1967
|
} |
|
@@ -1971,13 +1971,13 @@ discard block |
|
|
block discarded – undo |
1971
|
1971
|
try { |
1972
|
1972
|
$sth = $this->db->prepare($query); |
1973
|
1973
|
$sth->execute($query_values); |
1974
|
|
- } catch(PDOException $e) { |
|
1974
|
+ } catch (PDOException $e) { |
1975
|
1975
|
return "error : ".$e->getMessage(); |
1976
|
1976
|
} |
1977
|
1977
|
} |
1978
|
1978
|
|
1979
|
1979
|
public function addOldStats() { |
1980
|
|
- global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear, $globalAccidents; |
|
1980
|
+ global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters, $globalDeleteLastYearStats, $globalStatsReset, $globalStatsResetYear, $globalAccidents; |
1981
|
1981
|
$Common = new Common(); |
1982
|
1982
|
$Connection = new Connection(); |
1983
|
1983
|
date_default_timezone_set('UTC'); |
|
@@ -1995,41 +1995,41 @@ discard block |
|
|
block discarded – undo |
1995
|
1995
|
$Spotter = new Spotter($this->db); |
1996
|
1996
|
|
1997
|
1997
|
if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
1998
|
|
- $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
|
1998
|
+ $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day); |
1999
|
1999
|
foreach ($alldata as $number) { |
2000
|
|
- $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset); |
|
2000
|
+ $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', '', $reset); |
2001
|
2001
|
} |
2002
|
2002
|
if ($globalDebug) echo 'Count all airlines...'."\n"; |
2003
|
|
- $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
|
2003
|
+ $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day); |
2004
|
2004
|
foreach ($alldata as $number) { |
2005
|
|
- $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset); |
|
2005
|
+ $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], '', $reset); |
2006
|
2006
|
} |
2007
|
2007
|
if ($globalDebug) echo 'Count all registrations...'."\n"; |
2008
|
|
- $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
|
2008
|
+ $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day); |
2009
|
2009
|
foreach ($alldata as $number) { |
2010
|
|
- $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset); |
|
2010
|
+ $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', '', $reset); |
2011
|
2011
|
} |
2012
|
2012
|
if ($globalDebug) echo 'Count all callsigns...'."\n"; |
2013
|
|
- $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
|
2013
|
+ $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day); |
2014
|
2014
|
foreach ($alldata as $number) { |
2015
|
|
- $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
|
2015
|
+ $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset); |
2016
|
2016
|
} |
2017
|
2017
|
if ($globalDebug) echo 'Count all owners...'."\n"; |
2018
|
|
- $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
|
2018
|
+ $alldata = $Spotter->countAllOwners(false, 0, $last_update_day); |
2019
|
2019
|
foreach ($alldata as $number) { |
2020
|
|
- $this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset); |
|
2020
|
+ $this->addStatOwner($number['owner_name'], $number['owner_count'], '', '', $reset); |
2021
|
2021
|
} |
2022
|
2022
|
if ($globalDebug) echo 'Count all pilots...'."\n"; |
2023
|
|
- $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
|
2023
|
+ $alldata = $Spotter->countAllPilots(false, 0, $last_update_day); |
2024
|
2024
|
foreach ($alldata as $number) { |
2025
|
2025
|
if ($number['pilot_id'] == 0 || $number['pilot_id'] == '') $number['pilot_id'] = $number['pilot_name']; |
2026
|
|
- $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset); |
|
2026
|
+ $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', '', $number['format_source'], $reset); |
2027
|
2027
|
} |
2028
|
2028
|
|
2029
|
2029
|
if ($globalDebug) echo 'Count all departure airports...'."\n"; |
2030
|
|
- $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
|
2030
|
+ $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day); |
2031
|
2031
|
if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
2032
|
|
- $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
2032
|
+ $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day); |
2033
|
2033
|
if ($globalDebug) echo 'Order departure airports...'."\n"; |
2034
|
2034
|
$alldata = array(); |
2035
|
2035
|
foreach ($pall as $value) { |
|
@@ -2046,14 +2046,14 @@ discard block |
|
|
block discarded – undo |
2046
|
2046
|
foreach ($alldata as $key => $row) { |
2047
|
2047
|
$count[$key] = $row['airport_departure_icao_count']; |
2048
|
2048
|
} |
2049
|
|
- array_multisort($count,SORT_DESC,$alldata); |
|
2049
|
+ array_multisort($count, SORT_DESC, $alldata); |
2050
|
2050
|
foreach ($alldata as $number) { |
2051
|
|
- 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); |
|
2051
|
+ echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', '', $reset); |
2052
|
2052
|
} |
2053
|
2053
|
if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
2054
|
|
- $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
|
2054
|
+ $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day); |
2055
|
2055
|
if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
2056
|
|
- $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
2056
|
+ $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day); |
2057
|
2057
|
if ($globalDebug) echo 'Order arrival airports...'."\n"; |
2058
|
2058
|
$alldata = array(); |
2059
|
2059
|
foreach ($pall as $value) { |
|
@@ -2070,18 +2070,18 @@ discard block |
|
|
block discarded – undo |
2070
|
2070
|
foreach ($alldata as $key => $row) { |
2071
|
2071
|
$count[$key] = $row['airport_arrival_icao_count']; |
2072
|
2072
|
} |
2073
|
|
- array_multisort($count,SORT_DESC,$alldata); |
|
2073
|
+ array_multisort($count, SORT_DESC, $alldata); |
2074
|
2074
|
foreach ($alldata as $number) { |
2075
|
|
- 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); |
|
2075
|
+ echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', '', $reset); |
2076
|
2076
|
} |
2077
|
2077
|
if ($Connection->tableExists('countries')) { |
2078
|
2078
|
if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
2079
|
2079
|
//$SpotterArchive = new SpotterArchive(); |
2080
|
2080
|
//$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
2081
|
2081
|
$Spotter = new Spotter($this->db); |
2082
|
|
- $alldata = $Spotter->countAllFlightOverCountries(false,0,$last_update_day); |
|
2082
|
+ $alldata = $Spotter->countAllFlightOverCountries(false, 0, $last_update_day); |
2083
|
2083
|
foreach ($alldata as $number) { |
2084
|
|
- $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],'','',$reset); |
|
2084
|
+ $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], '', '', $reset); |
2085
|
2085
|
} |
2086
|
2086
|
} |
2087
|
2087
|
|
|
@@ -2091,12 +2091,12 @@ discard block |
|
|
block discarded – undo |
2091
|
2091
|
$this->deleteStatsByType('fatalities_byyear'); |
2092
|
2092
|
$alldata = $Accident->countFatalitiesByYear(); |
2093
|
2093
|
foreach ($alldata as $number) { |
2094
|
|
- $this->addStat('fatalities_byyear',$number['count'],date('Y-m-d H:i:s',mktime(0,0,0,1,1,$number['year']))); |
|
2094
|
+ $this->addStat('fatalities_byyear', $number['count'], date('Y-m-d H:i:s', mktime(0, 0, 0, 1, 1, $number['year']))); |
2095
|
2095
|
} |
2096
|
2096
|
$this->deleteStatsByType('fatalities_bymonth'); |
2097
|
2097
|
$alldata = $Accident->countFatalitiesLast12Months(); |
2098
|
2098
|
foreach ($alldata as $number) { |
2099
|
|
- $this->addStat('fatalities_bymonth',$number['count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month'],1,$number['year']))); |
|
2099
|
+ $this->addStat('fatalities_bymonth', $number['count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month'], 1, $number['year']))); |
2100
|
2100
|
} |
2101
|
2101
|
} |
2102
|
2102
|
|
|
@@ -2110,37 +2110,37 @@ discard block |
|
|
block discarded – undo |
2110
|
2110
|
$lastyear = false; |
2111
|
2111
|
foreach ($alldata as $number) { |
2112
|
2112
|
if ($number['year_name'] != date('Y')) $lastyear = true; |
2113
|
|
- $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']))); |
|
2113
|
+ $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']))); |
2114
|
2114
|
} |
2115
|
2115
|
if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
2116
|
2116
|
$alldata = $Spotter->countAllMilitaryMonths($filter_last_month); |
2117
|
2117
|
foreach ($alldata as $number) { |
2118
|
|
- $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']))); |
|
2118
|
+ $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']))); |
2119
|
2119
|
} |
2120
|
2120
|
if ($globalDebug) echo 'Count all owners by months...'."\n"; |
2121
|
2121
|
$alldata = $Spotter->countAllMonthsOwners($filter_last_month); |
2122
|
2122
|
foreach ($alldata as $number) { |
2123
|
|
- $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']))); |
|
2123
|
+ $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']))); |
2124
|
2124
|
} |
2125
|
2125
|
if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
2126
|
2126
|
$alldata = $Spotter->countAllMonthsPilots($filter_last_month); |
2127
|
2127
|
foreach ($alldata as $number) { |
2128
|
|
- $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']))); |
|
2128
|
+ $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']))); |
2129
|
2129
|
} |
2130
|
2130
|
if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
2131
|
2131
|
$alldata = $Spotter->countAllMonthsAirlines($filter_last_month); |
2132
|
2132
|
foreach ($alldata as $number) { |
2133
|
|
- $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']))); |
|
2133
|
+ $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']))); |
2134
|
2134
|
} |
2135
|
2135
|
if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
2136
|
2136
|
$alldata = $Spotter->countAllMonthsAircrafts($filter_last_month); |
2137
|
2137
|
foreach ($alldata as $number) { |
2138
|
|
- $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']))); |
|
2138
|
+ $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']))); |
2139
|
2139
|
} |
2140
|
2140
|
if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
2141
|
2141
|
$alldata = $Spotter->countAllMonthsRealArrivals($filter_last_month); |
2142
|
2142
|
foreach ($alldata as $number) { |
2143
|
|
- $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']))); |
|
2143
|
+ $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']))); |
2144
|
2144
|
} |
2145
|
2145
|
if ($globalDebug) echo 'Airports data...'."\n"; |
2146
|
2146
|
if ($globalDebug) echo '...Departure'."\n"; |
|
@@ -2185,7 +2185,7 @@ discard block |
|
|
block discarded – undo |
2185
|
2185
|
} |
2186
|
2186
|
$alldata = $pall; |
2187
|
2187
|
foreach ($alldata as $number) { |
2188
|
|
- $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']); |
|
2188
|
+ $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']); |
2189
|
2189
|
} |
2190
|
2190
|
echo '...Arrival'."\n"; |
2191
|
2191
|
$pall = $Spotter->getLast7DaysAirportsArrival(); |
|
@@ -2226,7 +2226,7 @@ discard block |
|
|
block discarded – undo |
2226
|
2226
|
} |
2227
|
2227
|
$alldata = $pall; |
2228
|
2228
|
foreach ($alldata as $number) { |
2229
|
|
- $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']); |
|
2229
|
+ $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']); |
2230
|
2230
|
} |
2231
|
2231
|
|
2232
|
2232
|
echo 'Flights data...'."\n"; |
|
@@ -2234,28 +2234,28 @@ discard block |
|
|
block discarded – undo |
2234
|
2234
|
echo '-> countAllDatesLastMonth...'."\n"; |
2235
|
2235
|
$alldata = $Spotter->countAllDatesLastMonth($filter_last_month); |
2236
|
2236
|
foreach ($alldata as $number) { |
2237
|
|
- $this->addStatFlight('month',$number['date_name'],$number['date_count']); |
|
2237
|
+ $this->addStatFlight('month', $number['date_name'], $number['date_count']); |
2238
|
2238
|
} |
2239
|
2239
|
echo '-> countAllDates...'."\n"; |
2240
|
2240
|
$previousdata = $this->countAllDates(); |
2241
|
2241
|
$previousdatabyairlines = $this->countAllDatesByAirlines(); |
2242
|
2242
|
$this->deleteStatFlight('date'); |
2243
|
|
- $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter_last_month)); |
|
2243
|
+ $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter_last_month)); |
2244
|
2244
|
$values = array(); |
2245
|
2245
|
foreach ($alldata as $cnt) { |
2246
|
2246
|
$values[] = $cnt['date_count']; |
2247
|
2247
|
} |
2248
|
|
- array_multisort($values,SORT_DESC,$alldata); |
2249
|
|
- array_splice($alldata,11); |
|
2248
|
+ array_multisort($values, SORT_DESC, $alldata); |
|
2249
|
+ array_splice($alldata, 11); |
2250
|
2250
|
foreach ($alldata as $number) { |
2251
|
|
- $this->addStatFlight('date',$number['date_name'],$number['date_count']); |
|
2251
|
+ $this->addStatFlight('date', $number['date_name'], $number['date_count']); |
2252
|
2252
|
} |
2253
|
2253
|
|
2254
|
2254
|
$this->deleteStatFlight('hour'); |
2255
|
2255
|
echo '-> countAllHours...'."\n"; |
2256
|
|
- $alldata = $Spotter->countAllHours('hour',$filter_last_month); |
|
2256
|
+ $alldata = $Spotter->countAllHours('hour', $filter_last_month); |
2257
|
2257
|
foreach ($alldata as $number) { |
2258
|
|
- $this->addStatFlight('hour',$number['hour_name'],$number['hour_count']); |
|
2258
|
+ $this->addStatFlight('hour', $number['hour_name'], $number['hour_count']); |
2259
|
2259
|
} |
2260
|
2260
|
|
2261
|
2261
|
// Count by airlines |
|
@@ -2264,42 +2264,42 @@ discard block |
|
|
block discarded – undo |
2264
|
2264
|
if ($globalDebug) echo 'Count all flights by countries by airlines...'."\n"; |
2265
|
2265
|
$SpotterArchive = new SpotterArchive(); |
2266
|
2266
|
//$Spotter = new Spotter($this->db); |
2267
|
|
- $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
|
2267
|
+ $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false, 0, $last_update_day); |
2268
|
2268
|
//$alldata = $Spotter->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
2269
|
2269
|
foreach ($alldata as $number) { |
2270
|
|
- $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],$number['airline_icao'],'',$reset); |
|
2270
|
+ $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], $number['airline_icao'], '', $reset); |
2271
|
2271
|
} |
2272
|
2272
|
} |
2273
|
2273
|
if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
2274
|
2274
|
$Spotter = new Spotter($this->db); |
2275
|
|
- $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
|
2275
|
+ $alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day); |
2276
|
2276
|
foreach ($alldata as $number) { |
2277
|
|
- $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset); |
|
2277
|
+ $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao'], '', $reset); |
2278
|
2278
|
} |
2279
|
2279
|
if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
2280
|
|
- $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
|
2280
|
+ $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day); |
2281
|
2281
|
foreach ($alldata as $number) { |
2282
|
|
- $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset); |
|
2282
|
+ $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao'], '', $reset); |
2283
|
2283
|
} |
2284
|
2284
|
if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
2285
|
|
- $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
|
2285
|
+ $alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day); |
2286
|
2286
|
foreach ($alldata as $number) { |
2287
|
|
- $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
|
2287
|
+ $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset); |
2288
|
2288
|
} |
2289
|
2289
|
if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
2290
|
|
- $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
|
2290
|
+ $alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day); |
2291
|
2291
|
foreach ($alldata as $number) { |
2292
|
|
- $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset); |
|
2292
|
+ $this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao'], '', $reset); |
2293
|
2293
|
} |
2294
|
2294
|
if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
2295
|
|
- $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
|
2295
|
+ $alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day); |
2296
|
2296
|
foreach ($alldata as $number) { |
2297
|
|
- $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset); |
|
2297
|
+ $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao'], '', $number['format_source'], $reset); |
2298
|
2298
|
} |
2299
|
2299
|
if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
2300
|
|
- $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
|
2300
|
+ $pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day); |
2301
|
2301
|
if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
2302
|
|
- $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
2302
|
+ $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day); |
2303
|
2303
|
if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
2304
|
2304
|
//$alldata = array(); |
2305
|
2305
|
foreach ($dall as $value) { |
|
@@ -2319,12 +2319,12 @@ discard block |
|
|
block discarded – undo |
2319
|
2319
|
} |
2320
|
2320
|
$alldata = $pall; |
2321
|
2321
|
foreach ($alldata as $number) { |
2322
|
|
- 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); |
|
2322
|
+ 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); |
2323
|
2323
|
} |
2324
|
2324
|
if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
2325
|
|
- $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
|
2325
|
+ $pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day); |
2326
|
2326
|
if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
2327
|
|
- $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
2327
|
+ $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day); |
2328
|
2328
|
if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
2329
|
2329
|
//$alldata = array(); |
2330
|
2330
|
foreach ($dall as $value) { |
|
@@ -2344,7 +2344,7 @@ discard block |
|
|
block discarded – undo |
2344
|
2344
|
} |
2345
|
2345
|
$alldata = $pall; |
2346
|
2346
|
foreach ($alldata as $number) { |
2347
|
|
- 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); |
|
2347
|
+ 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); |
2348
|
2348
|
} |
2349
|
2349
|
if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
2350
|
2350
|
$Spotter = new Spotter($this->db); |
|
@@ -2352,27 +2352,27 @@ discard block |
|
|
block discarded – undo |
2352
|
2352
|
$lastyear = false; |
2353
|
2353
|
foreach ($alldata as $number) { |
2354
|
2354
|
if ($number['year_name'] != date('Y')) $lastyear = true; |
2355
|
|
- $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']); |
|
2355
|
+ $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']); |
2356
|
2356
|
} |
2357
|
2357
|
if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
2358
|
2358
|
$alldata = $Spotter->countAllMonthsOwnersByAirlines($filter_last_month); |
2359
|
2359
|
foreach ($alldata as $number) { |
2360
|
|
- $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']); |
|
2360
|
+ $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']); |
2361
|
2361
|
} |
2362
|
2362
|
if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
2363
|
2363
|
$alldata = $Spotter->countAllMonthsPilotsByAirlines($filter_last_month); |
2364
|
2364
|
foreach ($alldata as $number) { |
2365
|
|
- $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']); |
|
2365
|
+ $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']); |
2366
|
2366
|
} |
2367
|
2367
|
if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
2368
|
2368
|
$alldata = $Spotter->countAllMonthsAircraftsByAirlines($filter_last_month); |
2369
|
2369
|
foreach ($alldata as $number) { |
2370
|
|
- $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']); |
|
2370
|
+ $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']); |
2371
|
2371
|
} |
2372
|
2372
|
if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
2373
|
2373
|
$alldata = $Spotter->countAllMonthsRealArrivalsByAirlines($filter_last_month); |
2374
|
2374
|
foreach ($alldata as $number) { |
2375
|
|
- $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']); |
|
2375
|
+ $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']); |
2376
|
2376
|
} |
2377
|
2377
|
if ($globalDebug) echo '...Departure'."\n"; |
2378
|
2378
|
$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
|
@@ -2395,7 +2395,7 @@ discard block |
|
|
block discarded – undo |
2395
|
2395
|
} |
2396
|
2396
|
$alldata = $pall; |
2397
|
2397
|
foreach ($alldata as $number) { |
2398
|
|
- $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']); |
|
2398
|
+ $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']); |
2399
|
2399
|
} |
2400
|
2400
|
if ($globalDebug) echo '...Arrival'."\n"; |
2401
|
2401
|
$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
|
@@ -2418,32 +2418,32 @@ discard block |
|
|
block discarded – undo |
2418
|
2418
|
} |
2419
|
2419
|
$alldata = $pall; |
2420
|
2420
|
foreach ($alldata as $number) { |
2421
|
|
- $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']); |
|
2421
|
+ $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']); |
2422
|
2422
|
} |
2423
|
2423
|
|
2424
|
2424
|
if ($globalDebug) echo 'Flights data...'."\n"; |
2425
|
2425
|
if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
2426
|
2426
|
$alldata = $Spotter->countAllDatesLastMonthByAirlines($filter_last_month); |
2427
|
2427
|
foreach ($alldata as $number) { |
2428
|
|
- $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
|
2428
|
+ $this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']); |
2429
|
2429
|
} |
2430
|
2430
|
if ($globalDebug) echo '-> countAllDates...'."\n"; |
2431
|
2431
|
//$previousdata = $this->countAllDatesByAirlines(); |
2432
|
|
- $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines($filter_last_month)); |
|
2432
|
+ $alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines($filter_last_month)); |
2433
|
2433
|
$values = array(); |
2434
|
2434
|
foreach ($alldata as $cnt) { |
2435
|
2435
|
$values[] = $cnt['date_count']; |
2436
|
2436
|
} |
2437
|
|
- array_multisort($values,SORT_DESC,$alldata); |
2438
|
|
- array_splice($alldata,11); |
|
2437
|
+ array_multisort($values, SORT_DESC, $alldata); |
|
2438
|
+ array_splice($alldata, 11); |
2439
|
2439
|
foreach ($alldata as $number) { |
2440
|
|
- $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
|
2440
|
+ $this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']); |
2441
|
2441
|
} |
2442
|
2442
|
|
2443
|
2443
|
if ($globalDebug) echo '-> countAllHours...'."\n"; |
2444
|
|
- $alldata = $Spotter->countAllHoursByAirlines('hour',$filter_last_month); |
|
2444
|
+ $alldata = $Spotter->countAllHoursByAirlines('hour', $filter_last_month); |
2445
|
2445
|
foreach ($alldata as $number) { |
2446
|
|
- $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
|
2446
|
+ $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']); |
2447
|
2447
|
} |
2448
|
2448
|
|
2449
|
2449
|
// Stats by filters |
|
@@ -2466,7 +2466,7 @@ discard block |
|
|
block discarded – undo |
2466
|
2466
|
$last_update_day = date('Y').'-01-01 00:00:00'; |
2467
|
2467
|
} |
2468
|
2468
|
} |
2469
|
|
- if (isset($filter['DeleteLastYearStats']) && date('Y',strtotime($last_update_day)) != date('Y')) { |
|
2469
|
+ if (isset($filter['DeleteLastYearStats']) && date('Y', strtotime($last_update_day)) != date('Y')) { |
2470
|
2470
|
$last_update_day = date('Y').'-01-01 00:00:00'; |
2471
|
2471
|
$reset = true; |
2472
|
2472
|
} |
|
@@ -2475,32 +2475,32 @@ discard block |
|
|
block discarded – undo |
2475
|
2475
|
// Count by filter |
2476
|
2476
|
if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
2477
|
2477
|
$Spotter = new Spotter($this->db); |
2478
|
|
- $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
|
2478
|
+ $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter); |
2479
|
2479
|
foreach ($alldata as $number) { |
2480
|
|
- $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name,$reset); |
|
2480
|
+ $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name, $reset); |
2481
|
2481
|
} |
2482
|
|
- $alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter); |
|
2482
|
+ $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day, $filter); |
2483
|
2483
|
foreach ($alldata as $number) { |
2484
|
|
- $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name,$reset); |
|
2484
|
+ $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], $filter_name, $reset); |
2485
|
2485
|
} |
2486
|
|
- $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter); |
|
2486
|
+ $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter); |
2487
|
2487
|
foreach ($alldata as $number) { |
2488
|
|
- $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name,$reset); |
|
2488
|
+ $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name, $reset); |
2489
|
2489
|
} |
2490
|
|
- $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter); |
|
2490
|
+ $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter); |
2491
|
2491
|
foreach ($alldata as $number) { |
2492
|
|
- $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name,$reset); |
|
2492
|
+ $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name, $reset); |
2493
|
2493
|
} |
2494
|
|
- $alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter); |
|
2494
|
+ $alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter); |
2495
|
2495
|
foreach ($alldata as $number) { |
2496
|
|
- $this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name,$reset); |
|
2496
|
+ $this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name, $reset); |
2497
|
2497
|
} |
2498
|
|
- $alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter); |
|
2498
|
+ $alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter); |
2499
|
2499
|
foreach ($alldata as $number) { |
2500
|
|
- $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source'],$reset); |
|
2500
|
+ $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name, $number['format_source'], $reset); |
2501
|
2501
|
} |
2502
|
|
- $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
2503
|
|
- $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
2502
|
+ $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter); |
|
2503
|
+ $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter); |
2504
|
2504
|
$alldata = array(); |
2505
|
2505
|
foreach ($pall as $value) { |
2506
|
2506
|
$icao = $value['airport_departure_icao']; |
|
@@ -2516,12 +2516,12 @@ discard block |
|
|
block discarded – undo |
2516
|
2516
|
foreach ($alldata as $key => $row) { |
2517
|
2517
|
$count[$key] = $row['airport_departure_icao_count']; |
2518
|
2518
|
} |
2519
|
|
- array_multisort($count,SORT_DESC,$alldata); |
|
2519
|
+ array_multisort($count, SORT_DESC, $alldata); |
2520
|
2520
|
foreach ($alldata as $number) { |
2521
|
|
- 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); |
|
2521
|
+ 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); |
2522
|
2522
|
} |
2523
|
|
- $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter); |
2524
|
|
- $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter); |
|
2523
|
+ $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, false, $filter); |
|
2524
|
+ $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, false, $filter); |
2525
|
2525
|
$alldata = array(); |
2526
|
2526
|
foreach ($pall as $value) { |
2527
|
2527
|
$icao = $value['airport_arrival_icao']; |
|
@@ -2537,40 +2537,40 @@ discard block |
|
|
block discarded – undo |
2537
|
2537
|
foreach ($alldata as $key => $row) { |
2538
|
2538
|
$count[$key] = $row['airport_arrival_icao_count']; |
2539
|
2539
|
} |
2540
|
|
- array_multisort($count,SORT_DESC,$alldata); |
|
2540
|
+ array_multisort($count, SORT_DESC, $alldata); |
2541
|
2541
|
foreach ($alldata as $number) { |
2542
|
|
- 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); |
|
2542
|
+ 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); |
2543
|
2543
|
} |
2544
|
2544
|
$Spotter = new Spotter($this->db); |
2545
|
2545
|
$alldata = $Spotter->countAllMonths($filter); |
2546
|
2546
|
$lastyear = false; |
2547
|
2547
|
foreach ($alldata as $number) { |
2548
|
2548
|
if ($number['year_name'] != date('Y')) $lastyear = true; |
2549
|
|
- $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); |
|
2549
|
+ $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); |
2550
|
2550
|
} |
2551
|
2551
|
$alldata = $Spotter->countAllMonthsOwners($filter); |
2552
|
2552
|
foreach ($alldata as $number) { |
2553
|
|
- $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); |
|
2553
|
+ $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); |
2554
|
2554
|
} |
2555
|
2555
|
$alldata = $Spotter->countAllMonthsPilots($filter); |
2556
|
2556
|
foreach ($alldata as $number) { |
2557
|
|
- $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); |
|
2557
|
+ $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); |
2558
|
2558
|
} |
2559
|
2559
|
$alldata = $Spotter->countAllMilitaryMonths($filter); |
2560
|
2560
|
foreach ($alldata as $number) { |
2561
|
|
- $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); |
|
2561
|
+ $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); |
2562
|
2562
|
} |
2563
|
2563
|
$alldata = $Spotter->countAllMonthsAircrafts($filter); |
2564
|
2564
|
foreach ($alldata as $number) { |
2565
|
|
- $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); |
|
2565
|
+ $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); |
2566
|
2566
|
} |
2567
|
2567
|
$alldata = $Spotter->countAllMonthsRealArrivals($filter); |
2568
|
2568
|
foreach ($alldata as $number) { |
2569
|
|
- $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); |
|
2569
|
+ $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); |
2570
|
2570
|
} |
2571
|
2571
|
echo '...Departure'."\n"; |
2572
|
|
- $pall = $Spotter->getLast7DaysAirportsDeparture('',$filter); |
2573
|
|
- $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
2572
|
+ $pall = $Spotter->getLast7DaysAirportsDeparture('', $filter); |
|
2573
|
+ $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter); |
2574
|
2574
|
foreach ($dall as $value) { |
2575
|
2575
|
$icao = $value['departure_airport_icao']; |
2576
|
2576
|
$ddate = $value['date']; |
|
@@ -2588,11 +2588,11 @@ discard block |
|
|
block discarded – undo |
2588
|
2588
|
} |
2589
|
2589
|
$alldata = $pall; |
2590
|
2590
|
foreach ($alldata as $number) { |
2591
|
|
- $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],'',$filter_name); |
|
2591
|
+ $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], '', $filter_name); |
2592
|
2592
|
} |
2593
|
2593
|
echo '...Arrival'."\n"; |
2594
|
|
- $pall = $Spotter->getLast7DaysAirportsArrival('',$filter); |
2595
|
|
- $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
2594
|
+ $pall = $Spotter->getLast7DaysAirportsArrival('', $filter); |
|
2595
|
+ $dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter); |
2596
|
2596
|
foreach ($dall as $value) { |
2597
|
2597
|
$icao = $value['arrival_airport_icao']; |
2598
|
2598
|
$ddate = $value['date']; |
|
@@ -2610,39 +2610,39 @@ discard block |
|
|
block discarded – undo |
2610
|
2610
|
} |
2611
|
2611
|
$alldata = $pall; |
2612
|
2612
|
foreach ($alldata as $number) { |
2613
|
|
- $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],'',$filter_name); |
|
2613
|
+ $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], '', $filter_name); |
2614
|
2614
|
} |
2615
|
2615
|
echo 'Flights data...'."\n"; |
2616
|
2616
|
echo '-> countAllDatesLastMonth...'."\n"; |
2617
|
2617
|
$alldata = $Spotter->countAllDatesLastMonth($filter); |
2618
|
2618
|
foreach ($alldata as $number) { |
2619
|
|
- $this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name); |
|
2619
|
+ $this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name); |
2620
|
2620
|
} |
2621
|
2621
|
echo '-> countAllDates...'."\n"; |
2622
|
|
- $previousdata = $this->countAllDates('',$filter_name); |
2623
|
|
- $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter)); |
|
2622
|
+ $previousdata = $this->countAllDates('', $filter_name); |
|
2623
|
+ $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter)); |
2624
|
2624
|
$values = array(); |
2625
|
2625
|
foreach ($alldata as $cnt) { |
2626
|
2626
|
$values[] = $cnt['date_count']; |
2627
|
2627
|
} |
2628
|
|
- array_multisort($values,SORT_DESC,$alldata); |
2629
|
|
- array_splice($alldata,11); |
|
2628
|
+ array_multisort($values, SORT_DESC, $alldata); |
|
2629
|
+ array_splice($alldata, 11); |
2630
|
2630
|
foreach ($alldata as $number) { |
2631
|
|
- $this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name); |
|
2631
|
+ $this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name); |
2632
|
2632
|
} |
2633
|
2633
|
|
2634
|
2634
|
echo '-> countAllHours...'."\n"; |
2635
|
|
- $alldata = $Spotter->countAllHours('hour',$filter); |
|
2635
|
+ $alldata = $Spotter->countAllHours('hour', $filter); |
2636
|
2636
|
foreach ($alldata as $number) { |
2637
|
|
- $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name); |
|
2637
|
+ $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name); |
2638
|
2638
|
} |
2639
|
2639
|
echo 'Insert last stats update date...'."\n"; |
2640
|
2640
|
date_default_timezone_set('UTC'); |
2641
|
|
- $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y-m-d G:i:s')); |
|
2641
|
+ $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y-m-d G:i:s')); |
2642
|
2642
|
if (isset($filter['DeleteLastYearStats']) && $filter['DeleteLastYearStats'] == true) { |
2643
|
|
- if (date('Y',strtotime($last_update_day)) != date('Y')) { |
|
2643
|
+ if (date('Y', strtotime($last_update_day)) != date('Y')) { |
2644
|
2644
|
$this->deleteOldStats($filter_name); |
2645
|
|
- $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y').'-01-01 00:00:00'); |
|
2645
|
+ $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y').'-01-01 00:00:00'); |
2646
|
2646
|
} |
2647
|
2647
|
} |
2648
|
2648
|
} |
|
@@ -2653,16 +2653,16 @@ discard block |
|
|
block discarded – undo |
2653
|
2653
|
// SUM all previous month to put as year |
2654
|
2654
|
$previous_year = date('Y'); |
2655
|
2655
|
$previous_year--; |
2656
|
|
- $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
2657
|
|
- $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
2658
|
|
- $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
2659
|
|
- $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2656
|
+ $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2657
|
+ $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2658
|
+ $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2659
|
+ $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
2660
|
2660
|
$allairlines = $this->getAllAirlineNames(); |
2661
|
2661
|
foreach ($allairlines as $data) { |
2662
|
|
- $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
2663
|
|
- $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
2664
|
|
- $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
2665
|
|
- $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2662
|
+ $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2663
|
+ $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2664
|
+ $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2665
|
+ $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
2666
|
2666
|
} |
2667
|
2667
|
|
2668
|
2668
|
if (isset($globalArchiveYear) && $globalArchiveYear) { |
|
@@ -2671,7 +2671,7 @@ discard block |
|
|
block discarded – undo |
2671
|
2671
|
try { |
2672
|
2672
|
$sth = $this->db->prepare($query); |
2673
|
2673
|
$sth->execute(); |
2674
|
|
- } catch(PDOException $e) { |
|
2674
|
+ } catch (PDOException $e) { |
2675
|
2675
|
return "error : ".$e->getMessage().' - query : '.$query."\n"; |
2676
|
2676
|
} |
2677
|
2677
|
} |
|
@@ -2680,15 +2680,15 @@ discard block |
|
|
block discarded – undo |
2680
|
2680
|
try { |
2681
|
2681
|
$sth = $this->db->prepare($query); |
2682
|
2682
|
$sth->execute(); |
2683
|
|
- } catch(PDOException $e) { |
|
2683
|
+ } catch (PDOException $e) { |
2684
|
2684
|
return "error : ".$e->getMessage().' - query : '.$query."\n"; |
2685
|
2685
|
} |
2686
|
2686
|
} |
2687
|
2687
|
if (isset($globalDeleteLastYearStats) && $globalDeleteLastYearStats) { |
2688
|
2688
|
$last_update = $this->getLastStatsUpdate('last_update_stats'); |
2689
|
|
- if (date('Y',strtotime($last_update[0]['value'])) != date('Y')) { |
|
2689
|
+ if (date('Y', strtotime($last_update[0]['value'])) != date('Y')) { |
2690
|
2690
|
$this->deleteOldStats(); |
2691
|
|
- $this->addLastStatsUpdate('last_update_stats',date('Y').'-01-01 00:00:00'); |
|
2691
|
+ $this->addLastStatsUpdate('last_update_stats', date('Y').'-01-01 00:00:00'); |
2692
|
2692
|
$lastyearupdate = true; |
2693
|
2693
|
} |
2694
|
2694
|
} |
|
@@ -2710,7 +2710,7 @@ discard block |
|
|
block discarded – undo |
2710
|
2710
|
try { |
2711
|
2711
|
$sth = $this->db->prepare($query); |
2712
|
2712
|
$sth->execute(); |
2713
|
|
- } catch(PDOException $e) { |
|
2713
|
+ } catch (PDOException $e) { |
2714
|
2714
|
return "error : ".$e->getMessage(); |
2715
|
2715
|
} |
2716
|
2716
|
} |
|
@@ -2724,14 +2724,14 @@ discard block |
|
|
block discarded – undo |
2724
|
2724
|
try { |
2725
|
2725
|
$sth = $this->db->prepare($query); |
2726
|
2726
|
$sth->execute(); |
2727
|
|
- } catch(PDOException $e) { |
|
2727
|
+ } catch (PDOException $e) { |
2728
|
2728
|
return "error : ".$e->getMessage(); |
2729
|
2729
|
} |
2730
|
2730
|
} |
2731
|
2731
|
if (!isset($lastyearupdate)) { |
2732
|
2732
|
echo 'Insert last stats update date...'."\n"; |
2733
|
2733
|
date_default_timezone_set('UTC'); |
2734
|
|
- $this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s')); |
|
2734
|
+ $this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s')); |
2735
|
2735
|
} |
2736
|
2736
|
if ($globalStatsResetYear) { |
2737
|
2737
|
require_once(dirname(__FILE__).'/../install/class.settings.php'); |