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