CPagination
| Package |
system.web |
| Inheritance |
class CPagination »
CComponent |
| Since |
1.0 |
| Version |
$Id: CPagination.php 562 2009-01-21 15:36:03Z qiang.xue $ |
CPagination represents information relevant to pagination.
When data needs to be rendered in multiple pages, we can use CPagination to
represent information such as
total item count,
page size,
current page, etc.
These information can be passed to
pagers to render
pagination buttons or links.
Public Properties
Hide inherited properties
| Property | Type | Description | Defined By |
| currentPage |
integer |
the zero-based index of the current page. |
CPagination |
| itemCount |
integer |
total number of items. |
CPagination |
| pageCount |
integer |
number of pages |
CPagination |
| pageSize |
integer |
number of items in each page. |
CPagination |
| pageVar |
string |
name of the GET variable storing the current page index. |
CPagination |
| route |
string |
the route (controller ID and action ID) for displaying the paged contents. |
CPagination |
Property Details
the zero-based index of the current page. Defaults to 0.
total number of items. Defaults to 0.
number of pages
number of items in each page. Defaults to 10.
public string $pageVar;
name of the GET variable storing the current page index. Defaults to 'page'.
public string $route;
the route (controller ID and action ID) for displaying the paged contents.
Defaults to empty string, meaning using the current route.
Method Details
|
public void __construct(integer $itemCount=0)
|
| $itemCount |
integer |
total number of items. |
Constructor.
|
|
| $criteria |
CDbCriteria |
the query criteria that should be applied with the limit |
Applies LIMIT and OFFSET to the specified query criteria.
public string createPageUrl( CController $controller, integer $page)
|
| $controller |
CController |
the controller that will create the actual URL |
| $page |
integer |
the page that the URL should point to. This is a zero-based index. |
| {return} |
string |
the created URL |
Creates the URL suitable for pagination.
This method is mainly called by pagers when creating URLs used to
perform pagination. The default implementation is to call
the controller's createUrl method with the page information.
You may override this method if your URL scheme is not the same as
the one supported by the controller's createUrl method.
|
public integer getCurrentPage(boolean $recalculate=true)
|
| $recalculate |
boolean |
whether to recalculate the current page based on the page size and item count. |
| {return} |
integer |
the zero-based index of the current page. Defaults to 0. |
|
public integer getItemCount()
|
| {return} |
integer |
total number of items. Defaults to 0. |
|
public integer getPageCount()
|
| {return} |
integer |
number of pages |
|
public integer getPageSize()
|
| {return} |
integer |
number of items in each page. Defaults to 10. |
|
public void setCurrentPage(integer $value)
|
| $value |
integer |
the zero-based index of the current page. |
|
public void setItemCount(integer $value)
|
| $value |
integer |
total number of items. |
|
public void setPageSize(integer $value)
|
| $value |
integer |
number of items in each page |