Advertisement
Guest User

PaginateViewHelper.php

a guest
Sep 8th, 2013
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.59 KB | None | 0 0
  1. <?php
  2. namespace Emmar\MsPartners\ViewHelpers\Widget;
  3. //namespace TYPO3\CMS\Fluid\ViewHelpers\Widget;
  4.  
  5. /*                                                                        *
  6.  * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
  7.  *                                                                        *
  8.  * It is free software; you can redistribute it and/or modify it under    *
  9.  * the terms of the GNU Lesser General Public License, either version 3   *
  10.  *  of the License, or (at your option) any later version.                *
  11.  *                                                                        *
  12.  *                                                                        *
  13.  * This script is distributed in the hope that it will be useful, but     *
  14.  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
  15.  * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
  16.  * General Public License for more details.                               *
  17.  *                                                                        *
  18.  * You should have received a copy of the GNU Lesser General Public       *
  19.  * License along with the script.                                         *
  20.  * If not, see http://www.gnu.org/licenses/lgpl.html                      *
  21.  *                                                                        *
  22.  * The TYPO3 project - inspiring people to share!                         *
  23.  *                                                                        */
  24. /**
  25.  * This ViewHelper renders a Pagination of objects.
  26.  *
  27.  * = Examples =
  28.  *
  29.  * <code title="required arguments">
  30.  * <f:widget.paginate objects="{blogs}" as="paginatedBlogs">
  31.  * use {paginatedBlogs} as you used {blogs} before, most certainly inside
  32.  * a <f:for> loop.
  33.  * </f:widget.paginate>
  34.  * </code>
  35.  *
  36.  * <code title="full configuration">
  37.  * <f:widget.paginate objects="{blogs}" as="paginatedBlogs" configuration="{itemsPerPage: 5, insertAbove: 1, insertBelow: 0, maximumNumberOfLinks: 10}">
  38.  * use {paginatedBlogs} as you used {blogs} before, most certainly inside
  39.  * a <f:for> loop.
  40.  * </f:widget.paginate>
  41.  * </code>
  42.  *
  43.  * = Performance characteristics =
  44.  *
  45.  * In the above examples, it looks like {blogs} contains all Blog objects, thus
  46.  * you might wonder if all objects were fetched from the database.
  47.  * However, the blogs are NOT fetched from the database until you actually use them,
  48.  * so the paginate ViewHelper will adjust the query sent to the database and receive
  49.  * only the small subset of objects.
  50.  * So, there is no negative performance overhead in using the Paginate Widget.
  51.  *
  52.  * @api
  53.  */
  54. class PaginateViewHelper extends \TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetViewHelper {
  55.  
  56.     /**
  57.      * @var \Emmar\MsPartners\ViewHelpers\Widget\Controller\PaginateController
  58.      */
  59.     protected $controller;
  60.  
  61.     /**
  62.      * @param \Emmar\MsPartners\ViewHelpers\Widget\Controller\PaginateController $controller
  63.      * @return void
  64.      */
  65.     public function injectController(\Emmar\MsPartners\ViewHelpers\Widget\Controller\PaginateController $controller) {
  66.         $this->controller = $controller;
  67.     }
  68.     /**
  69.      * @param \TYPO3\CMS\Extbase\Persistence\QueryResultInterface $objects
  70.      * @param string $as
  71.      * @param array $configuration
  72.      * @param array $filter
  73.      * @return string
  74.      */
  75.     public function render(\TYPO3\CMS\Extbase\Persistence\QueryResultInterface $objects, $as, array $configuration = array('itemsPerPage' => 10, 'insertAbove' => FALSE, 'insertBelow' => TRUE, 'maximumNumberOfLinks' => 99), $filter = array()) {
  76.         return $this->initiateSubRequest();
  77.     }
  78. }
  79.  
  80. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement