Paginator.php
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-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'
- string
Properties


bool $_cacheEnabled = true
true
Details- Type
- bool


integer $_currentItemCount = null
null
Details- Type
- integer


integer $_currentPageNumber = 1
1
Details- Type
- integer


int $_defaultPageRange = 10
10
Details- Type
- int


string $_defaultScrollingStyle = 'Sliding'
'Sliding'
Details- Type
- string


integer $_pageRange = null
null
Details- Type
- integer


\Zend_Loader_PluginLoader $_scrollingStyleLoader = null
null
DetailsMethods


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


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


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


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


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


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


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


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


addAdapterPrefixPaths(array $prefixPaths) : void
Adds 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) : void
Adds a scrolling style prefix path to the plugin loader.
Name | Type | Description |
---|---|---|
$prefix | string | |
$path | string |


addScrollingStylePrefixPaths(array $prefixPaths) : void
Adds 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_Paginator
Clear 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_Paginator
Factory.
Name | Type | Description |
---|---|---|
$data | mixed | |
$adapter | string | |
$prefixPaths | array |
Type | Description |
---|---|
\Zend_Paginator |


getAbsoluteItemNumber(integer $relativeItemNumber, integer $pageNumber = null) : integer
Returns 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_Interface
Returns the adapter.
Type | Description |
---|---|
\Zend_Paginator_Adapter_Interface |


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


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


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


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


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


getItem(integer $itemNumber, integer $pageNumber = null) : mixed
Returns 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) : integer
Returns the number of items in a collection.
Name | Type | Description |
---|---|---|
$items | mixed | Items |
Type | Description |
---|---|
integer |


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


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


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


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


getPagesInRange(integer $lowerBound, integer $upperBound) : array
Returns 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_PluginLoader
Returns the scrolling style loader.
If it doesn't exist it's created.
Type | Description |
---|---|
\Zend_Loader_PluginLoader |


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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