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 = trueEnable or disable the cache by Zend_Paginator instance
Default valuetrueDetails- Type
- bool



integer $_currentItemCount = nullNumber of items in the current page
Default valuenullDetails- Type
- integer



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



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



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



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



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



_createPages(string $scrollingStyle = null) : \stdClassCreates the page collection.
Parameters| Name | Type | Description |
|---|
| $scrollingStyle | string | Scrolling style |
|---|
Returns 


_getCacheId(int $page = null) : stringMakes 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
Parameters| Name | Type | Description |
|---|
| $page | int | |
|---|
Returns


_getCacheInternalId() : stringGet 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) : voidstaticAdds an adapter prefix path to the plugin loader.
Parameters| Name | Type | Description |
|---|
| $prefix | string | |
|---|
| $path | string | |
|---|



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



addScrollingStylePrefixPath(string $prefix, string $path) : voidstaticAdds a scrolling style prefix path to the plugin loader.
Parameters| Name | Type | Description |
|---|
| $prefix | string | |
|---|
| $path | string | |
|---|



addScrollingStylePrefixPaths(array $prefixPaths) : voidstaticAdds 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/'
);
Parameters| Name | Type | Description |
|---|
| $prefixPaths | array | |
|---|



clearPageItemCache(int $pageNumber = null) : \Zend_PaginatorClear the page item cache.
Parameters| Name | Type | Description |
|---|
| $pageNumber | int | |
|---|
Returns 


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


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


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


getItemsByPage( $pageNumber) : \TraversableReturns the items for a given page.
Parameters| Name | Type | Description |
|---|
| $pageNumber | | |
|---|
Returns 


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


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


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


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


setCacheEnabled(bool $enable) : \Zend_PaginatorEnables/Disables the cache for this instance
Parameters| Name | Type | Description |
|---|
| $enable | bool | |
|---|
Returns 


setCurrentPageNumber(integer $pageNumber) : \Zend_PaginatorSets the current page number.
Parameters| Name | Type | Description |
|---|
| $pageNumber | integer | Page number |
|---|
Returns 


setDefaultItemCountPerPage(int $count) : voidstaticSet the default item count per page
Parameters| Name | Type | Description |
|---|
| $count | int | |
|---|



setDefaultPageRange(int $count) : voidstaticSet the default page range
Parameters| Name | Type | Description |
|---|
| $count | int | |
|---|



setDefaultScrollingStyle(string $scrollingStyle = 'Sliding') : voidstaticSets the default scrolling style.
Parameters| Name | Type | Description |
|---|
| $scrollingStyle | string | |
|---|



setItemCountPerPage(integer $itemCountPerPage = -1) : \Zend_PaginatorSets the number of items per page.
Parameters| Name | Type | Description |
|---|
| $itemCountPerPage | integer | |
|---|
Returns 


setPageRange(integer $pageRange) : \Zend_PaginatorSets the page range (see property declaration above).
Parameters| Name | Type | Description |
|---|
| $pageRange | integer | |
|---|
Returns