File indexing completed on 2025-03-02 05:29:37
0001 <?php 0002 /** 0003 * Zend Framework 0004 * 0005 * LICENSE 0006 * 0007 * This source file is subject to the new BSD license that is bundled 0008 * with this package in the file LICENSE.txt. 0009 * It is also available through the world-wide-web at this URL: 0010 * http://framework.zend.com/license/new-bsd 0011 * If you did not receive a copy of the license and are unable to 0012 * obtain it through the world-wide-web, please send an email 0013 * to license@zend.com so we can send you a copy immediately. 0014 * 0015 * @category Zend 0016 * @package Zend_Paginator 0017 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0018 * @license http://framework.zend.com/license/new-bsd New BSD License 0019 * @version $Id$ 0020 */ 0021 0022 /** 0023 * @see Zend_Paginator_ScrollingStyle_Interface 0024 */ 0025 // require_once 'Zend/Paginator/ScrollingStyle/Interface.php'; 0026 0027 /** 0028 * A scrolling style in which the cursor advances to the upper bound 0029 * of the page range, the page range "jumps" to the next section, and 0030 * the cursor moves back to the beginning of the range. 0031 * 0032 * @category Zend 0033 * @package Zend_Paginator 0034 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0035 * @license http://framework.zend.com/license/new-bsd New BSD License 0036 */ 0037 class Zend_Paginator_ScrollingStyle_Jumping implements Zend_Paginator_ScrollingStyle_Interface 0038 { 0039 /** 0040 * Returns an array of "local" pages given a page number and range. 0041 * 0042 * @param Zend_Paginator $paginator 0043 * @param integer $pageRange Unused 0044 * @return array 0045 */ 0046 public function getPages(Zend_Paginator $paginator, $pageRange = null) 0047 { 0048 $pageRange = $paginator->getPageRange(); 0049 $pageNumber = $paginator->getCurrentPageNumber(); 0050 0051 $delta = $pageNumber % $pageRange; 0052 0053 if ($delta == 0) { 0054 $delta = $pageRange; 0055 } 0056 0057 $offset = $pageNumber - $delta; 0058 $lowerBound = $offset + 1; 0059 $upperBound = $offset + $pageRange; 0060 0061 return $paginator->getPagesInRange($lowerBound, $upperBound); 0062 } 0063 }