Zepi/Web/UserInterface/src/Renderer/Pagination.php
public function prepare(DataRequest $dataRequest, $paginationUrl, $numberOfEntries, $numberOfEntriesPerPage = 10)
    {
        $this->paginationUrl = $paginationUrl;
        $neededPages = ceil($numberOfEntries / $numberOfEntriesPerPage);
        $activePage = $dataRequest->getPage();

        $pagination = new PaginationObject();
        
        if ($activePage > 1) {
            // Add the first page button
            $button = new Button('&laquo;', $this->buildUrl(1));
            $pagination->addEntry($button); 
            
            
            // Add the prev page button
            $button = new Button('&lsaquo;', $this->buildUrl(($activePage - 1)));
            $pagination->addEntry($button);
        }
        
        $this->addPages($pagination, $activePage, $neededPages);
        
        if ($activePage < $neededPages) {
            // Add the next page button
            $button = new Button('&rsaquo;', $this->buildUrl(($activePage + 1)));
            $pagination->addEntry($button);
            
            // Add the last page button
            $button = new Button('&raquo;', $this->buildUrl($neededPages));
            $pagination->addEntry($button);
        }
        
        return $pagination;
    }
public function prepare(DataRequest $dataRequest, $paginationUrl, $numberOfEntries, $numberOfEntriesPerPage = 10)
    {
        $this->paginationUrl = $paginationUrl;
        $neededPages = ceil($numberOfEntries / $numberOfEntriesPerPage);
        $activePage = $dataRequest->getPage();

        $pagination = new PaginationObject();
        
        if ($activePage > 1) {
            // Add the first page button
            $button = new Button('&laquo;', $this->buildUrl(1));
            $pagination->addEntry($button); 
            
            
            // Add the prev page button
            $button = new Button('&lsaquo;', $this->buildUrl(($activePage - 1)));
            $pagination->addEntry($button);
        }
        
        $this->addPages($pagination, $activePage, $neededPages);
        
        if ($activePage < $neededPages) {
            // Add the next page button
            $button = new Button('&rsaquo;', $this->buildUrl(($activePage + 1)));
            $pagination->addEntry($button);
            
            // Add the last page button
            $button = new Button('&raquo;', $this->buildUrl($neededPages));
            $pagination->addEntry($button);
        }
        
        return $pagination;
    }
public function prepare ( DataRequest $ dataRequest , $ paginationUrl , $ numberOfEntries , $ numberOfEntriesPerPage = 10 ) { $ this -> paginationUrl = $ paginationUrl ; $ neededPages = ceil ( $ numberOfEntries / $ numberOfEntriesPerPage ) ; $ activePage = $ dataRequest -> getPage ( ) ; $ pagination = new PaginationObject ( ) ; if ( $ activePage > 1 ) { // Add the first page button $ button = new Button ( '&laquo;' , $ this -> buildUrl ( 1 ) ) ; $ pagination -> addEntry ( $ button ) ; // Add the prev page button $ button = new Button ( '&lsaquo;' , $ this -> buildUrl ( ( $ activePage - 1 ) ) ) ; $ pagination -> addEntry ( $ button ) ; } $ this -> addPages ( $ pagination , $ activePage , $ neededPages ) ; if ( $ activePage < $ neededPages ) { // Add the next page button $ button = new Button ( '&rsaquo;' , $ this -> buildUrl ( ( $ activePage + 1 ) ) ) ; $ pagination -> addEntry ( $ button ) ; // Add the last page button $ button = new Button ( '&raquo;' , $ this -> buildUrl ( $ neededPages ) ) ; $ pagination -> addEntry ( $ button ) ; } return $ pagination ; }
Prepares the Pagination object for the given DataRequest and number of entries per page

@access public
@param \Zepi\DataSource\Core\Entity\DataRequest $dataRequest
@param string $paginationUrl
@param integer $numberOfEntries
@param integer $numberOfEntriesPerPage
@return \Zepi\Web\UserInterface\Pagination\Pagination
Prepares the Pagination object for the given DataRequest and number of entries per page