MDL-35260 Course formats may have settings, be enabled, disabled and uninstalled

This commit is contained in:
Marina Glancy
2012-11-10 15:34:29 +08:00
parent 8ccaa296fa
commit 3776335ce2
14 changed files with 432 additions and 13 deletions
+11 -2
View File
@@ -113,11 +113,20 @@ class course_edit_form extends moodleform {
$mform->hardFreeze('summary_editor');
}
$courseformats = get_plugin_list('format');
$courseformats = get_sorted_course_formats(true);
$formcourseformats = array();
foreach ($courseformats as $courseformat => $formatdir) {
foreach ($courseformats as $courseformat) {
$formcourseformats[$courseformat] = get_string('pluginname', "format_$courseformat");
}
if (isset($course->format)) {
$course->format = course_get_format($course)->get_format(); // replace with default if not found
if (!in_array($course->format, $courseformats)) {
// this format is disabled. Still display it in the dropdown
$formcourseformats[$course->format] = get_string('withdisablednote', 'moodle',
get_string('pluginname', 'format_'.$course->format));
}
}
$mform->addElement('select', 'format', get_string('format'), $formcourseformats);
$mform->addHelpButton('format', 'format');
$mform->setDefault('format', $courseconfig->format);