Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes | Static Protected Attributes

Zend_Paginator Class Reference

Public Member Functions

 __construct ($adapter)
 __toString ()
 setCacheEnabled ($enable)
 count ()
 getTotalItemCount ()
 clearPageItemCache ($pageNumber=null)
 getAbsoluteItemNumber ($relativeItemNumber, $pageNumber=null)
 getAdapter ()
 getCurrentItemCount ()
 getCurrentItems ()
 getCurrentPageNumber ()
 setCurrentPageNumber ($pageNumber)
 getFilter ()
 setFilter (Zend_Filter_Interface $filter)
 getItem ($itemNumber, $pageNumber=null)
 getItemCountPerPage ()
 setItemCountPerPage ($itemCountPerPage)
 getItemCount ($items)
 getItemsByPage ($pageNumber)
 getIterator ()
 getPageRange ()
 setPageRange ($pageRange)
 getPages ($scrollingStyle=null)
 getPagesInRange ($lowerBound, $upperBound)
 getPageItemCache ()
 getView ()
 setView (Zend_View_Interface $view=null)
 normalizeItemNumber ($itemNumber)
 normalizePageNumber ($pageNumber)
 render (Zend_View_Interface $view=null)
 toJson ()

Static Public Member Functions

static addAdapterPrefixPath ($prefix, $path)
static addAdapterPrefixPaths (array $prefixPaths)
static addScrollingStylePrefixPath ($prefix, $path)
static addScrollingStylePrefixPaths (array $prefixPaths)
static factory ($data, $adapter=self::INTERNAL_ADAPTER, array $prefixPaths=null)
static getAdapterLoader ()
static setConfig (Zend_Config $config)
static getDefaultScrollingStyle ()
static getDefaultItemCountPerPage ()
static setDefaultItemCountPerPage ($count)
static setCache (Zend_Cache_Core $cache)
static setDefaultScrollingStyle ($scrollingStyle= 'Sliding')
static getScrollingStyleLoader ()

Data Fields

const INTERNAL_ADAPTER = 'Zend_Paginator_Adapter_Internal'
const CACHE_TAG_PREFIX = 'Zend_Paginator_'

Protected Member Functions

 _cacheEnabled ()
 _getCacheId ($page=null)
 _getCacheInternalId ()
 _calculatePageCount ()
 _createPages ($scrollingStyle=null)
 _loadScrollingStyle ($scrollingStyle=null)

Protected Attributes

 $_cacheEnabled = true
 $_adapter = null
 $_currentItemCount = null
 $_currentItems = null
 $_currentPageNumber = 1
 $_filter = null
 $_itemCountPerPage = null
 $_pageCount = null
 $_pageRange = 10
 $_pages = null
 $_view = null

Static Protected Attributes

static $_adapterLoader = null
static $_config = null
static $_defaultScrollingStyle = 'Sliding'
static $_defaultItemCountPerPage = 10
static $_scrollingStyleLoader = null
static $_cache

Detailed Description

Definition at line 38 of file Paginator.php.


Constructor & Destructor Documentation

__construct ( adapter )

Constructor.

Parameters:
Zend_Paginator_Adapter_Interface | Zend_Paginator_AdapterAggregate$adapter

See also:
Zend_Paginator_Exception

Definition at line 420 of file Paginator.php.


Member Function Documentation

__toString (  )

Serializes the object as a string. Proxies to render().

Returns:
string

Definition at line 459 of file Paginator.php.

_cacheEnabled (  ) [protected]

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

Returns:
bool

Definition at line 972 of file Paginator.php.

_calculatePageCount (  ) [protected]

Calculates the page count.

Returns:
integer

Definition at line 1013 of file Paginator.php.

_createPages ( scrollingStyle = null ) [protected]

Creates the page collection.

Parameters:
string$scrollingStyleScrolling style
Returns:
stdClass

Definition at line 1024 of file Paginator.php.

_getCacheId ( page = null ) [protected]

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:
int$page
Returns:
string

