7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
16 * @package Zend_Paginator
17 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
18 * @license http://framework.zend.com/license/new-bsd New BSD License
19 * @version $Id: Jumping.php 16215 2009-06-21 19:36:07Z thomas $
23 * @see Zend_Paginator_ScrollingStyle_Interface
25 require_once 'Zend/Paginator/ScrollingStyle/Interface.php';
28 * A scrolling style in which the cursor advances to the upper bound
29 * of the page range, the page range "jumps" to the next section, and
30 * the cursor moves back to the beginning of the range.
33 * @package Zend_Paginator
34 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
35 * @license http://framework.zend.com/license/new-bsd New BSD License
37 class Zend_Paginator_ScrollingStyle_Jumping
implements Zend_Paginator_ScrollingStyle_Interface
40 * Returns an array of "local" pages given a page number and range.
42 * @param Zend_Paginator $paginator
43 * @param integer $pageRange Unused
46 public function getPages(Zend_Paginator
$paginator, $pageRange = null)
48 $pageRange = $paginator->getPageRange();
49 $pageNumber = $paginator->getCurrentPageNumber();
51 $delta = $pageNumber %
$pageRange;
57 $offset = $pageNumber - $delta;
58 $lowerBound = $offset +
1;
59 $upperBound = $offset +
$pageRange;
61 return $paginator->getPagesInRange($lowerBound, $upperBound);