Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove sorting of the Battle Hall #72

Merged
merged 1 commit into from Mar 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 3 additions & 20 deletions includes/pages/game/ShowBattleHallPage.class.php
@@ -1,7 +1,7 @@
<?php

/**
* 2Moons
* 2Moons
* by Jan-Otto Kröpke 2009-2016
*
* For the full copyright and license information, please view the LICENSE
Expand All @@ -27,21 +27,6 @@ function __construct()
function show()
{
global $USER, $LNG;
$order = HTTP::_GP('order', 'units');
$sort = HTTP::_GP('sort', 'desc');
$sort = strtoupper($sort) === "DESC" ? "DESC" : "ASC";


switch($order)
{
case 'date':
$key = '%%TOPKB%%.time '.$sort;
break;
case 'units':
default:
$key = '%%TOPKB%%.units '.$sort;
break;
}

$db = Database::get();
$sql = "SELECT *, (
Expand All @@ -57,7 +42,7 @@ function show()
FROM %%TOPKB_USERS%% INNER JOIN %%USERS%% ON uid = id
WHERE %%TOPKB_USERS%%.rid = %%TOPKB%%.`rid` AND `role` = 2
) as defender
FROM %%TOPKB%% WHERE universe = :universe ORDER BY ".$key." LIMIT 100;";
FROM %%TOPKB%% WHERE universe = :universe ORDER BY %%TOPKB%%.units DESC LIMIT 100;";

$top = $db->select($sql, array(
':universe' => Universe::current()
Expand All @@ -79,10 +64,8 @@ function show()

$this->assign(array(
'TopKBList' => $TopKBList,
'sort' => $sort,
'order' => $order,
));

$this->display('page.battleHall.default.tpl');
}
}
}
6 changes: 3 additions & 3 deletions styles/templates/game/page.battleHall.default.tpl
Expand Up @@ -11,8 +11,8 @@
<tr>
<td>{$LNG.tkb_platz}</td>
<td>{$LNG.tkb_owners}</td>
<td><a href="game.php?page=battleHall&order=date&sort={if $sort == "ASC"}DESC{else}ASC{/if}"{if $order == "date"} style="font-weight:bold;"{/if}>{$LNG.tkb_datum}</a></td>
<td><a href="game.php?page=battleHall&order=units&sort={if $sort == "ASC"}DESC{else}ASC{/if}"{if $order == "units"} style="font-weight:bold;"{/if}>{$LNG.tkb_units}</a></td>
<td>{$LNG.tkb_datum}</td>
<td>{$LNG.tkb_units}</td>
</tr>
{foreach $TopKBList as $row}
<tr class="day{floor($row.date / 86400)} week{floor($row.date / 604800)}">
Expand All @@ -34,4 +34,4 @@
<td colspan="4">{$LNG.tkb_legende}<span style="color:#00FF00">{$LNG.tkb_gewinner}</span><span style="color:#FF0000">{$LNG.tkb_verlierer}</span></td></tr>
</tbody>
</table>
{/block}
{/block}