From 18a0b829a466ccf56260e4e6c0dd73ff1cb6d6c0 Mon Sep 17 00:00:00 2001 From: Cathal O'Riordan Date: Thu, 15 Nov 2012 12:18:05 +0000 Subject: [PATCH] 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. --- mod/assign/submission/file/locallib.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mod/assign/submission/file/locallib.php b/mod/assign/submission/file/locallib.php index 3f95f343524..ed1e23471dc 100644 --- a/mod/assign/submission/file/locallib.php +++ b/mod/assign/submission/file/locallib.php @@ -87,10 +87,13 @@ class assign_submission_file extends assign_submission_plugin { $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', -- 2.43.0