Documentation

Paging
in package

Creates the paging

Tags
subpackage

core

version
3.0.0
author

Reto Kohli reto.kohli@comvation.com

Table of Contents

Methods

get()  : string
Returs a string representing the complete paging HTML code for the current page
getParametername()  : mixed
getPosition()  : int
Returns the current offset
reset()  : mixed
Resets the paging offset to zero
getBackendPaging()  : string
Returs a string representing the complete paging HTML code for the current page
getPagingBaseUrl()  : string
Returns the URL with an sprintf-style placeholder for the offset
getPagingUrl()  : string
Returns the URL for a certain paging offset to jump to
generateParameterName()  : mixed
sanitizeParameterName()  : string
Ensure that the used parameter name complies with the session restrictions defined for variable keys, as the parameter name is being used as a sesison-variable-key.

Methods

get()

Returs a string representing the complete paging HTML code for the current page

public static get(string $uri_parameter, string $paging_text, int $numof_rows[, int|null $results_per_page = 0 ][, bool $showeverytime = false ][, int|null $position = null ][, string|null $parameter_name = null ][, bool $addCsrfToken = true ][, int $viewGeneratorId = -1 ][, bool $useSession = false ]) : string
Parameters
$uri_parameter : string

Optional additional URI parameters, MUST* start with an URI encoded ampersand (&).

$paging_text : string

The text to be put in front of the paging

$numof_rows : int

The number of rows available

$results_per_page : int|null = 0

The optional maximum number of rows to be shown on a single page. Defaults to the corePagingLimit setting.

$showeverytime : bool = false

If true, the paging is shown even if $numof_rows is less than $results_per_page

$position : int|null = null

The optional starting position offset. Defaults to null

$parameter_name : string|null = null

The optional name for the URI parameter. Will be determined automatically if empty.

$addCsrfToken : bool = true

Set to false (defaults to true) to not inject a CSRF token into the paging URLs. This might be useful when the paging will be used over AJAX where CSRF is not required.

$viewGeneratorId : int = -1

The ID of the VG to generate URIs for

$useSession : bool = false

Whether to use session to save position. Defaults to false.

Tags
author

Reto Kohli reto.kohli@comvation.com

access

public

global

array $_CONFIG Configuration

global

array $_CORELANG Core language

Return values
string

HTML code for the paging

getParametername()

public static getParametername([mixed $parameterName = null ]) : mixed
Parameters
$parameterName : mixed = null

getPosition()

Returns the current offset

public static getPosition([string|null $parameter_name = null ][, bool $useSession = false ]) : int

If the parameter 'pos' is present in the request, it overrides the value stored in the session, if any. Defaults to zero.

Parameters
$parameter_name : string|null = null

The optional name of the position offset parameter

$useSession : bool = false

Whether or not to use session to store paging position

Return values
int

The position offset

reset()

Resets the paging offset to zero

public static reset([string $parameter_name = null ]) : mixed

Call this if your query results in less records than the offset.

Parameters
$parameter_name : string = null

The optional name of the position offset parameter

getBackendPaging()

Returs a string representing the complete paging HTML code for the current page

protected static getBackendPaging(string $uri_parameter, string $paging_text, int $dataLength[, int|null $pageLength = 0 ][, int|null $offset = null ][, string|null $parameter_name = null ][, bool $addCsrfToken = true ][, int $viewGeneratorId = -1 ]) : string
Parameters
$uri_parameter : string

Optional additional URI parameters, MUST* start with an URI encoded ampersand (&).

$paging_text : string

The text to be put in front of the paging (currently unused)

$dataLength : int

The number of rows available

$pageLength : int|null = 0

The optional maximum number of rows to be shown on a single page. Defaults to the corePagingLimit setting.

$offset : int|null = null

The optional starting position offset. Defaults to null

$parameter_name : string|null = null

The optional name for the URI parameter. Will be determined automatically if empty.

$addCsrfToken : bool = true

Set to false (defaults to true) to not inject a CSRF token into the paging URLs. This might be useful when the paging will be used over AJAX where CSRF is not required.

$viewGeneratorId : int = -1

The ID of the VG to generate URIs for

Tags
global

array $_CORELANG Core language

Return values
string

HTML code for the paging

getPagingBaseUrl()

Returns the URL with an sprintf-style placeholder for the offset

protected static getPagingBaseUrl(string $paramName[, int $vgId = -1 ][, string $uri_parameter = '' ]) : string
Parameters
$paramName : string

Name of the URL parameter to use

$vgId : int = -1

(optional) The ViewGenerator ID to generate the URL for

$uri_parameter : string = ''

Optional additional URI parameters, MUST* start with an URI encoded ampersand (&).

Return values
string

URL

getPagingUrl()

Returns the URL for a certain paging offset to jump to

protected static getPagingUrl(int $pos, string $paramName[, int $vgId = -1 ][, string $uri_parameter = '' ]) : string
Parameters
$pos : int

Offset to jump to

$paramName : string

Name of the URL parameter to use

$vgId : int = -1

(optional) The ViewGenerator ID to generate the URL for

$uri_parameter : string = ''

Optional additional URI parameters, MUST* start with an URI encoded ampersand (&).

Return values
string

URL

generateParameterName()

private static generateParameterName() : mixed

sanitizeParameterName()

Ensure that the used parameter name complies with the session restrictions defined for variable keys, as the parameter name is being used as a sesison-variable-key.

private static sanitizeParameterName(string $parameterName) : string
Parameters
$parameterName : string

The name of the session-variable-key used to store the current paging position.

Return values
string

$parameterName The sanitized session-variable-key.


        
On this page

Search results