|
@@ -17,14 +17,14 @@ discard block |
|
|
block discarded – undo |
|
17
|
17
|
$this->db = $Connection->db(); |
|
18
|
18
|
} |
|
19
|
19
|
|
|
20
|
|
- public function addLastStatsUpdate($type,$stats_date) { |
|
|
20
|
+ public function addLastStatsUpdate($type, $stats_date) { |
|
21
|
21
|
$query = "DELETE FROM config WHERE name = :type; |
|
22
|
22
|
INSERT INTO config (name,value) VALUES (:type,:stats_date);"; |
|
23
|
|
- $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
|
23
|
+ $query_values = array('type' => $type, ':stats_date' => $stats_date); |
|
24
|
24
|
try { |
|
25
|
25
|
$sth = $this->db->prepare($query); |
|
26
|
26
|
$sth->execute($query_values); |
|
27
|
|
- } catch(PDOException $e) { |
|
|
27
|
+ } catch (PDOException $e) { |
|
28
|
28
|
return "error : ".$e->getMessage(); |
|
29
|
29
|
} |
|
30
|
30
|
} |
|
@@ -34,7 +34,7 @@ discard block |
|
|
block discarded – undo |
|
34
|
34
|
try { |
|
35
|
35
|
$sth = $this->db->prepare($query); |
|
36
|
36
|
$sth->execute(array(':type' => $type)); |
|
37
|
|
- } catch(PDOException $e) { |
|
|
37
|
+ } catch (PDOException $e) { |
|
38
|
38
|
echo "error : ".$e->getMessage(); |
|
39
|
39
|
} |
|
40
|
40
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -54,7 +54,7 @@ discard block |
|
|
block discarded – undo |
|
54
|
54
|
try { |
|
55
|
55
|
$sth = $this->db->prepare($query); |
|
56
|
56
|
$sth->execute(array(':filter_name' => $filter_name)); |
|
57
|
|
- } catch(PDOException $e) { |
|
|
57
|
+ } catch (PDOException $e) { |
|
58
|
58
|
return "error : ".$e->getMessage(); |
|
59
|
59
|
} |
|
60
|
60
|
} |
|
@@ -64,7 +64,7 @@ discard block |
|
|
block discarded – undo |
|
64
|
64
|
try { |
|
65
|
65
|
$sth = $this->db->prepare($query); |
|
66
|
66
|
$sth->execute(); |
|
67
|
|
- } catch(PDOException $e) { |
|
|
67
|
+ } catch (PDOException $e) { |
|
68
|
68
|
return "error : ".$e->getMessage(); |
|
69
|
69
|
} |
|
70
|
70
|
|
|
@@ -72,7 +72,7 @@ discard block |
|
|
block discarded – undo |
|
72
|
72
|
try { |
|
73
|
73
|
$sth = $this->db->prepare($query); |
|
74
|
74
|
$sth->execute(array(':filter_name' => $filter_name)); |
|
75
|
|
- } catch(PDOException $e) { |
|
|
75
|
+ } catch (PDOException $e) { |
|
76
|
76
|
return "error : ".$e->getMessage(); |
|
77
|
77
|
} |
|
78
|
78
|
} |
|
@@ -82,69 +82,69 @@ discard block |
|
|
block discarded – undo |
|
82
|
82
|
try { |
|
83
|
83
|
$sth = $this->db->prepare($query); |
|
84
|
84
|
$sth->execute(array(':filter_name' => $filter_name)); |
|
85
|
|
- } catch(PDOException $e) { |
|
|
85
|
+ } catch (PDOException $e) { |
|
86
|
86
|
echo "error : ".$e->getMessage(); |
|
87
|
87
|
} |
|
88
|
88
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
89
|
89
|
return $all; |
|
90
|
90
|
} |
|
91
|
|
- public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
|
|
91
|
+ public function getAllAircraftTypes($stats_airline = '', $filter_name = '') { |
|
92
|
92
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
93
|
93
|
$query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
|
94
|
94
|
try { |
|
95
|
95
|
$sth = $this->db->prepare($query); |
|
96
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
97
|
|
- } catch(PDOException $e) { |
|
|
96
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
|
97
|
+ } catch (PDOException $e) { |
|
98
|
98
|
echo "error : ".$e->getMessage(); |
|
99
|
99
|
} |
|
100
|
100
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
101
|
101
|
return $all; |
|
102
|
102
|
} |
|
103
|
|
- public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
|
|
103
|
+ public function getAllManufacturers($stats_airline = '', $filter_name = '') { |
|
104
|
104
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
105
|
105
|
$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"; |
|
106
|
106
|
try { |
|
107
|
107
|
$sth = $this->db->prepare($query); |
|
108
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
109
|
|
- } catch(PDOException $e) { |
|
|
108
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
|
109
|
+ } catch (PDOException $e) { |
|
110
|
110
|
echo "error : ".$e->getMessage(); |
|
111
|
111
|
} |
|
112
|
112
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
113
|
113
|
return $all; |
|
114
|
114
|
} |
|
115
|
|
- public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
|
|
115
|
+ public function getAllAirportNames($stats_airline = '', $filter_name = '') { |
|
116
|
116
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
117
|
117
|
$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"; |
|
118
|
118
|
try { |
|
119
|
119
|
$sth = $this->db->prepare($query); |
|
120
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
121
|
|
- } catch(PDOException $e) { |
|
|
120
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
|
121
|
+ } catch (PDOException $e) { |
|
122
|
122
|
echo "error : ".$e->getMessage(); |
|
123
|
123
|
} |
|
124
|
124
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
125
|
125
|
return $all; |
|
126
|
126
|
} |
|
127
|
127
|
|
|
128
|
|
- public function getAllOwnerNames($stats_airline = '',$filter_name = '') { |
|
|
128
|
+ public function getAllOwnerNames($stats_airline = '', $filter_name = '') { |
|
129
|
129
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
130
|
130
|
$query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC"; |
|
131
|
131
|
try { |
|
132
|
132
|
$sth = $this->db->prepare($query); |
|
133
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
134
|
|
- } catch(PDOException $e) { |
|
|
133
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
|
134
|
+ } catch (PDOException $e) { |
|
135
|
135
|
echo "error : ".$e->getMessage(); |
|
136
|
136
|
} |
|
137
|
137
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
138
|
138
|
return $all; |
|
139
|
139
|
} |
|
140
|
140
|
|
|
141
|
|
- public function getAllPilotNames($stats_airline = '',$filter_name = '') { |
|
|
141
|
+ public function getAllPilotNames($stats_airline = '', $filter_name = '') { |
|
142
|
142
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
143
|
143
|
$query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC"; |
|
144
|
144
|
try { |
|
145
|
145
|
$sth = $this->db->prepare($query); |
|
146
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
147
|
|
- } catch(PDOException $e) { |
|
|
146
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
|
147
|
+ } catch (PDOException $e) { |
|
148
|
148
|
echo "error : ".$e->getMessage(); |
|
149
|
149
|
} |
|
150
|
150
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -152,7 +152,7 @@ discard block |
|
|
block discarded – undo |
|
152
|
152
|
} |
|
153
|
153
|
|
|
154
|
154
|
|
|
155
|
|
- public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
|
155
|
+ public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
156
|
156
|
global $globalStatsFilters; |
|
157
|
157
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
158
|
158
|
if ($year == '' && $month == '') { |
|
@@ -160,8 +160,8 @@ discard block |
|
|
block discarded – undo |
|
160
|
160
|
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"; |
|
161
|
161
|
try { |
|
162
|
162
|
$sth = $this->db->prepare($query); |
|
163
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
164
|
|
- } catch(PDOException $e) { |
|
|
163
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
|
164
|
+ } catch (PDOException $e) { |
|
165
|
165
|
echo "error : ".$e->getMessage(); |
|
166
|
166
|
} |
|
167
|
167
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -169,14 +169,14 @@ discard block |
|
|
block discarded – undo |
|
169
|
169
|
if (empty($all)) { |
|
170
|
170
|
$filters = array('airlines' => array($stats_airline)); |
|
171
|
171
|
if ($filter_name != '') { |
|
172
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
172
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
173
|
173
|
} |
|
174
|
174
|
$Spotter = new Spotter($this->db); |
|
175
|
|
- $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters,$year,$month); |
|
|
175
|
+ $all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters, $year, $month); |
|
176
|
176
|
} |
|
177
|
177
|
return $all; |
|
178
|
178
|
} |
|
179
|
|
- public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
|
|
179
|
+ public function countAllAirlineCountries($limit = true, $filter_name = '', $year = '', $month = '') { |
|
180
|
180
|
global $globalStatsFilters; |
|
181
|
181
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
182
|
182
|
if ($year == '' && $month == '') { |
|
@@ -185,7 +185,7 @@ discard block |
|
|
block discarded – undo |
|
185
|
185
|
try { |
|
186
|
186
|
$sth = $this->db->prepare($query); |
|
187
|
187
|
$sth->execute(array(':filter_name' => $filter_name)); |
|
188
|
|
- } catch(PDOException $e) { |
|
|
188
|
+ } catch (PDOException $e) { |
|
189
|
189
|
echo "error : ".$e->getMessage(); |
|
190
|
190
|
} |
|
191
|
191
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -194,13 +194,13 @@ discard block |
|
|
block discarded – undo |
|
194
|
194
|
$Spotter = new Spotter($this->db); |
|
195
|
195
|
$filters = array(); |
|
196
|
196
|
if ($filter_name != '') { |
|
197
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
197
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
198
|
198
|
} |
|
199
|
|
- $all = $Spotter->countAllAirlineCountries($limit,$filters,$year,$month); |
|
|
199
|
+ $all = $Spotter->countAllAirlineCountries($limit, $filters, $year, $month); |
|
200
|
200
|
} |
|
201
|
201
|
return $all; |
|
202
|
202
|
} |
|
203
|
|
- public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
|
203
|
+ public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
204
|
204
|
global $globalStatsFilters; |
|
205
|
205
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
206
|
206
|
if ($year == '' && $month == '') { |
|
@@ -208,8 +208,8 @@ discard block |
|
|
block discarded – undo |
|
208
|
208
|
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"; |
|
209
|
209
|
try { |
|
210
|
210
|
$sth = $this->db->prepare($query); |
|
211
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
212
|
|
- } catch(PDOException $e) { |
|
|
211
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
|
212
|
+ } catch (PDOException $e) { |
|
213
|
213
|
echo "error : ".$e->getMessage(); |
|
214
|
214
|
} |
|
215
|
215
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -217,15 +217,15 @@ discard block |
|
|
block discarded – undo |
|
217
|
217
|
if (empty($all)) { |
|
218
|
218
|
$filters = array('airlines' => array($stats_airline)); |
|
219
|
219
|
if ($filter_name != '') { |
|
220
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
220
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
221
|
221
|
} |
|
222
|
222
|
$Spotter = new Spotter($this->db); |
|
223
|
|
- $all = $Spotter->countAllAircraftManufacturers($filters,$year,$month); |
|
|
223
|
+ $all = $Spotter->countAllAircraftManufacturers($filters, $year, $month); |
|
224
|
224
|
} |
|
225
|
225
|
return $all; |
|
226
|
226
|
} |
|
227
|
227
|
|
|
228
|
|
- public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
|
228
|
+ public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
229
|
229
|
global $globalStatsFilters; |
|
230
|
230
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
231
|
231
|
if ($year == '' && $month == '') { |
|
@@ -233,8 +233,8 @@ discard block |
|
|
block discarded – undo |
|
233
|
233
|
else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC"; |
|
234
|
234
|
try { |
|
235
|
235
|
$sth = $this->db->prepare($query); |
|
236
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
237
|
|
- } catch(PDOException $e) { |
|
|
236
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
|
237
|
+ } catch (PDOException $e) { |
|
238
|
238
|
echo "error : ".$e->getMessage(); |
|
239
|
239
|
} |
|
240
|
240
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -242,10 +242,10 @@ discard block |
|
|
block discarded – undo |
|
242
|
242
|
if (empty($all)) { |
|
243
|
243
|
$filters = array('airlines' => array($stats_airline)); |
|
244
|
244
|
if ($filter_name != '') { |
|
245
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
245
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
246
|
246
|
} |
|
247
|
247
|
$Spotter = new Spotter($this->db); |
|
248
|
|
- $all = $Spotter->countAllArrivalCountries($limit,$filters,$year,$month); |
|
|
248
|
+ $all = $Spotter->countAllArrivalCountries($limit, $filters, $year, $month); |
|
249
|
249
|
} |
|
250
|
250
|
return $all; |
|
251
|
251
|
} |
|
@@ -256,23 +256,23 @@ discard block |
|
|
block discarded – undo |
|
256
|
256
|
else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
|
257
|
257
|
try { |
|
258
|
258
|
$sth = $this->db->prepare($query); |
|
259
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
260
|
|
- } catch(PDOException $e) { |
|
|
259
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
|
260
|
+ } catch (PDOException $e) { |
|
261
|
261
|
echo "error : ".$e->getMessage(); |
|
262
|
262
|
} |
|
263
|
263
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
264
|
264
|
if (empty($all)) { |
|
265
|
265
|
$filters = array('airlines' => array($stats_airline)); |
|
266
|
266
|
if ($filter_name != '') { |
|
267
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
267
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
268
|
268
|
} |
|
269
|
269
|
$Spotter = new Spotter($this->db); |
|
270
|
|
- $all = $Spotter->countAllDepartureCountries($filters,$year,$month); |
|
|
270
|
+ $all = $Spotter->countAllDepartureCountries($filters, $year, $month); |
|
271
|
271
|
} |
|
272
|
272
|
return $all; |
|
273
|
273
|
} |
|
274
|
274
|
|
|
275
|
|
- public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
|
|
275
|
+ public function countAllAirlines($limit = true, $filter_name = '', $year = '', $month = '') { |
|
276
|
276
|
global $globalStatsFilters; |
|
277
|
277
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
278
|
278
|
if ($year == '' && $month == '') { |
|
@@ -281,7 +281,7 @@ discard block |
|
|
block discarded – undo |
|
281
|
281
|
try { |
|
282
|
282
|
$sth = $this->db->prepare($query); |
|
283
|
283
|
$sth->execute(array(':filter_name' => $filter_name)); |
|
284
|
|
- } catch(PDOException $e) { |
|
|
284
|
+ } catch (PDOException $e) { |
|
285
|
285
|
echo "error : ".$e->getMessage(); |
|
286
|
286
|
} |
|
287
|
287
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -290,14 +290,14 @@ discard block |
|
|
block discarded – undo |
|
290
|
290
|
$Spotter = new Spotter($this->db); |
|
291
|
291
|
$filters = array(); |
|
292
|
292
|
if ($filter_name != '') { |
|
293
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
293
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
294
|
294
|
} |
|
295
|
295
|
|
|
296
|
|
- $all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month); |
|
|
296
|
+ $all = $Spotter->countAllAirlines($limit, 0, '', $filters, $year, $month); |
|
297
|
297
|
} |
|
298
|
298
|
return $all; |
|
299
|
299
|
} |
|
300
|
|
- public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
|
300
|
+ public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
301
|
301
|
global $globalStatsFilters; |
|
302
|
302
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
303
|
303
|
if ($year == '' && $month == '') { |
|
@@ -305,8 +305,8 @@ discard block |
|
|
block discarded – undo |
|
305
|
305
|
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"; |
|
306
|
306
|
try { |
|
307
|
307
|
$sth = $this->db->prepare($query); |
|
308
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
309
|
|
- } catch(PDOException $e) { |
|
|
308
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
|
309
|
+ } catch (PDOException $e) { |
|
310
|
310
|
echo "error : ".$e->getMessage(); |
|
311
|
311
|
} |
|
312
|
312
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -314,14 +314,14 @@ discard block |
|
|
block discarded – undo |
|
314
|
314
|
if (empty($all)) { |
|
315
|
315
|
$filters = array('airlines' => array($stats_airline)); |
|
316
|
316
|
if ($filter_name != '') { |
|
317
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
317
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
318
|
318
|
} |
|
319
|
319
|
$Spotter = new Spotter($this->db); |
|
320
|
|
- $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters,$year,$month); |
|
|
320
|
+ $all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters, $year, $month); |
|
321
|
321
|
} |
|
322
|
322
|
return $all; |
|
323
|
323
|
} |
|
324
|
|
- public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
|
324
|
+ public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
325
|
325
|
global $globalStatsFilters; |
|
326
|
326
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
327
|
327
|
if ($year == '' && $month == '') { |
|
@@ -329,8 +329,8 @@ discard block |
|
|
block discarded – undo |
|
329
|
329
|
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"; |
|
330
|
330
|
try { |
|
331
|
331
|
$sth = $this->db->prepare($query); |
|
332
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
333
|
|
- } catch(PDOException $e) { |
|
|
332
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
|
333
|
+ } catch (PDOException $e) { |
|
334
|
334
|
echo "error : ".$e->getMessage(); |
|
335
|
335
|
} |
|
336
|
336
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -338,14 +338,14 @@ discard block |
|
|
block discarded – undo |
|
338
|
338
|
if (empty($all)) { |
|
339
|
339
|
$filters = array('airlines' => array($stats_airline)); |
|
340
|
340
|
if ($filter_name != '') { |
|
341
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
341
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
342
|
342
|
} |
|
343
|
343
|
$Spotter = new Spotter($this->db); |
|
344
|
|
- $all = $Spotter->countAllCallsigns($limit,0,'',$filters,$year,$month); |
|
|
344
|
+ $all = $Spotter->countAllCallsigns($limit, 0, '', $filters, $year, $month); |
|
345
|
345
|
} |
|
346
|
346
|
return $all; |
|
347
|
347
|
} |
|
348
|
|
- public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
|
348
|
+ public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
349
|
349
|
$Connection = new Connection(); |
|
350
|
350
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
351
|
351
|
if ($Connection->tableExists('countries')) { |
|
@@ -354,8 +354,8 @@ discard block |
|
|
block discarded – undo |
|
354
|
354
|
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"; |
|
355
|
355
|
try { |
|
356
|
356
|
$sth = $this->db->prepare($query); |
|
357
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
358
|
|
- } catch(PDOException $e) { |
|
|
357
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
|
358
|
+ } catch (PDOException $e) { |
|
359
|
359
|
echo "error : ".$e->getMessage(); |
|
360
|
360
|
} |
|
361
|
361
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -371,7 +371,7 @@ discard block |
|
|
block discarded – undo |
|
371
|
371
|
return array(); |
|
372
|
372
|
} |
|
373
|
373
|
} |
|
374
|
|
- public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') { |
|
|
374
|
+ public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
375
|
375
|
global $globalStatsFilters; |
|
376
|
376
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
377
|
377
|
if ($year == '' && $month == '') { |
|
@@ -379,8 +379,8 @@ discard block |
|
|
block discarded – undo |
|
379
|
379
|
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"; |
|
380
|
380
|
try { |
|
381
|
381
|
$sth = $this->db->prepare($query); |
|
382
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
383
|
|
- } catch(PDOException $e) { |
|
|
382
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
|
383
|
+ } catch (PDOException $e) { |
|
384
|
384
|
echo "error : ".$e->getMessage(); |
|
385
|
385
|
} |
|
386
|
386
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -388,15 +388,15 @@ discard block |
|
|
block discarded – undo |
|
388
|
388
|
if (empty($all)) { |
|
389
|
389
|
$filters = array('airlines' => array($stats_airline)); |
|
390
|
390
|
if ($filter_name != '') { |
|
391
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
391
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
392
|
392
|
} |
|
393
|
393
|
$Spotter = new Spotter($this->db); |
|
394
|
|
- $all = $Spotter->countAllPilots($limit,0,'',$filters,$year,$month); |
|
|
394
|
+ $all = $Spotter->countAllPilots($limit, 0, '', $filters, $year, $month); |
|
395
|
395
|
} |
|
396
|
396
|
return $all; |
|
397
|
397
|
} |
|
398
|
398
|
|
|
399
|
|
- public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') { |
|
|
399
|
+ public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
400
|
400
|
global $globalStatsFilters; |
|
401
|
401
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
402
|
402
|
if ($year == '' && $month == '') { |
|
@@ -404,8 +404,8 @@ discard block |
|
|
block discarded – undo |
|
404
|
404
|
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"; |
|
405
|
405
|
try { |
|
406
|
406
|
$sth = $this->db->prepare($query); |
|
407
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
408
|
|
- } catch(PDOException $e) { |
|
|
407
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
|
408
|
+ } catch (PDOException $e) { |
|
409
|
409
|
echo "error : ".$e->getMessage(); |
|
410
|
410
|
} |
|
411
|
411
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -413,14 +413,14 @@ discard block |
|
|
block discarded – undo |
|
413
|
413
|
if (empty($all)) { |
|
414
|
414
|
$filters = array('airlines' => array($stats_airline)); |
|
415
|
415
|
if ($filter_name != '') { |
|
416
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
416
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
417
|
417
|
} |
|
418
|
418
|
$Spotter = new Spotter($this->db); |
|
419
|
|
- $all = $Spotter->countAllOwners($limit,0,'',$filters,$year,$month); |
|
|
419
|
+ $all = $Spotter->countAllOwners($limit, 0, '', $filters, $year, $month); |
|
420
|
420
|
} |
|
421
|
421
|
return $all; |
|
422
|
422
|
} |
|
423
|
|
- public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
|
423
|
+ public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
424
|
424
|
global $globalStatsFilters; |
|
425
|
425
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
426
|
426
|
if ($year == '' && $month == '') { |
|
@@ -428,8 +428,8 @@ discard block |
|
|
block discarded – undo |
|
428
|
428
|
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 FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
429
|
429
|
try { |
|
430
|
430
|
$sth = $this->db->prepare($query); |
|
431
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
432
|
|
- } catch(PDOException $e) { |
|
|
431
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
|
432
|
+ } catch (PDOException $e) { |
|
433
|
433
|
echo "error : ".$e->getMessage(); |
|
434
|
434
|
} |
|
435
|
435
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -437,11 +437,11 @@ discard block |
|
|
block discarded – undo |
|
437
|
437
|
if (empty($all)) { |
|
438
|
438
|
$filters = array('airlines' => array($stats_airline)); |
|
439
|
439
|
if ($filter_name != '') { |
|
440
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
440
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
441
|
441
|
} |
|
442
|
442
|
$Spotter = new Spotter($this->db); |
|
443
|
|
- $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters,$year,$month); |
|
444
|
|
- $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters,$year,$month); |
|
|
443
|
+ $pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters, $year, $month); |
|
|
444
|
+ $dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters, $year, $month); |
|
445
|
445
|
$all = array(); |
|
446
|
446
|
foreach ($pall as $value) { |
|
447
|
447
|
$icao = $value['airport_departure_icao']; |
|
@@ -458,11 +458,11 @@ discard block |
|
|
block discarded – undo |
|
458
|
458
|
foreach ($all as $key => $row) { |
|
459
|
459
|
$count[$key] = $row['airport_departure_icao_count']; |
|
460
|
460
|
} |
|
461
|
|
- array_multisort($count,SORT_DESC,$all); |
|
|
461
|
+ array_multisort($count, SORT_DESC, $all); |
|
462
|
462
|
} |
|
463
|
463
|
return $all; |
|
464
|
464
|
} |
|
465
|
|
- public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
|
465
|
+ public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
466
|
466
|
global $globalStatsFilters; |
|
467
|
467
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
468
|
468
|
if ($year == '' && $month == '') { |
|
@@ -470,8 +470,8 @@ discard block |
|
|
block discarded – undo |
|
470
|
470
|
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 FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
471
|
471
|
try { |
|
472
|
472
|
$sth = $this->db->prepare($query); |
|
473
|
|
- $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
474
|
|
- } catch(PDOException $e) { |
|
|
473
|
+ $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
|
474
|
+ } catch (PDOException $e) { |
|
475
|
475
|
echo "error : ".$e->getMessage(); |
|
476
|
476
|
} |
|
477
|
477
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -479,11 +479,11 @@ discard block |
|
|
block discarded – undo |
|
479
|
479
|
if (empty($all)) { |
|
480
|
480
|
$filters = array('airlines' => array($stats_airline)); |
|
481
|
481
|
if ($filter_name != '') { |
|
482
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
482
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
483
|
483
|
} |
|
484
|
484
|
$Spotter = new Spotter($this->db); |
|
485
|
|
- $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters,$year,$month); |
|
486
|
|
- $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters,$year,$month); |
|
|
485
|
+ $pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters, $year, $month); |
|
|
486
|
+ $dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters, $year, $month); |
|
487
|
487
|
$all = array(); |
|
488
|
488
|
foreach ($pall as $value) { |
|
489
|
489
|
$icao = $value['airport_arrival_icao']; |
|
@@ -500,12 +500,12 @@ discard block |
|
|
block discarded – undo |
|
500
|
500
|
foreach ($all as $key => $row) { |
|
501
|
501
|
$count[$key] = $row['airport_arrival_icao_count']; |
|
502
|
502
|
} |
|
503
|
|
- array_multisort($count,SORT_DESC,$all); |
|
|
503
|
+ array_multisort($count, SORT_DESC, $all); |
|
504
|
504
|
} |
|
505
|
505
|
|
|
506
|
506
|
return $all; |
|
507
|
507
|
} |
|
508
|
|
- public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
|
|
508
|
+ public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') { |
|
509
|
509
|
global $globalDBdriver, $globalStatsFilters; |
|
510
|
510
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
511
|
511
|
if ($globalDBdriver == 'mysql') { |
|
@@ -515,18 +515,18 @@ discard block |
|
|
block discarded – undo |
|
515
|
515
|
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"; |
|
516
|
516
|
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"; |
|
517
|
517
|
} |
|
518
|
|
- $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
|
518
|
+ $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
519
|
519
|
try { |
|
520
|
520
|
$sth = $this->db->prepare($query); |
|
521
|
521
|
$sth->execute($query_data); |
|
522
|
|
- } catch(PDOException $e) { |
|
|
522
|
+ } catch (PDOException $e) { |
|
523
|
523
|
echo "error : ".$e->getMessage(); |
|
524
|
524
|
} |
|
525
|
525
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
526
|
526
|
if (empty($all)) { |
|
527
|
527
|
$filters = array('airlines' => array($stats_airline)); |
|
528
|
528
|
if ($filter_name != '') { |
|
529
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
529
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
530
|
530
|
} |
|
531
|
531
|
$Spotter = new Spotter($this->db); |
|
532
|
532
|
$all = $Spotter->countAllMonthsLastYear($filters); |
|
@@ -535,29 +535,29 @@ discard block |
|
|
block discarded – undo |
|
535
|
535
|
return $all; |
|
536
|
536
|
} |
|
537
|
537
|
|
|
538
|
|
- public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
|
|
538
|
+ public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') { |
|
539
|
539
|
global $globalStatsFilters; |
|
540
|
540
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
541
|
541
|
$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"; |
|
542
|
|
- $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
|
542
|
+ $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
543
|
543
|
try { |
|
544
|
544
|
$sth = $this->db->prepare($query); |
|
545
|
545
|
$sth->execute($query_data); |
|
546
|
|
- } catch(PDOException $e) { |
|
|
546
|
+ } catch (PDOException $e) { |
|
547
|
547
|
echo "error : ".$e->getMessage(); |
|
548
|
548
|
} |
|
549
|
549
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
550
|
550
|
if (empty($all)) { |
|
551
|
551
|
$filters = array('airlines' => array($stats_airline)); |
|
552
|
552
|
if ($filter_name != '') { |
|
553
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
553
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
554
|
554
|
} |
|
555
|
555
|
$Spotter = new Spotter($this->db); |
|
556
|
556
|
$all = $Spotter->countAllDatesLastMonth($filters); |
|
557
|
557
|
} |
|
558
|
558
|
return $all; |
|
559
|
559
|
} |
|
560
|
|
- public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
|
|
560
|
+ public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') { |
|
561
|
561
|
global $globalDBdriver, $globalStatsFilters; |
|
562
|
562
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
563
|
563
|
if ($globalDBdriver == 'mysql') { |
|
@@ -565,40 +565,40 @@ discard block |
|
|
block discarded – undo |
|
565
|
565
|
} else { |
|
566
|
566
|
$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"; |
|
567
|
567
|
} |
|
568
|
|
- $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
|
568
|
+ $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
569
|
569
|
try { |
|
570
|
570
|
$sth = $this->db->prepare($query); |
|
571
|
571
|
$sth->execute($query_data); |
|
572
|
|
- } catch(PDOException $e) { |
|
|
572
|
+ } catch (PDOException $e) { |
|
573
|
573
|
echo "error : ".$e->getMessage(); |
|
574
|
574
|
} |
|
575
|
575
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
576
|
576
|
if (empty($all)) { |
|
577
|
577
|
$filters = array('airlines' => array($stats_airline)); |
|
578
|
578
|
if ($filter_name != '') { |
|
579
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
579
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
580
|
580
|
} |
|
581
|
581
|
$Spotter = new Spotter($this->db); |
|
582
|
582
|
$all = $Spotter->countAllDatesLast7Days($filters); |
|
583
|
583
|
} |
|
584
|
584
|
return $all; |
|
585
|
585
|
} |
|
586
|
|
- public function countAllDates($stats_airline = '',$filter_name = '') { |
|
|
586
|
+ public function countAllDates($stats_airline = '', $filter_name = '') { |
|
587
|
587
|
global $globalStatsFilters; |
|
588
|
588
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
589
|
589
|
$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"; |
|
590
|
|
- $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
|
590
|
+ $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
591
|
591
|
try { |
|
592
|
592
|
$sth = $this->db->prepare($query); |
|
593
|
593
|
$sth->execute($query_data); |
|
594
|
|
- } catch(PDOException $e) { |
|
|
594
|
+ } catch (PDOException $e) { |
|
595
|
595
|
echo "error : ".$e->getMessage(); |
|
596
|
596
|
} |
|
597
|
597
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
598
|
598
|
if (empty($all)) { |
|
599
|
599
|
$filters = array('airlines' => array($stats_airline)); |
|
600
|
600
|
if ($filter_name != '') { |
|
601
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
601
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
602
|
602
|
} |
|
603
|
603
|
$Spotter = new Spotter($this->db); |
|
604
|
604
|
$all = $Spotter->countAllDates($filters); |
|
@@ -613,28 +613,28 @@ discard block |
|
|
block discarded – undo |
|
613
|
613
|
try { |
|
614
|
614
|
$sth = $this->db->prepare($query); |
|
615
|
615
|
$sth->execute($query_data); |
|
616
|
|
- } catch(PDOException $e) { |
|
|
616
|
+ } catch (PDOException $e) { |
|
617
|
617
|
echo "error : ".$e->getMessage(); |
|
618
|
618
|
} |
|
619
|
619
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
620
|
620
|
if (empty($all)) { |
|
621
|
621
|
$filters = array(); |
|
622
|
622
|
if ($filter_name != '') { |
|
623
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
623
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
624
|
624
|
} |
|
625
|
625
|
$Spotter = new Spotter($this->db); |
|
626
|
626
|
$all = $Spotter->countAllDatesByAirlines($filters); |
|
627
|
627
|
} |
|
628
|
628
|
return $all; |
|
629
|
629
|
} |
|
630
|
|
- public function countAllMonths($stats_airline = '',$filter_name = '') { |
|
|
630
|
+ public function countAllMonths($stats_airline = '', $filter_name = '') { |
|
631
|
631
|
global $globalStatsFilters; |
|
632
|
632
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
633
|
633
|
$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
634
|
634
|
try { |
|
635
|
635
|
$sth = $this->db->prepare($query); |
|
636
|
636
|
$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
637
|
|
- } catch(PDOException $e) { |
|
|
637
|
+ } catch (PDOException $e) { |
|
638
|
638
|
echo "error : ".$e->getMessage(); |
|
639
|
639
|
} |
|
640
|
640
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -642,7 +642,7 @@ discard block |
|
|
block discarded – undo |
|
642
|
642
|
if (empty($all)) { |
|
643
|
643
|
$filters = array('airlines' => array($stats_airline)); |
|
644
|
644
|
if ($filter_name != '') { |
|
645
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
645
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
646
|
646
|
} |
|
647
|
647
|
$Spotter = new Spotter($this->db); |
|
648
|
648
|
$all = $Spotter->countAllMonths($filters); |
|
@@ -657,21 +657,21 @@ discard block |
|
|
block discarded – undo |
|
657
|
657
|
try { |
|
658
|
658
|
$sth = $this->db->prepare($query); |
|
659
|
659
|
$sth->execute(array(':filter_name' => $filter_name)); |
|
660
|
|
- } catch(PDOException $e) { |
|
|
660
|
+ } catch (PDOException $e) { |
|
661
|
661
|
echo "error : ".$e->getMessage(); |
|
662
|
662
|
} |
|
663
|
663
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
664
|
664
|
if (empty($all)) { |
|
665
|
665
|
$filters = array(); |
|
666
|
666
|
if ($filter_name != '') { |
|
667
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
667
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
668
|
668
|
} |
|
669
|
669
|
$Spotter = new Spotter($this->db); |
|
670
|
670
|
$all = $Spotter->countAllMilitaryMonths($filters); |
|
671
|
671
|
} |
|
672
|
672
|
return $all; |
|
673
|
673
|
} |
|
674
|
|
- public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
|
|
674
|
+ public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') { |
|
675
|
675
|
global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
|
676
|
676
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
677
|
677
|
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"; |
|
@@ -688,91 +688,91 @@ discard block |
|
|
block discarded – undo |
|
688
|
688
|
try { |
|
689
|
689
|
$sth = $this->db->prepare($query); |
|
690
|
690
|
$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
691
|
|
- } catch(PDOException $e) { |
|
|
691
|
+ } catch (PDOException $e) { |
|
692
|
692
|
echo "error : ".$e->getMessage(); |
|
693
|
693
|
} |
|
694
|
694
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
695
|
695
|
if (empty($all)) { |
|
696
|
696
|
$filters = array('airlines' => array($stats_airline)); |
|
697
|
697
|
if ($filter_name != '') { |
|
698
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
698
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
699
|
699
|
} |
|
700
|
700
|
$Spotter = new Spotter($this->db); |
|
701
|
|
- $all = $Spotter->countAllHours($orderby,$filters); |
|
|
701
|
+ $all = $Spotter->countAllHours($orderby, $filters); |
|
702
|
702
|
} |
|
703
|
703
|
return $all; |
|
704
|
704
|
} |
|
705
|
705
|
|
|
706
|
|
- public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
|
|
706
|
+ public function countOverallFlights($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
707
|
707
|
global $globalStatsFilters; |
|
708
|
708
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
709
|
709
|
if ($year == '') $year = date('Y'); |
|
710
|
|
- $all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month); |
|
|
710
|
+ $all = $this->getSumStats('flights_bymonth', $year, $stats_airline, $filter_name, $month); |
|
711
|
711
|
if (empty($all)) { |
|
712
|
712
|
$filters = array('airlines' => array($stats_airline)); |
|
713
|
713
|
if ($filter_name != '') { |
|
714
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
714
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
715
|
715
|
} |
|
716
|
716
|
$Spotter = new Spotter($this->db); |
|
717
|
|
- $all = $Spotter->countOverallFlights($filters,$year,$month); |
|
|
717
|
+ $all = $Spotter->countOverallFlights($filters, $year, $month); |
|
718
|
718
|
} |
|
719
|
719
|
return $all; |
|
720
|
720
|
} |
|
721
|
|
- public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') { |
|
|
721
|
+ public function countOverallMilitaryFlights($filter_name = '', $year = '', $month = '') { |
|
722
|
722
|
global $globalStatsFilters; |
|
723
|
723
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
724
|
724
|
if ($year == '') $year = date('Y'); |
|
725
|
|
- $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
|
|
725
|
+ $all = $this->getSumStats('military_flights_bymonth', $year, '', $filter_name, $month); |
|
726
|
726
|
if (empty($all)) { |
|
727
|
727
|
$filters = array(); |
|
728
|
728
|
if ($filter_name != '') { |
|
729
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
729
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
730
|
730
|
} |
|
731
|
731
|
$Spotter = new Spotter($this->db); |
|
732
|
|
- $all = $Spotter->countOverallMilitaryFlights($filters,$year,$month); |
|
|
732
|
+ $all = $Spotter->countOverallMilitaryFlights($filters, $year, $month); |
|
733
|
733
|
} |
|
734
|
734
|
return $all; |
|
735
|
735
|
} |
|
736
|
|
- public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') { |
|
|
736
|
+ public function countOverallArrival($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
737
|
737
|
global $globalStatsFilters; |
|
738
|
738
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
739
|
739
|
if ($year == '') $year = date('Y'); |
|
740
|
|
- $all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month); |
|
|
740
|
+ $all = $this->getSumStats('realarrivals_bymonth', $year, $stats_airline, $filter_name, $month); |
|
741
|
741
|
if (empty($all)) { |
|
742
|
742
|
$filters = array('airlines' => array($stats_airline)); |
|
743
|
743
|
if ($filter_name != '') { |
|
744
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
744
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
745
|
745
|
} |
|
746
|
746
|
$Spotter = new Spotter($this->db); |
|
747
|
|
- $all = $Spotter->countOverallArrival($filters,$year,$month); |
|
|
747
|
+ $all = $Spotter->countOverallArrival($filters, $year, $month); |
|
748
|
748
|
} |
|
749
|
749
|
return $all; |
|
750
|
750
|
} |
|
751
|
|
- public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
|
|
751
|
+ public function countOverallAircrafts($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
752
|
752
|
global $globalStatsFilters; |
|
753
|
753
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
754
|
754
|
if ($year == '' && $month == '') { |
|
755
|
755
|
$query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
756
|
756
|
try { |
|
757
|
757
|
$sth = $this->db->prepare($query); |
|
758
|
|
- $sth->execute(array(':filter_name' => $filter_name,':stats_airline' => $stats_airline)); |
|
759
|
|
- } catch(PDOException $e) { |
|
|
758
|
+ $sth->execute(array(':filter_name' => $filter_name, ':stats_airline' => $stats_airline)); |
|
|
759
|
+ } catch (PDOException $e) { |
|
760
|
760
|
echo "error : ".$e->getMessage(); |
|
761
|
761
|
} |
|
762
|
762
|
$result = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
763
|
763
|
$all = $result[0]['nb']; |
|
764
|
|
- } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
|
764
|
+ } else $all = $this->getSumStats('aircrafts_bymonth', $year, $stats_airline, $filter_name, $month); |
|
765
|
765
|
if (empty($all)) { |
|
766
|
766
|
$filters = array('airlines' => array($stats_airline)); |
|
767
|
767
|
if ($filter_name != '') { |
|
768
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
768
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
769
|
769
|
} |
|
770
|
770
|
$Spotter = new Spotter($this->db); |
|
771
|
|
- $all = $Spotter->countOverallAircrafts($filters,$year,$month); |
|
|
771
|
+ $all = $Spotter->countOverallAircrafts($filters, $year, $month); |
|
772
|
772
|
} |
|
773
|
773
|
return $all; |
|
774
|
774
|
} |
|
775
|
|
- public function countOverallAirlines($filter_name = '',$year = '',$month = '') { |
|
|
775
|
+ public function countOverallAirlines($filter_name = '', $year = '', $month = '') { |
|
776
|
776
|
global $globalStatsFilters; |
|
777
|
777
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
778
|
778
|
if ($year == '' && $month == '') { |
|
@@ -780,23 +780,23 @@ discard block |
|
|
block discarded – undo |
|
780
|
780
|
try { |
|
781
|
781
|
$sth = $this->db->prepare($query); |
|
782
|
782
|
$sth->execute(array(':filter_name' => $filter_name)); |
|
783
|
|
- } catch(PDOException $e) { |
|
|
783
|
+ } catch (PDOException $e) { |
|
784
|
784
|
echo "error : ".$e->getMessage(); |
|
785
|
785
|
} |
|
786
|
786
|
$result = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
787
|
787
|
$all = $result[0]['nb_airline']; |
|
788
|
|
- } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
|
788
|
+ } else $all = $this->getSumStats('airlines_bymonth', $year, '', $filter_name, $month); |
|
789
|
789
|
if (empty($all)) { |
|
790
|
790
|
$filters = array(); |
|
791
|
791
|
if ($filter_name != '') { |
|
792
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
792
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
793
|
793
|
} |
|
794
|
794
|
$Spotter = new Spotter($this->db); |
|
795
|
|
- $all = $Spotter->countOverallAirlines($filters,$year,$month); |
|
|
795
|
+ $all = $Spotter->countOverallAirlines($filters, $year, $month); |
|
796
|
796
|
} |
|
797
|
797
|
return $all; |
|
798
|
798
|
} |
|
799
|
|
- public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
|
|
799
|
+ public function countOverallOwners($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
800
|
800
|
global $globalStatsFilters; |
|
801
|
801
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
802
|
802
|
if ($year == '' && $month == '') { |
|
@@ -805,25 +805,25 @@ discard block |
|
|
block discarded – undo |
|
805
|
805
|
try { |
|
806
|
806
|
$sth = $this->db->prepare($query); |
|
807
|
807
|
$sth->execute($query_values); |
|
808
|
|
- } catch(PDOException $e) { |
|
|
808
|
+ } catch (PDOException $e) { |
|
809
|
809
|
echo "error : ".$e->getMessage(); |
|
810
|
810
|
} |
|
811
|
811
|
$result = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
812
|
812
|
$all = $result[0]['nb']; |
|
813
|
813
|
} else { |
|
814
|
|
- $all = $this->getSumStats('owners_bymonth',$year,$stats_airline,$filter_name,$month); |
|
|
814
|
+ $all = $this->getSumStats('owners_bymonth', $year, $stats_airline, $filter_name, $month); |
|
815
|
815
|
} |
|
816
|
816
|
if (empty($all)) { |
|
817
|
817
|
$filters = array('airlines' => array($stats_airline)); |
|
818
|
818
|
if ($filter_name != '') { |
|
819
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
819
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
820
|
820
|
} |
|
821
|
821
|
$Spotter = new Spotter($this->db); |
|
822
|
|
- $all = $Spotter->countOverallOwners($filters,$year,$month); |
|
|
822
|
+ $all = $Spotter->countOverallOwners($filters, $year, $month); |
|
823
|
823
|
} |
|
824
|
824
|
return $all; |
|
825
|
825
|
} |
|
826
|
|
- public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
|
826
|
+ public function countOverallPilots($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
827
|
827
|
global $globalStatsFilters; |
|
828
|
828
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
829
|
829
|
//if ($year == '') $year = date('Y'); |
|
@@ -833,75 +833,75 @@ discard block |
|
|
block discarded – undo |
|
833
|
833
|
try { |
|
834
|
834
|
$sth = $this->db->prepare($query); |
|
835
|
835
|
$sth->execute($query_values); |
|
836
|
|
- } catch(PDOException $e) { |
|
|
836
|
+ } catch (PDOException $e) { |
|
837
|
837
|
echo "error : ".$e->getMessage(); |
|
838
|
838
|
} |
|
839
|
839
|
$result = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
840
|
840
|
$all = $result[0]['nb']; |
|
841
|
841
|
} else { |
|
842
|
|
- $all = $this->getSumStats('pilots_bymonth',$year,$stats_airline,$filter_name,$month); |
|
|
842
|
+ $all = $this->getSumStats('pilots_bymonth', $year, $stats_airline, $filter_name, $month); |
|
843
|
843
|
} |
|
844
|
844
|
if (empty($all)) { |
|
845
|
845
|
$filters = array('airlines' => array($stats_airline)); |
|
846
|
846
|
if ($filter_name != '') { |
|
847
|
|
- $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
|
847
|
+ $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
848
|
848
|
} |
|
849
|
849
|
$Spotter = new Spotter($this->db); |
|
850
|
|
- $all = $Spotter->countOverallPilots($filters,$year,$month); |
|
|
850
|
+ $all = $Spotter->countOverallPilots($filters, $year, $month); |
|
851
|
851
|
} |
|
852
|
852
|
return $all; |
|
853
|
853
|
} |
|
854
|
854
|
|
|
855
|
|
- public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
|
|
855
|
+ public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') { |
|
856
|
856
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
857
|
857
|
$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"; |
|
858
|
|
- $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
|
858
|
+ $query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
859
|
859
|
try { |
|
860
|
860
|
$sth = $this->db->prepare($query); |
|
861
|
861
|
$sth->execute($query_values); |
|
862
|
|
- } catch(PDOException $e) { |
|
|
862
|
+ } catch (PDOException $e) { |
|
863
|
863
|
echo "error : ".$e->getMessage(); |
|
864
|
864
|
} |
|
865
|
865
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
866
|
866
|
return $all; |
|
867
|
867
|
} |
|
868
|
|
- public function getStats($type,$stats_airline = '', $filter_name = '') { |
|
|
868
|
+ public function getStats($type, $stats_airline = '', $filter_name = '') { |
|
869
|
869
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
870
|
870
|
$query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
|
871
|
|
- $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
|
871
|
+ $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
872
|
872
|
try { |
|
873
|
873
|
$sth = $this->db->prepare($query); |
|
874
|
874
|
$sth->execute($query_values); |
|
875
|
|
- } catch(PDOException $e) { |
|
|
875
|
+ } catch (PDOException $e) { |
|
876
|
876
|
echo "error : ".$e->getMessage(); |
|
877
|
877
|
} |
|
878
|
878
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
879
|
879
|
return $all; |
|
880
|
880
|
} |
|
881
|
|
- public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
|
|
881
|
+ public function getSumStats($type, $year, $stats_airline = '', $filter_name = '', $month = '') { |
|
882
|
882
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
883
|
883
|
global $globalArchiveMonths, $globalDBdriver; |
|
884
|
884
|
if ($globalDBdriver == 'mysql') { |
|
885
|
885
|
if ($month == '') { |
|
886
|
886
|
$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"; |
|
887
|
|
- $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
|
887
|
+ $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
888
|
888
|
} else { |
|
889
|
889
|
$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"; |
|
890
|
|
- $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month); |
|
|
890
|
+ $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month); |
|
891
|
891
|
} |
|
892
|
892
|
} else { |
|
893
|
893
|
if ($month == '') { |
|
894
|
894
|
$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"; |
|
895
|
|
- $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
|
895
|
+ $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
896
|
896
|
} else { |
|
897
|
897
|
$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"; |
|
898
|
|
- $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month); |
|
|
898
|
+ $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month); |
|
899
|
899
|
} |
|
900
|
900
|
} |
|
901
|
901
|
try { |
|
902
|
902
|
$sth = $this->db->prepare($query); |
|
903
|
903
|
$sth->execute($query_values); |
|
904
|
|
- } catch(PDOException $e) { |
|
|
904
|
+ } catch (PDOException $e) { |
|
905
|
905
|
echo "error : ".$e->getMessage(); |
|
906
|
906
|
} |
|
907
|
907
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -919,7 +919,7 @@ discard block |
|
|
block discarded – undo |
|
919
|
919
|
try { |
|
920
|
920
|
$sth = $this->db->prepare($query); |
|
921
|
921
|
$sth->execute($query_values); |
|
922
|
|
- } catch(PDOException $e) { |
|
|
922
|
+ } catch (PDOException $e) { |
|
923
|
923
|
echo "error : ".$e->getMessage(); |
|
924
|
924
|
} |
|
925
|
925
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -936,7 +936,7 @@ discard block |
|
|
block discarded – undo |
|
936
|
936
|
try { |
|
937
|
937
|
$sth = $this->db->prepare($query); |
|
938
|
938
|
$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
939
|
|
- } catch(PDOException $e) { |
|
|
939
|
+ } catch (PDOException $e) { |
|
940
|
940
|
echo "error : ".$e->getMessage(); |
|
941
|
941
|
} |
|
942
|
942
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -953,7 +953,7 @@ discard block |
|
|
block discarded – undo |
|
953
|
953
|
try { |
|
954
|
954
|
$sth = $this->db->prepare($query); |
|
955
|
955
|
$sth->execute(array(':filter_name' => $filter_name)); |
|
956
|
|
- } catch(PDOException $e) { |
|
|
956
|
+ } catch (PDOException $e) { |
|
957
|
957
|
echo "error : ".$e->getMessage(); |
|
958
|
958
|
} |
|
959
|
959
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -970,7 +970,7 @@ discard block |
|
|
block discarded – undo |
|
970
|
970
|
try { |
|
971
|
971
|
$sth = $this->db->prepare($query); |
|
972
|
972
|
$sth->execute(array(':filter_name' => $filter_name)); |
|
973
|
|
- } catch(PDOException $e) { |
|
|
973
|
+ } catch (PDOException $e) { |
|
974
|
974
|
echo "error : ".$e->getMessage(); |
|
975
|
975
|
} |
|
976
|
976
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
@@ -987,14 +987,14 @@ discard block |
|
|
block discarded – undo |
|
987
|
987
|
try { |
|
988
|
988
|
$sth = $this->db->prepare($query); |
|
989
|
989
|
$sth->execute(array(':filter_name' => $filter_name)); |
|
990
|
|
- } catch(PDOException $e) { |
|
|
990
|
+ } catch (PDOException $e) { |
|
991
|
991
|
echo "error : ".$e->getMessage(); |
|
992
|
992
|
} |
|
993
|
993
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
994
|
994
|
return $all[0]['total']; |
|
995
|
995
|
} |
|
996
|
996
|
|
|
997
|
|
- public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
|
997
|
+ public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
998
|
998
|
global $globalDBdriver; |
|
999
|
999
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
1000
|
1000
|
if ($globalDBdriver == 'mysql') { |
|
@@ -1002,15 +1002,15 @@ discard block |
|
|
block discarded – undo |
|
1002
|
1002
|
} else { |
|
1003
|
1003
|
$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);"; |
|
1004
|
1004
|
} |
|
1005
|
|
- $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
|
1005
|
+ $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1006
|
1006
|
try { |
|
1007
|
1007
|
$sth = $this->db->prepare($query); |
|
1008
|
1008
|
$sth->execute($query_values); |
|
1009
|
|
- } catch(PDOException $e) { |
|
|
1009
|
+ } catch (PDOException $e) { |
|
1010
|
1010
|
return "error : ".$e->getMessage(); |
|
1011
|
1011
|
} |
|
1012
|
1012
|
} |
|
1013
|
|
- public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
|
1013
|
+ public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
1014
|
1014
|
global $globalDBdriver; |
|
1015
|
1015
|
if ($filter_name == '') $filter_name = $this->filter_name; |
|
1016
|
1016
|
if ($globalDBdriver == 'mysql') { |
|
@@ -1019,11 +1019,11 @@ discard block |
|
|
block discarded – undo |
|
1019
|
1019
|
//$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
|
1020
|
1020
|
$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);"; |
|
1021
|
1021
|
} |
|
1022
|
|
- $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
|
1022
|
+ $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1023
|
1023
|
try { |
|
1024
|
1024
|
$sth = $this->db->prepare($query); |
|
1025
|
1025
|
$sth->execute($query_values); |
|
1026
|
|
- } catch(PDOException $e) { |
|
|
1026
|
+ } catch (PDOException $e) { |
|
1027
|
1027
|
return "error : ".$e->getMessage(); |
|
1028
|
1028
|
} |
|
1029
|
1029
|
} |
|
@@ -1047,75 +1047,75 @@ discard block |
|
|
block discarded – undo |
|
1047
|
1047
|
} |
|
1048
|
1048
|
*/ |
|
1049
|
1049
|
|
|
1050
|
|
- public function getStatsSource($stats_type,$year = '',$month = '',$day = '') { |
|
|
1050
|
+ public function getStatsSource($stats_type, $year = '', $month = '', $day = '') { |
|
1051
|
1051
|
global $globalDBdriver; |
|
1052
|
1052
|
$query = "SELECT * FROM stats_source WHERE stats_type = :stats_type"; |
|
1053
|
1053
|
$query_values = array(); |
|
1054
|
1054
|
if ($globalDBdriver == 'mysql') { |
|
1055
|
1055
|
if ($year != '') { |
|
1056
|
1056
|
$query .= ' AND YEAR(stats_date) = :year'; |
|
1057
|
|
- $query_values = array_merge($query_values,array(':year' => $year)); |
|
|
1057
|
+ $query_values = array_merge($query_values, array(':year' => $year)); |
|
1058
|
1058
|
} |
|
1059
|
1059
|
if ($month != '') { |
|
1060
|
1060
|
$query .= ' AND MONTH(stats_date) = :month'; |
|
1061
|
|
- $query_values = array_merge($query_values,array(':month' => $month)); |
|
|
1061
|
+ $query_values = array_merge($query_values, array(':month' => $month)); |
|
1062
|
1062
|
} |
|
1063
|
1063
|
if ($day != '') { |
|
1064
|
1064
|
$query .= ' AND DAY(stats_date) = :day'; |
|
1065
|
|
- $query_values = array_merge($query_values,array(':day' => $day)); |
|
|
1065
|
+ $query_values = array_merge($query_values, array(':day' => $day)); |
|
1066
|
1066
|
} |
|
1067
|
1067
|
} else { |
|
1068
|
1068
|
if ($year != '') { |
|
1069
|
1069
|
$query .= ' AND EXTRACT(YEAR FROM stats_date) = :year'; |
|
1070
|
|
- $query_values = array_merge($query_values,array(':year' => $year)); |
|
|
1070
|
+ $query_values = array_merge($query_values, array(':year' => $year)); |
|
1071
|
1071
|
} |
|
1072
|
1072
|
if ($month != '') { |
|
1073
|
1073
|
$query .= ' AND EXTRACT(MONTH FROM stats_date) = :month'; |
|
1074
|
|
- $query_values = array_merge($query_values,array(':month' => $month)); |
|
|
1074
|
+ $query_values = array_merge($query_values, array(':month' => $month)); |
|
1075
|
1075
|
} |
|
1076
|
1076
|
if ($day != '') { |
|
1077
|
1077
|
$query .= ' AND EXTRACT(DAY FROM stats_date) = :day'; |
|
1078
|
|
- $query_values = array_merge($query_values,array(':day' => $day)); |
|
|
1078
|
+ $query_values = array_merge($query_values, array(':day' => $day)); |
|
1079
|
1079
|
} |
|
1080
|
1080
|
} |
|
1081
|
1081
|
$query .= " ORDER BY source_name"; |
|
1082
|
|
- $query_values = array_merge($query_values,array(':stats_type' => $stats_type)); |
|
|
1082
|
+ $query_values = array_merge($query_values, array(':stats_type' => $stats_type)); |
|
1083
|
1083
|
try { |
|
1084
|
1084
|
$sth = $this->db->prepare($query); |
|
1085
|
1085
|
$sth->execute($query_values); |
|
1086
|
|
- } catch(PDOException $e) { |
|
|
1086
|
+ } catch (PDOException $e) { |
|
1087
|
1087
|
echo "error : ".$e->getMessage(); |
|
1088
|
1088
|
} |
|
1089
|
1089
|
$all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
1090
|
1090
|
return $all; |
|
1091
|
1091
|
} |
|
1092
|
1092
|
|
|
1093
|
|
- public function addStatSource($data,$source_name,$stats_type,$date) { |
|
|
1093
|
+ public function addStatSource($data, $source_name, $stats_type, $date) { |
|
1094
|
1094
|
global $globalDBdriver; |
|
1095
|
1095
|
if ($globalDBdriver == 'mysql') { |
|
1096
|
1096
|
$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"; |
|
1097
|
1097
|
} else { |
|
1098
|
1098
|
$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);"; |
|
1099
|
1099
|
} |
|
1100
|
|
- $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
|
1100
|
+ $query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type); |
|
1101
|
1101
|
try { |
|
1102
|
1102
|
$sth = $this->db->prepare($query); |
|
1103
|
1103
|
$sth->execute($query_values); |
|
1104
|
|
- } catch(PDOException $e) { |
|
|
1104
|
+ } catch (PDOException $e) { |
|
1105
|
1105
|
return "error : ".$e->getMessage(); |
|
1106
|
1106
|
} |
|
1107
|
1107
|
} |
|
1108
|
|
- public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
|
|
1108
|
+ public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') { |
|
1109
|
1109
|
$query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
|
1110
|
|
- $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
|
1110
|
+ $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1111
|
1111
|
try { |
|
1112
|
1112
|
$sth = $this->db->prepare($query); |
|
1113
|
1113
|
$sth->execute($query_values); |
|
1114
|
|
- } catch(PDOException $e) { |
|
|
1114
|
+ } catch (PDOException $e) { |
|
1115
|
1115
|
return "error : ".$e->getMessage(); |
|
1116
|
1116
|
} |
|
1117
|
1117
|
} |
|
1118
|
|
- public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '',$reset = false) { |
|
|
1118
|
+ public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
1119
|
1119
|
global $globalDBdriver; |
|
1120
|
1120
|
if ($globalDBdriver == 'mysql') { |
|
1121
|
1121
|
if ($reset) { |
|
@@ -1130,15 +1130,15 @@ discard block |
|
|
block discarded – undo |
|
1130
|
1130
|
$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);"; |
|
1131
|
1131
|
} |
|
1132
|
1132
|
} |
|
1133
|
|
- $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
|
1133
|
+ $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1134
|
1134
|
try { |
|
1135
|
1135
|
$sth = $this->db->prepare($query); |
|
1136
|
1136
|
$sth->execute($query_values); |
|
1137
|
|
- } catch(PDOException $e) { |
|
|
1137
|
+ } catch (PDOException $e) { |
|
1138
|
1138
|
return "error : ".$e->getMessage(); |
|
1139
|
1139
|
} |
|
1140
|
1140
|
} |
|
1141
|
|
- public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '', $reset = false) { |
|
|
1141
|
+ public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1142
|
1142
|
global $globalDBdriver; |
|
1143
|
1143
|
if ($globalDBdriver == 'mysql') { |
|
1144
|
1144
|
if ($reset) { |
|
@@ -1153,15 +1153,15 @@ discard block |
|
|
block discarded – undo |
|
1153
|
1153
|
$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);"; |
|
1154
|
1154
|
} |
|
1155
|
1155
|
} |
|
1156
|
|
- $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
|
1156
|
+ $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1157
|
1157
|
try { |
|
1158
|
1158
|
$sth = $this->db->prepare($query); |
|
1159
|
1159
|
$sth->execute($query_values); |
|
1160
|
|
- } catch(PDOException $e) { |
|
|
1160
|
+ } catch (PDOException $e) { |
|
1161
|
1161
|
return "error : ".$e->getMessage(); |
|
1162
|
1162
|
} |
|
1163
|
1163
|
} |
|
1164
|
|
- public function addStatCountry($iso2,$iso3,$name,$cnt,$airline_icao = '',$filter_name = '',$reset = false) { |
|
|
1164
|
+ public function addStatCountry($iso2, $iso3, $name, $cnt, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1165
|
1165
|
global $globalDBdriver; |
|
1166
|
1166
|
if ($globalDBdriver == 'mysql') { |
|
1167
|
1167
|
if ($reset) { |
|
@@ -1176,15 +1176,15 @@ discard block |
|
|
block discarded – undo |
|
1176
|
1176
|
$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);"; |
|
1177
|
1177
|
} |
|
1178
|
1178
|
} |
|
1179
|
|
- $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name,':airline' => $airline_icao); |
|
|
1179
|
+ $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name, ':airline' => $airline_icao); |
|
1180
|
1180
|
try { |
|
1181
|
1181
|
$sth = $this->db->prepare($query); |
|
1182
|
1182
|
$sth->execute($query_values); |
|
1183
|
|
- } catch(PDOException $e) { |
|
|
1183
|
+ } catch (PDOException $e) { |
|
1184
|
1184
|
return "error : ".$e->getMessage(); |
|
1185
|
1185
|
} |
|
1186
|
1186
|
} |
|
1187
|
|
- public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
|
1187
|
+ public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
1188
|
1188
|
global $globalDBdriver; |
|
1189
|
1189
|
if ($globalDBdriver == 'mysql') { |
|
1190
|
1190
|
if ($reset) { |
|
@@ -1199,15 +1199,15 @@ discard block |
|
|
block discarded – undo |
|
1199
|
1199
|
$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);"; |
|
1200
|
1200
|
} |
|
1201
|
1201
|
} |
|
1202
|
|
- $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); |
|
|
1202
|
+ $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); |
|
1203
|
1203
|
try { |
|
1204
|
1204
|
$sth = $this->db->prepare($query); |
|
1205
|
1205
|
$sth->execute($query_values); |
|
1206
|
|
- } catch(PDOException $e) { |
|
|
1206
|
+ } catch (PDOException $e) { |
|
1207
|
1207
|
return "error : ".$e->getMessage(); |
|
1208
|
1208
|
} |
|
1209
|
1209
|
} |
|
1210
|
|
- public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '', $reset = false) { |
|
|
1210
|
+ public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '', $reset = false) { |
|
1211
|
1211
|
global $globalDBdriver; |
|
1212
|
1212
|
if ($globalDBdriver == 'mysql') { |
|
1213
|
1213
|
if ($reset) { |
|
@@ -1222,15 +1222,15 @@ discard block |
|
|
block discarded – undo |
|
1222
|
1222
|
$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);"; |
|
1223
|
1223
|
} |
|
1224
|
1224
|
} |
|
1225
|
|
- $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
|
1225
|
+ $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1226
|
1226
|
try { |
|
1227
|
1227
|
$sth = $this->db->prepare($query); |
|
1228
|
1228
|
$sth->execute($query_values); |
|
1229
|
|
- } catch(PDOException $e) { |
|
|
1229
|
+ } catch (PDOException $e) { |
|
1230
|
1230
|
return "error : ".$e->getMessage(); |
|
1231
|
1231
|
} |
|
1232
|
1232
|
} |
|
1233
|
|
- public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '', $reset = false) { |
|
|
1233
|
+ public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '', $reset = false) { |
|
1234
|
1234
|
global $globalDBdriver; |
|
1235
|
1235
|
if ($globalDBdriver == 'mysql') { |
|
1236
|
1236
|
if ($reset) { |
|
@@ -1245,15 +1245,15 @@ discard block |
|
|
block discarded – undo |
|
1245
|
1245
|
$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);"; |
|
1246
|
1246
|
} |
|
1247
|
1247
|
} |
|
1248
|
|
- $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
|
1248
|
+ $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1249
|
1249
|
try { |
|
1250
|
1250
|
$sth = $this->db->prepare($query); |
|
1251
|
1251
|
$sth->execute($query_values); |
|
1252
|
|
- } catch(PDOException $e) { |
|
|
1252
|
+ } catch (PDOException $e) { |
|
1253
|
1253
|
return "error : ".$e->getMessage(); |
|
1254
|
1254
|
} |
|
1255
|
1255
|
} |
|
1256
|
|
- public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '',$reset = false) { |
|
|
1256
|
+ public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '', $format_source = '', $reset = false) { |
|
1257
|
1257
|
global $globalDBdriver; |
|
1258
|
1258
|
if ($globalDBdriver == 'mysql') { |
|
1259
|
1259
|
if ($reset) { |
|
@@ -1268,15 +1268,15 @@ discard block |
|
|
block discarded – undo |
|
1268
|
1268
|
$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);"; |
|
1269
|
1269
|
} |
|
1270
|
1270
|
} |
|
1271
|
|
- $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); |
|
|
1271
|
+ $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); |
|
1272
|
1272
|
try { |
|
1273
|
1273
|
$sth = $this->db->prepare($query); |
|
1274
|
1274
|
$sth->execute($query_values); |
|
1275
|
|
- } catch(PDOException $e) { |
|
|
1275
|
+ } catch (PDOException $e) { |
|
1276
|
1276
|
return "error : ".$e->getMessage(); |
|
1277
|
1277
|
} |
|
1278
|
1278
|
} |
|
1279
|
|
- public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '',$reset = false) { |
|
|
1279
|
+ public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1280
|
1280
|
global $globalDBdriver; |
|
1281
|
1281
|
if ($airport_icao != '') { |
|
1282
|
1282
|
if ($globalDBdriver == 'mysql') { |
|
@@ -1292,16 +1292,16 @@ discard block |
|
|
block discarded – undo |
|
1292
|
1292
|
$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);"; |
|
1293
|
1293
|
} |
|
1294
|
1294
|
} |
|
1295
|
|
- $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); |
|
|
1295
|
+ $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); |
|
1296
|
1296
|
try { |
|
1297
|
1297
|
$sth = $this->db->prepare($query); |
|
1298
|
1298
|
$sth->execute($query_values); |
|
1299
|
|
- } catch(PDOException $e) { |
|
|
1299
|
+ } catch (PDOException $e) { |
|
1300
|
1300
|
return "error : ".$e->getMessage(); |
|
1301
|
1301
|
} |
|
1302
|
1302
|
} |
|
1303
|
1303
|
} |
|
1304
|
|
- public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
|
|
1304
|
+ public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') { |
|
1305
|
1305
|
global $globalDBdriver; |
|
1306
|
1306
|
if ($airport_icao != '') { |
|
1307
|
1307
|
if ($globalDBdriver == 'mysql') { |
|
@@ -1309,16 +1309,16 @@ discard block |
|
|
block discarded – undo |
|
1309
|
1309
|
} else { |
|
1310
|
1310
|
$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);"; |
|
1311
|
1311
|
} |
|
1312
|
|
- $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); |
|
|
1312
|
+ $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); |
|
1313
|
1313
|
try { |
|
1314
|
1314
|
$sth = $this->db->prepare($query); |
|
1315
|
1315
|
$sth->execute($query_values); |
|
1316
|
|
- } catch(PDOException $e) { |
|
|
1316
|
+ } catch (PDOException $e) { |
|
1317
|
1317
|
return "error : ".$e->getMessage(); |
|
1318
|
1318
|
} |
|
1319
|
1319
|
} |
|
1320
|
1320
|
} |
|
1321
|
|
- public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '',$reset = false) { |
|
|
1321
|
+ public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1322
|
1322
|
global $globalDBdriver; |
|
1323
|
1323
|
if ($airport_icao != '') { |
|
1324
|
1324
|
if ($globalDBdriver == 'mysql') { |
|
@@ -1334,16 +1334,16 @@ discard block |
|
|
block discarded – undo |
|
1334
|
1334
|
$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);"; |
|
1335
|
1335
|
} |
|
1336
|
1336
|
} |
|
1337
|
|
- $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); |
|
|
1337
|
+ $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); |
|
1338
|
1338
|
try { |
|
1339
|
1339
|
$sth = $this->db->prepare($query); |
|
1340
|
1340
|
$sth->execute($query_values); |
|
1341
|
|
- } catch(PDOException $e) { |
|
|
1341
|
+ } catch (PDOException $e) { |
|
1342
|
1342
|
return "error : ".$e->getMessage(); |
|
1343
|
1343
|
} |
|
1344
|
1344
|
} |
|
1345
|
1345
|
} |
|
1346
|
|
- public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
|
|
1346
|
+ public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') { |
|
1347
|
1347
|
global $globalDBdriver; |
|
1348
|
1348
|
if ($airport_icao != '') { |
|
1349
|
1349
|
if ($globalDBdriver == 'mysql') { |
|
@@ -1351,11 +1351,11 @@ discard block |
|
|
block discarded – undo |
|
1351
|
1351
|
} else { |
|
1352
|
1352
|
$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);"; |
|
1353
|
1353
|
} |
|
1354
|
|
- $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); |
|
|
1354
|
+ $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); |
|
1355
|
1355
|
try { |
|
1356
|
1356
|
$sth = $this->db->prepare($query); |
|
1357
|
1357
|
$sth->execute($query_values); |
|
1358
|
|
- } catch(PDOException $e) { |
|
|
1358
|
+ } catch (PDOException $e) { |
|
1359
|
1359
|
return "error : ".$e->getMessage(); |
|
1360
|
1360
|
} |
|
1361
|
1361
|
} |
|
@@ -1367,7 +1367,7 @@ discard block |
|
|
block discarded – undo |
|
1367
|
1367
|
try { |
|
1368
|
1368
|
$sth = $this->db->prepare($query); |
|
1369
|
1369
|
$sth->execute($query_values); |
|
1370
|
|
- } catch(PDOException $e) { |
|
|
1370
|
+ } catch (PDOException $e) { |
|
1371
|
1371
|
return "error : ".$e->getMessage(); |
|
1372
|
1372
|
} |
|
1373
|
1373
|
} |
|
@@ -1377,7 +1377,7 @@ discard block |
|
|
block discarded – undo |
|
1377
|
1377
|
try { |
|
1378
|
1378
|
$sth = $this->db->prepare($query); |
|
1379
|
1379
|
$sth->execute($query_values); |
|
1380
|
|
- } catch(PDOException $e) { |
|
|
1380
|
+ } catch (PDOException $e) { |
|
1381
|
1381
|
return "error : ".$e->getMessage(); |
|
1382
|
1382
|
} |
|
1383
|
1383
|
} |
|
@@ -1387,13 +1387,13 @@ discard block |
|
|
block discarded – undo |
|
1387
|
1387
|
try { |
|
1388
|
1388
|
$sth = $this->db->prepare($query); |
|
1389
|
1389
|
$sth->execute($query_values); |
|
1390
|
|
- } catch(PDOException $e) { |
|
|
1390
|
+ } catch (PDOException $e) { |
|
1391
|
1391
|
return "error : ".$e->getMessage(); |
|
1392
|
1392
|
} |
|
1393
|
1393
|
} |
|
1394
|
1394
|
|
|
1395
|
1395
|
public function addOldStats() { |
|
1396
|
|
- global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear; |
|
|
1396
|
+ global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters, $globalDeleteLastYearStats, $globalStatsReset, $globalStatsResetYear; |
|
1397
|
1397
|
$Common = new Common(); |
|
1398
|
1398
|
$Connection = new Connection(); |
|
1399
|
1399
|
date_default_timezone_set('UTC'); |
|
@@ -1410,40 +1410,40 @@ discard block |
|
|
block discarded – undo |
|
1410
|
1410
|
$Spotter = new Spotter($this->db); |
|
1411
|
1411
|
|
|
1412
|
1412
|
if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
|
1413
|
|
- $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
|
|
1413
|
+ $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day); |
|
1414
|
1414
|
foreach ($alldata as $number) { |
|
1415
|
|
- $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset); |
|
|
1415
|
+ $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', '', $reset); |
|
1416
|
1416
|
} |
|
1417
|
1417
|
if ($globalDebug) echo 'Count all airlines...'."\n"; |
|
1418
|
|
- $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
|
|
1418
|
+ $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day); |
|
1419
|
1419
|
foreach ($alldata as $number) { |
|
1420
|
|
- $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset); |
|
|
1420
|
+ $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], '', $reset); |
|
1421
|
1421
|
} |
|
1422
|
1422
|
if ($globalDebug) echo 'Count all registrations...'."\n"; |
|
1423
|
|
- $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
|
|
1423
|
+ $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day); |
|
1424
|
1424
|
foreach ($alldata as $number) { |
|
1425
|
|
- $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset); |
|
|
1425
|
+ $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', '', $reset); |
|
1426
|
1426
|
} |
|
1427
|
1427
|
if ($globalDebug) echo 'Count all callsigns...'."\n"; |
|
1428
|
|
- $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
|
|
1428
|
+ $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day); |
|
1429
|
1429
|
foreach ($alldata as $number) { |
|
1430
|
|
- $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
|
|
1430
|
+ $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset); |
|
1431
|
1431
|
} |
|
1432
|
1432
|
if ($globalDebug) echo 'Count all owners...'."\n"; |
|
1433
|
|
- $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
|
|
1433
|
+ $alldata = $Spotter->countAllOwners(false, 0, $last_update_day); |
|
1434
|
1434
|
foreach ($alldata as $number) { |
|
1435
|
|
- $this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset); |
|
|
1435
|
+ $this->addStatOwner($number['owner_name'], $number['owner_count'], '', '', $reset); |
|
1436
|
1436
|
} |
|
1437
|
1437
|
if ($globalDebug) echo 'Count all pilots...'."\n"; |
|
1438
|
|
- $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
|
|
1438
|
+ $alldata = $Spotter->countAllPilots(false, 0, $last_update_day); |
|
1439
|
1439
|
foreach ($alldata as $number) { |
|
1440
|
|
- $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset); |
|
|
1440
|
+ $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', '', $number['format_source'], $reset); |
|
1441
|
1441
|
} |
|
1442
|
1442
|
|
|
1443
|
1443
|
if ($globalDebug) echo 'Count all departure airports...'."\n"; |
|
1444
|
|
- $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
|
|
1444
|
+ $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day); |
|
1445
|
1445
|
if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
|
1446
|
|
- $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
|
1446
|
+ $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day); |
|
1447
|
1447
|
if ($globalDebug) echo 'Order departure airports...'."\n"; |
|
1448
|
1448
|
$alldata = array(); |
|
1449
|
1449
|
|
|
@@ -1461,14 +1461,14 @@ discard block |
|
|
block discarded – undo |
|
1461
|
1461
|
foreach ($alldata as $key => $row) { |
|
1462
|
1462
|
$count[$key] = $row['airport_departure_icao_count']; |
|
1463
|
1463
|
} |
|
1464
|
|
- array_multisort($count,SORT_DESC,$alldata); |
|
|
1464
|
+ array_multisort($count, SORT_DESC, $alldata); |
|
1465
|
1465
|
foreach ($alldata as $number) { |
|
1466
|
|
- 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); |
|
|
1466
|
+ 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); |
|
1467
|
1467
|
} |
|
1468
|
1468
|
if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
|
1469
|
|
- $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
|
|
1469
|
+ $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day); |
|
1470
|
1470
|
if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
|
1471
|
|
- $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
|
1471
|
+ $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day); |
|
1472
|
1472
|
if ($globalDebug) echo 'Order arrival airports...'."\n"; |
|
1473
|
1473
|
$alldata = array(); |
|
1474
|
1474
|
foreach ($pall as $value) { |
|
@@ -1485,16 +1485,16 @@ discard block |
|
|
block discarded – undo |
|
1485
|
1485
|
foreach ($alldata as $key => $row) { |
|
1486
|
1486
|
$count[$key] = $row['airport_arrival_icao_count']; |
|
1487
|
1487
|
} |
|
1488
|
|
- array_multisort($count,SORT_DESC,$alldata); |
|
|
1488
|
+ array_multisort($count, SORT_DESC, $alldata); |
|
1489
|
1489
|
foreach ($alldata as $number) { |
|
1490
|
|
- 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); |
|
|
1490
|
+ 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); |
|
1491
|
1491
|
} |
|
1492
|
1492
|
if ($Connection->tableExists('countries')) { |
|
1493
|
1493
|
if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
|
1494
|
1494
|
$SpotterArchive = new SpotterArchive(); |
|
1495
|
|
- $alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
|
|
1495
|
+ $alldata = $SpotterArchive->countAllFlightOverCountries(false, 0, $last_update_day); |
|
1496
|
1496
|
foreach ($alldata as $number) { |
|
1497
|
|
- $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],'','',$reset); |
|
|
1497
|
+ $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], '', '', $reset); |
|
1498
|
1498
|
} |
|
1499
|
1499
|
} |
|
1500
|
1500
|
|
|
@@ -1508,37 +1508,37 @@ discard block |
|
|
block discarded – undo |
|
1508
|
1508
|
$lastyear = false; |
|
1509
|
1509
|
foreach ($alldata as $number) { |
|
1510
|
1510
|
if ($number['year_name'] != date('Y')) $lastyear = true; |
|
1511
|
|
- $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']))); |
|
|
1511
|
+ $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']))); |
|
1512
|
1512
|
} |
|
1513
|
1513
|
if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
|
1514
|
1514
|
$alldata = $Spotter->countAllMilitaryMonths(); |
|
1515
|
1515
|
foreach ($alldata as $number) { |
|
1516
|
|
- $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']))); |
|
|
1516
|
+ $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']))); |
|
1517
|
1517
|
} |
|
1518
|
1518
|
if ($globalDebug) echo 'Count all owners by months...'."\n"; |
|
1519
|
1519
|
$alldata = $Spotter->countAllMonthsOwners(); |
|
1520
|
1520
|
foreach ($alldata as $number) { |
|
1521
|
|
- $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']))); |
|
|
1521
|
+ $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']))); |
|
1522
|
1522
|
} |
|
1523
|
1523
|
if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
|
1524
|
1524
|
$alldata = $Spotter->countAllMonthsPilots(); |
|
1525
|
1525
|
foreach ($alldata as $number) { |
|
1526
|
|
- $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']))); |
|
|
1526
|
+ $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']))); |
|
1527
|
1527
|
} |
|
1528
|
1528
|
if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
|
1529
|
1529
|
$alldata = $Spotter->countAllMonthsAirlines(); |
|
1530
|
1530
|
foreach ($alldata as $number) { |
|
1531
|
|
- $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']))); |
|
|
1531
|
+ $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']))); |
|
1532
|
1532
|
} |
|
1533
|
1533
|
if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
|
1534
|
1534
|
$alldata = $Spotter->countAllMonthsAircrafts(); |
|
1535
|
1535
|
foreach ($alldata as $number) { |
|
1536
|
|
- $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']))); |
|
|
1536
|
+ $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']))); |
|
1537
|
1537
|
} |
|
1538
|
1538
|
if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
|
1539
|
1539
|
$alldata = $Spotter->countAllMonthsRealArrivals(); |
|
1540
|
1540
|
foreach ($alldata as $number) { |
|
1541
|
|
- $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']))); |
|
|
1541
|
+ $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']))); |
|
1542
|
1542
|
} |
|
1543
|
1543
|
if ($globalDebug) echo 'Airports data...'."\n"; |
|
1544
|
1544
|
if ($globalDebug) echo '...Departure'."\n"; |
|
@@ -1583,7 +1583,7 @@ discard block |
|
|
block discarded – undo |
|
1583
|
1583
|
} |
|
1584
|
1584
|
$alldata = $pall; |
|
1585
|
1585
|
foreach ($alldata as $number) { |
|
1586
|
|
- $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']); |
|
|
1586
|
+ $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']); |
|
1587
|
1587
|
} |
|
1588
|
1588
|
echo '...Arrival'."\n"; |
|
1589
|
1589
|
$pall = $Spotter->getLast7DaysAirportsArrival(); |
|
@@ -1625,7 +1625,7 @@ discard block |
|
|
block discarded – undo |
|
1625
|
1625
|
} |
|
1626
|
1626
|
$alldata = $pall; |
|
1627
|
1627
|
foreach ($alldata as $number) { |
|
1628
|
|
- $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']); |
|
|
1628
|
+ $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']); |
|
1629
|
1629
|
} |
|
1630
|
1630
|
|
|
1631
|
1631
|
echo 'Flights data...'."\n"; |
|
@@ -1633,28 +1633,28 @@ discard block |
|
|
block discarded – undo |
|
1633
|
1633
|
echo '-> countAllDatesLastMonth...'."\n"; |
|
1634
|
1634
|
$alldata = $Spotter->countAllDatesLastMonth(); |
|
1635
|
1635
|
foreach ($alldata as $number) { |
|
1636
|
|
- $this->addStatFlight('month',$number['date_name'],$number['date_count']); |
|
|
1636
|
+ $this->addStatFlight('month', $number['date_name'], $number['date_count']); |
|
1637
|
1637
|
} |
|
1638
|
1638
|
echo '-> countAllDates...'."\n"; |
|
1639
|
1639
|
$previousdata = $this->countAllDates(); |
|
1640
|
1640
|
$previousdatabyairlines = $this->countAllDatesByAirlines(); |
|
1641
|
1641
|
$this->deleteStatFlight('date'); |
|
1642
|
|
- $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates()); |
|
|
1642
|
+ $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates()); |
|
1643
|
1643
|
$values = array(); |
|
1644
|
1644
|
foreach ($alldata as $cnt) { |
|
1645
|
1645
|
$values[] = $cnt['date_count']; |
|
1646
|
1646
|
} |
|
1647
|
|
- array_multisort($values,SORT_DESC,$alldata); |
|
1648
|
|
- array_splice($alldata,11); |
|
|
1647
|
+ array_multisort($values, SORT_DESC, $alldata); |
|
|
1648
|
+ array_splice($alldata, 11); |
|
1649
|
1649
|
foreach ($alldata as $number) { |
|
1650
|
|
- $this->addStatFlight('date',$number['date_name'],$number['date_count']); |
|
|
1650
|
+ $this->addStatFlight('date', $number['date_name'], $number['date_count']); |
|
1651
|
1651
|
} |
|
1652
|
1652
|
|
|
1653
|
1653
|
$this->deleteStatFlight('hour'); |
|
1654
|
1654
|
echo '-> countAllHours...'."\n"; |
|
1655
|
1655
|
$alldata = $Spotter->countAllHours('hour'); |
|
1656
|
1656
|
foreach ($alldata as $number) { |
|
1657
|
|
- $this->addStatFlight('hour',$number['hour_name'],$number['hour_count']); |
|
|
1657
|
+ $this->addStatFlight('hour', $number['hour_name'], $number['hour_count']); |
|
1658
|
1658
|
} |
|
1659
|
1659
|
|
|
1660
|
1660
|
|
|
@@ -1664,41 +1664,41 @@ discard block |
|
|
block discarded – undo |
|
1664
|
1664
|
if ($Connection->tableExists('countries')) { |
|
1665
|
1665
|
if ($globalDebug) echo 'Count all flights by countries by airlines...'."\n"; |
|
1666
|
1666
|
$SpotterArchive = new SpotterArchive(); |
|
1667
|
|
- $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
|
|
1667
|
+ $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false, 0, $last_update_day); |
|
1668
|
1668
|
foreach ($alldata as $number) { |
|
1669
|
|
- $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],$number['airline_icao'],'',$reset); |
|
|
1669
|
+ $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], $number['airline_icao'], '', $reset); |
|
1670
|
1670
|
} |
|
1671
|
1671
|
} |
|
1672
|
1672
|
if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
|
1673
|
1673
|
$Spotter = new Spotter($this->db); |
|
1674
|
|
- $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
|
|
1674
|
+ $alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day); |
|
1675
|
1675
|
foreach ($alldata as $number) { |
|
1676
|
|
- $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset); |
|
|
1676
|
+ $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao'], '', $reset); |
|
1677
|
1677
|
} |
|
1678
|
1678
|
if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
|
1679
|
|
- $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
|
|
1679
|
+ $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day); |
|
1680
|
1680
|
foreach ($alldata as $number) { |
|
1681
|
|
- $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset); |
|
|
1681
|
+ $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao'], '', $reset); |
|
1682
|
1682
|
} |
|
1683
|
1683
|
if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
|
1684
|
|
- $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
|
|
1684
|
+ $alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day); |
|
1685
|
1685
|
foreach ($alldata as $number) { |
|
1686
|
|
- $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
|
|
1686
|
+ $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset); |
|
1687
|
1687
|
} |
|
1688
|
1688
|
if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
|
1689
|
|
- $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
|
|
1689
|
+ $alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day); |
|
1690
|
1690
|
foreach ($alldata as $number) { |
|
1691
|
|
- $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset); |
|
|
1691
|
+ $this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao'], '', $reset); |
|
1692
|
1692
|
} |
|
1693
|
1693
|
if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
|
1694
|
|
- $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
|
|
1694
|
+ $alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day); |
|
1695
|
1695
|
foreach ($alldata as $number) { |
|
1696
|
|
- $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset); |
|
|
1696
|
+ $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao'], '', $number['format_source'], $reset); |
|
1697
|
1697
|
} |
|
1698
|
1698
|
if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
|
1699
|
|
- $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
|
|
1699
|
+ $pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
1700
|
1700
|
if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
|
1701
|
|
- $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
|
1701
|
+ $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
1702
|
1702
|
if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
|
1703
|
1703
|
//$alldata = array(); |
|
1704
|
1704
|
foreach ($dall as $value) { |
|
@@ -1718,12 +1718,12 @@ discard block |
|
|
block discarded – undo |
|
1718
|
1718
|
} |
|
1719
|
1719
|
$alldata = $pall; |
|
1720
|
1720
|
foreach ($alldata as $number) { |
|
1721
|
|
- 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); |
|
|
1721
|
+ 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); |
|
1722
|
1722
|
} |
|
1723
|
1723
|
if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
|
1724
|
|
- $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
|
|
1724
|
+ $pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
1725
|
1725
|
if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
|
1726
|
|
- $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
|
1726
|
+ $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
1727
|
1727
|
if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
|
1728
|
1728
|
//$alldata = array(); |
|
1729
|
1729
|
foreach ($dall as $value) { |
|
@@ -1743,7 +1743,7 @@ discard block |
|
|
block discarded – undo |
|
1743
|
1743
|
} |
|
1744
|
1744
|
$alldata = $pall; |
|
1745
|
1745
|
foreach ($alldata as $number) { |
|
1746
|
|
- 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); |
|
|
1746
|
+ 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); |
|
1747
|
1747
|
} |
|
1748
|
1748
|
if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
|
1749
|
1749
|
$Spotter = new Spotter($this->db); |
|
@@ -1751,27 +1751,27 @@ discard block |
|
|
block discarded – undo |
|
1751
|
1751
|
$lastyear = false; |
|
1752
|
1752
|
foreach ($alldata as $number) { |
|
1753
|
1753
|
if ($number['year_name'] != date('Y')) $lastyear = true; |
|
1754
|
|
- $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']); |
|
|
1754
|
+ $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']); |
|
1755
|
1755
|
} |
|
1756
|
1756
|
if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
|
1757
|
1757
|
$alldata = $Spotter->countAllMonthsOwnersByAirlines(); |
|
1758
|
1758
|
foreach ($alldata as $number) { |
|
1759
|
|
- $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']); |
|
|
1759
|
+ $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']); |
|
1760
|
1760
|
} |
|
1761
|
1761
|
if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
|
1762
|
1762
|
$alldata = $Spotter->countAllMonthsPilotsByAirlines(); |
|
1763
|
1763
|
foreach ($alldata as $number) { |
|
1764
|
|
- $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']); |
|
|
1764
|
+ $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']); |
|
1765
|
1765
|
} |
|
1766
|
1766
|
if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
|
1767
|
1767
|
$alldata = $Spotter->countAllMonthsAircraftsByAirlines(); |
|
1768
|
1768
|
foreach ($alldata as $number) { |
|
1769
|
|
- $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']); |
|
|
1769
|
+ $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']); |
|
1770
|
1770
|
} |
|
1771
|
1771
|
if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
|
1772
|
1772
|
$alldata = $Spotter->countAllMonthsRealArrivalsByAirlines(); |
|
1773
|
1773
|
foreach ($alldata as $number) { |
|
1774
|
|
- $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']); |
|
|
1774
|
+ $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']); |
|
1775
|
1775
|
} |
|
1776
|
1776
|
if ($globalDebug) echo '...Departure'."\n"; |
|
1777
|
1777
|
$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
|
@@ -1794,7 +1794,7 @@ discard block |
|
|
block discarded – undo |
|
1794
|
1794
|
} |
|
1795
|
1795
|
$alldata = $pall; |
|
1796
|
1796
|
foreach ($alldata as $number) { |
|
1797
|
|
- $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']); |
|
|
1797
|
+ $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']); |
|
1798
|
1798
|
} |
|
1799
|
1799
|
if ($globalDebug) echo '...Arrival'."\n"; |
|
1800
|
1800
|
$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
|
@@ -1817,32 +1817,32 @@ discard block |
|
|
block discarded – undo |
|
1817
|
1817
|
} |
|
1818
|
1818
|
$alldata = $pall; |
|
1819
|
1819
|
foreach ($alldata as $number) { |
|
1820
|
|
- $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']); |
|
|
1820
|
+ $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']); |
|
1821
|
1821
|
} |
|
1822
|
1822
|
|
|
1823
|
1823
|
if ($globalDebug) echo 'Flights data...'."\n"; |
|
1824
|
1824
|
if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
|
1825
|
1825
|
$alldata = $Spotter->countAllDatesLastMonthByAirlines(); |
|
1826
|
1826
|
foreach ($alldata as $number) { |
|
1827
|
|
- $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
|
|
1827
|
+ $this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
1828
|
1828
|
} |
|
1829
|
1829
|
if ($globalDebug) echo '-> countAllDates...'."\n"; |
|
1830
|
1830
|
//$previousdata = $this->countAllDatesByAirlines(); |
|
1831
|
|
- $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines()); |
|
|
1831
|
+ $alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines()); |
|
1832
|
1832
|
$values = array(); |
|
1833
|
1833
|
foreach ($alldata as $cnt) { |
|
1834
|
1834
|
$values[] = $cnt['date_count']; |
|
1835
|
1835
|
} |
|
1836
|
|
- array_multisort($values,SORT_DESC,$alldata); |
|
1837
|
|
- array_splice($alldata,11); |
|
|
1836
|
+ array_multisort($values, SORT_DESC, $alldata); |
|
|
1837
|
+ array_splice($alldata, 11); |
|
1838
|
1838
|
foreach ($alldata as $number) { |
|
1839
|
|
- $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
|
|
1839
|
+ $this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
1840
|
1840
|
} |
|
1841
|
1841
|
|
|
1842
|
1842
|
if ($globalDebug) echo '-> countAllHours...'."\n"; |
|
1843
|
1843
|
$alldata = $Spotter->countAllHoursByAirlines('hour'); |
|
1844
|
1844
|
foreach ($alldata as $number) { |
|
1845
|
|
- $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
|
|
1845
|
+ $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']); |
|
1846
|
1846
|
} |
|
1847
|
1847
|
|
|
1848
|
1848
|
|
|
@@ -1861,32 +1861,32 @@ discard block |
|
|
block discarded – undo |
|
1861
|
1861
|
// Count by filter |
|
1862
|
1862
|
if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
1863
|
1863
|
$Spotter = new Spotter($this->db); |
|
1864
|
|
- $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
|
|
1864
|
+ $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter); |
|
1865
|
1865
|
foreach ($alldata as $number) { |
|
1866
|
|
- $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name,$reset); |
|
|
1866
|
+ $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name, $reset); |
|
1867
|
1867
|
} |
|
1868
|
|
- $alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter); |
|
|
1868
|
+ $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day, $filter); |
|
1869
|
1869
|
foreach ($alldata as $number) { |
|
1870
|
|
- $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name,$reset); |
|
|
1870
|
+ $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], $filter_name, $reset); |
|
1871
|
1871
|
} |
|
1872
|
|
- $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter); |
|
|
1872
|
+ $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter); |
|
1873
|
1873
|
foreach ($alldata as $number) { |
|
1874
|
|
- $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name,$reset); |
|
|
1874
|
+ $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name, $reset); |
|
1875
|
1875
|
} |
|
1876
|
|
- $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter); |
|
|
1876
|
+ $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter); |
|
1877
|
1877
|
foreach ($alldata as $number) { |
|
1878
|
|
- $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name,$reset); |
|
|
1878
|
+ $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name, $reset); |
|
1879
|
1879
|
} |
|
1880
|
|
- $alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter); |
|
|
1880
|
+ $alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter); |
|
1881
|
1881
|
foreach ($alldata as $number) { |
|
1882
|
|
- $this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name,$reset); |
|
|
1882
|
+ $this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name, $reset); |
|
1883
|
1883
|
} |
|
1884
|
|
- $alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter); |
|
|
1884
|
+ $alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter); |
|
1885
|
1885
|
foreach ($alldata as $number) { |
|
1886
|
|
- $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source'],$reset); |
|
|
1886
|
+ $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name, $number['format_source'], $reset); |
|
1887
|
1887
|
} |
|
1888
|
|
- $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
|
1889
|
|
- $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
|
1888
|
+ $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter); |
|
|
1889
|
+ $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter); |
|
1890
|
1890
|
$alldata = array(); |
|
1891
|
1891
|
foreach ($pall as $value) { |
|
1892
|
1892
|
$icao = $value['airport_departure_icao']; |
|
@@ -1902,12 +1902,12 @@ discard block |
|
|
block discarded – undo |
|
1902
|
1902
|
foreach ($alldata as $key => $row) { |
|
1903
|
1903
|
$count[$key] = $row['airport_departure_icao_count']; |
|
1904
|
1904
|
} |
|
1905
|
|
- array_multisort($count,SORT_DESC,$alldata); |
|
|
1905
|
+ array_multisort($count, SORT_DESC, $alldata); |
|
1906
|
1906
|
foreach ($alldata as $number) { |
|
1907
|
|
- 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); |
|
|
1907
|
+ 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); |
|
1908
|
1908
|
} |
|
1909
|
|
- $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter); |
|
1910
|
|
- $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter); |
|
|
1909
|
+ $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, false, $filter); |
|
|
1910
|
+ $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, false, $filter); |
|
1911
|
1911
|
$alldata = array(); |
|
1912
|
1912
|
foreach ($pall as $value) { |
|
1913
|
1913
|
$icao = $value['airport_arrival_icao']; |
|
@@ -1923,40 +1923,40 @@ discard block |
|
|
block discarded – undo |
|
1923
|
1923
|
foreach ($alldata as $key => $row) { |
|
1924
|
1924
|
$count[$key] = $row['airport_arrival_icao_count']; |
|
1925
|
1925
|
} |
|
1926
|
|
- array_multisort($count,SORT_DESC,$alldata); |
|
|
1926
|
+ array_multisort($count, SORT_DESC, $alldata); |
|
1927
|
1927
|
foreach ($alldata as $number) { |
|
1928
|
|
- 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); |
|
|
1928
|
+ 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); |
|
1929
|
1929
|
} |
|
1930
|
1930
|
$Spotter = new Spotter($this->db); |
|
1931
|
1931
|
$alldata = $Spotter->countAllMonths($filter); |
|
1932
|
1932
|
$lastyear = false; |
|
1933
|
1933
|
foreach ($alldata as $number) { |
|
1934
|
1934
|
if ($number['year_name'] != date('Y')) $lastyear = true; |
|
1935
|
|
- $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); |
|
|
1935
|
+ $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); |
|
1936
|
1936
|
} |
|
1937
|
1937
|
$alldata = $Spotter->countAllMonthsOwners($filter); |
|
1938
|
1938
|
foreach ($alldata as $number) { |
|
1939
|
|
- $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); |
|
|
1939
|
+ $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); |
|
1940
|
1940
|
} |
|
1941
|
1941
|
$alldata = $Spotter->countAllMonthsPilots($filter); |
|
1942
|
1942
|
foreach ($alldata as $number) { |
|
1943
|
|
- $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); |
|
|
1943
|
+ $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); |
|
1944
|
1944
|
} |
|
1945
|
1945
|
$alldata = $Spotter->countAllMilitaryMonths($filter); |
|
1946
|
1946
|
foreach ($alldata as $number) { |
|
1947
|
|
- $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); |
|
|
1947
|
+ $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); |
|
1948
|
1948
|
} |
|
1949
|
1949
|
$alldata = $Spotter->countAllMonthsAircrafts($filter); |
|
1950
|
1950
|
foreach ($alldata as $number) { |
|
1951
|
|
- $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); |
|
|
1951
|
+ $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); |
|
1952
|
1952
|
} |
|
1953
|
1953
|
$alldata = $Spotter->countAllMonthsRealArrivals($filter); |
|
1954
|
1954
|
foreach ($alldata as $number) { |
|
1955
|
|
- $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); |
|
|
1955
|
+ $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); |
|
1956
|
1956
|
} |
|
1957
|
1957
|
echo '...Departure'."\n"; |
|
1958
|
|
- $pall = $Spotter->getLast7DaysAirportsDeparture('',$filter); |
|
1959
|
|
- $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
|
1958
|
+ $pall = $Spotter->getLast7DaysAirportsDeparture('', $filter); |
|
|
1959
|
+ $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter); |
|
1960
|
1960
|
foreach ($dall as $value) { |
|
1961
|
1961
|
$icao = $value['departure_airport_icao']; |
|
1962
|
1962
|
$ddate = $value['date']; |
|
@@ -1974,11 +1974,11 @@ discard block |
|
|
block discarded – undo |
|
1974
|
1974
|
} |
|
1975
|
1975
|
$alldata = $pall; |
|
1976
|
1976
|
foreach ($alldata as $number) { |
|
1977
|
|
- $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); |
|
|
1977
|
+ $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); |
|
1978
|
1978
|
} |
|
1979
|
1979
|
echo '...Arrival'."\n"; |
|
1980
|
|
- $pall = $Spotter->getLast7DaysAirportsArrival('',$filter); |
|
1981
|
|
- $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
|
1980
|
+ $pall = $Spotter->getLast7DaysAirportsArrival('', $filter); |
|
|
1981
|
+ $dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter); |
|
1982
|
1982
|
foreach ($dall as $value) { |
|
1983
|
1983
|
$icao = $value['arrival_airport_icao']; |
|
1984
|
1984
|
$ddate = $value['date']; |
|
@@ -1996,40 +1996,40 @@ discard block |
|
|
block discarded – undo |
|
1996
|
1996
|
} |
|
1997
|
1997
|
$alldata = $pall; |
|
1998
|
1998
|
foreach ($alldata as $number) { |
|
1999
|
|
- $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); |
|
|
1999
|
+ $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); |
|
2000
|
2000
|
} |
|
2001
|
2001
|
|
|
2002
|
2002
|
echo 'Flights data...'."\n"; |
|
2003
|
2003
|
echo '-> countAllDatesLastMonth...'."\n"; |
|
2004
|
2004
|
$alldata = $Spotter->countAllDatesLastMonth($filter); |
|
2005
|
2005
|
foreach ($alldata as $number) { |
|
2006
|
|
- $this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name); |
|
|
2006
|
+ $this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name); |
|
2007
|
2007
|
} |
|
2008
|
2008
|
echo '-> countAllDates...'."\n"; |
|
2009
|
|
- $previousdata = $this->countAllDates('',$filter_name); |
|
2010
|
|
- $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter)); |
|
|
2009
|
+ $previousdata = $this->countAllDates('', $filter_name); |
|
|
2010
|
+ $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter)); |
|
2011
|
2011
|
$values = array(); |
|
2012
|
2012
|
foreach ($alldata as $cnt) { |
|
2013
|
2013
|
$values[] = $cnt['date_count']; |
|
2014
|
2014
|
} |
|
2015
|
|
- array_multisort($values,SORT_DESC,$alldata); |
|
2016
|
|
- array_splice($alldata,11); |
|
|
2015
|
+ array_multisort($values, SORT_DESC, $alldata); |
|
|
2016
|
+ array_splice($alldata, 11); |
|
2017
|
2017
|
foreach ($alldata as $number) { |
|
2018
|
|
- $this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name); |
|
|
2018
|
+ $this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name); |
|
2019
|
2019
|
} |
|
2020
|
2020
|
|
|
2021
|
2021
|
echo '-> countAllHours...'."\n"; |
|
2022
|
|
- $alldata = $Spotter->countAllHours('hour',$filter); |
|
|
2022
|
+ $alldata = $Spotter->countAllHours('hour', $filter); |
|
2023
|
2023
|
foreach ($alldata as $number) { |
|
2024
|
|
- $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name); |
|
|
2024
|
+ $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name); |
|
2025
|
2025
|
} |
|
2026
|
2026
|
echo 'Insert last stats update date...'."\n"; |
|
2027
|
2027
|
date_default_timezone_set('UTC'); |
|
2028
|
|
- $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y-m-d G:i:s')); |
|
|
2028
|
+ $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y-m-d G:i:s')); |
|
2029
|
2029
|
if (isset($filter['DeleteLastYearStats']) && $filter['DeleteLastYearStats'] == true) { |
|
2030
|
|
- if (date('Y',strtotime($last_update_day)) != date('Y')) { |
|
|
2030
|
+ if (date('Y', strtotime($last_update_day)) != date('Y')) { |
|
2031
|
2031
|
$this->deleteOldStats($filter_name); |
|
2032
|
|
- $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y').'-01-01 00:00:00'); |
|
|
2032
|
+ $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y').'-01-01 00:00:00'); |
|
2033
|
2033
|
} |
|
2034
|
2034
|
} |
|
2035
|
2035
|
|
|
@@ -2042,16 +2042,16 @@ discard block |
|
|
block discarded – undo |
|
2042
|
2042
|
// SUM all previous month to put as year |
|
2043
|
2043
|
$previous_year = date('Y'); |
|
2044
|
2044
|
$previous_year--; |
|
2045
|
|
- $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2046
|
|
- $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2047
|
|
- $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2048
|
|
- $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
|
2045
|
+ $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
|
2046
|
+ $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
|
2047
|
+ $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
|
2048
|
+ $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2049
|
2049
|
$allairlines = $this->getAllAirlineNames(); |
|
2050
|
2050
|
foreach ($allairlines as $data) { |
|
2051
|
|
- $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2052
|
|
- $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2053
|
|
- $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2054
|
|
- $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
|
2051
|
+ $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
|
2052
|
+ $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
|
2053
|
+ $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
|
2054
|
+ $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2055
|
2055
|
} |
|
2056
|
2056
|
|
|
2057
|
2057
|
if (isset($globalArchiveYear) && $globalArchiveYear) { |
|
@@ -2060,7 +2060,7 @@ discard block |
|
|
block discarded – undo |
|
2060
|
2060
|
try { |
|
2061
|
2061
|
$sth = $this->db->prepare($query); |
|
2062
|
2062
|
$sth->execute(); |
|
2063
|
|
- } catch(PDOException $e) { |
|
|
2063
|
+ } catch (PDOException $e) { |
|
2064
|
2064
|
return "error : ".$e->getMessage().' - query : '.$query."\n"; |
|
2065
|
2065
|
} |
|
2066
|
2066
|
} |
|
@@ -2069,15 +2069,15 @@ discard block |
|
|
block discarded – undo |
|
2069
|
2069
|
try { |
|
2070
|
2070
|
$sth = $this->db->prepare($query); |
|
2071
|
2071
|
$sth->execute(); |
|
2072
|
|
- } catch(PDOException $e) { |
|
|
2072
|
+ } catch (PDOException $e) { |
|
2073
|
2073
|
return "error : ".$e->getMessage().' - query : '.$query."\n"; |
|
2074
|
2074
|
} |
|
2075
|
2075
|
} |
|
2076
|
2076
|
if (isset($globalDeleteLastYearStats) && $globalDeleteLastYearStats) { |
|
2077
|
2077
|
$last_update = $this->getLastStatsUpdate('last_update_stats'); |
|
2078
|
|
- if (date('Y',strtotime($last_update[0]['value'])) != date('Y')) { |
|
|
2078
|
+ if (date('Y', strtotime($last_update[0]['value'])) != date('Y')) { |
|
2079
|
2079
|
$this->deleteOldStats(); |
|
2080
|
|
- $this->addLastStatsUpdate('last_update_stats',date('Y').'-01-01 00:00:00'); |
|
|
2080
|
+ $this->addLastStatsUpdate('last_update_stats', date('Y').'-01-01 00:00:00'); |
|
2081
|
2081
|
$lastyearupdate = true; |
|
2082
|
2082
|
} |
|
2083
|
2083
|
} |
|
@@ -2099,7 +2099,7 @@ discard block |
|
|
block discarded – undo |
|
2099
|
2099
|
try { |
|
2100
|
2100
|
$sth = $this->db->prepare($query); |
|
2101
|
2101
|
$sth->execute(); |
|
2102
|
|
- } catch(PDOException $e) { |
|
|
2102
|
+ } catch (PDOException $e) { |
|
2103
|
2103
|
return "error : ".$e->getMessage(); |
|
2104
|
2104
|
} |
|
2105
|
2105
|
} |
|
@@ -2113,14 +2113,14 @@ discard block |
|
|
block discarded – undo |
|
2113
|
2113
|
try { |
|
2114
|
2114
|
$sth = $this->db->prepare($query); |
|
2115
|
2115
|
$sth->execute(); |
|
2116
|
|
- } catch(PDOException $e) { |
|
|
2116
|
+ } catch (PDOException $e) { |
|
2117
|
2117
|
return "error : ".$e->getMessage(); |
|
2118
|
2118
|
} |
|
2119
|
2119
|
} |
|
2120
|
2120
|
if (!isset($lastyearupdate)) { |
|
2121
|
2121
|
echo 'Insert last stats update date...'."\n"; |
|
2122
|
2122
|
date_default_timezone_set('UTC'); |
|
2123
|
|
- $this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s')); |
|
|
2123
|
+ $this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s')); |
|
2124
|
2124
|
} |
|
2125
|
2125
|
if ($globalStatsResetYear) { |
|
2126
|
2126
|
require_once(dirname(__FILE__).'/../install/class.settings.php'); |