src/articles/classes/Controller/Client/Content.php
private function actionIndex()
    {
        /** @var Articles_Entity_Table_Article $table */
        $perPage = $this->getPlugin()->settings['itemsPerPage'];
        $table = ORM::getTable($this->getPlugin(), 'Article');
        $totalPageCount = ceil($table->countInSection($this->getPage()->id) / $perPage);
        if (0 == $totalPageCount)
        {
            $totalPageCount = 1;
        }

        if (0 == $this->getPage()->subpage)
        {
            $this->getPage()->subpage = 1;
        }
        if ($this->getPage()->subpage > $totalPageCount)
        {
            throw new Eresus_CMS_Exception_NotFound;
        }

        $articles = $table->findInSection($this->getPage()->id, $perPage,
            ($this->getPage()->subpage - 1) * $perPage);
        if (count($articles) && $totalPageCount > 1)
        {
            $pager = new PaginationHelper($totalPageCount, $this->getPage()->subpage);
        }
        else
        {
            $pager = null;
        }

        $vars = array(
            'settings' => $this->getPlugin()->settings,
            'page' => $this->getPage(),
            'articles' => $articles,
            'pager' => $pager
        );

        $tmpl = $this->getPlugin()->templates()->client('List.html');
        $html = $tmpl->compile($vars);

        return $html;
    }
private function actionIndex()
    {
        /** @var Articles_Entity_Table_Article $table */
        $perPage = $this->getPlugin()->settings['itemsPerPage'];
        $table = ORM::getTable($this->getPlugin(), 'Article');
        $totalPageCount = ceil($table->countInSection($this->getPage()->id) / $perPage);
        if (0 == $totalPageCount)
        {
            $totalPageCount = 1;
        }

        if (0 == $this->getPage()->subpage)
        {
            $this->getPage()->subpage = 1;
        }
        if ($this->getPage()->subpage > $totalPageCount)
        {
            throw new Eresus_CMS_Exception_NotFound;
        }

        $articles = $table->findInSection($this->getPage()->id, $perPage,
            ($this->getPage()->subpage - 1) * $perPage);
        if (count($articles) && $totalPageCount > 1)
        {
            $pager = new PaginationHelper($totalPageCount, $this->getPage()->subpage);
        }
        else
        {
            $pager = null;
        }

        $vars = array(
            'settings' => $this->getPlugin()->settings,
            'page' => $this->getPage(),
            'articles' => $articles,
            'pager' => $pager
        );

        $tmpl = $this->getPlugin()->templates()->client('List.html');
        $html = $tmpl->compile($vars);

        return $html;
    }
private function actionIndex ( ) { /** @var Articles_Entity_Table_Article $table */ $ perPage = $ this -> getPlugin ( ) -> settings [ 'itemsPerPage' ] ; $ table = ORM :: getTable ( $ this -> getPlugin ( ) , 'Article' ) ; $ totalPageCount = ceil ( $ table -> countInSection ( $ this -> getPage ( ) -> id ) / $ perPage ) ; if ( 0 == $ totalPageCount ) { $ totalPageCount = 1 ; } if ( 0 == $ this -> getPage ( ) -> subpage ) { $ this -> getPage ( ) -> subpage = 1 ; } if ( $ this -> getPage ( ) -> subpage > $ totalPageCount ) { throw new Eresus_CMS_Exception_NotFound ; } $ articles = $ table -> findInSection ( $ this -> getPage ( ) -> id , $ perPage , ( $ this -> getPage ( ) -> subpage - 1 ) * $ perPage ) ; if ( count ( $ articles ) && $ totalPageCount > 1 ) { $ pager = new PaginationHelper ( $ totalPageCount , $ this -> getPage ( ) -> subpage ) ; } else { $ pager = null ; } $ vars = array ( 'settings' => $ this -> getPlugin ( ) -> settings , 'page' => $ this -> getPage ( ) , 'articles' => $ articles , 'pager' => $ pager ) ; $ tmpl = $ this -> getPlugin ( ) -> templates ( ) -> client ( 'List.html' ) ; $ html = $ tmpl -> compile ( $ vars ) ; return $ html ; }
Отрисовка списка статей

@throws Eresus_CMS_Exception_NotFound

@return string

@since 3.01
Отрисовка списка статей