Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Paginator / ScrollingStyle / Elastic.php
blob3a3947b91902497062edb944851880a1b13311e0
1 <?php
2 /**
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
8 */
10 namespace Zend\Paginator\ScrollingStyle;
12 use Zend\Paginator\Paginator;
14 /**
15 * A Google-like scrolling style. Incrementally expands the range to about
16 * twice the given page range, then behaves like a slider. See the example
17 * link.
19 * @link http://www.google.com/search?q=Zend+Framework
21 class Elastic extends Sliding
23 /**
24 * Returns an array of "local" pages given a page number and range.
26 * @param Paginator $paginator
27 * @param int $pageRange Unused
28 * @return array
30 public function getPages(Paginator $paginator, $pageRange = null)
32 $pageRange = $paginator->getPageRange();
33 $pageNumber = $paginator->getCurrentPageNumber();
35 $originalPageRange = $pageRange;
36 $pageRange = $pageRange * 2 - 1;
38 if ($originalPageRange + $pageNumber - 1 < $pageRange) {
39 $pageRange = $originalPageRange + $pageNumber - 1;
40 } elseif ($originalPageRange + $pageNumber - 1 > count($paginator)) {
41 $pageRange = $originalPageRange + count($paginator) - $pageNumber;
44 return parent::getPages($paginator, $pageRange);