| @@ 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 |
|
| @@ 283-294 (lines=12) @@ | ||
| 280 | * @return Array the spotter information |
|
| 281 | * |
|
| 282 | */ |
|
| 283 | public function getLastLiveSpotterDataByIdent($ident) |
|
| 284 | { |
|
| 285 | $Spotter = new Spotter($this->db); |
|
| 286 | date_default_timezone_set('UTC'); |
|
| 287 | ||
| 288 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 289 | $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'; |
|
| 290 | ||
| 291 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident)); |
|
| 292 | ||
| 293 | return $spotter_array; |
|
| 294 | } |
|
| 295 | ||
| 296 | /** |
|
| 297 | * Gets last spotter information based on a particular callsign |
|
| @@ 302-313 (lines=12) @@ | ||
| 299 | * @return Array the spotter information |
|
| 300 | * |
|
| 301 | */ |
|
| 302 | public function getLastLiveSpotterDataById($id) |
|
| 303 | { |
|
| 304 | $Spotter = new Spotter($this->db); |
|
| 305 | date_default_timezone_set('UTC'); |
|
| 306 | ||
| 307 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 308 | $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'; |
|
| 309 | ||
| 310 | $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id)); |
|
| 311 | ||
| 312 | return $spotter_array; |
|
| 313 | } |
|
| 314 | ||
| 315 | /** |
|
| 316 | * Gets altitude information based on a particular callsign |
|