20 private $_pageSize = 10;
23 private $_totalCount = 0;
24 private $_ignoreTotalCount =
false;
34 public function __construct($pageSize, $ignoreTotalCount=
false) {
35 $this->_pageSize = intval($pageSize);
36 $this->_ignoreTotalCount = $ignoreTotalCount;
44 $this->_totalCount = intval($totalCount);
52 return $this->_totalCount;
60 $this->_page = intval($page);
61 $this->_offset = ($page - 1) * $this->_pageSize;
77 return $this->_pageSize;
85 return ceil($this->_totalCount / $this->_pageSize);
93 $this->_offset = $offset;
94 $this->_page = ceil(intval($offset) / $this->_pageSize) + 1;
102 return $this->_offset;
110 return $this->_page == 1;
118 return $this->_page == $this->getPageCount;
126 return $this->_ignoreTotalCount;
setOffset($offset)
Set the current offset (also selects the page).
getOffset()
Get the current offset.
getPageSize()
Get the size of a pages.
Persistence layer related interfaces and classes.
setTotalCount($totalCount)
Set the number of list items.
PagingInfo contains information about a paged list.
isOnLastPage()
Determine if we are on the first page.
isIgnoringTotalCount()
Check if this instance iignores the total count.
__construct($pageSize, $ignoreTotalCount=false)
Creates a PagingInfo object.
getPage()
Get the current page (1-based).
getPageCount()
Get the number of pages.
getTotalCount()
Get the number of list items.
setPage($page)
Set the current page (1-based) (also sets the offset).
isOnFirstPage()
Determine if we are on the first page.