diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/pagination.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/pagination.php
index e653afbb9..a4890f980 100644
--- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/pagination.php
+++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/pagination.php
@@ -5,6 +5,7 @@ class Pagination{
private $element_array;
private $last;
private $current;
+ private $amountOfRows;
function __construct($query,$db,$nrDisplayed,$resultClass) {
if (!(isset($_GET['pagenum']))){
@@ -16,7 +17,7 @@ class Pagination{
//Here we count the number of results
$db = new DBLayer($db);
$rows = $db->executeWithoutParams($query)->rowCount();
-
+ $this->amountOfRows = $rows;
//the array hat will contain all users
if($rows > 0){
@@ -55,39 +56,41 @@ class Pagination{
return $this->last;
}
+ public function getCurrent(){
+ return $this->current;
+ }
public function getElements(){
return $this->element_array;
}
+ public function getAmountOfRows(){
+ return $this->amountOfRows;
+ }
public function getLinks($nrOfLinks){
$pageLinks = Array();
- $pageLinks[] = 1;
//if amount of showable links is greater than the amount of pages: show all!
if ($this->last <= $nrOfLinks){
- for($var = 2; $var <= $this->last; $var++){
+ for($var = 1; $var <= $this->last; $var++){
$pageLinks[] = $var;
}
}else{
- $offset = ($nrOfLinks-3)/2 ;
- print "offset:" . $offset . "";
+ $offset = ($nrOfLinks-1)/2 ;
$startpoint = $this->current - $offset;
$endpoint = $this->current + $offset;
- print "startpointX:" . $startpoint . "";
- if($startpoint < 2){
- $startpoint = 2;
- $endpoint = $startpoint + $nrOfLinks - 3;
- }else if($endpoint > $this->last-1){
- $endpoint = $this->last-1;
- $startpoint = $endpoint - ($nrOfLinks -3);
+
+ if($startpoint < 1){
+ $startpoint = 1;
+ $endpoint = $startpoint + $nrOfLinks - 1;
+ }else if($endpoint > $this->last){
+ $endpoint = $this->last;
+ $startpoint = $endpoint - ($nrOfLinks -1);
}
- print "startpoint:" . $startpoint . "";
- print "endpoint:" . $endpoint . "";
+
for($var = $startpoint; $var <= $endpoint; $var++){
$pageLinks[] = $var;
}
- $pageLinks[] = $this->last;
}
return $pageLinks;
}
diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/libuserlist.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/libuserlist.php
index 5748e3fb6..66e8b9634 100644
--- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/libuserlist.php
+++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/libuserlist.php
@@ -4,19 +4,12 @@
function libuserlist(){
if(Ticket_User::isAdmin($_SESSION['ticket_user'])){
- $pagination = new Pagination("SELECT * FROM ams_querycache","lib",1,"Querycache");
- print "1 elements / page
";
- print "7 links max";
- print "
";
- print "last page=";
- print_r($pagination->getLast());
- print "
----------------------------------------------
";
- print "elements:";
- print_r($pagination->getElements());
- print "
----------------------------------------------
";
- print "links:";
- print_r($pagination->getLinks(7));
- exit;
+ $pagination = new Pagination("SELECT * FROM ams_querycache","lib",2,"Querycache");
+ $pageResult['liblist'] = Gui_Elements::make_table($pagination->getElements() , Array("getSID","getType"), Array("id","type"));
+ $pageResult['links'] = $pagination->getLinks(5);
+ $pageResult['lastPage'] = $pagination->getLast();
+ $pageResult['currentPage'] = $pagination->getCurrent();
+
//check if shard is online
try{
diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/table.php b/code/ryzom/tools/server/ryzom_ams/www/html/table.php
index d0eb7d815..0a023296c 100644
--- a/code/ryzom/tools/server/ryzom_ams/www/html/table.php
+++ b/code/ryzom/tools/server/ryzom_ams/www/html/table.php
@@ -210,6 +210,710 @@
+