MDL-25357 Allow maximum number of sections to be set by the admin. Also allow 0 sections at an choice.

Also fix one bad <br/> in another lang string.
This commit is contained in:
Tim Hunt
2011-07-04 15:35:03 +01:00
parent 81f8e0f8a0
commit c141b05f7d
4 changed files with 37 additions and 9 deletions
+26
View File
@@ -3591,6 +3591,32 @@ class admin_settings_country_select extends admin_setting_configselect {
}
/**
* admin_setting_configselect for the default number of sections in a course,
* simply so we can lazy-load the choices.
*
* @copyright 2011 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class admin_settings_num_course_sections extends admin_setting_configselect {
public function __construct($name, $visiblename, $description, $defaultsetting) {
parent::__construct($name, $visiblename, $description, $defaultsetting, array());
}
/** Lazy-load the available choices for the select box */
public function load_choices() {
$max = get_config('moodlecourse', 'maxsections');
if (empty($max)) {
$max = 52;
}
for ($i = 0; $i <= $max; $i++) {
$this->choices[$i] = "$i";
}
return true;
}
}
/**
* Course category selection
*