3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\Paginator\ScrollingStyle
;
12 use Zend\Paginator\Paginator
;
15 * A scrolling style in which the cursor advances to the upper bound
16 * of the page range, the page range "jumps" to the next section, and
17 * the cursor moves back to the beginning of the range.
19 class Jumping
implements ScrollingStyleInterface
22 * Returns an array of "local" pages given a page number and range.
24 * @param Paginator $paginator
25 * @param int $pageRange Unused
28 public function getPages(Paginator
$paginator, $pageRange = null)
30 $pageRange = $paginator->getPageRange();
31 $pageNumber = $paginator->getCurrentPageNumber();
33 $delta = $pageNumber %
$pageRange;
39 $offset = $pageNumber - $delta;
40 $lowerBound = $offset +
1;
41 $upperBound = $offset +
$pageRange;
43 return $paginator->getPagesInRange($lowerBound, $upperBound);