Aplus Framework Docs

Pager
in package
implements JsonSerializable, Stringable

Class Pager.

Interfaces, Classes, Traits and Enums

JsonSerializable
Stringable

Table of Contents

$currentPage  : int
$defaultView  : string
$itemsPerPage  : int
$language  : Language
$lastPage  : int
$nextPage  : int|null
$oldUrl  : string
$previousPage  : int|null
$query  : string
$surround  : int
$totalItems  : int
$url  : URL
$views  : array<string|int, mixed>
__construct()  : mixed
Pager constructor.
__toString()  : string
get()  : array<string, int|null>
getCurrentPage()  : int
getCurrentPageUrl()  : string
getDefaultView()  : string
getFirstPage()  : int
getFirstPageUrl()  : string
getItemsPerPage()  : int
getLanguage()  : Language
getLastPage()  : int
getLastPageUrl()  : string
getNextPage()  : int|null
getNextPagesUrls()  : array<int, string>
getNextPageUrl()  : string|null
getPageUrl()  : string|null
getPreviousPage()  : int|null
getPreviousPagesUrls()  : array<int, string>
getPreviousPageUrl()  : string|null
getQuery()  : string
getSurround()  : int
getTotalItems()  : int
getUrl()  : URL
getView()  : string
Get a view filepath.
getViews()  : array<string, string>
getWithUrl()  : array<string, string|null>
jsonSerialize()  : array<string, string|null>
render()  : string
renderShort()  : string
sanitize()  : int
Sanitize a number.
setAllowedQueries()  : static
setDefaultView()  : static
setLanguage()  : static
setQuery()  : static
setSurround()  : static
setUrl()  : static
setView()  : static
prepareUrl()  : static
setCurrentPage()  : static
setItemsPerPage()  : static
setLastPage()  : static
setNextPage()  : static
setPreviousPage()  : static
setTotalItems()  : static

Properties

$currentPage

protected int $currentPage

$defaultView

protected string $defaultView = 'pagination'

$itemsPerPage

protected int $itemsPerPage

$lastPage

protected int $lastPage

$nextPage

protected int|null $nextPage = null

$oldUrl

protected string $oldUrl

$previousPage

protected int|null $previousPage = null

$query

protected string $query = 'page'

$surround

protected int $surround = 2

$totalItems

protected int $totalItems

$views

