Permalink
Browse files

MDL-24877, do not display all courses in course category tree if ther…

…e are too many courses in moodle
  • Loading branch information...
1 parent c096042 commit 2848b97948aa6d6e289b1ec447ba55ad1a5e3c67 @dcai dcai committed Mar 14, 2011
Showing with 19 additions and 2 deletions.
  1. +2 −0 admin/settings/server.php
  2. +13 −1 index.php
  3. +2 −0 lang/en/admin.php
  4. +1 −0 lang/en/moodle.php
  5. +1 −1 version.php
@@ -227,6 +227,8 @@
// "performance" settingpage
$temp = new admin_settingpage('performance', get_string('performance', 'admin'));
+$temp->add(new admin_setting_configtext('numcoursesincombo', get_string('numcoursesincombo', 'admin'), get_string('numcoursesincombo_help', 'admin'), 500));
+
$temp->add(new admin_setting_configselect('extramemorylimit', get_string('extramemorylimit', 'admin'),
get_string('configextramemorylimit', 'admin'), '512M',
// if this option is set to 0, default 128M will be used
View
@@ -206,7 +206,19 @@
echo html_writer::tag('a', get_string('skipa', 'access', moodle_strtolower(get_string('courses'))), array('href'=>'#skipcourses', 'class'=>'skip-block'));
echo $OUTPUT->heading(get_string('courses'), 2, 'headingblock header');
$renderer = $PAGE->get_renderer('core','course');
- echo $renderer->course_category_tree(get_course_category_tree());
+ // if there are too many courses, budiling course category tree could be slow,
+ // users should go to course index page to see the whole list.
+ $coursecount = $DB->count_records('course');
+ if (empty($CFG->numcoursesincombo)) {
+ // if $CFG->numcoursesincombo hasn't been set, use default value 500
+ $CFG->numcoursesincombo = 500;
+ }
+ if ($coursecount > $CFG->numcoursesincombo) {
+ $link = new moodle_url('/course/');
+ echo $OUTPUT->notification(get_string('maxnumcoursesincombo', 'moodle', array('link'=>$link->out(), 'maxnumofcourses'=>$CFG->numcoursesincombo, 'numberofcourses'=>$coursecount)));
+ } else {
+ echo $renderer->course_category_tree(get_course_category_tree());
+ }
print_course_search('', false, 'short');
echo html_writer::tag('span', '', array('class'=>'skip-block-to', 'id'=>'skipcourses'));
break;
View
@@ -764,6 +764,8 @@
$string['numberofstrings'] = 'Total number of strings: {$a->strings}<br />Missing: {$a->missing} ({$a->missingpercent}&nbsp;%)';
$string['numquestions'] = 'No. questions';
$string['numquestionsandhidden'] = '{$a->numquestions} (+{$a->numhidden} hidden)';
+$string['numcoursesincombo'] = 'Maximum number of courses in combo list';
+$string['numcoursesincombo_help'] = 'The combo list doesn\'t work well with large numbers of courses. When the total number of courses in the site is higher than this setting then a link to the dedicated course listing will be shown instead of trying to display all the courses on the front page.';
$string['opensslrecommended'] = 'Installing the optional OpenSSL library is highly recommended -- it enables Moodle Networking functionality.';
$string['opentogoogle'] = 'Open to Google';
$string['optionalmaintenancemessage'] = 'Optional maintenance message';
View
@@ -980,6 +980,7 @@
$string['maximumupload_help'] = 'This setting determines the largest size of file that can be uploaded to the course, limited by the site-wide setting set by an administrator. Activity modules also include a maximum upload size setting for further restricting the file size.';
$string['maxsize'] = 'Max size: {$a}';
$string['maxfilesize'] = 'Maximum size for new files: {$a}';
+$string['maxnumcoursesincombo'] = 'Browse <a href="{$a->link}">{$a->numberofcourses} courses</a>.';
$string['memberincourse'] = 'People in the course';
$string['messagebody'] = 'Message body';
$string['messagedselectedusers'] = 'Selected users have been messaged and the recipient list has been reset.';
View
@@ -30,7 +30,7 @@
defined('MOODLE_INTERNAL') || die();
-$version = 2011030900.00; // YYYYMMDD = date of the last version bump
+$version = 2011031400.00; // YYYYMMDD = date of the last version bump
// XX = daily increments
$release = '2.0.2+ (Build: 20110309)'; // Human-friendly version name

0 comments on commit 2848b97

Please sign in to comment.