/** * @inheritdoc */ protected function renderPageButtons() { $result = ''; $sortParam = Yii::$app->request->getQueryParam('sort'); $viewParam = Yii::$app->request->getQueryParam('view'); $result .= Html::beginForm(Url::toRoute(['favorites/index', 'sort' => $sortParam, 'view' => $viewParam]), 'get'); $input = Html::input('text', 'page', $this->pagination->getPage() + 1, ['class' => 'input-style']); $result .= Html::tag('div', "Page {$input} of {$this->pagination->pageCount}", ['class' => 'page-namber']); return $result .= Html::endForm(); }
/** * @inheritdoc */ protected function renderPageButtons() { $prevButtonHtml = ''; $nextButtonHtml = ''; $pageCount = $this->pagination->getPageCount(); if ($pageCount < 2 && $this->hideOnSinglePage) { return ''; } $buttons = []; $currentPage = $this->pagination->getPage(); // first page $firstPageLabel = $this->firstPageLabel === true ? '1' : $this->firstPageLabel; if ($firstPageLabel !== false && $currentPage > 1) { $buttons[] = $this->renderPageButton($firstPageLabel, 0, $this->firstPageCssClass, $currentPage <= 0, false) . $this->firstPagePostfix; } // prev page if ($this->prevPageLabel !== false) { if (($page = $currentPage - 1) < 0) { $page = 0; } $prevButtonHtml = Html::a($this->prevPageLabel, $this->pagination->createUrl($page), ['class' => $this->prevPageCssClass]); } // internal pages list($beginPage, $endPage) = $this->getPageRange(); for ($i = $beginPage; $i <= $endPage; ++$i) { $buttons[] = $this->renderPageButton($i + 1, $i, null, false, $i == $currentPage); } // next page if ($this->nextPageLabel !== false) { if (($page = $currentPage + 1) >= $pageCount - 1) { $page = $pageCount - 1; } $nextButtonHtml = Html::a($this->nextPageLabel, $this->pagination->createUrl($page), ['class' => $this->nextPageCssClass]); } // last page $lastPageLabel = $this->lastPageLabel === true ? $pageCount : $this->lastPageLabel; if ($lastPageLabel !== false && $page + 1 !== $pageCount) { $buttons[] = $this->firstPagePostfix . $this->renderPageButton($lastPageLabel, $pageCount - 1, $this->lastPageCssClass, $currentPage >= $pageCount - 1, false); } return $prevButtonHtml . Html::tag('ul', implode("\n", $buttons), $this->options) . $nextButtonHtml; }