Pager class
Framework\Pagination\Pager
Class Pager.
Implements:
JsonSerializable, Stringable
Defined in libraries/pagination/src/Pager.php
Properties #
- $currentPage
- -
- $previousPage
- -
- $nextPage
- -
- $lastPage
- -
- $itemsPerPage
- -
- $totalItems
- -
- $surround
- -
- $views
- -
- $defaultView
- -
- $url
- -
- $oldUrl
- -
- $query
- -
- $language
- -
$currentPage
protected int $currentPage
$previousPage
protected ?int $previousPage = NULL
$nextPage
protected ?int $nextPage = NULL
$lastPage
protected int $lastPage
$itemsPerPage
protected int $itemsPerPage
$totalItems
protected int $totalItems
$surround
protected int $surround = 2
$views
protected array $views = array (
'head' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/head.php',
'header' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/header.php',
'pager' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/pagination-short.php',
'pagination' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/pagination.php',
'pagination-short' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/pagination-short.php',
'bootstrap' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/bootstrap.php',
'bootstrap-short' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/bootstrap-short.php',
'bootstrap5' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/bootstrap.php',
'bootstrap5-short' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/bootstrap-short.php',
'bulma' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/bulma.php',
'bulma-short' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/bulma-short.php',
'bulma1' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/bulma.php',
'bulma1-short' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/bulma-short.php',
'foundation' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/foundation.php',
'foundation-short' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/foundation-short.php',
'foundation6' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/foundation.php',
'foundation6-short' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/foundation-short.php',
'materialize' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/materialize.php',
'materialize-short' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/materialize-short.php',
'materialize1' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/materialize.php',
'materialize1-short' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/materialize-short.php',
'primer' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/primer.php',
'primer-short' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/primer-short.php',
'primer20' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/primer.php',
'primer20-short' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/primer-short.php',
'semantic-ui' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/semantic-ui.php',
'semantic-ui-short' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/semantic-ui-short.php',
'semantic-ui2' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/semantic-ui.php',
'semantic-ui2-short' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/semantic-ui-short.php',
'tailwind' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/tailwind.php',
'tailwind-short' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/tailwind-short.php',
'tailwind3' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/tailwind.php',
'tailwind3-short' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/tailwind-short.php',
'w3' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/w3.php',
'w3-short' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/w3-short.php',
'w34' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/w3.php',
'w34-short' => 'D:\\WEBISTERS\\libraries\\pagination\\src/Views/w3-short.php',
)
$defaultView
protected string $defaultView = 'pagination'
$url
protected \Framework\HTTP\URL $url
$oldUrl
protected string $oldUrl
$query
protected string $query = 'page'
$language
protected \Framework\Language\Language $language
Methods #
- __construct()
- Pager constructor.
- __toString()
- -
- get()
- -
- getCurrentPage()
- -
- getCurrentPageUrl()
- -
- getDefaultView()
- -
- getFirstPage()
- -
- getFirstPageUrl()
- -
- getItemsPerPage()
- -
- getLanguage()
- -
- getLastPage()
- -
- getLastPageUrl()
- -
- getNextPage()
- -
- getNextPageUrl()
- -
- getNextPagesUrls()
- -
- getPageUrl()
- -
- getPreviousPage()
- -
- getPreviousPageUrl()
- -
- getPreviousPagesUrls()
- -
- getQuery()
- -
- getSurround()
- -
- getTotalItems()
- -
- getUrl()
- -
- getView()
- Get a view filepath.
- getViews()
- -
- getWithUrl()
- -
- jsonSerialize()
- -
- render()
- -
- renderShort()
- -
- sanitize()
- Sanitize a number.
- setAllowedQueries()
- -
- setDefaultView()
- -
- setLanguage()
- -
- setQuery()
- -
- setSurround()
- -
- setUrl()
- -
- setView()
- -
- prepareUrl()
- -
- setCurrentPage()
- -
- setItemsPerPage()
- -
- setLastPage()
- -
- setNextPage()
- -
- setPreviousPage()
- -
- setTotalItems()
- -
__construct()
public function __construct(string|int $currentPage, string|int $itemsPerPage, int $totalItems, ?\Framework\Language\Language $language = NULL, ?string $url = NULL)
Pager constructor.
Parameters
- string|int $currentPage
- string|int $itemsPerPage
- int $totalItems
- ?\Framework\Language\Language $language - Language instance
- ?string $url
__toString()
public function __toString(): string
Returns
string
get()
public function get(): array
Returns
array
getCurrentPage()
public function getCurrentPage(): int
Returns
int
getCurrentPageUrl()
public function getCurrentPageUrl(): string
Returns
string
getDefaultView()
public function getDefaultView(): string
Returns
string
getFirstPage()
public function getFirstPage(): int
Returns
int
getFirstPageUrl()
public function getFirstPageUrl(): string
Returns
string
getItemsPerPage()
public function getItemsPerPage(): int
Returns
int
getLanguage()
public function getLanguage(): \Framework\Language\Language
Returns
\Framework\Language\Language
getLastPage()
public function getLastPage(): int
Returns
int
getLastPageUrl()
public function getLastPageUrl(): string
Returns
string
getNextPage()
public function getNextPage(): ?int
Returns
?int
getNextPageUrl()
public function getNextPageUrl(): ?string
Returns
?string
getNextPagesUrls()
public function getNextPagesUrls(): array
Returns
array
getPageUrl()
public function getPageUrl(?int $page): ?string
Parameters
- ?int $page
Returns
?string
getPreviousPage()
public function getPreviousPage(): ?int
Returns
?int
getPreviousPageUrl()
public function getPreviousPageUrl(): ?string
Returns
?string
getPreviousPagesUrls()
public function getPreviousPagesUrls(): array
Returns
array
getQuery()
public function getQuery(): string
Returns
string
getSurround()
public function getSurround(): int
Returns
int
getTotalItems()
public function getTotalItems(): int
Returns
int
getUrl()
public function getUrl(): \Framework\HTTP\URL
Returns
\Framework\HTTP\URL
getView()
public function getView(string $name): string
Get a view filepath.
Parameters
- string $name - The view name. Default names are: head, header, pager and pagination
Returns
string
getViews()
public function getViews(): array
Returns
array
getWithUrl()
public function getWithUrl(): array
Returns
array
jsonSerialize()
public function jsonSerialize(): array
Returns
array
render()
public function render(?string $view = NULL): string
Parameters
- ?string $view
Returns
string
renderShort()
public function renderShort(): string
Returns
string
sanitize()
public static function sanitize(mixed $number): int
Sanitize a number.
Parameters
- mixed $number
Returns
int
setAllowedQueries()
public function setAllowedQueries(?array $allowed): static
Parameters
- ?array $allowed - List of queries, an empty array to allow only the default or null to allow all
Returns
static
setDefaultView()
public function setDefaultView(string $defaultView): static
Parameters
- string $defaultView
Returns
static
setLanguage()
public function setLanguage(?\Framework\Language\Language $language = NULL): static
Parameters
- ?\Framework\Language\Language $language
Returns
static
setQuery()
public function setQuery(string $query = 'page'): static
Parameters
- string $query
Returns
static
setSurround()
public function setSurround(int $surround): static
Parameters
- int $surround
Returns
static
setUrl()
public function setUrl(\Framework\HTTP\URL|string $currentPageUrl, ?array $allowedQueries = NULL): static
Parameters
- \Framework\HTTP\URL|string $currentPageUrl
- ?array $allowedQueries - List of queries, an empty array to allow only the default or null to allow all
Returns
static
setView()
public function setView(string $name, string $filepath): static
Parameters
- string $name
- string $filepath
Returns
static
prepareUrl()
protected function prepareUrl(): static
Returns
static
setCurrentPage()
protected function setCurrentPage(int $currentPage): static
Parameters
- int $currentPage
Returns
static
setItemsPerPage()
protected function setItemsPerPage(int $itemsPerPage): static
Parameters
- int $itemsPerPage
Returns
static
setLastPage()
protected function setLastPage(int $lastPage): static
Parameters
- int $lastPage
Returns
static
setNextPage()
protected function setNextPage(int $nextPage): static
Parameters
- int $nextPage
Returns
static
setPreviousPage()
protected function setPreviousPage(int $previousPage): static
Parameters
- int $previousPage
Returns
static
setTotalItems()
protected function setTotalItems(int $totalItems): static
Parameters
- int $totalItems
Returns
static