2 namespace TYPO3\CMS\Fluid\ViewHelpers\Be\Widget\Controller;
26 protected $configuration = array(
'itemsPerPage' => 10,
'insertAbove' =>
false,
'insertBelow' =>
true,
'recordsLabel' =>
'');
63 $this->objects = $this->widgetConfiguration[
'objects'];
64 \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($this->configuration, $this->widgetConfiguration[
'configuration'],
false);
65 $this->numberOfObjects = count($this->objects);
66 $this->numberOfPages = ceil($this->numberOfObjects / (
int)$this->configuration[
'itemsPerPage']);
77 if ($this->currentPage < 1) {
78 $this->currentPage = 1;
80 if ($this->currentPage > $this->numberOfPages) {
82 $modifiedObjects = null;
85 $this->itemsPerPage = (int)$this->configuration[
'itemsPerPage'];
86 $query = $this->objects->getQuery();
87 $query->setLimit($this->itemsPerPage);
88 $this->offset = $this->itemsPerPage * ($this->currentPage - 1);
89 if ($this->currentPage > 1) {
90 $query->setOffset($this->offset);
92 $modifiedObjects = $query->execute();
94 $this->view->assign(
'contentArguments', array(
95 $this->widgetConfiguration[
'as'] => $modifiedObjects
97 $this->view->assign(
'configuration', $this->configuration);
109 if ($endRecord > $this->numberOfObjects) {
113 'current' => $this->currentPage,
114 'numberOfPages' => $this->numberOfPages,
115 'hasLessPages' => $this->currentPage > 1,
116 'hasMorePages' => $this->currentPage < $this->numberOfPages,
117 'startRecord' => $this->offset + 1,
118 'endRecord' => $endRecord
120 if ($this->currentPage < $this->numberOfPages) {
121 $pagination[
'nextPage'] = $this->currentPage + 1;
123 if ($this->currentPage > 1) {
124 $pagination[
'previousPage'] = $this->currentPage - 1;