#313 saimod_server_tbc characters, character
This commit is contained in:
parent
0696abdb5f
commit
ebdb73ab8b
@ -70,6 +70,47 @@ function init_saimod_mojotrollz_server_tbc_account_show(){
|
||||
}
|
||||
}
|
||||
|
||||
function init_saimod_mojotrollz_server_tbc_character(){
|
||||
{
|
||||
$('#tabs li').each(function(){
|
||||
$(this).removeClass('active');});
|
||||
$('#menu_character').parent().addClass('active');
|
||||
|
||||
$('#btn_search').click(function(){
|
||||
system.load('mojotrollz_server_tbc(character);search.'+$('#input_search').val(),true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function init_saimod_mojotrollz_server_tbc_character_show(){
|
||||
{
|
||||
$('#tabs li').each(function(){
|
||||
$(this).removeClass('active');});
|
||||
$('#menu_character').parent().addClass('active');
|
||||
}
|
||||
{
|
||||
$('.bot').click(function(){
|
||||
var account = $(this).attr('account');
|
||||
var guid = $(this).attr('guid');
|
||||
var server = $(this).attr('server');
|
||||
var status = $(this).attr('status');
|
||||
$.ajax({ type :'GET',
|
||||
url : './sai.php',
|
||||
data : { sai_mod: '.SAI.saimod_mojotrollz_server_tbc',
|
||||
action: 'bot_toggle',
|
||||
account: account,
|
||||
guid: guid,
|
||||
server: server,
|
||||
status: status},
|
||||
success : function() {
|
||||
system.reload();
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function init_saimod_mojotrollz_server_tbc_control(){
|
||||
{
|
||||
$('#tabs li').each(function(){
|
||||
|
||||
@ -49,7 +49,7 @@ class saimod_mojotrollz_server_tbc extends \SYSTEM\SAI\SaiModule {
|
||||
public static function sai_mod__SAI_saimod_mojotrollz_server_tbc_action_account_show($id){
|
||||
$vars = \SQL\TBC_ACCOUNT::Q1(array($id));
|
||||
$vars['entries'] = $vars['entries_test'] = '';
|
||||
$res = \SQL\TBC_CHARACTERS::QQ(array($id));
|
||||
$res = \SQL\TBC_ACCOUNT_CHARACTERS::QQ(array($id));
|
||||
while($r = $res->next()){
|
||||
$r['online'] = $r['online'] == 1 ? 'online' : 'offline';
|
||||
$r['status'] = $r['bot'] ? '1' : '0';
|
||||
@ -65,10 +65,46 @@ class saimod_mojotrollz_server_tbc extends \SYSTEM\SAI\SaiModule {
|
||||
$r['bot'] = $r['bot'] ? 'online' : 'offline';
|
||||
$r['server'] = 1;
|
||||
$r['account'] = $vars['id'];
|
||||
$vars['entries_test'] .= \SYSTEM\PAGE\replace::replaceFile(dirname(__FILE__).'/tpl/account_show_entry.tpl', $r);
|
||||
$vars['entries_test'] .= \SYSTEM\PAGE\replace::replaceFile(dirname(__FILE__).'/tpl/account_show_entry_test.tpl', $r);
|
||||
}
|
||||
return \SYSTEM\PAGE\replace::replaceFile(dirname(__FILE__).'/tpl/account_show.tpl',$vars);
|
||||
}
|
||||
public static function sai_mod__SAI_saimod_mojotrollz_server_tbc_action_character($search='%',$page=0){
|
||||
$res = \SQL\TBC_CHARACTERS::QQ(array($search,$search,$search));
|
||||
$count = \SQL\TBC_CHARACTERS_COUNT::Q1(array($search,$search,$search))['count'];
|
||||
|
||||
$vars = array();
|
||||
$vars['search'] = $search;
|
||||
$vars['page'] = $page;
|
||||
$vars['entries'] = '';
|
||||
$count_filtered = 0;
|
||||
$res->seek(100*$page);
|
||||
while(($r = $res->next()) && ($count_filtered < 100)){
|
||||
$r['online'] = $r['online'] == 1 ? 'online' : 'offline';
|
||||
$r['system_account'] = $r['system_account'] > 0 ? 'online' : 'offline';
|
||||
$r['bot'] = $r['bot'] > 0 ? 'online' : 'offline';
|
||||
$r['username'] = \htmlspecialchars($r['username']);
|
||||
$r['totaltime'] = floor($r['totaltime']/86400).'d '.gmdate("H\h i\m s\s", $r['totaltime']);
|
||||
$vars['entries'] .= \SYSTEM\PAGE\replace::replaceFile(dirname(__FILE__).'/tpl/character_entry.tpl', $r);
|
||||
$count_filtered++;}
|
||||
$vars['pagination'] = '';
|
||||
$vars['page_last'] = ceil($count/100)-1;
|
||||
for($i=0;$i < ceil($count/100);$i++){
|
||||
$data = array('page' => $i,'search' => $search, 'active' => ($i == $page) ? 'active' : '');
|
||||
$vars['pagination'] .= \SYSTEM\PAGE\replace::replaceFile(dirname(__FILE__).'/tpl/character_pagination.tpl', $data);
|
||||
}
|
||||
$vars['count'] = $count_filtered.'/'.$count;
|
||||
return \SYSTEM\PAGE\replace::replaceFile(dirname(__FILE__).'/tpl/character.tpl',$vars);
|
||||
}
|
||||
public static function sai_mod__SAI_saimod_mojotrollz_server_tbc_action_character_show($guid){
|
||||
$vars = \SQL\TBC_CHARACTER::Q1(array($guid));
|
||||
$vars['totaltime'] = floor($vars['totaltime']/86400).'d '.gmdate("H\h i\m s\s", $vars['totaltime']);
|
||||
$vars['online'] = $vars['online'] == 1 ? 'online' : 'offline';
|
||||
$vars['status'] = $vars['bot'] ? '1' : '0';
|
||||
$vars['bot'] = $vars['bot'] > 0 ? 'online' : 'offline';
|
||||
$vars['server'] = 0;
|
||||
return \SYSTEM\PAGE\replace::replaceFile(dirname(__FILE__).'/tpl/character_show.tpl',$vars);
|
||||
}
|
||||
|
||||
public static function sai_mod__SAI_saimod_mojotrollz_server_tbc_action_bot_toggle($account, $guid, $server, $status){
|
||||
if($status == 0){
|
||||
|
||||
@ -10,4 +10,9 @@ REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `na
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5650, 42, 2, 5600, 'bot_toggle', 'account', 'UINT0');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5651, 42, 2, 5600, 'bot_toggle', 'guid', 'UINT0');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5652, 42, 2, 5600, 'bot_toggle', 'server', 'UINT0');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5653, 42, 2, 5600, 'bot_toggle', 'status', 'UINT0');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5653, 42, 2, 5600, 'bot_toggle', 'status', 'UINT0');
|
||||
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5660, 42, 3, 5600, 'character', 'search', 'STRING');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5661, 42, 3, 5600, 'character', 'page', 'UINT0');
|
||||
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5670, 42, 2, 5600, 'character_show', 'guid', 'UINT0');
|
||||
@ -2,4 +2,6 @@ REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`
|
||||
REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (561, 42, 'status', 'mojotrollz_server_tbc', 560, 0, 0, '#tab', './sai.php?sai_mod=.SAI.saimod_mojotrollz_server_tbc&action=status', 'init_saimod_mojotrollz_server_tbc_status', '\\SAI\\saimod_mojotrollz_server_tbc');
|
||||
REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (562, 42, 'control', 'mojotrollz_server_tbc', 560, 0, 1, '#tab', './sai.php?sai_mod=.SAI.saimod_mojotrollz_server_tbc&action=control', 'init_saimod_mojotrollz_server_tbc_control', '\\SAI\\saimod_mojotrollz_server_tbc');
|
||||
REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (563, 42, 'account', 'mojotrollz_server_tbc', 560, 0, 1, '#tab', './sai.php?sai_mod=.SAI.saimod_mojotrollz_server_tbc&action=account&search=${search}&page=${page}', 'init_saimod_mojotrollz_server_tbc_account', '\\SAI\\saimod_mojotrollz_server_tbc');
|
||||
REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (564, 42, 'account_show', 'mojotrollz_server_tbc', 560, 0, 1, '#tab', './sai.php?sai_mod=.SAI.saimod_mojotrollz_server_tbc&action=account_show&id=${id}', 'init_saimod_mojotrollz_server_tbc_account_show', '\\SAI\\saimod_mojotrollz_server_tbc');
|
||||
REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (564, 42, 'account_show', 'mojotrollz_server_tbc', 560, 0, 1, '#tab', './sai.php?sai_mod=.SAI.saimod_mojotrollz_server_tbc&action=account_show&id=${id}', 'init_saimod_mojotrollz_server_tbc_account_show', '\\SAI\\saimod_mojotrollz_server_tbc');
|
||||
REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (565, 42, 'character', 'mojotrollz_server_tbc', 560, 0, 1, '#tab', './sai.php?sai_mod=.SAI.saimod_mojotrollz_server_tbc&action=character&search=${search}&page=${page}', 'init_saimod_mojotrollz_server_tbc_character', '\\SAI\\saimod_mojotrollz_server_tbc');
|
||||
REPLACE INTO `system_page` (`id`, `group`, `name`, `state`, `parent_id`, `login`, `type`, `div`, `url`, `func`, `php_class`) VALUES (566, 42, 'character_show', 'mojotrollz_server_tbc', 560, 0, 1, '#tab', './sai.php?sai_mod=.SAI.saimod_mojotrollz_server_tbc&action=character_show&guid=${guid}', 'init_saimod_mojotrollz_server_tbc_character_show', '\\SAI\\saimod_mojotrollz_server_tbc');
|
||||
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace SQL;
|
||||
class TBC_ACCOUNT_CHARACTERS extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function mysql(){return
|
||||
'SELECT chars.guid, chars.name, chars.level, chars.online,'.
|
||||
' mojotrollz_bot.account_id as bot'.
|
||||
' FROM mojotrollz_bot'.
|
||||
' RIGHT JOIN mangos_one_chars.characters as chars ON chars.account = mojotrollz_bot.account_id AND chars.guid = mojotrollz_bot.char_id AND mojotrollz_bot.server_id = 0'.
|
||||
' WHERE chars.account = ?;';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
namespace SQL;
|
||||
class TBC_CHARACTER extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function mysql(){return
|
||||
'SELECT chars.guid, chars.name, chars.level, chars.totaltime, chars.online,'.
|
||||
' accounts.id as account_id, accounts.username as username, accounts.email as email,'.
|
||||
' system_user.username as system_account,'.
|
||||
' COUNT(bots.account_id) as bot'.
|
||||
' FROM system_user'.
|
||||
' RIGHT JOIN mangos_one_realm.account as accounts ON UPPER(accounts.email) = UPPER(system_user.email)'.
|
||||
' LEFT JOIN mangos_one_chars.characters as chars ON chars.account = accounts.id'.
|
||||
' LEFT JOIN mojotrollz_bot as bots ON bots.account_id = accounts.id AND bots.char_id = chars.guid AND server_id = 0'.
|
||||
' WHERE chars.guid = ?'.
|
||||
' LIMIT 1;';
|
||||
}
|
||||
}
|
||||
@ -3,10 +3,15 @@ namespace SQL;
|
||||
class TBC_CHARACTERS extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function mysql(){return
|
||||
'SELECT chars.guid, chars.name, chars.level, chars.online,'.
|
||||
' mojotrollz_bot.account_id as bot'.
|
||||
' FROM mojotrollz_bot'.
|
||||
' RIGHT JOIN mangos_one_chars.characters as chars ON chars.account = mojotrollz_bot.account_id AND chars.guid = mojotrollz_bot.char_id AND mojotrollz_bot.server_id = 0'.
|
||||
' WHERE chars.account = ?;';
|
||||
'SELECT chars.guid, chars.name, chars.level, chars.totaltime, chars.online,'.
|
||||
' accounts.id as account_id, accounts.username as username, accounts.email as email,'.
|
||||
' COUNT(system_user.id) as system_account,'.
|
||||
' COUNT(bots.account_id) as bot'.
|
||||
' FROM system_user'.
|
||||
' RIGHT JOIN mangos_one_realm.account as accounts ON UPPER(accounts.email) = UPPER(system_user.email)'.
|
||||
' LEFT JOIN mangos_one_chars.characters as chars ON chars.account = accounts.id'.
|
||||
' LEFT JOIN mojotrollz_bot as bots ON bots.account_id = accounts.id AND bots.char_id = chars.guid AND server_id = 0'.
|
||||
' WHERE (chars.guid LIKE ? OR chars.name LIKE ? OR chars.level LIKE ?)'.
|
||||
' GROUP BY chars.guid;';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
namespace SQL;
|
||||
class TBC_CHARACTERS_COUNT extends \SYSTEM\DB\QP {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function mysql(){return
|
||||
'SELECT COUNT(*) as count FROM mangos_one_chars.characters as chars'.
|
||||
' WHERE (chars.guid LIKE ? OR chars.name LIKE ? OR chars.level LIKE ?)'.
|
||||
' LIMIT 1;';
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h4>TBC - Account</h4></div>
|
||||
<div class="panel-heading"><h4>TBC - Accounts</h4></div>
|
||||
<div class="panel-body">
|
||||
<button class="btn-sm btn btn-success" id="btn_search" type="submit" style="float: right; margin-left: 10px;"><span class="glyphicon glyphicon-search" aria-hidden="true"></span> Search</button>
|
||||
<input class="input-medium search-query action-control" id="input_search" type="text" placeholder="Search..." size="20" style="float: right;" value="${search}"/>
|
||||
@ -23,9 +23,9 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<ul class="pagination">
|
||||
<li><a href="#!mojotrollz_server_tbc(account);search.${search};page.0">«</a></li>
|
||||
<li><a href="#!mojotrollz_server_tbc(character);search.${search};page.0">«</a></li>
|
||||
${pagination}
|
||||
<li><a href="#!mojotrollz_server_tbc(account);search.${search};page.${page_last}">»</a></li>
|
||||
<li><a href="#!mojotrollz_server_tbc(character);search.${search};page.${page_last}">»</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,4 +1,4 @@
|
||||
<tr>
|
||||
<tr onclick="system.load('mojotrollz_server_tbc(character_show);guid.${guid}')">
|
||||
<td>${guid}</td>
|
||||
<td>${name}</td>
|
||||
<td>${level}</td>
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
<tr>
|
||||
<td>${guid}</td>
|
||||
<td>${name}</td>
|
||||
<td>${level}</td>
|
||||
<td><img class="bot" guid="${guid}" status="${status}" account="${account}" server="${server}" src="./api.php?call=files&cat=content&id=${bot}.png" width="18" height="18"/></td>
|
||||
<td><img src="./api.php?call=files&cat=content&id=${online}.png" width="18" height="18"/></td>
|
||||
</tr>
|
||||
@ -0,0 +1,30 @@
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h4>TBC - Characters</h4></div>
|
||||
<div class="panel-body">
|
||||
<button class="btn-sm btn btn-success" id="btn_search" type="submit" style="float: right; margin-left: 10px;"><span class="glyphicon glyphicon-search" aria-hidden="true"></span> Search</button>
|
||||
<input class="input-medium search-query action-control" id="input_search" type="text" placeholder="Search..." size="20" style="float: right;" value="${search}"/>
|
||||
<h6>Rows: ${count} Page: ${page}</h6>
|
||||
<table class="table table-hover table-condensed sai_table tablesorter">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>GUID</th>
|
||||
<th>Name</th>
|
||||
<th>Account</th>
|
||||
<th>Level</th>
|
||||
<th>Time</th>
|
||||
<th>Sys</th>
|
||||
<th>Bot</th>
|
||||
<th>On</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
${entries}
|
||||
</tbody>
|
||||
</table>
|
||||
<ul class="pagination">
|
||||
<li><a href="#!mojotrollz_server_tbc(character);search.${search};page.0">«</a></li>
|
||||
${pagination}
|
||||
<li><a href="#!mojotrollz_server_tbc(character);search.${search};page.${page_last}">»</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@ -0,0 +1,10 @@
|
||||
<tr onclick="system.load('mojotrollz_server_tbc(character_show);guid.${guid}')">
|
||||
<td>${guid}</td>
|
||||
<td>${name}</td>
|
||||
<td>${username} (${email})</td>
|
||||
<td>${level}</td>
|
||||
<td>${totaltime}</td>
|
||||
<td><img src="./api.php?call=files&cat=content&id=${system_account}.png" width="18" height="18"/></td>
|
||||
<td><img src="./api.php?call=files&cat=content&id=${bot}.png" width="18" height="18"/></td>
|
||||
<td><img src="./api.php?call=files&cat=content&id=${online}.png" width="18" height="18"/></td>
|
||||
</tr>
|
||||
@ -0,0 +1 @@
|
||||
<li class="${active}"><a href="#!mojotrollz_server_tbc(character);search.${search};page.${page}">${page}</a></li>
|
||||
@ -0,0 +1,44 @@
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h4>TBC - Character - <b>${name}</b></h4></div>
|
||||
<div class="panel-body">
|
||||
<table class="table table-hover table-condensed sai_table tablesorter">
|
||||
<tr>
|
||||
<th>GUID</th>
|
||||
<td>${guid}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<td>${name}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Level</th>
|
||||
<td>${level}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Time</th>
|
||||
<td>${totaltime}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Online</th>
|
||||
<td><img src="./api.php?call=files&cat=content&id=${online}.png" width="18" height="18"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Bot</th>
|
||||
<td><img class="bot" guid="${guid}" status="${status}" account="${account_id}" server="${server}" src="./api.php?call=files&cat=content&id=${bot}.png" width="18" height="18"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Account</th>
|
||||
<td><a href="#!mojotrollz_server_tbc(account_show);id.${account_id}">${username} (${email})</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>System Account</th>
|
||||
<td><a href="#!security(user);username.${system_account}">${system_account}</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
<button class="btn-sm btn btn-success" id="btn_back" onclick="system.back()"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> Back</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -3,6 +3,7 @@
|
||||
<li class="active"><a href="#!mojotrollz_server_tbc" id="menu_status">Status</a></li>
|
||||
<li><a href="#!mojotrollz_server_tbc(control)" id="menu_control">Control</a></li>
|
||||
<li><a href="#!mojotrollz_server_tbc(account)" id="menu_account">Account</a></li>
|
||||
<li><a href="#!mojotrollz_server_tbc(character)" id="menu_character">Character</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="tab"></div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user