API Documentation

Zend/Paginator.php

Show: inherited
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-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Paginator  
Version
$Id: Paginator.php 24594 2012-01-05 21:27:01Z matthew $  

\Zend_Paginator

Package: Zend\Paginator

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

Constants

Constantstring  INTERNAL_ADAPTER = 'Zend_Paginator_Adapter_Internal'

Specifies that the factory should try to detect the proper adapter type first

string
Constant  CACHE_TAG_PREFIX = 'Zend_Paginator_'

The cache tag prefix used to namespace Paginator results in the cache

Properties

Propertyprotected\Zend_Paginator_Adapter_Interface  $_adapter= 'null'

Adapter

Default valuenullDetails
Type
\Zend_Paginator_Adapter_Interface
Propertyprotected\Zend_Loader_PluginLoader  $_adapterLoader= 'null'
static

Adapter plugin loader

Default valuenullDetails
Type
\Zend_Loader_PluginLoader
Propertyprotected\Zend_Cache_Core  $_cache= ''
static

Cache object

Details
Type
\Zend_Cache_Core
Propertyprotectedbool  $_cacheEnabled= 'true'

Enable or disable the cache by Zend_Paginator instance

Default valuetrueDetails
Type
bool
Propertyprotected\Zend_Config  $_config= 'null'
static

Configuration file

Default valuenullDetails
Type
\Zend_Config
Propertyprotectedinteger  $_currentItemCount= 'null'

Number of items in the current page

Default valuenullDetails
Type
integer
Propertyprotected\Traversable  $_currentItems= 'null'

Current page items

Default valuenullDetails
Type
\Traversable
Propertyprotectedinteger  $_currentPageNumber= '1'

Current page number (starting from 1)

Default value1Details
Type
integer
Propertyprotectedint  $_defaultItemCountPerPage= '10'
static

Default item count per page

Default value10Details
Type
int
Propertyprotectedint  $_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
Propertyprotectedstring  $_defaultScrollingStyle= ''Sliding''
static

Default scrolling style

Default value'Sliding'Details
Type
string
Propertyprotected\Zend_Filter_Interface  $_filter= 'null'

Result filter

Default valuenullDetails
Type
\Zend_Filter_Interface
Propertyprotectedinteger  $_itemCountPerPage= 'null'

Number of items per page

Default valuenullDetails
Type
integer
Propertyprotectedinteger  $_pageCount= 'null'

Number of pages

Default valuenullDetails
Type
integer
Propertyprotectedinteger  $_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
Propertyprotectedarray  $_pages= 'null'

Pages

Default valuenullDetails
Type
array
Propertyprotected\Zend_Loader_PluginLoader  $_scrollingStyleLoader= 'null'
static

Scrolling style plugin loader

Default valuenullDetails
Type
\Zend_Loader_PluginLoader
Propertyprotected\Zend_View_Interface  $_view= 'null'

View instance used for self rendering

Default valuenullDetails
Type
\Zend_View_Interface

Methods

methodpublic__construct( \Zend_Paginator_Adapter_Interface|\Zend_Paginator_AdapterAggregate $adapter ) : void

Constructor.

Parameters
Name Type Description
$adapter \Zend_Paginator_Adapter_Interface|\Zend_Paginator_AdapterAggregate
methodpublic__toString( ) : string

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

Returns
Type Description
string
methodprotected_cacheEnabled( ) : bool

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

Returns
Type Description
bool
methodprotected_calculatePageCount( ) : integer

Calculates the page count.

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

Creates the page collection.

Parameters
Name Type Description
$scrollingStyle string

Scrolling style

Returns
Type Description
\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
Name Type Description
$page int
Returns
Type Description
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
Type Description
string
methodprotected_loadScrollingStyle( string $scrollingStyle = null ) : \Zend_Paginator_ScrollingStyle_Interface

Loads a scrolling style.

Parameters
Name Type Description
$scrollingStyle string
Returns
Type Description
\Zend_Paginator_ScrollingStyle_Interface
methodpublicaddAdapterPrefixPath( string $prefix, string $path ) : void
static

Adds an adapter prefix path to the plugin loader.

Parameters
Name Type Description
$prefix string
$path string
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
Name Type Description
$prefixPaths array
methodpublicaddScrollingStylePrefixPath( string $prefix, string $path ) : void
static

Adds a scrolling style prefix path to the plugin loader.

Parameters
Name Type Description
$prefix string
$path string
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
Name Type Description
$prefixPaths array
methodpublicclearPageItemCache( int $pageNumber = null ) : \Zend_Paginator

Clear the page item cache.

Parameters
Name Type Description
$pageNumber int
Returns
Type Description
\Zend_Paginator
methodpubliccount( ) : integer

Returns the number of pages.

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

Factory.

Parameters
Name Type Description
$data mixed
$adapter string
$prefixPaths array
Returns
Type Description
\Zend_Paginator
methodpublicgetAbsoluteItemNumber( integer $relativeItemNumber, integer $pageNumber = null ) : integer

Returns the absolute item number for the specified item.

Parameters
Name Type Description
$relativeItemNumber integer

Relative item number

$pageNumber integer

Page number

Returns
Type Description
integer
methodpublicgetAdapter( ) : \Zend_Paginator_Adapter_Interface

