added libuserlist page, that shows entire list of users in the lib db, admins can remove entry of it and perform manual syncing. Still needs some work though

--HG--
branch : quitta-gsoc-2013
This commit is contained in:
Quitta 2013-06-29 06:46:10 +02:00
parent a3b3dbd59c
commit 4f82afa5d0
4 changed files with 79 additions and 1 deletions

View file

@ -3,6 +3,8 @@
[home] [home]
[libuserlist]
[userlist] [userlist]
userlist_info = "welcome to the userlist" userlist_info = "welcome to the userlist"

View file

@ -19,7 +19,7 @@ $cfg['db']['lib']['name'] = 'ryzom_ams_lib';
$cfg['db']['lib']['user'] = 'root'; $cfg['db']['lib']['user'] = 'root';
$cfg['db']['lib']['pass'] = 'lol123'; $cfg['db']['lib']['pass'] = 'lol123';
$cfg['db']['shard']['host'] = 'localhost'; $cfg['db']['shard']['host'] = 'localhosti';
$cfg['db']['shard']['port'] = '3306'; $cfg['db']['shard']['port'] = '3306';
$cfg['db']['shard']['name'] = 'nel'; $cfg['db']['shard']['name'] = 'nel';
$cfg['db']['shard']['user'] = 'shard'; $cfg['db']['shard']['user'] = 'shard';

View file

@ -0,0 +1,50 @@
<?php
//This checks to see if there is a page number. If not, it will set it to page 1
if (!(isset($_GET['pagenum']))){
$pagenum = 1;
}else{
$pagenum = $_GET['pagenum'];
}
//Here we count the number of results
global $cfg;
$dbl = new DBLayer($cfg['db']['lib']);
$rows = $dbl->executeWithoutParams("SELECT * FROM ams_querycache")->rowCount();
//This is the number of results displayed per page
$page_rows = 2;
//This tells us the page number of our last page
$last = ceil($rows/$page_rows);
//this makes sure the page number isn't below one, or more than our maximum pages
if ($pagenum < 1)
{
$pagenum = 1;
}else if ($pagenum > $last) {
$pagenum = $last;
}
//This sets the range to display in our query
$max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows;
//This is your query again, the same one... the only difference is we add $max into it
$data = $dbl->executeWithoutParams("SELECT * FROM ams_querycache $max");
//This is where we put the results in a resultArray to be sent to smarty
$pageResult['liblist'] = Array();
$i = 0;
while($row = $data->fetch(PDO::FETCH_ASSOC)){
$decode = json_decode($row['query']);
$pageResult['liblist'][$i]['id'] = $row['SID'];
$pageResult['liblist'][$i]['type'] = $row['type'];
$pageResult['liblist'][$i]['name'] = $decode[0];
$pageResult['liblist'][$i]['mail'] = $decode[2];
$i++;
}
$pageResult['permission'] = 1;
$pageResult['no_visible_elements'] = 'FALSE';
helpers :: loadtemplate( 'libuserlist', $pageResult);
exit();

View file

@ -0,0 +1,26 @@
{block name=content}
<div class="row-fluid">
<div class="box span12">
<div class="box-header well">
<h2><i class="icon-info-sign"></i>The users in the libDB</h2>
<div class="box-icon">
<a href="#" class="btn btn-round" onclick="javascript:show_help('intro');return false;"><i class="icon-info-sign"></i></a>
<a href="#" class="btn btn-setting btn-round"><i class="icon-cog"></i></a>
<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
</div>
</div>
<div class="box-content">
<table border="1" cellpadding="5">
<tr><td><strong>ID</strong></td><td><strong>type</strong></td><td><strong>user</strong></td><td><strong>email</strong></td><td><strong>remove</strong></td></tr>
{foreach from=$liblist item=element}
<tr><td>{$element.id}</td><td>{$element.type}</td><td>{$element.name}</td><td>{$element.mail}</td><td><a class="btn btn-danger" href="index.php?page=libuserlist&action=remove&id={$element.id}"><i class="icon-trash icon-white"></i>Delete</a></td></tr>
{/foreach}
</table>
<div class="clearfix"></div>
</div>
</div>
</div>
{/block}