Definition at line 987 of file Paginator.php.

_getCacheInternalId (  ) [protected]

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:
string

Definition at line 1003 of file Paginator.php.

_loadScrollingStyle ( scrollingStyle = null ) [protected]

Loads a scrolling style.

Parameters:
string$scrollingStyle
Returns:
Zend_Paginator_ScrollingStyle_Interface

See also:
Zend_View_Exception
Zend_View_Exception

Definition at line 1069 of file Paginator.php.

static addAdapterPrefixPath ( prefix,
path 
) [static]

Adds an adapter prefix path to the plugin loader.

Parameters:
string$prefix
string$path

Definition at line 179 of file Paginator.php.

static addAdapterPrefixPaths ( array $  prefixPaths ) [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:
array$prefixPaths

Definition at line 197 of file Paginator.php.

static addScrollingStylePrefixPath ( prefix,
path 
) [static]

Adds a scrolling style prefix path to the plugin loader.

Parameters:
string$prefix
string$path

Definition at line 219 of file Paginator.php.

static addScrollingStylePrefixPaths ( array $  prefixPaths ) [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:
array$prefixPaths

Definition at line 237 of file Paginator.php.

clearPageItemCache ( pageNumber = null )

Clear the page item cache.

Parameters:
int$pageNumber
Returns:
Zend_Paginator

Definition at line 513 of file Paginator.php.

count (  )

Returns the number of pages.

Returns:
integer

Definition at line 488 of file Paginator.php.

static factory ( data,
adapter = self::INTERNAL_ADAPTER,
array $  prefixPaths = null 
) [static]

Factory.

Parameters:
mixed$data
string$adapter
array$prefixPaths
Returns:
Zend_Paginator

See also:
Zend_Paginator_Exception

Definition at line 261 of file Paginator.php.

getAbsoluteItemNumber ( relativeItemNumber,
pageNumber = null 
)

Returns the absolute item number for the specified item.

Parameters:
integer$relativeItemNumberRelative item number
integer$pageNumberPage number
Returns:
integer

Definition at line 540 of file Paginator.php.

getAdapter (  )

Returns the adapter.

Returns:
Zend_Paginator_Adapter_Interface

Definition at line 558 of file Paginator.php.

static getAdapterLoader (  ) [static]

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

Returns:
Zend_Loader_PluginLoader

Definition at line 309 of file Paginator.php.

getCurrentItemCount (  )

Returns the number of items for the current page.

Returns:
integer

Definition at line 568 of file Paginator.php.

getCurrentItems (  )

Returns the items for the current page.

Returns:
Traversable

Definition at line 582 of file Paginator.php.

getCurrentPageNumber (  )

Returns the current page number.

Returns:
integer

Definition at line 596 of file Paginator.php.

static getDefaultItemCountPerPage (  ) [static]

Get the default item count per page

Returns:
int

Definition at line 363 of file Paginator.php.

static getDefaultScrollingStyle (  ) [static]

Returns the default scrolling style.

Returns:
string

Definition at line 353 of file Paginator.php.

getFilter (  )

Get the filter

Returns:
Zend_Filter_Interface

Definition at line 621 of file Paginator.php.

getItem ( itemNumber,
pageNumber = null 
)

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

Parameters:
integer$itemNumberItem number (1 to itemCountPerPage)
integer$pageNumber
Returns:
mixed

See also:
Zend_Paginator_Exception
Zend_Paginator_Exception

Definition at line 647 of file Paginator.php.

getItemCount ( items )

Returns the number of items in a collection.

Parameters:
mixed$itemsItems
Returns:
integer

Definition at line 719 of file Paginator.php.

getItemCountPerPage (  )

Returns the number of items per page.

Returns:
integer

Definition at line 685 of file Paginator.php.

getItemsByPage ( pageNumber )

Returns the items for a given page.

Returns:
Traversable

Definition at line 737 of file Paginator.php.

getIterator (  )

Returns a foreach-compatible iterator.

Returns:
Traversable

Definition at line 774 of file Paginator.php.

getPageItemCache (  )

Returns the page item cache.

Returns:
array

Definition at line 843 of file Paginator.php.

getPageRange (  )

Returns the page range (see property declaration above).

Returns:
integer

Definition at line 784 of file Paginator.php.

getPages ( scrollingStyle = null )

Returns the page collection.

Parameters:
string$scrollingStyleScrolling style
Returns:
array

Definition at line 808 of file Paginator.php.

getPagesInRange ( lowerBound,
upperBound 
)

Returns a subset of pages within a given range.

Parameters:
integer$lowerBoundLower bound of the range
integer$upperBoundUpper bound of the range
Returns:
array

Definition at line 824 of file Paginator.php.

static getScrollingStyleLoader (  ) [static]

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

Returns:
Zend_Loader_PluginLoader

Definition at line 404 of file Paginator.php.

getTotalItemCount (  )

Returns the total number of items available.

Returns:
integer

Definition at line 502 of file Paginator.php.

getView (  )

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

Returns:
Zend_View_Interface|null

See also:
Zend_Controller_Action_HelperBroker

Definition at line 862 of file Paginator.php.

normalizeItemNumber ( itemNumber )

Brings the item number in range of the page.

Parameters:
integer$itemNumber
Returns:
integer

Definition at line 899 of file Paginator.php.

normalizePageNumber ( pageNumber )

Brings the page number in range of the paginator.

Parameters:
integer$pageNumber
Returns:
integer

Definition at line 918 of file Paginator.php.

render ( Zend_View_Interface view = null )

Renders the paginator.

Parameters:
Zend_View_Interface$view
Returns:
string

Definition at line 939 of file Paginator.php.

static setCache ( Zend_Cache_Core cache ) [static]

Sets a cache object

Parameters:
Zend_Cache_Core$cache

Definition at line 383 of file Paginator.php.

setCacheEnabled ( enable )

Enables/Disables the cache for this instance

Parameters:
bool$enable
Returns:
Zend_Paginator

Definition at line 477 of file Paginator.php.

static setConfig ( Zend_Config config ) [static]

Set a global config

Parameters:
Zend_Config$config

Definition at line 325 of file Paginator.php.

setCurrentPageNumber ( pageNumber )

Sets the current page number.

Parameters:
integer$pageNumberPage number
Returns:
Zend_Paginator $this

Definition at line 607 of file Paginator.php.

static setDefaultItemCountPerPage ( count ) [static]

Set the default item count per page

Parameters:
int$count

Definition at line 373 of file Paginator.php.

static setDefaultScrollingStyle ( scrollingStyle = 'Sliding' ) [static]

Sets the default scrolling style.

Parameters:
string$scrollingStyle

Definition at line 393 of file Paginator.php.

setFilter ( Zend_Filter_Interface $  filter )

Set a filter chain

Parameters:
Zend_Filter_Interface$filter
Returns:
Zend_Paginator

Definition at line 632 of file Paginator.php.

setItemCountPerPage ( itemCountPerPage )

Sets the number of items per page.

Parameters:
integer$itemCountPerPage
Returns:
Zend_Paginator $this

Definition at line 700 of file Paginator.php.

setPageRange ( pageRange )

Sets the page range (see property declaration above).

Parameters:
integer$pageRange
Returns:
Zend_Paginator $this

Definition at line 795 of file Paginator.php.

setView ( Zend_View_Interface view = null )

Sets the view object.

Parameters:
Zend_View_Interface$view
Returns:
Zend_Paginator

Definition at line 886 of file Paginator.php.

toJson (  )

Returns the items of the current page as JSON.

Returns:
string

Definition at line 955 of file Paginator.php.


Field Documentation

const CACHE_TAG_PREFIX = 'Zend_Paginator_'

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

Definition at line 51 of file Paginator.php.


The documentation for this class was generated from the following file: