@@ -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 | } |
@@ -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' ?> --> |