MDL-62279 assign: Properly set the defaults

Before an assignment has been created, we need to use the site defaults,
not the per instance defaults for the settings.
This commit is contained in:
Damyon Wiese 2018-08-03 15:03:53 +08:00
parent 6e8235c7d3
commit cc9384f121

View File

@ -69,11 +69,13 @@ class assign_submission_file extends assign_submission_plugin {
public function get_settings(MoodleQuickForm $mform) {
global $CFG, $COURSE;
$defaultmaxfilesubmissions = $this->get_config('maxfilesubmissions');
$defaultmaxsubmissionsizebytes = $this->get_config('maxsubmissionsizebytes');
if ($this->assignment->has_instance()) {
$defaultmaxfilesubmissions = $this->get_config('maxfilesubmissions');
$defaultmaxsubmissionsizebytes = $this->get_config('maxsubmissionsizebytes');
$defaultfiletypes = $this->get_config('filetypeslist');
} else {
$defaultmaxfilesubmissions = get_config('assignsubmission_file', 'maxfiles');
$defaultmaxsubmissionsizebytes = get_config('assignsubmission_file', 'maxbytes');
$defaultfiletypes = get_config('assignsubmission_file', 'filetypes');
}
$defaultfiletypes = (string)$defaultfiletypes;