feat: paginator first_page and last_page

This commit is contained in:
Baoshuo Ren 2022-09-18 21:17:52 +08:00
parent 17a69b006c
commit bbe8110120
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

View File

@ -77,8 +77,10 @@ class Paginator {
} }
$html = '<ul class="pagination top-buffer-no bot-buffer-sm justify-content-center">'; $html = '<ul class="pagination top-buffer-no bot-buffer-sm justify-content-center">';
if ($this->cur_page > 1) { if ($this->cur_page > 1) {
$html .= '<li class="page-item"><a class="page-link" href="'.$this->getPageUri(1).'"><span class="glyphicon glyphicon glyphicon-fast-backward"></span></a></li>';
$html .= '<li class="page-item"><a class="page-link" href="'.$this->getPageUri($this->cur_page - 1).'"><span class="glyphicon glyphicon glyphicon-backward"></span></a></li>'; $html .= '<li class="page-item"><a class="page-link" href="'.$this->getPageUri($this->cur_page - 1).'"><span class="glyphicon glyphicon glyphicon-backward"></span></a></li>';
} else { } else {
$html .= '<li class="page-item disabled"><a class="page-link"><span class="glyphicon glyphicon glyphicon-fast-backward"></span></a></li>';
$html .= '<li class="page-item disabled"><a class="page-link"><span class="glyphicon glyphicon glyphicon-backward"></span></a></li>'; $html .= '<li class="page-item disabled"><a class="page-link"><span class="glyphicon glyphicon glyphicon-backward"></span></a></li>';
} }
@ -91,8 +93,10 @@ class Paginator {
} }
if ($this->cur_page < $this->n_pages) { if ($this->cur_page < $this->n_pages) {
$html .= '<li class="page-item"><a class="page-link" href="'.$this->getPageUri($this->cur_page + 1).'"><span class="glyphicon glyphicon glyphicon-forward"></span></a></li>'; $html .= '<li class="page-item"><a class="page-link" href="'.$this->getPageUri($this->cur_page + 1).'"><span class="glyphicon glyphicon glyphicon-forward"></span></a></li>';
$html .= '<li class="page-item"><a class="page-link" href="'.$this->getPageUri($this->n_pages).'"><span class="glyphicon glyphicon glyphicon-fast-forward"></span></a></li>';
} else { } else {
$html .= '<li class="page-item disabled"><a class="page-link"><span class="glyphicon glyphicon glyphicon-forward"></span></a></li>'; $html .= '<li class="page-item disabled"><a class="page-link"><span class="glyphicon glyphicon glyphicon-forward"></span></a></li>';
$html .= '<li class="page-item disabled"><a class="page-link"><span class="glyphicon glyphicon glyphicon-fast-forward"></span></a></li>';
} }
$html .= '</ul>'; $html .= '</ul>';
return $html; return $html;