Esempio n. 1
0
 /**
  * Creates the page collection.
  *
  * @param  string $scrollingStyle Scrolling style
  * @return stdClass
  */
 protected function _createPages($scrollingStyle = null)
 {
     $this->getCurrentItems();
     // after loading the items, we can call the adapter to get the total count
     $this->_pageCount = $this->_calculatePageCount();
     /*
      * reproduce the original paginator behavior, for example:
      * if we have a total of 2 pages, but the user requested page number 3, the original paginator will return the last page (number 2).
      * 
      * this is needed bacause the previous request for getCurrentItems was made when we didn't know the total pages count. 
      * when page number is not normalized, we should get the items again.
      */
     $normalizedPageNumber = $this->normalizePageNumber($this->_currentPageNumber);
     if ($normalizedPageNumber != $this->_currentPageNumber) {
         $this->_currentItems = null;
         $this->getCurrentItems();
         $this->_pageCount = $this->_calculatePageCount();
     }
     return parent::_createPages($scrollingStyle);
 }