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:
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user