JPagination

Extends \JObject

Pagination Class. Provides a common interface for content pagination for the Joomla! Platform.

This class allows for simple but smart objects with get and set methods and an internal error handler.

package

Joomla.Platform

subpackage

HTML

since

11.1

Methods

__construct

Class constructor, overridden in descendant classes.

__construct(mixed $properties = null) 
inherited
since

11.1

Arguments

$properties

mixedEither and associative array or another object to set the initial properties of the object.

__toString

Magic method to convert the object to a string gracefully.

__toString() : string
inherited deprecated
since

11.1

deprecated

12.3 Classes should provide their own __toString() implementation.

Response

stringThe classname.

_buildDataObject

Create and return the pagination data object.

_buildDataObject() : object
since

11.1

Response

objectPagination data object.

_item_active

Method to create an active pagination link to the item

_item_active( &$item) : string
since

11.1

Arguments

$item

Response

stringHTML link

_item_inactive

Method to create an inactive pagination string

_item_inactive( &$item) : string
since

11.1

Arguments

$item

Response

string

_list_render

Create the html for a list footer

_list_render(array $list) : string
since

11.1

Arguments

$list

arrayPagination list data structure.

Response

stringHTML for a list start, previous, next,end

def

Sets a default value if not alreay assigned

def(string $property, mixed $default = null) : mixed
inherited
since

11.1

Arguments

$property

stringThe name of the property.

$default

mixedThe default value.

Response

mixed

get

Returns a property of the object or the default value if the property is not set.

get(string $property, mixed $default = null) : mixed
inherited
since

11.1

see \JObject::getProperties()

Arguments

$property

stringThe name of the property.

$default

mixedThe default value.

Response

mixedThe value of the property.

getAdditionalUrlParam

Method to get an additional URL parameter (if it exists) to be added to all pagination class generated links.

getAdditionalUrlParam(string $key) : mixed
since

11.1

Arguments

$key

stringThe name of the URL parameter for which to get the value.

Response

mixedThe value if it exists or null if it does not.

getData

Return the pagination data object, only creating it if it doesn't already exist.

getData() : object
since

11.1

Response

objectPagination data object.

getError

Get the most recent error message.

getError(integer $i = null, boolean $toString = true) : string
inherited deprecated
since

11.1

see \JError
deprecated

12.3 JError has been deprecated

Arguments

$i

integerOption error index.

$toString

booleanIndicates if JError objects should return their error message.

Response

stringError message

getErrors

Return all errors, if any.

getErrors() : array
inherited deprecated
since

11.1

see \JError
deprecated

12.3 JError has been deprecated

Response

arrayArray of error messages or JErrors.

getLimitBox

Creates a dropdown box for selecting how many records to show per page.

getLimitBox() : string
since

11.1

Response

stringThe HTML for the limit # input box.

getListFooter

Return the pagination footer.

getListFooter() : string
since

11.1

Response

stringPagination footer.

getPagesCounter

Create and return the pagination pages counter string, ie. Page 2 of 4.

getPagesCounter() : string
since

11.1

Response

stringPagination pages counter string.

getProperties

Returns an associative array of object properties.

getProperties(boolean $public = true) : array
inherited
since

11.1

see \JObject::get()

Arguments

$public

booleanIf true, returns only the public properties.

Response

array

getResultsCounter

Create and return the pagination result set counter string, e.g. Results 1-10 of 42

getResultsCounter() : string
since

11.1

Response

stringPagination result set counter string.

getRowOffset

Return the rationalised offset for a row with a given index.

getRowOffset(integer $index) : integer
since

11.1

Arguments

$index

integerThe row index

Response

integerRationalised offset for a row with a given index.

orderDownIcon

Return the icon to move an item DOWN.

orderDownIcon(integer $i, integer $n, boolean $condition = true, string $task = 'orderdown', string $alt = 'JLIB_HTML_MOVE_DOWN', boolean $enabled = true, string $checkbox = 'cb') : string
since

11.1

Arguments

$i

integerThe row index.

$n

integerThe number of items in the list.

$condition

booleanTrue to show the icon.

$task

stringThe task to fire.

$alt

stringThe image alternative text string.

$enabled

booleanAn optional setting for access control on the action.

$checkbox

stringAn optional prefix for checkboxes.

Response

stringEither the icon to move an item down or a space.

orderUpIcon

Return the icon to move an item UP.

orderUpIcon(integer $i, boolean $condition = true, string $task = 'orderup', string $alt = 'JLIB_HTML_MOVE_UP', boolean $enabled = true, string $checkbox = 'cb') : string
since

11.1

Arguments

$i

integerThe row index.

$condition

booleanTrue to show the icon.

$task

stringThe task to fire.

$alt

stringThe image alternative text string.

$enabled

booleanAn optional setting for access control on the action.

$checkbox

stringAn optional prefix for checkboxes.

Response

stringEither the icon to move an item up or a space.

set

Modifies a property of the object, creating it if it does not already exist.

set(string $property, mixed $value = null) : mixed
inherited
since

11.1

Arguments

$property

stringThe name of the property.

$value

mixedThe value of the property to set.

Response

mixedPrevious value of the property.

setAdditionalUrlParam

Method to set an additional URL parameter to be added to all pagination class generated links.

setAdditionalUrlParam(string $key, mixed $value) : mixed
since

11.1

Arguments

$key

stringThe name of the URL parameter for which to set a value.

$value

mixedThe value to set for the URL parameter.

Response

mixedThe old value for the parameter.

setError

Add an error message.

setError(string $error) : void
inherited deprecated
since

11.1

see \JError
deprecated

12.3 JError has been deprecated

Arguments

$error

stringError message.

setProperties

Set the object properties based on a named array/hash.

setProperties(mixed $properties) : boolean
inherited
since

11.1

see \JObject::set()

Arguments

$properties

mixedEither an associative array or another object.

Response

boolean

toString

Converts the object to a string (the class name).

toString() : string
inherited deprecated
since

11.1

deprecated

12.1 Use magic method __toString()

see \JObject::__toString()

Response

string

Properties

limitstart

The record number to start displaying from.

since

11.1

Type(s)

integer

limit

Number of rows to display per page.

since

11.1

Type(s)

integer

total

Total number of rows.

since

11.1

Type(s)

integer

prefix

Prefix used for request variables.

since

11.1

Type(s)

integer

_viewall

View all flag

since

11.1

Type(s)

boolean

_additionalUrlParams

Additional URL parameters to be added to the pagination URLs generated by the class. These may be useful for filters and extra values when dealing with lists and GET requests.

since

11.1

Type(s)

array

_errors

An array of error messages or Exception objects.

inherited deprecated
since

11.1

see \JError
deprecated

12.3 JError has been deprecated

Type(s)

array