| @@ 473-482 (lines=10) @@ | ||
| 470 | if (isset($team) && '' != $team) { |
|
| 471 | $where .= ('' === $where ? ' WHERE' : ' AND').' fs.team = '.$team; |
|
| 472 | } |
|
| 473 | switch ($ranking) { |
|
| 474 | case 1: |
|
| 475 | $order = ' ORDER BY name, last_modified DESC'; |
|
| 476 | break; |
|
| 477 | case 2: |
|
| 478 | $order = ' ORDER BY total_cp DESC, last_modified DESC'; |
|
| 479 | break; |
|
| 480 | default: |
|
| 481 | $order = ' ORDER BY last_modified DESC, name'; |
|
| 482 | } |
|
| 483 | ||
| 484 | $limit = ' LIMIT '.($page * 10).',10'; |
|
| 485 | ||
| @@ 462-471 (lines=10) @@ | ||
| 459 | if (isset($team) && '' != $team) { |
|
| 460 | $where .= ('' == $where ? ' WHERE' : ' AND').' team_id = '.$team; |
|
| 461 | } |
|
| 462 | switch ($ranking) { |
|
| 463 | case 1: |
|
| 464 | $order = ' ORDER BY name, last_modified DESC'; |
|
| 465 | break; |
|
| 466 | case 2: |
|
| 467 | $order = ' ORDER BY total_cp DESC, last_modified DESC'; |
|
| 468 | break; |
|
| 469 | default: |
|
| 470 | $order = ' ORDER BY last_modified DESC, name'; |
|
| 471 | } |
|
| 472 | $req = "SELECT gymdetails.gym_id, name, team_id, total_cp, |
|
| 473 | (6 - slots_available) as pokemon_count, |
|
| 474 | CONVERT_TZ(last_modified, '+00:00', '".self::$time_offset."') as last_modified |
|
| @@ 649-658 (lines=10) @@ | ||
| 646 | if (0 != $team) { |
|
| 647 | $where .= ('' == $where ? ' HAVING' : ' AND').' team = '.$team; |
|
| 648 | } |
|
| 649 | switch ($ranking) { |
|
| 650 | case 1: |
|
| 651 | $order = ' ORDER BY active DESC, level DESC'; |
|
| 652 | break; |
|
| 653 | case 2: |
|
| 654 | $order = ' ORDER BY maxCp DESC, level DESC'; |
|
| 655 | break; |
|
| 656 | default: |
|
| 657 | $order = ' ORDER BY level DESC, active DESC'; |
|
| 658 | } |
|
| 659 | $order .= ', last_seen DESC, name '; |
|
| 660 | $limit = ' LIMIT '.($page * 10).',10 '; |
|
| 661 | $req = "SELECT trainer.*, COUNT(actives_pokemons.trainer_name) AS active, max(actives_pokemons.cp) AS maxCp |
|
| @@ 451-460 (lines=10) @@ | ||
| 448 | if (isset($team) && '' != $team) { |
|
| 449 | $where .= ('' === $where ? ' WHERE' : ' AND').' fs.team = '.$team; |
|
| 450 | } |
|
| 451 | switch ($ranking) { |
|
| 452 | case 1: |
|
| 453 | $order = ' ORDER BY name, last_modified DESC'; |
|
| 454 | break; |
|
| 455 | case 2: |
|
| 456 | $order = ' ORDER BY total_cp DESC, last_modified DESC'; |
|
| 457 | break; |
|
| 458 | default: |
|
| 459 | $order = ' ORDER BY last_modified DESC, name'; |
|
| 460 | } |
|
| 461 | ||
| 462 | $limit = ' LIMIT 10 OFFSET '.($page * 10); |
|
| 463 | ||