Ryzom Account Management System
1.0
|
Handles returning arrays based on a given pagenumber. More...
Public Member Functions | |
__construct ($query, $db, $nrDisplayed, $resultClass, $params=array()) | |
Constructor. | |
getLast () | |
return the number of the 'last' object attribute | |
getCurrent () | |
return the number of the 'current' object attribute | |
getElements () | |
return the elements array of the object | |
getAmountOfRows () | |
return total amount of rows for the original query | |
getLinks ($nrOfLinks) | |
return the page links. | |
Private Attributes | |
$element_array | |
Array containing the elements that are extracted for that specific page number. | |
$last | |
The last page number. | |
$current | |
The current page number (read from $_GET['pagenum']) | |
$amountOfRows | |
Total amount of rows that a query would return (if no limits would be used) |
Handles returning arrays based on a given pagenumber.
By specifing a $_GET['pagenum'] or if not(page = 1 will be used) a few elements from a specific query will be returned. Not all elements have to be loaded into objects, only the elements needed for that specific page, this is a good thing performance wise. This is done by passign the query to the constructor and specifying how many you want to display.
__construct | ( | $ | query, |
$ | db, | ||
$ | nrDisplayed, | ||
$ | resultClass, | ||
$ | params = array() |
||
) |
Constructor.
will fetch the correct elements that match to a specific page (specified by the $_GET['pagenum'] variable). The query has to be passed as a string to the function that way it will only load the specific elements that are related to the pagenumber. The $params, parameter is optional and is used to pass the parameters for the query. The result class will be used to instantiate the found elements with, their set() function will be called. The class its getters can be later used to get the info out of the object.
$query | the query to be paginated |
$db | the db on which the query should be performed |
$nrDisplayed | the amount of elements that should be displayed /page |
$resultClass | the elements that should be returned should be of that specific class. |
$params | the parameters used by the query (optional) |
getAmountOfRows | ( | ) |
return total amount of rows for the original query
getCurrent | ( | ) |
return the number of the 'current' object attribute
getElements | ( | ) |
return the elements array of the object
getLast | ( | ) |
return the number of the 'last' object attribute
getLinks | ( | $ | nrOfLinks | ) |
return the page links.
(for browsing the pages, placed under a table for example) the $nrOfLinks parameter specifies the amount of links you want to return. it will show the links closest to the current page on both sides (in case one side can't show more, it will show more on the other side)
$amountOfRows [private] |
Total amount of rows that a query would return (if no limits would be used)
$current [private] |
The current page number (read from $_GET['pagenum'])
$element_array [private] |
Array containing the elements that are extracted for that specific page number.
$last [private] |
The last page number.