mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-14 01:34:55 +02:00
Fixes on new highscores
Fixed link to next page on first visit default highscores Fixed position of "No records yet." Also count pages is starting from 1 now (not from 0 like before)
This commit is contained in:
@@ -15,10 +15,14 @@ $configHighscoresCountryBox = config('highscores_country_box');
|
||||
if(config('account_country') && $configHighscoresCountryBox)
|
||||
require SYSTEM . 'countries.conf.php';
|
||||
|
||||
$list = isset($_GET['list']) ? $_GET['list'] : '';
|
||||
$_page = isset($_GET['page']) ? $_GET['page'] : 0;
|
||||
$list = isset($_GET['list']) ? $_GET['list'] : 'experience';
|
||||
$_page = isset($_GET['page']) ? $_GET['page'] : 1;
|
||||
$vocation = isset($_GET['vocation']) ? $_GET['vocation'] : 'all';
|
||||
|
||||
if(!is_numeric($_page) || $_page < 1 || $_page > PHP_INT_MAX) {
|
||||
$_page = 1;
|
||||
}
|
||||
|
||||
$add_sql = '';
|
||||
|
||||
$configHighscoresVocationBox = config('highscores_vocation_box');
|
||||
@@ -146,7 +150,7 @@ if ($cache->enabled()) {
|
||||
}
|
||||
}
|
||||
|
||||
$offset = $_page * $configHighscoresPerPage;
|
||||
$offset = ($_page - 1) * $configHighscoresPerPage;
|
||||
if (!isset($highscores) || empty($highscores)) {
|
||||
if ($skill >= POT::SKILL_FIRST && $skill <= POT::SKILL_LAST) { // skills
|
||||
if ($db->hasColumn('players', 'skill_fist')) {// tfs 1.0
|
||||
@@ -274,14 +278,9 @@ foreach($highscores as $id => &$player)
|
||||
}
|
||||
}
|
||||
|
||||
if(!$i) {
|
||||
$extra = ($configHighscoresOutfit ? 1 : 0);
|
||||
echo '<tr bgcolor="' . config('darkborder') . '"><td colspan="' . ($skill == POT::SKILL__LEVEL ? 5 + $extra : 4 + $extra) . '">No records yet.</td></tr>';
|
||||
}
|
||||
|
||||
//link to previous page if actual page is not first
|
||||
$linkPreviousPage = '';
|
||||
if($_page > 0) {
|
||||
if($_page > 1) {
|
||||
$linkPreviousPage = getLink('highscores') . '/' . $list . ($vocation !== 'all' ? '/' . $vocation : '') . '/' . ($_page - 1);
|
||||
}
|
||||
|
||||
@@ -291,7 +290,6 @@ if($show_link_to_next_page) {
|
||||
$linkNextPage = getLink('highscores') . '/' . $list . ($vocation !== 'all' ? '/' . $vocation : '') . '/' . ($_page + 1);
|
||||
}
|
||||
|
||||
|
||||
$types = array(
|
||||
'experience' => 'Experience',
|
||||
'magic' => 'Magic',
|
||||
@@ -313,6 +311,7 @@ if(config('highscores_balance'))
|
||||
/** @var Twig\Environment $twig */
|
||||
$twig->display('highscores.html.twig', [
|
||||
'highscores' => $highscores,
|
||||
'totalRows' => $i - 1,
|
||||
'list' => $list,
|
||||
'skill' => $skill,
|
||||
'skillName' => ($skill == SKILL_FRAGS ? 'Frags' : ($skill == SKILL_BALANCE ? 'Balance' : getSkillName($skill))),
|
||||
|
Reference in New Issue
Block a user