API Documentation

Paginator.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Paginator
version
$Id: Paginator.php 22829 2010-08-11 19:56:28Z bate $
Classes
Zend_Paginator

Description

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.

Zend_Paginator

Implements
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Paginator
Constants
INTERNAL_ADAPTER
CACHE_TAG_PREFIX
Properties
$_adapterLoader
$_config
$_defaultScrollingStyle
$_defaultItemCountPerPage
$_scrollingStyleLoader
$_cache
$_cacheEnabled
$_adapter
$_currentItemCount
$_currentItems
$_currentPageNumber
$_filter
$_itemCountPerPage
$_pageCount
$_pageRange
$_pages
$_view
Methods
addAdapterPrefixPath
addAdapterPrefixPaths
addScrollingStylePrefixPath
addScrollingStylePrefixPaths
factory
getAdapterLoader
setConfig
getDefaultScrollingStyle
getDefaultItemCountPerPage
setDefaultItemCountPerPage
setCache
setDefaultScrollingStyle
getScrollingStyleLoader
__construct
__toString
setCacheEnabled
count
getTotalItemCount
clearPageItemCache
getAbsoluteItemNumber
getAdapter
getCurrentItemCount
getCurrentItems
getCurrentPageNumber
setCurrentPageNumber
getFilter
setFilter
getItem
getItemCountPerPage
setItemCountPerPage
getItemCount
getItemsByPage
getIterator
getPageRange
setPageRange
getPages
getPagesInRange
getPageItemCache
getView
setView
normalizeItemNumber
normalizePageNumber
render
toJson
_cacheEnabled
_getCacheId
_getCacheInternalId
_calculatePageCount
_createPages
_loadScrollingStyle

Description

Constants

INTERNAL_ADAPTER

string INTERNAL_ADAPTER = 'Zend_Paginator_Adapter_Internal'

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

Details

value
Zend_Paginator_Adapter_Internal
INTERNAL_ADAPTER
string

CACHE_TAG_PREFIX

 CACHE_TAG_PREFIX = 'Zend_Paginator_'

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

Details

value
Zend_Paginator_

Properties

$_adapter

Zend_Paginator_Adapter_Interface $_adapter = 'null'

Adapter

Details

$_adapter
Zend_Paginator_Adapter_Interface
visibility
protected
default
null
final
false
static
false

$_adapterLoader

Zend_Loader_PluginLoader $_adapterLoader = 'null'

Adapter plugin loader

Details

$_adapterLoader
Zend_Loader_PluginLoader
visibility
protected
default
null
final
false
static
true

$_cache

Zend_Cache_Core $_cache = ''

Cache object

Details

$_cache
Zend_Cache_Core
visibility
protected
default
final
false
static
true

$_cacheEnabled

bool $_cacheEnabled = 'true'

Enable or disable the cache by Zend_Paginator instance

Details

$_cacheEnabled
bool
visibility
protected
default
true
final
false
static
false

$_config

Zend_Config $_config = 'null'

Configuration file

Details

$_config
Zend_Config
visibility
protected
default
null
final
false
static
true

$_currentItemCount

integer $_currentItemCount = 'null'

Number of items in the current page

Details

$_currentItemCount
integer
visibility
protected
default
null
final
false
static
false

$_currentItems

Traversable $_currentItems = 'null'

Current page items

Details

$_currentItems
Traversable
visibility
protected
default
null
final
false
static
false

$_currentPageNumber

integer $_currentPageNumber = '1'

Current page number (starting from 1)

Details

$_currentPageNumber
integer
visibility
protected
default
1
final
false
static
false

$_defaultItemCountPerPage

int $_defaultItemCountPerPage = '10'

Default item count per page

Details

$_defaultItemCountPerPage
int
visibility
protected
default
10
final
false
static
true

$_defaultScrollingStyle

string $_defaultScrollingStyle = 'Sliding'

Default scrolling style

Details

$_defaultScrollingStyle
string
visibility
protected
default
Sliding
final
false
static
true

$_filter

Zend_Filter_Interface $_filter = 'null'

Result filter

Details

$_filter
Zend_Filter_Interface
visibility
protected
default
null
final
false
static
false

$_itemCountPerPage

integer $_itemCountPerPage = 'null'

Number of items per page

Details

$_itemCountPerPage
integer
visibility
protected
default
null
final
false
static
false

$_pageCount

integer $_pageCount = 'null'

Number of pages

Details

$_pageCount
integer
visibility
protected
default
null
final
false
static
false

$_pageRange

integer $_pageRange = '10'

Number of local pages (i.e., the number of discrete page numbers that will be displayed, including the current page number)

Details

$_pageRange
integer
visibility
protected
default
10
final
false
static
false

$_pages

array $_pages = 'null'

Pages

Details

$_pages
array
visibility
protected
default
null
final
false
static
false

