diff --git a/admin/settings/appearance.php b/admin/settings/appearance.php index acd62dfb1af..7ea34542648 100644 --- a/admin/settings/appearance.php +++ b/admin/settings/appearance.php @@ -178,6 +178,8 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page $temp->add(new admin_setting_configcheckbox('courselistshortnames', new lang_string('courselistshortnames', 'admin'), new lang_string('courselistshortnames_desc', 'admin'), 0)); + $temp->add(new admin_setting_configtext('coursesperpage', new lang_string('coursesperpage', 'admin'), new lang_string('configcoursesperpage', 'admin'), 20, PARAM_INT)); + $temp->add(new admin_setting_configtext('courseswithsummarieslimit', new lang_string('courseswithsummarieslimit', 'admin'), new lang_string('configcourseswithsummarieslimit', 'admin'), 10, PARAM_INT)); $ADMIN->add('appearance', $temp); $temp = new admin_settingpage('ajax', new lang_string('ajaxuse')); diff --git a/admin/settings/frontpage.php b/admin/settings/frontpage.php index 5a060a101bb..f4ecb5bbcfb 100644 --- a/admin/settings/frontpage.php +++ b/admin/settings/frontpage.php @@ -49,8 +49,6 @@ if (!during_initial_install()) { //do not use during installation '10' => '10'))); $temp->add(new admin_setting_configtext('commentsperpage', new lang_string('commentsperpage', 'admin'), '', 15, PARAM_INT)); - $temp->add(new admin_setting_configtext('coursesperpage', new lang_string('coursesperpage', 'admin'), new lang_string('configcoursesperpage', 'admin'), 20, PARAM_INT)); - // front page default role $options = array(0=>new lang_string('none')); // roles to choose from $defaultfrontpageroleid = 0; diff --git a/course/category.php b/course/category.php index 1b822cc33a9..3ae02e7bb1c 100644 --- a/course/category.php +++ b/course/category.php @@ -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 '