Paginator.php

Show: PublicProtectedPrivateinherited
Table of Contents
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$  

\Zend_Paginator

Package: Zend_Paginator
Implements
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

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

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

Properties

>VPropertyprotected\Zend_Paginator_Adapter_Interface $_adapter = null
Adapter
Default valuenullDetails
Type
\Zend_Paginator_Adapter_Interface
>VPropertyprotected\Zend_Loader_PluginLoader $_adapterLoader = null
static
Adapter plugin loader
Default valuenullDetails
Type
\Zend_Loader_PluginLoader
>VPropertyprotected\Zend_Cache_Core $_cache
static
Cache object
Details
Type
\Zend_Cache_Core
>VPropertyprotectedbool $_cacheEnabled = true
Enable or disable the cache by Zend_Paginator instance
Default valuetrueDetails
Type
bool
>VPropertyprotected\Zend_Config $_config = null
static
Configuration file
Default valuenullDetails
Type
\Zend_Config
>VPropertyprotectedinteger $_currentItemCount = null
Number of items in the current page
Default valuenullDetails
Type
integer
>VPropertyprotected\Traversable $_currentItems = null
Current page items
Default valuenullDetails
Type
\Traversable
>VPropertyprotectedinteger $_currentPageNumber = 1
Current page number (starting from 1)
Default value1Details
Type
integer
>VPropertyprotectedint $_defaultItemCountPerPage = 10
static
Default item count per page
Default value10Details
Type
int
>VPropertyprotectedint $_defaultPageRange = 10
static
Default 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
>VPropertyprotectedstring $_defaultScrollingStyle = 'Sliding'
static
Default scrolling style
Default value'Sliding'Details
Type
string
>VPropertyprotected\Zend_Filter_Interface $_filter = null
Result filter
Default valuenullDetails
Type
\Zend_Filter_Interface
>VPropertyprotectedinteger $_itemCountPerPage = null
Number of items per page
Default valuenullDetails
Type
integer
>VPropertyprotectedinteger $_pageCount = null
Number of pages
Default valuenullDetails
Type
integer
>VPropertyprotectedinteger $_pageRange = null
Number of local pages (i.e., the number of discrete page numbers that will be displayed, including the current page number)
Default valuenullDetails
Type
integer
>VPropertyprotectedarray $_pages = null
Pages
Default valuenullDetails
Type
array
>VPropertyprotected\Zend_Loader_PluginLoader $_scrollingStyleLoader = null
static
Scrolling style plugin loader
Default valuenullDetails
Type
\Zend_Loader_PluginLoader
>VPropertyprotected\Zend_View_Interface $_view = null
View instance used for self rendering
Default valuenullDetails
Type
\Zend_View_Interface

Methods

methodpublic__toString() : string

Serializes the object as a string. Proxies to {@link render()}.

Returns
TypeDescription
string
methodprotected_cacheEnabled() : bool

Tells if there is an active cache object and if the cache has not been desabled

Returns
TypeDescription
bool
methodprotected_calculatePageCount() : integer

Calculates the page count.

Returns
TypeDescription
integer
methodprotected_createPages(string $scrollingStyle = null) : \stdClass

Creates the page collection.

Parameters
NameTypeDescription
$scrollingStylestring

Scrolling style

Returns
TypeDescription
\stdClass
methodprotected_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
Parameters
NameTypeDescription
$pageint
Returns
TypeDescription
string
methodprotected_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
TypeDescription
string
methodprotected_loadScrollingStyle(string $scrollingStyle = null) : \Zend_Paginator_ScrollingStyle_Interface

Loads a scrolling style.

Parameters
NameTypeDescription
$scrollingStylestring
Returns
TypeDescription
\Zend_Paginator_ScrollingStyle_Interface
methodpublicaddAdapterPrefixPath(string $prefix, string $path) : void
static

Adds an adapter prefix path to the plugin loader.

