| @@ 141-146 (lines=6) @@ | ||
| 138 | // Single Pokemon |
|
| 139 | /////////////////// |
|
| 140 | ||
| 141 | function getGymsProtectedByPokemon($pokemon_id) { |
|
| 142 | $req = "SELECT COUNT(DISTINCT(fort_id)) AS total FROM fort_sightings WHERE guard_pokemon_id = '".$pokemon_id."'"; |
|
| 143 | $result = $this->mysqli->query($req); |
|
| 144 | $data = $result->fetch_object(); |
|
| 145 | return $data; |
|
| 146 | } |
|
| 147 | ||
| 148 | function getPokemonLastSeen($pokemon_id) { |
|
| 149 | $req = "SELECT FROM_UNIXTIME(expire_timestamp) AS expire_timestamp, FROM_UNIXTIME(expire_timestamp) AS disappear_time_real, lat AS latitude, lon AS longitude |
|
| @@ 148-157 (lines=10) @@ | ||
| 145 | return $data; |
|
| 146 | } |
|
| 147 | ||
| 148 | function getPokemonLastSeen($pokemon_id) { |
|
| 149 | $req = "SELECT FROM_UNIXTIME(expire_timestamp) AS expire_timestamp, FROM_UNIXTIME(expire_timestamp) AS disappear_time_real, lat AS latitude, lon AS longitude |
|
| 150 | FROM sightings |
|
| 151 | WHERE pokemon_id = '".$pokemon_id."' |
|
| 152 | ORDER BY expire_timestamp DESC |
|
| 153 | LIMIT 0,1"; |
|
| 154 | $result = $this->mysqli->query($req); |
|
| 155 | $data = $result->fetch_object(); |
|
| 156 | return $data; |
|
| 157 | } |
|
| 158 | ||
| 159 | function getTop50Pokemon($pokemon_id, $top_order_by, $top_direction) { |
|
| 160 | $req = "SELECT FROM_UNIXTIME(expire_timestamp) AS distime, pokemon_id as pokemon_id, FROM_UNIXTIME(expire_timestamp) as disappear_time, lat as latitude, lon as longitude, |
|
| @@ 142-147 (lines=6) @@ | ||
| 139 | // Single Pokemon |
|
| 140 | /////////////////// |
|
| 141 | ||
| 142 | function getGymsProtectedByPokemon($pokemon_id) { |
|
| 143 | $req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE guard_pokemon_id = '".$pokemon_id."'"; |
|
| 144 | $result = $this->mysqli->query($req); |
|
| 145 | $data = $result->fetch_object(); |
|
| 146 | return $data; |
|
| 147 | } |
|
| 148 | ||
| 149 | function getPokemonLastSeen($pokemon_id) { |
|
| 150 | $req = "SELECT disappear_time, (CONVERT_TZ(disappear_time, '+00:00', '".self::$time_offset."')) AS disappear_time_real, latitude, longitude |
|
| @@ 149-158 (lines=10) @@ | ||
| 146 | return $data; |
|
| 147 | } |
|
| 148 | ||
| 149 | function getPokemonLastSeen($pokemon_id) { |
|
| 150 | $req = "SELECT disappear_time, (CONVERT_TZ(disappear_time, '+00:00', '".self::$time_offset."')) AS disappear_time_real, latitude, longitude |
|
| 151 | FROM pokemon |
|
| 152 | WHERE pokemon_id = '".$pokemon_id."' |
|
| 153 | ORDER BY disappear_time DESC |
|
| 154 | LIMIT 0,1"; |
|
| 155 | $result = $this->mysqli->query($req); |
|
| 156 | $data = $result->fetch_object(); |
|
| 157 | return $data; |
|
| 158 | } |
|
| 159 | ||
| 160 | function getTop50Pokemon($pokemon_id, $top_order_by, $top_direction) { |
|
| 161 | $req = "SELECT (CONVERT_TZ(disappear_time, '+00:00', '".self::$time_offset."')) AS distime, pokemon_id, disappear_time, latitude, longitude, |
|
| @@ 329-338 (lines=10) @@ | ||
| 326 | return $gyms; |
|
| 327 | } |
|
| 328 | ||
| 329 | public function getGymData($gym_id) { |
|
| 330 | $req = "SELECT gymdetails.name AS name, gymdetails.description AS description, gymdetails.url AS url, gym.team_id AS team, |
|
| 331 | (CONVERT_TZ(gym.last_scanned, '+00:00', '".self::$time_offset."')) AS last_scanned, gym.guard_pokemon_id AS guard_pokemon_id, gym.total_cp AS total_cp, (6 - gym.slots_available) AS level |
|
| 332 | FROM gymdetails |
|
| 333 | LEFT JOIN gym ON gym.gym_id = gymdetails.gym_id |
|
| 334 | WHERE gym.gym_id='".$gym_id."'"; |
|
| 335 | $result = $this->mysqli->query($req); |
|
| 336 | $data = $result->fetch_object(); |
|
| 337 | return $data; |
|
| 338 | } |
|
| 339 | ||
| 340 | public function getGymDefenders($gym_id) { |
|
| 341 | $req = "SELECT DISTINCT gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, MAX(cp) AS cp, gymmember.gym_id |
|