Skip to content
Permalink
Browse files
Merge branch 'MDL-42779-34' of https://github.com/lucaboesch/moodle i…
…nto MOODLE_34_STABLE
  • Loading branch information
David Monllao committed May 28, 2018
2 parents 3753139 + 000e6f4 commit 2bb95d9c5a07c6f3d8b5385f1e8958e1c2cccea7
Showing with 14 additions and 6 deletions.
  1. +13 −5 course/classes/management_renderer.php
  2. +1 −1 course/management.php
@@ -484,9 +484,11 @@ public function category_bulk_actions(coursecat $category = null) {
* @param course_in_list $course The currently selected course.
* @param int $page The page being displayed.
* @param int $perpage The number of courses to display per page.
* @param string|null $viewmode The view mode the page is in, one out of 'default', 'combined', 'courses' or 'categories'.
* @return string
*/
public function course_listing(coursecat $category = null, course_in_list $course = null, $page = 0, $perpage = 20) {
public function course_listing(coursecat $category = null, course_in_list $course = null, $page = 0, $perpage = 20,
$viewmode = 'default') {

if ($category === null) {
$html = html_writer::start_div('select-a-category');
@@ -527,13 +529,13 @@ public function course_listing(coursecat $category = null, course_in_list $cours
$html .= html_writer::tag('h3', $category->get_formatted_name(),
array('id' => 'course-listing-title', 'tabindex' => '0'));
$html .= $this->course_listing_actions($category, $course, $perpage);
$html .= $this->listing_pagination($category, $page, $perpage);
$html .= $this->listing_pagination($category, $page, $perpage, false, $viewmode);
$html .= html_writer::start_tag('ul', array('class' => 'ml', 'role' => 'group'));
foreach ($category->get_courses($options) as $listitem) {
$html .= $this->course_listitem($category, $listitem, $courseid);
}
$html .= html_writer::end_tag('ul');
$html .= $this->listing_pagination($category, $page, $perpage, true);
$html .= $this->listing_pagination($category, $page, $perpage, true, $viewmode);
$html .= $this->course_bulk_actions($category);
$html .= html_writer::end_div();
return $html;
@@ -546,9 +548,10 @@ public function course_listing(coursecat $category = null, course_in_list $cours
* @param int $page The current page.
* @param int $perpage The number of courses to display per page.
* @param bool $showtotals Set to true to show the total number of courses and what is being displayed.
* @param string|null $viewmode The view mode the page is in, one out of 'default', 'combined', 'courses' or 'categories'.
* @return string
*/
protected function listing_pagination(coursecat $category, $page, $perpage, $showtotals = false) {
protected function listing_pagination(coursecat $category, $page, $perpage, $showtotals = false, $viewmode = 'default') {
$html = '';
$totalcourses = $category->get_courses_count();
$totalpages = ceil($totalcourses / $perpage);
@@ -582,7 +585,12 @@ protected function listing_pagination(coursecat $category, $page, $perpage, $sho
}
}
$items = array();
$baseurl = new moodle_url('/course/management.php', array('categoryid' => $category->id));
if ($viewmode !== 'default') {
$baseurl = new moodle_url('/course/management.php', array('categoryid' => $category->id,
'view' => $viewmode));
} else {
$baseurl = new moodle_url('/course/management.php', array('categoryid' => $category->id));
}
if ($page > 0) {
$items[] = $this->action_button(new moodle_url($baseurl, array('page' => 0)), get_string('first'));
$items[] = $this->action_button(new moodle_url($baseurl, array('page' => $page - 1)), get_string('prev'));
@@ -495,7 +495,7 @@
if ($displaycourselisting) {
echo $renderer->grid_column_start($coursesize, 'course-listing');
if (!$issearching) {
echo $renderer->course_listing($category, $course, $page, $perpage);
echo $renderer->course_listing($category, $course, $page, $perpage, $viewmode);
} else {
list($courses, $coursescount, $coursestotal) =
\core_course\management\helper::search_courses($search, $blocklist, $modulelist, $page, $perpage);

0 comments on commit 2bb95d9

Please sign in to comment.