@@ -18,6 +18,10 @@ discard block |
||
18 | 18 | $this->db = $Connection->db(); |
19 | 19 | } |
20 | 20 | |
21 | + /** |
|
22 | + * @param string $type |
|
23 | + * @param string $stats_date |
|
24 | + */ |
|
21 | 25 | public function addLastStatsUpdate($type,$stats_date) { |
22 | 26 | $query = "DELETE FROM config WHERE name = :type; |
23 | 27 | INSERT INTO config (name,value) VALUES (:type,:stats_date);"; |
@@ -1368,6 +1372,10 @@ discard block |
||
1368 | 1372 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1369 | 1373 | return $all; |
1370 | 1374 | } |
1375 | + |
|
1376 | + /** |
|
1377 | + * @param string $type |
|
1378 | + */ |
|
1371 | 1379 | public function deleteStatsByType($type,$stats_airline = '', $filter_name = '') { |
1372 | 1380 | if ($filter_name == '') $filter_name = $this->filter_name; |
1373 | 1381 | $query = "DELETE FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -1379,6 +1387,11 @@ discard block |
||
1379 | 1387 | echo "error : ".$e->getMessage(); |
1380 | 1388 | } |
1381 | 1389 | } |
1390 | + |
|
1391 | + /** |
|
1392 | + * @param string $type |
|
1393 | + * @param string $year |
|
1394 | + */ |
|
1382 | 1395 | public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
1383 | 1396 | if ($filter_name == '') $filter_name = $this->filter_name; |
1384 | 1397 | global $globalArchiveMonths, $globalDBdriver; |
@@ -1578,6 +1591,10 @@ discard block |
||
1578 | 1591 | else return 0; |
1579 | 1592 | } |
1580 | 1593 | |
1594 | + /** |
|
1595 | + * @param string $type |
|
1596 | + * @param string $stats_date |
|
1597 | + */ |
|
1581 | 1598 | public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
1582 | 1599 | global $globalDBdriver; |
1583 | 1600 | if ($filter_name == '') $filter_name = $this->filter_name; |
@@ -1631,6 +1648,9 @@ discard block |
||
1631 | 1648 | } |
1632 | 1649 | */ |
1633 | 1650 | |
1651 | + /** |
|
1652 | + * @param string $stats_type |
|
1653 | + */ |
|
1634 | 1654 | public function getStatsSource($stats_type,$year = '',$month = '',$day = '') { |
1635 | 1655 | global $globalDBdriver; |
1636 | 1656 | $query = "SELECT * FROM stats_source WHERE stats_type = :stats_type"; |
@@ -1674,6 +1694,9 @@ discard block |
||
1674 | 1694 | return $all; |
1675 | 1695 | } |
1676 | 1696 | |
1697 | + /** |
|
1698 | + * @param string $stats_type |
|
1699 | + */ |
|
1677 | 1700 | public function addStatSource($data,$source_name,$stats_type,$date) { |
1678 | 1701 | global $globalDBdriver; |
1679 | 1702 | if ($globalDBdriver == 'mysql') { |
@@ -1689,6 +1712,10 @@ discard block |
||
1689 | 1712 | return "error : ".$e->getMessage(); |
1690 | 1713 | } |
1691 | 1714 | } |
1715 | + |
|
1716 | + /** |
|
1717 | + * @param string $type |
|
1718 | + */ |
|
1692 | 1719 | public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
1693 | 1720 | $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
1694 | 1721 | $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
@@ -1955,6 +1982,10 @@ discard block |
||
1955 | 1982 | return "error : ".$e->getMessage(); |
1956 | 1983 | } |
1957 | 1984 | } |
1985 | + |
|
1986 | + /** |
|
1987 | + * @param string $type |
|
1988 | + */ |
|
1958 | 1989 | public function deleteStatFlight($type) { |
1959 | 1990 | $query = "DELETE FROM stats_flight WHERE stats_type = :type"; |
1960 | 1991 | $query_values = array(':type' => $type); |
@@ -1965,6 +1996,10 @@ discard block |
||
1965 | 1996 | return "error : ".$e->getMessage(); |
1966 | 1997 | } |
1967 | 1998 | } |
1999 | + |
|
2000 | + /** |
|
2001 | + * @param string $type |
|
2002 | + */ |
|
1968 | 2003 | public function deleteStatAirport($type) { |
1969 | 2004 | $query = "DELETE FROM stats_airport WHERE stats_type = :type"; |
1970 | 2005 | $query_values = array(':type' => $type); |
@@ -16,33 +16,33 @@ discard block |
||
16 | 16 | if (isset($globalFilterName)) $this->filter_name = $globalFilterName; |
17 | 17 | $Connection = new Connection($dbc); |
18 | 18 | $this->db = $Connection->db(); |
19 | - } |
|
19 | + } |
|
20 | 20 | |
21 | 21 | public function addLastStatsUpdate($type,$stats_date) { |
22 | - $query = "DELETE FROM config WHERE name = :type; |
|
22 | + $query = "DELETE FROM config WHERE name = :type; |
|
23 | 23 | INSERT INTO config (name,value) VALUES (:type,:stats_date);"; |
24 | - $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
25 | - try { |
|
26 | - $sth = $this->db->prepare($query); |
|
27 | - $sth->execute($query_values); |
|
28 | - } catch(PDOException $e) { |
|
29 | - return "error : ".$e->getMessage(); |
|
30 | - } |
|
31 | - } |
|
24 | + $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
25 | + try { |
|
26 | + $sth = $this->db->prepare($query); |
|
27 | + $sth->execute($query_values); |
|
28 | + } catch(PDOException $e) { |
|
29 | + return "error : ".$e->getMessage(); |
|
30 | + } |
|
31 | + } |
|
32 | 32 | |
33 | 33 | public function getLastStatsUpdate($type = 'last_update_stats') { |
34 | - $query = "SELECT value FROM config WHERE name = :type"; |
|
35 | - try { |
|
36 | - $sth = $this->db->prepare($query); |
|
37 | - $sth->execute(array(':type' => $type)); |
|
38 | - } catch(PDOException $e) { |
|
39 | - echo "error : ".$e->getMessage(); |
|
40 | - } |
|
41 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
42 | - return $all; |
|
43 | - } |
|
44 | - public function deleteStats($filter_name = '') { |
|
45 | - /* |
|
34 | + $query = "SELECT value FROM config WHERE name = :type"; |
|
35 | + try { |
|
36 | + $sth = $this->db->prepare($query); |
|
37 | + $sth->execute(array(':type' => $type)); |
|
38 | + } catch(PDOException $e) { |
|
39 | + echo "error : ".$e->getMessage(); |
|
40 | + } |
|
41 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
42 | + return $all; |
|
43 | + } |
|
44 | + public function deleteStats($filter_name = '') { |
|
45 | + /* |
|
46 | 46 | $query = "DELETE FROM config WHERE name = 'last_update_stats'"; |
47 | 47 | try { |
48 | 48 | $sth = $this->db->prepare($query); |
@@ -51,35 +51,35 @@ discard block |
||
51 | 51 | return "error : ".$e->getMessage(); |
52 | 52 | } |
53 | 53 | */ |
54 | - $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;"; |
|
55 | - try { |
|
56 | - $sth = $this->db->prepare($query); |
|
57 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
58 | - } catch(PDOException $e) { |
|
59 | - return "error : ".$e->getMessage(); |
|
60 | - } |
|
61 | - } |
|
62 | - public function deleteOldStats($filter_name = '') { |
|
63 | - if ($filter_name == '') { |
|
64 | - $query = "DELETE FROM config WHERE name = 'last_update_stats'"; |
|
65 | - } else { |
|
66 | - $query = "DELETE FROM config WHERE name = 'last_update_stats_".$filter_name."'"; |
|
67 | - } |
|
68 | - try { |
|
69 | - $sth = $this->db->prepare($query); |
|
70 | - $sth->execute(); |
|
71 | - } catch(PDOException $e) { |
|
72 | - return "error : ".$e->getMessage(); |
|
73 | - } |
|
54 | + $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;"; |
|
55 | + try { |
|
56 | + $sth = $this->db->prepare($query); |
|
57 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
58 | + } catch(PDOException $e) { |
|
59 | + return "error : ".$e->getMessage(); |
|
60 | + } |
|
61 | + } |
|
62 | + public function deleteOldStats($filter_name = '') { |
|
63 | + if ($filter_name == '') { |
|
64 | + $query = "DELETE FROM config WHERE name = 'last_update_stats'"; |
|
65 | + } else { |
|
66 | + $query = "DELETE FROM config WHERE name = 'last_update_stats_".$filter_name."'"; |
|
67 | + } |
|
68 | + try { |
|
69 | + $sth = $this->db->prepare($query); |
|
70 | + $sth->execute(); |
|
71 | + } catch(PDOException $e) { |
|
72 | + return "error : ".$e->getMessage(); |
|
73 | + } |
|
74 | 74 | |
75 | - $query = "DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;"; |
|
76 | - try { |
|
77 | - $sth = $this->db->prepare($query); |
|
78 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
79 | - } catch(PDOException $e) { |
|
80 | - return "error : ".$e->getMessage(); |
|
81 | - } |
|
82 | - } |
|
75 | + $query = "DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;"; |
|
76 | + try { |
|
77 | + $sth = $this->db->prepare($query); |
|
78 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
79 | + } catch(PDOException $e) { |
|
80 | + return "error : ".$e->getMessage(); |
|
81 | + } |
|
82 | + } |
|
83 | 83 | public function getAllAirlineNames($filter_name = '') { |
84 | 84 | if ($filter_name == '') $filter_name = $this->filter_name; |
85 | 85 | $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
@@ -227,17 +227,17 @@ discard block |
||
227 | 227 | } |
228 | 228 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
229 | 229 | } else $all = array(); |
230 | - if (empty($all)) { |
|
231 | - $Spotter = new Spotter($this->db); |
|
232 | - $filters = array(); |
|
233 | - $filters = array('year' => $year,'month' => $month); |
|
234 | - if ($filter_name != '') { |
|
235 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
236 | - } |
|
237 | - //$all = $Spotter->countAllAirlineCountries($limit,$filters,$year,$month); |
|
238 | - $all = $Spotter->countAllAirlineCountries($limit,$filters); |
|
239 | - } |
|
240 | - return $all; |
|
230 | + if (empty($all)) { |
|
231 | + $Spotter = new Spotter($this->db); |
|
232 | + $filters = array(); |
|
233 | + $filters = array('year' => $year,'month' => $month); |
|
234 | + if ($filter_name != '') { |
|
235 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
236 | + } |
|
237 | + //$all = $Spotter->countAllAirlineCountries($limit,$filters,$year,$month); |
|
238 | + $all = $Spotter->countAllAirlineCountries($limit,$filters); |
|
239 | + } |
|
240 | + return $all; |
|
241 | 241 | } |
242 | 242 | public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
243 | 243 | global $globalStatsFilters; |
@@ -402,17 +402,17 @@ discard block |
||
402 | 402 | } |
403 | 403 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
404 | 404 | } else $all = array(); |
405 | - if (empty($all)) { |
|
406 | - $Spotter = new Spotter($this->db); |
|
407 | - $filters = array(); |
|
405 | + if (empty($all)) { |
|
406 | + $Spotter = new Spotter($this->db); |
|
407 | + $filters = array(); |
|
408 | 408 | $filters = array('year' => $year,'month' => $month); |
409 | - if ($filter_name != '') { |
|
410 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
409 | + if ($filter_name != '') { |
|
410 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
411 | 411 | } |
412 | 412 | //$all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month); |
413 | - $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
414 | - } |
|
415 | - return $all; |
|
413 | + $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
414 | + } |
|
415 | + return $all; |
|
416 | 416 | } |
417 | 417 | public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
418 | 418 | global $globalStatsFilters; |
@@ -942,22 +942,22 @@ discard block |
||
942 | 942 | if ($filter_name == '') $filter_name = $this->filter_name; |
943 | 943 | $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"; |
944 | 944 | $query_data = array('filter_name' => $filter_name); |
945 | - try { |
|
946 | - $sth = $this->db->prepare($query); |
|
947 | - $sth->execute($query_data); |
|
948 | - } catch(PDOException $e) { |
|
949 | - echo "error : ".$e->getMessage(); |
|
950 | - } |
|
951 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
952 | - if (empty($all)) { |
|
953 | - $filters = array(); |
|
954 | - if ($filter_name != '') { |
|
955 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
945 | + try { |
|
946 | + $sth = $this->db->prepare($query); |
|
947 | + $sth->execute($query_data); |
|
948 | + } catch(PDOException $e) { |
|
949 | + echo "error : ".$e->getMessage(); |
|
950 | + } |
|
951 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
952 | + if (empty($all)) { |
|
953 | + $filters = array(); |
|
954 | + if ($filter_name != '') { |
|
955 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
956 | 956 | } |
957 | - $Spotter = new Spotter($this->db); |
|
958 | - $all = $Spotter->countAllDatesByAirlines($filters); |
|
959 | - } |
|
960 | - return $all; |
|
957 | + $Spotter = new Spotter($this->db); |
|
958 | + $all = $Spotter->countAllDatesByAirlines($filters); |
|
959 | + } |
|
960 | + return $all; |
|
961 | 961 | } |
962 | 962 | public function countAllMonths($stats_airline = '',$filter_name = '') { |
963 | 963 | global $globalStatsFilters, $globalDBdriver; |
@@ -1011,19 +1011,19 @@ discard block |
||
1011 | 1011 | } else { |
1012 | 1012 | $query = "SELECT EXTRACT(YEAR FROM stats_date) AS year, EXTRACT(MONTH FROM stats_date) as month,cnt as count FROM stats WHERE stats_type = 'fatalities_bymonth' ORDER BY stats_date"; |
1013 | 1013 | } |
1014 | - try { |
|
1015 | - $sth = $this->db->prepare($query); |
|
1016 | - $sth->execute(); |
|
1017 | - } catch(PDOException $e) { |
|
1018 | - echo "error : ".$e->getMessage(); |
|
1019 | - } |
|
1020 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
1014 | + try { |
|
1015 | + $sth = $this->db->prepare($query); |
|
1016 | + $sth->execute(); |
|
1017 | + } catch(PDOException $e) { |
|
1018 | + echo "error : ".$e->getMessage(); |
|
1019 | + } |
|
1020 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
1021 | 1021 | |
1022 | - if (empty($all)) { |
|
1023 | - $Accident = new Accident($this->db); |
|
1024 | - $all = $Accident->countFatalitiesLast12Months(); |
|
1025 | - } |
|
1026 | - return $all; |
|
1022 | + if (empty($all)) { |
|
1023 | + $Accident = new Accident($this->db); |
|
1024 | + $all = $Accident->countFatalitiesLast12Months(); |
|
1025 | + } |
|
1026 | + return $all; |
|
1027 | 1027 | } |
1028 | 1028 | public function countFatalitiesByYear() { |
1029 | 1029 | global $globalStatsFilters, $globalDBdriver; |
@@ -1032,40 +1032,40 @@ discard block |
||
1032 | 1032 | } else { |
1033 | 1033 | $query = "SELECT EXTRACT(YEAR FROM stats_date) AS year, cnt as count FROM stats WHERE stats_type = 'fatalities_byyear' ORDER BY stats_date"; |
1034 | 1034 | } |
1035 | - try { |
|
1036 | - $sth = $this->db->prepare($query); |
|
1037 | - $sth->execute(); |
|
1038 | - } catch(PDOException $e) { |
|
1039 | - echo "error : ".$e->getMessage(); |
|
1040 | - } |
|
1041 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
1035 | + try { |
|
1036 | + $sth = $this->db->prepare($query); |
|
1037 | + $sth->execute(); |
|
1038 | + } catch(PDOException $e) { |
|
1039 | + echo "error : ".$e->getMessage(); |
|
1040 | + } |
|
1041 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
1042 | 1042 | |
1043 | - if (empty($all)) { |
|
1044 | - $Accident = new Accident($this->db); |
|
1045 | - $all = $Accident->countFatalitiesByYear(); |
|
1046 | - } |
|
1047 | - return $all; |
|
1043 | + if (empty($all)) { |
|
1044 | + $Accident = new Accident($this->db); |
|
1045 | + $all = $Accident->countFatalitiesByYear(); |
|
1046 | + } |
|
1047 | + return $all; |
|
1048 | 1048 | } |
1049 | 1049 | public function countAllMilitaryMonths($filter_name = '') { |
1050 | 1050 | global $globalStatsFilters; |
1051 | 1051 | if ($filter_name == '') $filter_name = $this->filter_name; |
1052 | - $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"; |
|
1053 | - try { |
|
1054 | - $sth = $this->db->prepare($query); |
|
1055 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
1056 | - } catch(PDOException $e) { |
|
1057 | - echo "error : ".$e->getMessage(); |
|
1058 | - } |
|
1059 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
1060 | - if (empty($all)) { |
|
1061 | - $filters = array(); |
|
1062 | - if ($filter_name != '') { |
|
1063 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1052 | + $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"; |
|
1053 | + try { |
|
1054 | + $sth = $this->db->prepare($query); |
|
1055 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
1056 | + } catch(PDOException $e) { |
|
1057 | + echo "error : ".$e->getMessage(); |
|
1058 | + } |
|
1059 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
1060 | + if (empty($all)) { |
|
1061 | + $filters = array(); |
|
1062 | + if ($filter_name != '') { |
|
1063 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1064 | 1064 | } |
1065 | - $Spotter = new Spotter($this->db); |
|
1066 | - $all = $Spotter->countAllMilitaryMonths($filters); |
|
1067 | - } |
|
1068 | - return $all; |
|
1065 | + $Spotter = new Spotter($this->db); |
|
1066 | + $all = $Spotter->countAllMilitaryMonths($filters); |
|
1067 | + } |
|
1068 | + return $all; |
|
1069 | 1069 | } |
1070 | 1070 | public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
1071 | 1071 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
@@ -1140,10 +1140,10 @@ discard block |
||
1140 | 1140 | if ($year == '') $year = date('Y'); |
1141 | 1141 | $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
1142 | 1142 | if (empty($all)) { |
1143 | - $filters = array(); |
|
1143 | + $filters = array(); |
|
1144 | 1144 | $filters = array('year' => $year,'month' => $month); |
1145 | - if ($filter_name != '') { |
|
1146 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1145 | + if ($filter_name != '') { |
|
1146 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1147 | 1147 | } |
1148 | 1148 | $Spotter = new Spotter($this->db); |
1149 | 1149 | //$all = $Spotter->countOverallMilitaryFlights($filters,$year,$month); |
@@ -1235,10 +1235,10 @@ discard block |
||
1235 | 1235 | $all = $result[0]['nb_airline']; |
1236 | 1236 | } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
1237 | 1237 | if (empty($all)) { |
1238 | - $filters = array(); |
|
1238 | + $filters = array(); |
|
1239 | 1239 | $filters = array('year' => $year,'month' => $month); |
1240 | - if ($filter_name != '') { |
|
1241 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1240 | + if ($filter_name != '') { |
|
1241 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1242 | 1242 | } |
1243 | 1243 | $Spotter = new Spotter($this->db); |
1244 | 1244 | //$all = $Spotter->countOverallAirlines($filters,$year,$month); |
@@ -1499,119 +1499,119 @@ discard block |
||
1499 | 1499 | return $all[0]['total']; |
1500 | 1500 | } |
1501 | 1501 | public function getStatsAirlineTotal($filter_name = '') { |
1502 | - global $globalArchiveMonths, $globalDBdriver; |
|
1502 | + global $globalArchiveMonths, $globalDBdriver; |
|
1503 | 1503 | if ($filter_name == '') $filter_name = $this->filter_name; |
1504 | - if ($globalDBdriver == 'mysql') { |
|
1504 | + if ($globalDBdriver == 'mysql') { |
|
1505 | 1505 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
1506 | - } else { |
|
1506 | + } else { |
|
1507 | 1507 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
1508 | - } |
|
1509 | - try { |
|
1510 | - $sth = $this->db->prepare($query); |
|
1511 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
1512 | - } catch(PDOException $e) { |
|
1513 | - echo "error : ".$e->getMessage(); |
|
1514 | - } |
|
1515 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
1516 | - return $all[0]['total']; |
|
1517 | - } |
|
1508 | + } |
|
1509 | + try { |
|
1510 | + $sth = $this->db->prepare($query); |
|
1511 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
1512 | + } catch(PDOException $e) { |
|
1513 | + echo "error : ".$e->getMessage(); |
|
1514 | + } |
|
1515 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
1516 | + return $all[0]['total']; |
|
1517 | + } |
|
1518 | 1518 | public function getStatsOwnerTotal($filter_name = '') { |
1519 | - global $globalArchiveMonths, $globalDBdriver; |
|
1519 | + global $globalArchiveMonths, $globalDBdriver; |
|
1520 | 1520 | if ($filter_name == '') $filter_name = $this->filter_name; |
1521 | - if ($globalDBdriver == 'mysql') { |
|
1521 | + if ($globalDBdriver == 'mysql') { |
|
1522 | 1522 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
1523 | 1523 | } else { |
1524 | 1524 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
1525 | - } |
|
1526 | - try { |
|
1527 | - $sth = $this->db->prepare($query); |
|
1528 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
1529 | - } catch(PDOException $e) { |
|
1530 | - echo "error : ".$e->getMessage(); |
|
1531 | - } |
|
1532 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
1533 | - return $all[0]['total']; |
|
1534 | - } |
|
1525 | + } |
|
1526 | + try { |
|
1527 | + $sth = $this->db->prepare($query); |
|
1528 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
1529 | + } catch(PDOException $e) { |
|
1530 | + echo "error : ".$e->getMessage(); |
|
1531 | + } |
|
1532 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
1533 | + return $all[0]['total']; |
|
1534 | + } |
|
1535 | 1535 | public function getStatsOwner($owner_name,$filter_name = '') { |
1536 | - global $globalArchiveMonths, $globalDBdriver; |
|
1536 | + global $globalArchiveMonths, $globalDBdriver; |
|
1537 | 1537 | if ($filter_name == '') $filter_name = $this->filter_name; |
1538 | 1538 | $query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name"; |
1539 | - try { |
|
1540 | - $sth = $this->db->prepare($query); |
|
1541 | - $sth->execute(array(':filter_name' => $filter_name,':owner_name' => $owner_name)); |
|
1542 | - } catch(PDOException $e) { |
|
1543 | - echo "error : ".$e->getMessage(); |
|
1544 | - } |
|
1545 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
1546 | - if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
1547 | - else return 0; |
|
1548 | - } |
|
1539 | + try { |
|
1540 | + $sth = $this->db->prepare($query); |
|
1541 | + $sth->execute(array(':filter_name' => $filter_name,':owner_name' => $owner_name)); |
|
1542 | + } catch(PDOException $e) { |
|
1543 | + echo "error : ".$e->getMessage(); |
|
1544 | + } |
|
1545 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
1546 | + if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
1547 | + else return 0; |
|
1548 | + } |
|
1549 | 1549 | public function getStatsPilotTotal($filter_name = '') { |
1550 | - global $globalArchiveMonths, $globalDBdriver; |
|
1550 | + global $globalArchiveMonths, $globalDBdriver; |
|
1551 | 1551 | if ($filter_name == '') $filter_name = $this->filter_name; |
1552 | - if ($globalDBdriver == 'mysql') { |
|
1553 | - $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
1554 | - } else { |
|
1555 | - $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
1556 | - } |
|
1557 | - try { |
|
1558 | - $sth = $this->db->prepare($query); |
|
1559 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
1560 | - } catch(PDOException $e) { |
|
1561 | - echo "error : ".$e->getMessage(); |
|
1562 | - } |
|
1563 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
1564 | - return $all[0]['total']; |
|
1565 | - } |
|
1552 | + if ($globalDBdriver == 'mysql') { |
|
1553 | + $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
1554 | + } else { |
|
1555 | + $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
1556 | + } |
|
1557 | + try { |
|
1558 | + $sth = $this->db->prepare($query); |
|
1559 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
1560 | + } catch(PDOException $e) { |
|
1561 | + echo "error : ".$e->getMessage(); |
|
1562 | + } |
|
1563 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
1564 | + return $all[0]['total']; |
|
1565 | + } |
|
1566 | 1566 | public function getStatsPilot($pilot,$filter_name = '') { |
1567 | - global $globalArchiveMonths, $globalDBdriver; |
|
1567 | + global $globalArchiveMonths, $globalDBdriver; |
|
1568 | 1568 | if ($filter_name == '') $filter_name = $this->filter_name; |
1569 | 1569 | $query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)"; |
1570 | - try { |
|
1571 | - $sth = $this->db->prepare($query); |
|
1572 | - $sth->execute(array(':filter_name' => $filter_name,':pilot' => $pilot)); |
|
1573 | - } catch(PDOException $e) { |
|
1574 | - echo "error : ".$e->getMessage(); |
|
1575 | - } |
|
1576 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
1577 | - if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
1578 | - else return 0; |
|
1579 | - } |
|
1570 | + try { |
|
1571 | + $sth = $this->db->prepare($query); |
|
1572 | + $sth->execute(array(':filter_name' => $filter_name,':pilot' => $pilot)); |
|
1573 | + } catch(PDOException $e) { |
|
1574 | + echo "error : ".$e->getMessage(); |
|
1575 | + } |
|
1576 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
1577 | + if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
1578 | + else return 0; |
|
1579 | + } |
|
1580 | 1580 | |
1581 | 1581 | public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
1582 | 1582 | global $globalDBdriver; |
1583 | 1583 | if ($filter_name == '') $filter_name = $this->filter_name; |
1584 | 1584 | if ($globalDBdriver == 'mysql') { |
1585 | 1585 | $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"; |
1586 | - } else { |
|
1586 | + } else { |
|
1587 | 1587 | $query = "UPDATE stats SET cnt = :cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1588 | 1588 | } |
1589 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1590 | - try { |
|
1591 | - $sth = $this->db->prepare($query); |
|
1592 | - $sth->execute($query_values); |
|
1593 | - } catch(PDOException $e) { |
|
1594 | - return "error : ".$e->getMessage(); |
|
1595 | - } |
|
1596 | - } |
|
1589 | + $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1590 | + try { |
|
1591 | + $sth = $this->db->prepare($query); |
|
1592 | + $sth->execute($query_values); |
|
1593 | + } catch(PDOException $e) { |
|
1594 | + return "error : ".$e->getMessage(); |
|
1595 | + } |
|
1596 | + } |
|
1597 | 1597 | public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
1598 | 1598 | global $globalDBdriver; |
1599 | 1599 | if ($filter_name == '') $filter_name = $this->filter_name; |
1600 | 1600 | if ($globalDBdriver == 'mysql') { |
1601 | 1601 | $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"; |
1602 | 1602 | } else { |
1603 | - //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
|
1603 | + //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
|
1604 | 1604 | $query = "UPDATE stats SET cnt = cnt+:cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1605 | - } |
|
1606 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1607 | - try { |
|
1608 | - $sth = $this->db->prepare($query); |
|
1609 | - $sth->execute($query_values); |
|
1610 | - } catch(PDOException $e) { |
|
1611 | - return "error : ".$e->getMessage(); |
|
1612 | - } |
|
1613 | - } |
|
1614 | - /* |
|
1605 | + } |
|
1606 | + $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1607 | + try { |
|
1608 | + $sth = $this->db->prepare($query); |
|
1609 | + $sth->execute($query_values); |
|
1610 | + } catch(PDOException $e) { |
|
1611 | + return "error : ".$e->getMessage(); |
|
1612 | + } |
|
1613 | + } |
|
1614 | + /* |
|
1615 | 1615 | public function getStatsSource($date,$stats_type = '') { |
1616 | 1616 | if ($stats_type == '') { |
1617 | 1617 | $query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name"; |
@@ -1680,25 +1680,25 @@ discard block |
||
1680 | 1680 | $query = "INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) VALUES (:data,:source_name,:stats_type,:stats_date) ON DUPLICATE KEY UPDATE source_data = :data"; |
1681 | 1681 | } else { |
1682 | 1682 | $query = "UPDATE stats_source SET source_data = :data WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type; INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) SELECT :data,:source_name,:stats_type,:stats_date WHERE NOT EXISTS (SELECT 1 FROM stats_source WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type);"; |
1683 | - } |
|
1684 | - $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
1685 | - try { |
|
1686 | - $sth = $this->db->prepare($query); |
|
1687 | - $sth->execute($query_values); |
|
1688 | - } catch(PDOException $e) { |
|
1689 | - return "error : ".$e->getMessage(); |
|
1690 | - } |
|
1691 | - } |
|
1683 | + } |
|
1684 | + $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
1685 | + try { |
|
1686 | + $sth = $this->db->prepare($query); |
|
1687 | + $sth->execute($query_values); |
|
1688 | + } catch(PDOException $e) { |
|
1689 | + return "error : ".$e->getMessage(); |
|
1690 | + } |
|
1691 | + } |
|
1692 | 1692 | public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
1693 | - $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
|
1694 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1695 | - try { |
|
1696 | - $sth = $this->db->prepare($query); |
|
1697 | - $sth->execute($query_values); |
|
1698 | - } catch(PDOException $e) { |
|
1699 | - return "error : ".$e->getMessage(); |
|
1700 | - } |
|
1701 | - } |
|
1693 | + $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
|
1694 | + $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1695 | + try { |
|
1696 | + $sth = $this->db->prepare($query); |
|
1697 | + $sth->execute($query_values); |
|
1698 | + } catch(PDOException $e) { |
|
1699 | + return "error : ".$e->getMessage(); |
|
1700 | + } |
|
1701 | + } |
|
1702 | 1702 | public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '',$reset = false) { |
1703 | 1703 | global $globalDBdriver; |
1704 | 1704 | if ($globalDBdriver == 'mysql') { |
@@ -1714,14 +1714,14 @@ discard block |
||
1714 | 1714 | $query = "UPDATE stats_registration SET cnt = cnt+:cnt WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:registration,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_registration WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1715 | 1715 | } |
1716 | 1716 | } |
1717 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1718 | - try { |
|
1719 | - $sth = $this->db->prepare($query); |
|
1720 | - $sth->execute($query_values); |
|
1721 | - } catch(PDOException $e) { |
|
1722 | - return "error : ".$e->getMessage(); |
|
1723 | - } |
|
1724 | - } |
|
1717 | + $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1718 | + try { |
|
1719 | + $sth = $this->db->prepare($query); |
|
1720 | + $sth->execute($query_values); |
|
1721 | + } catch(PDOException $e) { |
|
1722 | + return "error : ".$e->getMessage(); |
|
1723 | + } |
|
1724 | + } |
|
1725 | 1725 | public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '', $reset = false) { |
1726 | 1726 | global $globalDBdriver; |
1727 | 1727 | if ($globalDBdriver == 'mysql') { |
@@ -1737,14 +1737,14 @@ discard block |
||
1737 | 1737 | $query = "UPDATE stats_callsign SET cnt = cnt+:cnt WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name; INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) SELECT :callsign_icao,:airline_icao,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_callsign WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name);"; |
1738 | 1738 | } |
1739 | 1739 | } |
1740 | - $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1741 | - try { |
|
1742 | - $sth = $this->db->prepare($query); |
|
1743 | - $sth->execute($query_values); |
|
1744 | - } catch(PDOException $e) { |
|
1745 | - return "error : ".$e->getMessage(); |
|
1746 | - } |
|
1747 | - } |
|
1740 | + $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1741 | + try { |
|
1742 | + $sth = $this->db->prepare($query); |
|
1743 | + $sth->execute($query_values); |
|
1744 | + } catch(PDOException $e) { |
|
1745 | + return "error : ".$e->getMessage(); |
|
1746 | + } |
|
1747 | + } |
|
1748 | 1748 | public function addStatCountry($iso2,$iso3,$name,$cnt,$airline_icao = '',$filter_name = '',$reset = false) { |
1749 | 1749 | global $globalDBdriver; |
1750 | 1750 | if ($globalDBdriver == 'mysql') { |
@@ -1760,14 +1760,14 @@ discard block |
||
1760 | 1760 | $query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name AND stats_airline = :airline; INSERT INTO stats_country (iso2,iso3,name,cnt,stats_airline,filter_name) SELECT :iso2,:iso3,:name,:cnt,:airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name AND stats_airline = :airline);"; |
1761 | 1761 | } |
1762 | 1762 | } |
1763 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name,':airline' => $airline_icao); |
|
1764 | - try { |
|
1765 | - $sth = $this->db->prepare($query); |
|
1766 | - $sth->execute($query_values); |
|
1767 | - } catch(PDOException $e) { |
|
1768 | - return "error : ".$e->getMessage(); |
|
1769 | - } |
|
1770 | - } |
|
1763 | + $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name,':airline' => $airline_icao); |
|
1764 | + try { |
|
1765 | + $sth = $this->db->prepare($query); |
|
1766 | + $sth->execute($query_values); |
|
1767 | + } catch(PDOException $e) { |
|
1768 | + return "error : ".$e->getMessage(); |
|
1769 | + } |
|
1770 | + } |
|
1771 | 1771 | public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
1772 | 1772 | global $globalDBdriver; |
1773 | 1773 | if ($globalDBdriver == 'mysql') { |
@@ -1783,14 +1783,14 @@ discard block |
||
1783 | 1783 | $query = "UPDATE stats_aircraft SET cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, filter_name = :filter_name WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_aircraft WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1784 | 1784 | } |
1785 | 1785 | } |
1786 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1787 | - try { |
|
1788 | - $sth = $this->db->prepare($query); |
|
1789 | - $sth->execute($query_values); |
|
1790 | - } catch(PDOException $e) { |
|
1791 | - return "error : ".$e->getMessage(); |
|
1792 | - } |
|
1793 | - } |
|
1786 | + $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1787 | + try { |
|
1788 | + $sth = $this->db->prepare($query); |
|
1789 | + $sth->execute($query_values); |
|
1790 | + } catch(PDOException $e) { |
|
1791 | + return "error : ".$e->getMessage(); |
|
1792 | + } |
|
1793 | + } |
|
1794 | 1794 | public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '', $reset = false) { |
1795 | 1795 | global $globalDBdriver; |
1796 | 1796 | if ($globalDBdriver == 'mysql') { |
@@ -1806,14 +1806,14 @@ discard block |
||
1806 | 1806 | $query = "UPDATE stats_airline SET cnt = cnt+:cnt WHERE airline_icao = :airline_icao AND filter_name = :filter_name; INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) SELECT :airline_icao,:airline_name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airline WHERE airline_icao = :airline_icao AND filter_name = :filter_name);"; |
1807 | 1807 | } |
1808 | 1808 | } |
1809 | - $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
1810 | - try { |
|
1811 | - $sth = $this->db->prepare($query); |
|
1812 | - $sth->execute($query_values); |
|
1813 | - } catch(PDOException $e) { |
|
1814 | - return "error : ".$e->getMessage(); |
|
1815 | - } |
|
1816 | - } |
|
1809 | + $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
1810 | + try { |
|
1811 | + $sth = $this->db->prepare($query); |
|
1812 | + $sth->execute($query_values); |
|
1813 | + } catch(PDOException $e) { |
|
1814 | + return "error : ".$e->getMessage(); |
|
1815 | + } |
|
1816 | + } |
|
1817 | 1817 | public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '', $reset = false) { |
1818 | 1818 | global $globalDBdriver; |
1819 | 1819 | if ($globalDBdriver == 'mysql') { |
@@ -1829,14 +1829,14 @@ discard block |
||
1829 | 1829 | $query = "UPDATE stats_owner SET cnt = cnt+:cnt WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) SELECT :owner_name,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_owner WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1830 | 1830 | } |
1831 | 1831 | } |
1832 | - $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1833 | - try { |
|
1834 | - $sth = $this->db->prepare($query); |
|
1835 | - $sth->execute($query_values); |
|
1836 | - } catch(PDOException $e) { |
|
1837 | - return "error : ".$e->getMessage(); |
|
1838 | - } |
|
1839 | - } |
|
1832 | + $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1833 | + try { |
|
1834 | + $sth = $this->db->prepare($query); |
|
1835 | + $sth->execute($query_values); |
|
1836 | + } catch(PDOException $e) { |
|
1837 | + return "error : ".$e->getMessage(); |
|
1838 | + } |
|
1839 | + } |
|
1840 | 1840 | public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '',$reset = false) { |
1841 | 1841 | global $globalDBdriver; |
1842 | 1842 | if ($globalDBdriver == 'mysql') { |
@@ -1852,14 +1852,14 @@ discard block |
||
1852 | 1852 | $query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name,format_source) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name,:format_source WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source);"; |
1853 | 1853 | } |
1854 | 1854 | } |
1855 | - $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name,':format_source' => $format_source); |
|
1856 | - try { |
|
1857 | - $sth = $this->db->prepare($query); |
|
1858 | - $sth->execute($query_values); |
|
1859 | - } catch(PDOException $e) { |
|
1860 | - return "error : ".$e->getMessage(); |
|
1861 | - } |
|
1862 | - } |
|
1855 | + $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name,':format_source' => $format_source); |
|
1856 | + try { |
|
1857 | + $sth = $this->db->prepare($query); |
|
1858 | + $sth->execute($query_values); |
|
1859 | + } catch(PDOException $e) { |
|
1860 | + return "error : ".$e->getMessage(); |
|
1861 | + } |
|
1862 | + } |
|
1863 | 1863 | public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '',$reset = false) { |
1864 | 1864 | global $globalDBdriver; |
1865 | 1865 | if ($airport_icao != '') { |
@@ -1883,8 +1883,8 @@ discard block |
||
1883 | 1883 | } catch(PDOException $e) { |
1884 | 1884 | return "error : ".$e->getMessage(); |
1885 | 1885 | } |
1886 | - } |
|
1887 | - } |
|
1886 | + } |
|
1887 | + } |
|
1888 | 1888 | public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
1889 | 1889 | global $globalDBdriver; |
1890 | 1890 | if ($airport_icao != '') { |
@@ -1900,8 +1900,8 @@ discard block |
||
1900 | 1900 | } catch(PDOException $e) { |
1901 | 1901 | return "error : ".$e->getMessage(); |
1902 | 1902 | } |
1903 | - } |
|
1904 | - } |
|
1903 | + } |
|
1904 | + } |
|
1905 | 1905 | public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '',$reset = false) { |
1906 | 1906 | global $globalDBdriver; |
1907 | 1907 | if ($airport_icao != '') { |
@@ -1918,15 +1918,15 @@ discard block |
||
1918 | 1918 | $query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; |
1919 | 1919 | } |
1920 | 1920 | } |
1921 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1921 | + $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1922 | 1922 | try { |
1923 | - $sth = $this->db->prepare($query); |
|
1924 | - $sth->execute($query_values); |
|
1925 | - } catch(PDOException $e) { |
|
1926 | - return "error : ".$e->getMessage(); |
|
1927 | - } |
|
1928 | - } |
|
1929 | - } |
|
1923 | + $sth = $this->db->prepare($query); |
|
1924 | + $sth->execute($query_values); |
|
1925 | + } catch(PDOException $e) { |
|
1926 | + return "error : ".$e->getMessage(); |
|
1927 | + } |
|
1928 | + } |
|
1929 | + } |
|
1930 | 1930 | public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
1931 | 1931 | global $globalDBdriver; |
1932 | 1932 | if ($airport_icao != '') { |
@@ -1942,46 +1942,46 @@ discard block |
||
1942 | 1942 | } catch(PDOException $e) { |
1943 | 1943 | return "error : ".$e->getMessage(); |
1944 | 1944 | } |
1945 | - } |
|
1946 | - } |
|
1945 | + } |
|
1946 | + } |
|
1947 | 1947 | |
1948 | 1948 | public function deleteStat($id) { |
1949 | - $query = "DELETE FROM stats WHERE stats_id = :id"; |
|
1950 | - $query_values = array(':id' => $id); |
|
1951 | - try { |
|
1952 | - $sth = $this->db->prepare($query); |
|
1953 | - $sth->execute($query_values); |
|
1954 | - } catch(PDOException $e) { |
|
1955 | - return "error : ".$e->getMessage(); |
|
1956 | - } |
|
1957 | - } |
|
1949 | + $query = "DELETE FROM stats WHERE stats_id = :id"; |
|
1950 | + $query_values = array(':id' => $id); |
|
1951 | + try { |
|
1952 | + $sth = $this->db->prepare($query); |
|
1953 | + $sth->execute($query_values); |
|
1954 | + } catch(PDOException $e) { |
|
1955 | + return "error : ".$e->getMessage(); |
|
1956 | + } |
|
1957 | + } |
|
1958 | 1958 | public function deleteStatFlight($type) { |
1959 | - $query = "DELETE FROM stats_flight WHERE stats_type = :type"; |
|
1960 | - $query_values = array(':type' => $type); |
|
1961 | - try { |
|
1962 | - $sth = $this->db->prepare($query); |
|
1963 | - $sth->execute($query_values); |
|
1964 | - } catch(PDOException $e) { |
|
1965 | - return "error : ".$e->getMessage(); |
|
1966 | - } |
|
1967 | - } |
|
1959 | + $query = "DELETE FROM stats_flight WHERE stats_type = :type"; |
|
1960 | + $query_values = array(':type' => $type); |
|
1961 | + try { |
|
1962 | + $sth = $this->db->prepare($query); |
|
1963 | + $sth->execute($query_values); |
|
1964 | + } catch(PDOException $e) { |
|
1965 | + return "error : ".$e->getMessage(); |
|
1966 | + } |
|
1967 | + } |
|
1968 | 1968 | public function deleteStatAirport($type) { |
1969 | - $query = "DELETE FROM stats_airport WHERE stats_type = :type"; |
|
1970 | - $query_values = array(':type' => $type); |
|
1971 | - try { |
|
1972 | - $sth = $this->db->prepare($query); |
|
1973 | - $sth->execute($query_values); |
|
1974 | - } catch(PDOException $e) { |
|
1975 | - return "error : ".$e->getMessage(); |
|
1976 | - } |
|
1977 | - } |
|
1969 | + $query = "DELETE FROM stats_airport WHERE stats_type = :type"; |
|
1970 | + $query_values = array(':type' => $type); |
|
1971 | + try { |
|
1972 | + $sth = $this->db->prepare($query); |
|
1973 | + $sth->execute($query_values); |
|
1974 | + } catch(PDOException $e) { |
|
1975 | + return "error : ".$e->getMessage(); |
|
1976 | + } |
|
1977 | + } |
|
1978 | 1978 | |
1979 | - public function addOldStats() { |
|
1980 | - global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear, $globalAccidents; |
|
1981 | - $Common = new Common(); |
|
1982 | - $Connection = new Connection(); |
|
1983 | - date_default_timezone_set('UTC'); |
|
1984 | - $last_update = $this->getLastStatsUpdate('last_update_stats'); |
|
1979 | + public function addOldStats() { |
|
1980 | + global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear, $globalAccidents; |
|
1981 | + $Common = new Common(); |
|
1982 | + $Connection = new Connection(); |
|
1983 | + date_default_timezone_set('UTC'); |
|
1984 | + $last_update = $this->getLastStatsUpdate('last_update_stats'); |
|
1985 | 1985 | if ($globalDebug) echo 'Update stats !'."\n"; |
1986 | 1986 | if (isset($last_update[0]['value'])) { |
1987 | 1987 | $last_update_day = $last_update[0]['value']; |
@@ -2029,24 +2029,24 @@ discard block |
||
2029 | 2029 | if ($globalDebug) echo 'Count all departure airports...'."\n"; |
2030 | 2030 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
2031 | 2031 | if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
2032 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
2032 | + $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
2033 | 2033 | if ($globalDebug) echo 'Order departure airports...'."\n"; |
2034 | - $alldata = array(); |
|
2034 | + $alldata = array(); |
|
2035 | 2035 | |
2036 | - foreach ($pall as $value) { |
|
2037 | - $icao = $value['airport_departure_icao']; |
|
2038 | - $alldata[$icao] = $value; |
|
2039 | - } |
|
2040 | - foreach ($dall as $value) { |
|
2041 | - $icao = $value['airport_departure_icao']; |
|
2042 | - if (isset($alldata[$icao])) { |
|
2043 | - $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
2044 | - } else $alldata[$icao] = $value; |
|
2036 | + foreach ($pall as $value) { |
|
2037 | + $icao = $value['airport_departure_icao']; |
|
2038 | + $alldata[$icao] = $value; |
|
2039 | + } |
|
2040 | + foreach ($dall as $value) { |
|
2041 | + $icao = $value['airport_departure_icao']; |
|
2042 | + if (isset($alldata[$icao])) { |
|
2043 | + $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
2044 | + } else $alldata[$icao] = $value; |
|
2045 | 2045 | } |
2046 | - $count = array(); |
|
2047 | - foreach ($alldata as $key => $row) { |
|
2048 | - $count[$key] = $row['airport_departure_icao_count']; |
|
2049 | - } |
|
2046 | + $count = array(); |
|
2047 | + foreach ($alldata as $key => $row) { |
|
2048 | + $count[$key] = $row['airport_departure_icao_count']; |
|
2049 | + } |
|
2050 | 2050 | array_multisort($count,SORT_DESC,$alldata); |
2051 | 2051 | foreach ($alldata as $number) { |
2052 | 2052 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'','',$reset); |
@@ -2054,25 +2054,25 @@ discard block |
||
2054 | 2054 | if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
2055 | 2055 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
2056 | 2056 | if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
2057 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
2057 | + $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
2058 | 2058 | if ($globalDebug) echo 'Order arrival airports...'."\n"; |
2059 | - $alldata = array(); |
|
2060 | - foreach ($pall as $value) { |
|
2061 | - $icao = $value['airport_arrival_icao']; |
|
2062 | - $alldata[$icao] = $value; |
|
2063 | - } |
|
2064 | - foreach ($dall as $value) { |
|
2065 | - $icao = $value['airport_arrival_icao']; |
|
2066 | - if (isset($alldata[$icao])) { |
|
2067 | - $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
2068 | - } else $alldata[$icao] = $value; |
|
2069 | - } |
|
2070 | - $count = array(); |
|
2071 | - foreach ($alldata as $key => $row) { |
|
2072 | - $count[$key] = $row['airport_arrival_icao_count']; |
|
2073 | - } |
|
2074 | - array_multisort($count,SORT_DESC,$alldata); |
|
2075 | - foreach ($alldata as $number) { |
|
2059 | + $alldata = array(); |
|
2060 | + foreach ($pall as $value) { |
|
2061 | + $icao = $value['airport_arrival_icao']; |
|
2062 | + $alldata[$icao] = $value; |
|
2063 | + } |
|
2064 | + foreach ($dall as $value) { |
|
2065 | + $icao = $value['airport_arrival_icao']; |
|
2066 | + if (isset($alldata[$icao])) { |
|
2067 | + $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
2068 | + } else $alldata[$icao] = $value; |
|
2069 | + } |
|
2070 | + $count = array(); |
|
2071 | + foreach ($alldata as $key => $row) { |
|
2072 | + $count[$key] = $row['airport_arrival_icao_count']; |
|
2073 | + } |
|
2074 | + array_multisort($count,SORT_DESC,$alldata); |
|
2075 | + foreach ($alldata as $number) { |
|
2076 | 2076 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset); |
2077 | 2077 | } |
2078 | 2078 | if ($Connection->tableExists('countries')) { |
@@ -2151,8 +2151,8 @@ discard block |
||
2151 | 2151 | // $pall = $Spotter->getLast7DaysAirportsDeparture(); |
2152 | 2152 | // $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
2153 | 2153 | $pall = $Spotter->getLast7DaysAirportsDeparture(); |
2154 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
|
2155 | - /* |
|
2154 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
|
2155 | + /* |
|
2156 | 2156 | $alldata = array(); |
2157 | 2157 | foreach ($pall as $value) { |
2158 | 2158 | $icao = $value['departure_airport_icao']; |
@@ -2171,29 +2171,29 @@ discard block |
||
2171 | 2171 | } |
2172 | 2172 | array_multisort($count,SORT_DESC,$alldata); |
2173 | 2173 | */ |
2174 | - foreach ($dall as $value) { |
|
2175 | - $icao = $value['departure_airport_icao']; |
|
2176 | - $ddate = $value['date']; |
|
2177 | - $find = false; |
|
2178 | - foreach ($pall as $pvalue) { |
|
2179 | - if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
2180 | - $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
2181 | - $find = true; |
|
2182 | - break; |
|
2183 | - } |
|
2184 | - } |
|
2185 | - if ($find === false) { |
|
2186 | - $pall[] = $value; |
|
2187 | - } |
|
2188 | - } |
|
2189 | - $alldata = $pall; |
|
2174 | + foreach ($dall as $value) { |
|
2175 | + $icao = $value['departure_airport_icao']; |
|
2176 | + $ddate = $value['date']; |
|
2177 | + $find = false; |
|
2178 | + foreach ($pall as $pvalue) { |
|
2179 | + if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
2180 | + $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
2181 | + $find = true; |
|
2182 | + break; |
|
2183 | + } |
|
2184 | + } |
|
2185 | + if ($find === false) { |
|
2186 | + $pall[] = $value; |
|
2187 | + } |
|
2188 | + } |
|
2189 | + $alldata = $pall; |
|
2190 | 2190 | foreach ($alldata as $number) { |
2191 | 2191 | $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']); |
2192 | 2192 | } |
2193 | 2193 | echo '...Arrival'."\n"; |
2194 | 2194 | $pall = $Spotter->getLast7DaysAirportsArrival(); |
2195 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival(); |
|
2196 | - /* |
|
2195 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival(); |
|
2196 | + /* |
|
2197 | 2197 | $alldata = array(); |
2198 | 2198 | foreach ($pall as $value) { |
2199 | 2199 | $icao = $value['arrival_airport_icao']; |
@@ -2213,22 +2213,22 @@ discard block |
||
2213 | 2213 | */ |
2214 | 2214 | |
2215 | 2215 | |
2216 | - foreach ($dall as $value) { |
|
2217 | - $icao = $value['arrival_airport_icao']; |
|
2218 | - $ddate = $value['date']; |
|
2219 | - $find = false; |
|
2220 | - foreach ($pall as $pvalue) { |
|
2221 | - if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
2222 | - $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
2223 | - $find = true; |
|
2224 | - break; |
|
2225 | - } |
|
2226 | - } |
|
2227 | - if ($find === false) { |
|
2228 | - $pall[] = $value; |
|
2229 | - } |
|
2230 | - } |
|
2231 | - $alldata = $pall; |
|
2216 | + foreach ($dall as $value) { |
|
2217 | + $icao = $value['arrival_airport_icao']; |
|
2218 | + $ddate = $value['date']; |
|
2219 | + $find = false; |
|
2220 | + foreach ($pall as $pvalue) { |
|
2221 | + if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
2222 | + $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
2223 | + $find = true; |
|
2224 | + break; |
|
2225 | + } |
|
2226 | + } |
|
2227 | + if ($find === false) { |
|
2228 | + $pall[] = $value; |
|
2229 | + } |
|
2230 | + } |
|
2231 | + $alldata = $pall; |
|
2232 | 2232 | foreach ($alldata as $number) { |
2233 | 2233 | $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']); |
2234 | 2234 | } |
@@ -2305,51 +2305,51 @@ discard block |
||
2305 | 2305 | if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
2306 | 2306 | $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
2307 | 2307 | if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
2308 | - $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
2308 | + $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
2309 | 2309 | if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
2310 | - //$alldata = array(); |
|
2311 | - foreach ($dall as $value) { |
|
2312 | - $icao = $value['airport_departure_icao']; |
|
2313 | - $dicao = $value['airline_icao']; |
|
2314 | - $find = false; |
|
2315 | - foreach ($pall as $pvalue) { |
|
2316 | - if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
2317 | - $pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
2318 | - $find = true; |
|
2319 | - break; |
|
2320 | - } |
|
2321 | - } |
|
2322 | - if ($find === false) { |
|
2323 | - $pall[] = $value; |
|
2324 | - } |
|
2325 | - } |
|
2326 | - $alldata = $pall; |
|
2310 | + //$alldata = array(); |
|
2311 | + foreach ($dall as $value) { |
|
2312 | + $icao = $value['airport_departure_icao']; |
|
2313 | + $dicao = $value['airline_icao']; |
|
2314 | + $find = false; |
|
2315 | + foreach ($pall as $pvalue) { |
|
2316 | + if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
2317 | + $pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
2318 | + $find = true; |
|
2319 | + break; |
|
2320 | + } |
|
2321 | + } |
|
2322 | + if ($find === false) { |
|
2323 | + $pall[] = $value; |
|
2324 | + } |
|
2325 | + } |
|
2326 | + $alldata = $pall; |
|
2327 | 2327 | foreach ($alldata as $number) { |
2328 | 2328 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset); |
2329 | 2329 | } |
2330 | 2330 | if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
2331 | 2331 | $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
2332 | 2332 | if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
2333 | - $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
2333 | + $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
2334 | 2334 | if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
2335 | - //$alldata = array(); |
|
2336 | - foreach ($dall as $value) { |
|
2337 | - $icao = $value['airport_arrival_icao']; |
|
2338 | - $dicao = $value['airline_icao']; |
|
2339 | - $find = false; |
|
2340 | - foreach ($pall as $pvalue) { |
|
2341 | - if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
2342 | - $pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
2343 | - $find = true; |
|
2344 | - break; |
|
2345 | - } |
|
2346 | - } |
|
2347 | - if ($find === false) { |
|
2348 | - $pall[] = $value; |
|
2349 | - } |
|
2350 | - } |
|
2351 | - $alldata = $pall; |
|
2352 | - foreach ($alldata as $number) { |
|
2335 | + //$alldata = array(); |
|
2336 | + foreach ($dall as $value) { |
|
2337 | + $icao = $value['airport_arrival_icao']; |
|
2338 | + $dicao = $value['airline_icao']; |
|
2339 | + $find = false; |
|
2340 | + foreach ($pall as $pvalue) { |
|
2341 | + if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
2342 | + $pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
2343 | + $find = true; |
|
2344 | + break; |
|
2345 | + } |
|
2346 | + } |
|
2347 | + if ($find === false) { |
|
2348 | + $pall[] = $value; |
|
2349 | + } |
|
2350 | + } |
|
2351 | + $alldata = $pall; |
|
2352 | + foreach ($alldata as $number) { |
|
2353 | 2353 | if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
2354 | 2354 | } |
2355 | 2355 | if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
@@ -2382,47 +2382,47 @@ discard block |
||
2382 | 2382 | } |
2383 | 2383 | if ($globalDebug) echo '...Departure'."\n"; |
2384 | 2384 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
2385 | - $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
|
2386 | - foreach ($dall as $value) { |
|
2387 | - $icao = $value['departure_airport_icao']; |
|
2388 | - $airline = $value['airline_icao']; |
|
2389 | - $ddate = $value['date']; |
|
2390 | - $find = false; |
|
2391 | - foreach ($pall as $pvalue) { |
|
2392 | - if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) { |
|
2393 | - $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
2394 | - $find = true; |
|
2395 | - break; |
|
2396 | - } |
|
2397 | - } |
|
2398 | - if ($find === false) { |
|
2399 | - $pall[] = $value; |
|
2400 | - } |
|
2401 | - } |
|
2402 | - $alldata = $pall; |
|
2385 | + $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
|
2386 | + foreach ($dall as $value) { |
|
2387 | + $icao = $value['departure_airport_icao']; |
|
2388 | + $airline = $value['airline_icao']; |
|
2389 | + $ddate = $value['date']; |
|
2390 | + $find = false; |
|
2391 | + foreach ($pall as $pvalue) { |
|
2392 | + if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) { |
|
2393 | + $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
2394 | + $find = true; |
|
2395 | + break; |
|
2396 | + } |
|
2397 | + } |
|
2398 | + if ($find === false) { |
|
2399 | + $pall[] = $value; |
|
2400 | + } |
|
2401 | + } |
|
2402 | + $alldata = $pall; |
|
2403 | 2403 | foreach ($alldata as $number) { |
2404 | 2404 | $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']); |
2405 | 2405 | } |
2406 | 2406 | if ($globalDebug) echo '...Arrival'."\n"; |
2407 | 2407 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
2408 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
|
2409 | - foreach ($dall as $value) { |
|
2410 | - $icao = $value['arrival_airport_icao']; |
|
2411 | - $airline = $value['airline_icao']; |
|
2412 | - $ddate = $value['date']; |
|
2413 | - $find = false; |
|
2414 | - foreach ($pall as $pvalue) { |
|
2415 | - if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) { |
|
2416 | - $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
2417 | - $find = true; |
|
2418 | - break; |
|
2419 | - } |
|
2420 | - } |
|
2421 | - if ($find === false) { |
|
2422 | - $pall[] = $value; |
|
2423 | - } |
|
2424 | - } |
|
2425 | - $alldata = $pall; |
|
2408 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
|
2409 | + foreach ($dall as $value) { |
|
2410 | + $icao = $value['arrival_airport_icao']; |
|
2411 | + $airline = $value['airline_icao']; |
|
2412 | + $ddate = $value['date']; |
|
2413 | + $find = false; |
|
2414 | + foreach ($pall as $pvalue) { |
|
2415 | + if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) { |
|
2416 | + $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
2417 | + $find = true; |
|
2418 | + break; |
|
2419 | + } |
|
2420 | + } |
|
2421 | + if ($find === false) { |
|
2422 | + $pall[] = $value; |
|
2423 | + } |
|
2424 | + } |
|
2425 | + $alldata = $pall; |
|
2426 | 2426 | foreach ($alldata as $number) { |
2427 | 2427 | $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']); |
2428 | 2428 | } |
@@ -2507,44 +2507,44 @@ discard block |
||
2507 | 2507 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source'],$reset); |
2508 | 2508 | } |
2509 | 2509 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
2510 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
2511 | - $alldata = array(); |
|
2512 | - foreach ($pall as $value) { |
|
2513 | - $icao = $value['airport_departure_icao']; |
|
2514 | - $alldata[$icao] = $value; |
|
2515 | - } |
|
2516 | - foreach ($dall as $value) { |
|
2517 | - $icao = $value['airport_departure_icao']; |
|
2518 | - if (isset($alldata[$icao])) { |
|
2519 | - $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
2520 | - } else $alldata[$icao] = $value; |
|
2521 | - } |
|
2522 | - $count = array(); |
|
2523 | - foreach ($alldata as $key => $row) { |
|
2524 | - $count[$key] = $row['airport_departure_icao_count']; |
|
2525 | - } |
|
2510 | + $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
2511 | + $alldata = array(); |
|
2512 | + foreach ($pall as $value) { |
|
2513 | + $icao = $value['airport_departure_icao']; |
|
2514 | + $alldata[$icao] = $value; |
|
2515 | + } |
|
2516 | + foreach ($dall as $value) { |
|
2517 | + $icao = $value['airport_departure_icao']; |
|
2518 | + if (isset($alldata[$icao])) { |
|
2519 | + $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
2520 | + } else $alldata[$icao] = $value; |
|
2521 | + } |
|
2522 | + $count = array(); |
|
2523 | + foreach ($alldata as $key => $row) { |
|
2524 | + $count[$key] = $row['airport_departure_icao_count']; |
|
2525 | + } |
|
2526 | 2526 | array_multisort($count,SORT_DESC,$alldata); |
2527 | 2527 | foreach ($alldata as $number) { |
2528 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name,$reset); |
|
2528 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name,$reset); |
|
2529 | 2529 | } |
2530 | 2530 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter); |
2531 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter); |
|
2531 | + $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter); |
|
2532 | 2532 | $alldata = array(); |
2533 | - foreach ($pall as $value) { |
|
2534 | - $icao = $value['airport_arrival_icao']; |
|
2535 | - $alldata[$icao] = $value; |
|
2536 | - } |
|
2537 | - foreach ($dall as $value) { |
|
2538 | - $icao = $value['airport_arrival_icao']; |
|
2539 | - if (isset($alldata[$icao])) { |
|
2540 | - $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
2541 | - } else $alldata[$icao] = $value; |
|
2542 | - } |
|
2543 | - $count = array(); |
|
2544 | - foreach ($alldata as $key => $row) { |
|
2545 | - $count[$key] = $row['airport_arrival_icao_count']; |
|
2546 | - } |
|
2547 | - array_multisort($count,SORT_DESC,$alldata); |
|
2533 | + foreach ($pall as $value) { |
|
2534 | + $icao = $value['airport_arrival_icao']; |
|
2535 | + $alldata[$icao] = $value; |
|
2536 | + } |
|
2537 | + foreach ($dall as $value) { |
|
2538 | + $icao = $value['airport_arrival_icao']; |
|
2539 | + if (isset($alldata[$icao])) { |
|
2540 | + $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
2541 | + } else $alldata[$icao] = $value; |
|
2542 | + } |
|
2543 | + $count = array(); |
|
2544 | + foreach ($alldata as $key => $row) { |
|
2545 | + $count[$key] = $row['airport_arrival_icao_count']; |
|
2546 | + } |
|
2547 | + array_multisort($count,SORT_DESC,$alldata); |
|
2548 | 2548 | foreach ($alldata as $number) { |
2549 | 2549 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name,$reset); |
2550 | 2550 | } |
@@ -2577,45 +2577,45 @@ discard block |
||
2577 | 2577 | } |
2578 | 2578 | echo '...Departure'."\n"; |
2579 | 2579 | $pall = $Spotter->getLast7DaysAirportsDeparture('',$filter); |
2580 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
2580 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
2581 | 2581 | foreach ($dall as $value) { |
2582 | - $icao = $value['departure_airport_icao']; |
|
2583 | - $ddate = $value['date']; |
|
2584 | - $find = false; |
|
2585 | - foreach ($pall as $pvalue) { |
|
2586 | - if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
2587 | - $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
2588 | - $find = true; |
|
2589 | - break; |
|
2590 | - } |
|
2591 | - } |
|
2592 | - if ($find === false) { |
|
2593 | - $pall[] = $value; |
|
2594 | - } |
|
2595 | - } |
|
2596 | - $alldata = $pall; |
|
2582 | + $icao = $value['departure_airport_icao']; |
|
2583 | + $ddate = $value['date']; |
|
2584 | + $find = false; |
|
2585 | + foreach ($pall as $pvalue) { |
|
2586 | + if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
2587 | + $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
2588 | + $find = true; |
|
2589 | + break; |
|
2590 | + } |
|
2591 | + } |
|
2592 | + if ($find === false) { |
|
2593 | + $pall[] = $value; |
|
2594 | + } |
|
2595 | + } |
|
2596 | + $alldata = $pall; |
|
2597 | 2597 | foreach ($alldata as $number) { |
2598 | 2598 | $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],'',$filter_name); |
2599 | 2599 | } |
2600 | 2600 | echo '...Arrival'."\n"; |
2601 | 2601 | $pall = $Spotter->getLast7DaysAirportsArrival('',$filter); |
2602 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
2602 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
2603 | 2603 | foreach ($dall as $value) { |
2604 | 2604 | $icao = $value['arrival_airport_icao']; |
2605 | 2605 | $ddate = $value['date']; |
2606 | - $find = false; |
|
2606 | + $find = false; |
|
2607 | 2607 | foreach ($pall as $pvalue) { |
2608 | - if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
2609 | - $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
2610 | - $find = true; |
|
2611 | - break; |
|
2612 | - } |
|
2613 | - } |
|
2614 | - if ($find === false) { |
|
2615 | - $pall[] = $value; |
|
2616 | - } |
|
2617 | - } |
|
2618 | - $alldata = $pall; |
|
2608 | + if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
2609 | + $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
2610 | + $find = true; |
|
2611 | + break; |
|
2612 | + } |
|
2613 | + } |
|
2614 | + if ($find === false) { |
|
2615 | + $pall[] = $value; |
|
2616 | + } |
|
2617 | + } |
|
2618 | + $alldata = $pall; |
|
2619 | 2619 | foreach ($alldata as $number) { |
2620 | 2620 | $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],'',$filter_name); |
2621 | 2621 | } |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | $this->db = $Connection->db(); |
19 | 19 | } |
20 | 20 | |
21 | - public function addLastStatsUpdate($type,$stats_date) { |
|
21 | + public function addLastStatsUpdate($type, $stats_date) { |
|
22 | 22 | $query = "DELETE FROM config WHERE name = :type; |
23 | 23 | INSERT INTO config (name,value) VALUES (:type,:stats_date);"; |
24 | - $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
24 | + $query_values = array('type' => $type, ':stats_date' => $stats_date); |
|
25 | 25 | try { |
26 | 26 | $sth = $this->db->prepare($query); |
27 | 27 | $sth->execute($query_values); |
28 | - } catch(PDOException $e) { |
|
28 | + } catch (PDOException $e) { |
|
29 | 29 | return "error : ".$e->getMessage(); |
30 | 30 | } |
31 | 31 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | try { |
36 | 36 | $sth = $this->db->prepare($query); |
37 | 37 | $sth->execute(array(':type' => $type)); |
38 | - } catch(PDOException $e) { |
|
38 | + } catch (PDOException $e) { |
|
39 | 39 | echo "error : ".$e->getMessage(); |
40 | 40 | } |
41 | 41 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | try { |
56 | 56 | $sth = $this->db->prepare($query); |
57 | 57 | $sth->execute(array(':filter_name' => $filter_name)); |
58 | - } catch(PDOException $e) { |
|
58 | + } catch (PDOException $e) { |
|
59 | 59 | return "error : ".$e->getMessage(); |
60 | 60 | } |
61 | 61 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | try { |
69 | 69 | $sth = $this->db->prepare($query); |
70 | 70 | $sth->execute(); |
71 | - } catch(PDOException $e) { |
|
71 | + } catch (PDOException $e) { |
|
72 | 72 | return "error : ".$e->getMessage(); |
73 | 73 | } |
74 | 74 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | try { |
77 | 77 | $sth = $this->db->prepare($query); |
78 | 78 | $sth->execute(array(':filter_name' => $filter_name)); |
79 | - } catch(PDOException $e) { |
|
79 | + } catch (PDOException $e) { |
|
80 | 80 | return "error : ".$e->getMessage(); |
81 | 81 | } |
82 | 82 | } |
@@ -86,77 +86,77 @@ discard block |
||
86 | 86 | try { |
87 | 87 | $sth = $this->db->prepare($query); |
88 | 88 | $sth->execute(array(':filter_name' => $filter_name)); |
89 | - } catch(PDOException $e) { |
|
89 | + } catch (PDOException $e) { |
|
90 | 90 | echo "error : ".$e->getMessage(); |
91 | 91 | } |
92 | 92 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
93 | 93 | if (empty($all)) { |
94 | 94 | $filters = array(); |
95 | 95 | if ($filter_name != '') { |
96 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
96 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
97 | 97 | } |
98 | 98 | $Spotter = new Spotter($this->db); |
99 | - $all = $Spotter->getAllAirlineNames('',NULL,$filters); |
|
99 | + $all = $Spotter->getAllAirlineNames('', NULL, $filters); |
|
100 | 100 | } |
101 | 101 | return $all; |
102 | 102 | } |
103 | - public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
|
103 | + public function getAllAircraftTypes($stats_airline = '', $filter_name = '') { |
|
104 | 104 | if ($filter_name == '') $filter_name = $this->filter_name; |
105 | 105 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
106 | 106 | try { |
107 | 107 | $sth = $this->db->prepare($query); |
108 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
109 | - } catch(PDOException $e) { |
|
108 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
109 | + } catch (PDOException $e) { |
|
110 | 110 | echo "error : ".$e->getMessage(); |
111 | 111 | } |
112 | 112 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
113 | 113 | return $all; |
114 | 114 | } |
115 | - public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
|
115 | + public function getAllManufacturers($stats_airline = '', $filter_name = '') { |
|
116 | 116 | if ($filter_name == '') $filter_name = $this->filter_name; |
117 | 117 | $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC"; |
118 | 118 | try { |
119 | 119 | $sth = $this->db->prepare($query); |
120 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
121 | - } catch(PDOException $e) { |
|
120 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
121 | + } catch (PDOException $e) { |
|
122 | 122 | echo "error : ".$e->getMessage(); |
123 | 123 | } |
124 | 124 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
125 | 125 | return $all; |
126 | 126 | } |
127 | - public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
|
127 | + public function getAllAirportNames($stats_airline = '', $filter_name = '') { |
|
128 | 128 | if ($filter_name == '') $filter_name = $this->filter_name; |
129 | 129 | $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
130 | 130 | try { |
131 | 131 | $sth = $this->db->prepare($query); |
132 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
133 | - } catch(PDOException $e) { |
|
132 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
133 | + } catch (PDOException $e) { |
|
134 | 134 | echo "error : ".$e->getMessage(); |
135 | 135 | } |
136 | 136 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
137 | 137 | return $all; |
138 | 138 | } |
139 | 139 | |
140 | - public function getAllOwnerNames($stats_airline = '',$filter_name = '') { |
|
140 | + public function getAllOwnerNames($stats_airline = '', $filter_name = '') { |
|
141 | 141 | if ($filter_name == '') $filter_name = $this->filter_name; |
142 | 142 | $query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC"; |
143 | 143 | try { |
144 | 144 | $sth = $this->db->prepare($query); |
145 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
146 | - } catch(PDOException $e) { |
|
145 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
146 | + } catch (PDOException $e) { |
|
147 | 147 | echo "error : ".$e->getMessage(); |
148 | 148 | } |
149 | 149 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
150 | 150 | return $all; |
151 | 151 | } |
152 | 152 | |
153 | - public function getAllPilotNames($stats_airline = '',$filter_name = '') { |
|
153 | + public function getAllPilotNames($stats_airline = '', $filter_name = '') { |
|
154 | 154 | if ($filter_name == '') $filter_name = $this->filter_name; |
155 | 155 | $query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC"; |
156 | 156 | try { |
157 | 157 | $sth = $this->db->prepare($query); |
158 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
159 | - } catch(PDOException $e) { |
|
158 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
159 | + } catch (PDOException $e) { |
|
160 | 160 | echo "error : ".$e->getMessage(); |
161 | 161 | } |
162 | 162 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -164,23 +164,23 @@ discard block |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | |
167 | - public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
167 | + public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
168 | 168 | global $globalStatsFilters; |
169 | 169 | if ($filter_name == '') $filter_name = $this->filter_name; |
170 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
170 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
171 | 171 | $Spotter = new Spotter($this->db); |
172 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
172 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
173 | 173 | $alliance_airlines = array(); |
174 | 174 | foreach ($airlines as $airline) { |
175 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
175 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
176 | 176 | } |
177 | 177 | if ($year == '' && $month == '') { |
178 | - if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
179 | - else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
178 | + if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
179 | + else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
180 | 180 | try { |
181 | 181 | $sth = $this->db->prepare($query); |
182 | 182 | $sth->execute(array(':filter_name' => $filter_name)); |
183 | - } catch(PDOException $e) { |
|
183 | + } catch (PDOException $e) { |
|
184 | 184 | echo "error : ".$e->getMessage(); |
185 | 185 | } |
186 | 186 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -191,29 +191,29 @@ discard block |
||
191 | 191 | else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
192 | 192 | try { |
193 | 193 | $sth = $this->db->prepare($query); |
194 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
195 | - } catch(PDOException $e) { |
|
194 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
195 | + } catch (PDOException $e) { |
|
196 | 196 | echo "error : ".$e->getMessage(); |
197 | 197 | } |
198 | 198 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
199 | 199 | } else $all = array(); |
200 | 200 | } |
201 | 201 | if (empty($all)) { |
202 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
203 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
202 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
203 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
204 | 204 | } else { |
205 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
205 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
206 | 206 | } |
207 | 207 | if ($filter_name != '') { |
208 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
208 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
209 | 209 | } |
210 | 210 | $Spotter = new Spotter($this->db); |
211 | 211 | //$all = $Spotter->countAllAircraftTypes($limit,0,'',$filters,$year,$month); |
212 | - $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters); |
|
212 | + $all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters); |
|
213 | 213 | } |
214 | 214 | return $all; |
215 | 215 | } |
216 | - public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
|
216 | + public function countAllAirlineCountries($limit = true, $filter_name = '', $year = '', $month = '') { |
|
217 | 217 | global $globalStatsFilters; |
218 | 218 | if ($filter_name == '') $filter_name = $this->filter_name; |
219 | 219 | if ($year == '' && $month == '') { |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | try { |
223 | 223 | $sth = $this->db->prepare($query); |
224 | 224 | $sth->execute(array(':filter_name' => $filter_name)); |
225 | - } catch(PDOException $e) { |
|
225 | + } catch (PDOException $e) { |
|
226 | 226 | echo "error : ".$e->getMessage(); |
227 | 227 | } |
228 | 228 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -230,32 +230,32 @@ discard block |
||
230 | 230 | if (empty($all)) { |
231 | 231 | $Spotter = new Spotter($this->db); |
232 | 232 | $filters = array(); |
233 | - $filters = array('year' => $year,'month' => $month); |
|
233 | + $filters = array('year' => $year, 'month' => $month); |
|
234 | 234 | if ($filter_name != '') { |
235 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
235 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
236 | 236 | } |
237 | 237 | //$all = $Spotter->countAllAirlineCountries($limit,$filters,$year,$month); |
238 | - $all = $Spotter->countAllAirlineCountries($limit,$filters); |
|
238 | + $all = $Spotter->countAllAirlineCountries($limit, $filters); |
|
239 | 239 | } |
240 | 240 | return $all; |
241 | 241 | } |
242 | - public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
242 | + public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
243 | 243 | global $globalStatsFilters; |
244 | 244 | if ($filter_name == '') $filter_name = $this->filter_name; |
245 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
245 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
246 | 246 | $Spotter = new Spotter($this->db); |
247 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
247 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
248 | 248 | $alliance_airlines = array(); |
249 | 249 | foreach ($airlines as $airline) { |
250 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
250 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
251 | 251 | } |
252 | 252 | if ($year == '' && $month == '') { |
253 | - if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
254 | - else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
253 | + if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
254 | + else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
255 | 255 | try { |
256 | 256 | $sth = $this->db->prepare($query); |
257 | 257 | $sth->execute(array(':filter_name' => $filter_name)); |
258 | - } catch(PDOException $e) { |
|
258 | + } catch (PDOException $e) { |
|
259 | 259 | echo "error : ".$e->getMessage(); |
260 | 260 | } |
261 | 261 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -266,21 +266,21 @@ discard block |
||
266 | 266 | else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
267 | 267 | try { |
268 | 268 | $sth = $this->db->prepare($query); |
269 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
270 | - } catch(PDOException $e) { |
|
269 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
270 | + } catch (PDOException $e) { |
|
271 | 271 | echo "error : ".$e->getMessage(); |
272 | 272 | } |
273 | 273 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
274 | 274 | } else $all = array(); |
275 | 275 | } |
276 | 276 | if (empty($all)) { |
277 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
278 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
277 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
278 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
279 | 279 | } else { |
280 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
280 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
281 | 281 | } |
282 | 282 | if ($filter_name != '') { |
283 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
283 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
284 | 284 | } |
285 | 285 | $Spotter = new Spotter($this->db); |
286 | 286 | //$all = $Spotter->countAllAircraftManufacturers($filters,$year,$month); |
@@ -289,23 +289,23 @@ discard block |
||
289 | 289 | return $all; |
290 | 290 | } |
291 | 291 | |
292 | - public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
292 | + public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
293 | 293 | global $globalStatsFilters; |
294 | 294 | if ($filter_name == '') $filter_name = $this->filter_name; |
295 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
295 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
296 | 296 | $Spotter = new Spotter($this->db); |
297 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
297 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
298 | 298 | $alliance_airlines = array(); |
299 | 299 | foreach ($airlines as $airline) { |
300 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
300 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
301 | 301 | } |
302 | 302 | if ($year == '' && $month == '') { |
303 | - if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
304 | - else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
303 | + if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
304 | + else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
305 | 305 | try { |
306 | 306 | $sth = $this->db->prepare($query); |
307 | 307 | $sth->execute(array(':filter_name' => $filter_name)); |
308 | - } catch(PDOException $e) { |
|
308 | + } catch (PDOException $e) { |
|
309 | 309 | echo "error : ".$e->getMessage(); |
310 | 310 | } |
311 | 311 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -316,61 +316,61 @@ discard block |
||
316 | 316 | else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
317 | 317 | try { |
318 | 318 | $sth = $this->db->prepare($query); |
319 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
320 | - } catch(PDOException $e) { |
|
319 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
320 | + } catch (PDOException $e) { |
|
321 | 321 | echo "error : ".$e->getMessage(); |
322 | 322 | } |
323 | 323 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
324 | 324 | } else $all = array(); |
325 | 325 | } |
326 | 326 | if (empty($all)) { |
327 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
328 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
327 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
328 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
329 | 329 | } else { |
330 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
330 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
331 | 331 | } |
332 | 332 | if ($filter_name != '') { |
333 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
333 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
334 | 334 | } |
335 | 335 | $Spotter = new Spotter($this->db); |
336 | 336 | //$all = $Spotter->countAllArrivalCountries($limit,$filters,$year,$month); |
337 | - $all = $Spotter->countAllArrivalCountries($limit,$filters); |
|
337 | + $all = $Spotter->countAllArrivalCountries($limit, $filters); |
|
338 | 338 | } |
339 | 339 | return $all; |
340 | 340 | } |
341 | 341 | public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
342 | 342 | global $globalStatsFilters; |
343 | 343 | if ($filter_name == '') $filter_name = $this->filter_name; |
344 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
344 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
345 | 345 | $Spotter = new Spotter($this->db); |
346 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
346 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
347 | 347 | $alliance_airlines = array(); |
348 | 348 | foreach ($airlines as $airline) { |
349 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
349 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
350 | 350 | } |
351 | - if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
352 | - else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
351 | + if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
352 | + else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
353 | 353 | $query_values = array(':filter_name' => $filter_name); |
354 | 354 | } else { |
355 | 355 | if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
356 | 356 | else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
357 | - $query_values = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
357 | + $query_values = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
358 | 358 | } |
359 | 359 | try { |
360 | 360 | $sth = $this->db->prepare($query); |
361 | 361 | $sth->execute($query_values); |
362 | - } catch(PDOException $e) { |
|
362 | + } catch (PDOException $e) { |
|
363 | 363 | echo "error : ".$e->getMessage(); |
364 | 364 | } |
365 | 365 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
366 | 366 | if (empty($all)) { |
367 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
368 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
367 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
368 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
369 | 369 | } else { |
370 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
370 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
371 | 371 | } |
372 | 372 | if ($filter_name != '') { |
373 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
373 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
374 | 374 | } |
375 | 375 | $Spotter = new Spotter($this->db); |
376 | 376 | //$all = $Spotter->countAllDepartureCountries($filters,$year,$month); |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | return $all; |
380 | 380 | } |
381 | 381 | |
382 | - public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
|
382 | + public function countAllAirlines($limit = true, $filter_name = '', $year = '', $month = '') { |
|
383 | 383 | global $globalStatsFilters, $globalVATSIM, $globalIVAO; |
384 | 384 | if ($filter_name == '') $filter_name = $this->filter_name; |
385 | 385 | if ($year == '' && $month == '') { |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | if (isset($forsource)) { |
389 | 389 | if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
390 | 390 | else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC"; |
391 | - $query_values = array(':filter_name' => $filter_name,':forsource' => $forsource); |
|
391 | + $query_values = array(':filter_name' => $filter_name, ':forsource' => $forsource); |
|
392 | 392 | } else { |
393 | 393 | if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
394 | 394 | else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC"; |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | try { |
398 | 398 | $sth = $this->db->prepare($query); |
399 | 399 | $sth->execute($query_values); |
400 | - } catch(PDOException $e) { |
|
400 | + } catch (PDOException $e) { |
|
401 | 401 | echo "error : ".$e->getMessage(); |
402 | 402 | } |
403 | 403 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -405,32 +405,32 @@ discard block |
||
405 | 405 | if (empty($all)) { |
406 | 406 | $Spotter = new Spotter($this->db); |
407 | 407 | $filters = array(); |
408 | - $filters = array('year' => $year,'month' => $month); |
|
408 | + $filters = array('year' => $year, 'month' => $month); |
|
409 | 409 | if ($filter_name != '') { |
410 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
410 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
411 | 411 | } |
412 | 412 | //$all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month); |
413 | - $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
413 | + $all = $Spotter->countAllAirlines($limit, 0, '', $filters); |
|
414 | 414 | } |
415 | 415 | return $all; |
416 | 416 | } |
417 | - public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
417 | + public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
418 | 418 | global $globalStatsFilters; |
419 | 419 | if ($filter_name == '') $filter_name = $this->filter_name; |
420 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
420 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
421 | 421 | $Spotter = new Spotter($this->db); |
422 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
422 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
423 | 423 | $alliance_airlines = array(); |
424 | 424 | foreach ($airlines as $airline) { |
425 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
425 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
426 | 426 | } |
427 | 427 | if ($year == '' && $month == '') { |
428 | - if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
429 | - else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
428 | + if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
429 | + else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
430 | 430 | try { |
431 | 431 | $sth = $this->db->prepare($query); |
432 | 432 | $sth->execute(array(':filter_name' => $filter_name)); |
433 | - } catch(PDOException $e) { |
|
433 | + } catch (PDOException $e) { |
|
434 | 434 | echo "error : ".$e->getMessage(); |
435 | 435 | } |
436 | 436 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -441,45 +441,45 @@ discard block |
||
441 | 441 | else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
442 | 442 | try { |
443 | 443 | $sth = $this->db->prepare($query); |
444 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
445 | - } catch(PDOException $e) { |
|
444 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
445 | + } catch (PDOException $e) { |
|
446 | 446 | echo "error : ".$e->getMessage(); |
447 | 447 | } |
448 | 448 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
449 | 449 | } else $all = array(); |
450 | 450 | } |
451 | 451 | if (empty($all)) { |
452 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
453 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
452 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
453 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
454 | 454 | } else { |
455 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
455 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
456 | 456 | } |
457 | 457 | if ($filter_name != '') { |
458 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
458 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
459 | 459 | } |
460 | 460 | $Spotter = new Spotter($this->db); |
461 | 461 | //$all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters,$year,$month); |
462 | - $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters); |
|
462 | + $all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters); |
|
463 | 463 | } |
464 | 464 | return $all; |
465 | 465 | } |
466 | - public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
466 | + public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
467 | 467 | global $globalStatsFilters; |
468 | 468 | if ($filter_name == '') $filter_name = $this->filter_name; |
469 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
469 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
470 | 470 | $Spotter = new Spotter($this->db); |
471 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
471 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
472 | 472 | $alliance_airlines = array(); |
473 | 473 | foreach ($airlines as $airline) { |
474 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
474 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
475 | 475 | } |
476 | 476 | if ($year == '' && $month == '') { |
477 | - if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
478 | - else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
477 | + if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
478 | + else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
479 | 479 | try { |
480 | 480 | $sth = $this->db->prepare($query); |
481 | 481 | $sth->execute(array(':filter_name' => $filter_name)); |
482 | - } catch(PDOException $e) { |
|
482 | + } catch (PDOException $e) { |
|
483 | 483 | echo "error : ".$e->getMessage(); |
484 | 484 | } |
485 | 485 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -490,46 +490,46 @@ discard block |
||
490 | 490 | else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
491 | 491 | try { |
492 | 492 | $sth = $this->db->prepare($query); |
493 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
494 | - } catch(PDOException $e) { |
|
493 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
494 | + } catch (PDOException $e) { |
|
495 | 495 | echo "error : ".$e->getMessage(); |
496 | 496 | } |
497 | 497 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
498 | 498 | } else $all = array(); |
499 | 499 | } |
500 | 500 | if (empty($all)) { |
501 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
502 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
501 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
502 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
503 | 503 | } else { |
504 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
504 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
505 | 505 | } |
506 | 506 | if ($filter_name != '') { |
507 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
507 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
508 | 508 | } |
509 | 509 | $Spotter = new Spotter($this->db); |
510 | 510 | //$all = $Spotter->countAllCallsigns($limit,0,'',$filters,$year,$month); |
511 | - $all = $Spotter->countAllCallsigns($limit,0,'',$filters); |
|
511 | + $all = $Spotter->countAllCallsigns($limit, 0, '', $filters); |
|
512 | 512 | } |
513 | 513 | return $all; |
514 | 514 | } |
515 | - public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
515 | + public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
516 | 516 | $Connection = new Connection(); |
517 | 517 | if ($filter_name == '') $filter_name = $this->filter_name; |
518 | 518 | if ($Connection->tableExists('countries')) { |
519 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
519 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
520 | 520 | $Spotter = new Spotter($this->db); |
521 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
521 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
522 | 522 | if ($year == '' && $month == '') { |
523 | 523 | $alliance_airlines = array(); |
524 | 524 | foreach ($airlines as $airline) { |
525 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
525 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
526 | 526 | } |
527 | - if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
528 | - else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
527 | + if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
528 | + else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
529 | 529 | try { |
530 | 530 | $sth = $this->db->prepare($query); |
531 | 531 | $sth->execute(array(':filter_name' => $filter_name)); |
532 | - } catch(PDOException $e) { |
|
532 | + } catch (PDOException $e) { |
|
533 | 533 | echo "error : ".$e->getMessage(); |
534 | 534 | } |
535 | 535 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -541,8 +541,8 @@ discard block |
||
541 | 541 | else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
542 | 542 | try { |
543 | 543 | $sth = $this->db->prepare($query); |
544 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
545 | - } catch(PDOException $e) { |
|
544 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
545 | + } catch (PDOException $e) { |
|
546 | 546 | echo "error : ".$e->getMessage(); |
547 | 547 | } |
548 | 548 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | return array(); |
560 | 560 | } |
561 | 561 | } |
562 | - public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') { |
|
562 | + public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
563 | 563 | global $globalStatsFilters; |
564 | 564 | if ($filter_name == '') $filter_name = $this->filter_name; |
565 | 565 | if ($year == '' && $month == '') { |
@@ -567,41 +567,41 @@ discard block |
||
567 | 567 | else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
568 | 568 | try { |
569 | 569 | $sth = $this->db->prepare($query); |
570 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
571 | - } catch(PDOException $e) { |
|
570 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
571 | + } catch (PDOException $e) { |
|
572 | 572 | echo "error : ".$e->getMessage(); |
573 | 573 | } |
574 | 574 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
575 | 575 | } else $all = array(); |
576 | 576 | if (empty($all)) { |
577 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
577 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
578 | 578 | if ($filter_name != '') { |
579 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
579 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
580 | 580 | } |
581 | 581 | $Spotter = new Spotter($this->db); |
582 | 582 | //$all = $Spotter->countAllPilots($limit,0,'',$filters,$year,$month); |
583 | - $all = $Spotter->countAllPilots($limit,0,'',$filters); |
|
583 | + $all = $Spotter->countAllPilots($limit, 0, '', $filters); |
|
584 | 584 | } |
585 | 585 | return $all; |
586 | 586 | } |
587 | 587 | |
588 | - public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') { |
|
588 | + public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
589 | 589 | global $globalStatsFilters; |
590 | 590 | if ($filter_name == '') $filter_name = $this->filter_name; |
591 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
591 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
592 | 592 | $Spotter = new Spotter($this->db); |
593 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
593 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
594 | 594 | if ($year == '' && $month == '') { |
595 | 595 | $alliance_airlines = array(); |
596 | 596 | foreach ($airlines as $airline) { |
597 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
597 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
598 | 598 | } |
599 | - if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
600 | - else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
599 | + if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
600 | + else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
601 | 601 | try { |
602 | 602 | $sth = $this->db->prepare($query); |
603 | 603 | $sth->execute(array(':filter_name' => $filter_name)); |
604 | - } catch(PDOException $e) { |
|
604 | + } catch (PDOException $e) { |
|
605 | 605 | echo "error : ".$e->getMessage(); |
606 | 606 | } |
607 | 607 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -612,45 +612,45 @@ discard block |
||
612 | 612 | else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
613 | 613 | try { |
614 | 614 | $sth = $this->db->prepare($query); |
615 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
616 | - } catch(PDOException $e) { |
|
615 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
616 | + } catch (PDOException $e) { |
|
617 | 617 | echo "error : ".$e->getMessage(); |
618 | 618 | } |
619 | 619 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
620 | 620 | } else $all = array(); |
621 | 621 | } |
622 | 622 | if (empty($all)) { |
623 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
624 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
623 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
624 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
625 | 625 | } else { |
626 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
626 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
627 | 627 | } |
628 | 628 | if ($filter_name != '') { |
629 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
629 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
630 | 630 | } |
631 | 631 | $Spotter = new Spotter($this->db); |
632 | 632 | //$all = $Spotter->countAllOwners($limit,0,'',$filters,$year,$month); |
633 | - $all = $Spotter->countAllOwners($limit,0,'',$filters); |
|
633 | + $all = $Spotter->countAllOwners($limit, 0, '', $filters); |
|
634 | 634 | } |
635 | 635 | return $all; |
636 | 636 | } |
637 | - public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
637 | + public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
638 | 638 | global $globalStatsFilters; |
639 | 639 | if ($filter_name == '') $filter_name = $this->filter_name; |
640 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
640 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
641 | 641 | $Spotter = new Spotter($this->db); |
642 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
642 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
643 | 643 | if ($year == '' && $month == '') { |
644 | 644 | $alliance_airlines = array(); |
645 | 645 | foreach ($airlines as $airline) { |
646 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
646 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
647 | 647 | } |
648 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
649 | - else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
648 | + if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
649 | + else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
650 | 650 | try { |
651 | 651 | $sth = $this->db->prepare($query); |
652 | 652 | $sth->execute(array(':filter_name' => $filter_name)); |
653 | - } catch(PDOException $e) { |
|
653 | + } catch (PDOException $e) { |
|
654 | 654 | echo "error : ".$e->getMessage(); |
655 | 655 | } |
656 | 656 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -661,27 +661,27 @@ discard block |
||
661 | 661 | else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
662 | 662 | try { |
663 | 663 | $sth = $this->db->prepare($query); |
664 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
665 | - } catch(PDOException $e) { |
|
664 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
665 | + } catch (PDOException $e) { |
|
666 | 666 | echo "error : ".$e->getMessage(); |
667 | 667 | } |
668 | 668 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
669 | 669 | } else $all = array(); |
670 | 670 | } |
671 | 671 | if (empty($all)) { |
672 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
673 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
672 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
673 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
674 | 674 | } else { |
675 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
675 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
676 | 676 | } |
677 | 677 | if ($filter_name != '') { |
678 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
678 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
679 | 679 | } |
680 | 680 | $Spotter = new Spotter($this->db); |
681 | 681 | // $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters,$year,$month); |
682 | 682 | // $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters,$year,$month); |
683 | - $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters); |
|
684 | - $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters); |
|
683 | + $pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters); |
|
684 | + $dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters); |
|
685 | 685 | $all = array(); |
686 | 686 | foreach ($pall as $value) { |
687 | 687 | $icao = $value['airport_departure_icao']; |
@@ -697,27 +697,27 @@ discard block |
||
697 | 697 | foreach ($all as $key => $row) { |
698 | 698 | $count[$key] = $row['airport_departure_icao_count']; |
699 | 699 | } |
700 | - array_multisort($count,SORT_DESC,$all); |
|
700 | + array_multisort($count, SORT_DESC, $all); |
|
701 | 701 | } |
702 | 702 | return $all; |
703 | 703 | } |
704 | - public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
704 | + public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
705 | 705 | global $globalStatsFilters; |
706 | 706 | if ($filter_name == '') $filter_name = $this->filter_name; |
707 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
707 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
708 | 708 | $Spotter = new Spotter($this->db); |
709 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
709 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
710 | 710 | if ($year == '' && $month == '') { |
711 | 711 | $alliance_airlines = array(); |
712 | 712 | foreach ($airlines as $airline) { |
713 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
713 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
714 | 714 | } |
715 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
716 | - else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
715 | + if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
716 | + else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
717 | 717 | try { |
718 | 718 | $sth = $this->db->prepare($query); |
719 | 719 | $sth->execute(array(':filter_name' => $filter_name)); |
720 | - } catch(PDOException $e) { |
|
720 | + } catch (PDOException $e) { |
|
721 | 721 | echo "error : ".$e->getMessage(); |
722 | 722 | } |
723 | 723 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -728,27 +728,27 @@ discard block |
||
728 | 728 | else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
729 | 729 | try { |
730 | 730 | $sth = $this->db->prepare($query); |
731 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
732 | - } catch(PDOException $e) { |
|
731 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
732 | + } catch (PDOException $e) { |
|
733 | 733 | echo "error : ".$e->getMessage(); |
734 | 734 | } |
735 | 735 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
736 | 736 | } else $all = array(); |
737 | 737 | } |
738 | 738 | if (empty($all)) { |
739 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
740 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
739 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
740 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
741 | 741 | } else { |
742 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
742 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
743 | 743 | } |
744 | 744 | if ($filter_name != '') { |
745 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
745 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
746 | 746 | } |
747 | 747 | $Spotter = new Spotter($this->db); |
748 | 748 | // $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters,$year,$month); |
749 | 749 | // $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters,$year,$month); |
750 | - $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters); |
|
751 | - $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters); |
|
750 | + $pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters); |
|
751 | + $dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters); |
|
752 | 752 | $all = array(); |
753 | 753 | foreach ($pall as $value) { |
754 | 754 | $icao = $value['airport_arrival_icao']; |
@@ -764,26 +764,26 @@ discard block |
||
764 | 764 | foreach ($all as $key => $row) { |
765 | 765 | $count[$key] = $row['airport_arrival_icao_count']; |
766 | 766 | } |
767 | - array_multisort($count,SORT_DESC,$all); |
|
767 | + array_multisort($count, SORT_DESC, $all); |
|
768 | 768 | } |
769 | 769 | return $all; |
770 | 770 | } |
771 | - public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
|
771 | + public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') { |
|
772 | 772 | global $globalDBdriver, $globalStatsFilters; |
773 | 773 | if ($filter_name == '') $filter_name = $this->filter_name; |
774 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
774 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
775 | 775 | $Spotter = new Spotter($this->db); |
776 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
776 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
777 | 777 | $alliance_airlines = array(); |
778 | 778 | foreach ($airlines as $airline) { |
779 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
779 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
780 | 780 | } |
781 | 781 | if ($globalDBdriver == 'mysql') { |
782 | - if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
783 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
782 | + if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
783 | + else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
784 | 784 | } else { |
785 | - if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
786 | - else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
785 | + if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
786 | + else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
787 | 787 | } |
788 | 788 | $query_data = array(':filter_name' => $filter_name); |
789 | 789 | } else { |
@@ -794,23 +794,23 @@ discard block |
||
794 | 794 | if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
795 | 795 | else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
796 | 796 | } |
797 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
797 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
798 | 798 | } |
799 | 799 | try { |
800 | 800 | $sth = $this->db->prepare($query); |
801 | 801 | $sth->execute($query_data); |
802 | - } catch(PDOException $e) { |
|
802 | + } catch (PDOException $e) { |
|
803 | 803 | echo "error : ".$e->getMessage(); |
804 | 804 | } |
805 | 805 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
806 | 806 | if (empty($all)) { |
807 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
808 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
807 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
808 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
809 | 809 | } else { |
810 | 810 | $filters = array('airlines' => array($stats_airline)); |
811 | 811 | } |
812 | 812 | if ($filter_name != '') { |
813 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
813 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
814 | 814 | } |
815 | 815 | $Spotter = new Spotter($this->db); |
816 | 816 | $all = $Spotter->countAllMonthsLastYear($filters); |
@@ -818,57 +818,57 @@ discard block |
||
818 | 818 | return $all; |
819 | 819 | } |
820 | 820 | |
821 | - public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
|
821 | + public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') { |
|
822 | 822 | global $globalStatsFilters; |
823 | 823 | if ($filter_name == '') $filter_name = $this->filter_name; |
824 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
824 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
825 | 825 | $Spotter = new Spotter($this->db); |
826 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
826 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
827 | 827 | $alliance_airlines = array(); |
828 | 828 | foreach ($airlines as $airline) { |
829 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
829 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
830 | 830 | } |
831 | - $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
831 | + $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
832 | 832 | $query_data = array(':filter_name' => $filter_name); |
833 | 833 | } else { |
834 | 834 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
835 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
835 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
836 | 836 | } |
837 | 837 | try { |
838 | 838 | $sth = $this->db->prepare($query); |
839 | 839 | $sth->execute($query_data); |
840 | - } catch(PDOException $e) { |
|
840 | + } catch (PDOException $e) { |
|
841 | 841 | echo "error : ".$e->getMessage(); |
842 | 842 | } |
843 | 843 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
844 | 844 | if (empty($all)) { |
845 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
846 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
845 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
846 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
847 | 847 | } else { |
848 | 848 | $filters = array('airlines' => array($stats_airline)); |
849 | 849 | } |
850 | 850 | if ($filter_name != '') { |
851 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
851 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
852 | 852 | } |
853 | 853 | $Spotter = new Spotter($this->db); |
854 | 854 | $all = $Spotter->countAllDatesLastMonth($filters); |
855 | 855 | } |
856 | 856 | return $all; |
857 | 857 | } |
858 | - public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
|
858 | + public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') { |
|
859 | 859 | global $globalDBdriver, $globalStatsFilters; |
860 | 860 | if ($filter_name == '') $filter_name = $this->filter_name; |
861 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
861 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
862 | 862 | $Spotter = new Spotter($this->db); |
863 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
863 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
864 | 864 | $alliance_airlines = array(); |
865 | 865 | foreach ($airlines as $airline) { |
866 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
866 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
867 | 867 | } |
868 | 868 | if ($globalDBdriver == 'mysql') { |
869 | - $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
869 | + $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
870 | 870 | } else { |
871 | - $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
871 | + $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
872 | 872 | } |
873 | 873 | $query_data = array(':filter_name' => $filter_name); |
874 | 874 | } else { |
@@ -877,60 +877,60 @@ discard block |
||
877 | 877 | } else { |
878 | 878 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
879 | 879 | } |
880 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
880 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
881 | 881 | } |
882 | 882 | try { |
883 | 883 | $sth = $this->db->prepare($query); |
884 | 884 | $sth->execute($query_data); |
885 | - } catch(PDOException $e) { |
|
885 | + } catch (PDOException $e) { |
|
886 | 886 | echo "error : ".$e->getMessage(); |
887 | 887 | } |
888 | 888 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
889 | 889 | if (empty($all)) { |
890 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
891 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
890 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
891 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
892 | 892 | } else { |
893 | 893 | $filters = array('airlines' => array($stats_airline)); |
894 | 894 | } |
895 | 895 | if ($filter_name != '') { |
896 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
896 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
897 | 897 | } |
898 | 898 | $Spotter = new Spotter($this->db); |
899 | 899 | $all = $Spotter->countAllDatesLast7Days($filters); |
900 | 900 | } |
901 | 901 | return $all; |
902 | 902 | } |
903 | - public function countAllDates($stats_airline = '',$filter_name = '') { |
|
903 | + public function countAllDates($stats_airline = '', $filter_name = '') { |
|
904 | 904 | global $globalStatsFilters; |
905 | 905 | if ($filter_name == '') $filter_name = $this->filter_name; |
906 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
906 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
907 | 907 | $Spotter = new Spotter($this->db); |
908 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
908 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
909 | 909 | $alliance_airlines = array(); |
910 | 910 | foreach ($airlines as $airline) { |
911 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
911 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
912 | 912 | } |
913 | - $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date ORDER BY date_count DESC"; |
|
913 | + $query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date ORDER BY date_count DESC"; |
|
914 | 914 | $query_data = array(':filter_name' => $filter_name); |
915 | 915 | } else { |
916 | 916 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date_count DESC"; |
917 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
917 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
918 | 918 | } |
919 | 919 | try { |
920 | 920 | $sth = $this->db->prepare($query); |
921 | 921 | $sth->execute($query_data); |
922 | - } catch(PDOException $e) { |
|
922 | + } catch (PDOException $e) { |
|
923 | 923 | echo "error : ".$e->getMessage(); |
924 | 924 | } |
925 | 925 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
926 | 926 | if (empty($all)) { |
927 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
928 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
927 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
928 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
929 | 929 | } else { |
930 | 930 | $filters = array('airlines' => array($stats_airline)); |
931 | 931 | } |
932 | 932 | if ($filter_name != '') { |
933 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
933 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
934 | 934 | } |
935 | 935 | $Spotter = new Spotter($this->db); |
936 | 936 | $all = $Spotter->countAllDates($filters); |
@@ -945,34 +945,34 @@ discard block |
||
945 | 945 | try { |
946 | 946 | $sth = $this->db->prepare($query); |
947 | 947 | $sth->execute($query_data); |
948 | - } catch(PDOException $e) { |
|
948 | + } catch (PDOException $e) { |
|
949 | 949 | echo "error : ".$e->getMessage(); |
950 | 950 | } |
951 | 951 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
952 | 952 | if (empty($all)) { |
953 | 953 | $filters = array(); |
954 | 954 | if ($filter_name != '') { |
955 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
955 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
956 | 956 | } |
957 | 957 | $Spotter = new Spotter($this->db); |
958 | 958 | $all = $Spotter->countAllDatesByAirlines($filters); |
959 | 959 | } |
960 | 960 | return $all; |
961 | 961 | } |
962 | - public function countAllMonths($stats_airline = '',$filter_name = '') { |
|
962 | + public function countAllMonths($stats_airline = '', $filter_name = '') { |
|
963 | 963 | global $globalStatsFilters, $globalDBdriver; |
964 | 964 | if ($filter_name == '') $filter_name = $this->filter_name; |
965 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
965 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
966 | 966 | $Spotter = new Spotter($this->db); |
967 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
967 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
968 | 968 | $alliance_airlines = array(); |
969 | 969 | foreach ($airlines as $airline) { |
970 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
970 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
971 | 971 | } |
972 | 972 | if ($globalDBdriver == 'mysql') { |
973 | - $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC"; |
|
973 | + $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC"; |
|
974 | 974 | } else { |
975 | - $query = "SELECT EXTRACT(YEAR FROM stats_date) AS year_name,EXTRACT(MONTH FROM stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC"; |
|
975 | + $query = "SELECT EXTRACT(YEAR FROM stats_date) AS year_name,EXTRACT(MONTH FROM stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC"; |
|
976 | 976 | } |
977 | 977 | $query_data = array(':filter_name' => $filter_name); |
978 | 978 | } else { |
@@ -986,18 +986,18 @@ discard block |
||
986 | 986 | try { |
987 | 987 | $sth = $this->db->prepare($query); |
988 | 988 | $sth->execute($query_data); |
989 | - } catch(PDOException $e) { |
|
989 | + } catch (PDOException $e) { |
|
990 | 990 | echo "error : ".$e->getMessage(); |
991 | 991 | } |
992 | 992 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
993 | 993 | if (empty($all)) { |
994 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
995 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
994 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
995 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
996 | 996 | } else { |
997 | 997 | $filters = array('airlines' => array($stats_airline)); |
998 | 998 | } |
999 | 999 | if ($filter_name != '') { |
1000 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1000 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1001 | 1001 | } |
1002 | 1002 | $Spotter = new Spotter($this->db); |
1003 | 1003 | $all = $Spotter->countAllMonths($filters); |
@@ -1014,7 +1014,7 @@ discard block |
||
1014 | 1014 | try { |
1015 | 1015 | $sth = $this->db->prepare($query); |
1016 | 1016 | $sth->execute(); |
1017 | - } catch(PDOException $e) { |
|
1017 | + } catch (PDOException $e) { |
|
1018 | 1018 | echo "error : ".$e->getMessage(); |
1019 | 1019 | } |
1020 | 1020 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1035,7 +1035,7 @@ discard block |
||
1035 | 1035 | try { |
1036 | 1036 | $sth = $this->db->prepare($query); |
1037 | 1037 | $sth->execute(); |
1038 | - } catch(PDOException $e) { |
|
1038 | + } catch (PDOException $e) { |
|
1039 | 1039 | echo "error : ".$e->getMessage(); |
1040 | 1040 | } |
1041 | 1041 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1053,32 +1053,32 @@ discard block |
||
1053 | 1053 | try { |
1054 | 1054 | $sth = $this->db->prepare($query); |
1055 | 1055 | $sth->execute(array(':filter_name' => $filter_name)); |
1056 | - } catch(PDOException $e) { |
|
1056 | + } catch (PDOException $e) { |
|
1057 | 1057 | echo "error : ".$e->getMessage(); |
1058 | 1058 | } |
1059 | 1059 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1060 | 1060 | if (empty($all)) { |
1061 | 1061 | $filters = array(); |
1062 | 1062 | if ($filter_name != '') { |
1063 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1063 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1064 | 1064 | } |
1065 | 1065 | $Spotter = new Spotter($this->db); |
1066 | 1066 | $all = $Spotter->countAllMilitaryMonths($filters); |
1067 | 1067 | } |
1068 | 1068 | return $all; |
1069 | 1069 | } |
1070 | - public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
|
1070 | + public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') { |
|
1071 | 1071 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
1072 | 1072 | if ($filter_name == '') $filter_name = $this->filter_name; |
1073 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1073 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1074 | 1074 | $Spotter = new Spotter($this->db); |
1075 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1075 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1076 | 1076 | $alliance_airlines = array(); |
1077 | 1077 | foreach ($airlines as $airline) { |
1078 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1078 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1079 | 1079 | } |
1080 | - if ($limit) $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1081 | - else $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1080 | + if ($limit) $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1081 | + else $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1082 | 1082 | $query_data = array(':filter_name' => $filter_name); |
1083 | 1083 | } else { |
1084 | 1084 | if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -1096,37 +1096,37 @@ discard block |
||
1096 | 1096 | try { |
1097 | 1097 | $sth = $this->db->prepare($query); |
1098 | 1098 | $sth->execute($query_data); |
1099 | - } catch(PDOException $e) { |
|
1099 | + } catch (PDOException $e) { |
|
1100 | 1100 | echo "error : ".$e->getMessage(); |
1101 | 1101 | } |
1102 | 1102 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1103 | 1103 | if (empty($all)) { |
1104 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1105 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1104 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1105 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1106 | 1106 | } else { |
1107 | 1107 | $filters = array('airlines' => array($stats_airline)); |
1108 | 1108 | } |
1109 | 1109 | if ($filter_name != '') { |
1110 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1110 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1111 | 1111 | } |
1112 | 1112 | $Spotter = new Spotter($this->db); |
1113 | - $all = $Spotter->countAllHours($orderby,$filters); |
|
1113 | + $all = $Spotter->countAllHours($orderby, $filters); |
|
1114 | 1114 | } |
1115 | 1115 | return $all; |
1116 | 1116 | } |
1117 | - public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
|
1117 | + public function countOverallFlights($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
1118 | 1118 | global $globalStatsFilters; |
1119 | 1119 | if ($filter_name == '') $filter_name = $this->filter_name; |
1120 | 1120 | if ($year == '') $year = date('Y'); |
1121 | - $all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1121 | + $all = $this->getSumStats('flights_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1122 | 1122 | if (empty($all)) { |
1123 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1124 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
1123 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1124 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
1125 | 1125 | } else { |
1126 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1126 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
1127 | 1127 | } |
1128 | 1128 | if ($filter_name != '') { |
1129 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1129 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1130 | 1130 | } |
1131 | 1131 | $Spotter = new Spotter($this->db); |
1132 | 1132 | //$all = $Spotter->countOverallFlights($filters,$year,$month); |
@@ -1134,16 +1134,16 @@ discard block |
||
1134 | 1134 | } |
1135 | 1135 | return $all; |
1136 | 1136 | } |
1137 | - public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') { |
|
1137 | + public function countOverallMilitaryFlights($filter_name = '', $year = '', $month = '') { |
|
1138 | 1138 | global $globalStatsFilters; |
1139 | 1139 | if ($filter_name == '') $filter_name = $this->filter_name; |
1140 | 1140 | if ($year == '') $year = date('Y'); |
1141 | - $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
|
1141 | + $all = $this->getSumStats('military_flights_bymonth', $year, '', $filter_name, $month); |
|
1142 | 1142 | if (empty($all)) { |
1143 | 1143 | $filters = array(); |
1144 | - $filters = array('year' => $year,'month' => $month); |
|
1144 | + $filters = array('year' => $year, 'month' => $month); |
|
1145 | 1145 | if ($filter_name != '') { |
1146 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1146 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1147 | 1147 | } |
1148 | 1148 | $Spotter = new Spotter($this->db); |
1149 | 1149 | //$all = $Spotter->countOverallMilitaryFlights($filters,$year,$month); |
@@ -1151,19 +1151,19 @@ discard block |
||
1151 | 1151 | } |
1152 | 1152 | return $all; |
1153 | 1153 | } |
1154 | - public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') { |
|
1154 | + public function countOverallArrival($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
1155 | 1155 | global $globalStatsFilters; |
1156 | 1156 | if ($filter_name == '') $filter_name = $this->filter_name; |
1157 | 1157 | if ($year == '') $year = date('Y'); |
1158 | - $all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1158 | + $all = $this->getSumStats('realarrivals_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1159 | 1159 | if (empty($all)) { |
1160 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1161 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
1160 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1161 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
1162 | 1162 | } else { |
1163 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1163 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
1164 | 1164 | } |
1165 | 1165 | if ($filter_name != '') { |
1166 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1166 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1167 | 1167 | } |
1168 | 1168 | $Spotter = new Spotter($this->db); |
1169 | 1169 | //$all = $Spotter->countOverallArrival($filters,$year,$month); |
@@ -1171,48 +1171,48 @@ discard block |
||
1171 | 1171 | } |
1172 | 1172 | return $all; |
1173 | 1173 | } |
1174 | - public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
|
1174 | + public function countOverallAircrafts($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
1175 | 1175 | global $globalStatsFilters; |
1176 | 1176 | if ($filter_name == '') $filter_name = $this->filter_name; |
1177 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1177 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1178 | 1178 | $Spotter = new Spotter($this->db); |
1179 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1179 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1180 | 1180 | if ($year == '' && $month == '') { |
1181 | 1181 | $alliance_airlines = array(); |
1182 | 1182 | foreach ($airlines as $airline) { |
1183 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1183 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1184 | 1184 | } |
1185 | - $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1185 | + $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1186 | 1186 | try { |
1187 | 1187 | $sth = $this->db->prepare($query); |
1188 | 1188 | $sth->execute(array(':filter_name' => $filter_name)); |
1189 | - } catch(PDOException $e) { |
|
1189 | + } catch (PDOException $e) { |
|
1190 | 1190 | echo "error : ".$e->getMessage(); |
1191 | 1191 | } |
1192 | 1192 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1193 | 1193 | $all = $result[0]['nb']; |
1194 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1194 | + } else $all = $this->getSumStats('aircrafts_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1195 | 1195 | } else { |
1196 | 1196 | if ($year == '' && $month == '') { |
1197 | 1197 | $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
1198 | 1198 | try { |
1199 | 1199 | $sth = $this->db->prepare($query); |
1200 | - $sth->execute(array(':filter_name' => $filter_name,':stats_airline' => $stats_airline)); |
|
1201 | - } catch(PDOException $e) { |
|
1200 | + $sth->execute(array(':filter_name' => $filter_name, ':stats_airline' => $stats_airline)); |
|
1201 | + } catch (PDOException $e) { |
|
1202 | 1202 | echo "error : ".$e->getMessage(); |
1203 | 1203 | } |
1204 | 1204 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1205 | 1205 | $all = $result[0]['nb']; |
1206 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1206 | + } else $all = $this->getSumStats('aircrafts_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1207 | 1207 | } |
1208 | 1208 | if (empty($all)) { |
1209 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1210 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
1209 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1210 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
1211 | 1211 | } else { |
1212 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1212 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
1213 | 1213 | } |
1214 | 1214 | if ($filter_name != '') { |
1215 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1215 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1216 | 1216 | } |
1217 | 1217 | $Spotter = new Spotter($this->db); |
1218 | 1218 | //$all = $Spotter->countOverallAircrafts($filters,$year,$month); |
@@ -1220,7 +1220,7 @@ discard block |
||
1220 | 1220 | } |
1221 | 1221 | return $all; |
1222 | 1222 | } |
1223 | - public function countOverallAirlines($filter_name = '',$year = '',$month = '') { |
|
1223 | + public function countOverallAirlines($filter_name = '', $year = '', $month = '') { |
|
1224 | 1224 | global $globalStatsFilters; |
1225 | 1225 | if ($filter_name == '') $filter_name = $this->filter_name; |
1226 | 1226 | if ($year == '' && $month == '') { |
@@ -1228,17 +1228,17 @@ discard block |
||
1228 | 1228 | try { |
1229 | 1229 | $sth = $this->db->prepare($query); |
1230 | 1230 | $sth->execute(array(':filter_name' => $filter_name)); |
1231 | - } catch(PDOException $e) { |
|
1231 | + } catch (PDOException $e) { |
|
1232 | 1232 | echo "error : ".$e->getMessage(); |
1233 | 1233 | } |
1234 | 1234 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1235 | 1235 | $all = $result[0]['nb_airline']; |
1236 | - } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
1236 | + } else $all = $this->getSumStats('airlines_bymonth', $year, '', $filter_name, $month); |
|
1237 | 1237 | if (empty($all)) { |
1238 | 1238 | $filters = array(); |
1239 | - $filters = array('year' => $year,'month' => $month); |
|
1239 | + $filters = array('year' => $year, 'month' => $month); |
|
1240 | 1240 | if ($filter_name != '') { |
1241 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1241 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1242 | 1242 | } |
1243 | 1243 | $Spotter = new Spotter($this->db); |
1244 | 1244 | //$all = $Spotter->countOverallAirlines($filters,$year,$month); |
@@ -1246,29 +1246,29 @@ discard block |
||
1246 | 1246 | } |
1247 | 1247 | return $all; |
1248 | 1248 | } |
1249 | - public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
|
1249 | + public function countOverallOwners($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
1250 | 1250 | global $globalStatsFilters; |
1251 | 1251 | if ($filter_name == '') $filter_name = $this->filter_name; |
1252 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1252 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1253 | 1253 | $Spotter = new Spotter($this->db); |
1254 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1254 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1255 | 1255 | if ($year == '' && $month == '') { |
1256 | 1256 | $alliance_airlines = array(); |
1257 | 1257 | foreach ($airlines as $airline) { |
1258 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1258 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1259 | 1259 | } |
1260 | - $query = "SELECT count(*) as nb FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1260 | + $query = "SELECT count(*) as nb FROM stats_owner WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1261 | 1261 | $query_values = array(':filter_name' => $filter_name); |
1262 | 1262 | try { |
1263 | 1263 | $sth = $this->db->prepare($query); |
1264 | 1264 | $sth->execute($query_values); |
1265 | - } catch(PDOException $e) { |
|
1265 | + } catch (PDOException $e) { |
|
1266 | 1266 | echo "error : ".$e->getMessage(); |
1267 | 1267 | } |
1268 | 1268 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1269 | 1269 | $all = $result[0]['nb']; |
1270 | 1270 | } else { |
1271 | - $all = $this->getSumStats('owners_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1271 | + $all = $this->getSumStats('owners_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1272 | 1272 | } |
1273 | 1273 | } else { |
1274 | 1274 | if ($year == '' && $month == '') { |
@@ -1277,23 +1277,23 @@ discard block |
||
1277 | 1277 | try { |
1278 | 1278 | $sth = $this->db->prepare($query); |
1279 | 1279 | $sth->execute($query_values); |
1280 | - } catch(PDOException $e) { |
|
1280 | + } catch (PDOException $e) { |
|
1281 | 1281 | echo "error : ".$e->getMessage(); |
1282 | 1282 | } |
1283 | 1283 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1284 | 1284 | $all = $result[0]['nb']; |
1285 | 1285 | } else { |
1286 | - $all = $this->getSumStats('owners_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1286 | + $all = $this->getSumStats('owners_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1287 | 1287 | } |
1288 | 1288 | } |
1289 | 1289 | if (empty($all)) { |
1290 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1291 | - $filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month); |
|
1290 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1291 | + $filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month); |
|
1292 | 1292 | } else { |
1293 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1293 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
1294 | 1294 | } |
1295 | 1295 | if ($filter_name != '') { |
1296 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1296 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1297 | 1297 | } |
1298 | 1298 | $Spotter = new Spotter($this->db); |
1299 | 1299 | //$all = $Spotter->countOverallOwners($filters,$year,$month); |
@@ -1301,7 +1301,7 @@ discard block |
||
1301 | 1301 | } |
1302 | 1302 | return $all; |
1303 | 1303 | } |
1304 | - public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
1304 | + public function countOverallPilots($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
1305 | 1305 | global $globalStatsFilters; |
1306 | 1306 | if ($filter_name == '') $filter_name = $this->filter_name; |
1307 | 1307 | //if ($year == '') $year = date('Y'); |
@@ -1311,18 +1311,18 @@ discard block |
||
1311 | 1311 | try { |
1312 | 1312 | $sth = $this->db->prepare($query); |
1313 | 1313 | $sth->execute($query_values); |
1314 | - } catch(PDOException $e) { |
|
1314 | + } catch (PDOException $e) { |
|
1315 | 1315 | echo "error : ".$e->getMessage(); |
1316 | 1316 | } |
1317 | 1317 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1318 | 1318 | $all = $result[0]['nb']; |
1319 | 1319 | } else { |
1320 | - $all = $this->getSumStats('pilots_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1320 | + $all = $this->getSumStats('pilots_bymonth', $year, $stats_airline, $filter_name, $month); |
|
1321 | 1321 | } |
1322 | 1322 | if (empty($all)) { |
1323 | - $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
|
1323 | + $filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month); |
|
1324 | 1324 | if ($filter_name != '') { |
1325 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
1325 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
1326 | 1326 | } |
1327 | 1327 | $Spotter = new Spotter($this->db); |
1328 | 1328 | //$all = $Spotter->countOverallPilots($filters,$year,$month); |
@@ -1331,104 +1331,104 @@ discard block |
||
1331 | 1331 | return $all; |
1332 | 1332 | } |
1333 | 1333 | |
1334 | - public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
|
1334 | + public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') { |
|
1335 | 1335 | if ($filter_name == '') $filter_name = $this->filter_name; |
1336 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1336 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1337 | 1337 | $Spotter = new Spotter($this->db); |
1338 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1338 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1339 | 1339 | $alliance_airlines = array(); |
1340 | 1340 | foreach ($airlines as $airline) { |
1341 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1341 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1342 | 1342 | } |
1343 | - $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY date"; |
|
1344 | - $query_values = array(':airport_icao' => $airport_icao,':filter_name' => $filter_name); |
|
1343 | + $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY date"; |
|
1344 | + $query_values = array(':airport_icao' => $airport_icao, ':filter_name' => $filter_name); |
|
1345 | 1345 | } else { |
1346 | 1346 | $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date"; |
1347 | - $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1347 | + $query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1348 | 1348 | } |
1349 | 1349 | try { |
1350 | 1350 | $sth = $this->db->prepare($query); |
1351 | 1351 | $sth->execute($query_values); |
1352 | - } catch(PDOException $e) { |
|
1352 | + } catch (PDOException $e) { |
|
1353 | 1353 | echo "error : ".$e->getMessage(); |
1354 | 1354 | } |
1355 | 1355 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1356 | 1356 | return $all; |
1357 | 1357 | } |
1358 | - public function getStats($type,$stats_airline = '', $filter_name = '') { |
|
1358 | + public function getStats($type, $stats_airline = '', $filter_name = '') { |
|
1359 | 1359 | if ($filter_name == '') $filter_name = $this->filter_name; |
1360 | 1360 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
1361 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1361 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1362 | 1362 | try { |
1363 | 1363 | $sth = $this->db->prepare($query); |
1364 | 1364 | $sth->execute($query_values); |
1365 | - } catch(PDOException $e) { |
|
1365 | + } catch (PDOException $e) { |
|
1366 | 1366 | echo "error : ".$e->getMessage(); |
1367 | 1367 | } |
1368 | 1368 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1369 | 1369 | return $all; |
1370 | 1370 | } |
1371 | - public function deleteStatsByType($type,$stats_airline = '', $filter_name = '') { |
|
1371 | + public function deleteStatsByType($type, $stats_airline = '', $filter_name = '') { |
|
1372 | 1372 | if ($filter_name == '') $filter_name = $this->filter_name; |
1373 | 1373 | $query = "DELETE FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
1374 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1374 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1375 | 1375 | try { |
1376 | 1376 | $sth = $this->db->prepare($query); |
1377 | 1377 | $sth->execute($query_values); |
1378 | - } catch(PDOException $e) { |
|
1378 | + } catch (PDOException $e) { |
|
1379 | 1379 | echo "error : ".$e->getMessage(); |
1380 | 1380 | } |
1381 | 1381 | } |
1382 | - public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
|
1382 | + public function getSumStats($type, $year, $stats_airline = '', $filter_name = '', $month = '') { |
|
1383 | 1383 | if ($filter_name == '') $filter_name = $this->filter_name; |
1384 | 1384 | global $globalArchiveMonths, $globalDBdriver; |
1385 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1385 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1386 | 1386 | $Spotter = new Spotter($this->db); |
1387 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1387 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1388 | 1388 | $alliance_airlines = array(); |
1389 | 1389 | foreach ($airlines as $airline) { |
1390 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1390 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1391 | 1391 | } |
1392 | 1392 | if ($globalDBdriver == 'mysql') { |
1393 | 1393 | if ($month == '') { |
1394 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1394 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1395 | 1395 | $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name); |
1396 | 1396 | } else { |
1397 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1398 | - $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name,':month' => $month); |
|
1397 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1398 | + $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name, ':month' => $month); |
|
1399 | 1399 | } |
1400 | 1400 | } else { |
1401 | 1401 | if ($month == '') { |
1402 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1402 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1403 | 1403 | $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name); |
1404 | 1404 | } else { |
1405 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1406 | - $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name,':month' => $month); |
|
1405 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1406 | + $query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name, ':month' => $month); |
|
1407 | 1407 | } |
1408 | 1408 | } |
1409 | 1409 | } else { |
1410 | 1410 | if ($globalDBdriver == 'mysql') { |
1411 | 1411 | if ($month == '') { |
1412 | 1412 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
1413 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1413 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1414 | 1414 | } else { |
1415 | 1415 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
1416 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month); |
|
1416 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month); |
|
1417 | 1417 | } |
1418 | 1418 | } else { |
1419 | 1419 | if ($month == '') { |
1420 | 1420 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
1421 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1421 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1422 | 1422 | } else { |
1423 | 1423 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
1424 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month); |
|
1424 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month); |
|
1425 | 1425 | } |
1426 | 1426 | } |
1427 | 1427 | } |
1428 | 1428 | try { |
1429 | 1429 | $sth = $this->db->prepare($query); |
1430 | 1430 | $sth->execute($query_values); |
1431 | - } catch(PDOException $e) { |
|
1431 | + } catch (PDOException $e) { |
|
1432 | 1432 | echo "error : ".$e->getMessage(); |
1433 | 1433 | } |
1434 | 1434 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1437,17 +1437,17 @@ discard block |
||
1437 | 1437 | public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
1438 | 1438 | global $globalArchiveMonths, $globalDBdriver; |
1439 | 1439 | if ($filter_name == '') $filter_name = $this->filter_name; |
1440 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1440 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1441 | 1441 | $Spotter = new Spotter($this->db); |
1442 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1442 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1443 | 1443 | $alliance_airlines = array(); |
1444 | 1444 | foreach ($airlines as $airline) { |
1445 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1445 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1446 | 1446 | } |
1447 | 1447 | if ($globalDBdriver == 'mysql') { |
1448 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1448 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1449 | 1449 | } else { |
1450 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveMonths." MONTHS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1450 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveMonths." MONTHS' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1451 | 1451 | } |
1452 | 1452 | $query_values = array(':type' => $type, ':filter_name' => $filter_name); |
1453 | 1453 | } else { |
@@ -1461,7 +1461,7 @@ discard block |
||
1461 | 1461 | try { |
1462 | 1462 | $sth = $this->db->prepare($query); |
1463 | 1463 | $sth->execute($query_values); |
1464 | - } catch(PDOException $e) { |
|
1464 | + } catch (PDOException $e) { |
|
1465 | 1465 | echo "error : ".$e->getMessage(); |
1466 | 1466 | } |
1467 | 1467 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1470,17 +1470,17 @@ discard block |
||
1470 | 1470 | public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
1471 | 1471 | global $globalArchiveMonths, $globalDBdriver; |
1472 | 1472 | if ($filter_name == '') $filter_name = $this->filter_name; |
1473 | - if (strpos($stats_airline,'alliance_') !== FALSE) { |
|
1473 | + if (strpos($stats_airline, 'alliance_') !== FALSE) { |
|
1474 | 1474 | $Spotter = new Spotter($this->db); |
1475 | - $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
|
1475 | + $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline))); |
|
1476 | 1476 | $alliance_airlines = array(); |
1477 | 1477 | foreach ($airlines as $airline) { |
1478 | - $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
|
1478 | + $alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao'])); |
|
1479 | 1479 | } |
1480 | 1480 | if ($globalDBdriver == 'mysql') { |
1481 | - $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1481 | + $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1482 | 1482 | } else { |
1483 | - $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name"; |
|
1483 | + $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name"; |
|
1484 | 1484 | } |
1485 | 1485 | } else { |
1486 | 1486 | if ($globalDBdriver == 'mysql') { |
@@ -1492,7 +1492,7 @@ discard block |
||
1492 | 1492 | try { |
1493 | 1493 | $sth = $this->db->prepare($query); |
1494 | 1494 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
1495 | - } catch(PDOException $e) { |
|
1495 | + } catch (PDOException $e) { |
|
1496 | 1496 | echo "error : ".$e->getMessage(); |
1497 | 1497 | } |
1498 | 1498 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1509,7 +1509,7 @@ discard block |
||
1509 | 1509 | try { |
1510 | 1510 | $sth = $this->db->prepare($query); |
1511 | 1511 | $sth->execute(array(':filter_name' => $filter_name)); |
1512 | - } catch(PDOException $e) { |
|
1512 | + } catch (PDOException $e) { |
|
1513 | 1513 | echo "error : ".$e->getMessage(); |
1514 | 1514 | } |
1515 | 1515 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1526,20 +1526,20 @@ discard block |
||
1526 | 1526 | try { |
1527 | 1527 | $sth = $this->db->prepare($query); |
1528 | 1528 | $sth->execute(array(':filter_name' => $filter_name)); |
1529 | - } catch(PDOException $e) { |
|
1529 | + } catch (PDOException $e) { |
|
1530 | 1530 | echo "error : ".$e->getMessage(); |
1531 | 1531 | } |
1532 | 1532 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1533 | 1533 | return $all[0]['total']; |
1534 | 1534 | } |
1535 | - public function getStatsOwner($owner_name,$filter_name = '') { |
|
1535 | + public function getStatsOwner($owner_name, $filter_name = '') { |
|
1536 | 1536 | global $globalArchiveMonths, $globalDBdriver; |
1537 | 1537 | if ($filter_name == '') $filter_name = $this->filter_name; |
1538 | 1538 | $query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name"; |
1539 | 1539 | try { |
1540 | 1540 | $sth = $this->db->prepare($query); |
1541 | - $sth->execute(array(':filter_name' => $filter_name,':owner_name' => $owner_name)); |
|
1542 | - } catch(PDOException $e) { |
|
1541 | + $sth->execute(array(':filter_name' => $filter_name, ':owner_name' => $owner_name)); |
|
1542 | + } catch (PDOException $e) { |
|
1543 | 1543 | echo "error : ".$e->getMessage(); |
1544 | 1544 | } |
1545 | 1545 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1557,20 +1557,20 @@ discard block |
||
1557 | 1557 | try { |
1558 | 1558 | $sth = $this->db->prepare($query); |
1559 | 1559 | $sth->execute(array(':filter_name' => $filter_name)); |
1560 | - } catch(PDOException $e) { |
|
1560 | + } catch (PDOException $e) { |
|
1561 | 1561 | echo "error : ".$e->getMessage(); |
1562 | 1562 | } |
1563 | 1563 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1564 | 1564 | return $all[0]['total']; |
1565 | 1565 | } |
1566 | - public function getStatsPilot($pilot,$filter_name = '') { |
|
1566 | + public function getStatsPilot($pilot, $filter_name = '') { |
|
1567 | 1567 | global $globalArchiveMonths, $globalDBdriver; |
1568 | 1568 | if ($filter_name == '') $filter_name = $this->filter_name; |
1569 | 1569 | $query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)"; |
1570 | 1570 | try { |
1571 | 1571 | $sth = $this->db->prepare($query); |
1572 | - $sth->execute(array(':filter_name' => $filter_name,':pilot' => $pilot)); |
|
1573 | - } catch(PDOException $e) { |
|
1572 | + $sth->execute(array(':filter_name' => $filter_name, ':pilot' => $pilot)); |
|
1573 | + } catch (PDOException $e) { |
|
1574 | 1574 | echo "error : ".$e->getMessage(); |
1575 | 1575 | } |
1576 | 1576 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1578,7 +1578,7 @@ discard block |
||
1578 | 1578 | else return 0; |
1579 | 1579 | } |
1580 | 1580 | |
1581 | - public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
1581 | + public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
1582 | 1582 | global $globalDBdriver; |
1583 | 1583 | if ($filter_name == '') $filter_name = $this->filter_name; |
1584 | 1584 | if ($globalDBdriver == 'mysql') { |
@@ -1586,15 +1586,15 @@ discard block |
||
1586 | 1586 | } else { |
1587 | 1587 | $query = "UPDATE stats SET cnt = :cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1588 | 1588 | } |
1589 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1589 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1590 | 1590 | try { |
1591 | 1591 | $sth = $this->db->prepare($query); |
1592 | 1592 | $sth->execute($query_values); |
1593 | - } catch(PDOException $e) { |
|
1593 | + } catch (PDOException $e) { |
|
1594 | 1594 | return "error : ".$e->getMessage(); |
1595 | 1595 | } |
1596 | 1596 | } |
1597 | - public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
1597 | + public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
1598 | 1598 | global $globalDBdriver; |
1599 | 1599 | if ($filter_name == '') $filter_name = $this->filter_name; |
1600 | 1600 | if ($globalDBdriver == 'mysql') { |
@@ -1603,11 +1603,11 @@ discard block |
||
1603 | 1603 | //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
1604 | 1604 | $query = "UPDATE stats SET cnt = cnt+:cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1605 | 1605 | } |
1606 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1606 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1607 | 1607 | try { |
1608 | 1608 | $sth = $this->db->prepare($query); |
1609 | 1609 | $sth->execute($query_values); |
1610 | - } catch(PDOException $e) { |
|
1610 | + } catch (PDOException $e) { |
|
1611 | 1611 | return "error : ".$e->getMessage(); |
1612 | 1612 | } |
1613 | 1613 | } |
@@ -1631,75 +1631,75 @@ discard block |
||
1631 | 1631 | } |
1632 | 1632 | */ |
1633 | 1633 | |
1634 | - public function getStatsSource($stats_type,$year = '',$month = '',$day = '') { |
|
1634 | + public function getStatsSource($stats_type, $year = '', $month = '', $day = '') { |
|
1635 | 1635 | global $globalDBdriver; |
1636 | 1636 | $query = "SELECT * FROM stats_source WHERE stats_type = :stats_type"; |
1637 | 1637 | $query_values = array(); |
1638 | 1638 | if ($globalDBdriver == 'mysql') { |
1639 | 1639 | if ($year != '') { |
1640 | 1640 | $query .= ' AND YEAR(stats_date) = :year'; |
1641 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1641 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1642 | 1642 | } |
1643 | 1643 | if ($month != '') { |
1644 | 1644 | $query .= ' AND MONTH(stats_date) = :month'; |
1645 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1645 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1646 | 1646 | } |
1647 | 1647 | if ($day != '') { |
1648 | 1648 | $query .= ' AND DAY(stats_date) = :day'; |
1649 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1649 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1650 | 1650 | } |
1651 | 1651 | } else { |
1652 | 1652 | if ($year != '') { |
1653 | 1653 | $query .= ' AND EXTRACT(YEAR FROM stats_date) = :year'; |
1654 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1654 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1655 | 1655 | } |
1656 | 1656 | if ($month != '') { |
1657 | 1657 | $query .= ' AND EXTRACT(MONTH FROM stats_date) = :month'; |
1658 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1658 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1659 | 1659 | } |
1660 | 1660 | if ($day != '') { |
1661 | 1661 | $query .= ' AND EXTRACT(DAY FROM stats_date) = :day'; |
1662 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1662 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1663 | 1663 | } |
1664 | 1664 | } |
1665 | 1665 | $query .= " ORDER BY source_name"; |
1666 | - $query_values = array_merge($query_values,array(':stats_type' => $stats_type)); |
|
1666 | + $query_values = array_merge($query_values, array(':stats_type' => $stats_type)); |
|
1667 | 1667 | try { |
1668 | 1668 | $sth = $this->db->prepare($query); |
1669 | 1669 | $sth->execute($query_values); |
1670 | - } catch(PDOException $e) { |
|
1670 | + } catch (PDOException $e) { |
|
1671 | 1671 | echo "error : ".$e->getMessage(); |
1672 | 1672 | } |
1673 | 1673 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1674 | 1674 | return $all; |
1675 | 1675 | } |
1676 | 1676 | |
1677 | - public function addStatSource($data,$source_name,$stats_type,$date) { |
|
1677 | + public function addStatSource($data, $source_name, $stats_type, $date) { |
|
1678 | 1678 | global $globalDBdriver; |
1679 | 1679 | if ($globalDBdriver == 'mysql') { |
1680 | 1680 | $query = "INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) VALUES (:data,:source_name,:stats_type,:stats_date) ON DUPLICATE KEY UPDATE source_data = :data"; |
1681 | 1681 | } else { |
1682 | 1682 | $query = "UPDATE stats_source SET source_data = :data WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type; INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) SELECT :data,:source_name,:stats_type,:stats_date WHERE NOT EXISTS (SELECT 1 FROM stats_source WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type);"; |
1683 | 1683 | } |
1684 | - $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
1684 | + $query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type); |
|
1685 | 1685 | try { |
1686 | 1686 | $sth = $this->db->prepare($query); |
1687 | 1687 | $sth->execute($query_values); |
1688 | - } catch(PDOException $e) { |
|
1688 | + } catch (PDOException $e) { |
|
1689 | 1689 | return "error : ".$e->getMessage(); |
1690 | 1690 | } |
1691 | 1691 | } |
1692 | - public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
|
1692 | + public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') { |
|
1693 | 1693 | $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
1694 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1694 | + $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1695 | 1695 | try { |
1696 | 1696 | $sth = $this->db->prepare($query); |
1697 | 1697 | $sth->execute($query_values); |
1698 | - } catch(PDOException $e) { |
|
1698 | + } catch (PDOException $e) { |
|
1699 | 1699 | return "error : ".$e->getMessage(); |
1700 | 1700 | } |
1701 | 1701 | } |
1702 | - public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '',$reset = false) { |
|
1702 | + public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
1703 | 1703 | global $globalDBdriver; |
1704 | 1704 | if ($globalDBdriver == 'mysql') { |
1705 | 1705 | if ($reset) { |
@@ -1714,15 +1714,15 @@ discard block |
||
1714 | 1714 | $query = "UPDATE stats_registration SET cnt = cnt+:cnt WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:registration,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_registration WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1715 | 1715 | } |
1716 | 1716 | } |
1717 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1717 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1718 | 1718 | try { |
1719 | 1719 | $sth = $this->db->prepare($query); |
1720 | 1720 | $sth->execute($query_values); |
1721 | - } catch(PDOException $e) { |
|
1721 | + } catch (PDOException $e) { |
|
1722 | 1722 | return "error : ".$e->getMessage(); |
1723 | 1723 | } |
1724 | 1724 | } |
1725 | - public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '', $reset = false) { |
|
1725 | + public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1726 | 1726 | global $globalDBdriver; |
1727 | 1727 | if ($globalDBdriver == 'mysql') { |
1728 | 1728 | if ($reset) { |
@@ -1737,15 +1737,15 @@ discard block |
||
1737 | 1737 | $query = "UPDATE stats_callsign SET cnt = cnt+:cnt WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name; INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) SELECT :callsign_icao,:airline_icao,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_callsign WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name);"; |
1738 | 1738 | } |
1739 | 1739 | } |
1740 | - $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1740 | + $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1741 | 1741 | try { |
1742 | 1742 | $sth = $this->db->prepare($query); |
1743 | 1743 | $sth->execute($query_values); |
1744 | - } catch(PDOException $e) { |
|
1744 | + } catch (PDOException $e) { |
|
1745 | 1745 | return "error : ".$e->getMessage(); |
1746 | 1746 | } |
1747 | 1747 | } |
1748 | - public function addStatCountry($iso2,$iso3,$name,$cnt,$airline_icao = '',$filter_name = '',$reset = false) { |
|
1748 | + public function addStatCountry($iso2, $iso3, $name, $cnt, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1749 | 1749 | global $globalDBdriver; |
1750 | 1750 | if ($globalDBdriver == 'mysql') { |
1751 | 1751 | if ($reset) { |
@@ -1760,15 +1760,15 @@ discard block |
||
1760 | 1760 | $query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name AND stats_airline = :airline; INSERT INTO stats_country (iso2,iso3,name,cnt,stats_airline,filter_name) SELECT :iso2,:iso3,:name,:cnt,:airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name AND stats_airline = :airline);"; |
1761 | 1761 | } |
1762 | 1762 | } |
1763 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name,':airline' => $airline_icao); |
|
1763 | + $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name, ':airline' => $airline_icao); |
|
1764 | 1764 | try { |
1765 | 1765 | $sth = $this->db->prepare($query); |
1766 | 1766 | $sth->execute($query_values); |
1767 | - } catch(PDOException $e) { |
|
1767 | + } catch (PDOException $e) { |
|
1768 | 1768 | return "error : ".$e->getMessage(); |
1769 | 1769 | } |
1770 | 1770 | } |
1771 | - public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
1771 | + public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
1772 | 1772 | global $globalDBdriver; |
1773 | 1773 | if ($globalDBdriver == 'mysql') { |
1774 | 1774 | if ($reset) { |
@@ -1783,15 +1783,15 @@ discard block |
||
1783 | 1783 | $query = "UPDATE stats_aircraft SET cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, filter_name = :filter_name WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_aircraft WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1784 | 1784 | } |
1785 | 1785 | } |
1786 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1786 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':aircraft_name' => $aircraft_name, ':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1787 | 1787 | try { |
1788 | 1788 | $sth = $this->db->prepare($query); |
1789 | 1789 | $sth->execute($query_values); |
1790 | - } catch(PDOException $e) { |
|
1790 | + } catch (PDOException $e) { |
|
1791 | 1791 | return "error : ".$e->getMessage(); |
1792 | 1792 | } |
1793 | 1793 | } |
1794 | - public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '', $reset = false) { |
|
1794 | + public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '', $reset = false) { |
|
1795 | 1795 | global $globalDBdriver; |
1796 | 1796 | if ($globalDBdriver == 'mysql') { |
1797 | 1797 | if ($reset) { |
@@ -1806,15 +1806,15 @@ discard block |
||
1806 | 1806 | $query = "UPDATE stats_airline SET cnt = cnt+:cnt WHERE airline_icao = :airline_icao AND filter_name = :filter_name; INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) SELECT :airline_icao,:airline_name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airline WHERE airline_icao = :airline_icao AND filter_name = :filter_name);"; |
1807 | 1807 | } |
1808 | 1808 | } |
1809 | - $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
1809 | + $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1810 | 1810 | try { |
1811 | 1811 | $sth = $this->db->prepare($query); |
1812 | 1812 | $sth->execute($query_values); |
1813 | - } catch(PDOException $e) { |
|
1813 | + } catch (PDOException $e) { |
|
1814 | 1814 | return "error : ".$e->getMessage(); |
1815 | 1815 | } |
1816 | 1816 | } |
1817 | - public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '', $reset = false) { |
|
1817 | + public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '', $reset = false) { |
|
1818 | 1818 | global $globalDBdriver; |
1819 | 1819 | if ($globalDBdriver == 'mysql') { |
1820 | 1820 | if ($reset) { |
@@ -1829,15 +1829,15 @@ discard block |
||
1829 | 1829 | $query = "UPDATE stats_owner SET cnt = cnt+:cnt WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) SELECT :owner_name,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_owner WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1830 | 1830 | } |
1831 | 1831 | } |
1832 | - $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1832 | + $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1833 | 1833 | try { |
1834 | 1834 | $sth = $this->db->prepare($query); |
1835 | 1835 | $sth->execute($query_values); |
1836 | - } catch(PDOException $e) { |
|
1836 | + } catch (PDOException $e) { |
|
1837 | 1837 | return "error : ".$e->getMessage(); |
1838 | 1838 | } |
1839 | 1839 | } |
1840 | - public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '',$reset = false) { |
|
1840 | + public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '', $format_source = '', $reset = false) { |
|
1841 | 1841 | global $globalDBdriver; |
1842 | 1842 | if ($globalDBdriver == 'mysql') { |
1843 | 1843 | if ($reset) { |
@@ -1852,15 +1852,15 @@ discard block |
||
1852 | 1852 | $query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name,format_source) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name,:format_source WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source);"; |
1853 | 1853 | } |
1854 | 1854 | } |
1855 | - $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name,':format_source' => $format_source); |
|
1855 | + $query_values = array(':pilot_id' => $pilot_id, ':cnt' => $cnt, ':pilot_name' => $pilot_name, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':format_source' => $format_source); |
|
1856 | 1856 | try { |
1857 | 1857 | $sth = $this->db->prepare($query); |
1858 | 1858 | $sth->execute($query_values); |
1859 | - } catch(PDOException $e) { |
|
1859 | + } catch (PDOException $e) { |
|
1860 | 1860 | return "error : ".$e->getMessage(); |
1861 | 1861 | } |
1862 | 1862 | } |
1863 | - public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '',$reset = false) { |
|
1863 | + public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1864 | 1864 | global $globalDBdriver; |
1865 | 1865 | if ($airport_icao != '') { |
1866 | 1866 | if ($globalDBdriver == 'mysql') { |
@@ -1876,16 +1876,16 @@ discard block |
||
1876 | 1876 | $query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; |
1877 | 1877 | } |
1878 | 1878 | } |
1879 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1879 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1880 | 1880 | try { |
1881 | 1881 | $sth = $this->db->prepare($query); |
1882 | 1882 | $sth->execute($query_values); |
1883 | - } catch(PDOException $e) { |
|
1883 | + } catch (PDOException $e) { |
|
1884 | 1884 | return "error : ".$e->getMessage(); |
1885 | 1885 | } |
1886 | 1886 | } |
1887 | 1887 | } |
1888 | - public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
|
1888 | + public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') { |
|
1889 | 1889 | global $globalDBdriver; |
1890 | 1890 | if ($airport_icao != '') { |
1891 | 1891 | if ($globalDBdriver == 'mysql') { |
@@ -1893,16 +1893,16 @@ discard block |
||
1893 | 1893 | } else { |
1894 | 1894 | $query = "UPDATE stats_airport SET departure = :departure WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1895 | 1895 | } |
1896 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1896 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1897 | 1897 | try { |
1898 | 1898 | $sth = $this->db->prepare($query); |
1899 | 1899 | $sth->execute($query_values); |
1900 | - } catch(PDOException $e) { |
|
1900 | + } catch (PDOException $e) { |
|
1901 | 1901 | return "error : ".$e->getMessage(); |
1902 | 1902 | } |
1903 | 1903 | } |
1904 | 1904 | } |
1905 | - public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '',$reset = false) { |
|
1905 | + public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1906 | 1906 | global $globalDBdriver; |
1907 | 1907 | if ($airport_icao != '') { |
1908 | 1908 | if ($globalDBdriver == 'mysql') { |
@@ -1918,16 +1918,16 @@ discard block |
||
1918 | 1918 | $query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; |
1919 | 1919 | } |
1920 | 1920 | } |
1921 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1921 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1922 | 1922 | try { |
1923 | 1923 | $sth = $this->db->prepare($query); |
1924 | 1924 | $sth->execute($query_values); |
1925 | - } catch(PDOException $e) { |
|
1925 | + } catch (PDOException $e) { |
|
1926 | 1926 | return "error : ".$e->getMessage(); |
1927 | 1927 | } |
1928 | 1928 | } |
1929 | 1929 | } |
1930 | - public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
|
1930 | + public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') { |
|
1931 | 1931 | global $globalDBdriver; |
1932 | 1932 | if ($airport_icao != '') { |
1933 | 1933 | if ($globalDBdriver == 'mysql') { |
@@ -1935,11 +1935,11 @@ discard block |
||
1935 | 1935 | } else { |
1936 | 1936 | $query = "UPDATE stats_airport SET arrival = :arrival WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1937 | 1937 | } |
1938 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival, ':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1938 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1939 | 1939 | try { |
1940 | 1940 | $sth = $this->db->prepare($query); |
1941 | 1941 | $sth->execute($query_values); |
1942 | - } catch(PDOException $e) { |
|
1942 | + } catch (PDOException $e) { |
|
1943 | 1943 | return "error : ".$e->getMessage(); |
1944 | 1944 | } |
1945 | 1945 | } |
@@ -1951,7 +1951,7 @@ discard block |
||
1951 | 1951 | try { |
1952 | 1952 | $sth = $this->db->prepare($query); |
1953 | 1953 | $sth->execute($query_values); |
1954 | - } catch(PDOException $e) { |
|
1954 | + } catch (PDOException $e) { |
|
1955 | 1955 | return "error : ".$e->getMessage(); |
1956 | 1956 | } |
1957 | 1957 | } |
@@ -1961,7 +1961,7 @@ discard block |
||
1961 | 1961 | try { |
1962 | 1962 | $sth = $this->db->prepare($query); |
1963 | 1963 | $sth->execute($query_values); |
1964 | - } catch(PDOException $e) { |
|
1964 | + } catch (PDOException $e) { |
|
1965 | 1965 | return "error : ".$e->getMessage(); |
1966 | 1966 | } |
1967 | 1967 | } |
@@ -1971,13 +1971,13 @@ discard block |
||
1971 | 1971 | try { |
1972 | 1972 | $sth = $this->db->prepare($query); |
1973 | 1973 | $sth->execute($query_values); |
1974 | - } catch(PDOException $e) { |
|
1974 | + } catch (PDOException $e) { |
|
1975 | 1975 | return "error : ".$e->getMessage(); |
1976 | 1976 | } |
1977 | 1977 | } |
1978 | 1978 | |
1979 | 1979 | public function addOldStats() { |
1980 | - global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear, $globalAccidents; |
|
1980 | + global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters, $globalDeleteLastYearStats, $globalStatsReset, $globalStatsResetYear, $globalAccidents; |
|
1981 | 1981 | $Common = new Common(); |
1982 | 1982 | $Connection = new Connection(); |
1983 | 1983 | date_default_timezone_set('UTC'); |
@@ -1995,41 +1995,41 @@ discard block |
||
1995 | 1995 | $Spotter = new Spotter($this->db); |
1996 | 1996 | |
1997 | 1997 | if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
1998 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
|
1998 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day); |
|
1999 | 1999 | foreach ($alldata as $number) { |
2000 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset); |
|
2000 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', '', $reset); |
|
2001 | 2001 | } |
2002 | 2002 | if ($globalDebug) echo 'Count all airlines...'."\n"; |
2003 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
|
2003 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day); |
|
2004 | 2004 | foreach ($alldata as $number) { |
2005 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset); |
|
2005 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], '', $reset); |
|
2006 | 2006 | } |
2007 | 2007 | if ($globalDebug) echo 'Count all registrations...'."\n"; |
2008 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
|
2008 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day); |
|
2009 | 2009 | foreach ($alldata as $number) { |
2010 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset); |
|
2010 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', '', $reset); |
|
2011 | 2011 | } |
2012 | 2012 | if ($globalDebug) echo 'Count all callsigns...'."\n"; |
2013 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
|
2013 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day); |
|
2014 | 2014 | foreach ($alldata as $number) { |
2015 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
|
2015 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset); |
|
2016 | 2016 | } |
2017 | 2017 | if ($globalDebug) echo 'Count all owners...'."\n"; |
2018 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
|
2018 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day); |
|
2019 | 2019 | foreach ($alldata as $number) { |
2020 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset); |
|
2020 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], '', '', $reset); |
|
2021 | 2021 | } |
2022 | 2022 | if ($globalDebug) echo 'Count all pilots...'."\n"; |
2023 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
|
2023 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day); |
|
2024 | 2024 | foreach ($alldata as $number) { |
2025 | 2025 | if ($number['pilot_id'] == 0 || $number['pilot_id'] == '') $number['pilot_id'] = $number['pilot_name']; |
2026 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset); |
|
2026 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', '', $number['format_source'], $reset); |
|
2027 | 2027 | } |
2028 | 2028 | |
2029 | 2029 | if ($globalDebug) echo 'Count all departure airports...'."\n"; |
2030 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
|
2030 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day); |
|
2031 | 2031 | if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
2032 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
2032 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day); |
|
2033 | 2033 | if ($globalDebug) echo 'Order departure airports...'."\n"; |
2034 | 2034 | $alldata = array(); |
2035 | 2035 | |
@@ -2047,14 +2047,14 @@ discard block |
||
2047 | 2047 | foreach ($alldata as $key => $row) { |
2048 | 2048 | $count[$key] = $row['airport_departure_icao_count']; |
2049 | 2049 | } |
2050 | - array_multisort($count,SORT_DESC,$alldata); |
|
2050 | + array_multisort($count, SORT_DESC, $alldata); |
|
2051 | 2051 | foreach ($alldata as $number) { |
2052 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'','',$reset); |
|
2052 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', '', $reset); |
|
2053 | 2053 | } |
2054 | 2054 | if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
2055 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
|
2055 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day); |
|
2056 | 2056 | if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
2057 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
2057 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day); |
|
2058 | 2058 | if ($globalDebug) echo 'Order arrival airports...'."\n"; |
2059 | 2059 | $alldata = array(); |
2060 | 2060 | foreach ($pall as $value) { |
@@ -2071,18 +2071,18 @@ discard block |
||
2071 | 2071 | foreach ($alldata as $key => $row) { |
2072 | 2072 | $count[$key] = $row['airport_arrival_icao_count']; |
2073 | 2073 | } |
2074 | - array_multisort($count,SORT_DESC,$alldata); |
|
2074 | + array_multisort($count, SORT_DESC, $alldata); |
|
2075 | 2075 | foreach ($alldata as $number) { |
2076 | - echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset); |
|
2076 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', '', $reset); |
|
2077 | 2077 | } |
2078 | 2078 | if ($Connection->tableExists('countries')) { |
2079 | 2079 | if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
2080 | 2080 | //$SpotterArchive = new SpotterArchive(); |
2081 | 2081 | //$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
2082 | 2082 | $Spotter = new Spotter($this->db); |
2083 | - $alldata = $Spotter->countAllFlightOverCountries(false,0,$last_update_day); |
|
2083 | + $alldata = $Spotter->countAllFlightOverCountries(false, 0, $last_update_day); |
|
2084 | 2084 | foreach ($alldata as $number) { |
2085 | - $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],'','',$reset); |
|
2085 | + $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], '', '', $reset); |
|
2086 | 2086 | } |
2087 | 2087 | } |
2088 | 2088 | |
@@ -2092,12 +2092,12 @@ discard block |
||
2092 | 2092 | $this->deleteStatsByType('fatalities_byyear'); |
2093 | 2093 | $alldata = $Accident->countFatalitiesByYear(); |
2094 | 2094 | foreach ($alldata as $number) { |
2095 | - $this->addStat('fatalities_byyear',$number['count'],date('Y-m-d H:i:s',mktime(0,0,0,1,1,$number['year']))); |
|
2095 | + $this->addStat('fatalities_byyear', $number['count'], date('Y-m-d H:i:s', mktime(0, 0, 0, 1, 1, $number['year']))); |
|
2096 | 2096 | } |
2097 | 2097 | $this->deleteStatsByType('fatalities_bymonth'); |
2098 | 2098 | $alldata = $Accident->countFatalitiesLast12Months(); |
2099 | 2099 | foreach ($alldata as $number) { |
2100 | - $this->addStat('fatalities_bymonth',$number['count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month'],1,$number['year']))); |
|
2100 | + $this->addStat('fatalities_bymonth', $number['count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month'], 1, $number['year']))); |
|
2101 | 2101 | } |
2102 | 2102 | } |
2103 | 2103 | |
@@ -2113,37 +2113,37 @@ discard block |
||
2113 | 2113 | $lastyear = false; |
2114 | 2114 | foreach ($alldata as $number) { |
2115 | 2115 | if ($number['year_name'] != date('Y')) $lastyear = true; |
2116 | - $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
2116 | + $this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
2117 | 2117 | } |
2118 | 2118 | if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
2119 | 2119 | $alldata = $Spotter->countAllMilitaryMonths($filter_last_month); |
2120 | 2120 | foreach ($alldata as $number) { |
2121 | - $this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
2121 | + $this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
2122 | 2122 | } |
2123 | 2123 | if ($globalDebug) echo 'Count all owners by months...'."\n"; |
2124 | 2124 | $alldata = $Spotter->countAllMonthsOwners($filter_last_month); |
2125 | 2125 | foreach ($alldata as $number) { |
2126 | - $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
2126 | + $this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
2127 | 2127 | } |
2128 | 2128 | if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
2129 | 2129 | $alldata = $Spotter->countAllMonthsPilots($filter_last_month); |
2130 | 2130 | foreach ($alldata as $number) { |
2131 | - $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
2131 | + $this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
2132 | 2132 | } |
2133 | 2133 | if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
2134 | 2134 | $alldata = $Spotter->countAllMonthsAirlines($filter_last_month); |
2135 | 2135 | foreach ($alldata as $number) { |
2136 | - $this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
2136 | + $this->addStat('airlines_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
2137 | 2137 | } |
2138 | 2138 | if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
2139 | 2139 | $alldata = $Spotter->countAllMonthsAircrafts($filter_last_month); |
2140 | 2140 | foreach ($alldata as $number) { |
2141 | - $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
2141 | + $this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
2142 | 2142 | } |
2143 | 2143 | if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
2144 | 2144 | $alldata = $Spotter->countAllMonthsRealArrivals($filter_last_month); |
2145 | 2145 | foreach ($alldata as $number) { |
2146 | - $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
2146 | + $this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
2147 | 2147 | } |
2148 | 2148 | if ($globalDebug) echo 'Airports data...'."\n"; |
2149 | 2149 | if ($globalDebug) echo '...Departure'."\n"; |
@@ -2188,7 +2188,7 @@ discard block |
||
2188 | 2188 | } |
2189 | 2189 | $alldata = $pall; |
2190 | 2190 | foreach ($alldata as $number) { |
2191 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']); |
|
2191 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']); |
|
2192 | 2192 | } |
2193 | 2193 | echo '...Arrival'."\n"; |
2194 | 2194 | $pall = $Spotter->getLast7DaysAirportsArrival(); |
@@ -2230,7 +2230,7 @@ discard block |
||
2230 | 2230 | } |
2231 | 2231 | $alldata = $pall; |
2232 | 2232 | foreach ($alldata as $number) { |
2233 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']); |
|
2233 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']); |
|
2234 | 2234 | } |
2235 | 2235 | |
2236 | 2236 | echo 'Flights data...'."\n"; |
@@ -2238,28 +2238,28 @@ discard block |
||
2238 | 2238 | echo '-> countAllDatesLastMonth...'."\n"; |
2239 | 2239 | $alldata = $Spotter->countAllDatesLastMonth($filter_last_month); |
2240 | 2240 | foreach ($alldata as $number) { |
2241 | - $this->addStatFlight('month',$number['date_name'],$number['date_count']); |
|
2241 | + $this->addStatFlight('month', $number['date_name'], $number['date_count']); |
|
2242 | 2242 | } |
2243 | 2243 | echo '-> countAllDates...'."\n"; |
2244 | 2244 | $previousdata = $this->countAllDates(); |
2245 | 2245 | $previousdatabyairlines = $this->countAllDatesByAirlines(); |
2246 | 2246 | $this->deleteStatFlight('date'); |
2247 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter_last_month)); |
|
2247 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter_last_month)); |
|
2248 | 2248 | $values = array(); |
2249 | 2249 | foreach ($alldata as $cnt) { |
2250 | 2250 | $values[] = $cnt['date_count']; |
2251 | 2251 | } |
2252 | - array_multisort($values,SORT_DESC,$alldata); |
|
2253 | - array_splice($alldata,11); |
|
2252 | + array_multisort($values, SORT_DESC, $alldata); |
|
2253 | + array_splice($alldata, 11); |
|
2254 | 2254 | foreach ($alldata as $number) { |
2255 | - $this->addStatFlight('date',$number['date_name'],$number['date_count']); |
|
2255 | + $this->addStatFlight('date', $number['date_name'], $number['date_count']); |
|
2256 | 2256 | } |
2257 | 2257 | |
2258 | 2258 | $this->deleteStatFlight('hour'); |
2259 | 2259 | echo '-> countAllHours...'."\n"; |
2260 | - $alldata = $Spotter->countAllHours('hour',$filter_last_month); |
|
2260 | + $alldata = $Spotter->countAllHours('hour', $filter_last_month); |
|
2261 | 2261 | foreach ($alldata as $number) { |
2262 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count']); |
|
2262 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count']); |
|
2263 | 2263 | } |
2264 | 2264 | |
2265 | 2265 | |
@@ -2270,42 +2270,42 @@ discard block |
||
2270 | 2270 | if ($globalDebug) echo 'Count all flights by countries by airlines...'."\n"; |
2271 | 2271 | $SpotterArchive = new SpotterArchive(); |
2272 | 2272 | //$Spotter = new Spotter($this->db); |
2273 | - $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
|
2273 | + $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false, 0, $last_update_day); |
|
2274 | 2274 | //$alldata = $Spotter->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
2275 | 2275 | foreach ($alldata as $number) { |
2276 | - $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],$number['airline_icao'],'',$reset); |
|
2276 | + $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], $number['airline_icao'], '', $reset); |
|
2277 | 2277 | } |
2278 | 2278 | } |
2279 | 2279 | if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
2280 | 2280 | $Spotter = new Spotter($this->db); |
2281 | - $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
|
2281 | + $alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day); |
|
2282 | 2282 | foreach ($alldata as $number) { |
2283 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset); |
|
2283 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao'], '', $reset); |
|
2284 | 2284 | } |
2285 | 2285 | if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
2286 | - $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
|
2286 | + $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day); |
|
2287 | 2287 | foreach ($alldata as $number) { |
2288 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset); |
|
2288 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao'], '', $reset); |
|
2289 | 2289 | } |
2290 | 2290 | if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
2291 | - $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
|
2291 | + $alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day); |
|
2292 | 2292 | foreach ($alldata as $number) { |
2293 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
|
2293 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset); |
|
2294 | 2294 | } |
2295 | 2295 | if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
2296 | - $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
|
2296 | + $alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day); |
|
2297 | 2297 | foreach ($alldata as $number) { |
2298 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset); |
|
2298 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao'], '', $reset); |
|
2299 | 2299 | } |
2300 | 2300 | if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
2301 | - $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
|
2301 | + $alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day); |
|
2302 | 2302 | foreach ($alldata as $number) { |
2303 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset); |
|
2303 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao'], '', $number['format_source'], $reset); |
|
2304 | 2304 | } |
2305 | 2305 | if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
2306 | - $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
|
2306 | + $pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
2307 | 2307 | if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
2308 | - $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
2308 | + $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
2309 | 2309 | if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
2310 | 2310 | //$alldata = array(); |
2311 | 2311 | foreach ($dall as $value) { |
@@ -2325,12 +2325,12 @@ discard block |
||
2325 | 2325 | } |
2326 | 2326 | $alldata = $pall; |
2327 | 2327 | foreach ($alldata as $number) { |
2328 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset); |
|
2328 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], $number['airline_icao'], '', $reset); |
|
2329 | 2329 | } |
2330 | 2330 | if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
2331 | - $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
|
2331 | + $pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
2332 | 2332 | if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
2333 | - $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
2333 | + $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
2334 | 2334 | if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
2335 | 2335 | //$alldata = array(); |
2336 | 2336 | foreach ($dall as $value) { |
@@ -2350,7 +2350,7 @@ discard block |
||
2350 | 2350 | } |
2351 | 2351 | $alldata = $pall; |
2352 | 2352 | foreach ($alldata as $number) { |
2353 | - if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
|
2353 | + if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], $number['airline_icao'], '', $reset); |
|
2354 | 2354 | } |
2355 | 2355 | if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
2356 | 2356 | $Spotter = new Spotter($this->db); |
@@ -2358,27 +2358,27 @@ discard block |
||
2358 | 2358 | $lastyear = false; |
2359 | 2359 | foreach ($alldata as $number) { |
2360 | 2360 | if ($number['year_name'] != date('Y')) $lastyear = true; |
2361 | - $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
2361 | + $this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
2362 | 2362 | } |
2363 | 2363 | if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
2364 | 2364 | $alldata = $Spotter->countAllMonthsOwnersByAirlines($filter_last_month); |
2365 | 2365 | foreach ($alldata as $number) { |
2366 | - $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
2366 | + $this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
2367 | 2367 | } |
2368 | 2368 | if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
2369 | 2369 | $alldata = $Spotter->countAllMonthsPilotsByAirlines($filter_last_month); |
2370 | 2370 | foreach ($alldata as $number) { |
2371 | - $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
2371 | + $this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
2372 | 2372 | } |
2373 | 2373 | if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
2374 | 2374 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines($filter_last_month); |
2375 | 2375 | foreach ($alldata as $number) { |
2376 | - $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
2376 | + $this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
2377 | 2377 | } |
2378 | 2378 | if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
2379 | 2379 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines($filter_last_month); |
2380 | 2380 | foreach ($alldata as $number) { |
2381 | - $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
2381 | + $this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
2382 | 2382 | } |
2383 | 2383 | if ($globalDebug) echo '...Departure'."\n"; |
2384 | 2384 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
@@ -2401,7 +2401,7 @@ discard block |
||
2401 | 2401 | } |
2402 | 2402 | $alldata = $pall; |
2403 | 2403 | foreach ($alldata as $number) { |
2404 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']); |
|
2404 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], $number['airline_icao']); |
|
2405 | 2405 | } |
2406 | 2406 | if ($globalDebug) echo '...Arrival'."\n"; |
2407 | 2407 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
@@ -2424,32 +2424,32 @@ discard block |
||
2424 | 2424 | } |
2425 | 2425 | $alldata = $pall; |
2426 | 2426 | foreach ($alldata as $number) { |
2427 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']); |
|
2427 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], $number['airline_icao']); |
|
2428 | 2428 | } |
2429 | 2429 | |
2430 | 2430 | if ($globalDebug) echo 'Flights data...'."\n"; |
2431 | 2431 | if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
2432 | 2432 | $alldata = $Spotter->countAllDatesLastMonthByAirlines($filter_last_month); |
2433 | 2433 | foreach ($alldata as $number) { |
2434 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
|
2434 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
2435 | 2435 | } |
2436 | 2436 | if ($globalDebug) echo '-> countAllDates...'."\n"; |
2437 | 2437 | //$previousdata = $this->countAllDatesByAirlines(); |
2438 | - $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines($filter_last_month)); |
|
2438 | + $alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines($filter_last_month)); |
|
2439 | 2439 | $values = array(); |
2440 | 2440 | foreach ($alldata as $cnt) { |
2441 | 2441 | $values[] = $cnt['date_count']; |
2442 | 2442 | } |
2443 | - array_multisort($values,SORT_DESC,$alldata); |
|
2444 | - array_splice($alldata,11); |
|
2443 | + array_multisort($values, SORT_DESC, $alldata); |
|
2444 | + array_splice($alldata, 11); |
|
2445 | 2445 | foreach ($alldata as $number) { |
2446 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
|
2446 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
2447 | 2447 | } |
2448 | 2448 | |
2449 | 2449 | if ($globalDebug) echo '-> countAllHours...'."\n"; |
2450 | - $alldata = $Spotter->countAllHoursByAirlines('hour',$filter_last_month); |
|
2450 | + $alldata = $Spotter->countAllHoursByAirlines('hour', $filter_last_month); |
|
2451 | 2451 | foreach ($alldata as $number) { |
2452 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
|
2452 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']); |
|
2453 | 2453 | } |
2454 | 2454 | |
2455 | 2455 | |
@@ -2473,7 +2473,7 @@ discard block |
||
2473 | 2473 | $last_update_day = date('Y').'-01-01 00:00:00'; |
2474 | 2474 | } |
2475 | 2475 | } |
2476 | - if (isset($filter['DeleteLastYearStats']) && date('Y',strtotime($last_update_day)) != date('Y')) { |
|
2476 | + if (isset($filter['DeleteLastYearStats']) && date('Y', strtotime($last_update_day)) != date('Y')) { |
|
2477 | 2477 | $last_update_day = date('Y').'-01-01 00:00:00'; |
2478 | 2478 | $reset = true; |
2479 | 2479 | } |
@@ -2482,32 +2482,32 @@ discard block |
||
2482 | 2482 | // Count by filter |
2483 | 2483 | if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
2484 | 2484 | $Spotter = new Spotter($this->db); |
2485 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
|
2485 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter); |
|
2486 | 2486 | foreach ($alldata as $number) { |
2487 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name,$reset); |
|
2487 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name, $reset); |
|
2488 | 2488 | } |
2489 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter); |
|
2489 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day, $filter); |
|
2490 | 2490 | foreach ($alldata as $number) { |
2491 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name,$reset); |
|
2491 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], $filter_name, $reset); |
|
2492 | 2492 | } |
2493 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter); |
|
2493 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter); |
|
2494 | 2494 | foreach ($alldata as $number) { |
2495 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name,$reset); |
|
2495 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name, $reset); |
|
2496 | 2496 | } |
2497 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter); |
|
2497 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter); |
|
2498 | 2498 | foreach ($alldata as $number) { |
2499 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name,$reset); |
|
2499 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name, $reset); |
|
2500 | 2500 | } |
2501 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter); |
|
2501 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter); |
|
2502 | 2502 | foreach ($alldata as $number) { |
2503 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name,$reset); |
|
2503 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name, $reset); |
|
2504 | 2504 | } |
2505 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter); |
|
2505 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter); |
|
2506 | 2506 | foreach ($alldata as $number) { |
2507 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source'],$reset); |
|
2507 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name, $number['format_source'], $reset); |
|
2508 | 2508 | } |
2509 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
|
2510 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
2509 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter); |
|
2510 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter); |
|
2511 | 2511 | $alldata = array(); |
2512 | 2512 | foreach ($pall as $value) { |
2513 | 2513 | $icao = $value['airport_departure_icao']; |
@@ -2523,12 +2523,12 @@ discard block |
||
2523 | 2523 | foreach ($alldata as $key => $row) { |
2524 | 2524 | $count[$key] = $row['airport_departure_icao_count']; |
2525 | 2525 | } |
2526 | - array_multisort($count,SORT_DESC,$alldata); |
|
2526 | + array_multisort($count, SORT_DESC, $alldata); |
|
2527 | 2527 | foreach ($alldata as $number) { |
2528 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name,$reset); |
|
2528 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', $filter_name, $reset); |
|
2529 | 2529 | } |
2530 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter); |
|
2531 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter); |
|
2530 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, false, $filter); |
|
2531 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, false, $filter); |
|
2532 | 2532 | $alldata = array(); |
2533 | 2533 | foreach ($pall as $value) { |
2534 | 2534 | $icao = $value['airport_arrival_icao']; |
@@ -2544,40 +2544,40 @@ discard block |
||
2544 | 2544 | foreach ($alldata as $key => $row) { |
2545 | 2545 | $count[$key] = $row['airport_arrival_icao_count']; |
2546 | 2546 | } |
2547 | - array_multisort($count,SORT_DESC,$alldata); |
|
2547 | + array_multisort($count, SORT_DESC, $alldata); |
|
2548 | 2548 | foreach ($alldata as $number) { |
2549 | - echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name,$reset); |
|
2549 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', $filter_name, $reset); |
|
2550 | 2550 | } |
2551 | 2551 | $Spotter = new Spotter($this->db); |
2552 | 2552 | $alldata = $Spotter->countAllMonths($filter); |
2553 | 2553 | $lastyear = false; |
2554 | 2554 | foreach ($alldata as $number) { |
2555 | 2555 | if ($number['year_name'] != date('Y')) $lastyear = true; |
2556 | - $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
2556 | + $this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
2557 | 2557 | } |
2558 | 2558 | $alldata = $Spotter->countAllMonthsOwners($filter); |
2559 | 2559 | foreach ($alldata as $number) { |
2560 | - $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
2560 | + $this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
2561 | 2561 | } |
2562 | 2562 | $alldata = $Spotter->countAllMonthsPilots($filter); |
2563 | 2563 | foreach ($alldata as $number) { |
2564 | - $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
2564 | + $this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
2565 | 2565 | } |
2566 | 2566 | $alldata = $Spotter->countAllMilitaryMonths($filter); |
2567 | 2567 | foreach ($alldata as $number) { |
2568 | - $this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
2568 | + $this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
2569 | 2569 | } |
2570 | 2570 | $alldata = $Spotter->countAllMonthsAircrafts($filter); |
2571 | 2571 | foreach ($alldata as $number) { |
2572 | - $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
2572 | + $this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
2573 | 2573 | } |
2574 | 2574 | $alldata = $Spotter->countAllMonthsRealArrivals($filter); |
2575 | 2575 | foreach ($alldata as $number) { |
2576 | - $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
2576 | + $this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
2577 | 2577 | } |
2578 | 2578 | echo '...Departure'."\n"; |
2579 | - $pall = $Spotter->getLast7DaysAirportsDeparture('',$filter); |
|
2580 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
2579 | + $pall = $Spotter->getLast7DaysAirportsDeparture('', $filter); |
|
2580 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter); |
|
2581 | 2581 | foreach ($dall as $value) { |
2582 | 2582 | $icao = $value['departure_airport_icao']; |
2583 | 2583 | $ddate = $value['date']; |
@@ -2595,11 +2595,11 @@ discard block |
||
2595 | 2595 | } |
2596 | 2596 | $alldata = $pall; |
2597 | 2597 | foreach ($alldata as $number) { |
2598 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],'',$filter_name); |
|
2598 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], '', $filter_name); |
|
2599 | 2599 | } |
2600 | 2600 | echo '...Arrival'."\n"; |
2601 | - $pall = $Spotter->getLast7DaysAirportsArrival('',$filter); |
|
2602 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
2601 | + $pall = $Spotter->getLast7DaysAirportsArrival('', $filter); |
|
2602 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter); |
|
2603 | 2603 | foreach ($dall as $value) { |
2604 | 2604 | $icao = $value['arrival_airport_icao']; |
2605 | 2605 | $ddate = $value['date']; |
@@ -2617,40 +2617,40 @@ discard block |
||
2617 | 2617 | } |
2618 | 2618 | $alldata = $pall; |
2619 | 2619 | foreach ($alldata as $number) { |
2620 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],'',$filter_name); |
|
2620 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], '', $filter_name); |
|
2621 | 2621 | } |
2622 | 2622 | |
2623 | 2623 | echo 'Flights data...'."\n"; |
2624 | 2624 | echo '-> countAllDatesLastMonth...'."\n"; |
2625 | 2625 | $alldata = $Spotter->countAllDatesLastMonth($filter); |
2626 | 2626 | foreach ($alldata as $number) { |
2627 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name); |
|
2627 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name); |
|
2628 | 2628 | } |
2629 | 2629 | echo '-> countAllDates...'."\n"; |
2630 | - $previousdata = $this->countAllDates('',$filter_name); |
|
2631 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter)); |
|
2630 | + $previousdata = $this->countAllDates('', $filter_name); |
|
2631 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter)); |
|
2632 | 2632 | $values = array(); |
2633 | 2633 | foreach ($alldata as $cnt) { |
2634 | 2634 | $values[] = $cnt['date_count']; |
2635 | 2635 | } |
2636 | - array_multisort($values,SORT_DESC,$alldata); |
|
2637 | - array_splice($alldata,11); |
|
2636 | + array_multisort($values, SORT_DESC, $alldata); |
|
2637 | + array_splice($alldata, 11); |
|
2638 | 2638 | foreach ($alldata as $number) { |
2639 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name); |
|
2639 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name); |
|
2640 | 2640 | } |
2641 | 2641 | |
2642 | 2642 | echo '-> countAllHours...'."\n"; |
2643 | - $alldata = $Spotter->countAllHours('hour',$filter); |
|
2643 | + $alldata = $Spotter->countAllHours('hour', $filter); |
|
2644 | 2644 | foreach ($alldata as $number) { |
2645 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name); |
|
2645 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name); |
|
2646 | 2646 | } |
2647 | 2647 | echo 'Insert last stats update date...'."\n"; |
2648 | 2648 | date_default_timezone_set('UTC'); |
2649 | - $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y-m-d G:i:s')); |
|
2649 | + $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y-m-d G:i:s')); |
|
2650 | 2650 | if (isset($filter['DeleteLastYearStats']) && $filter['DeleteLastYearStats'] == true) { |
2651 | - if (date('Y',strtotime($last_update_day)) != date('Y')) { |
|
2651 | + if (date('Y', strtotime($last_update_day)) != date('Y')) { |
|
2652 | 2652 | $this->deleteOldStats($filter_name); |
2653 | - $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y').'-01-01 00:00:00'); |
|
2653 | + $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y').'-01-01 00:00:00'); |
|
2654 | 2654 | } |
2655 | 2655 | } |
2656 | 2656 | |
@@ -2663,16 +2663,16 @@ discard block |
||
2663 | 2663 | // SUM all previous month to put as year |
2664 | 2664 | $previous_year = date('Y'); |
2665 | 2665 | $previous_year--; |
2666 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2667 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2668 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2669 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2666 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2667 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2668 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2669 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2670 | 2670 | $allairlines = $this->getAllAirlineNames(); |
2671 | 2671 | foreach ($allairlines as $data) { |
2672 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2673 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2674 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2675 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2672 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2673 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2674 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2675 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2676 | 2676 | } |
2677 | 2677 | |
2678 | 2678 | if (isset($globalArchiveYear) && $globalArchiveYear) { |
@@ -2681,7 +2681,7 @@ discard block |
||
2681 | 2681 | try { |
2682 | 2682 | $sth = $this->db->prepare($query); |
2683 | 2683 | $sth->execute(); |
2684 | - } catch(PDOException $e) { |
|
2684 | + } catch (PDOException $e) { |
|
2685 | 2685 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
2686 | 2686 | } |
2687 | 2687 | } |
@@ -2690,15 +2690,15 @@ discard block |
||
2690 | 2690 | try { |
2691 | 2691 | $sth = $this->db->prepare($query); |
2692 | 2692 | $sth->execute(); |
2693 | - } catch(PDOException $e) { |
|
2693 | + } catch (PDOException $e) { |
|
2694 | 2694 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
2695 | 2695 | } |
2696 | 2696 | } |
2697 | 2697 | if (isset($globalDeleteLastYearStats) && $globalDeleteLastYearStats) { |
2698 | 2698 | $last_update = $this->getLastStatsUpdate('last_update_stats'); |
2699 | - if (date('Y',strtotime($last_update[0]['value'])) != date('Y')) { |
|
2699 | + if (date('Y', strtotime($last_update[0]['value'])) != date('Y')) { |
|
2700 | 2700 | $this->deleteOldStats(); |
2701 | - $this->addLastStatsUpdate('last_update_stats',date('Y').'-01-01 00:00:00'); |
|
2701 | + $this->addLastStatsUpdate('last_update_stats', date('Y').'-01-01 00:00:00'); |
|
2702 | 2702 | $lastyearupdate = true; |
2703 | 2703 | } |
2704 | 2704 | } |
@@ -2720,7 +2720,7 @@ discard block |
||
2720 | 2720 | try { |
2721 | 2721 | $sth = $this->db->prepare($query); |
2722 | 2722 | $sth->execute(); |
2723 | - } catch(PDOException $e) { |
|
2723 | + } catch (PDOException $e) { |
|
2724 | 2724 | return "error : ".$e->getMessage(); |
2725 | 2725 | } |
2726 | 2726 | } |
@@ -2734,14 +2734,14 @@ discard block |
||
2734 | 2734 | try { |
2735 | 2735 | $sth = $this->db->prepare($query); |
2736 | 2736 | $sth->execute(); |
2737 | - } catch(PDOException $e) { |
|
2737 | + } catch (PDOException $e) { |
|
2738 | 2738 | return "error : ".$e->getMessage(); |
2739 | 2739 | } |
2740 | 2740 | } |
2741 | 2741 | if (!isset($lastyearupdate)) { |
2742 | 2742 | echo 'Insert last stats update date...'."\n"; |
2743 | 2743 | date_default_timezone_set('UTC'); |
2744 | - $this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s')); |
|
2744 | + $this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s')); |
|
2745 | 2745 | } |
2746 | 2746 | if ($globalStatsResetYear) { |
2747 | 2747 | require_once(dirname(__FILE__).'/../install/class.settings.php'); |
@@ -13,7 +13,9 @@ discard block |
||
13 | 13 | |
14 | 14 | public function __construct($dbc = null) { |
15 | 15 | global $globalFilterName; |
16 | - if (isset($globalFilterName)) $this->filter_name = $globalFilterName; |
|
16 | + if (isset($globalFilterName)) { |
|
17 | + $this->filter_name = $globalFilterName; |
|
18 | + } |
|
17 | 19 | $Connection = new Connection($dbc); |
18 | 20 | $this->db = $Connection->db(); |
19 | 21 | } |
@@ -81,7 +83,9 @@ discard block |
||
81 | 83 | } |
82 | 84 | } |
83 | 85 | public function getAllAirlineNames($filter_name = '') { |
84 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
86 | + if ($filter_name == '') { |
|
87 | + $filter_name = $this->filter_name; |
|
88 | + } |
|
85 | 89 | $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
86 | 90 | try { |
87 | 91 | $sth = $this->db->prepare($query); |
@@ -101,7 +105,9 @@ discard block |
||
101 | 105 | return $all; |
102 | 106 | } |
103 | 107 | public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
104 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
108 | + if ($filter_name == '') { |
|
109 | + $filter_name = $this->filter_name; |
|
110 | + } |
|
105 | 111 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
106 | 112 | try { |
107 | 113 | $sth = $this->db->prepare($query); |
@@ -113,7 +119,9 @@ discard block |
||
113 | 119 | return $all; |
114 | 120 | } |
115 | 121 | public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
116 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
122 | + if ($filter_name == '') { |
|
123 | + $filter_name = $this->filter_name; |
|
124 | + } |
|
117 | 125 | $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC"; |
118 | 126 | try { |
119 | 127 | $sth = $this->db->prepare($query); |
@@ -125,7 +133,9 @@ discard block |
||
125 | 133 | return $all; |
126 | 134 | } |
127 | 135 | public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
128 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
136 | + if ($filter_name == '') { |
|
137 | + $filter_name = $this->filter_name; |
|
138 | + } |
|
129 | 139 | $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
130 | 140 | try { |
131 | 141 | $sth = $this->db->prepare($query); |
@@ -138,7 +148,9 @@ discard block |
||
138 | 148 | } |
139 | 149 | |
140 | 150 | public function getAllOwnerNames($stats_airline = '',$filter_name = '') { |
141 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
151 | + if ($filter_name == '') { |
|
152 | + $filter_name = $this->filter_name; |
|
153 | + } |
|
142 | 154 | $query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC"; |
143 | 155 | try { |
144 | 156 | $sth = $this->db->prepare($query); |
@@ -151,7 +163,9 @@ discard block |
||
151 | 163 | } |
152 | 164 | |
153 | 165 | public function getAllPilotNames($stats_airline = '',$filter_name = '') { |
154 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
166 | + if ($filter_name == '') { |
|
167 | + $filter_name = $this->filter_name; |
|
168 | + } |
|
155 | 169 | $query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC"; |
156 | 170 | try { |
157 | 171 | $sth = $this->db->prepare($query); |
@@ -166,7 +180,9 @@ discard block |
||
166 | 180 | |
167 | 181 | public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
168 | 182 | global $globalStatsFilters; |
169 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
183 | + if ($filter_name == '') { |
|
184 | + $filter_name = $this->filter_name; |
|
185 | + } |
|
170 | 186 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
171 | 187 | $Spotter = new Spotter($this->db); |
172 | 188 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -175,8 +191,11 @@ discard block |
||
175 | 191 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
176 | 192 | } |
177 | 193 | if ($year == '' && $month == '') { |
178 | - if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
179 | - else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
194 | + if ($limit) { |
|
195 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
196 | + } else { |
|
197 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
198 | + } |
|
180 | 199 | try { |
181 | 200 | $sth = $this->db->prepare($query); |
182 | 201 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -184,11 +203,16 @@ discard block |
||
184 | 203 | echo "error : ".$e->getMessage(); |
185 | 204 | } |
186 | 205 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
187 | - } else $all = array(); |
|
206 | + } else { |
|
207 | + $all = array(); |
|
208 | + } |
|
188 | 209 | } else { |
189 | 210 | if ($year == '' && $month == '') { |
190 | - if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
191 | - else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
211 | + if ($limit) { |
|
212 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
213 | + } else { |
|
214 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
215 | + } |
|
192 | 216 | try { |
193 | 217 | $sth = $this->db->prepare($query); |
194 | 218 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -196,7 +220,9 @@ discard block |
||
196 | 220 | echo "error : ".$e->getMessage(); |
197 | 221 | } |
198 | 222 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
199 | - } else $all = array(); |
|
223 | + } else { |
|
224 | + $all = array(); |
|
225 | + } |
|
200 | 226 | } |
201 | 227 | if (empty($all)) { |
202 | 228 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -215,10 +241,15 @@ discard block |
||
215 | 241 | } |
216 | 242 | public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
217 | 243 | global $globalStatsFilters; |
218 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
244 | + if ($filter_name == '') { |
|
245 | + $filter_name = $this->filter_name; |
|
246 | + } |
|
219 | 247 | if ($year == '' && $month == '') { |
220 | - if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
221 | - else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC"; |
|
248 | + if ($limit) { |
|
249 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
250 | + } else { |
|
251 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC"; |
|
252 | + } |
|
222 | 253 | try { |
223 | 254 | $sth = $this->db->prepare($query); |
224 | 255 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -226,7 +257,9 @@ discard block |
||
226 | 257 | echo "error : ".$e->getMessage(); |
227 | 258 | } |
228 | 259 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
229 | - } else $all = array(); |
|
260 | + } else { |
|
261 | + $all = array(); |
|
262 | + } |
|
230 | 263 | if (empty($all)) { |
231 | 264 | $Spotter = new Spotter($this->db); |
232 | 265 | $filters = array(); |
@@ -241,7 +274,9 @@ discard block |
||
241 | 274 | } |
242 | 275 | public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
243 | 276 | global $globalStatsFilters; |
244 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
277 | + if ($filter_name == '') { |
|
278 | + $filter_name = $this->filter_name; |
|
279 | + } |
|
245 | 280 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
246 | 281 | $Spotter = new Spotter($this->db); |
247 | 282 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -250,8 +285,11 @@ discard block |
||
250 | 285 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
251 | 286 | } |
252 | 287 | if ($year == '' && $month == '') { |
253 | - if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
254 | - else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
288 | + if ($limit) { |
|
289 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
290 | + } else { |
|
291 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
292 | + } |
|
255 | 293 | try { |
256 | 294 | $sth = $this->db->prepare($query); |
257 | 295 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -259,11 +297,16 @@ discard block |
||
259 | 297 | echo "error : ".$e->getMessage(); |
260 | 298 | } |
261 | 299 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
262 | - } else $all = array(); |
|
300 | + } else { |
|
301 | + $all = array(); |
|
302 | + } |
|
263 | 303 | } else { |
264 | 304 | if ($year == '' && $month == '') { |
265 | - 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"; |
|
266 | - else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
305 | + if ($limit) { |
|
306 | + $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"; |
|
307 | + } else { |
|
308 | + $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"; |
|
309 | + } |
|
267 | 310 | try { |
268 | 311 | $sth = $this->db->prepare($query); |
269 | 312 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -271,7 +314,9 @@ discard block |
||
271 | 314 | echo "error : ".$e->getMessage(); |
272 | 315 | } |
273 | 316 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
274 | - } else $all = array(); |
|
317 | + } else { |
|
318 | + $all = array(); |
|
319 | + } |
|
275 | 320 | } |
276 | 321 | if (empty($all)) { |
277 | 322 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -291,7 +336,9 @@ discard block |
||
291 | 336 | |
292 | 337 | public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
293 | 338 | global $globalStatsFilters; |
294 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
339 | + if ($filter_name == '') { |
|
340 | + $filter_name = $this->filter_name; |
|
341 | + } |
|
295 | 342 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
296 | 343 | $Spotter = new Spotter($this->db); |
297 | 344 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -300,8 +347,11 @@ discard block |
||
300 | 347 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
301 | 348 | } |
302 | 349 | if ($year == '' && $month == '') { |
303 | - if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
304 | - else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
350 | + if ($limit) { |
|
351 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
352 | + } else { |
|
353 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
354 | + } |
|
305 | 355 | try { |
306 | 356 | $sth = $this->db->prepare($query); |
307 | 357 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -309,11 +359,16 @@ discard block |
||
309 | 359 | echo "error : ".$e->getMessage(); |
310 | 360 | } |
311 | 361 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
312 | - } else $all = array(); |
|
362 | + } else { |
|
363 | + $all = array(); |
|
364 | + } |
|
313 | 365 | } else { |
314 | 366 | if ($year == '' && $month == '') { |
315 | - if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
316 | - else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
367 | + if ($limit) { |
|
368 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
369 | + } else { |
|
370 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
371 | + } |
|
317 | 372 | try { |
318 | 373 | $sth = $this->db->prepare($query); |
319 | 374 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -321,7 +376,9 @@ discard block |
||
321 | 376 | echo "error : ".$e->getMessage(); |
322 | 377 | } |
323 | 378 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
324 | - } else $all = array(); |
|
379 | + } else { |
|
380 | + $all = array(); |
|
381 | + } |
|
325 | 382 | } |
326 | 383 | if (empty($all)) { |
327 | 384 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -340,7 +397,9 @@ discard block |
||
340 | 397 | } |
341 | 398 | public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
342 | 399 | global $globalStatsFilters; |
343 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
400 | + if ($filter_name == '') { |
|
401 | + $filter_name = $this->filter_name; |
|
402 | + } |
|
344 | 403 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
345 | 404 | $Spotter = new Spotter($this->db); |
346 | 405 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -348,12 +407,18 @@ discard block |
||
348 | 407 | foreach ($airlines as $airline) { |
349 | 408 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
350 | 409 | } |
351 | - if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
352 | - else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
410 | + if ($limit) { |
|
411 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
412 | + } else { |
|
413 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
414 | + } |
|
353 | 415 | $query_values = array(':filter_name' => $filter_name); |
354 | 416 | } else { |
355 | - if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
356 | - else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
417 | + if ($limit) { |
|
418 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
419 | + } else { |
|
420 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
421 | + } |
|
357 | 422 | $query_values = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
358 | 423 | } |
359 | 424 | try { |
@@ -381,17 +446,29 @@ discard block |
||
381 | 446 | |
382 | 447 | public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
383 | 448 | global $globalStatsFilters, $globalVATSIM, $globalIVAO; |
384 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
449 | + if ($filter_name == '') { |
|
450 | + $filter_name = $this->filter_name; |
|
451 | + } |
|
385 | 452 | if ($year == '' && $month == '') { |
386 | - if ($globalVATSIM) $forsource = 'vatsim'; |
|
387 | - if ($globalIVAO) $forsource = 'ivao'; |
|
453 | + if ($globalVATSIM) { |
|
454 | + $forsource = 'vatsim'; |
|
455 | + } |
|
456 | + if ($globalIVAO) { |
|
457 | + $forsource = 'ivao'; |
|
458 | + } |
|
388 | 459 | if (isset($forsource)) { |
389 | - if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
390 | - else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC"; |
|
460 | + if ($limit) { |
|
461 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
462 | + } else { |
|
463 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC"; |
|
464 | + } |
|
391 | 465 | $query_values = array(':filter_name' => $filter_name,':forsource' => $forsource); |
392 | 466 | } else { |
393 | - if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
394 | - else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC"; |
|
467 | + if ($limit) { |
|
468 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
469 | + } else { |
|
470 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC"; |
|
471 | + } |
|
395 | 472 | $query_values = array(':filter_name' => $filter_name); |
396 | 473 | } |
397 | 474 | try { |
@@ -401,7 +478,9 @@ discard block |
||
401 | 478 | echo "error : ".$e->getMessage(); |
402 | 479 | } |
403 | 480 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
404 | - } else $all = array(); |
|
481 | + } else { |
|
482 | + $all = array(); |
|
483 | + } |
|
405 | 484 | if (empty($all)) { |
406 | 485 | $Spotter = new Spotter($this->db); |
407 | 486 | $filters = array(); |
@@ -416,7 +495,9 @@ discard block |
||
416 | 495 | } |
417 | 496 | public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
418 | 497 | global $globalStatsFilters; |
419 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
498 | + if ($filter_name == '') { |
|
499 | + $filter_name = $this->filter_name; |
|
500 | + } |
|
420 | 501 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
421 | 502 | $Spotter = new Spotter($this->db); |
422 | 503 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -425,8 +506,11 @@ discard block |
||
425 | 506 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
426 | 507 | } |
427 | 508 | if ($year == '' && $month == '') { |
428 | - if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
429 | - else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
509 | + if ($limit) { |
|
510 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
511 | + } else { |
|
512 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
513 | + } |
|
430 | 514 | try { |
431 | 515 | $sth = $this->db->prepare($query); |
432 | 516 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -434,11 +518,16 @@ discard block |
||
434 | 518 | echo "error : ".$e->getMessage(); |
435 | 519 | } |
436 | 520 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
437 | - } else $all = array(); |
|
521 | + } else { |
|
522 | + $all = array(); |
|
523 | + } |
|
438 | 524 | } else { |
439 | 525 | if ($year == '' && $month == '') { |
440 | - 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"; |
|
441 | - else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
526 | + if ($limit) { |
|
527 | + $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"; |
|
528 | + } else { |
|
529 | + $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"; |
|
530 | + } |
|
442 | 531 | try { |
443 | 532 | $sth = $this->db->prepare($query); |
444 | 533 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -446,7 +535,9 @@ discard block |
||
446 | 535 | echo "error : ".$e->getMessage(); |
447 | 536 | } |
448 | 537 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
449 | - } else $all = array(); |
|
538 | + } else { |
|
539 | + $all = array(); |
|
540 | + } |
|
450 | 541 | } |
451 | 542 | if (empty($all)) { |
452 | 543 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -465,7 +556,9 @@ discard block |
||
465 | 556 | } |
466 | 557 | public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
467 | 558 | global $globalStatsFilters; |
468 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
559 | + if ($filter_name == '') { |
|
560 | + $filter_name = $this->filter_name; |
|
561 | + } |
|
469 | 562 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
470 | 563 | $Spotter = new Spotter($this->db); |
471 | 564 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -474,8 +567,11 @@ discard block |
||
474 | 567 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
475 | 568 | } |
476 | 569 | if ($year == '' && $month == '') { |
477 | - if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
478 | - else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
570 | + if ($limit) { |
|
571 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
572 | + } else { |
|
573 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
574 | + } |
|
479 | 575 | try { |
480 | 576 | $sth = $this->db->prepare($query); |
481 | 577 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -483,11 +579,16 @@ discard block |
||
483 | 579 | echo "error : ".$e->getMessage(); |
484 | 580 | } |
485 | 581 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
486 | - } else $all = array(); |
|
582 | + } else { |
|
583 | + $all = array(); |
|
584 | + } |
|
487 | 585 | } else { |
488 | 586 | if ($year == '' && $month == '') { |
489 | - if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
490 | - else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
587 | + if ($limit) { |
|
588 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
589 | + } else { |
|
590 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
591 | + } |
|
491 | 592 | try { |
492 | 593 | $sth = $this->db->prepare($query); |
493 | 594 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -495,7 +596,9 @@ discard block |
||
495 | 596 | echo "error : ".$e->getMessage(); |
496 | 597 | } |
497 | 598 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
498 | - } else $all = array(); |
|
599 | + } else { |
|
600 | + $all = array(); |
|
601 | + } |
|
499 | 602 | } |
500 | 603 | if (empty($all)) { |
501 | 604 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -514,7 +617,9 @@ discard block |
||
514 | 617 | } |
515 | 618 | public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') { |
516 | 619 | $Connection = new Connection(); |
517 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
620 | + if ($filter_name == '') { |
|
621 | + $filter_name = $this->filter_name; |
|
622 | + } |
|
518 | 623 | if ($Connection->tableExists('countries')) { |
519 | 624 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
520 | 625 | $Spotter = new Spotter($this->db); |
@@ -524,8 +629,11 @@ discard block |
||
524 | 629 | foreach ($airlines as $airline) { |
525 | 630 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
526 | 631 | } |
527 | - if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
528 | - else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
632 | + if ($limit) { |
|
633 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
634 | + } else { |
|
635 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
636 | + } |
|
529 | 637 | try { |
530 | 638 | $sth = $this->db->prepare($query); |
531 | 639 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -534,11 +642,16 @@ discard block |
||
534 | 642 | } |
535 | 643 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
536 | 644 | return $all; |
537 | - } else return array(); |
|
645 | + } else { |
|
646 | + return array(); |
|
647 | + } |
|
538 | 648 | } else { |
539 | 649 | if ($year == '' && $month == '') { |
540 | - if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
541 | - else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
650 | + if ($limit) { |
|
651 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
652 | + } else { |
|
653 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
654 | + } |
|
542 | 655 | try { |
543 | 656 | $sth = $this->db->prepare($query); |
544 | 657 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -547,7 +660,9 @@ discard block |
||
547 | 660 | } |
548 | 661 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
549 | 662 | return $all; |
550 | - } else return array(); |
|
663 | + } else { |
|
664 | + return array(); |
|
665 | + } |
|
551 | 666 | } |
552 | 667 | } else { |
553 | 668 | /* |
@@ -561,10 +676,15 @@ discard block |
||
561 | 676 | } |
562 | 677 | public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') { |
563 | 678 | global $globalStatsFilters; |
564 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
679 | + if ($filter_name == '') { |
|
680 | + $filter_name = $this->filter_name; |
|
681 | + } |
|
565 | 682 | if ($year == '' && $month == '') { |
566 | - 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"; |
|
567 | - else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
|
683 | + if ($limit) { |
|
684 | + $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"; |
|
685 | + } else { |
|
686 | + $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"; |
|
687 | + } |
|
568 | 688 | try { |
569 | 689 | $sth = $this->db->prepare($query); |
570 | 690 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -572,7 +692,9 @@ discard block |
||
572 | 692 | echo "error : ".$e->getMessage(); |
573 | 693 | } |
574 | 694 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
575 | - } else $all = array(); |
|
695 | + } else { |
|
696 | + $all = array(); |
|
697 | + } |
|
576 | 698 | if (empty($all)) { |
577 | 699 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
578 | 700 | if ($filter_name != '') { |
@@ -587,7 +709,9 @@ discard block |
||
587 | 709 | |
588 | 710 | public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') { |
589 | 711 | global $globalStatsFilters; |
590 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
712 | + if ($filter_name == '') { |
|
713 | + $filter_name = $this->filter_name; |
|
714 | + } |
|
591 | 715 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
592 | 716 | $Spotter = new Spotter($this->db); |
593 | 717 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -596,8 +720,11 @@ discard block |
||
596 | 720 | foreach ($airlines as $airline) { |
597 | 721 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
598 | 722 | } |
599 | - if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
600 | - else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
723 | + if ($limit) { |
|
724 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
725 | + } else { |
|
726 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
727 | + } |
|
601 | 728 | try { |
602 | 729 | $sth = $this->db->prepare($query); |
603 | 730 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -605,11 +732,16 @@ discard block |
||
605 | 732 | echo "error : ".$e->getMessage(); |
606 | 733 | } |
607 | 734 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
608 | - } else $all = array(); |
|
735 | + } else { |
|
736 | + $all = array(); |
|
737 | + } |
|
609 | 738 | } else { |
610 | 739 | if ($year == '' && $month == '') { |
611 | - 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"; |
|
612 | - else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
740 | + if ($limit) { |
|
741 | + $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"; |
|
742 | + } else { |
|
743 | + $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"; |
|
744 | + } |
|
613 | 745 | try { |
614 | 746 | $sth = $this->db->prepare($query); |
615 | 747 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -617,7 +749,9 @@ discard block |
||
617 | 749 | echo "error : ".$e->getMessage(); |
618 | 750 | } |
619 | 751 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
620 | - } else $all = array(); |
|
752 | + } else { |
|
753 | + $all = array(); |
|
754 | + } |
|
621 | 755 | } |
622 | 756 | if (empty($all)) { |
623 | 757 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -636,7 +770,9 @@ discard block |
||
636 | 770 | } |
637 | 771 | public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
638 | 772 | global $globalStatsFilters; |
639 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
773 | + if ($filter_name == '') { |
|
774 | + $filter_name = $this->filter_name; |
|
775 | + } |
|
640 | 776 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
641 | 777 | $Spotter = new Spotter($this->db); |
642 | 778 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -645,8 +781,11 @@ discard block |
||
645 | 781 | foreach ($airlines as $airline) { |
646 | 782 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
647 | 783 | } |
648 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
649 | - else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
784 | + if ($limit) { |
|
785 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
786 | + } else { |
|
787 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
788 | + } |
|
650 | 789 | try { |
651 | 790 | $sth = $this->db->prepare($query); |
652 | 791 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -654,11 +793,16 @@ discard block |
||
654 | 793 | echo "error : ".$e->getMessage(); |
655 | 794 | } |
656 | 795 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
657 | - } else $all = array(); |
|
796 | + } else { |
|
797 | + $all = array(); |
|
798 | + } |
|
658 | 799 | } else { |
659 | 800 | if ($year == '' && $month == '') { |
660 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
661 | - else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
801 | + if ($limit) { |
|
802 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
803 | + } else { |
|
804 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
805 | + } |
|
662 | 806 | try { |
663 | 807 | $sth = $this->db->prepare($query); |
664 | 808 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -666,7 +810,9 @@ discard block |
||
666 | 810 | echo "error : ".$e->getMessage(); |
667 | 811 | } |
668 | 812 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
669 | - } else $all = array(); |
|
813 | + } else { |
|
814 | + $all = array(); |
|
815 | + } |
|
670 | 816 | } |
671 | 817 | if (empty($all)) { |
672 | 818 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -691,7 +837,9 @@ discard block |
||
691 | 837 | $icao = $value['airport_departure_icao']; |
692 | 838 | if (isset($all[$icao])) { |
693 | 839 | $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
694 | - } else $all[$icao] = $value; |
|
840 | + } else { |
|
841 | + $all[$icao] = $value; |
|
842 | + } |
|
695 | 843 | } |
696 | 844 | $count = array(); |
697 | 845 | foreach ($all as $key => $row) { |
@@ -703,7 +851,9 @@ discard block |
||
703 | 851 | } |
704 | 852 | public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
705 | 853 | global $globalStatsFilters; |
706 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
854 | + if ($filter_name == '') { |
|
855 | + $filter_name = $this->filter_name; |
|
856 | + } |
|
707 | 857 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
708 | 858 | $Spotter = new Spotter($this->db); |
709 | 859 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -712,8 +862,11 @@ discard block |
||
712 | 862 | foreach ($airlines as $airline) { |
713 | 863 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
714 | 864 | } |
715 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
716 | - else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
865 | + if ($limit) { |
|
866 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
867 | + } else { |
|
868 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
869 | + } |
|
717 | 870 | try { |
718 | 871 | $sth = $this->db->prepare($query); |
719 | 872 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -721,11 +874,16 @@ discard block |
||
721 | 874 | echo "error : ".$e->getMessage(); |
722 | 875 | } |
723 | 876 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
724 | - } else $all = array(); |
|
877 | + } else { |
|
878 | + $all = array(); |
|
879 | + } |
|
725 | 880 | } else { |
726 | 881 | if ($year == '' && $month == '') { |
727 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
728 | - else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
882 | + if ($limit) { |
|
883 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
884 | + } else { |
|
885 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
886 | + } |
|
729 | 887 | try { |
730 | 888 | $sth = $this->db->prepare($query); |
731 | 889 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -733,7 +891,9 @@ discard block |
||
733 | 891 | echo "error : ".$e->getMessage(); |
734 | 892 | } |
735 | 893 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
736 | - } else $all = array(); |
|
894 | + } else { |
|
895 | + $all = array(); |
|
896 | + } |
|
737 | 897 | } |
738 | 898 | if (empty($all)) { |
739 | 899 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -758,7 +918,9 @@ discard block |
||
758 | 918 | $icao = $value['airport_arrival_icao']; |
759 | 919 | if (isset($all[$icao])) { |
760 | 920 | $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
761 | - } else $all[$icao] = $value; |
|
921 | + } else { |
|
922 | + $all[$icao] = $value; |
|
923 | + } |
|
762 | 924 | } |
763 | 925 | $count = array(); |
764 | 926 | foreach ($all as $key => $row) { |
@@ -770,7 +932,9 @@ discard block |
||
770 | 932 | } |
771 | 933 | public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
772 | 934 | global $globalDBdriver, $globalStatsFilters; |
773 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
935 | + if ($filter_name == '') { |
|
936 | + $filter_name = $this->filter_name; |
|
937 | + } |
|
774 | 938 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
775 | 939 | $Spotter = new Spotter($this->db); |
776 | 940 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -779,20 +943,32 @@ discard block |
||
779 | 943 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
780 | 944 | } |
781 | 945 | if ($globalDBdriver == 'mysql') { |
782 | - if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
783 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
946 | + if ($limit) { |
|
947 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
948 | + } else { |
|
949 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
950 | + } |
|
784 | 951 | } else { |
785 | - if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
786 | - else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
952 | + if ($limit) { |
|
953 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
954 | + } else { |
|
955 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
956 | + } |
|
787 | 957 | } |
788 | 958 | $query_data = array(':filter_name' => $filter_name); |
789 | 959 | } else { |
790 | 960 | if ($globalDBdriver == 'mysql') { |
791 | - if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
792 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
961 | + if ($limit) { |
|
962 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
963 | + } else { |
|
964 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
965 | + } |
|
793 | 966 | } else { |
794 | - if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
795 | - 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"; |
|
967 | + if ($limit) { |
|
968 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
969 | + } else { |
|
970 | + $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"; |
|
971 | + } |
|
796 | 972 | } |
797 | 973 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
798 | 974 | } |
@@ -820,7 +996,9 @@ discard block |
||
820 | 996 | |
821 | 997 | public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
822 | 998 | global $globalStatsFilters; |
823 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
999 | + if ($filter_name == '') { |
|
1000 | + $filter_name = $this->filter_name; |
|
1001 | + } |
|
824 | 1002 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
825 | 1003 | $Spotter = new Spotter($this->db); |
826 | 1004 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -857,7 +1035,9 @@ discard block |
||
857 | 1035 | } |
858 | 1036 | public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
859 | 1037 | global $globalDBdriver, $globalStatsFilters; |
860 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1038 | + if ($filter_name == '') { |
|
1039 | + $filter_name = $this->filter_name; |
|
1040 | + } |
|
861 | 1041 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
862 | 1042 | $Spotter = new Spotter($this->db); |
863 | 1043 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -902,7 +1082,9 @@ discard block |
||
902 | 1082 | } |
903 | 1083 | public function countAllDates($stats_airline = '',$filter_name = '') { |
904 | 1084 | global $globalStatsFilters; |
905 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1085 | + if ($filter_name == '') { |
|
1086 | + $filter_name = $this->filter_name; |
|
1087 | + } |
|
906 | 1088 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
907 | 1089 | $Spotter = new Spotter($this->db); |
908 | 1090 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -939,7 +1121,9 @@ discard block |
||
939 | 1121 | } |
940 | 1122 | public function countAllDatesByAirlines($filter_name = '') { |
941 | 1123 | global $globalStatsFilters; |
942 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1124 | + if ($filter_name == '') { |
|
1125 | + $filter_name = $this->filter_name; |
|
1126 | + } |
|
943 | 1127 | $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"; |
944 | 1128 | $query_data = array('filter_name' => $filter_name); |
945 | 1129 | try { |
@@ -961,7 +1145,9 @@ discard block |
||
961 | 1145 | } |
962 | 1146 | public function countAllMonths($stats_airline = '',$filter_name = '') { |
963 | 1147 | global $globalStatsFilters, $globalDBdriver; |
964 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1148 | + if ($filter_name == '') { |
|
1149 | + $filter_name = $this->filter_name; |
|
1150 | + } |
|
965 | 1151 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
966 | 1152 | $Spotter = new Spotter($this->db); |
967 | 1153 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1048,7 +1234,9 @@ discard block |
||
1048 | 1234 | } |
1049 | 1235 | public function countAllMilitaryMonths($filter_name = '') { |
1050 | 1236 | global $globalStatsFilters; |
1051 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1237 | + if ($filter_name == '') { |
|
1238 | + $filter_name = $this->filter_name; |
|
1239 | + } |
|
1052 | 1240 | $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"; |
1053 | 1241 | try { |
1054 | 1242 | $sth = $this->db->prepare($query); |
@@ -1069,7 +1257,9 @@ discard block |
||
1069 | 1257 | } |
1070 | 1258 | public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
1071 | 1259 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
1072 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1260 | + if ($filter_name == '') { |
|
1261 | + $filter_name = $this->filter_name; |
|
1262 | + } |
|
1073 | 1263 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
1074 | 1264 | $Spotter = new Spotter($this->db); |
1075 | 1265 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1077,12 +1267,18 @@ discard block |
||
1077 | 1267 | foreach ($airlines as $airline) { |
1078 | 1268 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
1079 | 1269 | } |
1080 | - if ($limit) $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1081 | - else $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1270 | + if ($limit) { |
|
1271 | + $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1272 | + } else { |
|
1273 | + $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
1274 | + } |
|
1082 | 1275 | $query_data = array(':filter_name' => $filter_name); |
1083 | 1276 | } else { |
1084 | - if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
1085 | - else $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
1277 | + if ($limit) { |
|
1278 | + $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
1279 | + } else { |
|
1280 | + $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
1281 | + } |
|
1086 | 1282 | $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
1087 | 1283 | } |
1088 | 1284 | if ($orderby == 'hour') { |
@@ -1092,7 +1288,9 @@ discard block |
||
1092 | 1288 | $query .= " ORDER BY CAST(flight_date AS integer) ASC"; |
1093 | 1289 | } |
1094 | 1290 | } |
1095 | - if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
|
1291 | + if ($orderby == 'count') { |
|
1292 | + $query .= " ORDER BY hour_count DESC"; |
|
1293 | + } |
|
1096 | 1294 | try { |
1097 | 1295 | $sth = $this->db->prepare($query); |
1098 | 1296 | $sth->execute($query_data); |
@@ -1116,8 +1314,12 @@ discard block |
||
1116 | 1314 | } |
1117 | 1315 | public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
1118 | 1316 | global $globalStatsFilters; |
1119 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1120 | - if ($year == '') $year = date('Y'); |
|
1317 | + if ($filter_name == '') { |
|
1318 | + $filter_name = $this->filter_name; |
|
1319 | + } |
|
1320 | + if ($year == '') { |
|
1321 | + $year = date('Y'); |
|
1322 | + } |
|
1121 | 1323 | $all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month); |
1122 | 1324 | if (empty($all)) { |
1123 | 1325 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -1136,8 +1338,12 @@ discard block |
||
1136 | 1338 | } |
1137 | 1339 | public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') { |
1138 | 1340 | global $globalStatsFilters; |
1139 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1140 | - if ($year == '') $year = date('Y'); |
|
1341 | + if ($filter_name == '') { |
|
1342 | + $filter_name = $this->filter_name; |
|
1343 | + } |
|
1344 | + if ($year == '') { |
|
1345 | + $year = date('Y'); |
|
1346 | + } |
|
1141 | 1347 | $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
1142 | 1348 | if (empty($all)) { |
1143 | 1349 | $filters = array(); |
@@ -1153,8 +1359,12 @@ discard block |
||
1153 | 1359 | } |
1154 | 1360 | public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') { |
1155 | 1361 | global $globalStatsFilters; |
1156 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1157 | - if ($year == '') $year = date('Y'); |
|
1362 | + if ($filter_name == '') { |
|
1363 | + $filter_name = $this->filter_name; |
|
1364 | + } |
|
1365 | + if ($year == '') { |
|
1366 | + $year = date('Y'); |
|
1367 | + } |
|
1158 | 1368 | $all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month); |
1159 | 1369 | if (empty($all)) { |
1160 | 1370 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -1173,7 +1383,9 @@ discard block |
||
1173 | 1383 | } |
1174 | 1384 | public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
1175 | 1385 | global $globalStatsFilters; |
1176 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1386 | + if ($filter_name == '') { |
|
1387 | + $filter_name = $this->filter_name; |
|
1388 | + } |
|
1177 | 1389 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
1178 | 1390 | $Spotter = new Spotter($this->db); |
1179 | 1391 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1191,7 +1403,9 @@ discard block |
||
1191 | 1403 | } |
1192 | 1404 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1193 | 1405 | $all = $result[0]['nb']; |
1194 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1406 | + } else { |
|
1407 | + $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1408 | + } |
|
1195 | 1409 | } else { |
1196 | 1410 | if ($year == '' && $month == '') { |
1197 | 1411 | $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -1203,7 +1417,9 @@ discard block |
||
1203 | 1417 | } |
1204 | 1418 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1205 | 1419 | $all = $result[0]['nb']; |
1206 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1420 | + } else { |
|
1421 | + $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
1422 | + } |
|
1207 | 1423 | } |
1208 | 1424 | if (empty($all)) { |
1209 | 1425 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -1222,7 +1438,9 @@ discard block |
||
1222 | 1438 | } |
1223 | 1439 | public function countOverallAirlines($filter_name = '',$year = '',$month = '') { |
1224 | 1440 | global $globalStatsFilters; |
1225 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1441 | + if ($filter_name == '') { |
|
1442 | + $filter_name = $this->filter_name; |
|
1443 | + } |
|
1226 | 1444 | if ($year == '' && $month == '') { |
1227 | 1445 | $query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name"; |
1228 | 1446 | try { |
@@ -1233,7 +1451,9 @@ discard block |
||
1233 | 1451 | } |
1234 | 1452 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
1235 | 1453 | $all = $result[0]['nb_airline']; |
1236 | - } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
1454 | + } else { |
|
1455 | + $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
1456 | + } |
|
1237 | 1457 | if (empty($all)) { |
1238 | 1458 | $filters = array(); |
1239 | 1459 | $filters = array('year' => $year,'month' => $month); |
@@ -1248,7 +1468,9 @@ discard block |
||
1248 | 1468 | } |
1249 | 1469 | public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
1250 | 1470 | global $globalStatsFilters; |
1251 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1471 | + if ($filter_name == '') { |
|
1472 | + $filter_name = $this->filter_name; |
|
1473 | + } |
|
1252 | 1474 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
1253 | 1475 | $Spotter = new Spotter($this->db); |
1254 | 1476 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1303,7 +1525,9 @@ discard block |
||
1303 | 1525 | } |
1304 | 1526 | public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') { |
1305 | 1527 | global $globalStatsFilters; |
1306 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1528 | + if ($filter_name == '') { |
|
1529 | + $filter_name = $this->filter_name; |
|
1530 | + } |
|
1307 | 1531 | //if ($year == '') $year = date('Y'); |
1308 | 1532 | if ($year == '' && $month == '') { |
1309 | 1533 | $query = "SELECT count(*) as nb FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -1332,7 +1556,9 @@ discard block |
||
1332 | 1556 | } |
1333 | 1557 | |
1334 | 1558 | public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
1335 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1559 | + if ($filter_name == '') { |
|
1560 | + $filter_name = $this->filter_name; |
|
1561 | + } |
|
1336 | 1562 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
1337 | 1563 | $Spotter = new Spotter($this->db); |
1338 | 1564 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1356,7 +1582,9 @@ discard block |
||
1356 | 1582 | return $all; |
1357 | 1583 | } |
1358 | 1584 | public function getStats($type,$stats_airline = '', $filter_name = '') { |
1359 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1585 | + if ($filter_name == '') { |
|
1586 | + $filter_name = $this->filter_name; |
|
1587 | + } |
|
1360 | 1588 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
1361 | 1589 | $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
1362 | 1590 | try { |
@@ -1369,7 +1597,9 @@ discard block |
||
1369 | 1597 | return $all; |
1370 | 1598 | } |
1371 | 1599 | public function deleteStatsByType($type,$stats_airline = '', $filter_name = '') { |
1372 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1600 | + if ($filter_name == '') { |
|
1601 | + $filter_name = $this->filter_name; |
|
1602 | + } |
|
1373 | 1603 | $query = "DELETE FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
1374 | 1604 | $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
1375 | 1605 | try { |
@@ -1380,7 +1610,9 @@ discard block |
||
1380 | 1610 | } |
1381 | 1611 | } |
1382 | 1612 | public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
1383 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1613 | + if ($filter_name == '') { |
|
1614 | + $filter_name = $this->filter_name; |
|
1615 | + } |
|
1384 | 1616 | global $globalArchiveMonths, $globalDBdriver; |
1385 | 1617 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
1386 | 1618 | $Spotter = new Spotter($this->db); |
@@ -1436,7 +1668,9 @@ discard block |
||
1436 | 1668 | } |
1437 | 1669 | public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
1438 | 1670 | global $globalArchiveMonths, $globalDBdriver; |
1439 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1671 | + if ($filter_name == '') { |
|
1672 | + $filter_name = $this->filter_name; |
|
1673 | + } |
|
1440 | 1674 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
1441 | 1675 | $Spotter = new Spotter($this->db); |
1442 | 1676 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1469,7 +1703,9 @@ discard block |
||
1469 | 1703 | } |
1470 | 1704 | public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
1471 | 1705 | global $globalArchiveMonths, $globalDBdriver; |
1472 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1706 | + if ($filter_name == '') { |
|
1707 | + $filter_name = $this->filter_name; |
|
1708 | + } |
|
1473 | 1709 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
1474 | 1710 | $Spotter = new Spotter($this->db); |
1475 | 1711 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1500,7 +1736,9 @@ discard block |
||
1500 | 1736 | } |
1501 | 1737 | public function getStatsAirlineTotal($filter_name = '') { |
1502 | 1738 | global $globalArchiveMonths, $globalDBdriver; |
1503 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1739 | + if ($filter_name == '') { |
|
1740 | + $filter_name = $this->filter_name; |
|
1741 | + } |
|
1504 | 1742 | if ($globalDBdriver == 'mysql') { |
1505 | 1743 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
1506 | 1744 | } else { |
@@ -1517,7 +1755,9 @@ discard block |
||
1517 | 1755 | } |
1518 | 1756 | public function getStatsOwnerTotal($filter_name = '') { |
1519 | 1757 | global $globalArchiveMonths, $globalDBdriver; |
1520 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1758 | + if ($filter_name == '') { |
|
1759 | + $filter_name = $this->filter_name; |
|
1760 | + } |
|
1521 | 1761 | if ($globalDBdriver == 'mysql') { |
1522 | 1762 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
1523 | 1763 | } else { |
@@ -1534,7 +1774,9 @@ discard block |
||
1534 | 1774 | } |
1535 | 1775 | public function getStatsOwner($owner_name,$filter_name = '') { |
1536 | 1776 | global $globalArchiveMonths, $globalDBdriver; |
1537 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1777 | + if ($filter_name == '') { |
|
1778 | + $filter_name = $this->filter_name; |
|
1779 | + } |
|
1538 | 1780 | $query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name"; |
1539 | 1781 | try { |
1540 | 1782 | $sth = $this->db->prepare($query); |
@@ -1543,12 +1785,17 @@ discard block |
||
1543 | 1785 | echo "error : ".$e->getMessage(); |
1544 | 1786 | } |
1545 | 1787 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1546 | - if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
1547 | - else return 0; |
|
1788 | + if (isset($all[0]['cnt'])) { |
|
1789 | + return $all[0]['cnt']; |
|
1790 | + } else { |
|
1791 | + return 0; |
|
1792 | + } |
|
1548 | 1793 | } |
1549 | 1794 | public function getStatsPilotTotal($filter_name = '') { |
1550 | 1795 | global $globalArchiveMonths, $globalDBdriver; |
1551 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1796 | + if ($filter_name == '') { |
|
1797 | + $filter_name = $this->filter_name; |
|
1798 | + } |
|
1552 | 1799 | if ($globalDBdriver == 'mysql') { |
1553 | 1800 | $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
1554 | 1801 | } else { |
@@ -1565,7 +1812,9 @@ discard block |
||
1565 | 1812 | } |
1566 | 1813 | public function getStatsPilot($pilot,$filter_name = '') { |
1567 | 1814 | global $globalArchiveMonths, $globalDBdriver; |
1568 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1815 | + if ($filter_name == '') { |
|
1816 | + $filter_name = $this->filter_name; |
|
1817 | + } |
|
1569 | 1818 | $query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)"; |
1570 | 1819 | try { |
1571 | 1820 | $sth = $this->db->prepare($query); |
@@ -1574,13 +1823,18 @@ discard block |
||
1574 | 1823 | echo "error : ".$e->getMessage(); |
1575 | 1824 | } |
1576 | 1825 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1577 | - if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
1578 | - else return 0; |
|
1826 | + if (isset($all[0]['cnt'])) { |
|
1827 | + return $all[0]['cnt']; |
|
1828 | + } else { |
|
1829 | + return 0; |
|
1830 | + } |
|
1579 | 1831 | } |
1580 | 1832 | |
1581 | 1833 | public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
1582 | 1834 | global $globalDBdriver; |
1583 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1835 | + if ($filter_name == '') { |
|
1836 | + $filter_name = $this->filter_name; |
|
1837 | + } |
|
1584 | 1838 | if ($globalDBdriver == 'mysql') { |
1585 | 1839 | $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"; |
1586 | 1840 | } else { |
@@ -1596,7 +1850,9 @@ discard block |
||
1596 | 1850 | } |
1597 | 1851 | public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
1598 | 1852 | global $globalDBdriver; |
1599 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1853 | + if ($filter_name == '') { |
|
1854 | + $filter_name = $this->filter_name; |
|
1855 | + } |
|
1600 | 1856 | if ($globalDBdriver == 'mysql') { |
1601 | 1857 | $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"; |
1602 | 1858 | } else { |
@@ -1982,10 +2238,14 @@ discard block |
||
1982 | 2238 | $Connection = new Connection(); |
1983 | 2239 | date_default_timezone_set('UTC'); |
1984 | 2240 | $last_update = $this->getLastStatsUpdate('last_update_stats'); |
1985 | - if ($globalDebug) echo 'Update stats !'."\n"; |
|
2241 | + if ($globalDebug) { |
|
2242 | + echo 'Update stats !'."\n"; |
|
2243 | + } |
|
1986 | 2244 | if (isset($last_update[0]['value'])) { |
1987 | 2245 | $last_update_day = $last_update[0]['value']; |
1988 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
2246 | + } else { |
|
2247 | + $last_update_day = '2012-12-12 12:12:12'; |
|
2248 | + } |
|
1989 | 2249 | $reset = false; |
1990 | 2250 | //if ($globalStatsResetYear && date('Y',strtotime($last_update_day)) != date('Y')) { |
1991 | 2251 | if ($globalStatsResetYear) { |
@@ -1994,43 +2254,63 @@ discard block |
||
1994 | 2254 | } |
1995 | 2255 | $Spotter = new Spotter($this->db); |
1996 | 2256 | |
1997 | - if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
|
2257 | + if ($globalDebug) { |
|
2258 | + echo 'Count all aircraft types...'."\n"; |
|
2259 | + } |
|
1998 | 2260 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
1999 | 2261 | foreach ($alldata as $number) { |
2000 | 2262 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset); |
2001 | 2263 | } |
2002 | - if ($globalDebug) echo 'Count all airlines...'."\n"; |
|
2264 | + if ($globalDebug) { |
|
2265 | + echo 'Count all airlines...'."\n"; |
|
2266 | + } |
|
2003 | 2267 | $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
2004 | 2268 | foreach ($alldata as $number) { |
2005 | 2269 | $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset); |
2006 | 2270 | } |
2007 | - if ($globalDebug) echo 'Count all registrations...'."\n"; |
|
2271 | + if ($globalDebug) { |
|
2272 | + echo 'Count all registrations...'."\n"; |
|
2273 | + } |
|
2008 | 2274 | $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
2009 | 2275 | foreach ($alldata as $number) { |
2010 | 2276 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset); |
2011 | 2277 | } |
2012 | - if ($globalDebug) echo 'Count all callsigns...'."\n"; |
|
2278 | + if ($globalDebug) { |
|
2279 | + echo 'Count all callsigns...'."\n"; |
|
2280 | + } |
|
2013 | 2281 | $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
2014 | 2282 | foreach ($alldata as $number) { |
2015 | 2283 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
2016 | 2284 | } |
2017 | - if ($globalDebug) echo 'Count all owners...'."\n"; |
|
2285 | + if ($globalDebug) { |
|
2286 | + echo 'Count all owners...'."\n"; |
|
2287 | + } |
|
2018 | 2288 | $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
2019 | 2289 | foreach ($alldata as $number) { |
2020 | 2290 | $this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset); |
2021 | 2291 | } |
2022 | - if ($globalDebug) echo 'Count all pilots...'."\n"; |
|
2292 | + if ($globalDebug) { |
|
2293 | + echo 'Count all pilots...'."\n"; |
|
2294 | + } |
|
2023 | 2295 | $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
2024 | 2296 | foreach ($alldata as $number) { |
2025 | - if ($number['pilot_id'] == 0 || $number['pilot_id'] == '') $number['pilot_id'] = $number['pilot_name']; |
|
2297 | + if ($number['pilot_id'] == 0 || $number['pilot_id'] == '') { |
|
2298 | + $number['pilot_id'] = $number['pilot_name']; |
|
2299 | + } |
|
2026 | 2300 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset); |
2027 | 2301 | } |
2028 | 2302 | |
2029 | - if ($globalDebug) echo 'Count all departure airports...'."\n"; |
|
2303 | + if ($globalDebug) { |
|
2304 | + echo 'Count all departure airports...'."\n"; |
|
2305 | + } |
|
2030 | 2306 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
2031 | - if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
|
2307 | + if ($globalDebug) { |
|
2308 | + echo 'Count all detected departure airports...'."\n"; |
|
2309 | + } |
|
2032 | 2310 | $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
2033 | - if ($globalDebug) echo 'Order departure airports...'."\n"; |
|
2311 | + if ($globalDebug) { |
|
2312 | + echo 'Order departure airports...'."\n"; |
|
2313 | + } |
|
2034 | 2314 | $alldata = array(); |
2035 | 2315 | |
2036 | 2316 | foreach ($pall as $value) { |
@@ -2041,7 +2321,9 @@ discard block |
||
2041 | 2321 | $icao = $value['airport_departure_icao']; |
2042 | 2322 | if (isset($alldata[$icao])) { |
2043 | 2323 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
2044 | - } else $alldata[$icao] = $value; |
|
2324 | + } else { |
|
2325 | + $alldata[$icao] = $value; |
|
2326 | + } |
|
2045 | 2327 | } |
2046 | 2328 | $count = array(); |
2047 | 2329 | foreach ($alldata as $key => $row) { |
@@ -2051,11 +2333,17 @@ discard block |
||
2051 | 2333 | foreach ($alldata as $number) { |
2052 | 2334 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'','',$reset); |
2053 | 2335 | } |
2054 | - if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
|
2336 | + if ($globalDebug) { |
|
2337 | + echo 'Count all arrival airports...'."\n"; |
|
2338 | + } |
|
2055 | 2339 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
2056 | - if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
|
2340 | + if ($globalDebug) { |
|
2341 | + echo 'Count all detected arrival airports...'."\n"; |
|
2342 | + } |
|
2057 | 2343 | $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
2058 | - if ($globalDebug) echo 'Order arrival airports...'."\n"; |
|
2344 | + if ($globalDebug) { |
|
2345 | + echo 'Order arrival airports...'."\n"; |
|
2346 | + } |
|
2059 | 2347 | $alldata = array(); |
2060 | 2348 | foreach ($pall as $value) { |
2061 | 2349 | $icao = $value['airport_arrival_icao']; |
@@ -2065,7 +2353,9 @@ discard block |
||
2065 | 2353 | $icao = $value['airport_arrival_icao']; |
2066 | 2354 | if (isset($alldata[$icao])) { |
2067 | 2355 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
2068 | - } else $alldata[$icao] = $value; |
|
2356 | + } else { |
|
2357 | + $alldata[$icao] = $value; |
|
2358 | + } |
|
2069 | 2359 | } |
2070 | 2360 | $count = array(); |
2071 | 2361 | foreach ($alldata as $key => $row) { |
@@ -2076,7 +2366,9 @@ discard block |
||
2076 | 2366 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset); |
2077 | 2367 | } |
2078 | 2368 | if ($Connection->tableExists('countries')) { |
2079 | - if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
|
2369 | + if ($globalDebug) { |
|
2370 | + echo 'Count all flights by countries...'."\n"; |
|
2371 | + } |
|
2080 | 2372 | //$SpotterArchive = new SpotterArchive(); |
2081 | 2373 | //$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
2082 | 2374 | $Spotter = new Spotter($this->db); |
@@ -2087,7 +2379,9 @@ discard block |
||
2087 | 2379 | } |
2088 | 2380 | |
2089 | 2381 | if (isset($globalAccidents) && $globalAccidents) { |
2090 | - if ($globalDebug) echo 'Count fatalities stats...'."\n"; |
|
2382 | + if ($globalDebug) { |
|
2383 | + echo 'Count fatalities stats...'."\n"; |
|
2384 | + } |
|
2091 | 2385 | $Accident = new Accident(); |
2092 | 2386 | $this->deleteStatsByType('fatalities_byyear'); |
2093 | 2387 | $alldata = $Accident->countFatalitiesByYear(); |
@@ -2105,48 +2399,68 @@ discard block |
||
2105 | 2399 | // Add by month using getstat if month finish... |
2106 | 2400 | |
2107 | 2401 | //if (date('m',strtotime($last_update_day)) != date('m')) { |
2108 | - if ($globalDebug) echo 'Count all flights by months...'."\n"; |
|
2402 | + if ($globalDebug) { |
|
2403 | + echo 'Count all flights by months...'."\n"; |
|
2404 | + } |
|
2109 | 2405 | $last_month = date('Y-m-01 00:00:00', strtotime('-1 month', strtotime($last_update_day))); |
2110 | 2406 | $filter_last_month = array('since_date' => $last_month); |
2111 | 2407 | $Spotter = new Spotter($this->db); |
2112 | 2408 | $alldata = $Spotter->countAllMonths($filter_last_month); |
2113 | 2409 | $lastyear = false; |
2114 | 2410 | foreach ($alldata as $number) { |
2115 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
2411 | + if ($number['year_name'] != date('Y')) { |
|
2412 | + $lastyear = true; |
|
2413 | + } |
|
2116 | 2414 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
2117 | 2415 | } |
2118 | - if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
|
2416 | + if ($globalDebug) { |
|
2417 | + echo 'Count all military flights by months...'."\n"; |
|
2418 | + } |
|
2119 | 2419 | $alldata = $Spotter->countAllMilitaryMonths($filter_last_month); |
2120 | 2420 | foreach ($alldata as $number) { |
2121 | 2421 | $this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
2122 | 2422 | } |
2123 | - if ($globalDebug) echo 'Count all owners by months...'."\n"; |
|
2423 | + if ($globalDebug) { |
|
2424 | + echo 'Count all owners by months...'."\n"; |
|
2425 | + } |
|
2124 | 2426 | $alldata = $Spotter->countAllMonthsOwners($filter_last_month); |
2125 | 2427 | foreach ($alldata as $number) { |
2126 | 2428 | $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
2127 | 2429 | } |
2128 | - if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
|
2430 | + if ($globalDebug) { |
|
2431 | + echo 'Count all pilots by months...'."\n"; |
|
2432 | + } |
|
2129 | 2433 | $alldata = $Spotter->countAllMonthsPilots($filter_last_month); |
2130 | 2434 | foreach ($alldata as $number) { |
2131 | 2435 | $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
2132 | 2436 | } |
2133 | - if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
|
2437 | + if ($globalDebug) { |
|
2438 | + echo 'Count all airlines by months...'."\n"; |
|
2439 | + } |
|
2134 | 2440 | $alldata = $Spotter->countAllMonthsAirlines($filter_last_month); |
2135 | 2441 | foreach ($alldata as $number) { |
2136 | 2442 | $this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
2137 | 2443 | } |
2138 | - if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
|
2444 | + if ($globalDebug) { |
|
2445 | + echo 'Count all aircrafts by months...'."\n"; |
|
2446 | + } |
|
2139 | 2447 | $alldata = $Spotter->countAllMonthsAircrafts($filter_last_month); |
2140 | 2448 | foreach ($alldata as $number) { |
2141 | 2449 | $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
2142 | 2450 | } |
2143 | - if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
|
2451 | + if ($globalDebug) { |
|
2452 | + echo 'Count all real arrivals by months...'."\n"; |
|
2453 | + } |
|
2144 | 2454 | $alldata = $Spotter->countAllMonthsRealArrivals($filter_last_month); |
2145 | 2455 | foreach ($alldata as $number) { |
2146 | 2456 | $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
2147 | 2457 | } |
2148 | - if ($globalDebug) echo 'Airports data...'."\n"; |
|
2149 | - if ($globalDebug) echo '...Departure'."\n"; |
|
2458 | + if ($globalDebug) { |
|
2459 | + echo 'Airports data...'."\n"; |
|
2460 | + } |
|
2461 | + if ($globalDebug) { |
|
2462 | + echo '...Departure'."\n"; |
|
2463 | + } |
|
2150 | 2464 | $this->deleteStatAirport('daily'); |
2151 | 2465 | // $pall = $Spotter->getLast7DaysAirportsDeparture(); |
2152 | 2466 | // $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
@@ -2267,7 +2581,9 @@ discard block |
||
2267 | 2581 | // Count by airlines |
2268 | 2582 | echo '--- Stats by airlines ---'."\n"; |
2269 | 2583 | if ($Connection->tableExists('countries')) { |
2270 | - if ($globalDebug) echo 'Count all flights by countries by airlines...'."\n"; |
|
2584 | + if ($globalDebug) { |
|
2585 | + echo 'Count all flights by countries by airlines...'."\n"; |
|
2586 | + } |
|
2271 | 2587 | $SpotterArchive = new SpotterArchive(); |
2272 | 2588 | //$Spotter = new Spotter($this->db); |
2273 | 2589 | $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
@@ -2276,37 +2592,53 @@ discard block |
||
2276 | 2592 | $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],$number['airline_icao'],'',$reset); |
2277 | 2593 | } |
2278 | 2594 | } |
2279 | - if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
|
2595 | + if ($globalDebug) { |
|
2596 | + echo 'Count all aircraft types by airlines...'."\n"; |
|
2597 | + } |
|
2280 | 2598 | $Spotter = new Spotter($this->db); |
2281 | 2599 | $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
2282 | 2600 | foreach ($alldata as $number) { |
2283 | 2601 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset); |
2284 | 2602 | } |
2285 | - if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
|
2603 | + if ($globalDebug) { |
|
2604 | + echo 'Count all aircraft registrations by airlines...'."\n"; |
|
2605 | + } |
|
2286 | 2606 | $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
2287 | 2607 | foreach ($alldata as $number) { |
2288 | 2608 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset); |
2289 | 2609 | } |
2290 | - if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
|
2610 | + if ($globalDebug) { |
|
2611 | + echo 'Count all callsigns by airlines...'."\n"; |
|
2612 | + } |
|
2291 | 2613 | $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
2292 | 2614 | foreach ($alldata as $number) { |
2293 | 2615 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
2294 | 2616 | } |
2295 | - if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
|
2617 | + if ($globalDebug) { |
|
2618 | + echo 'Count all owners by airlines...'."\n"; |
|
2619 | + } |
|
2296 | 2620 | $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
2297 | 2621 | foreach ($alldata as $number) { |
2298 | 2622 | $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset); |
2299 | 2623 | } |
2300 | - if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
|
2624 | + if ($globalDebug) { |
|
2625 | + echo 'Count all pilots by airlines...'."\n"; |
|
2626 | + } |
|
2301 | 2627 | $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
2302 | 2628 | foreach ($alldata as $number) { |
2303 | 2629 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset); |
2304 | 2630 | } |
2305 | - if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
|
2631 | + if ($globalDebug) { |
|
2632 | + echo 'Count all departure airports by airlines...'."\n"; |
|
2633 | + } |
|
2306 | 2634 | $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
2307 | - if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
|
2635 | + if ($globalDebug) { |
|
2636 | + echo 'Count all detected departure airports by airlines...'."\n"; |
|
2637 | + } |
|
2308 | 2638 | $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
2309 | - if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
|
2639 | + if ($globalDebug) { |
|
2640 | + echo 'Order detected departure airports by airlines...'."\n"; |
|
2641 | + } |
|
2310 | 2642 | //$alldata = array(); |
2311 | 2643 | foreach ($dall as $value) { |
2312 | 2644 | $icao = $value['airport_departure_icao']; |
@@ -2327,11 +2659,17 @@ discard block |
||
2327 | 2659 | foreach ($alldata as $number) { |
2328 | 2660 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset); |
2329 | 2661 | } |
2330 | - if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
|
2662 | + if ($globalDebug) { |
|
2663 | + echo 'Count all arrival airports by airlines...'."\n"; |
|
2664 | + } |
|
2331 | 2665 | $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
2332 | - if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
|
2666 | + if ($globalDebug) { |
|
2667 | + echo 'Count all detected arrival airports by airlines...'."\n"; |
|
2668 | + } |
|
2333 | 2669 | $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
2334 | - if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
|
2670 | + if ($globalDebug) { |
|
2671 | + echo 'Order arrival airports by airlines...'."\n"; |
|
2672 | + } |
|
2335 | 2673 | //$alldata = array(); |
2336 | 2674 | foreach ($dall as $value) { |
2337 | 2675 | $icao = $value['airport_arrival_icao']; |
@@ -2350,37 +2688,53 @@ discard block |
||
2350 | 2688 | } |
2351 | 2689 | $alldata = $pall; |
2352 | 2690 | foreach ($alldata as $number) { |
2353 | - if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
|
2691 | + if ($number['airline_icao'] != '') { |
|
2692 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
|
2693 | + } |
|
2694 | + } |
|
2695 | + if ($globalDebug) { |
|
2696 | + echo 'Count all flights by months by airlines...'."\n"; |
|
2354 | 2697 | } |
2355 | - if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
|
2356 | 2698 | $Spotter = new Spotter($this->db); |
2357 | 2699 | $alldata = $Spotter->countAllMonthsByAirlines($filter_last_month); |
2358 | 2700 | $lastyear = false; |
2359 | 2701 | foreach ($alldata as $number) { |
2360 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
2702 | + if ($number['year_name'] != date('Y')) { |
|
2703 | + $lastyear = true; |
|
2704 | + } |
|
2361 | 2705 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
2362 | 2706 | } |
2363 | - if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
|
2707 | + if ($globalDebug) { |
|
2708 | + echo 'Count all owners by months by airlines...'."\n"; |
|
2709 | + } |
|
2364 | 2710 | $alldata = $Spotter->countAllMonthsOwnersByAirlines($filter_last_month); |
2365 | 2711 | foreach ($alldata as $number) { |
2366 | 2712 | $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
2367 | 2713 | } |
2368 | - if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
|
2714 | + if ($globalDebug) { |
|
2715 | + echo 'Count all pilots by months by airlines...'."\n"; |
|
2716 | + } |
|
2369 | 2717 | $alldata = $Spotter->countAllMonthsPilotsByAirlines($filter_last_month); |
2370 | 2718 | foreach ($alldata as $number) { |
2371 | 2719 | $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
2372 | 2720 | } |
2373 | - if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
|
2721 | + if ($globalDebug) { |
|
2722 | + echo 'Count all aircrafts by months by airlines...'."\n"; |
|
2723 | + } |
|
2374 | 2724 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines($filter_last_month); |
2375 | 2725 | foreach ($alldata as $number) { |
2376 | 2726 | $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
2377 | 2727 | } |
2378 | - if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
|
2728 | + if ($globalDebug) { |
|
2729 | + echo 'Count all real arrivals by months by airlines...'."\n"; |
|
2730 | + } |
|
2379 | 2731 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines($filter_last_month); |
2380 | 2732 | foreach ($alldata as $number) { |
2381 | 2733 | $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
2382 | 2734 | } |
2383 | - if ($globalDebug) echo '...Departure'."\n"; |
|
2735 | + if ($globalDebug) { |
|
2736 | + echo '...Departure'."\n"; |
|
2737 | + } |
|
2384 | 2738 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
2385 | 2739 | $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
2386 | 2740 | foreach ($dall as $value) { |
@@ -2403,7 +2757,9 @@ discard block |
||
2403 | 2757 | foreach ($alldata as $number) { |
2404 | 2758 | $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']); |
2405 | 2759 | } |
2406 | - if ($globalDebug) echo '...Arrival'."\n"; |
|
2760 | + if ($globalDebug) { |
|
2761 | + echo '...Arrival'."\n"; |
|
2762 | + } |
|
2407 | 2763 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
2408 | 2764 | $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
2409 | 2765 | foreach ($dall as $value) { |
@@ -2427,13 +2783,19 @@ discard block |
||
2427 | 2783 | $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']); |
2428 | 2784 | } |
2429 | 2785 | |
2430 | - if ($globalDebug) echo 'Flights data...'."\n"; |
|
2431 | - if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
|
2786 | + if ($globalDebug) { |
|
2787 | + echo 'Flights data...'."\n"; |
|
2788 | + } |
|
2789 | + if ($globalDebug) { |
|
2790 | + echo '-> countAllDatesLastMonth...'."\n"; |
|
2791 | + } |
|
2432 | 2792 | $alldata = $Spotter->countAllDatesLastMonthByAirlines($filter_last_month); |
2433 | 2793 | foreach ($alldata as $number) { |
2434 | 2794 | $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
2435 | 2795 | } |
2436 | - if ($globalDebug) echo '-> countAllDates...'."\n"; |
|
2796 | + if ($globalDebug) { |
|
2797 | + echo '-> countAllDates...'."\n"; |
|
2798 | + } |
|
2437 | 2799 | //$previousdata = $this->countAllDatesByAirlines(); |
2438 | 2800 | $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines($filter_last_month)); |
2439 | 2801 | $values = array(); |
@@ -2446,7 +2808,9 @@ discard block |
||
2446 | 2808 | $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
2447 | 2809 | } |
2448 | 2810 | |
2449 | - if ($globalDebug) echo '-> countAllHours...'."\n"; |
|
2811 | + if ($globalDebug) { |
|
2812 | + echo '-> countAllHours...'."\n"; |
|
2813 | + } |
|
2450 | 2814 | $alldata = $Spotter->countAllHoursByAirlines('hour',$filter_last_month); |
2451 | 2815 | foreach ($alldata as $number) { |
2452 | 2816 | $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
@@ -2454,14 +2818,18 @@ discard block |
||
2454 | 2818 | |
2455 | 2819 | |
2456 | 2820 | // Stats by filters |
2457 | - if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array(); |
|
2821 | + if (!isset($globalStatsFilters) || $globalStatsFilters == '') { |
|
2822 | + $globalStatsFilters = array(); |
|
2823 | + } |
|
2458 | 2824 | foreach ($globalStatsFilters as $name => $filter) { |
2459 | 2825 | //$filter_name = $filter['name']; |
2460 | 2826 | $filter_name = $name; |
2461 | 2827 | $reset = false; |
2462 | 2828 | $last_update = $this->getLastStatsUpdate('last_update_stats_'.$filter_name); |
2463 | 2829 | if (isset($filter['resetall']) && isset($last_update[0]['value']) && strtotime($filter['resetall']) > strtotime($last_update[0]['value'])) { |
2464 | - if ($globalDebug) echo '!!! Delete stats for filter '.$filter_name.' !!!'."\n"; |
|
2830 | + if ($globalDebug) { |
|
2831 | + echo '!!! Delete stats for filter '.$filter_name.' !!!'."\n"; |
|
2832 | + } |
|
2465 | 2833 | $this->deleteOldStats($filter_name); |
2466 | 2834 | unset($last_update); |
2467 | 2835 | } |
@@ -2480,7 +2848,9 @@ discard block |
||
2480 | 2848 | |
2481 | 2849 | |
2482 | 2850 | // Count by filter |
2483 | - if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
2851 | + if ($globalDebug) { |
|
2852 | + echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
2853 | + } |
|
2484 | 2854 | $Spotter = new Spotter($this->db); |
2485 | 2855 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
2486 | 2856 | foreach ($alldata as $number) { |
@@ -2517,7 +2887,9 @@ discard block |
||
2517 | 2887 | $icao = $value['airport_departure_icao']; |
2518 | 2888 | if (isset($alldata[$icao])) { |
2519 | 2889 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
2520 | - } else $alldata[$icao] = $value; |
|
2890 | + } else { |
|
2891 | + $alldata[$icao] = $value; |
|
2892 | + } |
|
2521 | 2893 | } |
2522 | 2894 | $count = array(); |
2523 | 2895 | foreach ($alldata as $key => $row) { |
@@ -2538,7 +2910,9 @@ discard block |
||
2538 | 2910 | $icao = $value['airport_arrival_icao']; |
2539 | 2911 | if (isset($alldata[$icao])) { |
2540 | 2912 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
2541 | - } else $alldata[$icao] = $value; |
|
2913 | + } else { |
|
2914 | + $alldata[$icao] = $value; |
|
2915 | + } |
|
2542 | 2916 | } |
2543 | 2917 | $count = array(); |
2544 | 2918 | foreach ($alldata as $key => $row) { |
@@ -2552,7 +2926,9 @@ discard block |
||
2552 | 2926 | $alldata = $Spotter->countAllMonths($filter); |
2553 | 2927 | $lastyear = false; |
2554 | 2928 | foreach ($alldata as $number) { |
2555 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
2929 | + if ($number['year_name'] != date('Y')) { |
|
2930 | + $lastyear = true; |
|
2931 | + } |
|
2556 | 2932 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
2557 | 2933 | } |
2558 | 2934 | $alldata = $Spotter->countAllMonthsOwners($filter); |
@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | $Spotter = new Spotter(); |
24 | 24 | $alliances = $Spotter->getAllAllianceNames(); |
25 | 25 | if (!empty($alliances)) { |
26 | - foreach($alliances as $alliance) { |
|
27 | - if (isset($airline_icao) && str_replace('_',' ',$airline_icao) == $alliance['alliance']) { |
|
28 | - print '<option value="'.str_replace(' ','_',$alliance['alliance']).'" selected>'.$alliance['alliance'].'</option>'; |
|
26 | + foreach ($alliances as $alliance) { |
|
27 | + if (isset($airline_icao) && str_replace('_', ' ', $airline_icao) == $alliance['alliance']) { |
|
28 | + print '<option value="'.str_replace(' ', '_', $alliance['alliance']).'" selected>'.$alliance['alliance'].'</option>'; |
|
29 | 29 | } else { |
30 | - print '<option value="'.str_replace(' ','_',$alliance['alliance']).'">'.$alliance['alliance'].'</option>'; |
|
30 | + print '<option value="'.str_replace(' ', '_', $alliance['alliance']).'">'.$alliance['alliance'].'</option>'; |
|
31 | 31 | } |
32 | 32 | } |
33 | 33 | print '<option disabled>──────────</option>'; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $Stats = new Stats(); |
36 | 36 | if (!isset($filter_name)) $filter_name = ''; |
37 | 37 | $airlines = $Stats->getAllAirlineNames($filter_name); |
38 | - foreach($airlines as $airline) { |
|
38 | + foreach ($airlines as $airline) { |
|
39 | 39 | if (isset($airline_icao) && $airline_icao == $airline['airline_icao']) { |
40 | 40 | print '<option value="'.$airline['airline_icao'].'" selected>'.$airline['airline_name'].'</option>'; |
41 | 41 | } else { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | if (!isset($type) || $type == 'aircraft') { |
59 | 59 | ?> |
60 | 60 | <li class="dropdown"> |
61 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#" > |
|
61 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#" > |
|
62 | 62 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
63 | 63 | </a> |
64 | 64 | <ul class="dropdown-menu"> |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | </ul> |
70 | 70 | </li> |
71 | 71 | <li class="dropdown"> |
72 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
72 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
73 | 73 | <?php echo _("Airline"); ?> <span class="caret"></span> |
74 | 74 | </a> |
75 | 75 | <ul class="dropdown-menu" role="menu"> |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | </ul> |
86 | 86 | </li> |
87 | 87 | <li class="dropdown"> |
88 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
88 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
89 | 89 | <?php echo _("Airport"); ?> <span class="caret"></span> |
90 | 90 | </a> |
91 | 91 | <ul class="dropdown-menu" role="menu"> |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | </ul> |
97 | 97 | </li> |
98 | 98 | <li class="dropdown"> |
99 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
99 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
100 | 100 | <?php echo _("Route"); ?> <span class="caret"></span> |
101 | 101 | </a> |
102 | 102 | <ul class="dropdown-menu" role="menu"> |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | </ul> |
106 | 106 | </li> |
107 | 107 | <li class="dropdown"> |
108 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
108 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
109 | 109 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
110 | 110 | </a> |
111 | 111 | <ul class="dropdown-menu" role="menu"> |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) { |
118 | 118 | ?> |
119 | 119 | <li class="dropdown"> |
120 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
120 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
121 | 121 | <?php echo _("Fatalities"); ?> <span class="caret"></span> |
122 | 122 | </a> |
123 | 123 | <ul class="dropdown-menu" role="menu"> |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | } elseif ($type == 'marine' || $type == 'tracker') { |
133 | 133 | ?> |
134 | 134 | <li class="dropdown"> |
135 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
135 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
136 | 136 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
137 | 137 | </a> |
138 | 138 | <ul class="dropdown-menu" role="menu"> |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | if (!isset($type) || $type == 'aircraft') { |
155 | 155 | ?> |
156 | 156 | <li class="dropdown"> |
157 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#" > |
|
157 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#" > |
|
158 | 158 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
159 | 159 | </a> |
160 | 160 | <ul class="dropdown-menu"> |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | </ul> |
166 | 166 | </li> |
167 | 167 | <li class="dropdown"> |
168 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
168 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
169 | 169 | <?php echo _("Airline"); ?> <span class="caret"></span> |
170 | 170 | </a> |
171 | 171 | <ul class="dropdown-menu" role="menu"> |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | </ul> |
182 | 182 | </li> |
183 | 183 | <li class="dropdown"> |
184 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
184 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
185 | 185 | <?php echo _("Airport"); ?> <span class="caret"></span> |
186 | 186 | </a> |
187 | 187 | <ul class="dropdown-menu" role="menu"> |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | </li> |
194 | 194 | <!-- |
195 | 195 | <li class="dropdown"> |
196 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
196 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
197 | 197 | <?php echo _("Route"); ?> <span class="caret"></span> |
198 | 198 | </a> |
199 | 199 | <ul class="dropdown-menu" role="menu"> |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | --> |
205 | 205 | <!-- |
206 | 206 | <li class="dropdown"> |
207 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
207 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
208 | 208 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
209 | 209 | </a> |
210 | 210 | <ul class="dropdown-menu" role="menu"> |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | ?> |
219 | 219 | <!-- |
220 | 220 | <li class="dropdown"> |
221 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
221 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
222 | 222 | <?php echo _("Fatalities"); ?> <span class="caret"></span> |
223 | 223 | </a> |
224 | 224 | <ul class="dropdown-menu" role="menu"> |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | } elseif ($type == 'marine' || $type == 'tracker') { |
235 | 235 | ?> |
236 | 236 | <li class="dropdown"> |
237 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
237 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
238 | 238 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
239 | 239 | </a> |
240 | 240 | <ul class="dropdown-menu" role="menu"> |
@@ -4,7 +4,13 @@ discard block |
||
4 | 4 | <div class="stats_airline"> |
5 | 5 | |
6 | 6 | <form id="changedate" method="post"> |
7 | - <input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') echo $year.'-'; ?><?php if (isset($month) && $month != '') echo $month; ?>" /> |
|
7 | + <input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') { |
|
8 | + echo $year.'-'; |
|
9 | +} |
|
10 | +?><?php if (isset($month) && $month != '') { |
|
11 | + echo $month; |
|
12 | +} |
|
13 | +?>" /> |
|
8 | 14 | </form> |
9 | 15 | <?php |
10 | 16 | if (!isset($type) || $type == 'aircraft') { |
@@ -33,7 +39,9 @@ discard block |
||
33 | 39 | print '<option disabled>──────────</option>'; |
34 | 40 | } |
35 | 41 | $Stats = new Stats(); |
36 | - if (!isset($filter_name)) $filter_name = ''; |
|
42 | + if (!isset($filter_name)) { |
|
43 | + $filter_name = ''; |
|
44 | + } |
|
37 | 45 | $airlines = $Stats->getAllAirlineNames($filter_name); |
38 | 46 | foreach($airlines as $airline) { |
39 | 47 | if (isset($airline_icao) && $airline_icao == $airline['airline_icao']) { |
@@ -62,10 +70,22 @@ discard block |
||
62 | 70 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
63 | 71 | </a> |
64 | 72 | <ul class="dropdown-menu"> |
65 | - <li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Aircraft"); ?></a></li> |
|
66 | - <li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Registration"); ?></a></li> |
|
67 | - <li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Manufacturer"); ?></a></li> |
|
68 | - <li><a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Country"); ?></a></li> |
|
73 | + <li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
74 | + echo '/'.$airline_icao; |
|
75 | +} |
|
76 | +?>"><?php echo _("Aircraft"); ?></a></li> |
|
77 | + <li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
78 | + echo '/'.$airline_icao; |
|
79 | +} |
|
80 | +?>"><?php echo _("Registration"); ?></a></li> |
|
81 | + <li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
82 | + echo '/'.$airline_icao; |
|
83 | +} |
|
84 | +?>"><?php echo _("Manufacturer"); ?></a></li> |
|
85 | + <li><a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
86 | + echo '/'.$airline_icao; |
|
87 | +} |
|
88 | +?>"><?php echo _("Country"); ?></a></li> |
|
69 | 89 | </ul> |
70 | 90 | </li> |
71 | 91 | <li class="dropdown"> |
@@ -76,12 +96,21 @@ discard block |
||
76 | 96 | <?php |
77 | 97 | if (!isset($airline_icao) || $airline_icao == 'all') { |
78 | 98 | ?> |
79 | - <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Airline"); ?></a></li> |
|
80 | - <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Airline by Country"); ?></a></li> |
|
99 | + <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
100 | + echo '/'.$airline_icao; |
|
101 | +} |
|
102 | +?>"><?php echo _("Airline"); ?></a></li> |
|
103 | + <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
104 | + echo '/'.$airline_icao; |
|
105 | +} |
|
106 | +?>"><?php echo _("Airline by Country"); ?></a></li> |
|
81 | 107 | <?php |
82 | 108 | } |
83 | 109 | ?> |
84 | - <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Callsign"); ?></a></li> |
|
110 | + <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
111 | + echo '/'.$airline_icao; |
|
112 | +} |
|
113 | +?>"><?php echo _("Callsign"); ?></a></li> |
|
85 | 114 | </ul> |
86 | 115 | </li> |
87 | 116 | <li class="dropdown"> |
@@ -89,10 +118,22 @@ discard block |
||
89 | 118 | <?php echo _("Airport"); ?> <span class="caret"></span> |
90 | 119 | </a> |
91 | 120 | <ul class="dropdown-menu" role="menu"> |
92 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Departure Airport"); ?></a></li> |
|
93 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
94 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
95 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
121 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
122 | + echo '/'.$airline_icao; |
|
123 | +} |
|
124 | +?>"><?php echo _("Departure Airport"); ?></a></li> |
|
125 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
126 | + echo '/'.$airline_icao; |
|
127 | +} |
|
128 | +?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
129 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
130 | + echo '/'.$airline_icao; |
|
131 | +} |
|
132 | +?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
133 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
134 | + echo '/'.$airline_icao; |
|
135 | +} |
|
136 | +?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
96 | 137 | </ul> |
97 | 138 | </li> |
98 | 139 | <li class="dropdown"> |
@@ -100,8 +141,14 @@ discard block |
||
100 | 141 | <?php echo _("Route"); ?> <span class="caret"></span> |
101 | 142 | </a> |
102 | 143 | <ul class="dropdown-menu" role="menu"> |
103 | - <li><a href="<?php print $globalURL; ?>/statistics/route-airport<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Route by Airport"); ?></a></li> |
|
104 | - <li><a href="<?php print $globalURL; ?>/statistics/route-waypoint<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Route by Waypoint"); ?></a></li> |
|
144 | + <li><a href="<?php print $globalURL; ?>/statistics/route-airport<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
145 | + echo '/'.$airline_icao; |
|
146 | +} |
|
147 | +?>"><?php echo _("Route by Airport"); ?></a></li> |
|
148 | + <li><a href="<?php print $globalURL; ?>/statistics/route-waypoint<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
149 | + echo '/'.$airline_icao; |
|
150 | +} |
|
151 | +?>"><?php echo _("Route by Waypoint"); ?></a></li> |
|
105 | 152 | </ul> |
106 | 153 | </li> |
107 | 154 | <li class="dropdown"> |
@@ -109,8 +156,14 @@ discard block |
||
109 | 156 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
110 | 157 | </a> |
111 | 158 | <ul class="dropdown-menu" role="menu"> |
112 | - <li><a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Date"); ?></a></li> |
|
113 | - <li><a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Time"); ?></a></li> |
|
159 | + <li><a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
160 | + echo '/'.$airline_icao; |
|
161 | +} |
|
162 | +?>"><?php echo _("Date"); ?></a></li> |
|
163 | + <li><a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
164 | + echo '/'.$airline_icao; |
|
165 | +} |
|
166 | +?>"><?php echo _("Time"); ?></a></li> |
|
114 | 167 | </ul> |
115 | 168 | </li> |
116 | 169 | <?php |
@@ -158,9 +211,18 @@ discard block |
||
158 | 211 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
159 | 212 | </a> |
160 | 213 | <ul class="dropdown-menu"> |
161 | - <li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Aircraft"); ?></a></li> |
|
162 | - <li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Registration"); ?></a></li> |
|
163 | - <li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Manufacturer"); ?></a></li> |
|
214 | + <li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
215 | + echo '/'.$airline_icao; |
|
216 | +} |
|
217 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Aircraft"); ?></a></li> |
|
218 | + <li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
219 | + echo '/'.$airline_icao; |
|
220 | +} |
|
221 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Registration"); ?></a></li> |
|
222 | + <li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
223 | + echo '/'.$airline_icao; |
|
224 | +} |
|
225 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Manufacturer"); ?></a></li> |
|
164 | 226 | <!-- <li><a href="<?php print $globalURL; ?>/statistics/country"><?php echo _("Country"); ?></a></li> --> |
165 | 227 | </ul> |
166 | 228 | </li> |
@@ -172,12 +234,21 @@ discard block |
||
172 | 234 | <?php |
173 | 235 | if (!isset($airline_icao) || $airline_icao == 'all') { |
174 | 236 | ?> |
175 | - <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline"); ?></a></li> |
|
176 | - <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline by Country"); ?></a></li> |
|
237 | + <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
238 | + echo '/'.$airline_icao; |
|
239 | +} |
|
240 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline"); ?></a></li> |
|
241 | + <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
242 | + echo '/'.$airline_icao; |
|
243 | +} |
|
244 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline by Country"); ?></a></li> |
|
177 | 245 | <?php |
178 | 246 | } |
179 | 247 | ?> |
180 | - <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Callsign"); ?></a></li> |
|
248 | + <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
249 | + echo '/'.$airline_icao; |
|
250 | +} |
|
251 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Callsign"); ?></a></li> |
|
181 | 252 | </ul> |
182 | 253 | </li> |
183 | 254 | <li class="dropdown"> |
@@ -185,10 +256,22 @@ discard block |
||
185 | 256 | <?php echo _("Airport"); ?> <span class="caret"></span> |
186 | 257 | </a> |
187 | 258 | <ul class="dropdown-menu" role="menu"> |
188 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport"); ?></a></li> |
|
189 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
190 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
191 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
259 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
260 | + echo '/'.$airline_icao; |
|
261 | +} |
|
262 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport"); ?></a></li> |
|
263 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
264 | + echo '/'.$airline_icao; |
|
265 | +} |
|
266 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
267 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
268 | + echo '/'.$airline_icao; |
|
269 | +} |
|
270 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
271 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
272 | + echo '/'.$airline_icao; |
|
273 | +} |
|
274 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
192 | 275 | </ul> |
193 | 276 | </li> |
194 | 277 | <!-- |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | ?> |
250 | 250 | <div class="more"> |
251 | 251 | <?php |
252 | - /* |
|
252 | + /* |
|
253 | 253 | if ($year != '' && $month != '') { |
254 | 254 | ?> |
255 | 255 | <a href="<?php print $globalURL; ?>/marine/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | <?php |
261 | 261 | } |
262 | 262 | */ |
263 | - ?> |
|
263 | + ?> |
|
264 | 264 | </div> |
265 | 265 | </div> |
266 | 266 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | ?> |
295 | 295 | <div class="more"> |
296 | 296 | <?php |
297 | - /* |
|
297 | + /* |
|
298 | 298 | if ($year != '' && $month != '') { |
299 | 299 | ?> |
300 | 300 | <a href="<?php print $globalURL; ?>/marine/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | <?php |
306 | 306 | } |
307 | 307 | */ |
308 | - ?> |
|
308 | + ?> |
|
309 | 309 | </div> |
310 | 310 | </div> |
311 | 311 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | if (!isset($filter_name)) $filter_name = ''; |
22 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
22 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
23 | 23 | if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) { |
24 | 24 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
25 | 25 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | if (isset($airline_info[0]['name'])) { |
30 | 30 | $airline_name = $airline_info[0]['name']; |
31 | 31 | } else { |
32 | - $alliances = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',$airline_icao)); |
|
32 | + $alliances = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', $airline_icao)); |
|
33 | 33 | if (!empty($alliances)) { |
34 | 34 | $alliance_name = $airline_icao; |
35 | 35 | $airline_icao = 'alliance_'.$airline_icao; |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | $title = _("Statistics"); |
43 | 43 | } |
44 | 44 | |
45 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
46 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
45 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
46 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
47 | 47 | |
48 | 48 | require_once('header.php'); |
49 | 49 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | date_default_timezone_set('UTC'); |
71 | 71 | $lastupdate = strtotime($last_update[0]['value']); |
72 | 72 | if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
73 | - print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
|
73 | + print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>'; |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | ?> |
@@ -82,31 +82,31 @@ discard block |
||
82 | 82 | <?php |
83 | 83 | if ($type == 'aircraft') { |
84 | 84 | ?> |
85 | - <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Flights"); ?></span> |
|
86 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
87 | - <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
|
88 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
85 | + <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Flights"); ?></span> |
|
86 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
87 | + <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
|
88 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
89 | 89 | <?php |
90 | 90 | if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
91 | 91 | ?> |
92 | - <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span> |
|
93 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
92 | + <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Pilots"); ?></span> |
|
93 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
94 | 94 | <?php |
95 | 95 | } |
96 | 96 | if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
97 | 97 | ?> |
98 | - <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span> |
|
99 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
98 | + <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Owners"); ?></span> |
|
99 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
100 | 100 | <?php |
101 | 101 | } |
102 | 102 | ?> |
103 | - <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
|
104 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
103 | + <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
|
104 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
105 | 105 | <?php |
106 | 106 | if ($airline_icao == '') { |
107 | 107 | ?> |
108 | - <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span> |
|
109 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
108 | + <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name, $year, $month)); ?></span> <?php echo _("Airlines"); ?></span> |
|
109 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
110 | 110 | <?php |
111 | 111 | } |
112 | 112 | ?> |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | if (!(isset($globalVA) && $globalVA) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS) && !(isset($globalVAM) && $globalVAM)) { |
115 | 115 | if ($airline_icao == '' || $airline_icao == 'all') { |
116 | 116 | ?> |
117 | - <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name,$year,$month)); ?></span> <?php echo _("Military"); ?></span> |
|
118 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
117 | + <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name, $year, $month)); ?></span> <?php echo _("Military"); ?></span> |
|
118 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
119 | 119 | <?php |
120 | 120 | } |
121 | 121 | } |
@@ -123,22 +123,22 @@ discard block |
||
123 | 123 | <?php |
124 | 124 | } elseif ($type == 'marine') { |
125 | 125 | ?> |
126 | - <span><span class="badge"><?php print number_format($Marine->countOverallMarine(array(),$year,$month)); ?></span> <?php echo _("Vessels"); ?></span> |
|
127 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
128 | - <span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span> |
|
129 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
126 | + <span><span class="badge"><?php print number_format($Marine->countOverallMarine(array(), $year, $month)); ?></span> <?php echo _("Vessels"); ?></span> |
|
127 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
128 | + <span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span> |
|
129 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
130 | 130 | <?php |
131 | 131 | } elseif ($type == 'tracker') { |
132 | 132 | ?> |
133 | - <span><span class="badge"><?php print number_format($Tracker->countOverallTracker(array(),$year,$month)); ?></span> <?php echo _("Trackers"); ?></span> |
|
134 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
135 | - <span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span> |
|
136 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
133 | + <span><span class="badge"><?php print number_format($Tracker->countOverallTracker(array(), $year, $month)); ?></span> <?php echo _("Trackers"); ?></span> |
|
134 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
135 | + <span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span> |
|
136 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
137 | 137 | <?php |
138 | 138 | } |
139 | 139 | ?> |
140 | 140 | </p> |
141 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
141 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
142 | 142 | <div class="specific-stats"> |
143 | 143 | <?php |
144 | 144 | if ($type == 'aircraft') { |
@@ -147,13 +147,13 @@ discard block |
||
147 | 147 | <div class="col-md-6"> |
148 | 148 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
149 | 149 | <?php |
150 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
|
150 | + $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month); |
|
151 | 151 | if (count($aircraft_array) == 0) { |
152 | 152 | print _("No data available"); |
153 | 153 | } else { |
154 | 154 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
155 | 155 | $aircraft_data = ''; |
156 | - foreach($aircraft_array as $aircraft_item) { |
|
156 | + foreach ($aircraft_array as $aircraft_item) { |
|
157 | 157 | if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
158 | 158 | else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
159 | 159 | } |
@@ -182,16 +182,16 @@ discard block |
||
182 | 182 | ?> |
183 | 183 | </div> |
184 | 184 | </div> |
185 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
185 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
186 | 186 | <?php |
187 | 187 | if ($airline_icao == '' || $airline_icao == 'all') { |
188 | - $airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month); |
|
188 | + $airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month); |
|
189 | 189 | if (count($airline_array) > 0) { |
190 | 190 | print '<div class="col-md-6">'; |
191 | 191 | print '<h2>'._("Top 10 Most Common Airline").'</h2>'; |
192 | 192 | print '<div id="chart2" class="chart" width="100%"></div><script>'; |
193 | 193 | $airline_data = ''; |
194 | - foreach($airline_array as $airline_item) { |
|
194 | + foreach ($airline_array as $airline_item) { |
|
195 | 195 | $airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
196 | 196 | } |
197 | 197 | $airline_data = substr($airline_data, 0, -1); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } |
217 | 217 | ?> |
218 | 218 | </div> |
219 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
219 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
220 | 220 | <?php |
221 | 221 | } |
222 | 222 | } |
@@ -228,12 +228,12 @@ discard block |
||
228 | 228 | <div class="col-md-6"> |
229 | 229 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
230 | 230 | <?php |
231 | - $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month); |
|
231 | + $marine_array = $Marine->countAllMarineTypes(true, 0, '', array(), $year, $month); |
|
232 | 232 | if (count($marine_array) == 0) print _("No data available"); |
233 | 233 | else { |
234 | 234 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
235 | 235 | $marine_data = ''; |
236 | - foreach($marine_array as $marine_item) { |
|
236 | + foreach ($marine_array as $marine_item) { |
|
237 | 237 | $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],'; |
238 | 238 | } |
239 | 239 | $marine_data = substr($marine_data, 0, -1); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | ?> |
264 | 264 | </div> |
265 | 265 | </div> |
266 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
266 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
267 | 267 | <!-- </div>--> |
268 | 268 | <?php |
269 | 269 | } |
@@ -273,12 +273,12 @@ discard block |
||
273 | 273 | <div class="col-md-6"> |
274 | 274 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
275 | 275 | <?php |
276 | - $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month); |
|
276 | + $tracker_array = $Tracker->countAllTrackerTypes(true, 0, '', array(), $year, $month); |
|
277 | 277 | if (count($tracker_array) == 0) print _("No data available"); |
278 | 278 | else { |
279 | 279 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
280 | 280 | $tracker_data = ''; |
281 | - foreach($tracker_array as $tracker_item) { |
|
281 | + foreach ($tracker_array as $tracker_item) { |
|
282 | 282 | $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],'; |
283 | 283 | } |
284 | 284 | $tracker_data = substr($tracker_data, 0, -1); |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | ?> |
309 | 309 | </div> |
310 | 310 | </div> |
311 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
311 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
312 | 312 | <!-- </div>--> |
313 | 313 | <?php |
314 | 314 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | ?> |
317 | 317 | <div class="row column"> |
318 | 318 | <?php |
319 | - $flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month); |
|
319 | + $flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name, $year, $month); |
|
320 | 320 | //if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
321 | 321 | if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
322 | 322 | if (empty($flightover_array)) { |
@@ -327,12 +327,12 @@ discard block |
||
327 | 327 | ?> |
328 | 328 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
329 | 329 | <?php |
330 | - $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
|
330 | + $pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month); |
|
331 | 331 | if (count($pilot_array) == 0) print _("No data available"); |
332 | 332 | else { |
333 | 333 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
334 | 334 | $pilot_data = ''; |
335 | - foreach($pilot_array as $pilot_item) { |
|
335 | + foreach ($pilot_array as $pilot_item) { |
|
336 | 336 | $pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
337 | 337 | } |
338 | 338 | $pilot_data = substr($pilot_data, 0, -1); |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | ?> |
354 | 354 | </div> |
355 | 355 | |
356 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
356 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
357 | 357 | <?php |
358 | 358 | } |
359 | 359 | // else { |
@@ -362,12 +362,12 @@ discard block |
||
362 | 362 | <div class="col-md-6"> |
363 | 363 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
364 | 364 | <?php |
365 | - $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
|
365 | + $owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month); |
|
366 | 366 | if (count($owner_array) == 0) print _("No data available"); |
367 | 367 | else { |
368 | 368 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
369 | 369 | $owner_data = ''; |
370 | - foreach($owner_array as $owner_item) { |
|
370 | + foreach ($owner_array as $owner_item) { |
|
371 | 371 | $owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
372 | 372 | } |
373 | 373 | $owner_data = substr($owner_data, 0, -1); |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | </div> |
387 | 387 | </div> |
388 | 388 | |
389 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
389 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
390 | 390 | <?php |
391 | 391 | } |
392 | 392 | if (!empty($flightover_array)) { |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
401 | 401 | print 'var series = ['; |
402 | 402 | $flightover_data = ''; |
403 | - foreach($flightover_array as $flightover_item) { |
|
403 | + foreach ($flightover_array as $flightover_item) { |
|
404 | 404 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
405 | 405 | } |
406 | 406 | $flightover_data = substr($flightover_data, 0, -1); |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | } |
446 | 446 | ?> |
447 | 447 | </div> |
448 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
448 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
449 | 449 | </div> |
450 | 450 | <?php |
451 | 451 | } |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
462 | 462 | print 'var series = ['; |
463 | 463 | $flightover_data = ''; |
464 | - foreach($flightover_array as $flightover_item) { |
|
464 | + foreach ($flightover_array as $flightover_item) { |
|
465 | 465 | $flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],'; |
466 | 466 | } |
467 | 467 | $flightover_data = substr($flightover_data, 0, -1); |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
519 | 519 | print 'var series = ['; |
520 | 520 | $flightover_data = ''; |
521 | - foreach($flightover_array as $flightover_item) { |
|
521 | + foreach ($flightover_array as $flightover_item) { |
|
522 | 522 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
523 | 523 | } |
524 | 524 | $flightover_data = substr($flightover_data, 0, -1); |
@@ -568,14 +568,14 @@ discard block |
||
568 | 568 | <div class="row column"> |
569 | 569 | <div class="col-md-6"> |
570 | 570 | <?php |
571 | - $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month); |
|
571 | + $airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month); |
|
572 | 572 | if (count($airport_airport_array) > 0) { |
573 | 573 | print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>'; |
574 | 574 | print '<div id="chart3" class="chart" width="100%"></div><script>'; |
575 | 575 | print "\n"; |
576 | 576 | print 'var series = ['; |
577 | 577 | $airport_data = ''; |
578 | - foreach($airport_airport_array as $airport_item) { |
|
578 | + foreach ($airport_airport_array as $airport_item) { |
|
579 | 579 | $airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],'; |
580 | 580 | } |
581 | 581 | $airport_data = substr($airport_data, 0, -1); |
@@ -625,18 +625,18 @@ discard block |
||
625 | 625 | } |
626 | 626 | ?> |
627 | 627 | </div> |
628 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
628 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
629 | 629 | |
630 | 630 | <div class="col-md-6"> |
631 | 631 | <?php |
632 | - $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month); |
|
632 | + $airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month); |
|
633 | 633 | if (count($airport_airport_array2) > 0) { |
634 | 634 | print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>'; |
635 | 635 | print '<div id="chart4" class="chart" width="100%"></div><script>'; |
636 | 636 | print "\n"; |
637 | 637 | print 'var series = ['; |
638 | 638 | $airport_data = ''; |
639 | - foreach($airport_airport_array2 as $airport_item) |
|
639 | + foreach ($airport_airport_array2 as $airport_item) |
|
640 | 640 | { |
641 | 641 | $airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],'; |
642 | 642 | } |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | ?> |
689 | 689 | </div> |
690 | 690 | </div> |
691 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
691 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
692 | 692 | <?php |
693 | 693 | } |
694 | 694 | if ($type == 'aircraft') { |
@@ -700,18 +700,18 @@ discard block |
||
700 | 700 | <div class="col-md-6"> |
701 | 701 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
702 | 702 | <?php |
703 | - $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
703 | + $year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
704 | 704 | if (count($year_array) == 0) print _("No data available"); |
705 | 705 | else { |
706 | 706 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
707 | 707 | $year_data = ''; |
708 | 708 | $year_cnt = ''; |
709 | - foreach($year_array as $year_item) { |
|
709 | + foreach ($year_array as $year_item) { |
|
710 | 710 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
711 | 711 | $year_cnt .= $year_item['date_count'].','; |
712 | 712 | } |
713 | 713 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
714 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
714 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
715 | 715 | print 'c3.generate({ |
716 | 716 | bindto: "#chart8", |
717 | 717 | data: { x: "x", |
@@ -724,22 +724,22 @@ discard block |
||
724 | 724 | <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
725 | 725 | </div> |
726 | 726 | </div> |
727 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
727 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
728 | 728 | <div class="col-md-6"> |
729 | 729 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
730 | 730 | <?php |
731 | - $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
731 | + $month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name); |
|
732 | 732 | if (count($month_array) == 0) print _("No data available"); |
733 | 733 | else { |
734 | 734 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
735 | 735 | $month_data = ''; |
736 | 736 | $month_cnt = ''; |
737 | - foreach($month_array as $month_item) { |
|
737 | + foreach ($month_array as $month_item) { |
|
738 | 738 | $month_data .= '"'.$month_item['date_name'].'",'; |
739 | 739 | $month_cnt .= $month_item['date_count'].','; |
740 | 740 | } |
741 | 741 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
742 | - $month_cnt = "['flights',".substr($month_cnt,0,-1)."]"; |
|
742 | + $month_cnt = "['flights',".substr($month_cnt, 0, -1)."]"; |
|
743 | 743 | print 'c3.generate({ |
744 | 744 | bindto: "#chart9", |
745 | 745 | data: { x: "x", |
@@ -752,23 +752,23 @@ discard block |
||
752 | 752 | <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
753 | 753 | </div> |
754 | 754 | </div> |
755 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
755 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
756 | 756 | |
757 | 757 | <div class="col-md-6"> |
758 | 758 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
759 | 759 | <?php |
760 | - $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
760 | + $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name); |
|
761 | 761 | if (empty($date_array)) print _("No data available"); |
762 | 762 | else { |
763 | 763 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
764 | 764 | $date_data = ''; |
765 | 765 | $date_cnt = ''; |
766 | - foreach($date_array as $date_item) { |
|
766 | + foreach ($date_array as $date_item) { |
|
767 | 767 | $date_data .= '"'.$date_item['date_name'].'",'; |
768 | 768 | $date_cnt .= $date_item['date_count'].','; |
769 | 769 | } |
770 | 770 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
771 | - $date_cnt = "['flights',".substr($date_cnt,0,-1)."]"; |
|
771 | + $date_cnt = "['flights',".substr($date_cnt, 0, -1)."]"; |
|
772 | 772 | print 'c3.generate({ |
773 | 773 | bindto: "#chart5", |
774 | 774 | data: { x: "x", |
@@ -781,22 +781,22 @@ discard block |
||
781 | 781 | <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
782 | 782 | </div> |
783 | 783 | </div> |
784 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
784 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
785 | 785 | <div class="col-md-6"> |
786 | 786 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
787 | 787 | <?php |
788 | - $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
788 | + $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name); |
|
789 | 789 | if (empty($hour_array)) print _("No data available"); |
790 | 790 | else { |
791 | 791 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
792 | 792 | $hour_data = ''; |
793 | 793 | $hour_cnt = ''; |
794 | - foreach($hour_array as $hour_item) { |
|
794 | + foreach ($hour_array as $hour_item) { |
|
795 | 795 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
796 | 796 | $hour_cnt .= $hour_item['hour_count'].','; |
797 | 797 | } |
798 | 798 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
799 | - $hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]"; |
|
799 | + $hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]"; |
|
800 | 800 | print 'c3.generate({ |
801 | 801 | bindto: "#chart6", |
802 | 802 | data: { |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
810 | 810 | </div> |
811 | 811 | </div> |
812 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
812 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
813 | 813 | </div> |
814 | 814 | <?php |
815 | 815 | } |
@@ -825,18 +825,18 @@ discard block |
||
825 | 825 | <div class="col-md-6"> |
826 | 826 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
827 | 827 | <?php |
828 | - $year_array = $Marine->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
828 | + $year_array = $Marine->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
829 | 829 | if (count($year_array) == 0) print _("No data available"); |
830 | 830 | else { |
831 | 831 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
832 | 832 | $year_data = ''; |
833 | 833 | $year_cnt = ''; |
834 | - foreach($year_array as $year_item) { |
|
834 | + foreach ($year_array as $year_item) { |
|
835 | 835 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
836 | 836 | $year_cnt .= $year_item['date_count'].','; |
837 | 837 | } |
838 | 838 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
839 | - $year_cnt = "['vessels',".substr($year_cnt,0,-1)."]"; |
|
839 | + $year_cnt = "['vessels',".substr($year_cnt, 0, -1)."]"; |
|
840 | 840 | print 'c3.generate({ |
841 | 841 | bindto: "#chart8", |
842 | 842 | data: { x: "x", |
@@ -850,22 +850,22 @@ discard block |
||
850 | 850 | </div> |
851 | 851 | </div> |
852 | 852 | |
853 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
853 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
854 | 854 | <div class="col-md-6"> |
855 | 855 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
856 | 856 | <?php |
857 | - $month_array = $Marine->countAllDatesLastMonth($airline_icao,$filter_name); |
|
857 | + $month_array = $Marine->countAllDatesLastMonth($airline_icao, $filter_name); |
|
858 | 858 | if (count($month_array) == 0) print _("No data available"); |
859 | 859 | else { |
860 | 860 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
861 | 861 | $month_data = ''; |
862 | 862 | $month_cnt = ''; |
863 | - foreach($month_array as $month_item) { |
|
863 | + foreach ($month_array as $month_item) { |
|
864 | 864 | $month_data .= '"'.$month_item['date_name'].'",'; |
865 | 865 | $month_cnt .= $month_item['date_count'].','; |
866 | 866 | } |
867 | 867 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
868 | - $month_cnt = "['vessels',".substr($month_cnt,0,-1)."]"; |
|
868 | + $month_cnt = "['vessels',".substr($month_cnt, 0, -1)."]"; |
|
869 | 869 | print 'c3.generate({ |
870 | 870 | bindto: "#chart9", |
871 | 871 | data: { x: "x", |
@@ -878,23 +878,23 @@ discard block |
||
878 | 878 | <a href="<?php print $globalURL; ?>/marine/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
879 | 879 | </div> |
880 | 880 | </div> |
881 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
881 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
882 | 882 | |
883 | 883 | <div class="col-md-6"> |
884 | 884 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
885 | 885 | <?php |
886 | - $date_array = $Marine->countAllDatesLast7Days($airline_icao,$filter_name); |
|
886 | + $date_array = $Marine->countAllDatesLast7Days($airline_icao, $filter_name); |
|
887 | 887 | if (empty($date_array)) print _("No data available"); |
888 | 888 | else { |
889 | 889 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
890 | 890 | $date_data = ''; |
891 | 891 | $date_cnt = ''; |
892 | - foreach($date_array as $date_item) { |
|
892 | + foreach ($date_array as $date_item) { |
|
893 | 893 | $date_data .= '"'.$date_item['date_name'].'",'; |
894 | 894 | $date_cnt .= $date_item['date_count'].','; |
895 | 895 | } |
896 | 896 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
897 | - $date_cnt = "['vessels',".substr($date_cnt,0,-1)."]"; |
|
897 | + $date_cnt = "['vessels',".substr($date_cnt, 0, -1)."]"; |
|
898 | 898 | print 'c3.generate({ |
899 | 899 | bindto: "#chart5", |
900 | 900 | data: { x: "x", |
@@ -907,22 +907,22 @@ discard block |
||
907 | 907 | <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
908 | 908 | </div> |
909 | 909 | </div> |
910 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
910 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
911 | 911 | <div class="col-md-6"> |
912 | 912 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
913 | 913 | <?php |
914 | - $hour_array = $Marine->countAllHours('hour',true,$airline_icao,$filter_name); |
|
914 | + $hour_array = $Marine->countAllHours('hour', true, $airline_icao, $filter_name); |
|
915 | 915 | if (empty($hour_array)) print _("No data available"); |
916 | 916 | else { |
917 | 917 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
918 | 918 | $hour_data = ''; |
919 | 919 | $hour_cnt = ''; |
920 | - foreach($hour_array as $hour_item) { |
|
920 | + foreach ($hour_array as $hour_item) { |
|
921 | 921 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
922 | 922 | $hour_cnt .= $hour_item['hour_count'].','; |
923 | 923 | } |
924 | 924 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
925 | - $hour_cnt = "['vessels',".substr($hour_cnt,0,-1)."]"; |
|
925 | + $hour_cnt = "['vessels',".substr($hour_cnt, 0, -1)."]"; |
|
926 | 926 | print 'c3.generate({ |
927 | 927 | bindto: "#chart6", |
928 | 928 | data: { |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | <a href="<?php print $globalURL; ?>/marine/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
936 | 936 | </div> |
937 | 937 | </div> |
938 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
938 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
939 | 939 | </div> |
940 | 940 | <?php |
941 | 941 | } |
@@ -957,12 +957,12 @@ discard block |
||
957 | 957 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
958 | 958 | $year_data = ''; |
959 | 959 | $year_cnt = ''; |
960 | - foreach($year_array as $year_item) { |
|
960 | + foreach ($year_array as $year_item) { |
|
961 | 961 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
962 | 962 | $year_cnt .= $year_item['date_count'].','; |
963 | 963 | } |
964 | 964 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
965 | - $year_cnt = "['trackers',".substr($year_cnt,0,-1)."]"; |
|
965 | + $year_cnt = "['trackers',".substr($year_cnt, 0, -1)."]"; |
|
966 | 966 | print 'c3.generate({ |
967 | 967 | bindto: "#chart8", |
968 | 968 | data: { x: "x", |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | </div> |
977 | 977 | </div> |
978 | 978 | |
979 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
979 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
980 | 980 | <div class="col-md-6"> |
981 | 981 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
982 | 982 | <?php |
@@ -986,12 +986,12 @@ discard block |
||
986 | 986 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
987 | 987 | $month_data = ''; |
988 | 988 | $month_cnt = ''; |
989 | - foreach($month_array as $month_item) { |
|
989 | + foreach ($month_array as $month_item) { |
|
990 | 990 | $month_data .= '"'.$month_item['date_name'].'",'; |
991 | 991 | $month_cnt .= $month_item['date_count'].','; |
992 | 992 | } |
993 | 993 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
994 | - $month_cnt = "['trackers',".substr($month_cnt,0,-1)."]"; |
|
994 | + $month_cnt = "['trackers',".substr($month_cnt, 0, -1)."]"; |
|
995 | 995 | print 'c3.generate({ |
996 | 996 | bindto: "#chart9", |
997 | 997 | data: { x: "x", |
@@ -1004,7 +1004,7 @@ discard block |
||
1004 | 1004 | <a href="<?php print $globalURL; ?>/tracker/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1005 | 1005 | </div> |
1006 | 1006 | </div> |
1007 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1007 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1008 | 1008 | |
1009 | 1009 | <div class="col-md-6"> |
1010 | 1010 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
@@ -1015,12 +1015,12 @@ discard block |
||
1015 | 1015 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
1016 | 1016 | $date_data = ''; |
1017 | 1017 | $date_cnt = ''; |
1018 | - foreach($date_array as $date_item) { |
|
1018 | + foreach ($date_array as $date_item) { |
|
1019 | 1019 | $date_data .= '"'.$date_item['date_name'].'",'; |
1020 | 1020 | $date_cnt .= $date_item['date_count'].','; |
1021 | 1021 | } |
1022 | 1022 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
1023 | - $date_cnt = "['trackers',".substr($date_cnt,0,-1)."]"; |
|
1023 | + $date_cnt = "['trackers',".substr($date_cnt, 0, -1)."]"; |
|
1024 | 1024 | print 'c3.generate({ |
1025 | 1025 | bindto: "#chart5", |
1026 | 1026 | data: { x: "x", |
@@ -1033,22 +1033,22 @@ discard block |
||
1033 | 1033 | <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1034 | 1034 | </div> |
1035 | 1035 | </div> |
1036 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1036 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1037 | 1037 | <div class="col-md-6"> |
1038 | 1038 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
1039 | 1039 | <?php |
1040 | - $hour_array = $Tracker->countAllHours('hour',true); |
|
1040 | + $hour_array = $Tracker->countAllHours('hour', true); |
|
1041 | 1041 | if (empty($hour_array)) print _("No data available"); |
1042 | 1042 | else { |
1043 | 1043 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
1044 | 1044 | $hour_data = ''; |
1045 | 1045 | $hour_cnt = ''; |
1046 | - foreach($hour_array as $hour_item) { |
|
1046 | + foreach ($hour_array as $hour_item) { |
|
1047 | 1047 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
1048 | 1048 | $hour_cnt .= $hour_item['hour_count'].','; |
1049 | 1049 | } |
1050 | 1050 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
1051 | - $hour_cnt = "['trackers',".substr($hour_cnt,0,-1)."]"; |
|
1051 | + $hour_cnt = "['trackers',".substr($hour_cnt, 0, -1)."]"; |
|
1052 | 1052 | print 'c3.generate({ |
1053 | 1053 | bindto: "#chart6", |
1054 | 1054 | data: { |
@@ -1061,7 +1061,7 @@ discard block |
||
1061 | 1061 | <a href="<?php print $globalURL; ?>/tracker/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1062 | 1062 | </div> |
1063 | 1063 | </div> |
1064 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1064 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1065 | 1065 | </div> |
1066 | 1066 | <?php |
1067 | 1067 | } |
@@ -1083,12 +1083,12 @@ discard block |
||
1083 | 1083 | print '<div id="chart32" class="chart" width="100%"></div><script>'; |
1084 | 1084 | $year_data = ''; |
1085 | 1085 | $year_cnt = ''; |
1086 | - foreach($year_array as $year_item) { |
|
1086 | + foreach ($year_array as $year_item) { |
|
1087 | 1087 | $year_data .= '"'.$year_item['year'].'-01-01",'; |
1088 | 1088 | $year_cnt .= $year_item['count'].','; |
1089 | 1089 | } |
1090 | 1090 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1091 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
1091 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
1092 | 1092 | print 'c3.generate({ |
1093 | 1093 | bindto: "#chart32", |
1094 | 1094 | data: { x: "x", |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1102 | 1102 | </div> |
1103 | 1103 | </div> |
1104 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1104 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1105 | 1105 | |
1106 | 1106 | <div class="row column"> |
1107 | 1107 | <div class="col-md-6"> |
@@ -1113,12 +1113,12 @@ discard block |
||
1113 | 1113 | print '<div id="chart33" class="chart" width="100%"></div><script>'; |
1114 | 1114 | $year_data = ''; |
1115 | 1115 | $year_cnt = ''; |
1116 | - foreach($year_array as $year_item) { |
|
1116 | + foreach ($year_array as $year_item) { |
|
1117 | 1117 | $year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",'; |
1118 | 1118 | $year_cnt .= $year_item['count'].','; |
1119 | 1119 | } |
1120 | 1120 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1121 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
1121 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
1122 | 1122 | print 'c3.generate({ |
1123 | 1123 | bindto: "#chart33", |
1124 | 1124 | data: { x: "x", |
@@ -1131,7 +1131,7 @@ discard block |
||
1131 | 1131 | <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1132 | 1132 | </div> |
1133 | 1133 | </div> |
1134 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1134 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1135 | 1135 | <br/> |
1136 | 1136 | <?php |
1137 | 1137 | } |
@@ -1145,19 +1145,19 @@ discard block |
||
1145 | 1145 | //$polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
1146 | 1146 | if ($year == '' && $month == '') { |
1147 | 1147 | if ($type == 'aircraft') { |
1148 | - $polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d')); |
|
1148 | + $polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d')); |
|
1149 | 1149 | } elseif ($type == 'marine') { |
1150 | - $polar = $Stats->getStatsSource('polar_marine',date('Y'),date('m'),date('d')); |
|
1150 | + $polar = $Stats->getStatsSource('polar_marine', date('Y'), date('m'), date('d')); |
|
1151 | 1151 | } elseif ($type == 'tracker') { |
1152 | - $polar = $Stats->getStatsSource('polar_tracker',date('Y'),date('m'),date('d')); |
|
1152 | + $polar = $Stats->getStatsSource('polar_tracker', date('Y'), date('m'), date('d')); |
|
1153 | 1153 | } |
1154 | 1154 | } else { |
1155 | 1155 | if ($type == 'aircraft') { |
1156 | - $polar = $Stats->getStatsSource('polar',$year,$month); |
|
1156 | + $polar = $Stats->getStatsSource('polar', $year, $month); |
|
1157 | 1157 | } elseif ($type == 'marine') { |
1158 | - $polar = $Stats->getStatsSource('polar_marine',$year,$month); |
|
1158 | + $polar = $Stats->getStatsSource('polar_marine', $year, $month); |
|
1159 | 1159 | } elseif ($type == 'tracker') { |
1160 | - $polar = $Stats->getStatsSource('polar_tracker',$year,$month); |
|
1160 | + $polar = $Stats->getStatsSource('polar_tracker', $year, $month); |
|
1161 | 1161 | } |
1162 | 1162 | } |
1163 | 1163 | if (!empty($polar)) { |
@@ -1166,7 +1166,7 @@ discard block |
||
1166 | 1166 | unset($polar_data); |
1167 | 1167 | $Spotter = new Spotter(); |
1168 | 1168 | $data = json_decode($eachpolar['source_data']); |
1169 | - foreach($data as $value => $key) { |
|
1169 | + foreach ($data as $value => $key) { |
|
1170 | 1170 | $direction = $Spotter->parseDirection(($value*22.5)); |
1171 | 1171 | $distance = $key; |
1172 | 1172 | $unit = 'km'; |
@@ -1186,7 +1186,7 @@ discard block |
||
1186 | 1186 | ?> |
1187 | 1187 | <div class="col-md-6"> |
1188 | 1188 | <h4><?php print $eachpolar['source_name']; ?></h4> |
1189 | - <div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
1189 | + <div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
1190 | 1190 | <script> |
1191 | 1191 | (function() { |
1192 | 1192 | var margin = {top: 100, right: 100, bottom: 100, left: 100}, |
@@ -1210,7 +1210,7 @@ discard block |
||
1210 | 1210 | color: color, |
1211 | 1211 | unit: '<?php echo $unit; ?>' |
1212 | 1212 | }; |
1213 | - RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
1213 | + RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
1214 | 1214 | })(); |
1215 | 1215 | </script> |
1216 | 1216 | </div> |
@@ -1225,19 +1225,19 @@ discard block |
||
1225 | 1225 | //$msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
1226 | 1226 | if ($year == '' && $month == '') { |
1227 | 1227 | if ($type == 'aircraft') { |
1228 | - $msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d')); |
|
1228 | + $msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d')); |
|
1229 | 1229 | } elseif ($type == 'marine') { |
1230 | - $msg = $Stats->getStatsSource('msg_marine',date('Y'),date('m'),date('d')); |
|
1230 | + $msg = $Stats->getStatsSource('msg_marine', date('Y'), date('m'), date('d')); |
|
1231 | 1231 | } elseif ($type == 'tracker') { |
1232 | - $msg = $Stats->getStatsSource('msg_tracker',date('Y'),date('m'),date('d')); |
|
1232 | + $msg = $Stats->getStatsSource('msg_tracker', date('Y'), date('m'), date('d')); |
|
1233 | 1233 | } |
1234 | 1234 | } else { |
1235 | 1235 | if ($type == 'aircraft') { |
1236 | - $msg = $Stats->getStatsSource('msg',$year,$month); |
|
1236 | + $msg = $Stats->getStatsSource('msg', $year, $month); |
|
1237 | 1237 | } elseif ($type == 'marine') { |
1238 | - $msg = $Stats->getStatsSource('msg_marine',$year,$month); |
|
1238 | + $msg = $Stats->getStatsSource('msg_marine', $year, $month); |
|
1239 | 1239 | } elseif ($type == 'tracker') { |
1240 | - $msg = $Stats->getStatsSource('msg_tracker',$year,$month); |
|
1240 | + $msg = $Stats->getStatsSource('msg_tracker', $year, $month); |
|
1241 | 1241 | } |
1242 | 1242 | } |
1243 | 1243 | if (!empty($msg)) { |
@@ -1245,13 +1245,13 @@ discard block |
||
1245 | 1245 | foreach ($msg as $eachmsg) { |
1246 | 1246 | //$eachmsg = $msg[0]; |
1247 | 1247 | $data = $eachmsg['source_data']; |
1248 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
1248 | + if ($data > 500) $max = (round(($data + 100)/100))*100; |
|
1249 | 1249 | else $max = 500; |
1250 | 1250 | ?> |
1251 | - <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
1251 | + <div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
1252 | 1252 | <script> |
1253 | 1253 | var g = new JustGage({ |
1254 | - id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>", |
|
1254 | + id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>", |
|
1255 | 1255 | value: <?php echo $data; ?>, |
1256 | 1256 | min: 0, |
1257 | 1257 | max: <?php print $max; ?>, |
@@ -1273,19 +1273,19 @@ discard block |
||
1273 | 1273 | //$hist = $Stats->getStatsSource(date('Y-m-d'),'hist'); |
1274 | 1274 | if ($year == '' && $month == '') { |
1275 | 1275 | if ($type == 'aircraft') { |
1276 | - $hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d')); |
|
1276 | + $hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d')); |
|
1277 | 1277 | } elseif ($type == 'marine') { |
1278 | - $hist = $Stats->getStatsSource('hist_marine',date('Y'),date('m'),date('d')); |
|
1278 | + $hist = $Stats->getStatsSource('hist_marine', date('Y'), date('m'), date('d')); |
|
1279 | 1279 | } elseif ($type == 'tracker') { |
1280 | - $hist = $Stats->getStatsSource('hist_tracker',date('Y'),date('m'),date('d')); |
|
1280 | + $hist = $Stats->getStatsSource('hist_tracker', date('Y'), date('m'), date('d')); |
|
1281 | 1281 | } |
1282 | 1282 | } else { |
1283 | 1283 | if ($type == 'aircraft') { |
1284 | - $hist = $Stats->getStatsSource('hist',$year,$month); |
|
1284 | + $hist = $Stats->getStatsSource('hist', $year, $month); |
|
1285 | 1285 | } elseif ($type == 'marine') { |
1286 | - $hist = $Stats->getStatsSource('hist_marine',$year,$month); |
|
1286 | + $hist = $Stats->getStatsSource('hist_marine', $year, $month); |
|
1287 | 1287 | } elseif ($type == 'tracker') { |
1288 | - $hist = $Stats->getStatsSource('hist_tracker',$year,$month); |
|
1288 | + $hist = $Stats->getStatsSource('hist_tracker', $year, $month); |
|
1289 | 1289 | } |
1290 | 1290 | } |
1291 | 1291 | foreach ($hist as $hists) { |
@@ -1295,7 +1295,7 @@ discard block |
||
1295 | 1295 | $source = $hists['source_name']; |
1296 | 1296 | $hist_array = json_decode($hists['source_data']); |
1297 | 1297 | $unit = 'km'; |
1298 | - foreach($hist_array as $distance => $nb) { |
|
1298 | + foreach ($hist_array as $distance => $nb) { |
|
1299 | 1299 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
1300 | 1300 | $distance = round($distance*0.539957); |
1301 | 1301 | $unit = 'nm'; |
@@ -1315,18 +1315,18 @@ discard block |
||
1315 | 1315 | $nb_data = "['flights',".substr($nb_data, 0, -1)."]"; |
1316 | 1316 | ?> |
1317 | 1317 | <div class="col-md-6"> |
1318 | - <h2><?php echo sprintf(_("Distance for %s"),$source); ?></h2> |
|
1318 | + <h2><?php echo sprintf(_("Distance for %s"), $source); ?></h2> |
|
1319 | 1319 | <?php |
1320 | - print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
1320 | + print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
1321 | 1321 | print 'c3.generate({ |
1322 | - bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'", |
|
1322 | + bindto: "#charthist-'.str_replace(' ', '_', strtolower($source)).'", |
|
1323 | 1323 | data: { x: "x", |
1324 | 1324 | columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}}, |
1325 | 1325 | axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});'; |
1326 | 1326 | print '</script>'; |
1327 | 1327 | ?> |
1328 | 1328 | </div> |
1329 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1329 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1330 | 1330 | <?php |
1331 | 1331 | } |
1332 | 1332 | ?> |
@@ -18,11 +18,15 @@ discard block |
||
18 | 18 | require_once('require/class.Spotter.php'); |
19 | 19 | } |
20 | 20 | |
21 | -if (!isset($filter_name)) $filter_name = ''; |
|
21 | +if (!isset($filter_name)) { |
|
22 | + $filter_name = ''; |
|
23 | +} |
|
22 | 24 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
23 | 25 | if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) { |
24 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
25 | -} |
|
26 | + if (isset($globalFilter['airline'])) { |
|
27 | + $airline_icao = $globalFilter['airline'][0]; |
|
28 | + } |
|
29 | + } |
|
26 | 30 | if ($type == 'aircraft' && $airline_icao != '' && $airline_icao != 'all') { |
27 | 31 | $Spotter = new Spotter(); |
28 | 32 | $airline_info = $Spotter->getAllAirlineInfo($airline_icao); |
@@ -61,7 +65,12 @@ discard block |
||
61 | 65 | <script type="text/javascript" src="<?php echo $globalURL; ?>/js/datamaps.world.min.js"></script> |
62 | 66 | <div class="column"> |
63 | 67 | <div class="info"> |
64 | - <h1><?php if (isset($airline_name)) echo _("Statistics for ").$airline_name; else echo _("Statistics"); ?></h1> |
|
68 | + <h1><?php if (isset($airline_name)) { |
|
69 | + echo _("Statistics for ").$airline_name; |
|
70 | +} else { |
|
71 | + echo _("Statistics"); |
|
72 | +} |
|
73 | +?></h1> |
|
65 | 74 | <?php |
66 | 75 | if ($type == 'aircraft') { |
67 | 76 | $last_update = $Stats->getLastStatsUpdate(); |
@@ -69,7 +78,9 @@ discard block |
||
69 | 78 | if (isset($last_update[0]['value'])) { |
70 | 79 | date_default_timezone_set('UTC'); |
71 | 80 | $lastupdate = strtotime($last_update[0]['value']); |
72 | - if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
|
81 | + if (isset($globalTimezone) && $globalTimezone != '') { |
|
82 | + date_default_timezone_set($globalTimezone); |
|
83 | + } |
|
73 | 84 | print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
74 | 85 | } |
75 | 86 | } |
@@ -154,8 +165,11 @@ discard block |
||
154 | 165 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
155 | 166 | $aircraft_data = ''; |
156 | 167 | foreach($aircraft_array as $aircraft_item) { |
157 | - if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
158 | - else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
168 | + if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') { |
|
169 | + $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
170 | + } else { |
|
171 | + $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
172 | + } |
|
159 | 173 | } |
160 | 174 | $aircraft_data = substr($aircraft_data, 0, -1); |
161 | 175 | print 'var series = ['.$aircraft_data.'];'; |
@@ -172,11 +186,17 @@ discard block |
||
172 | 186 | <?php |
173 | 187 | if ($year != '' && $month != '') { |
174 | 188 | ?> |
175 | - <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
189 | + <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
190 | + echo '/'.$airline_icao; |
|
191 | +} |
|
192 | +?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
176 | 193 | <?php |
177 | 194 | } else { |
178 | 195 | ?> |
179 | - <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
196 | + <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
197 | + echo '/'.$airline_icao; |
|
198 | +} |
|
199 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
180 | 200 | <?php |
181 | 201 | } |
182 | 202 | ?> |
@@ -205,11 +225,15 @@ discard block |
||
205 | 225 | print '</script>'; |
206 | 226 | if ($year != '' && $month != '') { |
207 | 227 | print '<div class="more"><a href="'.$globalURL.'/statistics/airline'; |
208 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
228 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
229 | + echo '/'.$airline_icao; |
|
230 | + } |
|
209 | 231 | print '/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
210 | 232 | } else { |
211 | 233 | print '<div class="more"><a href="'.$globalURL.'/statistics/airline'; |
212 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
234 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
235 | + echo '/'.$airline_icao; |
|
236 | + } |
|
213 | 237 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
214 | 238 | } |
215 | 239 | print '</div>'; |
@@ -229,8 +253,9 @@ discard block |
||
229 | 253 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
230 | 254 | <?php |
231 | 255 | $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month); |
232 | - if (count($marine_array) == 0) print _("No data available"); |
|
233 | - else { |
|
256 | + if (count($marine_array) == 0) { |
|
257 | + print _("No data available"); |
|
258 | + } else { |
|
234 | 259 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
235 | 260 | $marine_data = ''; |
236 | 261 | foreach($marine_array as $marine_item) { |
@@ -274,8 +299,9 @@ discard block |
||
274 | 299 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
275 | 300 | <?php |
276 | 301 | $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month); |
277 | - if (count($tracker_array) == 0) print _("No data available"); |
|
278 | - else { |
|
302 | + if (count($tracker_array) == 0) { |
|
303 | + print _("No data available"); |
|
304 | + } else { |
|
279 | 305 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
280 | 306 | $tracker_data = ''; |
281 | 307 | foreach($tracker_array as $tracker_item) { |
@@ -328,8 +354,9 @@ discard block |
||
328 | 354 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
329 | 355 | <?php |
330 | 356 | $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
331 | - if (count($pilot_array) == 0) print _("No data available"); |
|
332 | - else { |
|
357 | + if (count($pilot_array) == 0) { |
|
358 | + print _("No data available"); |
|
359 | + } else { |
|
333 | 360 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
334 | 361 | $pilot_data = ''; |
335 | 362 | foreach($pilot_array as $pilot_item) { |
@@ -347,7 +374,9 @@ discard block |
||
347 | 374 | } |
348 | 375 | print '<div class="more">'; |
349 | 376 | print '<a href="'.$globalURL.'/statistics/pilot'; |
350 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
377 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
378 | + echo '/'.$airline_icao; |
|
379 | + } |
|
351 | 380 | print'" class="btn btn-default btn" role="button">'._("See full statistic").'»</a>'; |
352 | 381 | print '</div>'; |
353 | 382 | ?> |
@@ -363,8 +392,9 @@ discard block |
||
363 | 392 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
364 | 393 | <?php |
365 | 394 | $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
366 | - if (count($owner_array) == 0) print _("No data available"); |
|
367 | - else { |
|
395 | + if (count($owner_array) == 0) { |
|
396 | + print _("No data available"); |
|
397 | + } else { |
|
368 | 398 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
369 | 399 | $owner_data = ''; |
370 | 400 | foreach($owner_array as $owner_item) { |
@@ -382,7 +412,10 @@ discard block |
||
382 | 412 | } |
383 | 413 | ?> |
384 | 414 | <div class="more"> |
385 | - <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
415 | + <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
416 | + echo '/'.$airline_icao; |
|
417 | +} |
|
418 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
386 | 419 | </div> |
387 | 420 | </div> |
388 | 421 | |
@@ -395,8 +428,9 @@ discard block |
||
395 | 428 | <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2> |
396 | 429 | <?php |
397 | 430 | //$flightover_array = $Stats->countAllFlightOverCountries(); |
398 | - if (count($flightover_array) == 0) print _("No data available"); |
|
399 | - else { |
|
431 | + if (count($flightover_array) == 0) { |
|
432 | + print _("No data available"); |
|
433 | + } else { |
|
400 | 434 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
401 | 435 | print 'var series = ['; |
402 | 436 | $flightover_data = ''; |
@@ -438,7 +472,10 @@ discard block |
||
438 | 472 | } |
439 | 473 | ?> |
440 | 474 | <div class="more"> |
441 | - <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
475 | + <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
476 | + echo '/'.$airline_icao; |
|
477 | +} |
|
478 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
442 | 479 | </div> |
443 | 480 | </div> |
444 | 481 | <?php |
@@ -456,8 +493,9 @@ discard block |
||
456 | 493 | <div class="col-md-6"> |
457 | 494 | <h2><?php echo _("Top 20 Most Common Country a Vessel was inside"); ?></h2> |
458 | 495 | <?php |
459 | - if (count($flightover_array) == 0) print _("No data available"); |
|
460 | - else { |
|
496 | + if (count($flightover_array) == 0) { |
|
497 | + print _("No data available"); |
|
498 | + } else { |
|
461 | 499 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
462 | 500 | print 'var series = ['; |
463 | 501 | $flightover_data = ''; |
@@ -513,8 +551,9 @@ discard block |
||
513 | 551 | <div class="col-md-6"> |
514 | 552 | <h2><?php echo _("Top 20 Most Common Country a Tracker was inside"); ?></h2> |
515 | 553 | <?php |
516 | - if (count($flightover_array) == 0) print _("No data available"); |
|
517 | - else { |
|
554 | + if (count($flightover_array) == 0) { |
|
555 | + print _("No data available"); |
|
556 | + } else { |
|
518 | 557 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
519 | 558 | print 'var series = ['; |
520 | 559 | $flightover_data = ''; |
@@ -620,7 +659,9 @@ discard block |
||
620 | 659 | });"; |
621 | 660 | print '</script>'; |
622 | 661 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure'; |
623 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
662 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
663 | + echo '/'.$airline_icao; |
|
664 | + } |
|
624 | 665 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
625 | 666 | } |
626 | 667 | ?> |
@@ -682,7 +723,9 @@ discard block |
||
682 | 723 | });"; |
683 | 724 | print '</script>'; |
684 | 725 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival'; |
685 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
726 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
727 | + echo '/'.$airline_icao; |
|
728 | + } |
|
686 | 729 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
687 | 730 | } |
688 | 731 | ?> |
@@ -701,8 +744,9 @@ discard block |
||
701 | 744 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
702 | 745 | <?php |
703 | 746 | $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
704 | - if (count($year_array) == 0) print _("No data available"); |
|
705 | - else { |
|
747 | + if (count($year_array) == 0) { |
|
748 | + print _("No data available"); |
|
749 | + } else { |
|
706 | 750 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
707 | 751 | $year_data = ''; |
708 | 752 | $year_cnt = ''; |
@@ -721,7 +765,10 @@ discard block |
||
721 | 765 | } |
722 | 766 | ?> |
723 | 767 | <div class="more"> |
724 | - <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
768 | + <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
769 | + echo '/'.$airline_icao; |
|
770 | +} |
|
771 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
725 | 772 | </div> |
726 | 773 | </div> |
727 | 774 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -729,8 +776,9 @@ discard block |
||
729 | 776 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
730 | 777 | <?php |
731 | 778 | $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
732 | - if (count($month_array) == 0) print _("No data available"); |
|
733 | - else { |
|
779 | + if (count($month_array) == 0) { |
|
780 | + print _("No data available"); |
|
781 | + } else { |
|
734 | 782 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
735 | 783 | $month_data = ''; |
736 | 784 | $month_cnt = ''; |
@@ -749,7 +797,10 @@ discard block |
||
749 | 797 | } |
750 | 798 | ?> |
751 | 799 | <div class="more"> |
752 | - <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
800 | + <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
801 | + echo '/'.$airline_icao; |
|
802 | +} |
|
803 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
753 | 804 | </div> |
754 | 805 | </div> |
755 | 806 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -758,8 +809,9 @@ discard block |
||
758 | 809 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
759 | 810 | <?php |
760 | 811 | $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
761 | - if (empty($date_array)) print _("No data available"); |
|
762 | - else { |
|
812 | + if (empty($date_array)) { |
|
813 | + print _("No data available"); |
|
814 | + } else { |
|
763 | 815 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
764 | 816 | $date_data = ''; |
765 | 817 | $date_cnt = ''; |
@@ -778,7 +830,10 @@ discard block |
||
778 | 830 | } |
779 | 831 | ?> |
780 | 832 | <div class="more"> |
781 | - <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
833 | + <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
834 | + echo '/'.$airline_icao; |
|
835 | +} |
|
836 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
782 | 837 | </div> |
783 | 838 | </div> |
784 | 839 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -786,8 +841,9 @@ discard block |
||
786 | 841 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
787 | 842 | <?php |
788 | 843 | $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
789 | - if (empty($hour_array)) print _("No data available"); |
|
790 | - else { |
|
844 | + if (empty($hour_array)) { |
|
845 | + print _("No data available"); |
|
846 | + } else { |
|
791 | 847 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
792 | 848 | $hour_data = ''; |
793 | 849 | $hour_cnt = ''; |
@@ -806,7 +862,10 @@ discard block |
||
806 | 862 | } |
807 | 863 | ?> |
808 | 864 | <div class="more"> |
809 | - <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
865 | + <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
866 | + echo '/'.$airline_icao; |
|
867 | +} |
|
868 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
810 | 869 | </div> |
811 | 870 | </div> |
812 | 871 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -826,8 +885,9 @@ discard block |
||
826 | 885 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
827 | 886 | <?php |
828 | 887 | $year_array = $Marine->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
829 | - if (count($year_array) == 0) print _("No data available"); |
|
830 | - else { |
|
888 | + if (count($year_array) == 0) { |
|
889 | + print _("No data available"); |
|
890 | + } else { |
|
831 | 891 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
832 | 892 | $year_data = ''; |
833 | 893 | $year_cnt = ''; |
@@ -855,8 +915,9 @@ discard block |
||
855 | 915 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
856 | 916 | <?php |
857 | 917 | $month_array = $Marine->countAllDatesLastMonth($airline_icao,$filter_name); |
858 | - if (count($month_array) == 0) print _("No data available"); |
|
859 | - else { |
|
918 | + if (count($month_array) == 0) { |
|
919 | + print _("No data available"); |
|
920 | + } else { |
|
860 | 921 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
861 | 922 | $month_data = ''; |
862 | 923 | $month_cnt = ''; |
@@ -884,8 +945,9 @@ discard block |
||
884 | 945 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
885 | 946 | <?php |
886 | 947 | $date_array = $Marine->countAllDatesLast7Days($airline_icao,$filter_name); |
887 | - if (empty($date_array)) print _("No data available"); |
|
888 | - else { |
|
948 | + if (empty($date_array)) { |
|
949 | + print _("No data available"); |
|
950 | + } else { |
|
889 | 951 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
890 | 952 | $date_data = ''; |
891 | 953 | $date_cnt = ''; |
@@ -912,8 +974,9 @@ discard block |
||
912 | 974 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
913 | 975 | <?php |
914 | 976 | $hour_array = $Marine->countAllHours('hour',true,$airline_icao,$filter_name); |
915 | - if (empty($hour_array)) print _("No data available"); |
|
916 | - else { |
|
977 | + if (empty($hour_array)) { |
|
978 | + print _("No data available"); |
|
979 | + } else { |
|
917 | 980 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
918 | 981 | $hour_data = ''; |
919 | 982 | $hour_cnt = ''; |
@@ -952,8 +1015,9 @@ discard block |
||
952 | 1015 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
953 | 1016 | <?php |
954 | 1017 | $year_array = $Tracker->countAllMonthsLastYear(true); |
955 | - if (count($year_array) == 0) print _("No data available"); |
|
956 | - else { |
|
1018 | + if (count($year_array) == 0) { |
|
1019 | + print _("No data available"); |
|
1020 | + } else { |
|
957 | 1021 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
958 | 1022 | $year_data = ''; |
959 | 1023 | $year_cnt = ''; |
@@ -981,8 +1045,9 @@ discard block |
||
981 | 1045 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
982 | 1046 | <?php |
983 | 1047 | $month_array = $Tracker->countAllDatesLastMonth(); |
984 | - if (count($month_array) == 0) print _("No data available"); |
|
985 | - else { |
|
1048 | + if (count($month_array) == 0) { |
|
1049 | + print _("No data available"); |
|
1050 | + } else { |
|
986 | 1051 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
987 | 1052 | $month_data = ''; |
988 | 1053 | $month_cnt = ''; |
@@ -1010,8 +1075,9 @@ discard block |
||
1010 | 1075 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
1011 | 1076 | <?php |
1012 | 1077 | $date_array = $Tracker->countAllDatesLast7Days(); |
1013 | - if (empty($date_array)) print _("No data available"); |
|
1014 | - else { |
|
1078 | + if (empty($date_array)) { |
|
1079 | + print _("No data available"); |
|
1080 | + } else { |
|
1015 | 1081 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
1016 | 1082 | $date_data = ''; |
1017 | 1083 | $date_cnt = ''; |
@@ -1038,8 +1104,9 @@ discard block |
||
1038 | 1104 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
1039 | 1105 | <?php |
1040 | 1106 | $hour_array = $Tracker->countAllHours('hour',true); |
1041 | - if (empty($hour_array)) print _("No data available"); |
|
1042 | - else { |
|
1107 | + if (empty($hour_array)) { |
|
1108 | + print _("No data available"); |
|
1109 | + } else { |
|
1043 | 1110 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
1044 | 1111 | $hour_data = ''; |
1045 | 1112 | $hour_cnt = ''; |
@@ -1078,8 +1145,9 @@ discard block |
||
1078 | 1145 | <h2><?php echo _("Fatalities by Years"); ?></h2> |
1079 | 1146 | <?php |
1080 | 1147 | $year_array = $Stats->countFatalitiesByYear(); |
1081 | - if (count($year_array) == 0) print _("No data available"); |
|
1082 | - else { |
|
1148 | + if (count($year_array) == 0) { |
|
1149 | + print _("No data available"); |
|
1150 | + } else { |
|
1083 | 1151 | print '<div id="chart32" class="chart" width="100%"></div><script>'; |
1084 | 1152 | $year_data = ''; |
1085 | 1153 | $year_cnt = ''; |
@@ -1108,8 +1176,9 @@ discard block |
||
1108 | 1176 | <h2><?php echo _("Fatalities last 12 Months"); ?></h2> |
1109 | 1177 | <?php |
1110 | 1178 | $year_array = $Stats->countFatalitiesLast12Months(); |
1111 | - if (count($year_array) == 0) print _("No data available"); |
|
1112 | - else { |
|
1179 | + if (count($year_array) == 0) { |
|
1180 | + print _("No data available"); |
|
1181 | + } else { |
|
1113 | 1182 | print '<div id="chart33" class="chart" width="100%"></div><script>'; |
1114 | 1183 | $year_data = ''; |
1115 | 1184 | $year_cnt = ''; |
@@ -1180,8 +1249,11 @@ discard block |
||
1180 | 1249 | $distance = $distance; |
1181 | 1250 | $unit = 'km'; |
1182 | 1251 | } |
1183 | - if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
1184 | - else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
1252 | + if (!isset($polar_data)) { |
|
1253 | + $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
1254 | + } else { |
|
1255 | + $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
1256 | + } |
|
1185 | 1257 | } |
1186 | 1258 | ?> |
1187 | 1259 | <div class="col-md-6"> |
@@ -1245,9 +1317,12 @@ discard block |
||
1245 | 1317 | foreach ($msg as $eachmsg) { |
1246 | 1318 | //$eachmsg = $msg[0]; |
1247 | 1319 | $data = $eachmsg['source_data']; |
1248 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
1249 | - else $max = 500; |
|
1250 | -?> |
|
1320 | + if ($data > 500) { |
|
1321 | + $max = (round(($data+100)/100))*100; |
|
1322 | + } else { |
|
1323 | + $max = 500; |
|
1324 | + } |
|
1325 | + ?> |
|
1251 | 1326 | <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
1252 | 1327 | <script> |
1253 | 1328 | var g = new JustGage({ |