mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-49025 assign: Submissions of an empty directory should not save
Before this change if only a folder was submitted the submission_is_empty check would return true. This meant that the draft area would be saved. The is_empty check would then be called which would return false. This caused the submission form to indicate to the user that the submission had failed. Now is_empty and submission_is_empty should both return false if only folders are submitted.
This commit is contained in:
parent
3ebfab9810
commit
650779d609
@ -513,8 +513,16 @@ class assign_submission_file extends assign_submission_plugin {
|
||||
* @return bool
|
||||
*/
|
||||
public function submission_is_empty(stdClass $data) {
|
||||
$files = file_get_drafarea_files($data->files_filemanager);
|
||||
return count($files->list) == 0;
|
||||
global $USER;
|
||||
$fs = get_file_storage();
|
||||
// Get a count of all the draft files, excluding any directories.
|
||||
$files = $fs->get_area_files(context_user::instance($USER->id)->id,
|
||||
'user',
|
||||
'draft',
|
||||
$data->files_filemanager,
|
||||
'id',
|
||||
false);
|
||||
return count($files) == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user