|
@@ 3687-3726 (lines=40) @@
|
| 3684 |
|
* @return Array the airline country list |
| 3685 |
|
* |
| 3686 |
|
*/ |
| 3687 |
|
public function countAllAirlineCountriesByDate($date) |
| 3688 |
|
{ |
| 3689 |
|
global $globalTimezone, $globalDBdriver; |
| 3690 |
|
$date = filter_var($date,FILTER_SANITIZE_STRING); |
| 3691 |
|
if ($globalTimezone != '') { |
| 3692 |
|
date_default_timezone_set($globalTimezone); |
| 3693 |
|
$datetime = new DateTime($date); |
| 3694 |
|
$offset = $datetime->format('P'); |
| 3695 |
|
} else $offset = '+00:00'; |
| 3696 |
|
|
| 3697 |
|
if ($globalDBdriver == 'mysql') { |
| 3698 |
|
$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
| 3699 |
|
FROM spotter_output |
| 3700 |
|
WHERE spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 3701 |
|
GROUP BY spotter_output.airline_country |
| 3702 |
|
ORDER BY airline_country_count DESC |
| 3703 |
|
LIMIT 10 OFFSET 0"; |
| 3704 |
|
} else { |
| 3705 |
|
$query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
| 3706 |
|
FROM spotter_output |
| 3707 |
|
WHERE spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 3708 |
|
GROUP BY spotter_output.airline_country |
| 3709 |
|
ORDER BY airline_country_count DESC |
| 3710 |
|
LIMIT 10 OFFSET 0"; |
| 3711 |
|
} |
| 3712 |
|
|
| 3713 |
|
$sth = $this->db->prepare($query); |
| 3714 |
|
$sth->execute(array(':date' => $date, ':offset' => $offset)); |
| 3715 |
|
|
| 3716 |
|
$airline_country_array = array(); |
| 3717 |
|
$temp_array = array(); |
| 3718 |
|
while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 3719 |
|
{ |
| 3720 |
|
$temp_array['airline_country_count'] = $row['airline_country_count']; |
| 3721 |
|
$temp_array['airline_country'] = $row['airline_country']; |
| 3722 |
|
|
| 3723 |
|
$airline_country_array[] = $temp_array; |
| 3724 |
|
} |
| 3725 |
|
return $airline_country_array; |
| 3726 |
|
} |
| 3727 |
|
|
| 3728 |
|
|
| 3729 |
|
/** |
|
@@ 4490-4528 (lines=39) @@
|
| 4487 |
|
* @return Array the aircraft manufacturer list |
| 4488 |
|
* |
| 4489 |
|
*/ |
| 4490 |
|
public function countAllAircraftManufacturerByDate($date) |
| 4491 |
|
{ |
| 4492 |
|
global $globalTimezone, $globalDBdriver; |
| 4493 |
|
$date = filter_var($date,FILTER_SANITIZE_STRING); |
| 4494 |
|
if ($globalTimezone != '') { |
| 4495 |
|
date_default_timezone_set($globalTimezone); |
| 4496 |
|
$datetime = new DateTime($date); |
| 4497 |
|
$offset = $datetime->format('P'); |
| 4498 |
|
} else $offset = '+00:00'; |
| 4499 |
|
|
| 4500 |
|
if ($globalDBdriver == 'mysql') { |
| 4501 |
|
$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
| 4502 |
|
FROM spotter_output |
| 4503 |
|
WHERE spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 4504 |
|
GROUP BY spotter_output.aircraft_manufacturer |
| 4505 |
|
ORDER BY aircraft_manufacturer_count DESC"; |
| 4506 |
|
} else { |
| 4507 |
|
$query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
| 4508 |
|
FROM spotter_output |
| 4509 |
|
WHERE spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 4510 |
|
GROUP BY spotter_output.aircraft_manufacturer |
| 4511 |
|
ORDER BY aircraft_manufacturer_count DESC"; |
| 4512 |
|
} |
| 4513 |
|
|
| 4514 |
|
$sth = $this->db->prepare($query); |
| 4515 |
|
$sth->execute(array(':date' => $date, ':offset' => $offset)); |
| 4516 |
|
|
| 4517 |
|
$aircraft_array = array(); |
| 4518 |
|
$temp_array = array(); |
| 4519 |
|
|
| 4520 |
|
while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 4521 |
|
{ |
| 4522 |
|
$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 4523 |
|
$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
| 4524 |
|
|
| 4525 |
|
$aircraft_array[] = $temp_array; |
| 4526 |
|
} |
| 4527 |
|
return $aircraft_array; |
| 4528 |
|
} |
| 4529 |
|
|
| 4530 |
|
|
| 4531 |
|
/** |
|
@@ 5512-5550 (lines=39) @@
|
| 5509 |
|
* @return Array the airport list |
| 5510 |
|
* |
| 5511 |
|
*/ |
| 5512 |
|
public function countAllDepartureAirportCountriesByDate($date) |
| 5513 |
|
{ |
| 5514 |
|
global $globalTimezone, $globalDBdriver; |
| 5515 |
|
$date = filter_var($date,FILTER_SANITIZE_STRING); |
| 5516 |
|
if ($globalTimezone != '') { |
| 5517 |
|
date_default_timezone_set($globalTimezone); |
| 5518 |
|
$datetime = new DateTime($date); |
| 5519 |
|
$offset = $datetime->format('P'); |
| 5520 |
|
} else $offset = '+00:00'; |
| 5521 |
|
|
| 5522 |
|
if ($globalDBdriver == 'mysql') { |
| 5523 |
|
$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
| 5524 |
|
FROM spotter_output |
| 5525 |
|
WHERE spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 5526 |
|
GROUP BY spotter_output.departure_airport_country |
| 5527 |
|
ORDER BY airport_departure_country_count DESC"; |
| 5528 |
|
} else { |
| 5529 |
|
$query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
| 5530 |
|
FROM spotter_output |
| 5531 |
|
WHERE spotter_output.departure_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 5532 |
|
GROUP BY spotter_output.departure_airport_country |
| 5533 |
|
ORDER BY airport_departure_country_count DESC"; |
| 5534 |
|
} |
| 5535 |
|
|
| 5536 |
|
$sth = $this->db->prepare($query); |
| 5537 |
|
$sth->execute(array(':date' => $date, ':offset' => $offset)); |
| 5538 |
|
|
| 5539 |
|
$airport_array = array(); |
| 5540 |
|
$temp_array = array(); |
| 5541 |
|
|
| 5542 |
|
while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 5543 |
|
{ |
| 5544 |
|
$temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 5545 |
|
$temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
| 5546 |
|
|
| 5547 |
|
$airport_array[] = $temp_array; |
| 5548 |
|
} |
| 5549 |
|
return $airport_array; |
| 5550 |
|
} |
| 5551 |
|
|
| 5552 |
|
|
| 5553 |
|
|
|
@@ 6254-6292 (lines=39) @@
|
| 6251 |
|
* @return Array the airport list |
| 6252 |
|
* |
| 6253 |
|
*/ |
| 6254 |
|
public function countAllArrivalAirportCountriesByDate($date) |
| 6255 |
|
{ |
| 6256 |
|
global $globalTimezone, $globalDBdriver; |
| 6257 |
|
$date = filter_var($date,FILTER_SANITIZE_STRING); |
| 6258 |
|
if ($globalTimezone != '') { |
| 6259 |
|
date_default_timezone_set($globalTimezone); |
| 6260 |
|
$datetime = new DateTime($date); |
| 6261 |
|
$offset = $datetime->format('P'); |
| 6262 |
|
} else $offset = '+00:00'; |
| 6263 |
|
|
| 6264 |
|
if ($globalDBdriver == 'mysql') { |
| 6265 |
|
$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
| 6266 |
|
FROM spotter_output |
| 6267 |
|
WHERE spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 6268 |
|
GROUP BY spotter_output.arrival_airport_country |
| 6269 |
|
ORDER BY airport_arrival_country_count DESC"; |
| 6270 |
|
} else { |
| 6271 |
|
$query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
| 6272 |
|
FROM spotter_output |
| 6273 |
|
WHERE spotter_output.arrival_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 6274 |
|
GROUP BY spotter_output.arrival_airport_country |
| 6275 |
|
ORDER BY airport_arrival_country_count DESC"; |
| 6276 |
|
} |
| 6277 |
|
|
| 6278 |
|
$sth = $this->db->prepare($query); |
| 6279 |
|
$sth->execute(array(':date' => $date, ':offset' => $offset)); |
| 6280 |
|
|
| 6281 |
|
$airport_array = array(); |
| 6282 |
|
$temp_array = array(); |
| 6283 |
|
|
| 6284 |
|
while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 6285 |
|
{ |
| 6286 |
|
$temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 6287 |
|
$temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
| 6288 |
|
|
| 6289 |
|
$airport_array[] = $temp_array; |
| 6290 |
|
} |
| 6291 |
|
return $airport_array; |
| 6292 |
|
} |
| 6293 |
|
|
| 6294 |
|
|
| 6295 |
|
|
|
@@ 7598-7638 (lines=41) @@
|
| 7595 |
|
* @return Array the hour list |
| 7596 |
|
* |
| 7597 |
|
*/ |
| 7598 |
|
public function countAllHoursByAirline($airline_icao) |
| 7599 |
|
{ |
| 7600 |
|
global $globalTimezone, $globalDBdriver; |
| 7601 |
|
if ($globalTimezone != '') { |
| 7602 |
|
date_default_timezone_set($globalTimezone); |
| 7603 |
|
$datetime = new DateTime(); |
| 7604 |
|
$offset = $datetime->format('P'); |
| 7605 |
|
} else $offset = '+00:00'; |
| 7606 |
|
|
| 7607 |
|
$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
| 7608 |
|
|
| 7609 |
|
if ($globalDBdriver == 'mysql') { |
| 7610 |
|
$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
| 7611 |
|
FROM spotter_output |
| 7612 |
|
WHERE spotter_output.airline_icao = :airline_icao |
| 7613 |
|
GROUP BY hour_name |
| 7614 |
|
ORDER BY hour_name ASC"; |
| 7615 |
|
} else { |
| 7616 |
|
$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
| 7617 |
|
FROM spotter_output |
| 7618 |
|
WHERE spotter_output.airline_icao = :airline_icao |
| 7619 |
|
GROUP BY hour_name |
| 7620 |
|
ORDER BY hour_name ASC"; |
| 7621 |
|
} |
| 7622 |
|
|
| 7623 |
|
$sth = $this->db->prepare($query); |
| 7624 |
|
$sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset)); |
| 7625 |
|
|
| 7626 |
|
$hour_array = array(); |
| 7627 |
|
$temp_array = array(); |
| 7628 |
|
|
| 7629 |
|
while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 7630 |
|
{ |
| 7631 |
|
$temp_array['hour_name'] = $row['hour_name']; |
| 7632 |
|
$temp_array['hour_count'] = $row['hour_count']; |
| 7633 |
|
|
| 7634 |
|
$hour_array[] = $temp_array; |
| 7635 |
|
} |
| 7636 |
|
|
| 7637 |
|
return $hour_array; |
| 7638 |
|
} |
| 7639 |
|
|
| 7640 |
|
|
| 7641 |
|
|
|
@@ 7649-7688 (lines=40) @@
|
| 7646 |
|
* @return Array the hour list |
| 7647 |
|
* |
| 7648 |
|
*/ |
| 7649 |
|
public function countAllHoursByAircraft($aircraft_icao) |
| 7650 |
|
{ |
| 7651 |
|
global $globalTimezone, $globalDBdriver; |
| 7652 |
|
$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
| 7653 |
|
if ($globalTimezone != '') { |
| 7654 |
|
date_default_timezone_set($globalTimezone); |
| 7655 |
|
$datetime = new DateTime(); |
| 7656 |
|
$offset = $datetime->format('P'); |
| 7657 |
|
} else $offset = '+00:00'; |
| 7658 |
|
|
| 7659 |
|
if ($globalDBdriver == 'mysql') { |
| 7660 |
|
$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
| 7661 |
|
FROM spotter_output |
| 7662 |
|
WHERE spotter_output.aircraft_icao = :aircraft_icao |
| 7663 |
|
GROUP BY hour_name |
| 7664 |
|
ORDER BY hour_name ASC"; |
| 7665 |
|
} else { |
| 7666 |
|
$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
| 7667 |
|
FROM spotter_output |
| 7668 |
|
WHERE spotter_output.aircraft_icao = :aircraft_icao |
| 7669 |
|
GROUP BY hour_name |
| 7670 |
|
ORDER BY hour_name ASC"; |
| 7671 |
|
} |
| 7672 |
|
|
| 7673 |
|
$sth = $this->db->prepare($query); |
| 7674 |
|
$sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset)); |
| 7675 |
|
|
| 7676 |
|
$hour_array = array(); |
| 7677 |
|
$temp_array = array(); |
| 7678 |
|
|
| 7679 |
|
while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 7680 |
|
{ |
| 7681 |
|
$temp_array['hour_name'] = $row['hour_name']; |
| 7682 |
|
$temp_array['hour_count'] = $row['hour_count']; |
| 7683 |
|
|
| 7684 |
|
$hour_array[] = $temp_array; |
| 7685 |
|
} |
| 7686 |
|
|
| 7687 |
|
return $hour_array; |
| 7688 |
|
} |
| 7689 |
|
|
| 7690 |
|
|
| 7691 |
|
/** |
|
@@ 7697-7736 (lines=40) @@
|
| 7694 |
|
* @return Array the hour list |
| 7695 |
|
* |
| 7696 |
|
*/ |
| 7697 |
|
public function countAllHoursByRegistration($registration) |
| 7698 |
|
{ |
| 7699 |
|
global $globalTimezone, $globalDBdriver; |
| 7700 |
|
$registration = filter_var($registration,FILTER_SANITIZE_STRING); |
| 7701 |
|
if ($globalTimezone != '') { |
| 7702 |
|
date_default_timezone_set($globalTimezone); |
| 7703 |
|
$datetime = new DateTime(); |
| 7704 |
|
$offset = $datetime->format('P'); |
| 7705 |
|
} else $offset = '+00:00'; |
| 7706 |
|
|
| 7707 |
|
if ($globalDBdriver == 'mysql') { |
| 7708 |
|
$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
| 7709 |
|
FROM spotter_output |
| 7710 |
|
WHERE spotter_output.registration = :registration |
| 7711 |
|
GROUP BY hour_name |
| 7712 |
|
ORDER BY hour_name ASC"; |
| 7713 |
|
} else { |
| 7714 |
|
$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
| 7715 |
|
FROM spotter_output |
| 7716 |
|
WHERE spotter_output.registration = :registration |
| 7717 |
|
GROUP BY hour_name |
| 7718 |
|
ORDER BY hour_name ASC"; |
| 7719 |
|
} |
| 7720 |
|
|
| 7721 |
|
$sth = $this->db->prepare($query); |
| 7722 |
|
$sth->execute(array(':registration' => $registration,':offset' => $offset)); |
| 7723 |
|
|
| 7724 |
|
$hour_array = array(); |
| 7725 |
|
$temp_array = array(); |
| 7726 |
|
|
| 7727 |
|
while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 7728 |
|
{ |
| 7729 |
|
$temp_array['hour_name'] = $row['hour_name']; |
| 7730 |
|
$temp_array['hour_count'] = $row['hour_count']; |
| 7731 |
|
|
| 7732 |
|
$hour_array[] = $temp_array; |
| 7733 |
|
} |
| 7734 |
|
|
| 7735 |
|
return $hour_array; |
| 7736 |
|
} |
| 7737 |
|
|
| 7738 |
|
|
| 7739 |
|
/** |
|
@@ 7745-7784 (lines=40) @@
|
| 7742 |
|
* @return Array the hour list |
| 7743 |
|
* |
| 7744 |
|
*/ |
| 7745 |
|
public function countAllHoursByAirport($airport_icao) |
| 7746 |
|
{ |
| 7747 |
|
global $globalTimezone, $globalDBdriver; |
| 7748 |
|
$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
| 7749 |
|
if ($globalTimezone != '') { |
| 7750 |
|
date_default_timezone_set($globalTimezone); |
| 7751 |
|
$datetime = new DateTime(); |
| 7752 |
|
$offset = $datetime->format('P'); |
| 7753 |
|
} else $offset = '+00:00'; |
| 7754 |
|
|
| 7755 |
|
if ($globalDBdriver == 'mysql') { |
| 7756 |
|
$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
| 7757 |
|
FROM spotter_output |
| 7758 |
|
WHERE (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 7759 |
|
GROUP BY hour_name |
| 7760 |
|
ORDER BY hour_name ASC"; |
| 7761 |
|
} else { |
| 7762 |
|
$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
| 7763 |
|
FROM spotter_output |
| 7764 |
|
WHERE (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 7765 |
|
GROUP BY hour_name |
| 7766 |
|
ORDER BY hour_name ASC"; |
| 7767 |
|
} |
| 7768 |
|
|
| 7769 |
|
$sth = $this->db->prepare($query); |
| 7770 |
|
$sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset)); |
| 7771 |
|
|
| 7772 |
|
$hour_array = array(); |
| 7773 |
|
$temp_array = array(); |
| 7774 |
|
|
| 7775 |
|
while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 7776 |
|
{ |
| 7777 |
|
$temp_array['hour_name'] = $row['hour_name']; |
| 7778 |
|
$temp_array['hour_count'] = $row['hour_count']; |
| 7779 |
|
|
| 7780 |
|
$hour_array[] = $temp_array; |
| 7781 |
|
} |
| 7782 |
|
|
| 7783 |
|
return $hour_array; |
| 7784 |
|
} |
| 7785 |
|
|
| 7786 |
|
|
| 7787 |
|
|
|
@@ 7794-7833 (lines=40) @@
|
| 7791 |
|
* @return Array the hour list |
| 7792 |
|
* |
| 7793 |
|
*/ |
| 7794 |
|
public function countAllHoursByManufacturer($aircraft_manufacturer) |
| 7795 |
|
{ |
| 7796 |
|
global $globalTimezone, $globalDBdriver; |
| 7797 |
|
$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
| 7798 |
|
if ($globalTimezone != '') { |
| 7799 |
|
date_default_timezone_set($globalTimezone); |
| 7800 |
|
$datetime = new DateTime(); |
| 7801 |
|
$offset = $datetime->format('P'); |
| 7802 |
|
} else $offset = '+00:00'; |
| 7803 |
|
|
| 7804 |
|
if ($globalDBdriver == 'mysql') { |
| 7805 |
|
$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
| 7806 |
|
FROM spotter_output |
| 7807 |
|
WHERE spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 7808 |
|
GROUP BY hour_name |
| 7809 |
|
ORDER BY hour_name ASC"; |
| 7810 |
|
} else { |
| 7811 |
|
$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
| 7812 |
|
FROM spotter_output |
| 7813 |
|
WHERE spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 7814 |
|
GROUP BY hour_name |
| 7815 |
|
ORDER BY hour_name ASC"; |
| 7816 |
|
} |
| 7817 |
|
|
| 7818 |
|
$sth = $this->db->prepare($query); |
| 7819 |
|
$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset)); |
| 7820 |
|
|
| 7821 |
|
$hour_array = array(); |
| 7822 |
|
$temp_array = array(); |
| 7823 |
|
|
| 7824 |
|
while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 7825 |
|
{ |
| 7826 |
|
$temp_array['hour_name'] = $row['hour_name']; |
| 7827 |
|
$temp_array['hour_count'] = $row['hour_count']; |
| 7828 |
|
|
| 7829 |
|
$hour_array[] = $temp_array; |
| 7830 |
|
} |
| 7831 |
|
|
| 7832 |
|
return $hour_array; |
| 7833 |
|
} |
| 7834 |
|
|
| 7835 |
|
|
| 7836 |
|
|
|
@@ 7843-7882 (lines=40) @@
|
| 7840 |
|
* @return Array the hour list |
| 7841 |
|
* |
| 7842 |
|
*/ |
| 7843 |
|
public function countAllHoursByDate($date) |
| 7844 |
|
{ |
| 7845 |
|
global $globalTimezone, $globalDBdriver; |
| 7846 |
|
$date = filter_var($date,FILTER_SANITIZE_STRING); |
| 7847 |
|
if ($globalTimezone != '') { |
| 7848 |
|
date_default_timezone_set($globalTimezone); |
| 7849 |
|
$datetime = new DateTime($date); |
| 7850 |
|
$offset = $datetime->format('P'); |
| 7851 |
|
} else $offset = '+00:00'; |
| 7852 |
|
|
| 7853 |
|
if ($globalDBdriver == 'mysql') { |
| 7854 |
|
$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
| 7855 |
|
FROM spotter_output |
| 7856 |
|
WHERE DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 7857 |
|
GROUP BY hour_name |
| 7858 |
|
ORDER BY hour_name ASC"; |
| 7859 |
|
} else { |
| 7860 |
|
$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
| 7861 |
|
FROM spotter_output |
| 7862 |
|
WHERE to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
| 7863 |
|
GROUP BY hour_name |
| 7864 |
|
ORDER BY hour_name ASC"; |
| 7865 |
|
} |
| 7866 |
|
|
| 7867 |
|
$sth = $this->db->prepare($query); |
| 7868 |
|
$sth->execute(array(':date' => $date, ':offset' => $offset)); |
| 7869 |
|
|
| 7870 |
|
$hour_array = array(); |
| 7871 |
|
$temp_array = array(); |
| 7872 |
|
|
| 7873 |
|
while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 7874 |
|
{ |
| 7875 |
|
$temp_array['hour_name'] = $row['hour_name']; |
| 7876 |
|
$temp_array['hour_count'] = $row['hour_count']; |
| 7877 |
|
|
| 7878 |
|
$hour_array[] = $temp_array; |
| 7879 |
|
} |
| 7880 |
|
|
| 7881 |
|
return $hour_array; |
| 7882 |
|
} |
| 7883 |
|
|
| 7884 |
|
|
| 7885 |
|
|
|
@@ 7892-7932 (lines=41) @@
|
| 7889 |
|
* @return Array the hour list |
| 7890 |
|
* |
| 7891 |
|
*/ |
| 7892 |
|
public function countAllHoursByIdent($ident) |
| 7893 |
|
{ |
| 7894 |
|
global $globalTimezone, $globalDBdriver; |
| 7895 |
|
$ident = filter_var($ident,FILTER_SANITIZE_STRING); |
| 7896 |
|
if ($globalTimezone != '') { |
| 7897 |
|
date_default_timezone_set($globalTimezone); |
| 7898 |
|
$datetime = new DateTime(); |
| 7899 |
|
$offset = $datetime->format('P'); |
| 7900 |
|
} else $offset = '+00:00'; |
| 7901 |
|
|
| 7902 |
|
if ($globalDBdriver == 'mysql') { |
| 7903 |
|
$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
| 7904 |
|
FROM spotter_output |
| 7905 |
|
WHERE spotter_output.ident = :ident |
| 7906 |
|
GROUP BY hour_name |
| 7907 |
|
ORDER BY hour_name ASC"; |
| 7908 |
|
} else { |
| 7909 |
|
$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
| 7910 |
|
FROM spotter_output |
| 7911 |
|
WHERE spotter_output.ident = :ident |
| 7912 |
|
GROUP BY hour_name |
| 7913 |
|
ORDER BY hour_name ASC"; |
| 7914 |
|
} |
| 7915 |
|
|
| 7916 |
|
|
| 7917 |
|
$sth = $this->db->prepare($query); |
| 7918 |
|
$sth->execute(array(':ident' => $ident,':offset' => $offset)); |
| 7919 |
|
|
| 7920 |
|
$hour_array = array(); |
| 7921 |
|
$temp_array = array(); |
| 7922 |
|
|
| 7923 |
|
while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 7924 |
|
{ |
| 7925 |
|
$temp_array['hour_name'] = $row['hour_name']; |
| 7926 |
|
$temp_array['hour_count'] = $row['hour_count']; |
| 7927 |
|
|
| 7928 |
|
$hour_array[] = $temp_array; |
| 7929 |
|
} |
| 7930 |
|
|
| 7931 |
|
return $hour_array; |
| 7932 |
|
} |
| 7933 |
|
|
| 7934 |
|
|
| 7935 |
|
|
|
@@ 7991-8030 (lines=40) @@
|
| 7988 |
|
* @return Array the hour list |
| 7989 |
|
* |
| 7990 |
|
*/ |
| 7991 |
|
public function countAllHoursByCountry($country) |
| 7992 |
|
{ |
| 7993 |
|
global $globalTimezone, $globalDBdriver; |
| 7994 |
|
$country = filter_var($country,FILTER_SANITIZE_STRING); |
| 7995 |
|
if ($globalTimezone != '') { |
| 7996 |
|
date_default_timezone_set($globalTimezone); |
| 7997 |
|
$datetime = new DateTime(); |
| 7998 |
|
$offset = $datetime->format('P'); |
| 7999 |
|
} else $offset = '+00:00'; |
| 8000 |
|
|
| 8001 |
|
if ($globalDBdriver == 'mysql') { |
| 8002 |
|
$query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
| 8003 |
|
FROM spotter_output |
| 8004 |
|
WHERE ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 8005 |
|
GROUP BY hour_name |
| 8006 |
|
ORDER BY hour_name ASC"; |
| 8007 |
|
} else { |
| 8008 |
|
$query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
| 8009 |
|
FROM spotter_output |
| 8010 |
|
WHERE ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 8011 |
|
GROUP BY hour_name |
| 8012 |
|
ORDER BY hour_name ASC"; |
| 8013 |
|
} |
| 8014 |
|
|
| 8015 |
|
$sth = $this->db->prepare($query); |
| 8016 |
|
$sth->execute(array(':country' => $country,':offset' => $offset)); |
| 8017 |
|
|
| 8018 |
|
$hour_array = array(); |
| 8019 |
|
$temp_array = array(); |
| 8020 |
|
|
| 8021 |
|
while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 8022 |
|
{ |
| 8023 |
|
$temp_array['hour_name'] = $row['hour_name']; |
| 8024 |
|
$temp_array['hour_count'] = $row['hour_count']; |
| 8025 |
|
|
| 8026 |
|
$hour_array[] = $temp_array; |
| 8027 |
|
} |
| 8028 |
|
|
| 8029 |
|
return $hour_array; |
| 8030 |
|
} |
| 8031 |
|
|
| 8032 |
|
|
| 8033 |
|
|