Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
|
Library class for file submission plugin extending submission plugin base class. More...
Public Member Functions | |
add_attempt (stdClass $oldsubmission, stdClass $newsubmission) | |
Carry out any extra processing required when a student is given a new attempt (i.e. | |
allow_image_conversion () | |
Determine if the plugin allows image file conversion. | |
allow_submissions () | |
This plugin accepts submissions from a student The comments plugin has no submission component so should not be counted when determining whether to show the edit submission link. | |
can_upgrade ($type, $version) | |
Return true if this plugin can upgrade an old Moodle 2.2 assignment of this type and version. | |
copy_submission (stdClass $sourcesubmission, stdClass $destsubmission) | |
Copy the student's submission from a previous submission. | |
data_preprocessing (&$defaultvalues) | |
Allows the plugin to update the defaultvalues passed in to the settings form (needed to set up draft areas for editor and filemanager elements) | |
delete_instance () | |
The assignment has been deleted - cleanup. | |
disable () | |
Set this plugin to disabled. | |
enable () | |
Set this plugin to enabled. | |
format_for_log (stdClass $submission) | |
Formatting for log info. | |
get_config ($setting=null) | |
Get a configuration value for this plugin. | |
get_config_file_areas () | |
Get a list of file areas associated with the plugin configuration. | |
get_config_for_external () | |
Return the plugin configs for external functions. | |
get_editor_fields () | |
Return a list of the fields that can be exported or imported via text. | |
get_editor_format ($name, $submissionid) | |
Given a field name, should return the format of an editor field that is part of this plugin. | |
get_editor_text ($name, $submissionorgradeid) | |
Given a field name, should return the text of an editor field that is part of this plugin. | |
get_error () | |
What was the last error? | |
get_external_parameters () | |
Return a description of external params suitable for uploading a file submission from a webservice. | |
get_file_areas () | |
Get file areas returns a list of areas this plugin stores files. | |
get_file_info ($browser, $filearea, $itemid, $filepath, $filename) | |
Default implementation of file_get_info for plugins. | |
get_files (stdClass $submission, stdClass $user) | |
Produce a list of files suitable for export that represent this feedback or submission. | |
get_form_elements ($submission, MoodleQuickForm $mform, stdClass $data) | |
Add elements to submission form. | |
get_form_elements_for_user ($submissionorgrade, MoodleQuickForm $mform, stdClass $data, $userid) | |
Get any additional fields for the submission/grading form for this assignment. | |
get_name () | |
Get the name of the file submission plugin. | |
get_requires () | |
Get the required moodle version for this plugin. | |
get_settings (MoodleQuickForm $mform) | |
Get the default setting for file submission plugin. | |
get_sort_order () | |
Get the numerical sort order for this plugin. | |
get_subtype () | |
return subtype name of the plugin | |
get_type () | |
Should return the type of this plugin. | |
get_version () | |
Get the installed version of this plugin. | |
has_admin_settings () | |
Has this plugin got a custom settings.php file? | |
has_user_summary () | |
If this plugin should not include a column in the grading table or a row on the summary page then return false. | |
is_configurable () | |
If true, the plugin will appear on the module settings page and can be enabled/disabled per assignment instance. | |
is_empty (stdClass $submission) | |
Return true if there are no submission files. | |
is_enabled () | |
Allows hiding this plugin from the submission/feedback screen if it is not enabled. | |
is_first () | |
Is this the first plugin in the list? | |
is_last () | |
Is this the last plugin in the list? | |
is_visible () | |
Is this plugin enaled? | |
lock ($submission, stdClass $flags) | |
Carry out any extra processing required when the work is locked. | |
precheck_submission ($submission) | |
Check if the submission plugin has all the required data to allow the work to be submitted for grading. | |
remove (stdClass $submission) | |
Remove files from this submission. | |
revert_to_draft (stdClass $submission) | |
Carry out any extra processing required when the work reverted to draft. | |
save (stdClass $submission, stdClass $data) | |
Save the files and trigger plagiarism plugin, if enabled, to scan the uploaded files via events trigger. | |
save_settings (stdClass $data) | |
Save the settings for file submission plugin. | |
set_config ($name, $value) | |
Set a configuration value for this plugin. | |
set_editor_format ($name, $format, $submissionorgradeid) | |
Given a field name and value should update the format for this field in the plugins submission or grade. | |
set_editor_text ($name, $value, $submissionorgradeid) | |
Given a field name and value should update the text for this field in the plugins submission or grade. | |
submission_is_empty (stdClass $data) | |
Determine if a submission is empty. | |
submit_for_grading ($submission) | |
Carry out any extra processing required when the work is submitted for grading. | |
unlock ($submission, stdClass $flags) | |
Carry out any extra processing required when the work is unlocked. | |
upgrade (context $oldcontext, stdClass $oldassignment, stdClass $oldsubmission, stdClass $submission, & $log) | |
Upgrade the submission from the old assignment to the new one. | |
upgrade_settings (context $oldcontext, stdClass $oldassignment, & $log) | |
Upgrade the settings from the old assignment to the new plugin based one. | |
view (stdClass $submission) | |
No full submission view - the summary contains the list of files and that is the whole submission. | |
view_header () | |
This allows a plugin to render an introductory section which is displayed right below the activity's "intro" section on the main assignment page. | |
view_page ($action) | |
This allows a plugin to render a page in the context of the assignment. | |
view_summary (stdClass $submission, & $showviewlink) | |
Display the list of files in the submission status table. | |
Static Public Member Functions | |
static | cron () |
Run cron for this plugin. | |
Protected Member Functions | |
set_error ($msg) | |
Save the error message from the last error. | |
Protected Attributes | |
assign | $assignment |
$assignment the assignment record that contains the global settings for this assign instance | |
Library class for file submission plugin extending submission plugin base class.
|
inherited |
Carry out any extra processing required when a student is given a new attempt (i.e.
when the submission is "reopened"
stdClass | $oldsubmission | The previous attempt |
stdClass | $newsubmission | The new attempt |
assign_submission_file::allow_image_conversion | ( | ) |
Determine if the plugin allows image file conversion.
bool |
Reimplemented from assign_submission_plugin.
|
inherited |
This plugin accepts submissions from a student The comments plugin has no submission component so should not be counted when determining whether to show the edit submission link.
boolean |
Reimplemented in assign_submission_comments.
assign_submission_file::can_upgrade | ( | $type, | |
$version ) |
Return true if this plugin can upgrade an old Moodle 2.2 assignment of this type and version.
string | $type | |
int | $version |
bool | True if upgrade is possible |
Reimplemented from assign_plugin.
assign_submission_file::copy_submission | ( | stdClass | $sourcesubmission, |
stdClass | $destsubmission ) |
Copy the student's submission from a previous submission.
Used when a student opts to base their resubmission on the last submission.
stdClass | $sourcesubmission | |
stdClass | $destsubmission |
Reimplemented from assign_submission_plugin.
|
inherited |
Allows the plugin to update the defaultvalues passed in to the settings form (needed to set up draft areas for editor and filemanager elements)
array | $defaultvalues |
assign_submission_file::delete_instance | ( | ) |
|
finalinherited |
Set this plugin to disabled.
bool |
|
finalinherited |
Set this plugin to enabled.
bool |
assign_submission_file::format_for_log | ( | stdClass | $submission | ) |
Formatting for log info.
stdClass | $submission | The submission |
string |
Reimplemented from assign_plugin.
|
finalinherited |
Get a configuration value for this plugin.
mixed | $setting | The config key (string) or null |
mixed | string | false |
|
inherited |
Get a list of file areas associated with the plugin configuration.
This is used for backup/restore.
array | names of the fileareas, can be an empty array |
assign_submission_file::get_config_for_external | ( | ) |
Return the plugin configs for external functions.
array | the list of settings |
Reimplemented from assign_plugin.
|
inherited |
Return a list of the fields that can be exported or imported via text.
array | - The list of field names (strings) and descriptions. ($name => $description) |
Reimplemented in assign_feedback_comments, and assign_submission_onlinetext.
|
inherited |
Given a field name, should return the format of an editor field that is part of this plugin.
This is used when exporting to portfolio.
string | $name | Name of the field. |
int | $submissionid | The id of the submission |
int | - The format for the editor field |
Reimplemented in assign_submission_onlinetext.
|
inherited |
Given a field name, should return the text of an editor field that is part of this plugin.
This is used when exporting to portfolio.
string | $name | Name of the field. |
int | $submissionorgradeid | The id of the submission or grade |
string | - The text for the editor field |
Reimplemented in assign_feedback_comments, and assign_submission_onlinetext.
|
finalinherited |
What was the last error?
string |
assign_submission_file::get_external_parameters | ( | ) |
Return a description of external params suitable for uploading a file submission from a webservice.
core_external\external_description|null |
Reimplemented from assign_plugin.
assign_submission_file::get_file_areas | ( | ) |
Get file areas returns a list of areas this plugin stores files.
array | - An array of fileareas (keys) and descriptions (values) |
Reimplemented from assign_plugin.
|
inherited |
Default implementation of file_get_info for plugins.
This is used by the filebrowser to browse a plugins file areas.
This implementation should work for most plugins but can be overridden if required.
file_browser | $browser | |
string | $filearea | |
int | $itemid | |
string | $filepath | |
string | $filename |
file_info_stored |
assign_submission_file::get_files | ( | stdClass | $submission, |
stdClass | $user ) |
Produce a list of files suitable for export that represent this feedback or submission.
stdClass | $submission | The submission |
stdClass | $user | The user record - unused |
array | - return an array of files indexed by filename |
Reimplemented from assign_plugin.
assign_submission_file::get_form_elements | ( | $submission, | |
MoodleQuickForm | $mform, | ||
stdClass | $data ) |
Add elements to submission form.
mixed | $submission | stdClass|null |
MoodleQuickForm | $mform | |
stdClass | $data |
bool |
Reimplemented from assign_plugin.
|
inherited |
Get any additional fields for the submission/grading form for this assignment.
mixed | $submissionorgrade | submission|grade - For submission plugins this is the submission data, for feedback plugins it is the grade data |
MoodleQuickForm | $mform | - This is the form |
stdClass | $data | - This is the form data that can be modified for example by a filemanager element |
int | $userid | - This is the userid for the current submission. This is passed separately as there may not yet be a submission or grade. |
boolean | - true if we added anything to the form |
Reimplemented in assign_feedback_comments, assign_feedback_editpdf, and assign_feedback_file.
assign_submission_file::get_name | ( | ) |
|
finalinherited |
Get the required moodle version for this plugin.
string |
assign_submission_file::get_settings | ( | MoodleQuickForm | $mform | ) |
Get the default setting for file submission plugin.
MoodleQuickForm | $mform | The form to add elements to |
void |
Reimplemented from assign_plugin.
|
finalinherited |
Get the numerical sort order for this plugin.
int |
|
finalinherited |
|
finalinherited |
Should return the type of this plugin.
string | - the type |
|
finalinherited |
Get the installed version of this plugin.
string |
|
finalinherited |
Has this plugin got a custom settings.php file?
bool |
|
inherited |
If this plugin should not include a column in the grading table or a row on the summary page then return false.
bool |
Reimplemented in assign_feedback_offline.
|
inherited |
If true, the plugin will appear on the module settings page and can be enabled/disabled per assignment instance.
bool |
Reimplemented in assign_feedback_editpdf, and assign_submission_comments.
assign_submission_file::is_empty | ( | stdClass | $submission | ) |
Return true if there are no submission files.
stdClass | $submission |
Reimplemented from assign_plugin.
|
inherited |
Allows hiding this plugin from the submission/feedback screen if it is not enabled.
bool | - if false - this plugin will not accept submissions / feedback |
Reimplemented in assign_feedback_offline, and assign_submission_comments.
|
finalinherited |
Is this the first plugin in the list?
bool |
|
finalinherited |
Is this the last plugin in the list?
bool |
|
finalinherited |
Is this plugin enaled?
bool |
|
inherited |
Carry out any extra processing required when the work is locked.
stdClass | false | $submission | - assign_submission data if any |
stdClass | $flags | - User flags record |
void |
|
inherited |
Check if the submission plugin has all the required data to allow the work to be submitted for grading.
stdClass | $submission | the assign_submission record being submitted. |
bool|string | 'true' if OK to proceed with submission, otherwise a a message to display to the user |
assign_submission_file::remove | ( | stdClass | $submission | ) |
Remove files from this submission.
stdClass | $submission | The submission |
boolean |
Reimplemented from assign_submission_plugin.
|
inherited |
Carry out any extra processing required when the work reverted to draft.
stdClass | $submission | - assign_submission data |
void |
assign_submission_file::save | ( | stdClass | $submission, |
stdClass | $data ) |
Save the files and trigger plagiarism plugin, if enabled, to scan the uploaded files via events trigger.
stdClass | $submission | |
stdClass | $data |
bool |
Reimplemented from assign_plugin.
assign_submission_file::save_settings | ( | stdClass | $data | ) |
Save the settings for file submission plugin.
stdClass | $data |
bool |
Reimplemented from assign_plugin.
|
finalinherited |
Set a configuration value for this plugin.
string | $name | The config key |
string | $value | The config value |
bool |
|
inherited |
Given a field name and value should update the format for this field in the plugins submission or grade.
string | $name | Name of the field. |
int | $format | Updated format. |
int | $submissionorgradeid | The id of the submission or grade. |
bool | - true if the value was updated |
|
inherited |
Given a field name and value should update the text for this field in the plugins submission or grade.
string | $name | Name of the field. |
string | $value | Updated text |
int | $submissionorgradeid | The id of the submission or grade |
bool | - true if the value was updated |
Reimplemented in assign_feedback_comments.
|
finalprotectedinherited |
Save the error message from the last error.
string | $msg | - the error description |
assign_submission_file::submission_is_empty | ( | stdClass | $data | ) |
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.
stdClass | $data | The submission data |
bool |
Reimplemented from assign_submission_plugin.
|
inherited |
Carry out any extra processing required when the work is submitted for grading.
stdClass | $submission | the assign_submission record being submitted. |
void |
|
inherited |
Carry out any extra processing required when the work is unlocked.
stdClass | false | $submission | - assign_submission data if any |
stdClass | $flags | - User flags record |
void |
assign_submission_file::upgrade | ( | context | $oldcontext, |
stdClass | $oldassignment, | ||
stdClass | $oldsubmission, | ||
stdClass | $submission, | ||
& | $log ) |
Upgrade the submission from the old assignment to the new one.
context | $oldcontext | The context of the old assignment |
stdClass | $oldassignment | The data record for the old oldassignment |
stdClass | $oldsubmission | The data record for the old submission |
stdClass | $submission | The data record for the new submission |
string | $log | Record upgrade messages in the log |
bool | true or false - false will trigger a rollback |
Reimplemented from assign_plugin.
assign_submission_file::upgrade_settings | ( | context | $oldcontext, |
stdClass | $oldassignment, | ||
& | $log ) |
Upgrade the settings from the old assignment to the new plugin based one.
context | $oldcontext | - the old assignment context |
stdClass | $oldassignment | - the old assignment data record |
string | $log | record log events here |
bool | Was it a success? (false will trigger rollback) |
Reimplemented from assign_plugin.
assign_submission_file::view | ( | stdClass | $submission | ) |
No full submission view - the summary contains the list of files and that is the whole submission.
stdClass | $submission |
string |
Reimplemented from assign_plugin.
|
inherited |
This allows a plugin to render an introductory section which is displayed right below the activity's "intro" section on the main assignment page.
string |
|
inherited |
This allows a plugin to render a page in the context of the assignment.
If the plugin creates a link to the assignment view.php page with The following required parameters: id=coursemoduleid plugin=type pluginsubtype=assignfeedback|assignsubmission pluginaction=customaction
Then this function will be called to display the page with the pluginaction passed as action
string | $action | The plugin specified action |
string |
Reimplemented in assign_feedback_file, and assign_feedback_offline.
assign_submission_file::view_summary | ( | stdClass | $submission, |
& | $showviewlink ) |
Display the list of files in the submission status table.
stdClass | $submission | |
bool | $showviewlink | Set this to true if the list of files is long |
string |
Reimplemented from assign_plugin.