mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 01:09:21 +02:00
Modules in admin panel, thanks to Lee for the code
This commit is contained in:
parent
d03989481b
commit
ded5274be7
@ -62,18 +62,6 @@ $query = $db->query('SELECT count(*) as `how_much` FROM `houses`;');
|
||||
$query = $query->fetch();
|
||||
$total_houses = $query['how_much'];
|
||||
|
||||
if ($db->hasColumn('accounts', 'premium_points')) {
|
||||
$points = $db->query('SELECT `premium_points`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `premium_points` DESC LIMIT 10;');
|
||||
} else {
|
||||
$points = 0;
|
||||
}
|
||||
|
||||
if ($db->hasColumn('accounts', 'coins')) {
|
||||
$coins = $db->query('SELECT `coins`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `coins` DESC LIMIT 10;');
|
||||
} else {
|
||||
$coins = 0;
|
||||
}
|
||||
|
||||
$twig->display('admin.statistics.html.twig', array(
|
||||
'total_accounts' => $total_accounts,
|
||||
'total_players' => $total_players,
|
||||
@ -86,9 +74,23 @@ $twig->display('admin.dashboard.html.twig', array(
|
||||
'closed_message' => $closed_message,
|
||||
'status' => $status,
|
||||
'account_type' => (USE_ACCOUNT_NAME ? 'name' : 'number'),
|
||||
'points' => $points,
|
||||
'coins' => $coins,
|
||||
|
||||
));
|
||||
|
||||
echo '<div class="row">';
|
||||
$config['modules'] = "lastlogin,points,coins";
|
||||
if(isset($config['modules']))
|
||||
$config['modules'] = explode(",", $config['modules']);
|
||||
|
||||
$twig_loader->prependPath(__DIR__ . '/modules/templates');
|
||||
foreach($config['modules'] as $box) {
|
||||
$file = __DIR__ . '/modules/' . $box . '.php';
|
||||
if(file_exists($file)) {
|
||||
include($file);
|
||||
}
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
function clearCache()
|
||||
{
|
||||
global $template_name;
|
||||
|
11
system/pages/admin/modules/coins.php
Normal file
11
system/pages/admin/modules/coins.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
if ($db->hasColumn('accounts', 'coins')) {
|
||||
$coins = $db->query('SELECT `coins`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `coins` DESC LIMIT 10;');
|
||||
} else {
|
||||
$coins = 0;
|
||||
}
|
||||
|
||||
$twig->display('coins.html.twig', array(
|
||||
'coins' => $coins
|
||||
));
|
11
system/pages/admin/modules/lastlogin.php
Normal file
11
system/pages/admin/modules/lastlogin.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
if ($db->hasColumn('players', 'lastlogin')) {
|
||||
$players = $db->query('SELECT `id`, `name`,`level`,`lastlogin` FROM `players` ORDER BY `lastlogin` DESC LIMIT 10;');
|
||||
} else {
|
||||
$players = 0;
|
||||
}
|
||||
|
||||
$twig->display('lastlogin.html.twig', array(
|
||||
'players' => $players,
|
||||
));
|
10
system/pages/admin/modules/points.php
Normal file
10
system/pages/admin/modules/points.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
if ($db->hasColumn('accounts', 'premium_points')) {
|
||||
$points = $db->query('SELECT `premium_points`, `' . (USE_ACCOUNT_NAME ? 'name' : 'id') . '` as `name` FROM `accounts` ORDER BY `premium_points` DESC LIMIT 10;');
|
||||
} else {
|
||||
$points = 0;
|
||||
}
|
||||
|
||||
$twig->display('points.html.twig', array(
|
||||
'points' => $points,
|
||||
));
|
29
system/pages/admin/modules/templates/coins.html.twig
Normal file
29
system/pages/admin/modules/templates/coins.html.twig
Normal file
@ -0,0 +1,29 @@
|
||||
{% if coins is iterable %}
|
||||
<div class="col-md-3">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">Top 10 - Most coins</h3>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<table class="table table-condensed">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Account {{ account_type }}</th>
|
||||
<th>Tibia coins</th>
|
||||
</tr>
|
||||
{% set i = 0 %}
|
||||
{% for result in coins %}
|
||||
{% set i = i + 1 %}
|
||||
<tr>
|
||||
<td>{{ i }}</td>
|
||||
<td>{{ result.name }}</td>
|
||||
<td>{{ result.coins }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
29
system/pages/admin/modules/templates/lastlogin.html.twig
Normal file
29
system/pages/admin/modules/templates/lastlogin.html.twig
Normal file
@ -0,0 +1,29 @@
|
||||
{% if players is iterable %}
|
||||
<div class="col-md-3">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">Last 10 Logins</h3>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<table class="table table-condensed">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Player</th>
|
||||
<th>Login Date</th>
|
||||
</tr>
|
||||
{% set i = 0 %}
|
||||
{% for result in players %}
|
||||
{% set i = i + 1 %}
|
||||
<tr>
|
||||
<td>{{ i }}</td>
|
||||
<td>{{ result.name }}</td>
|
||||
<td>{{ result.lastlogin|date("M d Y, H:i:s") }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
29
system/pages/admin/modules/templates/points.html.twig
Normal file
29
system/pages/admin/modules/templates/points.html.twig
Normal file
@ -0,0 +1,29 @@
|
||||
{% if points is iterable %}
|
||||
<div class="col-md-3">
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">Top 10 - Most premium points</h3>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<table class="table table-condensed">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Account {{ account_type }}</th>
|
||||
<th>Premium points</th>
|
||||
</tr>
|
||||
{% set i = 0 %}
|
||||
{% for result in points %}
|
||||
{% set i = i + 1 %}
|
||||
<tr>
|
||||
<td>{{ i }}</td>
|
||||
<td>{{ result.name }}</td>
|
||||
<td>{{ result.premium_points }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
Loading…
x
Reference in New Issue
Block a user