MDL-69559 course: Add course setting and cap to control course downloads
This commit is contained in:
@@ -120,6 +120,27 @@ class course_edit_form extends moodleform {
|
||||
$mform->setConstant('visible', $courseconfig->visible);
|
||||
}
|
||||
}
|
||||
|
||||
// Download course content.
|
||||
if ($CFG->downloadcoursecontentallowed) {
|
||||
$downloadchoices = [
|
||||
DOWNLOAD_COURSE_CONTENT_DISABLED => get_string('no'),
|
||||
DOWNLOAD_COURSE_CONTENT_ENABLED => get_string('yes'),
|
||||
];
|
||||
$sitedefaultstring = $downloadchoices[$courseconfig->downloadcontentsitedefault];
|
||||
$downloadchoices[DOWNLOAD_COURSE_CONTENT_SITE_DEFAULT] = get_string('sitedefaultspecified', '', $sitedefaultstring);
|
||||
$downloadselectdefault = $courseconfig->downloadcontent ?? DOWNLOAD_COURSE_CONTENT_SITE_DEFAULT;
|
||||
|
||||
$mform->addElement('select', 'downloadcontent', get_string('enabledownloadcoursecontent', 'course'), $downloadchoices);
|
||||
$mform->addHelpButton('downloadcontent', 'downloadcoursecontent', 'course');
|
||||
$mform->setDefault('downloadcontent', $downloadselectdefault);
|
||||
|
||||
if (!has_capability('moodle/course:configuredownloadcontent', $coursecontext)) {
|
||||
$mform->hardFreeze('downloadcontent');
|
||||
$mform->setConstant('downloadcontent', $downloadselectdefault);
|
||||
}
|
||||
}
|
||||
|
||||
$mform->addElement('date_time_selector', 'startdate', get_string('startdate'));
|
||||
$mform->addHelpButton('startdate', 'startdate');
|
||||
$date = (new DateTime())->setTimestamp(usergetmidnight(time()));
|
||||
|
||||
Reference in New Issue
Block a user