|
@@ 4224-4260 (lines=37) @@
|
| 4221 |
|
* @return Array the aircraft list |
| 4222 |
|
* |
| 4223 |
|
*/ |
| 4224 |
|
public function countAllAircraftRegistrationByAirport($airport_icao) |
| 4225 |
|
{ |
| 4226 |
|
$Image = new Image($this->db); |
| 4227 |
|
$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
| 4228 |
|
|
| 4229 |
|
$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
| 4230 |
|
FROM spotter_output |
| 4231 |
|
WHERE spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 4232 |
|
GROUP BY spotter_output.registration |
| 4233 |
|
ORDER BY registration_count DESC"; |
| 4234 |
|
|
| 4235 |
|
|
| 4236 |
|
$sth = $this->db->prepare($query); |
| 4237 |
|
$sth->execute(array(':airport_icao' => $airport_icao)); |
| 4238 |
|
|
| 4239 |
|
$aircraft_array = array(); |
| 4240 |
|
$temp_array = array(); |
| 4241 |
|
|
| 4242 |
|
while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 4243 |
|
{ |
| 4244 |
|
$temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4245 |
|
$temp_array['aircraft_name'] = $row['aircraft_name']; |
| 4246 |
|
$temp_array['registration'] = $row['registration']; |
| 4247 |
|
$temp_array['airline_name'] = $row['airline_name']; |
| 4248 |
|
$temp_array['image_thumbnail'] = ""; |
| 4249 |
|
if($row['registration'] != "") |
| 4250 |
|
{ |
| 4251 |
|
$image_array = $Image->getSpotterImage($row['registration']); |
| 4252 |
|
$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
| 4253 |
|
} |
| 4254 |
|
$temp_array['registration_count'] = $row['registration_count']; |
| 4255 |
|
|
| 4256 |
|
$aircraft_array[] = $temp_array; |
| 4257 |
|
} |
| 4258 |
|
|
| 4259 |
|
return $aircraft_array; |
| 4260 |
|
} |
| 4261 |
|
|
| 4262 |
|
|
| 4263 |
|
/** |
|
@@ 4341-4377 (lines=37) @@
|
| 4338 |
|
* @return Array the aircraft list |
| 4339 |
|
* |
| 4340 |
|
*/ |
| 4341 |
|
public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer) |
| 4342 |
|
{ |
| 4343 |
|
$Image = new Image($this->db); |
| 4344 |
|
$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
| 4345 |
|
|
| 4346 |
|
$query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
| 4347 |
|
FROM spotter_output |
| 4348 |
|
WHERE spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 4349 |
|
GROUP BY spotter_output.registration |
| 4350 |
|
ORDER BY registration_count DESC"; |
| 4351 |
|
|
| 4352 |
|
|
| 4353 |
|
$sth = $this->db->prepare($query); |
| 4354 |
|
$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
| 4355 |
|
|
| 4356 |
|
$aircraft_array = array(); |
| 4357 |
|
$temp_array = array(); |
| 4358 |
|
|
| 4359 |
|
while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 4360 |
|
{ |
| 4361 |
|
$temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4362 |
|
$temp_array['aircraft_name'] = $row['aircraft_name']; |
| 4363 |
|
$temp_array['registration'] = $row['registration']; |
| 4364 |
|
$temp_array['airline_name'] = $row['airline_name']; |
| 4365 |
|
$temp_array['image_thumbnail'] = ""; |
| 4366 |
|
if($row['registration'] != "") |
| 4367 |
|
{ |
| 4368 |
|
$image_array = $Image->getSpotterImage($row['registration']); |
| 4369 |
|
$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
| 4370 |
|
} |
| 4371 |
|
$temp_array['registration_count'] = $row['registration_count']; |
| 4372 |
|
|
| 4373 |
|
$aircraft_array[] = $temp_array; |
| 4374 |
|
} |
| 4375 |
|
|
| 4376 |
|
return $aircraft_array; |
| 4377 |
|
} |
| 4378 |
|
|
| 4379 |
|
|
| 4380 |
|
|