mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 02:16:41 +02:00
MDL-4655 course: Number of courses with summaries to display is configurable
This commit is contained in:
parent
ecfe814e0f
commit
3b7bfbb5b8
5 changed files with 22 additions and 8 deletions
|
@ -284,23 +284,28 @@ if ($subcategorieswereshown) {
|
|||
echo html_writer::table($table);
|
||||
}
|
||||
|
||||
// Print out all the courses
|
||||
// Print out all the courses.
|
||||
$courses = get_courses_page($category->id, 'c.sortorder ASC',
|
||||
'c.id,c.sortorder,c.shortname,c.fullname,c.summary,c.visible',
|
||||
$totalcount, $page*$perpage, $perpage);
|
||||
$numcourses = count($courses);
|
||||
|
||||
// We can consider that we are using pagination when the total count of courses is different than the one returned.
|
||||
$pagingmode = $totalcount != $numcourses;
|
||||
|
||||
if (!$courses) {
|
||||
// There is no course to display.
|
||||
if (empty($subcategorieswereshown)) {
|
||||
echo $OUTPUT->heading(get_string("nocoursesyet"));
|
||||
}
|
||||
|
||||
} else if ($numcourses <= COURSE_MAX_SUMMARIES_PER_PAGE and !$page and !$editingon) {
|
||||
} else if ($numcourses <= $CFG->courseswithsummarieslimit and !$pagingmode and !$editingon) {
|
||||
// We display courses with their summaries as we have not reached the limit, also we are not
|
||||
// in paging mode and not allowed to edit either.
|
||||
echo $OUTPUT->box_start('courseboxes');
|
||||
print_courses($category);
|
||||
echo $OUTPUT->box_end();
|
||||
|
||||
} else {
|
||||
// The conditions above have failed, we display a basic list of courses with paging/editing options.
|
||||
echo $OUTPUT->paging_bar($totalcount, $page, $perpage, "/course/category.php?id=$category->id&perpage=$perpage");
|
||||
|
||||
echo '<form id="movecourses" action="category.php" method="post"><div>';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue