2014-04-27 14:44:40 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace FML\Script\Features;
|
|
|
|
|
|
|
|
use FML\Controls\Control;
|
|
|
|
use FML\Controls\Label;
|
2014-05-14 23:24:00 +02:00
|
|
|
use FML\Script\Builder;
|
|
|
|
use FML\Script\Script;
|
2014-04-27 14:44:40 +02:00
|
|
|
use FML\Script\ScriptInclude;
|
2014-05-14 23:24:00 +02:00
|
|
|
use FML\Script\ScriptLabel;
|
2014-04-27 14:44:40 +02:00
|
|
|
|
|
|
|
/**
|
2017-03-25 18:40:15 +01:00
|
|
|
* Script Feature realizing a mechanism for browsing through Pages
|
2014-05-14 23:24:00 +02:00
|
|
|
*
|
2014-05-20 15:44:45 +02:00
|
|
|
* @author steeffeen <mail@steeffeen.com>
|
2017-03-25 18:40:15 +01:00
|
|
|
* @copyright FancyManiaLinks Copyright © 2017 Steffen Schröder
|
2014-05-14 23:24:00 +02:00
|
|
|
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
2014-04-27 14:44:40 +02:00
|
|
|
*/
|
2017-03-25 18:40:15 +01:00
|
|
|
class Paging extends ScriptFeature
|
|
|
|
{
|
2014-04-27 14:44:40 +02:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
/*
|
|
|
|
* Constants
|
|
|
|
*/
|
|
|
|
const VAR_CURRENT_PAGE = "FML_Paging_CurrentPage";
|
|
|
|
const FUNCTION_UPDATE_CURRENT_PAGE = "FML_UpdateCurrentPage";
|
2014-04-27 14:44:40 +02:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
/**
|
|
|
|
* @var Label $label Page number Label
|
|
|
|
*/
|
|
|
|
protected $label = null;
|
2014-04-27 14:44:40 +02:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
/**
|
|
|
|
* @var PagingPage[] $pages Pages
|
|
|
|
*/
|
|
|
|
protected $pages = array();
|
2014-04-27 14:44:40 +02:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
/**
|
|
|
|
* @var PagingButton[] $buttons Paging Buttons
|
|
|
|
*/
|
|
|
|
protected $buttons = array();
|
2014-04-27 14:44:40 +02:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
/**
|
|
|
|
* @var int $startPageNumber Start Page number
|
|
|
|
*/
|
|
|
|
protected $startPageNumber = null;
|
2014-04-27 14:44:40 +02:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
/**
|
|
|
|
* @var int $customMaxPageNumber Custom maximum page number
|
|
|
|
*/
|
|
|
|
protected $customMaxPageNumber = null;
|
2014-04-27 14:44:40 +02:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
/**
|
|
|
|
* @var string $previousChunkAction Previous chunk action name
|
|
|
|
*/
|
|
|
|
protected $previousChunkAction = null;
|
2014-04-27 14:44:40 +02:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
/**
|
|
|
|
* @var string $nextChunkAction Next chunk action name
|
|
|
|
*/
|
|
|
|
protected $nextChunkAction = null;
|
2014-04-27 14:44:40 +02:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
/**
|
|
|
|
* @var bool $chunkActionAppendsPageNumber Chunk action appended with Page number
|
|
|
|
*/
|
|
|
|
protected $chunkActionAppendsPageNumber = null;
|
2014-04-27 14:44:40 +02:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
/**
|
|
|
|
* Construct a new Paging
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @param Label $label (optional) Page number Label
|
|
|
|
* @param PagingPage[] $pages (optional) Pages
|
|
|
|
* @param PagingButton[] $buttons (optional) Pageing Buttons
|
|
|
|
*/
|
|
|
|
public function __construct(Label $label = null, array $pages = null, array $buttons = null)
|
|
|
|
{
|
|
|
|
if ($label) {
|
|
|
|
$this->setLabel($label);
|
|
|
|
}
|
|
|
|
if ($pages) {
|
|
|
|
$this->setPages($pages);
|
|
|
|
}
|
|
|
|
if ($buttons) {
|
|
|
|
$this->setButtons($buttons);
|
|
|
|
}
|
|
|
|
}
|
2014-04-28 16:59:55 +02:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
/**
|
|
|
|
* Get the Label showing the Page number
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @return Label
|
|
|
|
*/
|
|
|
|
public function getLabel()
|
|
|
|
{
|
|
|
|
return $this->label;
|
|
|
|
}
|
2014-04-27 14:44:40 +02:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
/**
|
|
|
|
* Set the Label showing the Page number
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @param Label $label Page number Label
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
public function setLabel(Label $label)
|
|
|
|
{
|
|
|
|
$label->checkId();
|
|
|
|
$this->label = $label;
|
|
|
|
return $this;
|
|
|
|
}
|
2014-05-14 23:24:00 +02:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
/**
|
|
|
|
* Get the Pages
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @return PagingPage[]
|
|
|
|
*/
|
|
|
|
public function getPages()
|
|
|
|
{
|
|
|
|
return $this->pages;
|
|
|
|
}
|
2014-05-14 23:24:00 +02:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
/**
|
|
|
|
* Add a new Page Control
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @param Control $pageControl Page Control
|
|
|
|
* @param string $pageNumber (optional) Page number
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
public function addPageControl(Control $pageControl, $pageNumber = null)
|
|
|
|
{
|
|
|
|
if ($pageNumber === null) {
|
|
|
|
$pageNumber = count($this->pages) + 1;
|
|
|
|
}
|
|
|
|
$page = new PagingPage($pageControl, $pageNumber);
|
|
|
|
return $this->addPage($page);
|
|
|
|
}
|
2014-05-14 23:24:00 +02:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
/**
|
|
|
|
* Add a new Page
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @param PagingPage $page Page
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
public function addPage(PagingPage $page)
|
|
|
|
{
|
|
|
|
if (!in_array($page, $this->pages, true)) {
|
|
|
|
array_push($this->pages, $page);
|
|
|
|
}
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add new Pages
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @param PagingPage[] $pages Pages
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
public function setPages(array $pages)
|
|
|
|
{
|
|
|
|
$this->pages = array();
|
|
|
|
foreach ($pages as $page) {
|
|
|
|
$this->addPage($page);
|
|
|
|
}
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the Buttons
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @return PagingButton[]
|
|
|
|
*/
|
|
|
|
public function getButtons()
|
|
|
|
{
|
|
|
|
return $this->buttons;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a new Button Control to browse through the Pages
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @param Control $buttonControl Button used for browsing
|
|
|
|
* @param int $browseAction (optional) Number of browsed Pages per click
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
public function addButtonControl(Control $buttonControl, $browseAction = null)
|
|
|
|
{
|
|
|
|
if ($browseAction === null) {
|
|
|
|
$buttonCount = count($this->buttons);
|
|
|
|
if ($buttonCount % 2 === 0) {
|
|
|
|
$browseAction = $buttonCount / 2 + 1;
|
|
|
|
} else {
|
|
|
|
$browseAction = $buttonCount / -2 - 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$button = new PagingButton($buttonControl, $browseAction);
|
|
|
|
return $this->addButton($button);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a new Button to browse through Pages
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @param PagingButton $button Paging Button
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
public function addButton(PagingButton $button)
|
|
|
|
{
|
|
|
|
if (!in_array($button, $this->buttons, true)) {
|
|
|
|
array_push($this->buttons, $button);
|
|
|
|
}
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the Paging Buttons
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @param PagingButton[] $buttons Paging Buttons
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
public function setButtons(array $buttons)
|
|
|
|
{
|
|
|
|
$this->buttons = array();
|
|
|
|
foreach ($buttons as $button) {
|
|
|
|
$this->addButton($button);
|
|
|
|
}
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the start Page number
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
public function getStartPageNumber()
|
|
|
|
{
|
|
|
|
return $this->startPageNumber;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the start Page number
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @param int $startPageNumber Page number to start with
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
public function setStartPageNumber($startPageNumber)
|
|
|
|
{
|
|
|
|
$this->startPageNumber = (int)$startPageNumber;
|
|
|
|
return $this;
|
|
|
|
}
|
2014-05-14 23:24:00 +02:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
/**
|
|
|
|
* Get a custom maximum Page number for using chunks
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
public function getCustomMaxPageNumber()
|
|
|
|
{
|
|
|
|
return $this->customMaxPageNumber;
|
|
|
|
}
|
2014-05-14 23:24:00 +02:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
/**
|
|
|
|
* Set a custom maximum Page number for using chunks
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @param int $maxPageNumber Custom maximum Page number
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
public function setCustomMaxPageNumber($maxPageNumber)
|
|
|
|
{
|
|
|
|
$this->customMaxPageNumber = (int)$maxPageNumber;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the action triggered when the previous chunk is needed
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getPreviousChunkAction()
|
|
|
|
{
|
|
|
|
return $this->previousChunkAction;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the action triggered when the previous chunk is needed
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @param string $previousChunkAction Triggered action
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
public function setPreviousChunkAction($previousChunkAction)
|
|
|
|
{
|
|
|
|
$this->previousChunkAction = (string)$previousChunkAction;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the action triggered when the next chunk is needed
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getNextChunkAction()
|
|
|
|
{
|
|
|
|
return $this->nextChunkAction;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the action triggered when the next chunk is needed
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @param string $nextChunkAction Triggered action
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
public function setNextChunkAction($nextChunkAction)
|
|
|
|
{
|
|
|
|
$this->nextChunkAction = (string)$nextChunkAction;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the actions triggered when another chunk is needed
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @param string $chunkAction Triggered action
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
public function setChunkActions($chunkAction)
|
|
|
|
{
|
|
|
|
return $this->setNextChunkAction($chunkAction)
|
|
|
|
->setPreviousChunkAction($chunkAction);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get if the chunk action should append the needed Page number
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function getChunkActionAppendsPageNumber()
|
|
|
|
{
|
|
|
|
return $this->chunkActionAppendsPageNumber;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set if the chunk action should append the needed Page number
|
|
|
|
*
|
|
|
|
* @api
|
|
|
|
* @param bool $appendPageNumber Append the needed Page number
|
|
|
|
* @return static
|
|
|
|
*/
|
|
|
|
public function setChunkActionAppendsPageNumber($appendPageNumber)
|
|
|
|
{
|
|
|
|
$this->chunkActionAppendsPageNumber = (bool)$appendPageNumber;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @see ScriptFeature::prepare()
|
|
|
|
*/
|
|
|
|
public function prepare(Script $script)
|
|
|
|
{
|
|
|
|
if (empty($this->pages)) {
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
$script->setScriptInclude(ScriptInclude::TEXTLIB);
|
|
|
|
|
|
|
|
$currentPageVariable = self::VAR_CURRENT_PAGE;
|
|
|
|
$updatePageFunction = self::FUNCTION_UPDATE_CURRENT_PAGE;
|
|
|
|
|
|
|
|
$minPageNumber = 1;
|
|
|
|
$startPageNumber = (is_int($this->startPageNumber) ? $this->startPageNumber : $minPageNumber);
|
|
|
|
$maxPage = $this->getMaxPage();
|
|
|
|
$maxPageNumber = $this->customMaxPageNumber;
|
|
|
|
if (!is_int($maxPageNumber)) {
|
|
|
|
$maxPageNumber = $maxPage->getPageNumber();
|
|
|
|
}
|
|
|
|
|
|
|
|
$pagingId = $maxPage->getControl()
|
|
|
|
->getId(true, true);
|
|
|
|
$pagingId = Builder::escapeText($maxPage->getControl()
|
|
|
|
->getId());
|
|
|
|
$pageLabelId = Builder::EMPTY_STRING;
|
|
|
|
if ($this->label) {
|
|
|
|
$pageLabelId = Builder::escapeText($this->label->getId());
|
|
|
|
}
|
|
|
|
|
|
|
|
$pagesArrayText = $this->getPagesArrayText();
|
|
|
|
$pageButtonsArrayText = $this->getPageButtonsArrayText();
|
|
|
|
|
|
|
|
$previousChunkAction = Builder::escapeText($this->previousChunkAction);
|
|
|
|
$nextChunkAction = Builder::escapeText($this->nextChunkAction);
|
|
|
|
$chunkActionAppendsPageNumber = Builder::getBoolean($this->chunkActionAppendsPageNumber);
|
|
|
|
|
|
|
|
// Init
|
|
|
|
$initScriptText = "
|
2014-04-27 14:44:40 +02:00
|
|
|
declare {$currentPageVariable} for This = Integer[Text];
|
2014-06-21 03:18:21 +02:00
|
|
|
{$currentPageVariable}[{$pagingId}] = {$startPageNumber};
|
|
|
|
{$updatePageFunction}({$pagingId}, {$pageLabelId}, 0, {$minPageNumber}, {$maxPageNumber}, {$pagesArrayText}, {$previousChunkAction}, {$nextChunkAction}, {$chunkActionAppendsPageNumber});";
|
2017-03-25 18:40:15 +01:00
|
|
|
$script->appendGenericScriptLabel(ScriptLabel::ONINIT, $initScriptText, true);
|
2014-05-14 23:24:00 +02:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
// MouseClick
|
|
|
|
$clickScriptText = "
|
2014-04-27 14:44:40 +02:00
|
|
|
declare PageButtons = {$pageButtonsArrayText};
|
|
|
|
if (PageButtons.existskey(Event.Control.ControlId)) {
|
|
|
|
declare BrowseAction = PageButtons[Event.Control.ControlId];
|
2014-06-21 03:18:21 +02:00
|
|
|
{$updatePageFunction}({$pagingId}, {$pageLabelId}, BrowseAction, {$minPageNumber}, {$maxPageNumber}, {$pagesArrayText}, {$previousChunkAction}, {$nextChunkAction}, {$chunkActionAppendsPageNumber});
|
2014-04-27 14:44:40 +02:00
|
|
|
}";
|
2017-03-25 18:40:15 +01:00
|
|
|
$script->appendGenericScriptLabel(ScriptLabel::MOUSECLICK, $clickScriptText, true);
|
2014-05-14 23:24:00 +02:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
// Update function
|
|
|
|
$functionText = "
|
2014-04-27 14:44:40 +02:00
|
|
|
Void {$updatePageFunction}(Text _PagingId, Text _PageLabelId, Integer _BrowseAction, Integer _MinPageNumber, Integer _MaxPageNumber, Text[Integer] _Pages, Text _PreviousChunkAction, Text _NextChunkAction, Boolean _ChunkActionAppendPageNumber) {
|
|
|
|
declare {$currentPageVariable} for This = Integer[Text];
|
|
|
|
if (!{$currentPageVariable}.existskey(_PagingId)) return;
|
|
|
|
declare CurrentPage = {$currentPageVariable}[_PagingId] + _BrowseAction;
|
|
|
|
if (CurrentPage < _MinPageNumber) {
|
|
|
|
CurrentPage = _MinPageNumber;
|
|
|
|
} else if (CurrentPage > _MaxPageNumber) {
|
|
|
|
CurrentPage = _MaxPageNumber;
|
|
|
|
}
|
|
|
|
{$currentPageVariable}[_PagingId] = CurrentPage;
|
|
|
|
declare PageFound = False;
|
|
|
|
foreach (PageNumber => PageId in _Pages) {
|
|
|
|
declare PageControl <=> Page.GetFirstChild(PageId);
|
|
|
|
PageControl.Visible = (CurrentPage == PageNumber);
|
|
|
|
if (PageControl.Visible) {
|
|
|
|
PageFound = True;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!PageFound && _BrowseAction != 0) {
|
|
|
|
declare Text ChunkAction;
|
|
|
|
if (_BrowseAction < 0) {
|
|
|
|
ChunkAction = _PreviousChunkAction;
|
|
|
|
} else {
|
|
|
|
ChunkAction = _NextChunkAction;
|
|
|
|
}
|
|
|
|
if (_ChunkActionAppendPageNumber) {
|
|
|
|
ChunkAction ^= CurrentPage;
|
|
|
|
}
|
|
|
|
TriggerPageAction(ChunkAction);
|
|
|
|
}
|
2014-06-21 03:18:21 +02:00
|
|
|
if (_PageLabelId == " . Builder::EMPTY_STRING . ") return;
|
2014-04-27 14:44:40 +02:00
|
|
|
declare PageLabel <=> (Page.GetFirstChild(_PageLabelId) as CMlLabel);
|
|
|
|
if (PageLabel == Null) return;
|
|
|
|
PageLabel.Value = CurrentPage^\"/\"^_MaxPageNumber;
|
|
|
|
}";
|
2017-03-25 18:40:15 +01:00
|
|
|
$script->addScriptFunction($updatePageFunction, $functionText);
|
|
|
|
return $this;
|
|
|
|
}
|
2014-04-28 16:59:55 +02:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
/**
|
|
|
|
* Get the minimum Page
|
|
|
|
*
|
|
|
|
* @return PagingPage
|
|
|
|
*/
|
|
|
|
protected function getMinPage()
|
|
|
|
{
|
|
|
|
$minPageNumber = null;
|
|
|
|
$minPage = null;
|
|
|
|
foreach ($this->pages as $page) {
|
|
|
|
$pageNumber = $page->getPageNumber();
|
|
|
|
if ($minPageNumber === null || $pageNumber < $minPageNumber) {
|
|
|
|
$minPageNumber = $pageNumber;
|
|
|
|
$minPage = $page;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $minPage;
|
|
|
|
}
|
2014-04-27 14:44:40 +02:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
/**
|
|
|
|
* Get the maximum Page
|
|
|
|
*
|
|
|
|
* @return PagingPage
|
|
|
|
*/
|
|
|
|
protected function getMaxPage()
|
|
|
|
{
|
|
|
|
$maxPageNumber = null;
|
|
|
|
$maxPage = null;
|
|
|
|
foreach ($this->pages as $page) {
|
|
|
|
$pageNumber = $page->getPageNumber();
|
|
|
|
if ($maxPageNumber === null || $pageNumber > $maxPageNumber) {
|
|
|
|
$maxPageNumber = $pageNumber;
|
|
|
|
$maxPage = $page;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $maxPage;
|
|
|
|
}
|
2014-04-27 14:44:40 +02:00
|
|
|
|
2017-03-25 18:40:15 +01:00
|
|
|
/**
|
|
|
|
* Build the array text for the Pages
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
protected function getPagesArrayText()
|
|
|
|
{
|
|
|
|
if (empty($this->pages)) {
|
|
|
|
return Builder::getArray(array(0 => ''), true);
|
|
|
|
}
|
|
|
|
$pages = array();
|
|
|
|
foreach ($this->pages as $page) {
|
|
|
|
$pages[$page->getPageNumber()] = $page->getControl()
|
|
|
|
->getId();
|
|
|
|
}
|
|
|
|
return Builder::getArray($pages, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Build the array text for the Page Buttons
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
protected function getPageButtonsArrayText()
|
|
|
|
{
|
|
|
|
if (empty($this->buttons)) {
|
|
|
|
return Builder::getArray(array('' => 0), true);
|
|
|
|
}
|
|
|
|
$pageButtons = array();
|
|
|
|
foreach ($this->buttons as $pageButton) {
|
|
|
|
$pageButtons[$pageButton->getControl()
|
|
|
|
->getId()] = $pageButton->getPagingCount();
|
|
|
|
}
|
|
|
|
return Builder::getArray($pageButtons, true);
|
|
|
|
}
|
2014-04-27 14:44:40 +02:00
|
|
|
|
|
|
|
}
|