* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+use core_admin\local\settings\filesize;
+
$capabilities = array(
'moodle/backup:backupcourse',
'moodle/category:manage',
$temp->add(new admin_setting_configselect('moodlecourse/visible', new lang_string('visible'), new lang_string('visible_help'),
1, $choices));
+ // Enable/disable download course content.
+ $choices = [
+ DOWNLOAD_COURSE_CONTENT_DISABLED => new lang_string('no'),
+ DOWNLOAD_COURSE_CONTENT_ENABLED => new lang_string('yes'),
+ ];
+ $downloadcontentsitedefault = new admin_setting_configselect('moodlecourse/downloadcontentsitedefault',
+ new lang_string('enabledownloadcoursecontent', 'course'),
+ new lang_string('downloadcoursecontent_help', 'course'), 0, $choices);
+ $downloadcontentsitedefault->add_dependent_on('downloadcoursecontentallowed');
+ $temp->add($downloadcontentsitedefault);
+
// Course format.
$temp->add(new admin_setting_heading('courseformathdr', new lang_string('type_format', 'plugin'), ''));
$ADMIN->add('courses', $temp);
+ // Download course content.
+ $downloadcoursedefaulturl = new moodle_url('/admin/settings.php', ['section' => 'coursesettings']);
+ $temp = new admin_settingpage('downloadcoursecontent', new lang_string('downloadcoursecontent', 'course'));
+ $temp->add(new admin_setting_configcheckbox('downloadcoursecontentallowed',
+ new lang_string('downloadcoursecontentallowed', 'admin'),
+ new lang_string('downloadcoursecontentallowed_desc', 'admin', $downloadcoursedefaulturl->out()), 0));
+
+ // 50MB default maximum size per file when downloading course content.
+ $defaultmaxdownloadsize = 50 * filesize::UNIT_MB;
+ $temp->add(new filesize('maxsizeperdownloadcoursefile', new lang_string('maxsizeperdownloadcoursefile', 'admin'),
+ new lang_string('maxsizeperdownloadcoursefile_desc', 'admin'), $defaultmaxdownloadsize, filesize::UNIT_MB));
+ $temp->hide_if('maxsizeperdownloadcoursefile', 'downloadcoursecontentallowed');
+
+ $ADMIN->add('courses', $temp);
+
// "courserequests" settingpage.
$temp = new admin_settingpage('courserequest', new lang_string('courserequest'));
$temp->add(new admin_setting_configcheckbox('enablecourserequests',
// Course activity chooser footer default display option.
define('COURSE_CHOOSER_FOOTER_NONE', 'hidden');
+// Download course content options.
+define('DOWNLOAD_COURSE_CONTENT_DISABLED', 0);
+define('DOWNLOAD_COURSE_CONTENT_ENABLED', 1);
+define('DOWNLOAD_COURSE_CONTENT_SITE_DEFAULT', 2);
+
function make_log_url($module, $url) {
switch ($module) {
case 'course':
$string['doesnotfit'] = 'Email display settings';
$string['doesnotfitdetail'] = 'Display settings for email leaving Moodle.';
$string['download'] = 'Download';
+$string['downloadcoursecontentallowed'] = 'Download course content feature available';
+$string['downloadcoursecontentallowed_desc'] = 'Whether the download course content feature is available to courses. When available, course content downloads can be enabled/disabled using the "Enable download course content" setting within the course edit menu (the default for this can be set in <a href={$a} target="_blank">Course default settings</a>).';
$string['durationunits'] = 'duration units';
$string['edithelpdocs'] = 'Edit help documents';
$string['editlang'] = '<b>Edit</b>';
from a STABLE branch of the Moodle code. See Moodle Docs for more details.';
$string['maxbytes'] = 'Maximum uploaded file size';
$string['maxconsecutiveidentchars'] = 'Consecutive identical characters';
+$string['maxsizeperdownloadcoursefile'] = 'Maximum size per file';
+$string['maxsizeperdownloadcoursefile_desc'] = 'The maximum size of each file when downloading course content. Files exceeding this size will be omitted from the download.';
$string['maxeditingtime'] = 'Maximum time to edit posts';
$string['maxusersperpage'] = ' Maximum users per page';
$string['configmaxusersperpage'] = 'Maximum number of users displayed within user selector in course, group, cohort, webservice etc.';
$string['customfield_visibletoall'] = 'Everyone';
$string['customfield_visibletoteachers'] = 'Teachers';
$string['customfieldsettings'] = 'Common course custom fields settings';
+$string['downloadcoursecontent'] = 'Download course content';
+$string['downloadcoursecontent_help'] = 'This setting determines whether course content may be downloaded by users with the download course content capability (by default users with the role of student or teacher).';
+$string['enabledownloadcoursecontent'] = 'Enable download course content';
$string['errorendbeforestart'] = 'The end date ({$a}) is before the course start date.';
$string['favourite'] = 'Starred course';
$string['gradetopassnotset'] = 'This course does not have a grade to pass set. It may be set in the grade item of the course (Gradebook setup).';