khanat-opennel-code/code/ryzom/tools/server/ryzom_ams_docs/html/classPagination.html

369 lines
18 KiB
HTML
Raw Normal View History

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Ryzom Account Management System: Pagination Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname">Ryzom Account Management System
&#160;<span id="projectnumber">1.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
<li class="current"><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
<li><a href="classes.html"><span>Data&#160;Structure&#160;Index</span></a></li>
<li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Data&#160;Fields</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pri-attribs">Private Attributes</a> </div>
<div class="headertitle">
<div class="title">Pagination Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<!-- doxytag: class="Pagination" -->
<p>Handles returning arrays based on a given pagenumber.
<a href="classPagination.html#details">More...</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPagination.html#a2a1aecb8f526796b3d62e8278edc07c3">__construct</a> ($query, $db, $nrDisplayed, $resultClass, $params=array())</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor. <a href="#a2a1aecb8f526796b3d62e8278edc07c3"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPagination.html#a9316ede6960667d832997c8e20223623">getLast</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">return the number of the 'last' object attribute <a href="#a9316ede6960667d832997c8e20223623"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPagination.html#ad926899d7cac34a3f1a90e552d8eb27d">getCurrent</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">return the number of the 'current' object attribute <a href="#ad926899d7cac34a3f1a90e552d8eb27d"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPagination.html#a97a3a3e912139aa222a7ca13fdb27d33">getElements</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">return the elements array of the object <a href="#a97a3a3e912139aa222a7ca13fdb27d33"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPagination.html#ae43f78382809e3cd2aaa3c455cb0b2b4">getAmountOfRows</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">return total amount of rows for the original query <a href="#ae43f78382809e3cd2aaa3c455cb0b2b4"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPagination.html#aeecf550e63b55ecd5d737ecc46e07d3a">getLinks</a> ($nrOfLinks)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">return the page links. <a href="#aeecf550e63b55ecd5d737ecc46e07d3a"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pri-attribs"></a>
Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPagination.html#a8fa0f6a15481ba69e7be913eaa15594c">$element_array</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Array containing the elements that are extracted for that specific page number. <a href="#a8fa0f6a15481ba69e7be913eaa15594c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPagination.html#acf48db609a946d13953d8060363fd1d3">$last</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The last page number. <a href="#acf48db609a946d13953d8060363fd1d3"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPagination.html#a2c4c58e377f6c66ca38c8ea97666fc5e">$current</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The current page number (read from $_GET['pagenum']) <a href="#a2c4c58e377f6c66ca38c8ea97666fc5e"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPagination.html#a6b5c716eec440d8dc5b9754c53c545ec">$amountOfRows</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Total amount of rows that a query would return (if no limits would be used) <a href="#a6b5c716eec440d8dc5b9754c53c545ec"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Handles returning arrays based on a given pagenumber. </p>
<p>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. </p>
<dl class="author"><dt><b>Author:</b></dt><dd>Daan Janssens, mentored by Matthew Lagoe </dd></dl>
</div><hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a2a1aecb8f526796b3d62e8278edc07c3"></a><!-- doxytag: member="Pagination::__construct" ref="a2a1aecb8f526796b3d62e8278edc07c3" args="($query, $db, $nrDisplayed, $resultClass, $params=array())" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classPagination.html#a2a1aecb8f526796b3d62e8278edc07c3">__construct</a> </td>
<td>(</td>
<td class="paramtype">$&#160;</td>
<td class="paramname"><em>query</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">$&#160;</td>
<td class="paramname"><em>db</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">$&#160;</td>
<td class="paramname"><em>nrDisplayed</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">$&#160;</td>
<td class="paramname"><em>resultClass</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">$&#160;</td>
<td class="paramname"><em>params</em> = <code>array()</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Constructor. </p>
<p>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. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramname">$query</td><td>the query to be paginated </td></tr>
<tr><td class="paramname">$db</td><td>the db on which the query should be performed </td></tr>
<tr><td class="paramname">$nrDisplayed</td><td>the amount of elements that should be displayed /page </td></tr>
<tr><td class="paramname">$resultClass</td><td>the elements that should be returned should be of that specific class. </td></tr>
<tr><td class="paramname">$params</td><td>the parameters used by the query (optional) </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="ae43f78382809e3cd2aaa3c455cb0b2b4"></a><!-- doxytag: member="Pagination::getAmountOfRows" ref="ae43f78382809e3cd2aaa3c455cb0b2b4" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classPagination.html#ae43f78382809e3cd2aaa3c455cb0b2b4">getAmountOfRows</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>return total amount of rows for the original query </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>the total amount of rows for the original query </dd></dl>
</div>
</div>
<a class="anchor" id="ad926899d7cac34a3f1a90e552d8eb27d"></a><!-- doxytag: member="Pagination::getCurrent" ref="ad926899d7cac34a3f1a90e552d8eb27d" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classPagination.html#ad926899d7cac34a3f1a90e552d8eb27d">getCurrent</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>return the number of the 'current' object attribute </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>the number of the current page </dd></dl>
</div>
</div>
<a class="anchor" id="a97a3a3e912139aa222a7ca13fdb27d33"></a><!-- doxytag: member="Pagination::getElements" ref="a97a3a3e912139aa222a7ca13fdb27d33" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classPagination.html#a97a3a3e912139aa222a7ca13fdb27d33">getElements</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>return the elements array of the object </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>the elements of a specific page (these are instantiations of the class passed as parameter ($resultClass) to the constructor) </dd></dl>
</div>
</div>
<a class="anchor" id="a9316ede6960667d832997c8e20223623"></a><!-- doxytag: member="Pagination::getLast" ref="a9316ede6960667d832997c8e20223623" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classPagination.html#a9316ede6960667d832997c8e20223623">getLast</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>return the number of the 'last' object attribute </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>the number of the last page </dd></dl>
</div>
</div>
<a class="anchor" id="aeecf550e63b55ecd5d737ecc46e07d3a"></a><!-- doxytag: member="Pagination::getLinks" ref="aeecf550e63b55ecd5d737ecc46e07d3a" args="($nrOfLinks)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classPagination.html#aeecf550e63b55ecd5d737ecc46e07d3a">getLinks</a> </td>
<td>(</td>
<td class="paramtype">$&#160;</td>
<td class="paramname"><em>nrOfLinks</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>return the page links. </p>
<p>(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) </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>an array of integerswhich refer to the clickable pagenumbers for browsing other pages. </dd></dl>
</div>
</div>
<hr/><h2>Field Documentation</h2>
<a class="anchor" id="a6b5c716eec440d8dc5b9754c53c545ec"></a><!-- doxytag: member="Pagination::$amountOfRows" ref="a6b5c716eec440d8dc5b9754c53c545ec" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">$amountOfRows<code> [private]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Total amount of rows that a query would return (if no limits would be used) </p>
</div>
</div>
<a class="anchor" id="a2c4c58e377f6c66ca38c8ea97666fc5e"></a><!-- doxytag: member="Pagination::$current" ref="a2c4c58e377f6c66ca38c8ea97666fc5e" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">$current<code> [private]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The current page number (read from $_GET['pagenum']) </p>
</div>
</div>
<a class="anchor" id="a8fa0f6a15481ba69e7be913eaa15594c"></a><!-- doxytag: member="Pagination::$element_array" ref="a8fa0f6a15481ba69e7be913eaa15594c" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">$element_array<code> [private]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Array containing the elements that are extracted for that specific page number. </p>
</div>
</div>
<a class="anchor" id="acf48db609a946d13953d8060363fd1d3"></a><!-- doxytag: member="Pagination::$last" ref="acf48db609a946d13953d8060363fd1d3" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">$last<code> [private]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The last page number. </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>/home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/<a class="el" href="pagination_8php.html">pagination.php</a></li>
</ul>
</div><!-- contents -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<hr class="footer"/><address class="footer"><small>
Generated on Sat Sep 14 2013 00:33:45 for Ryzom Account Management System by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
</body>
</html>