mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 08:22:07 +02:00
MDL-62347 course: move boost pagination renderer in core
This commit is contained in:
parent
c8d5001f9a
commit
f3df9f9f62
@ -3006,41 +3006,15 @@ EOD;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal implementation of paging bar rendering.
|
||||
* Returns HTML to display the paging bar.
|
||||
*
|
||||
* @param paging_bar $pagingbar
|
||||
* @return string
|
||||
* @param paging_bar $pagingbar.
|
||||
* @return string the HTML to output.
|
||||
*/
|
||||
protected function render_paging_bar(paging_bar $pagingbar) {
|
||||
$output = '';
|
||||
$pagingbar = clone($pagingbar);
|
||||
$pagingbar->prepare($this, $this->page, $this->target);
|
||||
|
||||
if ($pagingbar->totalcount > $pagingbar->perpage) {
|
||||
$output .= get_string('page') . ':';
|
||||
|
||||
if (!empty($pagingbar->previouslink)) {
|
||||
$output .= ' (' . $pagingbar->previouslink . ') ';
|
||||
}
|
||||
|
||||
if (!empty($pagingbar->firstlink)) {
|
||||
$output .= ' ' . $pagingbar->firstlink . ' ...';
|
||||
}
|
||||
|
||||
foreach ($pagingbar->pagelinks as $link) {
|
||||
$output .= " $link";
|
||||
}
|
||||
|
||||
if (!empty($pagingbar->lastlink)) {
|
||||
$output .= ' ... ' . $pagingbar->lastlink . ' ';
|
||||
}
|
||||
|
||||
if (!empty($pagingbar->nextlink)) {
|
||||
$output .= ' (' . $pagingbar->nextlink . ')';
|
||||
}
|
||||
}
|
||||
|
||||
return html_writer::tag('div', $output, array('class' => 'paging'));
|
||||
// Any more than 10 is not usable and causes weird wrapping of the pagination.
|
||||
$pagingbar->maxdisplay = 10;
|
||||
return $this->render_from_template('core/paging_bar', $pagingbar->export_for_template($this));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,6 @@
|
||||
{{#haspages}}
|
||||
<nav aria-label="{{label}}">
|
||||
<ul class="pagination mt-3">
|
||||
<nav aria-label="{{label}}" class="pagination pagination-centered justify-content-center">
|
||||
<ul class="m-t-1 pagination ">
|
||||
{{#previous}}
|
||||
<li class="page-item">
|
||||
<a href="{{url}}" class="page-link">
|
@ -31,7 +31,6 @@ use preferences_groups;
|
||||
use action_menu;
|
||||
use help_icon;
|
||||
use single_button;
|
||||
use paging_bar;
|
||||
use context_course;
|
||||
use pix_icon;
|
||||
|
||||
@ -417,18 +416,6 @@ class core_renderer extends \core_renderer {
|
||||
return $this->render_from_template('core/single_button', $button->export_for_template($this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a paging bar.
|
||||
*
|
||||
* @param paging_bar $pagingbar The object.
|
||||
* @return string HTML
|
||||
*/
|
||||
protected function render_paging_bar(paging_bar $pagingbar) {
|
||||
// Any more than 10 is not usable and causes wierd wrapping of the pagination in this theme.
|
||||
$pagingbar->maxdisplay = 10;
|
||||
return $this->render_from_template('core/paging_bar', $pagingbar->export_for_template($this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the login form.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user