~chroot64bit/zivios/gentoo-experimental

« back to all changes in this revision

Viewing changes to application/library/Zend/Paginator/ScrollingStyle/Jumping.php

  • Committer: Mustafa A. Hashmi
  • Date: 2008-12-04 13:32:21 UTC
  • Revision ID: mhashmi@zivios.org-20081204133221-0nd1trunwevijj38
Inclusion of new installation framework with ties to zend layout and dojo layout

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * Zend Framework
 
4
 *
 
5
 * LICENSE
 
6
 *
 
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.
 
14
 *
 
15
 * @category   Zend
 
16
 * @package    Zend_Paginator
 
17
 * @copyright  Copyright (c) 2005-2008 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 10013 2008-07-09 21:08:06Z norm2782 $
 
20
 */
 
21
 
 
22
/**
 
23
 * @see Zend_Paginator_ScrollingStyle_Interface
 
24
 */
 
25
require_once 'Zend/Paginator/ScrollingStyle/Interface.php';
 
26
 
 
27
/**
 
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.
 
31
 * 
 
32
 * @category   Zend
 
33
 * @package    Zend_Paginator
 
34
 * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 
35
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 
36
 */
 
37
class Zend_Paginator_ScrollingStyle_Jumping implements Zend_Paginator_ScrollingStyle_Interface
 
38
{
 
39
    /**
 
40
     * Returns an array of "local" pages given a page number and range.
 
41
     * 
 
42
     * @param  Zend_Paginator $paginator
 
43
     * @param  integer $pageRange Unused
 
44
     * @return array
 
45
     */
 
46
    public function getPages(Zend_Paginator $paginator, $pageRange = null)
 
47
    {
 
48
        $pageRange  = $paginator->getPageRange();
 
49
        $pageNumber = $paginator->getCurrentPageNumber();
 
50
        
 
51
        $delta = $pageNumber % $pageRange;
 
52
        
 
53
        if ($delta == 0) {
 
54
            $delta = $pageRange;
 
55
        }
 
56
 
 
57
        $offset     = $pageNumber - $delta;
 
58
        $lowerBound = $offset + 1; 
 
59
        $upperBound = $offset + $pageRange;
 
60
        
 
61
        return $paginator->getPagesInRange($lowerBound, $upperBound); 
 
62
    }
 
63
}
 
 
b'\\ No newline at end of file'