public function postBuildView(DataSourceEvent\ViewEventArgs $event)
    {
        $datasource = $event->getDataSource();
        $datasourceName = $datasource->getName();
        $view = $event->getView();
        $parameters = $view->getParameters();
        $maxresults = $datasource->getMaxResults();

        if ($maxresults == 0) {
            $all = 1;
            $page = 1;
        } else {
            $all = (int) ceil(count($datasource->getResult())/$maxresults);
            $current = $datasource->getFirstResult();
            $page = (int) floor($current/$maxresults) + 1;
        }

        unset($parameters[$datasourceName][PaginationExtension::PARAMETER_PAGE]);
        $pages = [];

        for ($i = 1; $i <= $all; $i++) {
            if ($i > 1) {
                $parameters[$datasourceName][PaginationExtension::PARAMETER_PAGE] = $i;
            }

            $pages[$i] = $parameters;
        }

        $view->setAttribute('max_results', $maxresults);
        $view->setAttribute('page', $page);
        $view->setAttribute('parameters_pages', $pages);
    }
public function postBuildView(DataSourceEvent\ViewEventArgs $event)
    {
        $datasource = $event->getDataSource();
        $datasourceName = $datasource->getName();
        $view = $event->getView();
        $parameters = $view->getParameters();
        $maxresults = $datasource->getMaxResults();

        if ($maxresults == 0) {
            $all = 1;
            $page = 1;
        } else {
            $all = (int) ceil(count($datasource->getResult())/$maxresults);
            $current = $datasource->getFirstResult();
            $page = (int) floor($current/$maxresults) + 1;
        }

        unset($parameters[$datasourceName][PaginationExtension::PARAMETER_PAGE]);
        $pages = [];

        for ($i = 1; $i <= $all; $i++) {
            if ($i > 1) {
                $parameters[$datasourceName][PaginationExtension::PARAMETER_PAGE] = $i;
            }

            $pages[$i] = $parameters;
        }

        $view->setAttribute('max_results', $maxresults);
        $view->setAttribute('page', $page);
        $view->setAttribute('parameters_pages', $pages);
    }
public function postBuildView ( DataSourceEvent \ ViewEventArgs $ event ) { $ datasource = $ event -> getDataSource ( ) ; $ datasourceName = $ datasource -> getName ( ) ; $ view = $ event -> getView ( ) ; $ parameters = $ view -> getParameters ( ) ; $ maxresults = $ datasource -> getMaxResults ( ) ; if ( $ maxresults == 0 ) { $ all = 1 ; $ page = 1 ; } else { $ all = ( int ) ceil ( count ( $ datasource -> getResult ( ) ) / $ maxresults ) ; $ current = $ datasource -> getFirstResult ( ) ; $ page = ( int ) floor ( $ current / $ maxresults ) + 1 ; } unset ( $ parameters [ $ datasourceName ] [ PaginationExtension :: PARAMETER_PAGE ] ) ; $ pages = [ ] ; for ( $ i = 1 ; $ i <= $ all ; $ i ++ ) { if ( $ i > 1 ) { $ parameters [ $ datasourceName ] [ PaginationExtension :: PARAMETER_PAGE ] = $ i ; } $ pages [ $ i ] = $ parameters ; } $ view -> setAttribute ( 'max_results' , $ maxresults ) ; $ view -> setAttribute ( 'page' , $ page ) ; $ view -> setAttribute ( 'parameters_pages' , $ pages ) ; }
Method called at PostBuildView event.

@param \FSi\Component\DataSource\Event\DataSourceEvent\ViewEventArgs $event
Method called at PostBuildView event .