* new configurable: highscores_length, how much highscores to display

* fixed characters twig template loading
* fixed highscores links
This commit is contained in:
slawkens 2017-10-11 14:43:11 +02:00
parent f0adabf567
commit 005356ebb3
4 changed files with 11 additions and 6 deletions

View File

@ -185,6 +185,7 @@ $config = array(
'highscores_outfit' => true, // show player outfit? 'highscores_outfit' => true, // show player outfit?
'highscores_country_box' => false, // doesnt work yet! (not implemented) 'highscores_country_box' => false, // doesnt work yet! (not implemented)
'highscores_groups_hidden' => 4, // this group id and higher won't be shown on the highscores 'highscores_groups_hidden' => 4, // this group id and higher won't be shown on the highscores
'highscores_length' => 100, // how many records per page on highscores
// characters page // characters page
'characters' => array( // what things to display on character view page (true/false in each option) 'characters' => array( // what things to display on character view page (true/false in each option)

View File

@ -89,6 +89,8 @@ else {
'/^forum\/thread\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_thread', 'id' => '$2'), '/^forum\/thread\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_thread', 'id' => '$2'),
'/^forum\/thread\/[0-9]+\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_thread', 'id' => '$2', 'page' => '$3'), '/^forum\/thread\/[0-9]+\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_thread', 'id' => '$2', 'page' => '$3'),
'/^gifts\/history\/?$/' => array('subtopic' => 'gifts', 'action' => 'show_history'), '/^gifts\/history\/?$/' => array('subtopic' => 'gifts', 'action' => 'show_history'),
'/^highscores\/[A-Za-z0-9-_]+\/[A-Za-z0-9-_]+\/[0-9]+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1', 'vocation' => '$2', 'page' => '$3'),
'/^highscores\/[A-Za-z0-9-_]+\/[0-9]+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1', 'page' => '$2'),
'/^highscores\/[A-Za-z0-9-_]+\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1', 'vocation' => '$2'), '/^highscores\/[A-Za-z0-9-_]+\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1', 'vocation' => '$2'),
'/^highscores\/[A-Za-z0-9-_\']+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1'), '/^highscores\/[A-Za-z0-9-_\']+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1'),
'/^polls\/[0-9]+\/?$/' => array('subtopic' => 'polls', 'id' => '$1') '/^polls\/[0-9]+\/?$/' => array('subtopic' => 'polls', 'id' => '$1')

View File

@ -109,7 +109,7 @@ if($config['highscores_outfit']) {
} }
} }
$offset = $_page * 100; $offset = $_page * $config['highscores_length'];
if($skill <= POT::SKILL_LAST) { // skills if($skill <= POT::SKILL_LAST) { // skills
if(fieldExist('skill_fist', 'players')) {// tfs 1.0 if(fieldExist('skill_fist', 'players')) {// tfs 1.0
$skill_ids = array( $skill_ids = array(
@ -186,7 +186,7 @@ foreach($skills as $player)
$player['online'] = $query->rowCount() > 0; $player['online'] = $query->rowCount() > 0;
} }
if(++$i <= 100) if(++$i <= $config['highscores_length'])
{ {
if($skill == POT::SKILL__MAGIC) if($skill == POT::SKILL__MAGIC)
$player['value'] = $player['maglevel']; $player['value'] = $player['maglevel'];
@ -238,11 +238,11 @@ if(!$i)
<?php <?php
//link to previous page if actual page is not first //link to previous page if actual page is not first
if($_page > 0) if($_page > 0)
echo '<TR><TD WIDTH=100% ALIGN=right VALIGN=bottom><A HREF="?subtopic=highscores&list='.$list.'&page='.($_page - 1).'" CLASS="size_xxs">Previous Page</A></TD></TR>'; echo '<TR><TD WIDTH=100% ALIGN=right VALIGN=bottom><A HREF="' . getLink('highscores') . '/' . $list . (isset($vocation) ? '/' . $vocation : '') . '/' . ($_page - 1) . '" CLASS="size_xxs">Previous Page</A></TD></TR>';
//link to next page if any result will be on next page //link to next page if any result will be on next page
if($show_link_to_next_page) if($show_link_to_next_page)
echo '<TR><TD WIDTH=100% ALIGN=right VALIGN=bottom><A HREF="?subtopic=highscores&list='.$list.'&page='.($_page + 1).'" CLASS="size_xxs">Next Page</A></TD></TR>'; echo '<TR><TD WIDTH=100% ALIGN=right VALIGN=bottom><A HREF="' . getLink('highscores') . '/' . $list . (isset($vocation) ? '/' . $vocation : '') . '/' . ($_page + 1) . '" CLASS="size_xxs">Next Page</A></TD></TR>';
//end of page //end of page
echo '</TABLE> echo '</TABLE>
@ -307,8 +307,8 @@ if($config['highscores_vocation_box'])
</tr> </tr>
<tr bgcolor="'.$config['lightborder'].'"> <tr bgcolor="'.$config['lightborder'].'">
<td> <td>
<a href="' . getLink('highscores') . ($config['friendly_urls'] ? '/' : '&list=') . $list . '" class="size_xs">[ALL]</A><BR>'; <a href="' . getLink('highscores') . '/' . $list . '" class="size_xs">[ALL]</A><BR>';
for($i = 1; $i < count($config_vocations) / 2; $i++) { for($i = 1; $i <= $config['vocations_amount']; $i++) {
echo '<a href="' . getLink('highscores') . '/' . $list . '/' . strtolower($config_vocations[$i]) . '" class="size_xs">' . $config_vocations[$i] . '</a><br/>'; echo '<a href="' . getLink('highscores') . '/' . $list . '/' . strtolower($config_vocations[$i]) . '" class="size_xs">' . $config_vocations[$i] . '</a><br/>';
} }
echo ' echo '

View File

@ -244,7 +244,9 @@
<td width="20%" align="center">{{ frag.time|date("j M Y, H:i") }}</td> <td width="20%" align="center">{{ frag.time|date("j M Y, H:i") }}</td>
<td>{{ frag.description }}</td> <td>{{ frag.description }}</td>
</tr> </tr>
{% endfor %}
</table> </table>
{% endif %}
{{ hook(constant('HOOK_CHARACTERS_BEFORE_SIGNATURE')) }} {{ hook(constant('HOOK_CHARACTERS_BEFORE_SIGNATURE')) }}