| @@ 503-512 (lines=10) @@ | ||
| 500 | if (isset($team) && '' != $team) { |
|
| 501 | $where .= ('' === $where ? ' WHERE' : ' AND').' fs.team = '.$team; |
|
| 502 | } |
|
| 503 | switch ($ranking) { |
|
| 504 | case 1: |
|
| 505 | $order = ' ORDER BY name, last_modified DESC'; |
|
| 506 | break; |
|
| 507 | case 2: |
|
| 508 | $order = ' ORDER BY total_cp DESC, last_modified DESC'; |
|
| 509 | break; |
|
| 510 | default: |
|
| 511 | $order = ' ORDER BY last_modified DESC, name'; |
|
| 512 | } |
|
| 513 | ||
| 514 | $limit = ' LIMIT '.($page * 10).',10'; |
|
| 515 | ||
| @@ 492-501 (lines=10) @@ | ||
| 489 | if (isset($team) && '' != $team) { |
|
| 490 | $where .= ('' == $where ? ' WHERE' : ' AND').' team_id = '.$team; |
|
| 491 | } |
|
| 492 | switch ($ranking) { |
|
| 493 | case 1: |
|
| 494 | $order = ' ORDER BY name, last_modified DESC'; |
|
| 495 | break; |
|
| 496 | case 2: |
|
| 497 | $order = ' ORDER BY total_cp DESC, last_modified DESC'; |
|
| 498 | break; |
|
| 499 | default: |
|
| 500 | $order = ' ORDER BY last_modified DESC, name'; |
|
| 501 | } |
|
| 502 | $req = "SELECT gymdetails.gym_id, name, team_id, total_cp, |
|
| 503 | (6 - slots_available) as pokemon_count, |
|
| 504 | CONVERT_TZ(last_modified, '+00:00', '".self::$time_offset."') as last_modified |
|
| @@ 679-688 (lines=10) @@ | ||
| 676 | if (0 != $team) { |
|
| 677 | $where .= ('' == $where ? ' HAVING' : ' AND').' team = '.$team; |
|
| 678 | } |
|
| 679 | switch ($ranking) { |
|
| 680 | case 1: |
|
| 681 | $order = ' ORDER BY active DESC, level DESC'; |
|
| 682 | break; |
|
| 683 | case 2: |
|
| 684 | $order = ' ORDER BY maxCp DESC, level DESC'; |
|
| 685 | break; |
|
| 686 | default: |
|
| 687 | $order = ' ORDER BY level DESC, active DESC'; |
|
| 688 | } |
|
| 689 | $order .= ', last_seen DESC, name '; |
|
| 690 | $limit = ' LIMIT '.($page * 10).',10 '; |
|
| 691 | $req = "SELECT trainer.*, COUNT(actives_pokemons.trainer_name) AS active, max(actives_pokemons.cp) AS maxCp |
|
| @@ 481-490 (lines=10) @@ | ||
| 478 | if (isset($team) && '' != $team) { |
|
| 479 | $where .= ('' === $where ? ' WHERE' : ' AND').' fs.team = '.$team; |
|
| 480 | } |
|
| 481 | switch ($ranking) { |
|
| 482 | case 1: |
|
| 483 | $order = ' ORDER BY name, last_modified DESC'; |
|
| 484 | break; |
|
| 485 | case 2: |
|
| 486 | $order = ' ORDER BY total_cp DESC, last_modified DESC'; |
|
| 487 | break; |
|
| 488 | default: |
|
| 489 | $order = ' ORDER BY last_modified DESC, name'; |
|
| 490 | } |
|
| 491 | ||
| 492 | $limit = ' LIMIT 10 OFFSET '.($page * 10); |
|
| 493 | ||