$_scrollingStyleLoader

Zend_Loader_PluginLoader $_scrollingStyleLoader = 'null'

Scrolling style plugin loader

Details

$_scrollingStyleLoader
Zend_Loader_PluginLoader
visibility
protected
default
null
final
false
static
true

$_view

Zend_View_Interface $_view = 'null'

View instance used for self rendering

Details

$_view
Zend_View_Interface
visibility
protected
default
null
final
false
static
false

Methods

__construct

__construct( Zend_Paginator_Adapter_Interface|Zend_Paginator_AdapterAggregate $adapter ) :

Constructor.

Arguments
$adapter
Zend_Paginator_Adapter_InterfaceZend_Paginator_AdapterAggregate
Details
visibility
public
final
false
static
false

__toString

__toString( ) : string

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

Output
string
Details
visibility
public
final
false
static
false

_cacheEnabled

_cacheEnabled( ) : bool

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

Output
bool
Details
visibility
protected
final
false
static
false

_calculatePageCount

_calculatePageCount( ) : integer

Calculates the page count.

Output
integer
Details
visibility
protected
final
false
static
false

_createPages

_createPages( string $scrollingStyle = null ) : stdClass

Creates the page collection.

Arguments
$scrollingStyle
string
Scrolling style
Output
stdClass
Details
visibility
protected
final
false
static
false

_getCacheId

_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

Arguments
$page
int
Output
string
Details
visibility
protected
final
false
static
false

_getCacheInternalId

_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

Output
string
Details
visibility
protected
final
false
static
false

_loadScrollingStyle

_loadScrollingStyle( string $scrollingStyle = null ) : Zend_Paginator_ScrollingStyle_Interface

Loads a scrolling style.

Arguments
$scrollingStyle
string
Details
visibility
protected
final
false
static
false

addAdapterPrefixPath

addAdapterPrefixPath( string $prefix, string $path ) :

Adds an adapter prefix path to the plugin loader.

Arguments
$prefix
string
$path
string
Details
visibility
public
final
false
static
true

addAdapterPrefixPaths

addAdapterPrefixPaths( array $prefixPaths ) :

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/' );

Arguments
$prefixPaths
array
Details
visibility
public
final
false
static
true

addScrollingStylePrefixPath

addScrollingStylePrefixPath( string $prefix, string $path ) :

Adds a scrolling style prefix path to the plugin loader.

Arguments
$prefix
string
$path
string
Details
visibility
public
final
false
static
true

addScrollingStylePrefixPaths

addScrollingStylePrefixPaths( array $prefixPaths ) :

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/' );

Arguments
$prefixPaths
array
Details
visibility
public
final
false
static
true

clearPageItemCache

clearPageItemCache( int $pageNumber = null ) : Zend_Paginator

Clear the page item cache.

Arguments
$pageNumber
int
Details
visibility
public
final
false
static
false

count

count( ) : integer

Returns the number of pages.

Output
integer
Details
visibility
public
final
false
static
false

factory

factory( mixed $data, string $adapter = self, array $prefixPaths = null ) : Zend_Paginator

Factory.

Arguments
$data
mixed
$adapter
string
$prefixPaths
array
Details
visibility
public
final
false
static
true

getAbsoluteItemNumber

getAbsoluteItemNumber( integer $relativeItemNumber, integer $pageNumber = null ) : integer

Returns the absolute item number for the specified item.

Arguments
$relativeItemNumber
integer
Relative item number
$pageNumber
integer
Page number
Output
integer
Details
visibility
public
final
false
static
false

getAdapter

getAdapter( ) : Zend_Paginator_Adapter_Interface

Returns the adapter.

Details
visibility
public
final
false
static
false

getAdapterLoader

getAdapterLoader( ) : Zend_Loader_PluginLoader

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

Details
visibility
public
final
false
static
true

getCurrentItemCount

getCurrentItemCount( ) : integer

Returns the number of items for the current page.

Output
integer
Details
visibility
public
final
false
static
false

getCurrentItems

getCurrentItems( ) : Traversable

Returns the items for the current page.

Output
Traversable
Details
visibility
public
final
false
static
false

getCurrentPageNumber

getCurrentPageNumber( ) : integer

Returns the current page number.

Output
integer
Details
visibility
public
final
false
static
false

getDefaultItemCountPerPage

getDefaultItemCountPerPage( ) : int

Get the default item count per page

Output
int
Details
visibility
public
final
false
static
true

getDefaultScrollingStyle

getDefaultScrollingStyle( ) : string

Returns the default scrolling style.

Output
string
Details
visibility
public
final
false
static
true

getFilter

getFilter( ) : Zend_Filter_Interface

Get the filter

Details
visibility
public
final
false
static
false

getItem

getItem( integer $itemNumber, integer $pageNumber = null ) : mixed

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