Returns the adapter.

Returns
Type Description
\Zend_Paginator_Adapter_Interface
methodpublicgetAdapterLoader( ) : \Zend_Loader_PluginLoader
static

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

Returns
Type Description
\Zend_Loader_PluginLoader
methodpublicgetCurrentItemCount( ) : integer

Returns the number of items for the current page.

Returns
Type Description
integer
methodpublicgetCurrentItems( ) : \Traversable

Returns the items for the current page.

Returns
Type Description
\Traversable
methodpublicgetCurrentPageNumber( ) : integer

Returns the current page number.

Returns
Type Description
integer
methodpublicgetDefaultItemCountPerPage( ) : int
static

Get the default item count per page

Returns
Type Description
int
methodpublicgetDefaultPageRange( ) : int
static

Get the default page range

Returns
Type Description
int
methodpublicgetDefaultScrollingStyle( ) : string
static

Returns the default scrolling style.

Returns
Type Description
string
methodpublicgetFilter( ) : \Zend_Filter_Interface

Get the filter

Returns
Type Description
\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
Name Type Description
$itemNumber integer

Item number (1 to itemCountPerPage)

$pageNumber integer
Returns
Type Description
mixed
methodpublicgetItemCount( mixed $items ) : integer

Returns the number of items in a collection.

Parameters
Name Type Description
$items mixed

Items

Returns
Type Description
integer
methodpublicgetItemCountPerPage( ) : integer

Returns the number of items per page.

Returns
Type Description
integer
methodpublicgetItemsByPage(  $pageNumber ) : \Traversable

Returns the items for a given page.

Parameters
Name Type Description
$pageNumber
Returns
Type Description
\Traversable
methodpublicgetIterator( ) : \Traversable

Returns a foreach-compatible iterator.

Returns
Type Description
\Traversable
methodpublicgetPageItemCache( ) : array

Returns the page item cache.

Returns
Type Description
array
methodpublicgetPageRange( ) : integer

Returns the page range (see property declaration above).

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

Returns the page collection.

Parameters
Name Type Description
$scrollingStyle string

Scrolling style

Returns
Type Description
array
methodpublicgetPagesInRange( integer $lowerBound, integer $upperBound ) : array

Returns 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
Type Description
array
methodpublicgetScrollingStyleLoader( ) : \Zend_Loader_PluginLoader
static

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

Returns
Type Description
\Zend_Loader_PluginLoader
methodpublicgetTotalItemCount( ) : integer

Returns the total number of items available.

Returns
Type Description
integer
methodpublicgetView( ) : \Zend_View_Interface|null

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

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

Brings the item number in range of the page.

Parameters
Name Type Description
$itemNumber integer
Returns
Type Description
integer
methodpublicnormalizePageNumber( integer $pageNumber ) : integer

Brings the page number in range of the paginator.

Parameters
Name Type Description
$pageNumber integer
Returns
Type Description
integer
methodpublicrender( \Zend_View_Interface $view = null ) : string

Renders the paginator.

Parameters
Name Type Description
$view \Zend_View_Interface
Returns
Type Description
string
methodpublicsetCache( \Zend_Cache_Core $cache ) : void
static

Sets a cache object

Parameters
Name Type Description
$cache \Zend_Cache_Core
methodpublicsetCacheEnabled( bool $enable ) : \Zend_Paginator

Enables/Disables the cache for this instance

Parameters
Name Type Description
$enable bool
Returns
Type Description
\Zend_Paginator
methodpublicsetConfig( \Zend_Config $config ) : void
static

Set a global config

Parameters
Name Type Description
$config \Zend_Config
methodpublicsetCurrentPageNumber( integer $pageNumber ) : \Zend_Paginator

Sets the current page number.

Parameters
Name Type Description
$pageNumber integer

Page number

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

Set the default item count per page

Parameters
Name Type Description
$count int
methodpublicsetDefaultPageRange( int $count ) : void
static

Set the default page range

Parameters
Name Type Description
$count int
methodpublicsetDefaultScrollingStyle( string $scrollingStyle = 'Sliding' ) : void
static

Sets the default scrolling style.

Parameters
Name Type Description
$scrollingStyle string
methodpublicsetFilter( \Zend_Filter_Interface $filter ) : \Zend_Paginator

Set a filter chain

Parameters
Name Type Description
$filter \Zend_Filter_Interface
Returns
Type Description
\Zend_Paginator
methodpublicsetItemCountPerPage( integer $itemCountPerPage = -1 ) : \Zend_Paginator

Sets the number of items per page.

Parameters
Name Type Description
$itemCountPerPage integer
Returns
Type Description
\Zend_Paginator $this
methodpublicsetPageRange( integer $pageRange ) : \Zend_Paginator

Sets the page range (see property declaration above).

Parameters
Name Type Description
$pageRange integer
Returns
Type Description
\Zend_Paginator $this
methodpublicsetView( \Zend_View_Interface $view = null ) : \Zend_Paginator

Sets the view object.

Parameters
Name Type Description
$view \Zend_View_Interface
Returns
Type Description
\Zend_Paginator
methodpublictoJson( ) : string

Returns the items of the current page as JSON.

Returns
Type Description
string
Documentation was generated by DocBlox 0.15.1.