MDL-12846: move course default settings into config_plugin table

This commit is contained in:
jerome
2008-09-25 07:33:22 +00:00
parent 2ca22c727b
commit cfec045442
2 changed files with 45 additions and 44 deletions
+22 -22
View File
@@ -14,7 +14,7 @@ if ($hassiteconfig
/// Course Default Settings Page
///main course settings
$temp = new admin_settingpage('coursesettings', get_string('coursesettings'));
$temp->add(new admin_settings_coursecat_select('course_category', get_string('category'), '', 1));
$temp->add(new admin_settings_coursecat_select('moodlecourse/category', get_string('category'), '', 1));
$courseformats = get_list_of_plugins('course/format');
$formcourseformats = array();
foreach ($courseformats as $courseformat) {
@@ -23,22 +23,22 @@ if ($hassiteconfig
$formcourseformats["$courseformat"] = get_string("format$courseformat");
}
}
$temp->add(new admin_setting_configselect('course_format', get_string('format'), get_string('courseformats'), key($formcourseformats),$formcourseformats));
$temp->add(new admin_setting_configselect('moodlecourse/format', get_string('format'), get_string('courseformats'), key($formcourseformats),$formcourseformats));
for ($i=1; $i<=52; $i++) {
$sectionmenu[$i] = "$i";
}
$temp->add(new admin_setting_configselect('course_numsections', get_string('numberweeks'), '', 1,$sectionmenu));
$temp->add(new admin_setting_configselect('moodlecourse/numsections', get_string('numberweeks'), '', 1,$sectionmenu));
$choices = array();
$choices['0'] = get_string('hiddensectionscollapsed');
$choices['1'] = get_string('hiddensectionsinvisible');
$temp->add(new admin_setting_configselect('course_hiddensections', get_string('hiddensections'), '', 0,$choices));
$temp->add(new admin_setting_configselect('moodlecourse/hiddensections', get_string('hiddensections'), '', 0,$choices));
$options = range(0, 10);
$temp->add(new admin_setting_configselect('course_newsitems', get_string('newsitemsnumber'), '', 5,$options));
$temp->add(new admin_setting_configselect('course_showgrades', get_string('showgrades'), get_string('grades'), 1,array(0 => get_string('no'), 1 => get_string('yes'))));
$temp->add(new admin_setting_configselect('course_showreports', get_string('showreports'), get_string('activityreport'), 0,array(0 => get_string('no'), 1 => get_string('yes'))));
$temp->add(new admin_setting_configselect('moodlecourse/newsitems', get_string('newsitemsnumber'), '', 5,$options));
$temp->add(new admin_setting_configselect('moodlecourse/showgrades', get_string('showgrades'), get_string('grades'), 1,array(0 => get_string('no'), 1 => get_string('yes'))));
$temp->add(new admin_setting_configselect('moodlecourse/showreports', get_string('showreports'), get_string('activityreport'), 0,array(0 => get_string('no'), 1 => get_string('yes'))));
$choices = get_max_upload_sizes($CFG->maxbytes);
$temp->add(new admin_setting_configselect('course_maxbytes', get_string('maximumupload'), '', key($choices),$choices));
$temp->add(new admin_setting_configselect('course_metacourse', get_string('metacourse'), '', 0,array(0 => get_string('no'), 1 => get_string('yes'))));
$temp->add(new admin_setting_configselect('moodlecourse/maxbytes', get_string('maximumupload'), '', key($choices),$choices));
$temp->add(new admin_setting_configselect('moodlecourse/metacourse', get_string('metacourse'), '', 0,array(0 => get_string('no'), 1 => get_string('yes'))));
///enrolement course settings
$temp->add(new admin_setting_heading('enrolhdr', get_string('enrolments'), ''));
@@ -55,27 +55,27 @@ if ($hassiteconfig
asort($choices);
$choices = array_flip($choices);
$choices = array_merge(array('' => get_string('sitedefault').' ('.get_string('enrolname', "enrol_$CFG->enrol").')'), $choices);
$temp->add(new admin_setting_configselect('course_enrol', get_string('enrolmentplugins'), '', key($choices),$choices));
$temp->add(new admin_setting_configselect('moodlecourse/enrol', get_string('enrolmentplugins'), '', key($choices),$choices));
$choices = array(0 => get_string('no'), 1 => get_string('yes'), 2 => get_string('enroldate'));
$temp->add(new admin_setting_configselect('course_enrollable', get_string('enrollable'), '', 1,$choices));
$temp->add(new admin_setting_configselect('moodlecourse/enrollable', get_string('enrollable'), '', 1,$choices));
$periodmenu=array();
$periodmenu[0] = get_string('unlimited');
for ($i=1; $i<=365; $i++) {
$seconds = $i * 86400;
$periodmenu[$seconds] = get_string('numdays', '', $i);
}
$temp->add(new admin_setting_configselect('course_enrolperiod', get_string('enrolperiod'), '', 0,$periodmenu));
$temp->add(new admin_setting_configselect('moodlecourse/enrolperiod', get_string('enrolperiod'), '', 0,$periodmenu));
///
$temp->add(new admin_setting_heading('expirynotifyhdr', get_string('expirynotify'), ''));
$temp->add(new admin_setting_configselect('course_expirynotify', get_string('notify'), '', 0,array(0 => get_string('no'), 1 => get_string('yes'))));
$temp->add(new admin_setting_configselect('course_notifystudents', get_string('expirynotifystudents'), '', 0,array(0 => get_string('no'), 1 => get_string('yes'))));
$temp->add(new admin_setting_configselect('moodlecourse/expirynotify', get_string('notify'), '', 0,array(0 => get_string('no'), 1 => get_string('yes'))));
$temp->add(new admin_setting_configselect('moodlecourse/notifystudents', get_string('expirynotifystudents'), '', 0,array(0 => get_string('no'), 1 => get_string('yes'))));
$thresholdmenu=array();
for ($i=1; $i<=30; $i++) {
$seconds = $i * 86400;
$thresholdmenu[$seconds] = get_string('numdays', '', $i);
}
$temp->add(new admin_setting_configselect('course_expirythreshold', get_string('expirythreshold'), '', 10 * 86400,$thresholdmenu));
$temp->add(new admin_setting_configselect('moodlecourse/expirythreshold', get_string('expirythreshold'), '', 10 * 86400,$thresholdmenu));
$temp->add(new admin_setting_heading('groups', get_string('groups', 'group'), ''));
@@ -83,32 +83,32 @@ if ($hassiteconfig
$choices[NOGROUPS] = get_string('groupsnone', 'group');
$choices[SEPARATEGROUPS] = get_string('groupsseparate', 'group');
$choices[VISIBLEGROUPS] = get_string('groupsvisible', 'group');
$temp->add(new admin_setting_configselect('course_groupmode', get_string('groupmode'), '', key($choices),$choices));
$temp->add(new admin_setting_configselect('course_groupmodeforce', get_string('force'), get_string('groupmodeforce'), 0,array(0 => get_string('no'), 1 => get_string('yes'))));
$temp->add(new admin_setting_configselect('moodlecourse/groupmode', get_string('groupmode'), '', key($choices),$choices));
$temp->add(new admin_setting_configselect('moodlecourse/groupmodeforce', get_string('force'), get_string('groupmodeforce'), 0,array(0 => get_string('no'), 1 => get_string('yes'))));
$temp->add(new admin_setting_heading('availability', get_string('availability'), ''));
$choices = array();
$choices['0'] = get_string('courseavailablenot');
$choices['1'] = get_string('courseavailable');
$temp->add(new admin_setting_configselect('course_visible', get_string('visible'), '', 1,$choices));
$temp->add(new admin_setting_configpasswordunmask('course_enrolpassword', get_string('enrolmentkey'), '',''));
$temp->add(new admin_setting_configselect('moodlecourse/visible', get_string('visible'), '', 1,$choices));
$temp->add(new admin_setting_configpasswordunmask('moodlecourse/enrolpassword', get_string('enrolmentkey'), '',''));
$choices = array();
$choices['0'] = get_string('guestsno');
$choices['1'] = get_string('guestsyes');
$choices['2'] = get_string('guestskey');
$temp->add(new admin_setting_configselect('course_guest', get_string('opentoguests'), '', 0,$choices));
$temp->add(new admin_setting_configselect('moodlecourse/guest', get_string('opentoguests'), '', 0,$choices));
$temp->add(new admin_setting_heading('language', get_string('language'), ''));
$languages=array();
$languages[''] = get_string('forceno');
$languages += get_list_of_languages();
$temp->add(new admin_setting_configselect('course_lang', get_string('forcelanguage'), '', 0,$languages));
$temp->add(new admin_setting_configselect('moodlecourse/lang', get_string('forcelanguage'), '', 0,$languages));
if(completion_info::is_enabled_for_site()) {
$temp->add(new admin_setting_heading('progress', get_string('progress','completion'), ''));
$temp->add(new admin_setting_configselect('course_enablecompletion', get_string('completion','completion'), '',
$temp->add(new admin_setting_configselect('moodlecourse/enablecompletion', get_string('completion','completion'), '',
1,array(0 => get_string('completiondisabled','completion'), 1 => get_string('completionenabled','completion'))));
}
$ADMIN->add('courses', $temp);