Documentation

ResultsPage
in package
implements JsonSerializable

Represents a Page of DataRepository results

Tags
author

Jason Savell jsavell@library.tamu.edu

Table of Contents

Interfaces

JsonSerializable

Properties

$page  : int
$pageCount  : int
$pageResults  : array<string|int, mixed>
$resultsPerPage  : int

Methods

getNewResultsPage()  : ResultsPage
Creates a new ResultsPage
getPage()  : int
Get the page number of this ResultsPage
getPageCount()  : int
Get the total number of pages for this results set
getPageResults()  : array<string|int, mixed>
Get the results
getResultsPerPage()  : int
Get the results per page for this ResultsPage
jsonSerialize()  : mixed
setPage()  : void
Set the page number
setPageResults()  : void
Set the page results
setResultsPerPage()  : void
Set the number of results per page
__construct()  : mixed
calculatePageCount()  : void
Calculate and set the page count based on a results count
setPageCount()  : void
Set the page count

Properties

$page

private int $page = 1

The page number represented by this ResultsPage

$pageCount

private int $pageCount

The total number of pages in this result

$pageResults

private array<string|int, mixed> $pageResults

A two dimensional array representing the resulting rows: array(array("id"=>1,"field"=>"value1"),array("id"=>2","field"=>"value2"))

$resultsPerPage

private int $resultsPerPage = 25

The number of results included per page

Methods

getNewResultsPage()

Creates a new ResultsPage

public static getNewResultsPage(int $page, int $resultsPerPage) : ResultsPage

@param int $page The desired page number of the results

Parameters
$page : int
$resultsPerPage : int

The number of results to include per page

Return values
ResultsPage

A new ResultsPage, ready to be populated with results

getPage()

Get the page number of this ResultsPage

public getPage() : int
Return values
int

The page number

getPageCount()

Get the total number of pages for this results set

public getPageCount() : int
Return values
int

The total number of pages

getPageResults()

Get the results

public getPageResults() : array<string|int, mixed>
Return values
array<string|int, mixed>

A two dimensional array representing the resulting rows: array(array("id"=>1,"field"=>"value1"),array("id"=>2","field"=>"value2"))

getResultsPerPage()

Get the results per page for this ResultsPage

public getResultsPerPage() : int
Return values
int

The page number

setPage()

Set the page number

public setPage(int $page) : void
Parameters
$page : int

The page number

setPageResults()

Set the page results

public setPageResults(array<string|int, mixed> $results, int $resultsCount) : void
Parameters
$results : array<string|int, mixed>
$resultsCount : int

setResultsPerPage()

Set the number of results per page

public setResultsPerPage(int $resultsPerPage) : void
Parameters
$resultsPerPage : int

calculatePageCount()

Calculate and set the page count based on a results count

protected calculatePageCount(int $resultsCount) : void
Parameters
$resultsCount : int

setPageCount()

Set the page count

private setPageCount(int $pageCount) : void
Parameters
$pageCount : int

        
On this page

Search results