Permalink
Browse files

MDL-36644 Assignment: prepend the course upload limit to the options …

…array

Ensure that the course upload limit is the first option in the list of available choices for the Maximum submission size select.
  • Loading branch information...
1 parent 7ac94ca commit 6d976f3f30ad75f1224c3a5c01895550cb67cc31 @coriordan coriordan committed with danpoltawski Nov 15, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 mod/assign/submission/file/locallib.php
@@ -87,10 +87,13 @@ public function get_settings(MoodleQuickForm $mform) {
$mform->disabledIf('assignsubmission_file_maxfiles', 'assignsubmission_file_enabled', 'eq', 0);
$choices = get_max_upload_sizes($CFG->maxbytes, $COURSE->maxbytes, get_config('assignsubmission_file', 'maxbytes'));
+
+ // Remove the option for 0 bytes.
+ unset($choices[0]);
if ($COURSE->maxbytes == 0) {
- $choices[0] = get_string('siteuploadlimit', 'assignsubmission_file');
+ $choices = array(0=>get_string('siteuploadlimit', 'assignsubmission_file')) + $choices;
} else {
- $choices[0] = get_string('courseuploadlimit') . ' (' . display_size($COURSE->maxbytes) . ')';
+ $choices = array(0=>get_string('courseuploadlimit') . ' (' . display_size($COURSE->maxbytes) . ')') + $choices;
}
$settings[] = array('type' => 'select',
'name' => 'maxsubmissionsizebytes',

0 comments on commit 6d976f3

Please sign in to comment.