Conditions | 7 |
Paths | 36 |
Total Lines | 40 |
Code Lines | 27 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
3827 | public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
||
3828 | { |
||
3829 | global $globalDBdriver; |
||
3830 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
||
3831 | FROM spotter_output WHERE spotter_output.pilot_id <> '' "; |
||
3832 | if ($olderthanmonths > 0) { |
||
3833 | if ($globalDBdriver == 'mysql') { |
||
3834 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
||
3835 | } else { |
||
3836 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
||
3837 | } |
||
3838 | } |
||
3839 | if ($sincedate != '') { |
||
3840 | if ($globalDBdriver == 'mysql') { |
||
3841 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
||
3842 | } else { |
||
3843 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
||
3844 | } |
||
3845 | } |
||
3846 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
||
3847 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
||
3848 | |||
3849 | |||
3850 | $sth = $this->db->prepare($query); |
||
3851 | $sth->execute(); |
||
3852 | |||
3853 | $airline_array = array(); |
||
3854 | $temp_array = array(); |
||
3855 | |||
3856 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
||
3857 | { |
||
3858 | $temp_array['pilot_name'] = $row['pilot_name']; |
||
3859 | $temp_array['pilot_id'] = $row['pilot_id']; |
||
3860 | $temp_array['pilot_count'] = $row['pilot_count']; |
||
3861 | $temp_array['airline_icao'] = $row['airline_icao']; |
||
3862 | $temp_array['format_source'] = $row['format_source']; |
||
3863 | $airline_array[] = $temp_array; |
||
3864 | } |
||
3865 | return $airline_array; |
||
3866 | } |
||
3867 | |||
10386 | ?> |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.