Paginator.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@zend.com so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Paginator
- Version
- $Id$
Package: Zend_Paginator- Implements
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants


string
INTERNAL_ADAPTER
= 'Zend_Paginator_Adapter_Internal'
Specifies that the factory should try to detect the proper adapter type first


CACHE_TAG_PREFIX
= 'Zend_Paginator_'
The cache tag prefix used to namespace Paginator results in the cache
Properties



bool $_cacheEnabled = true
Enable or disable the cache by Zend_Paginator instance
Default valuetrue
Details- Type
- bool



integer $_currentItemCount = null
Number of items in the current page
Default valuenull
Details- Type
- integer



integer $_currentPageNumber = 1
Current page number (starting from 1)
Default value1
Details- Type
- integer



int $_defaultItemCountPerPage = 10
staticDefault item count per page
Default value10
Details- Type
- int



int $_defaultPageRange = 10
staticDefault number of local pages (i.e., the number of discretes
page numbers that will be displayed, including the current
page number)
Default value10
Details- Type
- int



string $_defaultScrollingStyle = 'Sliding'
staticDefault scrolling style
Default value'Sliding'
Details- Type
- string



integer $_pageRange = null
Number of local pages (i.e., the number of discrete page numbers
that will be displayed, including the current page number)
Default valuenull
Details- Type
- integer
Methods



_createPages(string $scrollingStyle = null) : \stdClass
Creates the page collection.
ParametersName | Type | Description |
---|
$scrollingStyle | string | Scrolling style |
---|
Returns 


_getCacheId(int $page = null) : string
Makes an Id for the cache
Depends on the adapter object and the page number
Used to store item in cache from that Paginator instance
and that current page
ParametersName | Type | Description |
---|
$page | int | |
---|
Returns


_getCacheInternalId() : string
Get the internal cache id
Depends on the adapter and the item count per page
Used to tag that unique Paginator instance in cache
Returns


addAdapterPrefixPath(string $prefix, string $path) : void
staticAdds an adapter prefix path to the plugin loader.
ParametersName | Type | Description |
---|
$prefix | string | |
---|
$path | string | |
---|



addAdapterPrefixPaths(array $prefixPaths) : void
staticAdds an array of adapter prefix paths to the plugin
loader.
$prefixPaths = array(
'My_Paginator_Adapter' => 'My/Paginator/Adapter/',
'Your_Paginator_Adapter' => 'Your/Paginator/Adapter/'
);
ParametersName | Type | Description |
---|
$prefixPaths | array | |
---|



addScrollingStylePrefixPath(string $prefix, string $path) : void
staticAdds a scrolling style prefix path to the plugin loader.
ParametersName | Type | Description |
---|
$prefix | string | |
---|
$path | string | |
---|



addScrollingStylePrefixPaths(array $prefixPaths) : void
staticAdds an array of scrolling style prefix paths to the plugin
loader.
$prefixPaths = array(
'My_Paginator_ScrollingStyle' => 'My/Paginator/ScrollingStyle/',
'Your_Paginator_ScrollingStyle' => 'Your/Paginator/ScrollingStyle/'
);
ParametersName | Type | Description |
---|
$prefixPaths | array | |
---|



clearPageItemCache(int $pageNumber = null) : \Zend_Paginator
Clear the page item cache.
ParametersName | Type | Description |
---|
$pageNumber | int | |
---|
Returns 


getAbsoluteItemNumber(integer $relativeItemNumber, integer $pageNumber = null) : integer
Returns the absolute item number for the specified item.
ParametersName | Type | Description |
---|
$relativeItemNumber | integer | Relative item number |
---|
$pageNumber | integer | Page number |
---|
Returns 


getItem(integer $itemNumber, integer $pageNumber = null) : mixed
Returns an item from a page. The current page is used if there's no
page sepcified.
ParametersName | Type | Description |
---|
$itemNumber | integer | Item number (1 to itemCountPerPage) |
---|
$pageNumber | integer | |
---|
Returns 


getItemCount(mixed $items) : integer
Returns the number of items in a collection.
ParametersName | Type | Description |
---|
$items | mixed | Items |
---|
Returns 


getItemsByPage( $pageNumber) : \Traversable
Returns the items for a given page.
ParametersName | Type | Description |
---|
$pageNumber | | |
---|
Returns 


getPages(string $scrollingStyle = null) : array
Returns the page collection.
ParametersName | Type | Description |
---|
$scrollingStyle | string | Scrolling style |
---|
Returns 


getPagesInRange(integer $lowerBound, integer $upperBound) : array
Returns a subset of pages within a given range.
ParametersName | Type | Description |
---|
$lowerBound | integer | Lower bound of the range |
---|
$upperBound | integer | Upper bound of the range |
---|
Returns 


normalizeItemNumber(integer $itemNumber) : integer
Brings the item number in range of the page.
ParametersName | Type | Description |
---|
$itemNumber | integer | |
---|
Returns 


normalizePageNumber(integer $pageNumber) : integer
Brings the page number in range of the paginator.
ParametersName | Type | Description |
---|
$pageNumber | integer | |
---|
Returns 


setCacheEnabled(bool $enable) : \Zend_Paginator
Enables/Disables the cache for this instance
ParametersName | Type | Description |
---|
$enable | bool | |
---|
Returns 


setCurrentPageNumber(integer $pageNumber) : \Zend_Paginator
Sets the current page number.
ParametersName | Type | Description |
---|
$pageNumber | integer | Page number |
---|
Returns 


setDefaultItemCountPerPage(int $count) : void
staticSet the default item count per page
ParametersName | Type | Description |
---|
$count | int | |
---|



setDefaultPageRange(int $count) : void
staticSet the default page range
ParametersName | Type | Description |
---|
$count | int | |
---|



setDefaultScrollingStyle(string $scrollingStyle = 'Sliding') : void
staticSets the default scrolling style.
ParametersName | Type | Description |
---|
$scrollingStyle | string | |
---|



setItemCountPerPage(integer $itemCountPerPage = -1) : \Zend_Paginator
Sets the number of items per page.
ParametersName | Type | Description |
---|
$itemCountPerPage | integer | |
---|
Returns 


setPageRange(integer $pageRange) : \Zend_Paginator
Sets the page range (see property declaration above).
ParametersName | Type | Description |
---|
$pageRange | integer | |
---|
Returns