Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 402] [Versions 311 and 403]

This file contains the definition for the library class for file submission plugin This class provides all the functionality for the new assign module.

Copyright: 2012 NetSpot {@link http://www.netspot.com.au}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 650 lines (26 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: assign_submission_file  - X-Ref

Library class for file submission plugin extending submission plugin base class

get_name()   X-Ref
Get the name of the file submission plugin

return: string

get_file_submission($submissionid)   X-Ref
Get file submission information from the database

param: int $submissionid
return: mixed

get_settings(MoodleQuickForm $mform)   X-Ref
Get the default setting for file submission plugin

param: MoodleQuickForm $mform The form to add elements to
return: void

save_settings(stdClass $data)   X-Ref
Save the settings for file submission plugin

param: stdClass $data
return: bool

get_file_options()   X-Ref
File format options

return: array

get_form_elements($submission, MoodleQuickForm $mform, stdClass $data)   X-Ref
Add elements to submission form

param: mixed $submission stdClass|null
param: MoodleQuickForm $mform
param: stdClass $data
return: bool

count_files($submissionid, $area)   X-Ref
Count the number of files

param: int $submissionid
param: string $area
return: int

save(stdClass $submission, stdClass $data)   X-Ref
Save the files and trigger plagiarism plugin, if enabled,
to scan the uploaded files via events trigger

param: stdClass $submission
param: stdClass $data
return: bool

remove(stdClass $submission)   X-Ref
Remove files from this submission.

param: stdClass $submission The submission
return: boolean

get_files(stdClass $submission, stdClass $user)   X-Ref
Produce a list of files suitable for export that represent this feedback or submission

param: stdClass $submission The submission
param: stdClass $user The user record - unused
return: array - return an array of files indexed by filename

view_summary(stdClass $submission, & $showviewlink)   X-Ref
Display the list of files  in the submission status table

param: stdClass $submission
param: bool $showviewlink Set this to true if the list of files is long
return: string

view(stdClass $submission)   X-Ref
No full submission view - the summary contains the list of files and that is the whole submission

param: stdClass $submission
return: string

can_upgrade($type, $version)   X-Ref
Return true if this plugin can upgrade an old Moodle 2.2 assignment of this type
and version.

param: string $type
param: int $version
return: bool True if upgrade is possible

upgrade_settings(context $oldcontext, stdClass $oldassignment, & $log)   X-Ref
Upgrade the settings from the old assignment
to the new plugin based one

param: context $oldcontext - the old assignment context
param: stdClass $oldassignment - the old assignment data record
param: string $log record log events here
return: bool Was it a success? (false will trigger rollback)

upgrade(context $oldcontext,stdClass $oldassignment,stdClass $oldsubmission,stdClass $submission,& $log)   X-Ref
Upgrade the submission from the old assignment to the new one

param: context $oldcontext The context of the old assignment
param: stdClass $oldassignment The data record for the old oldassignment
param: stdClass $oldsubmission The data record for the old submission
param: stdClass $submission The data record for the new submission
param: string $log Record upgrade messages in the log
return: bool true or false - false will trigger a rollback

delete_instance()   X-Ref
The assignment has been deleted - cleanup

return: bool

format_for_log(stdClass $submission)   X-Ref
Formatting for log info

param: stdClass $submission The submission
return: string

is_empty(stdClass $submission)   X-Ref
Return true if there are no submission files

param: stdClass $submission

submission_is_empty(stdClass $data)   X-Ref
Determine if a submission is empty

This is distinct from is_empty in that it is intended to be used to
determine if a submission made before saving is empty.

param: stdClass $data The submission data
return: bool

get_file_areas()   X-Ref
Get file areas returns a list of areas this plugin stores files

return: array - An array of fileareas (keys) and descriptions (values)

copy_submission(stdClass $sourcesubmission, stdClass $destsubmission)   X-Ref
Copy the student's submission from a previous submission. Used when a student opts to base their resubmission
on the last submission.

param: stdClass $sourcesubmission
param: stdClass $destsubmission

get_external_parameters()   X-Ref
Return a description of external params suitable for uploading a file submission from a webservice.

return: external_description|null

get_config_for_external()   X-Ref
Return the plugin configs for external functions.

return: array the list of settings

get_configured_typesets()   X-Ref
Get the type sets configured for this assignment.

return: array('groupname', 'mime/type', ...)

allow_image_conversion()   X-Ref
Determine if the plugin allows image file conversion

return: bool