mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 08:55:15 +02:00
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:
parent
81f8e0f8a0
commit
c141b05f7d
@ -21,10 +21,11 @@ if ($hassiteconfig
|
||||
$formcourseformats[$courseformat] = get_string('pluginname', "format_$courseformat");
|
||||
}
|
||||
$temp->add(new admin_setting_configselect('moodlecourse/format', get_string('format'), get_string('coursehelpformat'), 'weeks',$formcourseformats));
|
||||
for ($i=1; $i<=52; $i++) {
|
||||
$sectionmenu[$i] = "$i";
|
||||
}
|
||||
$temp->add(new admin_setting_configselect('moodlecourse/numsections', get_string('numberweeks'), get_string('coursehelpnumberweeks'), 10,$sectionmenu));
|
||||
|
||||
$temp->add(new admin_setting_configtext('moodlecourse/maxsections', get_string('maxnumberweeks'), get_string('maxnumberweeks_desc'), 52));
|
||||
|
||||
$temp->add(new admin_settings_num_course_sections('moodlecourse/numsections', get_string('numberweeks'), get_string('coursehelpnumberweeks'), 10));
|
||||
|
||||
$choices = array();
|
||||
$choices['0'] = get_string('hiddensectionscollapsed');
|
||||
$choices['1'] = get_string('hiddensectionsinvisible');
|
||||
@ -33,15 +34,14 @@ if ($hassiteconfig
|
||||
$temp->add(new admin_setting_configselect('moodlecourse/newsitems', get_string('newsitemsnumber'), get_string('coursehelpnewsitemsnumber'), 5,$options));
|
||||
$temp->add(new admin_setting_configselect('moodlecourse/showgrades', get_string('showgrades'), get_string('coursehelpshowgrades'), 1,array(0 => get_string('no'), 1 => get_string('yes'))));
|
||||
$temp->add(new admin_setting_configselect('moodlecourse/showreports', get_string('showreports'), '', 0,array(0 => get_string('no'), 1 => get_string('yes'))));
|
||||
|
||||
if (isset($CFG->maxbytes)) {
|
||||
$choices = get_max_upload_sizes($CFG->maxbytes);
|
||||
} else {
|
||||
$choices = get_max_upload_sizes();
|
||||
}
|
||||
|
||||
$temp->add(new admin_setting_configselect('moodlecourse/maxbytes', get_string('maximumupload'), get_string('coursehelpmaximumupload'), key($choices), $choices));
|
||||
|
||||
|
||||
if (!empty($CFG->legacyfilesinnewcourses)) {
|
||||
$choices = array('0'=>get_string('no'), '2'=>get_string('yes'));
|
||||
$temp->add(new admin_setting_configselect('moodlecourse/legacyfiles', get_string('courselegacyfiles'), get_string('courselegacyfiles_help'), key($choices), $choices));
|
||||
|
@ -120,8 +120,8 @@ class course_edit_form extends moodleform {
|
||||
$mform->addHelpButton('format', 'format');
|
||||
$mform->setDefault('format', $courseconfig->format);
|
||||
|
||||
for ($i=1; $i<=52; $i++) {
|
||||
$sectionmenu[$i] = "$i";
|
||||
for ($i = 0; $i <= $courseconfig->maxsections; $i++) {
|
||||
$sectionmenu[$i] = "$i";
|
||||
}
|
||||
$mform->addElement('select', 'numsections', get_string('numberweeks'), $sectionmenu);
|
||||
$mform->setDefault('numsections', $courseconfig->numsections);
|
||||
|
@ -304,7 +304,7 @@ $string['coursehelpforce'] = 'Force the course group mode to every activity in t
|
||||
$string['coursehelpformat'] = 'The course main page will be displayed in this format.';
|
||||
$string['coursehelphiddensections'] = 'How the hidden sections in the course are displayed to students.';
|
||||
$string['coursehelpmaximumupload'] = 'Define the largest size of file that can be uploaded in this course, limited by the site-wide setting.';
|
||||
$string['coursehelpnewsitemsnumber'] = 'Number of recent items appearing on the course home page, in a news box down the right-hand side <br/>(0 means the news box won\'t appear).';
|
||||
$string['coursehelpnewsitemsnumber'] = 'Number of recent items appearing on the course home page, in a news box down the right-hand side (0 means the news box won\'t appear).';
|
||||
$string['coursehelpnumberweeks'] = 'Number of weeks/topics displayed on the course main page.';
|
||||
$string['coursehelpshowgrades'] = 'Enable the display of the gradebook. It does not prevent grades from being displayed within the individual activities.';
|
||||
$string['coursehidden'] = 'This course is currently unavailable to students';
|
||||
@ -981,6 +981,8 @@ $string['maximumchars'] = 'Maximum of {$a} characters';
|
||||
$string['maximumshort'] = 'Max';
|
||||
$string['maximumupload'] = 'Maximum upload size';
|
||||
$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['maxnumberweeks'] = 'Maximum for number of weeks/topics';
|
||||
$string['maxnumberweeks_desc'] = 'This controls the maximum options that appears in the "Number of weeks/topics" setting for courses.';
|
||||
$string['maxsize'] = 'Max size: {$a}';
|
||||
$string['maxfilesize'] = 'Maximum size for new files: {$a}';
|
||||
$string['maxnumcoursesincombo'] = 'Browse <a href="{$a->link}">{$a->numberofcourses} courses</a>.';
|
||||
|
@ -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
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user