mirror of
https://github.com/slawkens/myaac.git
synced 2025-06-18 10:44:29 +02:00
Revamped online page
This commit is contained in:
parent
ba4ed6a04b
commit
9a90e4aae2
BIN
images/order_asc.gif
Normal file
BIN
images/order_asc.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 56 B |
BIN
images/order_desc.gif
Normal file
BIN
images/order_desc.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 56 B |
@ -22,13 +22,16 @@ $promotion = '';
|
|||||||
if($db->hasColumn('players', 'promotion'))
|
if($db->hasColumn('players', 'promotion'))
|
||||||
$promotion = '`promotion`,';
|
$promotion = '`promotion`,';
|
||||||
|
|
||||||
$order = $_GET['order'] ?? 'name';
|
$order = $_GET['order'] ?? 'name_asc';
|
||||||
if(!in_array($order, array('country', 'name', 'level', 'vocation')))
|
if(!in_array($order, ['country_asc', 'country_desc', 'name_asc', 'name_desc', 'level_asc', 'level_desc', 'vocation_asc', 'vocation_desc'])) {
|
||||||
$order = $db->fieldName('name');
|
$order = 'name_asc';
|
||||||
else if($order == 'country')
|
}
|
||||||
$order = $db->tableName('accounts') . '.' . $db->fieldName('country');
|
else if($order == 'vocation_asc' || $order == 'vocation_desc') {
|
||||||
else if($order == 'vocation')
|
$order = $promotion . 'vocation_' . (str_contains($order, 'asc') ? 'asc' : 'desc');
|
||||||
$order = $promotion . 'vocation ASC';
|
}
|
||||||
|
|
||||||
|
$orderExplode = explode('_', $order);
|
||||||
|
$orderSql = $orderExplode[0] . ' ' . $orderExplode[1];
|
||||||
|
|
||||||
$skull_type = 'skull';
|
$skull_type = 'skull';
|
||||||
if($db->hasColumn('players', 'skull_type')) {
|
if($db->hasColumn('players', 'skull_type')) {
|
||||||
@ -58,11 +61,11 @@ if (setting('core.online_vocations')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($db->hasTable('players_online')) // tfs 1.0
|
if($db->hasTable('players_online')) // tfs 1.0
|
||||||
$playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `players`.`level`, `players`.`vocation`' . $outfit . ', `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players`, `players_online` WHERE `players`.`id` = `players_online`.`player_id` AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $order);
|
$playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `players`.`level`, `players`.`vocation`' . $outfit . ', `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players`, `players_online` WHERE `players`.`id` = `players_online`.`player_id` AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $orderSql);
|
||||||
else
|
else
|
||||||
$playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `players`.`level`, `players`.`vocation`' . $outfit . ', ' . $promotion . ' `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players` WHERE `players`.`online` > 0 AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $order);
|
$playersOnline = $db->query('SELECT `accounts`.`country`, `players`.`name`, `players`.`level`, `players`.`vocation`' . $outfit . ', ' . $promotion . ' `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull` FROM `accounts`, `players` WHERE `players`.`online` > 0 AND `accounts`.`id` = `players`.`account_id` ORDER BY ' . $orderSql);
|
||||||
|
|
||||||
$players_data = array();
|
$players_data = [];
|
||||||
$players = 0;
|
$players = 0;
|
||||||
$data = '';
|
$data = '';
|
||||||
foreach($playersOnline as $player) {
|
foreach($playersOnline as $player) {
|
||||||
@ -115,7 +118,7 @@ if(count($players_data) > 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($result) {
|
if($result) {
|
||||||
$record = 'The maximum on this game world was ' . $result['record'] . ' players' . ($timestamp ? ' on ' . date("M d Y, H:i:s", $result['timestamp']) . '.' : '.');
|
$record = $result['record'] . ' player' . ($result['record'] > 1 ? 's' : '') . ($timestamp ? ' (on ' . date("M d Y, H:i:s", $result['timestamp']) . ')' : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -124,6 +127,7 @@ $twig->display('online.html.twig', array(
|
|||||||
'players' => $players_data,
|
'players' => $players_data,
|
||||||
'record' => $record,
|
'record' => $record,
|
||||||
'vocs' => $vocs,
|
'vocs' => $vocs,
|
||||||
|
'order' => $order,
|
||||||
));
|
));
|
||||||
|
|
||||||
//search bar
|
//search bar
|
||||||
|
@ -1264,6 +1264,12 @@ Sent by MyAAC,<br/>
|
|||||||
'desc' => '',
|
'desc' => '',
|
||||||
'default' => false,
|
'default' => false,
|
||||||
],
|
],
|
||||||
|
'online_datacenter' => [
|
||||||
|
'name' => 'Data Center',
|
||||||
|
'type' => 'text',
|
||||||
|
'desc' => 'Server Location, will be shown on online page',
|
||||||
|
'default' => 'Frankfurt - Germany',
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'type' => 'section',
|
'type' => 'section',
|
||||||
'title' => 'Team Page'
|
'title' => 'Team Page'
|
||||||
|
@ -1,37 +1,5 @@
|
|||||||
<table border="0" cellspacing="1" cellpadding="4" width="100%">
|
{# vocation statistics #}
|
||||||
<tr bgcolor="{{ config.vdarkborder }}">
|
{% if setting('core.online_vocations') %}
|
||||||
<td class="white"><b>Server Status</b></td>
|
|
||||||
</tr>
|
|
||||||
{% if players|length == 0 %}
|
|
||||||
<tr bgcolor="{{ config.darkborder }}"><td>Currently no one is playing on {{ config.lua.serverName }}.</td></tr></table>
|
|
||||||
{% else %}
|
|
||||||
<tr bgcolor="{{ config.darkborder }}">
|
|
||||||
<td>
|
|
||||||
{% if not status.online %}
|
|
||||||
Server is offline.<br/>
|
|
||||||
{% else %}
|
|
||||||
{% if setting('core.online_afk') %}
|
|
||||||
{% set players_count = players|length %}
|
|
||||||
{% set afk = players_count - status.players %}
|
|
||||||
{% if afk < 0 %}
|
|
||||||
{% set players_count = players_count + afk|abs %}
|
|
||||||
{% set afk = 0 %}
|
|
||||||
{% endif %}
|
|
||||||
Currently there are <b>{{ status.players }}</b> active and <b>{{ afk }}</b> AFK players.<br/>
|
|
||||||
Total number of players: <b>{{ players_count }}</b>.<br/>
|
|
||||||
{% else %}
|
|
||||||
Currently {{ players|length }} players are online.<br/>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
{% if setting('core.online_record') %}
|
|
||||||
{{ record }}
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<br/>
|
|
||||||
{# vocation statistics #}
|
|
||||||
{% if setting('core.online_vocations') %}
|
|
||||||
<br/>
|
<br/>
|
||||||
{% if setting('core.online_vocations_images') %}
|
{% if setting('core.online_vocations_images') %}
|
||||||
<table width="200" cellspacing="1" cellpadding="0" border="0" align="center">
|
<table width="200" cellspacing="1" cellpadding="0" border="0" align="center">
|
||||||
@ -70,10 +38,12 @@
|
|||||||
</table>
|
</table>
|
||||||
<br/>
|
<br/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# show skulls #}
|
<br/>
|
||||||
{% if setting('core.online_skulls') %}
|
|
||||||
|
{# show skulls #}
|
||||||
|
{% if setting('core.online_skulls') %}
|
||||||
<table width="100%" cellspacing="1">
|
<table width="100%" cellspacing="1">
|
||||||
<tr>
|
<tr>
|
||||||
<td style="background: {{ config.darkborder }};" align="center">
|
<td style="background: {{ config.darkborder }};" align="center">
|
||||||
@ -83,34 +53,114 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
{% set title = 'World Information' %}
|
||||||
|
{% set tableClass = 'Table3' %}
|
||||||
|
{% set background = config('darkborder') %}
|
||||||
|
{% set content %}
|
||||||
|
<table width="100%">
|
||||||
|
<tr>
|
||||||
|
<td class="LabelV150"><b>Status:</b></td>
|
||||||
|
<td>{% if not status.online %}Offline{% else %}Online{% endif %}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="LabelV150"><b>Players Online:</b></td>
|
||||||
|
<td>
|
||||||
|
{% if setting('core.online_afk') %}
|
||||||
|
{% set players_count = players|length %}
|
||||||
|
{% set afk = players_count - status.players %}
|
||||||
|
{% if afk < 0 %}
|
||||||
|
{% set players_count = players_count + afk|abs %}
|
||||||
|
{% set afk = 0 %}
|
||||||
|
{% endif %}
|
||||||
|
Currently there are <b>{{ status.players }}</b> active and <b>{{ afk }}</b> AFK players.<br/>
|
||||||
|
Total number of players: <b>{{ players_count }}</b>.<br/>
|
||||||
|
{% else %}
|
||||||
|
{{ players|length }} Players Online.
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{% if setting('core.online_record') %}
|
||||||
|
<tr>
|
||||||
|
<td class="LabelV150"><b>Online Record:</b></td>
|
||||||
|
<td>
|
||||||
|
{{ record }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<table border="0" cellspacing="1" cellpadding="4" width="100%">
|
<tr>
|
||||||
<tr bgcolor="{{ config.vdarkborder }}">
|
<td class="LabelV150"><b>Location Datacenter:</b></td>
|
||||||
|
<td>{{ setting('core.online_datacenter') }} <small>(Server date & time: - {{ "now"|date("d/m/Y H:i:s") }})</small></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="LabelV150"><b>PvP Type:</b></td>
|
||||||
|
<td>
|
||||||
|
{% set worldType = config('lua')['worldType']|lower %}
|
||||||
|
{% if worldType in ['pvp','2','normal','open','openpvp'] %}
|
||||||
|
Open PvP
|
||||||
|
{% elseif worldType in ['no-pvp','nopvp','non-pvp','nonpvp','1','safe','optional','optionalpvp'] %}
|
||||||
|
Optional PvP
|
||||||
|
{% elseif worldType in ['pvp-enforced','pvpenforced','pvp-enfo','pvpenfo','pvpe','enforced','enfo','3','war','hardcore','hardcorepvp'] %}
|
||||||
|
Hardcore PvP
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
{% endset %}
|
||||||
|
{% include 'tables.headline.html.twig' %}
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
{% set title = 'Players Online' %}
|
||||||
|
{% set tableClass = 'Table2' %}
|
||||||
|
{% set content %}
|
||||||
|
<table width="100%">
|
||||||
|
<tr class="LabelH" style="position: relative; z-index: 20;">
|
||||||
{% if setting('core.account_country') %}
|
{% if setting('core.account_country') %}
|
||||||
<td width="11px"><a href="{{ getLink('online?order=country') }}" class="white">#</A></td>
|
<td width="11px"><a href="{{ getLink('online')}}?order=country_{{ order == 'country_asc' ? 'desc' : 'asc' }}">#  </a>
|
||||||
|
</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if setting('core.online_outfit') %}
|
{% if setting('core.online_outfit') %}
|
||||||
<td class="white"><b>Outfit</b></td>
|
<td><b>Outfit</b></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<td width="60%"><a href="{{ getLink('online?order=name') }}" class="white">Name</A></td>
|
<td style="text-align:left; width:50%">Name  
|
||||||
<td width="20%"><a href="{{ getLink('online?order=level') }}" class="white">Level</A></td>
|
<small style="font-weight:normal">[<a href="{{ getLink('online')}}?order=name_{{ order == 'name_asc' ? 'desc' : 'asc' }}">sort</a>]</small>
|
||||||
<td width="20%"><a href="{{ getLink('online?order=vocation') }}" class="white">Vocation</td>
|
<img class="sortarrow" src="images/{{ order == 'name_asc' ? 'order_desc' : (order == 'name_desc' ? 'order_asc' : 'news/blank') }}.gif"/></td>
|
||||||
|
<td style="text-align:left;width:30%">Level  
|
||||||
|
<small style="font-weight:normal">[<a href="{{ getLink('online')}}?order=level_{{ order == 'level_asc' ? 'desc' : 'asc' }}">sort</a>]</small>
|
||||||
|
<img class="sortarrow" src="images/{{ order == 'level_asc' ? 'order_desc' : (order == 'level_desc' ? 'order_asc' : 'news/blank') }}.gif"/>
|
||||||
|
</td>
|
||||||
|
<td style="text-align:left;width:50%">Vocation  
|
||||||
|
<small style="font-weight:normal">[<a href="{{ getLink('online')}}?order=vocation_{{ order == 'vocation_asc' ? 'desc' : 'asc' }}">sort</a>]</small>
|
||||||
|
<img class="sortarrow" src="images/{{ order == 'vocation_asc' ? 'order_desc' : (order == 'vocation_desc' ? 'order_asc' : 'news/blank') }}.gif"/>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
{% set i = 0 %}
|
{% set i = 0 %}
|
||||||
{% for player in players %}
|
{% for player in players %}
|
||||||
{% set i = i + 1 %}
|
{% set i = i + 1 %}
|
||||||
<tr bgcolor="{{ getStyle(i) }}">
|
|
||||||
|
<tr style="background: {{ getStyle(i) }}; text-align: right; height: 40px;">
|
||||||
{% if setting('core.account_country') %}
|
{% if setting('core.account_country') %}
|
||||||
<td>{{ player.country_image|raw }}</td>
|
<td>{{ player.country_image|raw }}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if setting('core.online_outfit') %}
|
{% if setting('core.online_outfit') %}
|
||||||
<td width="5%"><img style="position:absolute;margin-top:{% if player.player.looktype in setting('core.outfit_images_wrong_looktypes') %}-20px;margin-left:-0px;{% else %}-45px;margin-left:-25px;{% endif %}" src="{{ player.outfit }}" alt="player outfit"/></td>
|
<td width="5%"><img style="position:absolute;margin-top:-48px;margin-left:-70px;" src="{{ player.outfit }}" alt="player outfit"/></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<td>{{ player.name|raw }}{{ player.skull }}</td>
|
|
||||||
<td>{{ player.level }}</td>
|
<td style="width:70%; text-align:left">
|
||||||
<td>{{ player.vocation }}</td>
|
{{ player.name|raw }}{{ player.skull }}
|
||||||
|
</td>
|
||||||
|
<td style="width:10%">{{ player.level }}</td>
|
||||||
|
<td style="width:20%">{{ player.vocation }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
{% endif %}
|
{% endset %}
|
||||||
|
{{ include('tables.headline.html.twig') }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user