Parameters
NameTypeDescription
$prefixstring
$pathstring
methodpublicaddAdapterPrefixPaths(array $prefixPaths) : void
static

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/' );
Parameters
NameTypeDescription
$prefixPathsarray
methodpublicaddScrollingStylePrefixPath(string $prefix, string $path) : void
static

Adds a scrolling style prefix path to the plugin loader.

Parameters
NameTypeDescription
$prefixstring
$pathstring
methodpublicaddScrollingStylePrefixPaths(array $prefixPaths) : void
static

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/' );
Parameters
NameTypeDescription
$prefixPathsarray
methodpublicclearPageItemCache(int $pageNumber = null) : \Zend_Paginator

Clear the page item cache.

Parameters
NameTypeDescription
$pageNumberint
Returns
TypeDescription
\Zend_Paginator
methodpubliccount() : integer

Returns the number of pages.

Returns
TypeDescription
integer
methodpublicfactory(mixed $data, string $adapter = self::INTERNAL_ADAPTER, array $prefixPaths = null) : \Zend_Paginator
static

Factory.

Parameters
NameTypeDescription
$datamixed
$adapterstring
$prefixPathsarray
Returns
TypeDescription
\Zend_Paginator
methodpublicgetAbsoluteItemNumber(integer $relativeItemNumber, integer $pageNumber = null) : integer

Returns the absolute item number for the specified item.

Parameters
NameTypeDescription
$relativeItemNumberinteger

Relative item number

$pageNumberinteger

Page number

Returns
TypeDescription
integer
methodpublicgetAdapter() : \Zend_Paginator_Adapter_Interface

Returns the adapter.

Returns
TypeDescription
\Zend_Paginator_Adapter_Interface
methodpublicgetAdapterLoader() : \Zend_Loader_PluginLoader
static

Returns the adapter loader. If it doesn't exist it's created.

Returns
TypeDescription
\Zend_Loader_PluginLoader
methodpublicgetCurrentItemCount() : integer

Returns the number of items for the current page.

Returns
TypeDescription
integer
methodpublicgetCurrentItems() : \Traversable

Returns the items for the current page.

Returns
TypeDescription
\Traversable
methodpublicgetCurrentPageNumber() : integer

Returns the current page number.

Returns
TypeDescription
integer
methodpublicgetDefaultItemCountPerPage() : int
static

Get the default item count per page

Returns
TypeDescription
int
methodpublicgetDefaultPageRange() : int
static

Get the default page range

Returns
TypeDescription
int
methodpublicgetDefaultScrollingStyle() : string
static

Returns the default scrolling style.

Returns
TypeDescription
string
methodpublicgetFilter() : \Zend_Filter_Interface

Get the filter

Returns
TypeDescription
\Zend_Filter_Interface
methodpublicgetItem(integer $itemNumber, integer $pageNumber = null) : mixed

Returns an item from a page. The current page is used if there's no page sepcified.

Parameters
NameTypeDescription
$itemNumberinteger

Item number (1 to itemCountPerPage)

$pageNumberinteger
Returns
TypeDescription
mixed
methodpublicgetItemCount(mixed $items) : integer

Returns the number of items in a collection.

Parameters
NameTypeDescription
$itemsmixed

Items

Returns
TypeDescription
integer
methodpublicgetItemCountPerPage() : integer

Returns the number of items per page.

Returns
TypeDescription
integer
methodpublicgetItemsByPage( $pageNumber) : \Traversable

Returns the items for a given page.

Parameters
NameTypeDescription
$pageNumber
Returns
TypeDescription
\Traversable
methodpublicgetIterator() : \Traversable

Returns a foreach-compatible iterator.

Returns
TypeDescription
\Traversable
methodpublicgetPageItemCache() : array

Returns the page item cache.

Returns
TypeDescription
array
methodpublicgetPageRange() : integer

Returns the page range (see property declaration above).

Returns
TypeDescription
integer
methodpublicgetPages(string $scrollingStyle = null) : array

Returns the page collection.

