From 35e7ad6a60c4251ec263872018f8a05e296f0740 Mon Sep 17 00:00:00 2001 From: Syxton Date: Wed, 22 Oct 2014 08:24:30 -0400 Subject: [PATCH] MDL-47777 assign: max files hard coded to setting The current file submission is hard coded to a maximum of 20 files possible. While the user can choose a number less than 20, the maximum is still set in code. This converts the hard coded 20 to a site setting defaulting to 20. --- mod/assign/submission/file/lang/en/assignsubmission_file.php | 2 ++ mod/assign/submission/file/locallib.php | 3 +-- mod/assign/submission/file/settings.php | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mod/assign/submission/file/lang/en/assignsubmission_file.php b/mod/assign/submission/file/lang/en/assignsubmission_file.php index 70eb6a9399c..5f1bf0d84f5 100644 --- a/mod/assign/submission/file/lang/en/assignsubmission_file.php +++ b/mod/assign/submission/file/lang/en/assignsubmission_file.php @@ -32,6 +32,8 @@ $string['enabled_help'] = 'If enabled, students are able to upload one or more f $string['eventassessableuploaded'] = 'A file has been uploaded.'; $string['file'] = 'File submissions'; $string['maxbytes'] = 'Maximum file size'; +$string['maxfiles'] = 'Maximum files per submission'; +$string['maxfiles_help'] = 'If file submissions are enabled, each assignment can be set to accept up to this number of files for their submission.'; $string['maxfilessubmission'] = 'Maximum number of uploaded files'; $string['maxfilessubmission_help'] = 'If file submissions are enabled, each student will be able to upload up to this number of files for their submission.'; $string['maximumsubmissionsize'] = 'Maximum submission size'; diff --git a/mod/assign/submission/file/locallib.php b/mod/assign/submission/file/locallib.php index 31c7efc335d..506eeaa7c0e 100644 --- a/mod/assign/submission/file/locallib.php +++ b/mod/assign/submission/file/locallib.php @@ -29,7 +29,6 @@ require_once($CFG->libdir.'/eventslib.php'); defined('MOODLE_INTERNAL') || die(); // File areas for file submission assignment. -define('ASSIGNSUBMISSION_FILE_MAXFILES', 20); define('ASSIGNSUBMISSION_FILE_MAXSUMMARYFILES', 5); define('ASSIGNSUBMISSION_FILE_FILEAREA', 'submission_files'); @@ -75,7 +74,7 @@ class assign_submission_file extends assign_submission_plugin { $settings = array(); $options = array(); - for ($i = 1; $i <= ASSIGNSUBMISSION_FILE_MAXFILES; $i++) { + for ($i = 1; $i <= get_config('assignsubmission_file', 'maxfiles'); $i++) { $options[$i] = $i; } diff --git a/mod/assign/submission/file/settings.php b/mod/assign/submission/file/settings.php index 47578194a78..4f38feed053 100644 --- a/mod/assign/submission/file/settings.php +++ b/mod/assign/submission/file/settings.php @@ -28,6 +28,10 @@ $settings->add(new admin_setting_configcheckbox('assignsubmission_file/default', new lang_string('default', 'assignsubmission_file'), new lang_string('default_help', 'assignsubmission_file'), 1)); +$settings->add(new admin_setting_configtext('assignsubmission_file/maxfiles', + new lang_string('maxfiles', 'assignsubmission_file'), + new lang_string('maxfiles_help', 'assignsubmission_file'), 20, PARAM_INT)); + if (isset($CFG->maxbytes)) { $name = new lang_string('maximumsubmissionsize', 'assignsubmission_file');