AdminPageNavigation extends PageNavigation
Class PageNavigation
This class helps to calculate limits for DB queries and other data sources to organize page navigation through results.
Examples of supported URLs: /page.php?nav-cars=page-5&nav-books=page-2&other=params /page.php?nav-cars=page-5-size-20&nav-books=page-2 /page.php?nav-cars=page-all&nav-books=page-2 /page/nav-cars/page-2/size-20/something/ /page/nav-cars/page-all/something/?other=params /page/nav-cars/page-5/nav-books/page-2/size-10
Table of Contents
Methods
- __construct() : mixed
- addParams() : Uri
- Returns an URI with navigation parameters compatible with initFromUri().
- allowAllRecords() : $this
- allRecordsAllowed() : bool
- Returns true if showing all records is allowed.
- allRecordsShown() : bool
- Returns true if all the records are shown in one page.
- clearParams() : Uri
- Clears an URI from navigation parameters and returns it.
- getCurrentPage() : int
- Returns the current page number.
- getId() : string
- Returns navigation ID.
- getLimit() : int
- Returns the number of records in the current page.
- getOffset() : int
- Returns offset of the first record of the current page.
- getPageCount() : int
- Returns number of pages or 0 if recordCount is not set.
- getPageSize() : int
- Returns "formal" page size.
- getPageSizes() : array<string|int, mixed>
- Returns allowed page sizes.
- getRecordCount() : int|null
- Returns number of records.
- initFromUri() : void
- Initializes the navigation from URI.
- setCurrentPage() : $this
- setPageSize() : $this
- setPageSizes() : $this
- This controls which sizes are available via user interface.
- setRecordCount() : $this
Methods
__construct()
public
__construct(string $id) : mixed
Parameters
- $id : string
-
Navigation identity like "nav-cars".
addParams()
Returns an URI with navigation parameters compatible with initFromUri().
public
addParams(Uri $uri, bool $sef, string $page[, string $size = null ]) : Uri
Parameters
- $uri : Uri
- $sef : bool
-
SEF mode.
- $page : string
-
Page number.
- $size : string = null
-
Page size.
Return values
UriallowAllRecords()
public
allowAllRecords(bool $mode) : $this
Parameters
- $mode : bool
-
Allows to show all records, yes or no.
Return values
$thisallRecordsAllowed()
Returns true if showing all records is allowed.
public
allRecordsAllowed() : bool
Return values
boolallRecordsShown()
Returns true if all the records are shown in one page.
public
allRecordsShown() : bool
Return values
boolclearParams()
Clears an URI from navigation parameters and returns it.
public
clearParams(Uri $uri, bool $sef) : Uri
Parameters
- $uri : Uri
- $sef : bool
-
SEF mode.
Return values
UrigetCurrentPage()
Returns the current page number.
public
getCurrentPage() : int
Return values
intgetId()
Returns navigation ID.
public
getId() : string
Return values
stringgetLimit()
Returns the number of records in the current page.
public
getLimit() : int
Return values
intgetOffset()
Returns offset of the first record of the current page.
public
getOffset() : int
Return values
intgetPageCount()
Returns number of pages or 0 if recordCount is not set.
public
getPageCount() : int
Return values
intgetPageSize()
Returns "formal" page size.
public
getPageSize() : int
Return values
intgetPageSizes()
Returns allowed page sizes.
public
getPageSizes() : array<string|int, mixed>
Return values
array<string|int, mixed>getRecordCount()
Returns number of records.
public
getRecordCount() : int|null
Return values
int|nullinitFromUri()
Initializes the navigation from URI.
public
initFromUri() : void
setCurrentPage()
public
setCurrentPage(int $n) : $this
Parameters
- $n : int
-
The current page number.
Return values
$thissetPageSize()
public
setPageSize(int $n) : $this
Parameters
- $n : int
-
Page size.
Return values
$thissetPageSizes()
This controls which sizes are available via user interface.
public
setPageSizes(array<string|int, mixed> $sizes) : $this
Parameters
- $sizes : array<string|int, mixed>
-
Array of integers.
Return values
$thissetRecordCount()
public
setRecordCount(int $n) : $this
Parameters
- $n : int
-
Number of records (to calculate number of pages).