Parameters
NameTypeDescription
$scrollingStylestring

Scrolling style

Returns
TypeDescription
array
methodpublicgetPagesInRange(integer $lowerBound, integer $upperBound) : array

Returns a subset of pages within a given range.

Parameters
NameTypeDescription
$lowerBoundinteger

Lower bound of the range

$upperBoundinteger

Upper bound of the range

Returns
TypeDescription
array
methodpublicgetScrollingStyleLoader() : \Zend_Loader_PluginLoader
static

Returns the scrolling style loader. If it doesn't exist it's created.

Returns
TypeDescription
\Zend_Loader_PluginLoader
methodpublicgetTotalItemCount() : integer

Returns the total number of items available. Uses cache if caching is enabled.

Returns
TypeDescription
integer
methodpublicgetView() : \Zend_View_Interface | null

Retrieves the view instance. If none registered, attempts to pull f rom ViewRenderer.

Returns
TypeDescription
\Zend_View_Interface | null
methodpublicnormalizeItemNumber(integer $itemNumber) : integer

Brings the item number in range of the page.

Parameters
NameTypeDescription
$itemNumberinteger
Returns
TypeDescription
integer
methodpublicnormalizePageNumber(integer $pageNumber) : integer

Brings the page number in range of the paginator.

Parameters
NameTypeDescription
$pageNumberinteger
Returns
TypeDescription
integer
methodpublicrender(\Zend_View_Interface $view = null) : string

Renders the paginator.

Parameters
NameTypeDescription
$view\Zend_View_Interface
Returns
TypeDescription
string
methodpublicsetCache(\Zend_Cache_Core $cache) : void
static

Sets a cache object

Parameters
NameTypeDescription
$cache\Zend_Cache_Core
methodpublicsetCacheEnabled(bool $enable) : \Zend_Paginator

Enables/Disables the cache for this instance

Parameters
NameTypeDescription
$enablebool
Returns
TypeDescription
\Zend_Paginator
methodpublicsetConfig(\Zend_Config $config) : void
static

Set a global config

Parameters
NameTypeDescription
$config\Zend_Config
methodpublicsetCurrentPageNumber(integer $pageNumber) : \Zend_Paginator

Sets the current page number.

Parameters
NameTypeDescription
$pageNumberinteger

Page number

Returns
TypeDescription
\Zend_Paginator$this
methodpublicsetDefaultItemCountPerPage(int $count) : void
static

Set the default item count per page

Parameters
NameTypeDescription
$countint
methodpublicsetDefaultPageRange(int $count) : void
static

Set the default page range

Parameters
NameTypeDescription
$countint
methodpublicsetDefaultScrollingStyle(string $scrollingStyle = 'Sliding') : void
static

Sets the default scrolling style.

Parameters
NameTypeDescription
$scrollingStylestring
methodpublicsetFilter(\Zend_Filter_Interface $filter) : \Zend_Paginator

Set a filter chain

Parameters
NameTypeDescription
$filter\Zend_Filter_Interface
Returns
TypeDescription
\Zend_Paginator
methodpublicsetItemCountPerPage(integer $itemCountPerPage = -1) : \Zend_Paginator

Sets the number of items per page.

Parameters
NameTypeDescription
$itemCountPerPageinteger
Returns
TypeDescription
\Zend_Paginator$this
methodpublicsetPageRange(integer $pageRange) : \Zend_Paginator

Sets the page range (see property declaration above).

Parameters
NameTypeDescription
$pageRangeinteger
Returns
TypeDescription
\Zend_Paginator$this
methodpublicsetView(\Zend_View_Interface $view = null) : \Zend_Paginator

Sets the view object.

Parameters
NameTypeDescription
$view\Zend_View_Interface
Returns
TypeDescription
\Zend_Paginator
methodpublictoJson() : string

Returns the items of the current page as JSON.

Returns
TypeDescription
string
Documentation was generated by phpDocumentor 2.2.0 .