@@ -15,33 +15,33 @@ discard block |
||
15 | 15 | if (isset($globalFilterName)) $this->filter_name = $globalFilterName; |
16 | 16 | $Connection = new Connection($dbc); |
17 | 17 | $this->db = $Connection->db(); |
18 | - } |
|
18 | + } |
|
19 | 19 | |
20 | 20 | public function addLastStatsUpdate($type,$stats_date) { |
21 | - $query = "DELETE FROM config WHERE name = :type; |
|
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); |
|
24 | - try { |
|
25 | - $sth = $this->db->prepare($query); |
|
26 | - $sth->execute($query_values); |
|
27 | - } catch(PDOException $e) { |
|
28 | - return "error : ".$e->getMessage(); |
|
29 | - } |
|
30 | - } |
|
23 | + $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
24 | + try { |
|
25 | + $sth = $this->db->prepare($query); |
|
26 | + $sth->execute($query_values); |
|
27 | + } catch(PDOException $e) { |
|
28 | + return "error : ".$e->getMessage(); |
|
29 | + } |
|
30 | + } |
|
31 | 31 | |
32 | 32 | public function getLastStatsUpdate($type = 'last_update_stats') { |
33 | - $query = "SELECT value FROM config WHERE name = :type"; |
|
34 | - try { |
|
35 | - $sth = $this->db->prepare($query); |
|
36 | - $sth->execute(array(':type' => $type)); |
|
37 | - } catch(PDOException $e) { |
|
38 | - echo "error : ".$e->getMessage(); |
|
39 | - } |
|
40 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
41 | - return $all; |
|
42 | - } |
|
43 | - public function deleteStats($filter_name = '') { |
|
44 | - /* |
|
33 | + $query = "SELECT value FROM config WHERE name = :type"; |
|
34 | + try { |
|
35 | + $sth = $this->db->prepare($query); |
|
36 | + $sth->execute(array(':type' => $type)); |
|
37 | + } catch(PDOException $e) { |
|
38 | + echo "error : ".$e->getMessage(); |
|
39 | + } |
|
40 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
41 | + return $all; |
|
42 | + } |
|
43 | + public function deleteStats($filter_name = '') { |
|
44 | + /* |
|
45 | 45 | $query = "DELETE FROM config WHERE name = 'last_update_stats'"; |
46 | 46 | try { |
47 | 47 | $sth = $this->db->prepare($query); |
@@ -50,62 +50,62 @@ discard block |
||
50 | 50 | return "error : ".$e->getMessage(); |
51 | 51 | } |
52 | 52 | */ |
53 | - $query = "DELETE FROM stats WHERE filter_name = :filter_name;DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_airport WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_flight WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;"; |
|
54 | - try { |
|
55 | - $sth = $this->db->prepare($query); |
|
56 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
57 | - } catch(PDOException $e) { |
|
58 | - return "error : ".$e->getMessage(); |
|
59 | - } |
|
60 | - } |
|
53 | + $query = "DELETE FROM stats WHERE filter_name = :filter_name;DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_airport WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_flight WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;"; |
|
54 | + try { |
|
55 | + $sth = $this->db->prepare($query); |
|
56 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
57 | + } catch(PDOException $e) { |
|
58 | + return "error : ".$e->getMessage(); |
|
59 | + } |
|
60 | + } |
|
61 | 61 | public function getAllAirlineNames($filter_name = '') { |
62 | 62 | if ($filter_name == '') $filter_name = $this->filter_name; |
63 | - $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
|
64 | - try { |
|
65 | - $sth = $this->db->prepare($query); |
|
66 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
67 | - } catch(PDOException $e) { |
|
68 | - echo "error : ".$e->getMessage(); |
|
69 | - } |
|
70 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
71 | - return $all; |
|
72 | - } |
|
63 | + $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
|
64 | + try { |
|
65 | + $sth = $this->db->prepare($query); |
|
66 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
67 | + } catch(PDOException $e) { |
|
68 | + echo "error : ".$e->getMessage(); |
|
69 | + } |
|
70 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
71 | + return $all; |
|
72 | + } |
|
73 | 73 | public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
74 | 74 | if ($filter_name == '') $filter_name = $this->filter_name; |
75 | - $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
|
76 | - try { |
|
77 | - $sth = $this->db->prepare($query); |
|
78 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
79 | - } catch(PDOException $e) { |
|
80 | - echo "error : ".$e->getMessage(); |
|
81 | - } |
|
82 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
83 | - return $all; |
|
84 | - } |
|
75 | + $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
|
76 | + try { |
|
77 | + $sth = $this->db->prepare($query); |
|
78 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
79 | + } catch(PDOException $e) { |
|
80 | + echo "error : ".$e->getMessage(); |
|
81 | + } |
|
82 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
83 | + return $all; |
|
84 | + } |
|
85 | 85 | public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
86 | 86 | if ($filter_name == '') $filter_name = $this->filter_name; |
87 | - $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"; |
|
88 | - try { |
|
89 | - $sth = $this->db->prepare($query); |
|
90 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
91 | - } catch(PDOException $e) { |
|
92 | - echo "error : ".$e->getMessage(); |
|
93 | - } |
|
94 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
95 | - return $all; |
|
96 | - } |
|
87 | + $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"; |
|
88 | + try { |
|
89 | + $sth = $this->db->prepare($query); |
|
90 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
91 | + } catch(PDOException $e) { |
|
92 | + echo "error : ".$e->getMessage(); |
|
93 | + } |
|
94 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
95 | + return $all; |
|
96 | + } |
|
97 | 97 | public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
98 | 98 | if ($filter_name == '') $filter_name = $this->filter_name; |
99 | - $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"; |
|
100 | - try { |
|
101 | - $sth = $this->db->prepare($query); |
|
102 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
103 | - } catch(PDOException $e) { |
|
104 | - echo "error : ".$e->getMessage(); |
|
105 | - } |
|
106 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
107 | - return $all; |
|
108 | - } |
|
99 | + $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"; |
|
100 | + try { |
|
101 | + $sth = $this->db->prepare($query); |
|
102 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
103 | + } catch(PDOException $e) { |
|
104 | + echo "error : ".$e->getMessage(); |
|
105 | + } |
|
106 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
107 | + return $all; |
|
108 | + } |
|
109 | 109 | |
110 | 110 | |
111 | 111 | public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '') { |
@@ -113,66 +113,66 @@ discard block |
||
113 | 113 | if ($filter_name == '') $filter_name = $this->filter_name; |
114 | 114 | if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name 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 LIMIT 10 OFFSET 0"; |
115 | 115 | else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name 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"; |
116 | - try { |
|
117 | - $sth = $this->db->prepare($query); |
|
118 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
119 | - } catch(PDOException $e) { |
|
120 | - echo "error : ".$e->getMessage(); |
|
121 | - } |
|
122 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
123 | - if (empty($all)) { |
|
124 | - $filters = array('airlines' => array($stats_airline)); |
|
125 | - if ($filter_name != '') { |
|
126 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
127 | - } |
|
128 | - $Spotter = new Spotter($this->db); |
|
129 | - $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters); |
|
130 | - } |
|
131 | - return $all; |
|
116 | + try { |
|
117 | + $sth = $this->db->prepare($query); |
|
118 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
119 | + } catch(PDOException $e) { |
|
120 | + echo "error : ".$e->getMessage(); |
|
121 | + } |
|
122 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
123 | + if (empty($all)) { |
|
124 | + $filters = array('airlines' => array($stats_airline)); |
|
125 | + if ($filter_name != '') { |
|
126 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
127 | + } |
|
128 | + $Spotter = new Spotter($this->db); |
|
129 | + $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters); |
|
130 | + } |
|
131 | + return $all; |
|
132 | 132 | } |
133 | 133 | public function countAllAirlineCountries($limit = true,$filter_name = '') { |
134 | 134 | global $globalStatsFilters; |
135 | 135 | if ($filter_name == '') $filter_name = $this->filter_name; |
136 | 136 | if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
137 | 137 | else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC"; |
138 | - try { |
|
139 | - $sth = $this->db->prepare($query); |
|
140 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
141 | - } catch(PDOException $e) { |
|
142 | - echo "error : ".$e->getMessage(); |
|
143 | - } |
|
144 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
145 | - if (empty($all)) { |
|
146 | - $Spotter = new Spotter($this->db); |
|
147 | - $filters = array(); |
|
148 | - if ($filter_name != '') { |
|
149 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
150 | - } |
|
151 | - $all = $Spotter->countAllAirlineCountries($limit,$filters); |
|
152 | - } |
|
153 | - return $all; |
|
138 | + try { |
|
139 | + $sth = $this->db->prepare($query); |
|
140 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
141 | + } catch(PDOException $e) { |
|
142 | + echo "error : ".$e->getMessage(); |
|
143 | + } |
|
144 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
145 | + if (empty($all)) { |
|
146 | + $Spotter = new Spotter($this->db); |
|
147 | + $filters = array(); |
|
148 | + if ($filter_name != '') { |
|
149 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
150 | + } |
|
151 | + $all = $Spotter->countAllAirlineCountries($limit,$filters); |
|
152 | + } |
|
153 | + return $all; |
|
154 | 154 | } |
155 | 155 | public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') { |
156 | 156 | global $globalStatsFilters; |
157 | 157 | if ($filter_name == '') $filter_name = $this->filter_name; |
158 | 158 | if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
159 | 159 | 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"; |
160 | - try { |
|
161 | - $sth = $this->db->prepare($query); |
|
162 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
163 | - } catch(PDOException $e) { |
|
164 | - echo "error : ".$e->getMessage(); |
|
165 | - } |
|
166 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
167 | - if (empty($all)) { |
|
168 | - $filters = array('airlines' => array($stats_airline)); |
|
169 | - if ($filter_name != '') { |
|
170 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
160 | + try { |
|
161 | + $sth = $this->db->prepare($query); |
|
162 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
163 | + } catch(PDOException $e) { |
|
164 | + echo "error : ".$e->getMessage(); |
|
165 | + } |
|
166 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
167 | + if (empty($all)) { |
|
168 | + $filters = array('airlines' => array($stats_airline)); |
|
169 | + if ($filter_name != '') { |
|
170 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
171 | 171 | } |
172 | - $Spotter = new Spotter($this->db); |
|
172 | + $Spotter = new Spotter($this->db); |
|
173 | 173 | $all = $Spotter->countAllAircraftManufacturers($filters); |
174 | - } |
|
175 | - return $all; |
|
174 | + } |
|
175 | + return $all; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '') { |
@@ -180,44 +180,44 @@ discard block |
||
180 | 180 | if ($filter_name == '') $filter_name = $this->filter_name; |
181 | 181 | if ($limit) $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 LIMIT 10 OFFSET 0"; |
182 | 182 | 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"; |
183 | - try { |
|
184 | - $sth = $this->db->prepare($query); |
|
185 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
186 | - } catch(PDOException $e) { |
|
187 | - echo "error : ".$e->getMessage(); |
|
188 | - } |
|
189 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
190 | - if (empty($all)) { |
|
183 | + try { |
|
184 | + $sth = $this->db->prepare($query); |
|
185 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
186 | + } catch(PDOException $e) { |
|
187 | + echo "error : ".$e->getMessage(); |
|
188 | + } |
|
189 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
190 | + if (empty($all)) { |
|
191 | 191 | $filters = array('airlines' => array($stats_airline)); |
192 | 192 | if ($filter_name != '') { |
193 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
193 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
194 | 194 | } |
195 | 195 | $Spotter = new Spotter($this->db); |
196 | 196 | $all = $Spotter->countAllArrivalCountries($limit,$filters); |
197 | - } |
|
198 | - return $all; |
|
197 | + } |
|
198 | + return $all; |
|
199 | 199 | } |
200 | 200 | public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '') { |
201 | 201 | global $globalStatsFilters; |
202 | 202 | if ($filter_name == '') $filter_name = $this->filter_name; |
203 | 203 | if ($limit) $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 LIMIT 10 OFFSET 0"; |
204 | 204 | 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"; |
205 | - try { |
|
206 | - $sth = $this->db->prepare($query); |
|
207 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
208 | - } catch(PDOException $e) { |
|
209 | - echo "error : ".$e->getMessage(); |
|
210 | - } |
|
211 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
212 | - if (empty($all)) { |
|
205 | + try { |
|
206 | + $sth = $this->db->prepare($query); |
|
207 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
208 | + } catch(PDOException $e) { |
|
209 | + echo "error : ".$e->getMessage(); |
|
210 | + } |
|
211 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
212 | + if (empty($all)) { |
|
213 | 213 | $filters = array('airlines' => array($stats_airline)); |
214 | 214 | if ($filter_name != '') { |
215 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
215 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
216 | 216 | } |
217 | 217 | $Spotter = new Spotter($this->db); |
218 | 218 | $all = $Spotter->countAllDepartureCountries($filters); |
219 | - } |
|
220 | - return $all; |
|
219 | + } |
|
220 | + return $all; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | public function countAllAirlines($limit = true,$filter_name = '') { |
@@ -225,45 +225,45 @@ discard block |
||
225 | 225 | if ($filter_name == '') $filter_name = $this->filter_name; |
226 | 226 | if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
227 | 227 | else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC"; |
228 | - try { |
|
229 | - $sth = $this->db->prepare($query); |
|
230 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
231 | - } catch(PDOException $e) { |
|
232 | - echo "error : ".$e->getMessage(); |
|
233 | - } |
|
234 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
235 | - if (empty($all)) { |
|
236 | - $Spotter = new Spotter($this->db); |
|
237 | - $filters = array(); |
|
238 | - if ($filter_name != '') { |
|
239 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
228 | + try { |
|
229 | + $sth = $this->db->prepare($query); |
|
230 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
231 | + } catch(PDOException $e) { |
|
232 | + echo "error : ".$e->getMessage(); |
|
233 | + } |
|
234 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
235 | + if (empty($all)) { |
|
236 | + $Spotter = new Spotter($this->db); |
|
237 | + $filters = array(); |
|
238 | + if ($filter_name != '') { |
|
239 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
240 | 240 | } |
241 | 241 | |
242 | - $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
243 | - } |
|
244 | - return $all; |
|
242 | + $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
243 | + } |
|
244 | + return $all; |
|
245 | 245 | } |
246 | 246 | public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') { |
247 | 247 | global $globalStatsFilters; |
248 | 248 | if ($filter_name == '') $filter_name = $this->filter_name; |
249 | 249 | if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
250 | 250 | 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"; |
251 | - try { |
|
252 | - $sth = $this->db->prepare($query); |
|
253 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
254 | - } catch(PDOException $e) { |
|
255 | - echo "error : ".$e->getMessage(); |
|
256 | - } |
|
257 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
258 | - if (empty($all)) { |
|
251 | + try { |
|
252 | + $sth = $this->db->prepare($query); |
|
253 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
254 | + } catch(PDOException $e) { |
|
255 | + echo "error : ".$e->getMessage(); |
|
256 | + } |
|
257 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
258 | + if (empty($all)) { |
|
259 | 259 | $filters = array('airlines' => array($stats_airline)); |
260 | 260 | if ($filter_name != '') { |
261 | 261 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
262 | 262 | } |
263 | - $Spotter = new Spotter($this->db); |
|
264 | - $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters); |
|
265 | - } |
|
266 | - return $all; |
|
263 | + $Spotter = new Spotter($this->db); |
|
264 | + $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters); |
|
265 | + } |
|
266 | + return $all; |
|
267 | 267 | } |
268 | 268 | public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') { |
269 | 269 | global $globalStatsFilters; |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | echo "error : ".$e->getMessage(); |
301 | 301 | } |
302 | 302 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
303 | - /* |
|
303 | + /* |
|
304 | 304 | if (empty($all)) { |
305 | 305 | $Spotter = new Spotter($this->db); |
306 | 306 | $all = $Spotter->countAllFlightOverCountries($limit); |
@@ -316,84 +316,84 @@ discard block |
||
316 | 316 | if ($filter_name == '') $filter_name = $this->filter_name; |
317 | 317 | if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
318 | 318 | 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"; |
319 | - try { |
|
320 | - $sth = $this->db->prepare($query); |
|
321 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
322 | - } catch(PDOException $e) { |
|
323 | - echo "error : ".$e->getMessage(); |
|
324 | - } |
|
325 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
326 | - if (empty($all)) { |
|
319 | + try { |
|
320 | + $sth = $this->db->prepare($query); |
|
321 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
322 | + } catch(PDOException $e) { |
|
323 | + echo "error : ".$e->getMessage(); |
|
324 | + } |
|
325 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
326 | + if (empty($all)) { |
|
327 | 327 | $filters = array('airlines' => array($stats_airline)); |
328 | 328 | if ($filter_name != '') { |
329 | 329 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
330 | 330 | } |
331 | - $Spotter = new Spotter($this->db); |
|
332 | - $all = $Spotter->countAllPilots($limit,0,'',$filters); |
|
333 | - } |
|
334 | - return $all; |
|
331 | + $Spotter = new Spotter($this->db); |
|
332 | + $all = $Spotter->countAllPilots($limit,0,'',$filters); |
|
333 | + } |
|
334 | + return $all; |
|
335 | 335 | } |
336 | 336 | public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') { |
337 | 337 | global $globalStatsFilters; |
338 | 338 | if ($filter_name == '') $filter_name = $this->filter_name; |
339 | 339 | if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
340 | 340 | 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"; |
341 | - try { |
|
342 | - $sth = $this->db->prepare($query); |
|
343 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
344 | - } catch(PDOException $e) { |
|
345 | - echo "error : ".$e->getMessage(); |
|
346 | - } |
|
347 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
348 | - if (empty($all)) { |
|
341 | + try { |
|
342 | + $sth = $this->db->prepare($query); |
|
343 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
344 | + } catch(PDOException $e) { |
|
345 | + echo "error : ".$e->getMessage(); |
|
346 | + } |
|
347 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
348 | + if (empty($all)) { |
|
349 | 349 | $filters = array('airlines' => array($stats_airline)); |
350 | 350 | if ($filter_name != '') { |
351 | 351 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
352 | 352 | } |
353 | - $Spotter = new Spotter($this->db); |
|
354 | - $all = $Spotter->countAllOwners($limit,0,'',$filters); |
|
355 | - } |
|
356 | - return $all; |
|
353 | + $Spotter = new Spotter($this->db); |
|
354 | + $all = $Spotter->countAllOwners($limit,0,'',$filters); |
|
355 | + } |
|
356 | + return $all; |
|
357 | 357 | } |
358 | 358 | public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') { |
359 | 359 | global $globalStatsFilters; |
360 | 360 | if ($filter_name == '') $filter_name = $this->filter_name; |
361 | 361 | if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count 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 LIMIT 10 OFFSET 0"; |
362 | 362 | 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"; |
363 | - try { |
|
364 | - $sth = $this->db->prepare($query); |
|
365 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
366 | - } catch(PDOException $e) { |
|
367 | - echo "error : ".$e->getMessage(); |
|
368 | - } |
|
369 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
370 | - if (empty($all)) { |
|
363 | + try { |
|
364 | + $sth = $this->db->prepare($query); |
|
365 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
366 | + } catch(PDOException $e) { |
|
367 | + echo "error : ".$e->getMessage(); |
|
368 | + } |
|
369 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
370 | + if (empty($all)) { |
|
371 | 371 | $filters = array('airlines' => array($stats_airline)); |
372 | - if ($filter_name != '') { |
|
373 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
374 | - } |
|
375 | - $Spotter = new Spotter($this->db); |
|
376 | - $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters); |
|
377 | - $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters); |
|
378 | - $all = array(); |
|
379 | - foreach ($pall as $value) { |
|
380 | - $icao = $value['airport_departure_icao']; |
|
381 | - $all[$icao] = $value; |
|
382 | - } |
|
372 | + if ($filter_name != '') { |
|
373 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
374 | + } |
|
375 | + $Spotter = new Spotter($this->db); |
|
376 | + $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters); |
|
377 | + $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters); |
|
378 | + $all = array(); |
|
379 | + foreach ($pall as $value) { |
|
380 | + $icao = $value['airport_departure_icao']; |
|
381 | + $all[$icao] = $value; |
|
382 | + } |
|
383 | 383 | |
384 | - foreach ($dall as $value) { |
|
385 | - $icao = $value['airport_departure_icao']; |
|
386 | - if (isset($all[$icao])) { |
|
387 | - $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
388 | - } else $all[$icao] = $value; |
|
389 | - } |
|
390 | - $count = array(); |
|
391 | - foreach ($all as $key => $row) { |
|
392 | - $count[$key] = $row['airport_departure_icao_count']; |
|
393 | - } |
|
394 | - array_multisort($count,SORT_DESC,$all); |
|
395 | - } |
|
396 | - return $all; |
|
384 | + foreach ($dall as $value) { |
|
385 | + $icao = $value['airport_departure_icao']; |
|
386 | + if (isset($all[$icao])) { |
|
387 | + $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
388 | + } else $all[$icao] = $value; |
|
389 | + } |
|
390 | + $count = array(); |
|
391 | + foreach ($all as $key => $row) { |
|
392 | + $count[$key] = $row['airport_departure_icao_count']; |
|
393 | + } |
|
394 | + array_multisort($count,SORT_DESC,$all); |
|
395 | + } |
|
396 | + return $all; |
|
397 | 397 | } |
398 | 398 | public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') { |
399 | 399 | global $globalStatsFilters; |
@@ -415,26 +415,26 @@ discard block |
||
415 | 415 | $Spotter = new Spotter($this->db); |
416 | 416 | $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters); |
417 | 417 | $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters); |
418 | - $all = array(); |
|
419 | - foreach ($pall as $value) { |
|
420 | - $icao = $value['airport_arrival_icao']; |
|
421 | - $all[$icao] = $value; |
|
422 | - } |
|
418 | + $all = array(); |
|
419 | + foreach ($pall as $value) { |
|
420 | + $icao = $value['airport_arrival_icao']; |
|
421 | + $all[$icao] = $value; |
|
422 | + } |
|
423 | 423 | |
424 | - foreach ($dall as $value) { |
|
425 | - $icao = $value['airport_arrival_icao']; |
|
426 | - if (isset($all[$icao])) { |
|
427 | - $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
428 | - } else $all[$icao] = $value; |
|
429 | - } |
|
430 | - $count = array(); |
|
431 | - foreach ($all as $key => $row) { |
|
432 | - $count[$key] = $row['airport_arrival_icao_count']; |
|
433 | - } |
|
434 | - array_multisort($count,SORT_DESC,$all); |
|
435 | - } |
|
424 | + foreach ($dall as $value) { |
|
425 | + $icao = $value['airport_arrival_icao']; |
|
426 | + if (isset($all[$icao])) { |
|
427 | + $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
428 | + } else $all[$icao] = $value; |
|
429 | + } |
|
430 | + $count = array(); |
|
431 | + foreach ($all as $key => $row) { |
|
432 | + $count[$key] = $row['airport_arrival_icao_count']; |
|
433 | + } |
|
434 | + array_multisort($count,SORT_DESC,$all); |
|
435 | + } |
|
436 | 436 | |
437 | - return $all; |
|
437 | + return $all; |
|
438 | 438 | } |
439 | 439 | public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
440 | 440 | global $globalDBdriver, $globalStatsFilters; |
@@ -447,23 +447,23 @@ discard block |
||
447 | 447 | 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"; |
448 | 448 | } |
449 | 449 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
450 | - try { |
|
451 | - $sth = $this->db->prepare($query); |
|
452 | - $sth->execute($query_data); |
|
453 | - } catch(PDOException $e) { |
|
454 | - echo "error : ".$e->getMessage(); |
|
455 | - } |
|
456 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
457 | - if (empty($all)) { |
|
450 | + try { |
|
451 | + $sth = $this->db->prepare($query); |
|
452 | + $sth->execute($query_data); |
|
453 | + } catch(PDOException $e) { |
|
454 | + echo "error : ".$e->getMessage(); |
|
455 | + } |
|
456 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
457 | + if (empty($all)) { |
|
458 | 458 | $filters = array('airlines' => array($stats_airline)); |
459 | 459 | if ($filter_name != '') { |
460 | 460 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
461 | 461 | } |
462 | - $Spotter = new Spotter($this->db); |
|
463 | - $all = $Spotter->countAllMonthsLastYear($filters); |
|
464 | - } |
|
462 | + $Spotter = new Spotter($this->db); |
|
463 | + $all = $Spotter->countAllMonthsLastYear($filters); |
|
464 | + } |
|
465 | 465 | |
466 | - return $all; |
|
466 | + return $all; |
|
467 | 467 | } |
468 | 468 | |
469 | 469 | public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
@@ -471,22 +471,22 @@ discard block |
||
471 | 471 | if ($filter_name == '') $filter_name = $this->filter_name; |
472 | 472 | $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"; |
473 | 473 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
474 | - try { |
|
475 | - $sth = $this->db->prepare($query); |
|
476 | - $sth->execute($query_data); |
|
477 | - } catch(PDOException $e) { |
|
478 | - echo "error : ".$e->getMessage(); |
|
479 | - } |
|
480 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
481 | - if (empty($all)) { |
|
474 | + try { |
|
475 | + $sth = $this->db->prepare($query); |
|
476 | + $sth->execute($query_data); |
|
477 | + } catch(PDOException $e) { |
|
478 | + echo "error : ".$e->getMessage(); |
|
479 | + } |
|
480 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
481 | + if (empty($all)) { |
|
482 | 482 | $filters = array('airlines' => array($stats_airline)); |
483 | 483 | if ($filter_name != '') { |
484 | 484 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
485 | 485 | } |
486 | - $Spotter = new Spotter($this->db); |
|
487 | - $all = $Spotter->countAllDatesLastMonth($filters); |
|
488 | - } |
|
489 | - return $all; |
|
486 | + $Spotter = new Spotter($this->db); |
|
487 | + $all = $Spotter->countAllDatesLastMonth($filters); |
|
488 | + } |
|
489 | + return $all; |
|
490 | 490 | } |
491 | 491 | public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
492 | 492 | global $globalDBdriver, $globalStatsFilters; |
@@ -497,108 +497,108 @@ discard block |
||
497 | 497 | $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"; |
498 | 498 | } |
499 | 499 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
500 | - try { |
|
501 | - $sth = $this->db->prepare($query); |
|
502 | - $sth->execute($query_data); |
|
503 | - } catch(PDOException $e) { |
|
504 | - echo "error : ".$e->getMessage(); |
|
505 | - } |
|
506 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
507 | - if (empty($all)) { |
|
500 | + try { |
|
501 | + $sth = $this->db->prepare($query); |
|
502 | + $sth->execute($query_data); |
|
503 | + } catch(PDOException $e) { |
|
504 | + echo "error : ".$e->getMessage(); |
|
505 | + } |
|
506 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
507 | + if (empty($all)) { |
|
508 | 508 | $filters = array('airlines' => array($stats_airline)); |
509 | 509 | if ($filter_name != '') { |
510 | 510 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
511 | 511 | } |
512 | - $Spotter = new Spotter($this->db); |
|
513 | - $all = $Spotter->countAllDatesLast7Days($filters); |
|
514 | - } |
|
515 | - return $all; |
|
512 | + $Spotter = new Spotter($this->db); |
|
513 | + $all = $Spotter->countAllDatesLast7Days($filters); |
|
514 | + } |
|
515 | + return $all; |
|
516 | 516 | } |
517 | 517 | public function countAllDates($stats_airline = '',$filter_name = '') { |
518 | 518 | global $globalStatsFilters; |
519 | 519 | if ($filter_name == '') $filter_name = $this->filter_name; |
520 | 520 | $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"; |
521 | 521 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
522 | - try { |
|
523 | - $sth = $this->db->prepare($query); |
|
524 | - $sth->execute($query_data); |
|
525 | - } catch(PDOException $e) { |
|
526 | - echo "error : ".$e->getMessage(); |
|
527 | - } |
|
528 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
529 | - if (empty($all)) { |
|
522 | + try { |
|
523 | + $sth = $this->db->prepare($query); |
|
524 | + $sth->execute($query_data); |
|
525 | + } catch(PDOException $e) { |
|
526 | + echo "error : ".$e->getMessage(); |
|
527 | + } |
|
528 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
529 | + if (empty($all)) { |
|
530 | 530 | $filters = array('airlines' => array($stats_airline)); |
531 | 531 | if ($filter_name != '') { |
532 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
532 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
533 | 533 | } |
534 | - $Spotter = new Spotter($this->db); |
|
535 | - $all = $Spotter->countAllDates($filters); |
|
536 | - } |
|
537 | - return $all; |
|
534 | + $Spotter = new Spotter($this->db); |
|
535 | + $all = $Spotter->countAllDates($filters); |
|
536 | + } |
|
537 | + return $all; |
|
538 | 538 | } |
539 | 539 | public function countAllDatesByAirlines($filter_name = '') { |
540 | 540 | global $globalStatsFilters; |
541 | 541 | if ($filter_name == '') $filter_name = $this->filter_name; |
542 | 542 | $query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name"; |
543 | 543 | $query_data = array('filter_name' => $filter_name); |
544 | - try { |
|
545 | - $sth = $this->db->prepare($query); |
|
546 | - $sth->execute($query_data); |
|
547 | - } catch(PDOException $e) { |
|
548 | - echo "error : ".$e->getMessage(); |
|
549 | - } |
|
550 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
551 | - if (empty($all)) { |
|
552 | - $filters = array(); |
|
553 | - if ($filter_name != '') { |
|
554 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
555 | - } |
|
556 | - $Spotter = new Spotter($this->db); |
|
557 | - $all = $Spotter->countAllDatesByAirlines($filters); |
|
558 | - } |
|
559 | - return $all; |
|
544 | + try { |
|
545 | + $sth = $this->db->prepare($query); |
|
546 | + $sth->execute($query_data); |
|
547 | + } catch(PDOException $e) { |
|
548 | + echo "error : ".$e->getMessage(); |
|
549 | + } |
|
550 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
551 | + if (empty($all)) { |
|
552 | + $filters = array(); |
|
553 | + if ($filter_name != '') { |
|
554 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
555 | + } |
|
556 | + $Spotter = new Spotter($this->db); |
|
557 | + $all = $Spotter->countAllDatesByAirlines($filters); |
|
558 | + } |
|
559 | + return $all; |
|
560 | 560 | } |
561 | 561 | public function countAllMonths($stats_airline = '',$filter_name = '') { |
562 | 562 | global $globalStatsFilters; |
563 | 563 | if ($filter_name == '') $filter_name = $this->filter_name; |
564 | - $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"; |
|
565 | - try { |
|
566 | - $sth = $this->db->prepare($query); |
|
567 | - $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
568 | - } catch(PDOException $e) { |
|
569 | - echo "error : ".$e->getMessage(); |
|
570 | - } |
|
571 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
572 | - if (empty($all)) { |
|
564 | + $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"; |
|
565 | + try { |
|
566 | + $sth = $this->db->prepare($query); |
|
567 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
568 | + } catch(PDOException $e) { |
|
569 | + echo "error : ".$e->getMessage(); |
|
570 | + } |
|
571 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
572 | + if (empty($all)) { |
|
573 | 573 | $filters = array('airlines' => array($stats_airline)); |
574 | 574 | if ($filter_name != '') { |
575 | 575 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
576 | 576 | } |
577 | - $Spotter = new Spotter($this->db); |
|
578 | - $all = $Spotter->countAllMonths($filters); |
|
579 | - } |
|
580 | - return $all; |
|
577 | + $Spotter = new Spotter($this->db); |
|
578 | + $all = $Spotter->countAllMonths($filters); |
|
579 | + } |
|
580 | + return $all; |
|
581 | 581 | } |
582 | 582 | public function countAllMilitaryMonths($filter_name = '') { |
583 | 583 | global $globalStatsFilters; |
584 | 584 | if ($filter_name == '') $filter_name = $this->filter_name; |
585 | - $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name"; |
|
586 | - try { |
|
587 | - $sth = $this->db->prepare($query); |
|
588 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
589 | - } catch(PDOException $e) { |
|
590 | - echo "error : ".$e->getMessage(); |
|
591 | - } |
|
592 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
593 | - if (empty($all)) { |
|
594 | - $filters = array(); |
|
595 | - if ($filter_name != '') { |
|
596 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
597 | - } |
|
598 | - $Spotter = new Spotter($this->db); |
|
599 | - $all = $Spotter->countAllMilitaryMonths($filters); |
|
600 | - } |
|
601 | - return $all; |
|
585 | + $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name"; |
|
586 | + try { |
|
587 | + $sth = $this->db->prepare($query); |
|
588 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
589 | + } catch(PDOException $e) { |
|
590 | + echo "error : ".$e->getMessage(); |
|
591 | + } |
|
592 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
593 | + if (empty($all)) { |
|
594 | + $filters = array(); |
|
595 | + if ($filter_name != '') { |
|
596 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
597 | + } |
|
598 | + $Spotter = new Spotter($this->db); |
|
599 | + $all = $Spotter->countAllMilitaryMonths($filters); |
|
600 | + } |
|
601 | + return $all; |
|
602 | 602 | } |
603 | 603 | public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
604 | 604 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
@@ -614,22 +614,22 @@ discard block |
||
614 | 614 | $query .= " ORDER BY CAST(flight_date AS integer) ASC"; |
615 | 615 | } |
616 | 616 | if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
617 | - try { |
|
618 | - $sth = $this->db->prepare($query); |
|
619 | - $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
620 | - } catch(PDOException $e) { |
|
621 | - echo "error : ".$e->getMessage(); |
|
622 | - } |
|
623 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
624 | - if (empty($all)) { |
|
617 | + try { |
|
618 | + $sth = $this->db->prepare($query); |
|
619 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
620 | + } catch(PDOException $e) { |
|
621 | + echo "error : ".$e->getMessage(); |
|
622 | + } |
|
623 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
624 | + if (empty($all)) { |
|
625 | 625 | $filters = array('airlines' => array($stats_airline)); |
626 | 626 | if ($filter_name != '') { |
627 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
627 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
628 | 628 | } |
629 | - $Spotter = new Spotter($this->db); |
|
630 | - $all = $Spotter->countAllHours($orderby,$filters); |
|
631 | - } |
|
632 | - return $all; |
|
629 | + $Spotter = new Spotter($this->db); |
|
630 | + $all = $Spotter->countAllHours($orderby,$filters); |
|
631 | + } |
|
632 | + return $all; |
|
633 | 633 | } |
634 | 634 | |
635 | 635 | public function countOverallFlights($stats_airline = '', $filter_name = '') { |
@@ -651,9 +651,9 @@ discard block |
||
651 | 651 | if ($filter_name == '') $filter_name = $this->filter_name; |
652 | 652 | $all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name); |
653 | 653 | if (empty($all)) { |
654 | - $filters = array(); |
|
655 | - if ($filter_name != '') { |
|
656 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
654 | + $filters = array(); |
|
655 | + if ($filter_name != '') { |
|
656 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
657 | 657 | } |
658 | 658 | $Spotter = new Spotter($this->db); |
659 | 659 | $all = $Spotter->countOverallMilitaryFlights($filters); |
@@ -692,19 +692,19 @@ discard block |
||
692 | 692 | global $globalStatsFilters; |
693 | 693 | if ($filter_name == '') $filter_name = $this->filter_name; |
694 | 694 | $query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name"; |
695 | - try { |
|
696 | - $sth = $this->db->prepare($query); |
|
697 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
698 | - } catch(PDOException $e) { |
|
699 | - echo "error : ".$e->getMessage(); |
|
700 | - } |
|
701 | - $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
702 | - $all = $result[0]['nb_airline']; |
|
695 | + try { |
|
696 | + $sth = $this->db->prepare($query); |
|
697 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
698 | + } catch(PDOException $e) { |
|
699 | + echo "error : ".$e->getMessage(); |
|
700 | + } |
|
701 | + $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
702 | + $all = $result[0]['nb_airline']; |
|
703 | 703 | //$all = $this->getSumStats('airlines_bymonth',date('Y')); |
704 | 704 | if (empty($all)) { |
705 | - $filters = array(); |
|
706 | - if ($filter_name != '') { |
|
707 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
705 | + $filters = array(); |
|
706 | + if ($filter_name != '') { |
|
707 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
708 | 708 | } |
709 | 709 | $Spotter = new Spotter($this->db); |
710 | 710 | $all = $Spotter->countOverallAirlines($filters); |
@@ -755,166 +755,166 @@ discard block |
||
755 | 755 | if ($filter_name == '') $filter_name = $this->filter_name; |
756 | 756 | $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"; |
757 | 757 | $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
758 | - try { |
|
759 | - $sth = $this->db->prepare($query); |
|
760 | - $sth->execute($query_values); |
|
761 | - } catch(PDOException $e) { |
|
762 | - echo "error : ".$e->getMessage(); |
|
763 | - } |
|
764 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
765 | - return $all; |
|
758 | + try { |
|
759 | + $sth = $this->db->prepare($query); |
|
760 | + $sth->execute($query_values); |
|
761 | + } catch(PDOException $e) { |
|
762 | + echo "error : ".$e->getMessage(); |
|
763 | + } |
|
764 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
765 | + return $all; |
|
766 | 766 | } |
767 | 767 | public function getStats($type,$stats_airline = '', $filter_name = '') { |
768 | 768 | if ($filter_name == '') $filter_name = $this->filter_name; |
769 | - $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
|
770 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
771 | - try { |
|
772 | - $sth = $this->db->prepare($query); |
|
773 | - $sth->execute($query_values); |
|
774 | - } catch(PDOException $e) { |
|
775 | - echo "error : ".$e->getMessage(); |
|
776 | - } |
|
777 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
778 | - return $all; |
|
779 | - } |
|
769 | + $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
|
770 | + $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
771 | + try { |
|
772 | + $sth = $this->db->prepare($query); |
|
773 | + $sth->execute($query_values); |
|
774 | + } catch(PDOException $e) { |
|
775 | + echo "error : ".$e->getMessage(); |
|
776 | + } |
|
777 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
778 | + return $all; |
|
779 | + } |
|
780 | 780 | public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') { |
781 | 781 | if ($filter_name == '') $filter_name = $this->filter_name; |
782 | - global $globalArchiveMonths, $globalDBdriver; |
|
783 | - if ($globalDBdriver == 'mysql') { |
|
784 | - $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"; |
|
785 | - } else { |
|
786 | - $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"; |
|
787 | - } |
|
788 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
789 | - try { |
|
790 | - $sth = $this->db->prepare($query); |
|
791 | - $sth->execute($query_values); |
|
792 | - } catch(PDOException $e) { |
|
793 | - echo "error : ".$e->getMessage(); |
|
794 | - } |
|
795 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
796 | - return $all[0]['total']; |
|
797 | - } |
|
782 | + global $globalArchiveMonths, $globalDBdriver; |
|
783 | + if ($globalDBdriver == 'mysql') { |
|
784 | + $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"; |
|
785 | + } else { |
|
786 | + $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"; |
|
787 | + } |
|
788 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
789 | + try { |
|
790 | + $sth = $this->db->prepare($query); |
|
791 | + $sth->execute($query_values); |
|
792 | + } catch(PDOException $e) { |
|
793 | + echo "error : ".$e->getMessage(); |
|
794 | + } |
|
795 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
796 | + return $all[0]['total']; |
|
797 | + } |
|
798 | 798 | public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
799 | - global $globalArchiveMonths, $globalDBdriver; |
|
799 | + global $globalArchiveMonths, $globalDBdriver; |
|
800 | 800 | if ($filter_name == '') $filter_name = $this->filter_name; |
801 | - if ($globalDBdriver == 'mysql') { |
|
801 | + if ($globalDBdriver == 'mysql') { |
|
802 | 802 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
803 | 803 | } else { |
804 | 804 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveMonths." MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
805 | - } |
|
806 | - $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
807 | - try { |
|
808 | - $sth = $this->db->prepare($query); |
|
809 | - $sth->execute($query_values); |
|
810 | - } catch(PDOException $e) { |
|
811 | - echo "error : ".$e->getMessage(); |
|
812 | - } |
|
813 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
814 | - return $all[0]['total']; |
|
815 | - } |
|
805 | + } |
|
806 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
807 | + try { |
|
808 | + $sth = $this->db->prepare($query); |
|
809 | + $sth->execute($query_values); |
|
810 | + } catch(PDOException $e) { |
|
811 | + echo "error : ".$e->getMessage(); |
|
812 | + } |
|
813 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
814 | + return $all[0]['total']; |
|
815 | + } |
|
816 | 816 | public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
817 | - global $globalArchiveMonths, $globalDBdriver; |
|
817 | + global $globalArchiveMonths, $globalDBdriver; |
|
818 | 818 | if ($filter_name == '') $filter_name = $this->filter_name; |
819 | - if ($globalDBdriver == 'mysql') { |
|
819 | + if ($globalDBdriver == 'mysql') { |
|
820 | 820 | $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
821 | - } else { |
|
821 | + } else { |
|
822 | 822 | $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
823 | - } |
|
824 | - try { |
|
825 | - $sth = $this->db->prepare($query); |
|
826 | - $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
827 | - } catch(PDOException $e) { |
|
828 | - echo "error : ".$e->getMessage(); |
|
829 | - } |
|
830 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
831 | - return $all[0]['total']; |
|
832 | - } |
|
823 | + } |
|
824 | + try { |
|
825 | + $sth = $this->db->prepare($query); |
|
826 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
827 | + } catch(PDOException $e) { |
|
828 | + echo "error : ".$e->getMessage(); |
|
829 | + } |
|
830 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
831 | + return $all[0]['total']; |
|
832 | + } |
|
833 | 833 | public function getStatsAirlineTotal($filter_name = '') { |
834 | - global $globalArchiveMonths, $globalDBdriver; |
|
834 | + global $globalArchiveMonths, $globalDBdriver; |
|
835 | 835 | if ($filter_name == '') $filter_name = $this->filter_name; |
836 | - if ($globalDBdriver == 'mysql') { |
|
836 | + if ($globalDBdriver == 'mysql') { |
|
837 | 837 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
838 | - } else { |
|
838 | + } else { |
|
839 | 839 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
840 | - } |
|
841 | - try { |
|
842 | - $sth = $this->db->prepare($query); |
|
843 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
844 | - } catch(PDOException $e) { |
|
845 | - echo "error : ".$e->getMessage(); |
|
846 | - } |
|
847 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
848 | - return $all[0]['total']; |
|
849 | - } |
|
840 | + } |
|
841 | + try { |
|
842 | + $sth = $this->db->prepare($query); |
|
843 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
844 | + } catch(PDOException $e) { |
|
845 | + echo "error : ".$e->getMessage(); |
|
846 | + } |
|
847 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
848 | + return $all[0]['total']; |
|
849 | + } |
|
850 | 850 | public function getStatsOwnerTotal($filter_name = '') { |
851 | - global $globalArchiveMonths, $globalDBdriver; |
|
851 | + global $globalArchiveMonths, $globalDBdriver; |
|
852 | 852 | if ($filter_name == '') $filter_name = $this->filter_name; |
853 | - if ($globalDBdriver == 'mysql') { |
|
853 | + if ($globalDBdriver == 'mysql') { |
|
854 | 854 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
855 | 855 | } else { |
856 | 856 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
857 | - } |
|
858 | - try { |
|
859 | - $sth = $this->db->prepare($query); |
|
860 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
861 | - } catch(PDOException $e) { |
|
862 | - echo "error : ".$e->getMessage(); |
|
863 | - } |
|
864 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
865 | - return $all[0]['total']; |
|
866 | - } |
|
857 | + } |
|
858 | + try { |
|
859 | + $sth = $this->db->prepare($query); |
|
860 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
861 | + } catch(PDOException $e) { |
|
862 | + echo "error : ".$e->getMessage(); |
|
863 | + } |
|
864 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
865 | + return $all[0]['total']; |
|
866 | + } |
|
867 | 867 | public function getStatsPilotTotal($filter_name = '') { |
868 | - global $globalArchiveMonths, $globalDBdriver; |
|
868 | + global $globalArchiveMonths, $globalDBdriver; |
|
869 | 869 | if ($filter_name == '') $filter_name = $this->filter_name; |
870 | - if ($globalDBdriver == 'mysql') { |
|
871 | - $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
872 | - } else { |
|
873 | - $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
874 | - } |
|
875 | - try { |
|
876 | - $sth = $this->db->prepare($query); |
|
877 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
878 | - } catch(PDOException $e) { |
|
879 | - echo "error : ".$e->getMessage(); |
|
880 | - } |
|
881 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
882 | - return $all[0]['total']; |
|
883 | - } |
|
870 | + if ($globalDBdriver == 'mysql') { |
|
871 | + $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
872 | + } else { |
|
873 | + $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
874 | + } |
|
875 | + try { |
|
876 | + $sth = $this->db->prepare($query); |
|
877 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
878 | + } catch(PDOException $e) { |
|
879 | + echo "error : ".$e->getMessage(); |
|
880 | + } |
|
881 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
882 | + return $all[0]['total']; |
|
883 | + } |
|
884 | 884 | |
885 | 885 | public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
886 | 886 | global $globalDBdriver; |
887 | 887 | if ($filter_name == '') $filter_name = $this->filter_name; |
888 | 888 | if ($globalDBdriver == 'mysql') { |
889 | 889 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt"; |
890 | - } else { |
|
890 | + } else { |
|
891 | 891 | $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);"; |
892 | 892 | } |
893 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
894 | - try { |
|
895 | - $sth = $this->db->prepare($query); |
|
896 | - $sth->execute($query_values); |
|
897 | - } catch(PDOException $e) { |
|
898 | - return "error : ".$e->getMessage(); |
|
899 | - } |
|
900 | - } |
|
893 | + $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
894 | + try { |
|
895 | + $sth = $this->db->prepare($query); |
|
896 | + $sth->execute($query_values); |
|
897 | + } catch(PDOException $e) { |
|
898 | + return "error : ".$e->getMessage(); |
|
899 | + } |
|
900 | + } |
|
901 | 901 | public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
902 | 902 | global $globalDBdriver; |
903 | 903 | if ($filter_name == '') $filter_name = $this->filter_name; |
904 | 904 | if ($globalDBdriver == 'mysql') { |
905 | 905 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
906 | 906 | } else { |
907 | - //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
|
907 | + //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
|
908 | 908 | $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);"; |
909 | - } |
|
910 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
911 | - try { |
|
912 | - $sth = $this->db->prepare($query); |
|
913 | - $sth->execute($query_values); |
|
914 | - } catch(PDOException $e) { |
|
915 | - return "error : ".$e->getMessage(); |
|
916 | - } |
|
917 | - } |
|
909 | + } |
|
910 | + $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
911 | + try { |
|
912 | + $sth = $this->db->prepare($query); |
|
913 | + $sth->execute($query_values); |
|
914 | + } catch(PDOException $e) { |
|
915 | + return "error : ".$e->getMessage(); |
|
916 | + } |
|
917 | + } |
|
918 | 918 | public function getStatsSource($date,$stats_type = '') { |
919 | 919 | if ($stats_type == '') { |
920 | 920 | $query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name"; |
@@ -923,15 +923,15 @@ discard block |
||
923 | 923 | $query = "SELECT * FROM stats_source WHERE stats_date = :date AND stats_type = :stats_type ORDER BY source_name"; |
924 | 924 | $query_values = array(':date' => $date,':stats_type' => $stats_type); |
925 | 925 | } |
926 | - try { |
|
927 | - $sth = $this->db->prepare($query); |
|
928 | - $sth->execute($query_values); |
|
929 | - } catch(PDOException $e) { |
|
930 | - echo "error : ".$e->getMessage(); |
|
931 | - } |
|
932 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
933 | - return $all; |
|
934 | - } |
|
926 | + try { |
|
927 | + $sth = $this->db->prepare($query); |
|
928 | + $sth->execute($query_values); |
|
929 | + } catch(PDOException $e) { |
|
930 | + echo "error : ".$e->getMessage(); |
|
931 | + } |
|
932 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
933 | + return $all; |
|
934 | + } |
|
935 | 935 | |
936 | 936 | public function addStatSource($data,$source_name,$stats_type,$date) { |
937 | 937 | global $globalDBdriver; |
@@ -939,25 +939,25 @@ discard block |
||
939 | 939 | $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"; |
940 | 940 | } else { |
941 | 941 | $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);"; |
942 | - } |
|
943 | - $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
944 | - try { |
|
945 | - $sth = $this->db->prepare($query); |
|
946 | - $sth->execute($query_values); |
|
947 | - } catch(PDOException $e) { |
|
948 | - return "error : ".$e->getMessage(); |
|
949 | - } |
|
950 | - } |
|
942 | + } |
|
943 | + $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
944 | + try { |
|
945 | + $sth = $this->db->prepare($query); |
|
946 | + $sth->execute($query_values); |
|
947 | + } catch(PDOException $e) { |
|
948 | + return "error : ".$e->getMessage(); |
|
949 | + } |
|
950 | + } |
|
951 | 951 | public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
952 | - $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
|
953 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
954 | - try { |
|
955 | - $sth = $this->db->prepare($query); |
|
956 | - $sth->execute($query_values); |
|
957 | - } catch(PDOException $e) { |
|
958 | - return "error : ".$e->getMessage(); |
|
959 | - } |
|
960 | - } |
|
952 | + $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
|
953 | + $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
954 | + try { |
|
955 | + $sth = $this->db->prepare($query); |
|
956 | + $sth->execute($query_values); |
|
957 | + } catch(PDOException $e) { |
|
958 | + return "error : ".$e->getMessage(); |
|
959 | + } |
|
960 | + } |
|
961 | 961 | public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '') { |
962 | 962 | global $globalDBdriver; |
963 | 963 | if ($globalDBdriver == 'mysql') { |
@@ -965,14 +965,14 @@ discard block |
||
965 | 965 | } else { |
966 | 966 | $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);"; |
967 | 967 | } |
968 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
969 | - try { |
|
970 | - $sth = $this->db->prepare($query); |
|
971 | - $sth->execute($query_values); |
|
972 | - } catch(PDOException $e) { |
|
973 | - return "error : ".$e->getMessage(); |
|
974 | - } |
|
975 | - } |
|
968 | + $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
969 | + try { |
|
970 | + $sth = $this->db->prepare($query); |
|
971 | + $sth->execute($query_values); |
|
972 | + } catch(PDOException $e) { |
|
973 | + return "error : ".$e->getMessage(); |
|
974 | + } |
|
975 | + } |
|
976 | 976 | public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '') { |
977 | 977 | global $globalDBdriver; |
978 | 978 | if ($globalDBdriver == 'mysql') { |
@@ -980,14 +980,14 @@ discard block |
||
980 | 980 | } else { |
981 | 981 | $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);"; |
982 | 982 | } |
983 | - $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
984 | - try { |
|
985 | - $sth = $this->db->prepare($query); |
|
986 | - $sth->execute($query_values); |
|
987 | - } catch(PDOException $e) { |
|
988 | - return "error : ".$e->getMessage(); |
|
989 | - } |
|
990 | - } |
|
983 | + $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
984 | + try { |
|
985 | + $sth = $this->db->prepare($query); |
|
986 | + $sth->execute($query_values); |
|
987 | + } catch(PDOException $e) { |
|
988 | + return "error : ".$e->getMessage(); |
|
989 | + } |
|
990 | + } |
|
991 | 991 | public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '') { |
992 | 992 | global $globalDBdriver; |
993 | 993 | if ($globalDBdriver == 'mysql') { |
@@ -995,14 +995,14 @@ discard block |
||
995 | 995 | } else { |
996 | 996 | $query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name; INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) SELECT :iso2,:iso3,:name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name);"; |
997 | 997 | } |
998 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
999 | - try { |
|
1000 | - $sth = $this->db->prepare($query); |
|
1001 | - $sth->execute($query_values); |
|
1002 | - } catch(PDOException $e) { |
|
1003 | - return "error : ".$e->getMessage(); |
|
1004 | - } |
|
1005 | - } |
|
998 | + $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
999 | + try { |
|
1000 | + $sth = $this->db->prepare($query); |
|
1001 | + $sth->execute($query_values); |
|
1002 | + } catch(PDOException $e) { |
|
1003 | + return "error : ".$e->getMessage(); |
|
1004 | + } |
|
1005 | + } |
|
1006 | 1006 | public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') { |
1007 | 1007 | global $globalDBdriver; |
1008 | 1008 | if ($globalDBdriver == 'mysql') { |
@@ -1010,14 +1010,14 @@ discard block |
||
1010 | 1010 | } else { |
1011 | 1011 | $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);"; |
1012 | 1012 | } |
1013 | - $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); |
|
1014 | - try { |
|
1015 | - $sth = $this->db->prepare($query); |
|
1016 | - $sth->execute($query_values); |
|
1017 | - } catch(PDOException $e) { |
|
1018 | - return "error : ".$e->getMessage(); |
|
1019 | - } |
|
1020 | - } |
|
1013 | + $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); |
|
1014 | + try { |
|
1015 | + $sth = $this->db->prepare($query); |
|
1016 | + $sth->execute($query_values); |
|
1017 | + } catch(PDOException $e) { |
|
1018 | + return "error : ".$e->getMessage(); |
|
1019 | + } |
|
1020 | + } |
|
1021 | 1021 | public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '') { |
1022 | 1022 | global $globalDBdriver; |
1023 | 1023 | if ($globalDBdriver == 'mysql') { |
@@ -1025,14 +1025,14 @@ discard block |
||
1025 | 1025 | } else { |
1026 | 1026 | $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);"; |
1027 | 1027 | } |
1028 | - $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
1029 | - try { |
|
1030 | - $sth = $this->db->prepare($query); |
|
1031 | - $sth->execute($query_values); |
|
1032 | - } catch(PDOException $e) { |
|
1033 | - return "error : ".$e->getMessage(); |
|
1034 | - } |
|
1035 | - } |
|
1028 | + $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
1029 | + try { |
|
1030 | + $sth = $this->db->prepare($query); |
|
1031 | + $sth->execute($query_values); |
|
1032 | + } catch(PDOException $e) { |
|
1033 | + return "error : ".$e->getMessage(); |
|
1034 | + } |
|
1035 | + } |
|
1036 | 1036 | public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '') { |
1037 | 1037 | global $globalDBdriver; |
1038 | 1038 | if ($globalDBdriver == 'mysql') { |
@@ -1040,14 +1040,14 @@ discard block |
||
1040 | 1040 | } else { |
1041 | 1041 | $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);"; |
1042 | 1042 | } |
1043 | - $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1044 | - try { |
|
1045 | - $sth = $this->db->prepare($query); |
|
1046 | - $sth->execute($query_values); |
|
1047 | - } catch(PDOException $e) { |
|
1048 | - return "error : ".$e->getMessage(); |
|
1049 | - } |
|
1050 | - } |
|
1043 | + $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1044 | + try { |
|
1045 | + $sth = $this->db->prepare($query); |
|
1046 | + $sth->execute($query_values); |
|
1047 | + } catch(PDOException $e) { |
|
1048 | + return "error : ".$e->getMessage(); |
|
1049 | + } |
|
1050 | + } |
|
1051 | 1051 | public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '') { |
1052 | 1052 | global $globalDBdriver; |
1053 | 1053 | if ($globalDBdriver == 'mysql') { |
@@ -1055,14 +1055,14 @@ discard block |
||
1055 | 1055 | } else { |
1056 | 1056 | $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);"; |
1057 | 1057 | } |
1058 | - $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); |
|
1059 | - try { |
|
1060 | - $sth = $this->db->prepare($query); |
|
1061 | - $sth->execute($query_values); |
|
1062 | - } catch(PDOException $e) { |
|
1063 | - return "error : ".$e->getMessage(); |
|
1064 | - } |
|
1065 | - } |
|
1058 | + $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); |
|
1059 | + try { |
|
1060 | + $sth = $this->db->prepare($query); |
|
1061 | + $sth->execute($query_values); |
|
1062 | + } catch(PDOException $e) { |
|
1063 | + return "error : ".$e->getMessage(); |
|
1064 | + } |
|
1065 | + } |
|
1066 | 1066 | public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
1067 | 1067 | global $globalDBdriver; |
1068 | 1068 | if ($globalDBdriver == 'mysql') { |
@@ -1070,14 +1070,14 @@ discard block |
||
1070 | 1070 | } else { |
1071 | 1071 | $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);"; |
1072 | 1072 | } |
1073 | - $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); |
|
1074 | - try { |
|
1075 | - $sth = $this->db->prepare($query); |
|
1076 | - $sth->execute($query_values); |
|
1077 | - } catch(PDOException $e) { |
|
1078 | - return "error : ".$e->getMessage(); |
|
1079 | - } |
|
1080 | - } |
|
1073 | + $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); |
|
1074 | + try { |
|
1075 | + $sth = $this->db->prepare($query); |
|
1076 | + $sth->execute($query_values); |
|
1077 | + } catch(PDOException $e) { |
|
1078 | + return "error : ".$e->getMessage(); |
|
1079 | + } |
|
1080 | + } |
|
1081 | 1081 | public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
1082 | 1082 | global $globalDBdriver; |
1083 | 1083 | if ($globalDBdriver == 'mysql') { |
@@ -1085,14 +1085,14 @@ discard block |
||
1085 | 1085 | } else { |
1086 | 1086 | $query = "UPDATE stats_airport SET departure = 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);"; |
1087 | 1087 | } |
1088 | - $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); |
|
1089 | - try { |
|
1090 | - $sth = $this->db->prepare($query); |
|
1091 | - $sth->execute($query_values); |
|
1092 | - } catch(PDOException $e) { |
|
1093 | - return "error : ".$e->getMessage(); |
|
1094 | - } |
|
1095 | - } |
|
1088 | + $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); |
|
1089 | + try { |
|
1090 | + $sth = $this->db->prepare($query); |
|
1091 | + $sth->execute($query_values); |
|
1092 | + } catch(PDOException $e) { |
|
1093 | + return "error : ".$e->getMessage(); |
|
1094 | + } |
|
1095 | + } |
|
1096 | 1096 | public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
1097 | 1097 | global $globalDBdriver; |
1098 | 1098 | if ($globalDBdriver == 'mysql') { |
@@ -1100,14 +1100,14 @@ discard block |
||
1100 | 1100 | } else { |
1101 | 1101 | $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);"; |
1102 | 1102 | } |
1103 | - $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); |
|
1104 | - try { |
|
1105 | - $sth = $this->db->prepare($query); |
|
1106 | - $sth->execute($query_values); |
|
1107 | - } catch(PDOException $e) { |
|
1108 | - return "error : ".$e->getMessage(); |
|
1109 | - } |
|
1110 | - } |
|
1103 | + $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); |
|
1104 | + try { |
|
1105 | + $sth = $this->db->prepare($query); |
|
1106 | + $sth->execute($query_values); |
|
1107 | + } catch(PDOException $e) { |
|
1108 | + return "error : ".$e->getMessage(); |
|
1109 | + } |
|
1110 | + } |
|
1111 | 1111 | public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
1112 | 1112 | global $globalDBdriver; |
1113 | 1113 | if ($globalDBdriver == 'mysql') { |
@@ -1115,52 +1115,52 @@ discard block |
||
1115 | 1115 | } else { |
1116 | 1116 | $query = "UPDATE stats_airport SET arrival = 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);"; |
1117 | 1117 | } |
1118 | - $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); |
|
1119 | - try { |
|
1120 | - $sth = $this->db->prepare($query); |
|
1121 | - $sth->execute($query_values); |
|
1122 | - } catch(PDOException $e) { |
|
1123 | - return "error : ".$e->getMessage(); |
|
1124 | - } |
|
1125 | - } |
|
1118 | + $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); |
|
1119 | + try { |
|
1120 | + $sth = $this->db->prepare($query); |
|
1121 | + $sth->execute($query_values); |
|
1122 | + } catch(PDOException $e) { |
|
1123 | + return "error : ".$e->getMessage(); |
|
1124 | + } |
|
1125 | + } |
|
1126 | 1126 | |
1127 | 1127 | public function deleteStat($id) { |
1128 | - $query = "DELETE FROM stats WHERE stats_id = :id"; |
|
1129 | - $query_values = array(':id' => $id); |
|
1130 | - try { |
|
1131 | - $sth = $this->db->prepare($query); |
|
1132 | - $sth->execute($query_values); |
|
1133 | - } catch(PDOException $e) { |
|
1134 | - return "error : ".$e->getMessage(); |
|
1135 | - } |
|
1136 | - } |
|
1128 | + $query = "DELETE FROM stats WHERE stats_id = :id"; |
|
1129 | + $query_values = array(':id' => $id); |
|
1130 | + try { |
|
1131 | + $sth = $this->db->prepare($query); |
|
1132 | + $sth->execute($query_values); |
|
1133 | + } catch(PDOException $e) { |
|
1134 | + return "error : ".$e->getMessage(); |
|
1135 | + } |
|
1136 | + } |
|
1137 | 1137 | public function deleteStatFlight($type) { |
1138 | - $query = "DELETE FROM stats_flight WHERE stats_type = :type"; |
|
1139 | - $query_values = array(':type' => $type); |
|
1140 | - try { |
|
1141 | - $sth = $this->db->prepare($query); |
|
1142 | - $sth->execute($query_values); |
|
1143 | - } catch(PDOException $e) { |
|
1144 | - return "error : ".$e->getMessage(); |
|
1145 | - } |
|
1146 | - } |
|
1138 | + $query = "DELETE FROM stats_flight WHERE stats_type = :type"; |
|
1139 | + $query_values = array(':type' => $type); |
|
1140 | + try { |
|
1141 | + $sth = $this->db->prepare($query); |
|
1142 | + $sth->execute($query_values); |
|
1143 | + } catch(PDOException $e) { |
|
1144 | + return "error : ".$e->getMessage(); |
|
1145 | + } |
|
1146 | + } |
|
1147 | 1147 | public function deleteStatAirport($type) { |
1148 | - $query = "DELETE FROM stats_airport WHERE stats_type = :type"; |
|
1149 | - $query_values = array(':type' => $type); |
|
1150 | - try { |
|
1151 | - $sth = $this->db->prepare($query); |
|
1152 | - $sth->execute($query_values); |
|
1153 | - } catch(PDOException $e) { |
|
1154 | - return "error : ".$e->getMessage(); |
|
1155 | - } |
|
1156 | - } |
|
1148 | + $query = "DELETE FROM stats_airport WHERE stats_type = :type"; |
|
1149 | + $query_values = array(':type' => $type); |
|
1150 | + try { |
|
1151 | + $sth = $this->db->prepare($query); |
|
1152 | + $sth->execute($query_values); |
|
1153 | + } catch(PDOException $e) { |
|
1154 | + return "error : ".$e->getMessage(); |
|
1155 | + } |
|
1156 | + } |
|
1157 | 1157 | |
1158 | - public function addOldStats() { |
|
1159 | - global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters; |
|
1160 | - $Common = new Common(); |
|
1161 | - $Connection = new Connection(); |
|
1162 | - date_default_timezone_set('UTC'); |
|
1163 | - $last_update = $this->getLastStatsUpdate('last_update_stats'); |
|
1158 | + public function addOldStats() { |
|
1159 | + global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters; |
|
1160 | + $Common = new Common(); |
|
1161 | + $Connection = new Connection(); |
|
1162 | + date_default_timezone_set('UTC'); |
|
1163 | + $last_update = $this->getLastStatsUpdate('last_update_stats'); |
|
1164 | 1164 | //print_r($last_update); |
1165 | 1165 | /* |
1166 | 1166 | $flightsbymonth = $this->getStats('flights_by_month'); |
@@ -1422,24 +1422,24 @@ discard block |
||
1422 | 1422 | if ($globalDebug) echo 'Count all departure airports...'."\n"; |
1423 | 1423 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
1424 | 1424 | if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
1425 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
1425 | + $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
1426 | 1426 | if ($globalDebug) echo 'Order departure airports...'."\n"; |
1427 | - $alldata = array(); |
|
1427 | + $alldata = array(); |
|
1428 | 1428 | |
1429 | - foreach ($pall as $value) { |
|
1430 | - $icao = $value['airport_departure_icao']; |
|
1431 | - $alldata[$icao] = $value; |
|
1432 | - } |
|
1433 | - foreach ($dall as $value) { |
|
1434 | - $icao = $value['airport_departure_icao']; |
|
1435 | - if (isset($alldata[$icao])) { |
|
1436 | - $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
1437 | - } else $alldata[$icao] = $value; |
|
1438 | - } |
|
1439 | - $count = array(); |
|
1440 | - foreach ($alldata as $key => $row) { |
|
1441 | - $count[$key] = $row['airport_departure_icao_count']; |
|
1442 | - } |
|
1429 | + foreach ($pall as $value) { |
|
1430 | + $icao = $value['airport_departure_icao']; |
|
1431 | + $alldata[$icao] = $value; |
|
1432 | + } |
|
1433 | + foreach ($dall as $value) { |
|
1434 | + $icao = $value['airport_departure_icao']; |
|
1435 | + if (isset($alldata[$icao])) { |
|
1436 | + $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
1437 | + } else $alldata[$icao] = $value; |
|
1438 | + } |
|
1439 | + $count = array(); |
|
1440 | + foreach ($alldata as $key => $row) { |
|
1441 | + $count[$key] = $row['airport_departure_icao_count']; |
|
1442 | + } |
|
1443 | 1443 | array_multisort($count,SORT_DESC,$alldata); |
1444 | 1444 | foreach ($alldata as $number) { |
1445 | 1445 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']); |
@@ -1447,25 +1447,25 @@ discard block |
||
1447 | 1447 | if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
1448 | 1448 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
1449 | 1449 | if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
1450 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
1450 | + $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
1451 | 1451 | if ($globalDebug) echo 'Order arrival airports...'."\n"; |
1452 | - $alldata = array(); |
|
1453 | - foreach ($pall as $value) { |
|
1454 | - $icao = $value['airport_arrival_icao']; |
|
1455 | - $alldata[$icao] = $value; |
|
1456 | - } |
|
1457 | - foreach ($dall as $value) { |
|
1458 | - $icao = $value['airport_arrival_icao']; |
|
1459 | - if (isset($alldata[$icao])) { |
|
1460 | - $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
1461 | - } else $alldata[$icao] = $value; |
|
1462 | - } |
|
1463 | - $count = array(); |
|
1464 | - foreach ($alldata as $key => $row) { |
|
1465 | - $count[$key] = $row['airport_arrival_icao_count']; |
|
1466 | - } |
|
1467 | - array_multisort($count,SORT_DESC,$alldata); |
|
1468 | - foreach ($alldata as $number) { |
|
1452 | + $alldata = array(); |
|
1453 | + foreach ($pall as $value) { |
|
1454 | + $icao = $value['airport_arrival_icao']; |
|
1455 | + $alldata[$icao] = $value; |
|
1456 | + } |
|
1457 | + foreach ($dall as $value) { |
|
1458 | + $icao = $value['airport_arrival_icao']; |
|
1459 | + if (isset($alldata[$icao])) { |
|
1460 | + $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
1461 | + } else $alldata[$icao] = $value; |
|
1462 | + } |
|
1463 | + $count = array(); |
|
1464 | + foreach ($alldata as $key => $row) { |
|
1465 | + $count[$key] = $row['airport_arrival_icao_count']; |
|
1466 | + } |
|
1467 | + array_multisort($count,SORT_DESC,$alldata); |
|
1468 | + foreach ($alldata as $number) { |
|
1469 | 1469 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']); |
1470 | 1470 | } |
1471 | 1471 | if ($Connection->tableExists('countries')) { |
@@ -1525,8 +1525,8 @@ discard block |
||
1525 | 1525 | // $pall = $Spotter->getLast7DaysAirportsDeparture(); |
1526 | 1526 | // $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
1527 | 1527 | $pall = $Spotter->getLast7DaysAirportsDeparture(); |
1528 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
|
1529 | - /* |
|
1528 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
|
1529 | + /* |
|
1530 | 1530 | $alldata = array(); |
1531 | 1531 | foreach ($pall as $value) { |
1532 | 1532 | $icao = $value['departure_airport_icao']; |
@@ -1545,29 +1545,29 @@ discard block |
||
1545 | 1545 | } |
1546 | 1546 | array_multisort($count,SORT_DESC,$alldata); |
1547 | 1547 | */ |
1548 | - foreach ($dall as $value) { |
|
1549 | - $icao = $value['departure_airport_icao']; |
|
1550 | - $ddate = $value['date']; |
|
1551 | - $find = false; |
|
1552 | - foreach ($pall as $pvalue) { |
|
1553 | - if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
1554 | - $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
1555 | - $find = true; |
|
1556 | - break; |
|
1557 | - } |
|
1558 | - } |
|
1559 | - if ($find === false) { |
|
1560 | - $pall[] = $value; |
|
1561 | - } |
|
1562 | - } |
|
1563 | - $alldata = $pall; |
|
1548 | + foreach ($dall as $value) { |
|
1549 | + $icao = $value['departure_airport_icao']; |
|
1550 | + $ddate = $value['date']; |
|
1551 | + $find = false; |
|
1552 | + foreach ($pall as $pvalue) { |
|
1553 | + if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
1554 | + $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
1555 | + $find = true; |
|
1556 | + break; |
|
1557 | + } |
|
1558 | + } |
|
1559 | + if ($find === false) { |
|
1560 | + $pall[] = $value; |
|
1561 | + } |
|
1562 | + } |
|
1563 | + $alldata = $pall; |
|
1564 | 1564 | foreach ($alldata as $number) { |
1565 | 1565 | $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']); |
1566 | 1566 | } |
1567 | 1567 | echo '...Arrival'."\n"; |
1568 | 1568 | $pall = $Spotter->getLast7DaysAirportsArrival(); |
1569 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival(); |
|
1570 | - /* |
|
1569 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival(); |
|
1570 | + /* |
|
1571 | 1571 | $alldata = array(); |
1572 | 1572 | foreach ($pall as $value) { |
1573 | 1573 | $icao = $value['arrival_airport_icao']; |
@@ -1587,22 +1587,22 @@ discard block |
||
1587 | 1587 | */ |
1588 | 1588 | |
1589 | 1589 | |
1590 | - foreach ($dall as $value) { |
|
1591 | - $icao = $value['arrival_airport_icao']; |
|
1592 | - $ddate = $value['date']; |
|
1593 | - $find = false; |
|
1594 | - foreach ($pall as $pvalue) { |
|
1595 | - if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
1596 | - $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
1597 | - $find = true; |
|
1598 | - break; |
|
1599 | - } |
|
1600 | - } |
|
1601 | - if ($find === false) { |
|
1602 | - $pall[] = $value; |
|
1603 | - } |
|
1604 | - } |
|
1605 | - $alldata = $pall; |
|
1590 | + foreach ($dall as $value) { |
|
1591 | + $icao = $value['arrival_airport_icao']; |
|
1592 | + $ddate = $value['date']; |
|
1593 | + $find = false; |
|
1594 | + foreach ($pall as $pvalue) { |
|
1595 | + if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
1596 | + $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
1597 | + $find = true; |
|
1598 | + break; |
|
1599 | + } |
|
1600 | + } |
|
1601 | + if ($find === false) { |
|
1602 | + $pall[] = $value; |
|
1603 | + } |
|
1604 | + } |
|
1605 | + $alldata = $pall; |
|
1606 | 1606 | foreach ($alldata as $number) { |
1607 | 1607 | $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']); |
1608 | 1608 | } |
@@ -1669,51 +1669,51 @@ discard block |
||
1669 | 1669 | if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
1670 | 1670 | $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
1671 | 1671 | if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
1672 | - $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
1672 | + $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
1673 | 1673 | if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
1674 | - //$alldata = array(); |
|
1675 | - foreach ($dall as $value) { |
|
1676 | - $icao = $value['airport_departure_icao']; |
|
1677 | - $dicao = $value['airline_icao']; |
|
1678 | - $find = false; |
|
1679 | - foreach ($pall as $pvalue) { |
|
1680 | - if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
1681 | - $pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
1682 | - $find = true; |
|
1683 | - break; |
|
1684 | - } |
|
1685 | - } |
|
1686 | - if ($find === false) { |
|
1687 | - $pall[] = $value; |
|
1688 | - } |
|
1689 | - } |
|
1690 | - $alldata = $pall; |
|
1674 | + //$alldata = array(); |
|
1675 | + foreach ($dall as $value) { |
|
1676 | + $icao = $value['airport_departure_icao']; |
|
1677 | + $dicao = $value['airline_icao']; |
|
1678 | + $find = false; |
|
1679 | + foreach ($pall as $pvalue) { |
|
1680 | + if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
1681 | + $pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
1682 | + $find = true; |
|
1683 | + break; |
|
1684 | + } |
|
1685 | + } |
|
1686 | + if ($find === false) { |
|
1687 | + $pall[] = $value; |
|
1688 | + } |
|
1689 | + } |
|
1690 | + $alldata = $pall; |
|
1691 | 1691 | foreach ($alldata as $number) { |
1692 | 1692 | 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']); |
1693 | 1693 | } |
1694 | 1694 | if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
1695 | 1695 | $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
1696 | 1696 | if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
1697 | - $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
1697 | + $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
1698 | 1698 | if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
1699 | - //$alldata = array(); |
|
1700 | - foreach ($dall as $value) { |
|
1701 | - $icao = $value['airport_arrival_icao']; |
|
1702 | - $dicao = $value['airline_icao']; |
|
1703 | - $find = false; |
|
1704 | - foreach ($pall as $pvalue) { |
|
1705 | - if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
1706 | - $pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
1707 | - $find = true; |
|
1708 | - break; |
|
1709 | - } |
|
1710 | - } |
|
1711 | - if ($find === false) { |
|
1712 | - $pall[] = $value; |
|
1713 | - } |
|
1714 | - } |
|
1715 | - $alldata = $pall; |
|
1716 | - foreach ($alldata as $number) { |
|
1699 | + //$alldata = array(); |
|
1700 | + foreach ($dall as $value) { |
|
1701 | + $icao = $value['airport_arrival_icao']; |
|
1702 | + $dicao = $value['airline_icao']; |
|
1703 | + $find = false; |
|
1704 | + foreach ($pall as $pvalue) { |
|
1705 | + if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
1706 | + $pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
1707 | + $find = true; |
|
1708 | + break; |
|
1709 | + } |
|
1710 | + } |
|
1711 | + if ($find === false) { |
|
1712 | + $pall[] = $value; |
|
1713 | + } |
|
1714 | + } |
|
1715 | + $alldata = $pall; |
|
1716 | + foreach ($alldata as $number) { |
|
1717 | 1717 | 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']); |
1718 | 1718 | } |
1719 | 1719 | if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
@@ -1746,47 +1746,47 @@ discard block |
||
1746 | 1746 | } |
1747 | 1747 | if ($globalDebug) echo '...Departure'."\n"; |
1748 | 1748 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
1749 | - $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
|
1750 | - foreach ($dall as $value) { |
|
1751 | - $icao = $value['departure_airport_icao']; |
|
1752 | - $airline = $value['airline_icao']; |
|
1753 | - $ddate = $value['date']; |
|
1754 | - $find = false; |
|
1755 | - foreach ($pall as $pvalue) { |
|
1756 | - if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) { |
|
1757 | - $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
1758 | - $find = true; |
|
1759 | - break; |
|
1760 | - } |
|
1761 | - } |
|
1762 | - if ($find === false) { |
|
1763 | - $pall[] = $value; |
|
1764 | - } |
|
1765 | - } |
|
1766 | - $alldata = $pall; |
|
1749 | + $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
|
1750 | + foreach ($dall as $value) { |
|
1751 | + $icao = $value['departure_airport_icao']; |
|
1752 | + $airline = $value['airline_icao']; |
|
1753 | + $ddate = $value['date']; |
|
1754 | + $find = false; |
|
1755 | + foreach ($pall as $pvalue) { |
|
1756 | + if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) { |
|
1757 | + $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
1758 | + $find = true; |
|
1759 | + break; |
|
1760 | + } |
|
1761 | + } |
|
1762 | + if ($find === false) { |
|
1763 | + $pall[] = $value; |
|
1764 | + } |
|
1765 | + } |
|
1766 | + $alldata = $pall; |
|
1767 | 1767 | foreach ($alldata as $number) { |
1768 | 1768 | $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']); |
1769 | 1769 | } |
1770 | 1770 | if ($globalDebug) echo '...Arrival'."\n"; |
1771 | 1771 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
1772 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
|
1773 | - foreach ($dall as $value) { |
|
1774 | - $icao = $value['arrival_airport_icao']; |
|
1775 | - $airline = $value['airline_icao']; |
|
1776 | - $ddate = $value['date']; |
|
1777 | - $find = false; |
|
1778 | - foreach ($pall as $pvalue) { |
|
1779 | - if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) { |
|
1780 | - $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
1781 | - $find = true; |
|
1782 | - break; |
|
1783 | - } |
|
1784 | - } |
|
1785 | - if ($find === false) { |
|
1786 | - $pall[] = $value; |
|
1787 | - } |
|
1788 | - } |
|
1789 | - $alldata = $pall; |
|
1772 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
|
1773 | + foreach ($dall as $value) { |
|
1774 | + $icao = $value['arrival_airport_icao']; |
|
1775 | + $airline = $value['airline_icao']; |
|
1776 | + $ddate = $value['date']; |
|
1777 | + $find = false; |
|
1778 | + foreach ($pall as $pvalue) { |
|
1779 | + if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) { |
|
1780 | + $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
1781 | + $find = true; |
|
1782 | + break; |
|
1783 | + } |
|
1784 | + } |
|
1785 | + if ($find === false) { |
|
1786 | + $pall[] = $value; |
|
1787 | + } |
|
1788 | + } |
|
1789 | + $alldata = $pall; |
|
1790 | 1790 | foreach ($alldata as $number) { |
1791 | 1791 | $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']); |
1792 | 1792 | } |
@@ -1856,44 +1856,44 @@ discard block |
||
1856 | 1856 | } |
1857 | 1857 | |
1858 | 1858 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
1859 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
1860 | - $alldata = array(); |
|
1861 | - foreach ($pall as $value) { |
|
1862 | - $icao = $value['airport_departure_icao']; |
|
1863 | - $alldata[$icao] = $value; |
|
1864 | - } |
|
1865 | - foreach ($dall as $value) { |
|
1866 | - $icao = $value['airport_departure_icao']; |
|
1867 | - if (isset($alldata[$icao])) { |
|
1868 | - $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
1869 | - } else $alldata[$icao] = $value; |
|
1870 | - } |
|
1871 | - $count = array(); |
|
1872 | - foreach ($alldata as $key => $row) { |
|
1873 | - $count[$key] = $row['airport_departure_icao_count']; |
|
1874 | - } |
|
1859 | + $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
1860 | + $alldata = array(); |
|
1861 | + foreach ($pall as $value) { |
|
1862 | + $icao = $value['airport_departure_icao']; |
|
1863 | + $alldata[$icao] = $value; |
|
1864 | + } |
|
1865 | + foreach ($dall as $value) { |
|
1866 | + $icao = $value['airport_departure_icao']; |
|
1867 | + if (isset($alldata[$icao])) { |
|
1868 | + $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
1869 | + } else $alldata[$icao] = $value; |
|
1870 | + } |
|
1871 | + $count = array(); |
|
1872 | + foreach ($alldata as $key => $row) { |
|
1873 | + $count[$key] = $row['airport_departure_icao_count']; |
|
1874 | + } |
|
1875 | 1875 | array_multisort($count,SORT_DESC,$alldata); |
1876 | 1876 | foreach ($alldata as $number) { |
1877 | - 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); |
|
1877 | + 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); |
|
1878 | 1878 | } |
1879 | 1879 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,$filter); |
1880 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,$filter); |
|
1880 | + $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,$filter); |
|
1881 | 1881 | $alldata = array(); |
1882 | - foreach ($pall as $value) { |
|
1883 | - $icao = $value['airport_arrival_icao']; |
|
1884 | - $alldata[$icao] = $value; |
|
1885 | - } |
|
1886 | - foreach ($dall as $value) { |
|
1887 | - $icao = $value['airport_arrival_icao']; |
|
1888 | - if (isset($alldata[$icao])) { |
|
1889 | - $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
1890 | - } else $alldata[$icao] = $value; |
|
1891 | - } |
|
1892 | - $count = array(); |
|
1893 | - foreach ($alldata as $key => $row) { |
|
1894 | - $count[$key] = $row['airport_arrival_icao_count']; |
|
1895 | - } |
|
1896 | - array_multisort($count,SORT_DESC,$alldata); |
|
1882 | + foreach ($pall as $value) { |
|
1883 | + $icao = $value['airport_arrival_icao']; |
|
1884 | + $alldata[$icao] = $value; |
|
1885 | + } |
|
1886 | + foreach ($dall as $value) { |
|
1887 | + $icao = $value['airport_arrival_icao']; |
|
1888 | + if (isset($alldata[$icao])) { |
|
1889 | + $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
1890 | + } else $alldata[$icao] = $value; |
|
1891 | + } |
|
1892 | + $count = array(); |
|
1893 | + foreach ($alldata as $key => $row) { |
|
1894 | + $count[$key] = $row['airport_arrival_icao_count']; |
|
1895 | + } |
|
1896 | + array_multisort($count,SORT_DESC,$alldata); |
|
1897 | 1897 | foreach ($alldata as $number) { |
1898 | 1898 | 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); |
1899 | 1899 | } |
@@ -1922,45 +1922,45 @@ discard block |
||
1922 | 1922 | } |
1923 | 1923 | echo '...Departure'."\n"; |
1924 | 1924 | $pall = $Spotter->getLast7DaysAirportsDeparture('',$filter); |
1925 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
1925 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
1926 | 1926 | foreach ($dall as $value) { |
1927 | - $icao = $value['departure_airport_icao']; |
|
1928 | - $ddate = $value['date']; |
|
1929 | - $find = false; |
|
1930 | - foreach ($pall as $pvalue) { |
|
1931 | - if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
1932 | - $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
1933 | - $find = true; |
|
1934 | - break; |
|
1935 | - } |
|
1936 | - } |
|
1937 | - if ($find === false) { |
|
1938 | - $pall[] = $value; |
|
1939 | - } |
|
1940 | - } |
|
1941 | - $alldata = $pall; |
|
1927 | + $icao = $value['departure_airport_icao']; |
|
1928 | + $ddate = $value['date']; |
|
1929 | + $find = false; |
|
1930 | + foreach ($pall as $pvalue) { |
|
1931 | + if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
1932 | + $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
1933 | + $find = true; |
|
1934 | + break; |
|
1935 | + } |
|
1936 | + } |
|
1937 | + if ($find === false) { |
|
1938 | + $pall[] = $value; |
|
1939 | + } |
|
1940 | + } |
|
1941 | + $alldata = $pall; |
|
1942 | 1942 | foreach ($alldata as $number) { |
1943 | 1943 | $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); |
1944 | 1944 | } |
1945 | 1945 | echo '...Arrival'."\n"; |
1946 | 1946 | $pall = $Spotter->getLast7DaysAirportsArrival('',$filter); |
1947 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
1947 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
1948 | 1948 | foreach ($dall as $value) { |
1949 | 1949 | $icao = $value['arrival_airport_icao']; |
1950 | 1950 | $ddate = $value['date']; |
1951 | - $find = false; |
|
1951 | + $find = false; |
|
1952 | 1952 | foreach ($pall as $pvalue) { |
1953 | - if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
1954 | - $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
1955 | - $find = true; |
|
1956 | - break; |
|
1957 | - } |
|
1958 | - } |
|
1959 | - if ($find === false) { |
|
1960 | - $pall[] = $value; |
|
1961 | - } |
|
1962 | - } |
|
1963 | - $alldata = $pall; |
|
1953 | + if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
1954 | + $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
1955 | + $find = true; |
|
1956 | + break; |
|
1957 | + } |
|
1958 | + } |
|
1959 | + if ($find === false) { |
|
1960 | + $pall[] = $value; |
|
1961 | + } |
|
1962 | + } |
|
1963 | + $alldata = $pall; |
|
1964 | 1964 | foreach ($alldata as $number) { |
1965 | 1965 | $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); |
1966 | 1966 | } |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
40 | 40 | print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
41 | 41 | } |
42 | - ?> |
|
42 | + ?> |
|
43 | 43 | </div> |
44 | 44 | <?php |
45 | 45 | // print_r($Stats->getAllAirlineNames()); |
46 | - ?> |
|
46 | + ?> |
|
47 | 47 | <?php include('statistics-sub-menu.php'); ?> |
48 | 48 | <p class="global-stats"> |
49 | 49 | <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name)); ?></span> <?php echo _("Flights"); ?></span> |
@@ -51,23 +51,23 @@ discard block |
||
51 | 51 | <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
52 | 52 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
53 | 53 | <?php |
54 | - if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
54 | + if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
55 | 55 | ?> |
56 | 56 | <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name)); ?></span> <?php echo _("Pilots"); ?></span> |
57 | 57 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
58 | 58 | <?php |
59 | - } else { |
|
60 | - ?> |
|
59 | + } else { |
|
60 | + ?> |
|
61 | 61 | <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name)); ?></span> <?php echo _("Owners"); ?></span> |
62 | 62 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
63 | 63 | <?php |
64 | - } |
|
65 | - ?> |
|
64 | + } |
|
65 | + ?> |
|
66 | 66 | <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name)); ?></span> <?php echo _("Aircrafts"); ?></span> |
67 | 67 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
68 | 68 | <?php |
69 | - if ($airline_icao == '') { |
|
70 | - ?> |
|
69 | + if ($airline_icao == '') { |
|
70 | + ?> |
|
71 | 71 | <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name)); ?></span> <?php echo _("Airlines"); ?></span> |
72 | 72 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
73 | 73 | <?php |
@@ -88,25 +88,25 @@ discard block |
||
88 | 88 | <div class="col-md-6"> |
89 | 89 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
90 | 90 | <?php |
91 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name); |
|
92 | - if (count($aircraft_array) == 0) print _("No data available"); |
|
93 | - else { |
|
91 | + $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name); |
|
92 | + if (count($aircraft_array) == 0) print _("No data available"); |
|
93 | + else { |
|
94 | 94 | |
95 | - print '<div id="chart1" class="chart" width="100%"></div> |
|
95 | + print '<div id="chart1" class="chart" width="100%"></div> |
|
96 | 96 | <script> |
97 | 97 | google.load("visualization", "1", {packages:["corechart"]}); |
98 | 98 | google.setOnLoadCallback(drawChart1); |
99 | 99 | function drawChart1() { |
100 | 100 | var data = google.visualization.arrayToDataTable([ |
101 | 101 | ["'._("Aircraft").'", "'._("# of times").'"], '; |
102 | - $aircraft_data = ''; |
|
103 | - foreach($aircraft_array as $aircraft_item) |
|
104 | - { |
|
105 | - $aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
106 | - } |
|
107 | - $aircraft_data = substr($aircraft_data, 0, -1); |
|
108 | - print $aircraft_data; |
|
109 | - print ']); |
|
102 | + $aircraft_data = ''; |
|
103 | + foreach($aircraft_array as $aircraft_item) |
|
104 | + { |
|
105 | + $aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
106 | + } |
|
107 | + $aircraft_data = substr($aircraft_data, 0, -1); |
|
108 | + print $aircraft_data; |
|
109 | + print ']); |
|
110 | 110 | |
111 | 111 | var options = { |
112 | 112 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | drawChart1(); |
122 | 122 | }); |
123 | 123 | </script>'; |
124 | - } |
|
125 | - ?> |
|
124 | + } |
|
125 | + ?> |
|
126 | 126 | <div class="more"> |
127 | 127 | <a href="<?php print $globalURL; ?>/statistics/aircraft" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
128 | 128 | </div> |
@@ -130,26 +130,26 @@ discard block |
||
130 | 130 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
131 | 131 | <?php |
132 | 132 | // echo $airline_icao; |
133 | - if ($airline_icao == '' || $airline_icao == 'all') { |
|
133 | + if ($airline_icao == '' || $airline_icao == 'all') { |
|
134 | 134 | $airline_array = $Stats->countAllAirlines(true,$filter_name); |
135 | 135 | if (count($airline_array) > 0) { |
136 | - print '<div class="col-md-6">'; |
|
137 | - print '<h2>'._("Top 10 Most Common Airline").'</h2>'; |
|
138 | - print '<div id="chart2" class="chart" width="100%"></div> |
|
136 | + print '<div class="col-md-6">'; |
|
137 | + print '<h2>'._("Top 10 Most Common Airline").'</h2>'; |
|
138 | + print '<div id="chart2" class="chart" width="100%"></div> |
|
139 | 139 | <script> |
140 | 140 | google.load("visualization", "1", {packages:["corechart"]}); |
141 | 141 | google.setOnLoadCallback(drawChart2); |
142 | 142 | function drawChart2() { |
143 | 143 | var data = google.visualization.arrayToDataTable([ |
144 | 144 | ["'._("Airline").'", "'._("# of times").'"], '; |
145 | - $airline_data = ''; |
|
146 | - foreach($airline_array as $airline_item) |
|
147 | - { |
|
145 | + $airline_data = ''; |
|
146 | + foreach($airline_array as $airline_item) |
|
147 | + { |
|
148 | 148 | $airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
149 | - } |
|
150 | - $airline_data = substr($airline_data, 0, -1); |
|
151 | - print $airline_data; |
|
152 | - print ']); |
|
149 | + } |
|
150 | + $airline_data = substr($airline_data, 0, -1); |
|
151 | + print $airline_data; |
|
152 | + print ']); |
|
153 | 153 | |
154 | 154 | var options = { |
155 | 155 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -164,23 +164,23 @@ discard block |
||
164 | 164 | drawChart2(); |
165 | 165 | }); |
166 | 166 | </script>'; |
167 | - print '<div class="more"><a href="'.$globalURL.'/statistics/airline" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
|
168 | - print '</div>'; |
|
167 | + print '<div class="more"><a href="'.$globalURL.'/statistics/airline" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
|
168 | + print '</div>'; |
|
169 | 169 | } |
170 | 170 | ?> |
171 | 171 | </div> |
172 | 172 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
173 | 173 | <?php |
174 | - } |
|
174 | + } |
|
175 | 175 | ?> |
176 | 176 | <div class="row column"> |
177 | 177 | <?php |
178 | - $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name); |
|
179 | - if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
178 | + $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name); |
|
179 | + if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
180 | 180 | if (empty($flightover_array)) { |
181 | - print '<div class="col-md-12">'; |
|
181 | + print '<div class="col-md-12">'; |
|
182 | 182 | } else { |
183 | - print '<div class="col-md-6">'; |
|
183 | + print '<div class="col-md-6">'; |
|
184 | 184 | } |
185 | 185 | ?> |
186 | 186 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
@@ -188,21 +188,21 @@ discard block |
||
188 | 188 | $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name); |
189 | 189 | if (count($pilot_array) == 0) print _("No data available"); |
190 | 190 | else { |
191 | - print '<div id="chart7" class="chart" width="100%"></div> |
|
191 | + print '<div id="chart7" class="chart" width="100%"></div> |
|
192 | 192 | <script> |
193 | 193 | google.load("visualization", "1", {packages:["corechart"]}); |
194 | 194 | google.setOnLoadCallback(drawChart7); |
195 | 195 | function drawChart7() { |
196 | 196 | var data = google.visualization.arrayToDataTable([ |
197 | 197 | ["'._("Pilots").'", "'._("# of times").'"], '; |
198 | - $pilot_data = ''; |
|
199 | - foreach($pilot_array as $pilot_item) |
|
200 | - { |
|
198 | + $pilot_data = ''; |
|
199 | + foreach($pilot_array as $pilot_item) |
|
200 | + { |
|
201 | 201 | $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
202 | - } |
|
203 | - $pilot_data = substr($pilot_data, 0, -1); |
|
204 | - print $pilot_data; |
|
205 | - print ']); |
|
202 | + } |
|
203 | + $pilot_data = substr($pilot_data, 0, -1); |
|
204 | + print $pilot_data; |
|
205 | + print ']); |
|
206 | 206 | |
207 | 207 | var options = { |
208 | 208 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | drawChart7(); |
218 | 218 | }); |
219 | 219 | </script>'; |
220 | - } |
|
220 | + } |
|
221 | 221 | ?> |
222 | 222 | <div class="more"> |
223 | 223 | <a href="<?php print $globalURL; ?>/statistics/pilot" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | |
227 | 227 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
228 | 228 | <?php |
229 | - } else { |
|
229 | + } else { |
|
230 | 230 | ?> |
231 | 231 | <div class="col-md-6"> |
232 | 232 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
@@ -234,21 +234,21 @@ discard block |
||
234 | 234 | $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name); |
235 | 235 | if (count($owner_array) == 0) print _("No data available"); |
236 | 236 | else { |
237 | - print '<div id="chart7" class="chart" width="100%"></div> |
|
237 | + print '<div id="chart7" class="chart" width="100%"></div> |
|
238 | 238 | <script> |
239 | 239 | google.load("visualization", "1", {packages:["corechart"]}); |
240 | 240 | google.setOnLoadCallback(drawChart7); |
241 | 241 | function drawChart7() { |
242 | 242 | var data = google.visualization.arrayToDataTable([ |
243 | 243 | ["'._("Owner").'", "'._("# of times").'"], '; |
244 | - $owner_data = ''; |
|
245 | - foreach($owner_array as $owner_item) |
|
246 | - { |
|
244 | + $owner_data = ''; |
|
245 | + foreach($owner_array as $owner_item) |
|
246 | + { |
|
247 | 247 | $owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
248 | - } |
|
249 | - $owner_data = substr($owner_data, 0, -1); |
|
250 | - print $owner_data; |
|
251 | - print ']); |
|
248 | + } |
|
249 | + $owner_data = substr($owner_data, 0, -1); |
|
250 | + print $owner_data; |
|
251 | + print ']); |
|
252 | 252 | |
253 | 253 | var options = { |
254 | 254 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -272,8 +272,8 @@ discard block |
||
272 | 272 | |
273 | 273 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
274 | 274 | <?php |
275 | - } |
|
276 | - if (!empty($flightover_array)) { |
|
275 | + } |
|
276 | + if (!empty($flightover_array)) { |
|
277 | 277 | ?> |
278 | 278 | <div class="col-md-6"> |
279 | 279 | <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2> |
@@ -281,21 +281,21 @@ discard block |
||
281 | 281 | //$flightover_array = $Stats->countAllFlightOverCountries(); |
282 | 282 | if (count($flightover_array) == 0) print _("No data available"); |
283 | 283 | else { |
284 | - print '<div id="chart10" class="chart" width="100%"></div> |
|
284 | + print '<div id="chart10" class="chart" width="100%"></div> |
|
285 | 285 | <script> |
286 | 286 | google.load("visualization", "1", {packages:["corechart"]}); |
287 | 287 | google.setOnLoadCallback(drawChart10); |
288 | 288 | function drawChart10() { |
289 | 289 | var data = google.visualization.arrayToDataTable([ |
290 | 290 | ["'._("Country").'", "'._("# of times").'"], '; |
291 | - $flightover_data = ''; |
|
292 | - foreach($flightover_array as $flightover_item) |
|
293 | - { |
|
291 | + $flightover_data = ''; |
|
292 | + foreach($flightover_array as $flightover_item) |
|
293 | + { |
|
294 | 294 | $flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],'; |
295 | - } |
|
296 | - $flightover_data = substr($flightover_data, 0, -1); |
|
297 | - print $flightover_data; |
|
298 | - print ']); |
|
295 | + } |
|
296 | + $flightover_data = substr($flightover_data, 0, -1); |
|
297 | + print $flightover_data; |
|
298 | + print ']); |
|
299 | 299 | |
300 | 300 | var options = { |
301 | 301 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | </div> |
320 | 320 | </div> |
321 | 321 | <?php |
322 | - } |
|
322 | + } |
|
323 | 323 | ?> |
324 | 324 | </div> |
325 | 325 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | <div class="row column"> |
330 | 330 | <div class="col-md-6"> |
331 | 331 | <?php |
332 | - $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name); |
|
333 | - if (count($airport_airport_array) > 0) { |
|
332 | + $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name); |
|
333 | + if (count($airport_airport_array) > 0) { |
|
334 | 334 | print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>'; |
335 | 335 | print '<div id="chart3" class="chart" width="100%"></div> |
336 | 336 | <script> |
@@ -343,13 +343,13 @@ discard block |
||
343 | 343 | |
344 | 344 | var data = google.visualization.arrayToDataTable([ |
345 | 345 | ["'._("Airport").'", "'._("# of times").'"],'; |
346 | - $airport_data = ''; |
|
346 | + $airport_data = ''; |
|
347 | 347 | foreach($airport_airport_array as $airport_item) |
348 | 348 | { |
349 | - $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')'; |
|
350 | - $name = str_replace("'", "", $name); |
|
351 | - $name = str_replace('"', "", $name); |
|
352 | - $airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],'; |
|
349 | + $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')'; |
|
350 | + $name = str_replace("'", "", $name); |
|
351 | + $name = str_replace('"', "", $name); |
|
352 | + $airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],'; |
|
353 | 353 | } |
354 | 354 | $airport_data = substr($airport_data, 0, -1); |
355 | 355 | print $airport_data; |
@@ -368,15 +368,15 @@ discard block |
||
368 | 368 | } |
369 | 369 | </script>'; |
370 | 370 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
371 | - } |
|
371 | + } |
|
372 | 372 | ?> |
373 | 373 | </div> |
374 | 374 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
375 | 375 | |
376 | 376 | <div class="col-md-6"> |
377 | 377 | <?php |
378 | - $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name); |
|
379 | - if (count($airport_airport_array2) > 0) { |
|
378 | + $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name); |
|
379 | + if (count($airport_airport_array2) > 0) { |
|
380 | 380 | print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>'; |
381 | 381 | print '<div id="chart4" class="chart" width="100%"></div> |
382 | 382 | <script> |
@@ -392,9 +392,9 @@ discard block |
||
392 | 392 | $airport_data2 = ''; |
393 | 393 | foreach($airport_airport_array2 as $airport_item2) |
394 | 394 | { |
395 | - $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')'; |
|
396 | - $name2 = str_replace(array("'",'"'), '', $name2); |
|
397 | - $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],'; |
|
395 | + $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')'; |
|
396 | + $name2 = str_replace(array("'",'"'), '', $name2); |
|
397 | + $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],'; |
|
398 | 398 | } |
399 | 399 | $airport_data2 = substr($airport_data2, 0, -1); |
400 | 400 | print $airport_data2; |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | } |
414 | 414 | </script>'; |
415 | 415 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
416 | - } |
|
416 | + } |
|
417 | 417 | ?> |
418 | 418 | </div> |
419 | 419 | </div> |
@@ -423,24 +423,24 @@ discard block |
||
423 | 423 | <div class="col-md-6"> |
424 | 424 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
425 | 425 | <?php |
426 | - $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
427 | - if (count($year_array) == 0) print _("No data available"); |
|
428 | - else { |
|
429 | - print '<div id="chart8" class="chart" width="100%"></div> |
|
426 | + $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
427 | + if (count($year_array) == 0) print _("No data available"); |
|
428 | + else { |
|
429 | + print '<div id="chart8" class="chart" width="100%"></div> |
|
430 | 430 | <script> |
431 | 431 | google.load("visualization", "1", {packages:["corechart"]}); |
432 | 432 | google.setOnLoadCallback(drawChart8); |
433 | 433 | function drawChart8() { |
434 | 434 | var data = google.visualization.arrayToDataTable([ |
435 | 435 | ["'._("Month").'", "'._("# of Flights").'"], '; |
436 | - $year_data = ''; |
|
437 | - foreach($year_array as $year_item) |
|
438 | - { |
|
439 | - $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],'; |
|
440 | - } |
|
441 | - $year_data = substr($year_data, 0, -1); |
|
442 | - print $year_data; |
|
443 | - print ']); |
|
436 | + $year_data = ''; |
|
437 | + foreach($year_array as $year_item) |
|
438 | + { |
|
439 | + $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],'; |
|
440 | + } |
|
441 | + $year_data = substr($year_data, 0, -1); |
|
442 | + print $year_data; |
|
443 | + print ']); |
|
444 | 444 | |
445 | 445 | var options = { |
446 | 446 | legend: {position: "none"}, |
@@ -458,8 +458,8 @@ discard block |
||
458 | 458 | drawChart8(); |
459 | 459 | }); |
460 | 460 | </script>'; |
461 | - } |
|
462 | - ?> |
|
461 | + } |
|
462 | + ?> |
|
463 | 463 | <div class="more"> |
464 | 464 | <a href="<?php print $globalURL; ?>/statistics/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
465 | 465 | </div> |
@@ -469,24 +469,24 @@ discard block |
||
469 | 469 | <div class="col-md-6"> |
470 | 470 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
471 | 471 | <?php |
472 | - $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
473 | - if (count($month_array) == 0) print _("No data available"); |
|
474 | - else { |
|
475 | - print '<div id="chart9" class="chart" width="100%"></div> |
|
472 | + $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
473 | + if (count($month_array) == 0) print _("No data available"); |
|
474 | + else { |
|
475 | + print '<div id="chart9" class="chart" width="100%"></div> |
|
476 | 476 | <script> |
477 | 477 | google.load("visualization", "1", {packages:["corechart"]}); |
478 | 478 | google.setOnLoadCallback(drawChart9); |
479 | 479 | function drawChart9() { |
480 | 480 | var data = google.visualization.arrayToDataTable([ |
481 | 481 | ["'._("Day").'", "'._("# of Flights").'"], '; |
482 | - $month_data = ''; |
|
483 | - foreach($month_array as $month_item) |
|
484 | - { |
|
485 | - $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],'; |
|
486 | - } |
|
487 | - $month_data = substr($month_data, 0, -1); |
|
488 | - print $month_data; |
|
489 | - print ']); |
|
482 | + $month_data = ''; |
|
483 | + foreach($month_array as $month_item) |
|
484 | + { |
|
485 | + $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],'; |
|
486 | + } |
|
487 | + $month_data = substr($month_data, 0, -1); |
|
488 | + print $month_data; |
|
489 | + print ']); |
|
490 | 490 | |
491 | 491 | var options = { |
492 | 492 | legend: {position: "none"}, |
@@ -504,8 +504,8 @@ discard block |
||
504 | 504 | drawChart9(); |
505 | 505 | }); |
506 | 506 | </script>'; |
507 | - } |
|
508 | - ?> |
|
507 | + } |
|
508 | + ?> |
|
509 | 509 | <div class="more"> |
510 | 510 | <a href="<?php print $globalURL; ?>/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
511 | 511 | </div> |
@@ -515,25 +515,25 @@ discard block |
||
515 | 515 | <div class="col-md-6"> |
516 | 516 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
517 | 517 | <?php |
518 | - $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
519 | - if (empty($date_array)) print _("No data available"); |
|
520 | - else { |
|
521 | - print '<div id="chart5" class="chart" width="100%"></div> |
|
518 | + $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
519 | + if (empty($date_array)) print _("No data available"); |
|
520 | + else { |
|
521 | + print '<div id="chart5" class="chart" width="100%"></div> |
|
522 | 522 | <script> |
523 | 523 | google.load("visualization", "1", {packages:["corechart"]}); |
524 | 524 | google.setOnLoadCallback(drawChart5); |
525 | 525 | function drawChart5() { |
526 | 526 | var data = google.visualization.arrayToDataTable([ |
527 | 527 | ["'._("Date").'", "'._("# of Flights").'"], '; |
528 | - $date_data = ''; |
|
528 | + $date_data = ''; |
|
529 | 529 | |
530 | - foreach($date_array as $date_item) |
|
531 | - { |
|
532 | - $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],'; |
|
533 | - } |
|
534 | - $date_data = substr($date_data, 0, -1); |
|
535 | - print $date_data; |
|
536 | - print ']); |
|
530 | + foreach($date_array as $date_item) |
|
531 | + { |
|
532 | + $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],'; |
|
533 | + } |
|
534 | + $date_data = substr($date_data, 0, -1); |
|
535 | + print $date_data; |
|
536 | + print ']); |
|
537 | 537 | |
538 | 538 | var options = { |
539 | 539 | legend: {position: "none"}, |
@@ -551,8 +551,8 @@ discard block |
||
551 | 551 | drawChart5(); |
552 | 552 | }); |
553 | 553 | </script>'; |
554 | - } |
|
555 | - ?> |
|
554 | + } |
|
555 | + ?> |
|
556 | 556 | <div class="more"> |
557 | 557 | <a href="<?php print $globalURL; ?>/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
558 | 558 | </div> |
@@ -562,25 +562,25 @@ discard block |
||
562 | 562 | <div class="col-md-6"> |
563 | 563 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
564 | 564 | <?php |
565 | - $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
566 | - if (empty($hour_array)) print _("No data available"); |
|
567 | - else { |
|
565 | + $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
566 | + if (empty($hour_array)) print _("No data available"); |
|
567 | + else { |
|
568 | 568 | |
569 | - print '<div id="chart6" class="chart" width="100%"></div> |
|
569 | + print '<div id="chart6" class="chart" width="100%"></div> |
|
570 | 570 | <script> |
571 | 571 | google.load("visualization", "1", {packages:["corechart"]}); |
572 | 572 | google.setOnLoadCallback(drawChart6); |
573 | 573 | function drawChart6() { |
574 | 574 | var data = google.visualization.arrayToDataTable([ |
575 | 575 | ["'._("Hour").'", "'._("# of Flights").'"], '; |
576 | - $hour_data = ''; |
|
577 | - foreach($hour_array as $hour_item) |
|
578 | - { |
|
579 | - $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],'; |
|
580 | - } |
|
581 | - $hour_data = substr($hour_data, 0, -1); |
|
582 | - print $hour_data; |
|
583 | - print ']); |
|
576 | + $hour_data = ''; |
|
577 | + foreach($hour_array as $hour_item) |
|
578 | + { |
|
579 | + $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],'; |
|
580 | + } |
|
581 | + $hour_data = substr($hour_data, 0, -1); |
|
582 | + print $hour_data; |
|
583 | + print ']); |
|
584 | 584 | |
585 | 585 | var options = { |
586 | 586 | legend: {position: "none"}, |
@@ -598,8 +598,8 @@ discard block |
||
598 | 598 | drawChart6(); |
599 | 599 | }); |
600 | 600 | </script>'; |
601 | - } |
|
602 | - ?> |
|
601 | + } |
|
602 | + ?> |
|
603 | 603 | <div class="more"> |
604 | 604 | <a href="<?php print $globalURL; ?>/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
605 | 605 | </div> |
@@ -607,21 +607,21 @@ discard block |
||
607 | 607 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
608 | 608 | </div> |
609 | 609 | <?php |
610 | - if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '') { |
|
610 | + if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '') { |
|
611 | 611 | ?> |
612 | 612 | <div class="row column"> |
613 | 613 | <?php |
614 | - $polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
|
615 | - if (!empty($polar)) { |
|
616 | - print '<h2>'._("Coverage pattern").'</h2>'; |
|
617 | - foreach ($polar as $eachpolar) { |
|
618 | - unset($polar_data); |
|
619 | - $Spotter = new Spotter(); |
|
620 | - $data = json_decode($eachpolar['source_data']); |
|
621 | - foreach($data as $value => $key) { |
|
622 | - $direction = $Spotter->parseDirection(($value*22.5)); |
|
623 | - $distance = $key; |
|
624 | - $unit = 'km'; |
|
614 | + $polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
|
615 | + if (!empty($polar)) { |
|
616 | + print '<h2>'._("Coverage pattern").'</h2>'; |
|
617 | + foreach ($polar as $eachpolar) { |
|
618 | + unset($polar_data); |
|
619 | + $Spotter = new Spotter(); |
|
620 | + $data = json_decode($eachpolar['source_data']); |
|
621 | + foreach($data as $value => $key) { |
|
622 | + $direction = $Spotter->parseDirection(($value*22.5)); |
|
623 | + $distance = $key; |
|
624 | + $unit = 'km'; |
|
625 | 625 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
626 | 626 | $distance = round($distance*0.539957); |
627 | 627 | $unit = 'nm'; |
@@ -632,10 +632,10 @@ discard block |
||
632 | 632 | $distance = $distance; |
633 | 633 | $unit = 'km'; |
634 | 634 | } |
635 | - if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
636 | - else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
637 | - } |
|
638 | - ?> |
|
635 | + if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
636 | + else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
637 | + } |
|
638 | + ?> |
|
639 | 639 | <div class="col-md-6"> |
640 | 640 | <h4><?php print $eachpolar['source_name']; ?></h4> |
641 | 641 | <div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
@@ -667,22 +667,22 @@ discard block |
||
667 | 667 | </script> |
668 | 668 | </div> |
669 | 669 | <?php |
670 | - } |
|
671 | - } |
|
672 | - ?> |
|
670 | + } |
|
671 | + } |
|
672 | + ?> |
|
673 | 673 | </div> |
674 | 674 | <div class="row column"> |
675 | 675 | <div class="col-md-6"> |
676 | 676 | <?php |
677 | - $msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
|
678 | - if (!empty($msg)) { |
|
679 | - print '<h2>'._("Messages received").'</h2>'; |
|
680 | - foreach ($msg as $eachmsg) { |
|
681 | - //$eachmsg = $msg[0]; |
|
682 | - $data = $eachmsg['source_data']; |
|
683 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
684 | - else $max = 500; |
|
685 | - ?> |
|
677 | + $msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
|
678 | + if (!empty($msg)) { |
|
679 | + print '<h2>'._("Messages received").'</h2>'; |
|
680 | + foreach ($msg as $eachmsg) { |
|
681 | + //$eachmsg = $msg[0]; |
|
682 | + $data = $eachmsg['source_data']; |
|
683 | + if ($data > 500) $max = (round(($data+100)/100))*100; |
|
684 | + else $max = 500; |
|
685 | + ?> |
|
686 | 686 | <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
687 | 687 | <script> |
688 | 688 | var g = new JustGage({ |
@@ -698,9 +698,9 @@ discard block |
||
698 | 698 | }); |
699 | 699 | </script> |
700 | 700 | <?php |
701 | - } |
|
702 | - } |
|
703 | - ?> |
|
701 | + } |
|
702 | + } |
|
703 | + ?> |
|
704 | 704 | </div> |
705 | 705 | </div> |
706 | 706 | <div class="row column"> |
@@ -727,19 +727,19 @@ discard block |
||
727 | 727 | $hist_data .= '[ "'.$distance.'",'.$nb.'],'; |
728 | 728 | } |
729 | 729 | $hist_data = substr($hist_data, 0, -1); |
730 | - ?> |
|
730 | + ?> |
|
731 | 731 | <div class="col-md-6"> |
732 | 732 | <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2> |
733 | 733 | <?php |
734 | - print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div> |
|
734 | + print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div> |
|
735 | 735 | <script> |
736 | 736 | google.load("visualization", "1", {packages:["corechart"]}); |
737 | 737 | google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).'); |
738 | 738 | function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() { |
739 | 739 | var data = google.visualization.arrayToDataTable([ |
740 | 740 | ["'._("Distance").'", "'._("# of Flights").'"], '; |
741 | - print $hist_data; |
|
742 | - print ']); |
|
741 | + print $hist_data; |
|
742 | + print ']); |
|
743 | 743 | |
744 | 744 | var options = { |
745 | 745 | legend: {position: "none"}, |
@@ -757,15 +757,15 @@ discard block |
||
757 | 757 | drawCharthist_'.str_replace(' ','_',strtolower($source)).'(); |
758 | 758 | }); |
759 | 759 | </script>'; |
760 | - ?> |
|
760 | + ?> |
|
761 | 761 | </div> |
762 | 762 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
763 | 763 | <?php |
764 | - } |
|
765 | - ?> |
|
764 | + } |
|
765 | + ?> |
|
766 | 766 | </div> |
767 | 767 | <?php |
768 | - } |
|
768 | + } |
|
769 | 769 | ?> |
770 | 770 | </div> |
771 | 771 | </div> |