| @@ 48-60 (lines=13) @@ | ||
| 45 | * @return Array the spotter information |
|
| 46 | * |
|
| 47 | */ |
|
| 48 | public function getLastArchiveSpotterDataByIdent($ident) |
|
| 49 | { |
|
| 50 | $Spotter = new Spotter($this->db); |
|
| 51 | date_default_timezone_set('UTC'); |
|
| 52 | ||
| 53 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 54 | //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
| 55 | $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
| 56 | ||
| 57 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident)); |
|
| 58 | ||
| 59 | return $spotter_array; |
|
| 60 | } |
|
| 61 | ||
| 62 | ||
| 63 | /** |
|
| @@ 69-92 (lines=24) @@ | ||
| 66 | * @return Array the spotter information |
|
| 67 | * |
|
| 68 | */ |
|
| 69 | public function getLastArchiveSpotterDataById($id) |
|
| 70 | { |
|
| 71 | $Spotter = new Spotter($this->db); |
|
| 72 | date_default_timezone_set('UTC'); |
|
| 73 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 74 | //$query = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id"; |
|
| 75 | //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
| 76 | $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
| 77 | ||
| 78 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
|
| 79 | /* |
|
| 80 | try { |
|
| 81 | $Connection = new Connection(); |
|
| 82 | $sth = Connection->$db->prepare($query); |
|
| 83 | $sth->execute(array(':id' => $id)); |
|
| 84 | } catch(PDOException $e) { |
|
| 85 | return "error"; |
|
| 86 | } |
|
| 87 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
|
| 88 | */ |
|
| 89 | $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id)); |
|
| 90 | ||
| 91 | return $spotter_array; |
|
| 92 | } |
|
| 93 | ||
| 94 | /** |
|
| 95 | * Gets all the spotter information based on a particular id |
|
| @@ 337-348 (lines=12) @@ | ||
| 334 | * @return Array the spotter information |
|
| 335 | * |
|
| 336 | */ |
|
| 337 | public function getLastLiveSpotterDataByIdent($ident) |
|
| 338 | { |
|
| 339 | $Spotter = new Spotter($this->db); |
|
| 340 | date_default_timezone_set('UTC'); |
|
| 341 | ||
| 342 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 343 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 344 | ||
| 345 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident)); |
|
| 346 | ||
| 347 | return $spotter_array; |
|
| 348 | } |
|
| 349 | ||
| 350 | /** |
|
| 351 | * Gets all the spotter information based on a particular callsign |
|
| @@ 376-387 (lines=12) @@ | ||
| 373 | * @return Array the spotter information |
|
| 374 | * |
|
| 375 | */ |
|
| 376 | public function getLastLiveSpotterDataById($id) |
|
| 377 | { |
|
| 378 | $Spotter = new Spotter($this->db); |
|
| 379 | date_default_timezone_set('UTC'); |
|
| 380 | ||
| 381 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 382 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 383 | ||
| 384 | $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id)); |
|
| 385 | ||
| 386 | return $spotter_array; |
|
| 387 | } |
|
| 388 | ||
| 389 | /** |
|
| 390 | * Gets last spotter information based on a particular callsign |
|