parent
fea68aee27
commit
2401727a20
1 changed files with 49 additions and 0 deletions
|
@ -141,6 +141,55 @@ class Paginator {
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function numberedPageHTML() {
|
||||||
|
global $L;
|
||||||
|
$maxDistance = 2;
|
||||||
|
|
||||||
|
if (self::get('numberOfPages') <= 1) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
$html = '<div id="paginator">';
|
||||||
|
$html .= '<ul>';
|
||||||
|
|
||||||
|
if(self::get('showPrev'))
|
||||||
|
{
|
||||||
|
$html .= '<li class="left">';
|
||||||
|
$html .= '<a aria-label="'.$L->g('Previous page').'" href="'.self::previousPageUrl().'">←</a>';
|
||||||
|
$html .= '</li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
for ($i=1; $i <= self::get('numberOfPages'); $i++) {
|
||||||
|
if ($i <= 1 || $i >= self::get('numberOfPages') || abs($i - self::currentPage()) < $maxDistance) {
|
||||||
|
if ($i == self::currentPage()) {
|
||||||
|
$html .= '<li class="pagination-page">';
|
||||||
|
$html .= '<span class="current-page">'.($i).'</span>';
|
||||||
|
$html .= '</li>';
|
||||||
|
} else {
|
||||||
|
$html .= '<li class="pagination-page">';
|
||||||
|
$html .= '<a href="'.self::numberUrl($i).'">'.($i).'</a>';
|
||||||
|
$html .= '</li>';
|
||||||
|
}
|
||||||
|
} elseif (abs($i - self::currentPage()) == $maxDistance) {
|
||||||
|
$html .= '<li class="pagination-page">';
|
||||||
|
$html .= '<span>…</span>';
|
||||||
|
$html .= '</li>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(self::get('showNext'))
|
||||||
|
{
|
||||||
|
$html .= '<li class="left">';
|
||||||
|
$html .= '<a aria-label="'.$L->g('Next page').'" href="'.self::nextPageUrl().'">→</a>';
|
||||||
|
$html .= '</li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$html .= '</ul>';
|
||||||
|
$html .= '</div>';
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Bootstrap Pagination
|
* Bootstrap Pagination
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue