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 [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Paginator
- Version
- $Id: Paginator.php 24754 2012-05-05 02:30:56Z adamlundrigan $
\Zend_Paginator
- Implements
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 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
- string
Properties

\Zend_Loader_PluginLoader $_adapterLoader = nullAdapter plugin loader
nullDetails

bool $_cacheEnabled = trueEnable or disable the cache by Zend_Paginator instance
trueDetails- Type
- bool

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

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

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

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

string $_defaultScrollingStyle = 'Sliding'Default scrolling style
'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)
nullDetails- Type
- integer

\Zend_Loader_PluginLoader $_scrollingStyleLoader = nullScrolling style plugin loader
nullDetails

\Zend_View_Interface $_view = nullView instance used for self rendering
nullDetails- Type
- \Zend_View_Interface
Methods

__construct(\Zend_Paginator_Adapter_Interface | \Zend_Paginator_AdapterAggregate $adapter) : voidConstructor.
| Name | Type | Description |
|---|---|---|
| $adapter | \Zend_Paginator_Adapter_Interface | \Zend_Paginator_AdapterAggregate |

__toString() : stringSerializes the object as a string.
Proxies to render().
| Type | Description |
|---|---|
| string |

_cacheEnabled() : boolTells if there is an active cache object and if the cache has not been desabled
| Type | Description |
|---|---|
| bool |

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

_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
| Name | Type | Description |
|---|---|---|
| $page | int |
| Type | Description |
|---|---|
| string |

_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
| Type | Description |
|---|---|
| string |

_loadScrollingStyle(string $scrollingStyle = null) : \Zend_Paginator_ScrollingStyle_InterfaceLoads a scrolling style.
| Name | Type | Description |
|---|---|---|
| $scrollingStyle | string |
| Type | Description |
|---|---|
| \Zend_Paginator_ScrollingStyle_Interface |

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

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

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

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

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

factory(mixed $data, string $adapter = self::INTERNAL_ADAPTER, array $prefixPaths = null) : \Zend_PaginatorFactory.
| Name | Type | Description |
|---|---|---|
| $data | mixed | |
| $adapter | string | |
| $prefixPaths | array |
| Type | Description |
|---|---|
| \Zend_Paginator |

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

getAdapter() : \Zend_Paginator_Adapter_InterfaceReturns the adapter.
| Type | Description |
|---|---|
| \Zend_Paginator_Adapter_Interface |

getAdapterLoader() : \Zend_Loader_PluginLoaderReturns the adapter loader.
If it doesn't exist it's created.
| Type | Description |
|---|---|
| \Zend_Loader_PluginLoader |

getCurrentItemCount() : integerReturns the number of items for the current page.
| Type | Description |
|---|---|
| integer |

getCurrentItems() : \TraversableReturns the items for the current page.
| Type | Description |
|---|---|
| \Traversable |

getDefaultItemCountPerPage() : intGet the default item count per page
| Type | Description |
|---|---|
| int |

getDefaultScrollingStyle() : stringReturns the default scrolling style.
| Type | Description |
|---|---|
| string |

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

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

getItemCountPerPage() : integerReturns the number of items per page.
| Type | Description |
|---|---|
| integer |

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

getIterator() : \TraversableReturns a foreach-compatible iterator.
| Type | Description |
|---|---|
| \Traversable |

getPageRange() : integerReturns the page range (see property declaration above).
| Type | Description |
|---|---|
| integer |

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

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

getScrollingStyleLoader() : \Zend_Loader_PluginLoaderReturns the scrolling style loader.
If it doesn't exist it's created.
| Type | Description |
|---|---|
| \Zend_Loader_PluginLoader |

getTotalItemCount() : integerReturns the total number of items available.
Uses cache if caching is enabled.
| Type | Description |
|---|---|
| integer |

getView() : \Zend_View_Interface | nullRetrieves the view instance.
If none registered, attempts to pull f rom ViewRenderer.
| Type | Description |
|---|---|
| \Zend_View_Interface | null |

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

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

render(\Zend_View_Interface $view = null) : stringRenders the paginator.
| Name | Type | Description |
|---|---|---|
| $view | \Zend_View_Interface |
| Type | Description |
|---|---|
| string |

setCache(\Zend_Cache_Core $cache) : voidSets a cache object
| Name | Type | Description |
|---|---|---|
| $cache | \Zend_Cache_Core |

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

setConfig(\Zend_Config $config) : voidSet a global config
| Name | Type | Description |
|---|---|---|
| $config | \Zend_Config |

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

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

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

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

setFilter(\Zend_Filter_Interface $filter) : \Zend_PaginatorSet a filter chain
| Name | Type | Description |
|---|---|---|
| $filter | \Zend_Filter_Interface |
| Type | Description |
|---|---|
| \Zend_Paginator |

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

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

setView(\Zend_View_Interface $view = null) : \Zend_PaginatorSets the view object.
| Name | Type | Description |
|---|---|---|
| $view | \Zend_View_Interface |
| Type | Description |
|---|---|
| \Zend_Paginator |