protected array<string|int, mixed> $views = [ // HTML Head 'head' => __DIR__ . '/Views/head.php', // HTTP Header 'header' => __DIR__ . '/Views/header.php', // HTML Previous and Next 'pager' => __DIR__ . '/Views/pagination-short.php', // HTML Full 'pagination' => __DIR__ . '/Views/pagination.php', 'pagination-short' => __DIR__ . '/Views/pagination-short.php', // Bootstrap 5 'bootstrap' => __DIR__ . '/Views/bootstrap.php', 'bootstrap-short' => __DIR__ . '/Views/bootstrap-short.php', 'bootstrap5' => __DIR__ . '/Views/bootstrap.php', 'bootstrap5-short' => __DIR__ . '/Views/bootstrap-short.php', // Bulma 1 'bulma' => __DIR__ . '/Views/bulma.php', 'bulma-short' => __DIR__ . '/Views/bulma-short.php', 'bulma1' => __DIR__ . '/Views/bulma.php', 'bulma1-short' => __DIR__ . '/Views/bulma-short.php', // Foundation 6 'foundation' => __DIR__ . '/Views/foundation.php', 'foundation-short' => __DIR__ . '/Views/foundation-short.php', 'foundation6' => __DIR__ . '/Views/foundation.php', 'foundation6-short' => __DIR__ . '/Views/foundation-short.php', // Materialize 1 'materialize' => __DIR__ . '/Views/materialize.php', 'materialize-short' => __DIR__ . '/Views/materialize-short.php', 'materialize1' => __DIR__ . '/Views/materialize.php', 'materialize1-short' => __DIR__ . '/Views/materialize-short.php', // Primer 20 'primer' => __DIR__ . '/Views/primer.php', 'primer-short' => __DIR__ . '/Views/primer-short.php', 'primer20' => __DIR__ . '/Views/primer.php', 'primer20-short' => __DIR__ . '/Views/primer-short.php', // Semantic UI 2 'semantic-ui' => __DIR__ . '/Views/semantic-ui.php', 'semantic-ui-short' => __DIR__ . '/Views/semantic-ui-short.php', 'semantic-ui2' => __DIR__ . '/Views/semantic-ui.php', 'semantic-ui2-short' => __DIR__ . '/Views/semantic-ui-short.php', // Tailwind CSS 3 'tailwind' => __DIR__ . '/Views/tailwind.php', 'tailwind-short' => __DIR__ . '/Views/tailwind-short.php', 'tailwind3' => __DIR__ . '/Views/tailwind.php', 'tailwind3-short' => __DIR__ . '/Views/tailwind-short.php', // W3.CSS 4 'w3' => __DIR__ . '/Views/w3.php', 'w3-short' => __DIR__ . '/Views/w3-short.php', 'w34' => __DIR__ . '/Views/w3.php', 'w34-short' => __DIR__ . '/Views/w3-short.php', ]

Methods

__construct()

Pager constructor.

public __construct(int|string $currentPage, int|string $itemsPerPage, int $totalItems[, Language|null $language = null ][, string|null $url = null ]) : mixed
Parameters
$currentPage : int|string
$itemsPerPage : int|string
$totalItems : int
$language : Language|null = null

Language instance

$url : string|null = null
Return values
mixed

__toString()

public __toString() : string
Return values
string

get()

public get() : array<string, int|null>
Return values
array<string, int|null>

getCurrentPage()

public getCurrentPage() : int
Return values
int

getCurrentPageUrl()

public getCurrentPageUrl() : string
Return values
string

getDefaultView()

public getDefaultView() : string
Return values
string

getFirstPage()

public getFirstPage() : int
Return values
int

getFirstPageUrl()

public getFirstPageUrl() : string
Return values
string

getItemsPerPage()

public getItemsPerPage() : int
Tags
since
3.5
Return values
int

getLastPage()

public getLastPage() : int
Return values
int

getLastPageUrl()

public getLastPageUrl() : string
Return values
string

getNextPage()

public getNextPage() : int|null
Return values
int|null

getNextPagesUrls()

public getNextPagesUrls() : array<int, string>
Return values
array<int, string>

getNextPageUrl()

public getNextPageUrl() : string|null
Return values
string|null

getPageUrl()

public getPageUrl(int|null $page) : string|null
Parameters
$page : int|null
Return values
string|null

getPreviousPage()

public getPreviousPage() : int|null
Return values
int|null

getPreviousPagesUrls()

public getPreviousPagesUrls() : array<int, string>
Return values
array<int, string>

getPreviousPageUrl()

public getPreviousPageUrl() : string|null
Return values
string|null

getQuery()

public getQuery() : string
Return values
string

getSurround()

public getSurround() : int
Return values
int

getTotalItems()

public getTotalItems() : int
Tags
since
3.5
Return values
int

getView()

Get a view filepath.

public getView(string $name) : string
Parameters
$name : string

The view name. Default names are: head, header, pager and pagination

Return values
string

getViews()

public getViews() : array<string, string>
Return values
array<string, string>

getWithUrl()

public getWithUrl() : array<string, string|null>
Return values
array<string, string|null>

jsonSerialize()

public jsonSerialize() : array<string, string|null>
Return values
array<string, string|null>

render()

public render([string|null $view = null ]) : string
Parameters
$view : string|null = null
Return values
string

renderShort()

public renderShort() : string
Return values
string

sanitize()

Sanitize a number.

public static sanitize(mixed $number) : int
Parameters
$number : mixed
Return values
int

setAllowedQueries()

public setAllowedQueries(array<string|int, string>|null $allowed) : static
Parameters
$allowed : array<string|int, string>|null

List of queries, an empty array to allow only the default or null to allow all

Return values
static

setDefaultView()

public setDefaultView(string $defaultView) : static
Parameters
$defaultView : string
Return values
static

setLanguage()

public setLanguage([Language|null $language = null ]) : static
Parameters
$language : Language|null = null
Return values
static

setQuery()

public setQuery([string $query = 'page' ]) : static
Parameters
$query : string = 'page'
Return values
static

setSurround()

public setSurround(int $surround) : static
Parameters
$surround : int
Return values
static

setUrl()

public setUrl(URL|string $currentPageUrl[, array<string|int, string>|null $allowedQueries = null ]) : static
Parameters
$currentPageUrl : URL|string
$allowedQueries : array<string|int, string>|null = null

List of queries, an empty array to allow only the default or null to allow all

Return values
static

setView()

public setView(string $name, string $filepath) : static
Parameters
$name : string
$filepath : string
Return values
static

prepareUrl()

protected prepareUrl() : static
Return values
static

setCurrentPage()

protected setCurrentPage(int $currentPage) : static
Parameters
$currentPage : int
Tags
since
3.5
Return values
static

setItemsPerPage()

protected setItemsPerPage(int $itemsPerPage) : static
Parameters
$itemsPerPage : int
Tags
since
3.5
Return values
static

setLastPage()

protected setLastPage(int $lastPage) : static
Parameters
$lastPage : int
Tags
since
3.5
Return values
static

setNextPage()

protected setNextPage(int $nextPage) : static
Parameters
$nextPage : int
Tags
since
3.5
Return values
static

setPreviousPage()

protected setPreviousPage(int $previousPage) : static
Parameters
$previousPage : int
Tags
since
3.5
Return values
static

setTotalItems()

protected setTotalItems(int $totalItems) : static
Parameters
$totalItems : int
Tags
since
3.5
Return values
static

Search results