fixed paging

This commit is contained in:
Steffen Schröder 2014-05-15 15:13:30 +02:00
parent 8c32655ba9
commit d5b6e16ccd

View File

@ -82,10 +82,6 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener {
// get Admins // get Admins
$admins = $this->maniaControl->authenticationManager->getAdmins(); $admins = $this->maniaControl->authenticationManager->getAdmins();
$pagesId = '';
if (count($admins) > self::MAX_PLAYERS_PER_PAGE) {
$pagesId = 'AdminListPages';
}
//Create ManiaLink //Create ManiaLink
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); $maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
@ -94,7 +90,7 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener {
$script->addFeature($paging); $script->addFeature($paging);
// Main frame // Main frame
$frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $pagesId); $frame = $this->maniaControl->manialinkManager->styleManager->getDefaultListFrame($script, $paging);
$maniaLink->add($frame); $maniaLink->add($frame);
// Start offsets // Start offsets
@ -114,19 +110,16 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener {
$i = 1; $i = 1;
$y = $y - 10; $y = $y - 10;
$pageFrames = array(); $pageFrame = null;
foreach ($admins as $admin) { foreach ($admins as $admin) {
if (!isset($pageFrame)) { if ($i % self::MAX_PLAYERS_PER_PAGE === 1) {
$pageFrame = new Frame(); $pageFrame = new Frame();
$frame->add($pageFrame); $frame->add($pageFrame);
if (!empty($pageFrames)) {
$pageFrame->setVisible(false);
}
array_push($pageFrames, $pageFrame);
$y = $height / 2 - 10;
$paging->addPage($pageFrame);
}
$paging->addPage($pageFrame);
$y = $height / 2 - 10;
}
$playerFrame = new Frame(); $playerFrame = new Frame();
$pageFrame->add($playerFrame); $pageFrame->add($playerFrame);
@ -192,9 +185,6 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener {
$y -= 4; $y -= 4;
$i++; $i++;
if (($i - 1) % self::MAX_PLAYERS_PER_PAGE == 0) {
unset($pageFrame);
}
} }
// Render and display xml // Render and display xml