public function indexAction(Request $request) { //$paginationModel = new PaginationModel(); //$count = $paginationModel->getItemsPerPage(); $from = $request->get('page') ? BOOKS_PER_PAGE * $request->get('page') - BOOKS_PER_PAGE : 0; $bookModel = new BookModel(); $books = $bookModel->getList($from, BOOKS_PER_PAGE); $args = array('books' => $books); return $this->render('index', $args); }
/** * действие для отображения списка книг - Books * * @param Request $request * @return int */ public function indexAction(Request $request) { $bookModel = new BookModel(); $page = $request->get('page'); $count = $bookModel->getBooksCount(); $books = $bookModel->getList($page); $pagination = new Pagination(array('itemsCount' => $count, 'itemsPerPage' => BookModel::BOOKS_PER_PAGE, 'currentPage' => $page)); $args = array('books' => $books, 'pagination' => $pagination); return $this->render('index', $args); }