Arguments
$itemNumber
integer
Item number (1 to itemCountPerPage)
$pageNumber
integer
Output
mixed
Details
visibility
public
final
false
static
false

getItemCount

getItemCount( mixed $items ) : integer

Returns the number of items in a collection.

Arguments
$items
mixed
Items
Output
integer
Details
visibility
public
final
false
static
false

getItemCountPerPage

getItemCountPerPage( ) : integer

Returns the number of items per page.

Output
integer
Details
visibility
public
final
false
static
false

getItemsByPage

getItemsByPage(  $pageNumber ) : Traversable

Returns the items for a given page.

Arguments
$pageNumber
Output
Traversable
Details
visibility
public
final
false
static
false

getIterator

getIterator( ) : Traversable

Returns a foreach-compatible iterator.

Output
Traversable
Details
visibility
public
final
false
static
false

getPageItemCache

getPageItemCache( ) : array

Returns the page item cache.

Output
array
Details
visibility
public
final
false
static
false

getPageRange

getPageRange( ) : integer

Returns the page range (see property declaration above).

Output
integer
Details
visibility
public
final
false
static
false

getPages

getPages( string $scrollingStyle = null ) : array

Returns the page collection.

Arguments
$scrollingStyle
string
Scrolling style
Output
array
Details
visibility
public
final
false
static
false

getPagesInRange

getPagesInRange( integer $lowerBound, integer $upperBound ) : array

Returns a subset of pages within a given range.

Arguments
$lowerBound
integer
Lower bound of the range
$upperBound
integer
Upper bound of the range
Output
array
Details
visibility
public
final
false
static
false

getScrollingStyleLoader

getScrollingStyleLoader( ) : Zend_Loader_PluginLoader

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

Details
visibility
public
final
false
static
true

getTotalItemCount

getTotalItemCount( ) : integer

Returns the total number of items available.

Output
integer
Details
visibility
public
final
false
static
false

getView

getView( ) : Zend_View_Interface|null

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

Output
Zend_View_Interface|null
Details
visibility
public
final
false
static
false

normalizeItemNumber

normalizeItemNumber( integer $itemNumber ) : integer

Brings the item number in range of the page.

Arguments
$itemNumber
integer
Output
integer
Details
visibility
public
final
false
static
false

normalizePageNumber

normalizePageNumber( integer $pageNumber ) : integer

Brings the page number in range of the paginator.

Arguments
$pageNumber
integer
Output
integer
Details
visibility
public
final
false
static
false

render

render( Zend_View_Interface $view = null ) : string

Renders the paginator.

Arguments
$view
Zend_View_Interface
Output
string
Details
visibility
public
final
false
static
false

setCache

setCache( Zend_Cache_Core $cache ) :

Sets a cache object

Arguments
$cache
Zend_Cache_Core
Details
visibility
public
final
false
static
true

setCacheEnabled

setCacheEnabled( bool $enable ) : Zend_Paginator

Enables/Disables the cache for this instance

Arguments
$enable
bool
Details
visibility
public
final
false
static
false

setConfig

setConfig( Zend_Config $config ) :

Set a global config

Arguments
$config
Zend_Config
Details
visibility
public
final
false
static
true

setCurrentPageNumber

setCurrentPageNumber( integer $pageNumber ) : Zend_Paginator

Sets the current page number.

Arguments
$pageNumber
integer
Page number
Output
Zend_Paginator
$this
Details
visibility
public
final
false
static
false

setDefaultItemCountPerPage

setDefaultItemCountPerPage( int $count ) :

Set the default item count per page

Arguments
$count
int
Details
visibility
public
final
false
static
true

setDefaultScrollingStyle

setDefaultScrollingStyle( string $scrollingStyle = Sliding ) :

Sets the default scrolling style.

Arguments
$scrollingStyle
string
Details
visibility
public
final
false
static
true

setFilter

setFilter( Zend_Filter_Interface $filter ) : Zend_Paginator

Set a filter chain

Arguments
$filter
Zend_Filter_Interface
Details
visibility
public
final
false
static
false

setItemCountPerPage

setItemCountPerPage( integer $itemCountPerPage ) : Zend_Paginator

Sets the number of items per page.

Arguments
$itemCountPerPage
integer
Output
Zend_Paginator
$this
Details
visibility
public
final
false
static
false

setPageRange

setPageRange( integer $pageRange ) : Zend_Paginator

Sets the page range (see property declaration above).

Arguments
$pageRange
integer
Output
Zend_Paginator
$this
Details
visibility
public
final
false
static
false

setView

setView( Zend_View_Interface $view = null ) : Zend_Paginator

Sets the view object.

Arguments
$view
Zend_View_Interface
Details
visibility
public
final
false
static
false

toJson

toJson( ) : string

Returns the items of the current page as JSON.

Output
string
Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox.