| @@ 100-117 (lines=18) @@ | ||
| 97 | * @return Array the spotter information |
|
| 98 | * |
|
| 99 | */ |
|
| 100 | public function getAllArchiveSpotterDataById($id) |
|
| 101 | { |
|
| 102 | date_default_timezone_set('UTC'); |
|
| 103 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 104 | $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id"; |
|
| 105 | ||
| 106 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
|
| 107 | ||
| 108 | try { |
|
| 109 | $sth = $this->db->prepare($query); |
|
| 110 | $sth->execute(array(':id' => $id)); |
|
| 111 | } catch(PDOException $e) { |
|
| 112 | return "error"; |
|
| 113 | } |
|
| 114 | $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 115 | ||
| 116 | return $spotter_array; |
|
| 117 | } |
|
| 118 | ||
| 119 | /** |
|
| 120 | * Gets coordinate & time spotter information based on a particular id |
|
| @@ 125-142 (lines=18) @@ | ||
| 122 | * @return Array the spotter information |
|
| 123 | * |
|
| 124 | */ |
|
| 125 | public function getCoordArchiveSpotterDataById($id) |
|
| 126 | { |
|
| 127 | date_default_timezone_set('UTC'); |
|
| 128 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 129 | $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id"; |
|
| 130 | ||
| 131 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
|
| 132 | ||
| 133 | try { |
|
| 134 | $sth = $this->db->prepare($query); |
|
| 135 | $sth->execute(array(':id' => $id)); |
|
| 136 | } catch(PDOException $e) { |
|
| 137 | return $e->getMessage(); |
|
| 138 | } |
|
| 139 | $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 140 | ||
| 141 | return $spotter_array; |
|
| 142 | } |
|
| 143 | ||
| 144 | ||
| 145 | /** |
|
| @@ 151-168 (lines=18) @@ | ||
| 148 | * @return Array the spotter information |
|
| 149 | * |
|
| 150 | */ |
|
| 151 | public function getAltitudeArchiveSpotterDataByIdent($ident) |
|
| 152 | { |
|
| 153 | ||
| 154 | date_default_timezone_set('UTC'); |
|
| 155 | ||
| 156 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 157 | $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident"; |
|
| 158 | ||
| 159 | try { |
|
| 160 | $sth = $this->db->prepare($query); |
|
| 161 | $sth->execute(array(':ident' => $ident)); |
|
| 162 | } catch(PDOException $e) { |
|
| 163 | return "error"; |
|
| 164 | } |
|
| 165 | $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 166 | ||
| 167 | return $spotter_array; |
|
| 168 | } |
|
| 169 | ||
| 170 | /** |
|
| 171 | * Gets altitude information based on a particular id |
|
| @@ 176-193 (lines=18) @@ | ||
| 173 | * @return Array the spotter information |
|
| 174 | * |
|
| 175 | */ |
|
| 176 | public function getAltitudeArchiveSpotterDataById($id) |
|
| 177 | { |
|
| 178 | ||
| 179 | date_default_timezone_set('UTC'); |
|
| 180 | ||
| 181 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 182 | $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id"; |
|
| 183 | ||
| 184 | try { |
|
| 185 | $sth = $this->db->prepare($query); |
|
| 186 | $sth->execute(array(':id' => $id)); |
|
| 187 | } catch(PDOException $e) { |
|
| 188 | return "error"; |
|
| 189 | } |
|
| 190 | $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 191 | ||
| 192 | return $spotter_array; |
|
| 193 | } |
|
| 194 | ||
| 195 | /** |
|
| 196 | * Gets altitude & speed information based on a particular id |
|
| @@ 201-218 (lines=18) @@ | ||
| 198 | * @return Array the spotter information |
|
| 199 | * |
|
| 200 | */ |
|
| 201 | public function getAltitudeSpeedArchiveSpotterDataById($id) |
|
| 202 | { |
|
| 203 | ||
| 204 | date_default_timezone_set('UTC'); |
|
| 205 | ||
| 206 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 207 | $query = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id"; |
|
| 208 | ||
| 209 | try { |
|
| 210 | $sth = $this->db->prepare($query); |
|
| 211 | $sth->execute(array(':id' => $id)); |
|
| 212 | } catch(PDOException $e) { |
|
| 213 | return "error : ".$e->getMessage(); |
|
| 214 | } |
|
| 215 | $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 216 | ||
| 217 | return $spotter_array; |
|
| 218 | } |
|
| 219 | ||
| 220 | ||
| 221 | /** |
|
| @@ 227-245 (lines=19) @@ | ||
| 224 | * @return Array the spotter information |
|
| 225 | * |
|
| 226 | */ |
|
| 227 | public function getLastAltitudeArchiveSpotterDataByIdent($ident) |
|
| 228 | { |
|
| 229 | ||
| 230 | date_default_timezone_set('UTC'); |
|
| 231 | ||
| 232 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 233 | $query = "SELECT spotter_archive.altitude, spotter_archive.date 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"; |
|
| 234 | // $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident"; |
|
| 235 | ||
| 236 | try { |
|
| 237 | $sth = $this->db->prepare($query); |
|
| 238 | $sth->execute(array(':ident' => $ident)); |
|
| 239 | } catch(PDOException $e) { |
|
| 240 | return "error"; |
|
| 241 | } |
|
| 242 | $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 243 | ||
| 244 | return $spotter_array; |
|
| 245 | } |
|
| 246 | ||
| 247 | ||
| 248 | ||
| @@ 414-432 (lines=19) @@ | ||
| 411 | * @return Array the spotter information |
|
| 412 | * |
|
| 413 | */ |
|
| 414 | public function getAltitudeLiveSpotterDataByIdent($ident) |
|
| 415 | { |
|
| 416 | ||
| 417 | date_default_timezone_set('UTC'); |
|
| 418 | ||
| 419 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 420 | $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 421 | ||
| 422 | try { |
|
| 423 | ||
| 424 | $sth = $this->db->prepare($query); |
|
| 425 | $sth->execute(array(':ident' => $ident)); |
|
| 426 | } catch(PDOException $e) { |
|
| 427 | return "error"; |
|
| 428 | } |
|
| 429 | $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 430 | ||
| 431 | return $spotter_array; |
|
| 432 | } |
|
| 433 | ||
| 434 | /** |
|
| 435 | * Gets all the spotter information based on a particular id |
|
| @@ 440-457 (lines=18) @@ | ||
| 437 | * @return Array the spotter information |
|
| 438 | * |
|
| 439 | */ |
|
| 440 | public function getAllLiveSpotterDataById($id) |
|
| 441 | { |
|
| 442 | date_default_timezone_set('UTC'); |
|
| 443 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 444 | $query = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date'; |
|
| 445 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
|
| 446 | ||
| 447 | try { |
|
| 448 | ||
| 449 | $sth = $this->db->prepare($query); |
|
| 450 | $sth->execute(array(':id' => $id)); |
|
| 451 | } catch(PDOException $e) { |
|
| 452 | return "error"; |
|
| 453 | } |
|
| 454 | $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 455 | ||
| 456 | return $spotter_array; |
|
| 457 | } |
|
| 458 | ||
| 459 | /** |
|
| 460 | * Gets all the spotter information based on a particular ident |
|
| @@ 465-479 (lines=15) @@ | ||
| 462 | * @return Array the spotter information |
|
| 463 | * |
|
| 464 | */ |
|
| 465 | public function getAllLiveSpotterDataByIdent($ident) |
|
| 466 | { |
|
| 467 | date_default_timezone_set('UTC'); |
|
| 468 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 469 | $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
| 470 | try { |
|
| 471 | ||
| 472 | $sth = $this->db->prepare($query); |
|
| 473 | $sth->execute(array(':ident' => $ident)); |
|
| 474 | } catch(PDOException $e) { |
|
| 475 | return "error"; |
|
| 476 | } |
|
| 477 | $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 478 | return $spotter_array; |
|
| 479 | } |
|
| 480 | ||
| 481 | ||
| 482 | /** |
|