Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
assign_submission_onlinetext Class Reference

library class for onlinetext submission plugin extending submission plugin base class More...

Inheritance diagram for assign_submission_onlinetext:

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.
 
 check_word_count ($submissiontext)
 Compare word count of onlinetext submission to word limit, and return result.
 
 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 ()
 
 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 text fields that can be imported/exported by this plugin.
 
 get_editor_format ($name, $submissionid)
 Get the content format for the editor.
 
 get_editor_text ($name, $submissionid)
 Get the saved text content from the editor.
 
 get_error ()
 What was the last error?
 
 get_external_parameters ()
 Return a description of external params suitable for uploading an onlinetext 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 submission.
 
 get_form_elements ($submission, MoodleQuickForm $mform, stdClass $data)
 Add form elements for settings.
 
 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 online text submission plugin.
 
 get_requires ()
 Get the required moodle version for this plugin.
 
 get_settings (MoodleQuickForm $mform)
 Get the settings for onlinetext 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)
 No text is set for this plugin.
 
 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 a submission.
 
 revert_to_draft (stdClass $submission)
 Carry out any extra processing required when the work reverted to draft.
 
 save (stdClass $submission, stdClass $data)
 Save data to the database and trigger plagiarism plugin, if enabled, to scan the uploaded content via events trigger.
 
 save_settings (stdClass $data)
 Save the settings for onlinetext 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)
 Display the saved text content from the editor in the view table.
 
 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 onlinetext word count 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
 

Detailed Description

library class for onlinetext submission plugin extending submission plugin base class

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ add_attempt()

assign_submission_plugin::add_attempt ( stdClass $oldsubmission,
stdClass $newsubmission )
inherited

Carry out any extra processing required when a student is given a new attempt (i.e.

when the submission is "reopened"

Parameters
stdClass$oldsubmissionThe previous attempt
stdClass$newsubmissionThe new attempt

◆ allow_image_conversion()

assign_submission_plugin::allow_image_conversion ( )
inherited

Determine if the plugin allows image file conversion.

Return values
bool

Reimplemented in assign_submission_file.

◆ allow_submissions()

assign_submission_plugin::allow_submissions ( )
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.

Return values
boolean

Reimplemented in assign_submission_comments.

◆ can_upgrade()

assign_submission_onlinetext::can_upgrade ( $type,
$version )

Return true if this plugin can upgrade an old Moodle 2.2 assignment of this type and version.

Parameters
string$typeold assignment subtype
int$versionold assignment version
Return values
boolTrue if upgrade is possible

Reimplemented from assign_plugin.

◆ check_word_count()

assign_submission_onlinetext::check_word_count ( $submissiontext)

Compare word count of onlinetext submission to word limit, and return result.

Parameters
string$submissiontextOnlinetext submission text from editor
Return values
stringError message if limit is enabled and exceeded, otherwise null

◆ copy_submission()

assign_submission_onlinetext::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.

Parameters
stdClass$sourcesubmission
stdClass$destsubmission

Reimplemented from assign_submission_plugin.

◆ data_preprocessing()

assign_plugin::data_preprocessing ( & $defaultvalues)
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)

Parameters
array$defaultvalues

◆ delete_instance()

assign_submission_onlinetext::delete_instance ( )

The assignment has been deleted - cleanup.

Return values
bool

Reimplemented from assign_plugin.

◆ disable()

assign_plugin::disable ( )
finalinherited

Set this plugin to disabled.

Return values
bool

◆ enable()

assign_plugin::enable ( )
finalinherited

Set this plugin to enabled.

Return values
bool

◆ format_for_log()

assign_plugin::format_for_log ( )
inherited
Deprecated
since 2.7

◆ get_config()

assign_plugin::get_config ( $setting = null)
finalinherited

Get a configuration value for this plugin.

Parameters
mixed$settingThe config key (string) or null
Return values
mixedstring | false

◆ get_config_file_areas()

assign_plugin::get_config_file_areas ( )
inherited

Get a list of file areas associated with the plugin configuration.

This is used for backup/restore.

Return values
arraynames of the fileareas, can be an empty array

◆ get_config_for_external()

assign_submission_onlinetext::get_config_for_external ( )

Return the plugin configs for external functions.

Return values
arraythe list of settings
Since
Moodle 3.2

Reimplemented from assign_plugin.

◆ get_editor_fields()

assign_submission_onlinetext::get_editor_fields ( )

Return a list of the text fields that can be imported/exported by this plugin.

Return values
arrayAn array of field names and descriptions. (name=>description, ...)

Reimplemented from assign_plugin.

◆ get_editor_format()

assign_submission_onlinetext::get_editor_format ( $name,
$submissionid )

Get the content format for the editor.

Parameters
string$name
int$submissionid
Return values
int

Reimplemented from assign_plugin.

◆ get_editor_text()

assign_submission_onlinetext::get_editor_text ( $name,
$submissionid )

Get the saved text content from the editor.

Parameters
string$name
int$submissionid
Return values
string

Reimplemented from assign_plugin.

◆ get_error()

assign_plugin::get_error ( )
finalinherited

What was the last error?

Return values
string

◆ get_external_parameters()

assign_submission_onlinetext::get_external_parameters ( )

Return a description of external params suitable for uploading an onlinetext submission from a webservice.

Return values
core_external\external_description|null

Reimplemented from assign_plugin.

◆ get_file_areas()

assign_submission_onlinetext::get_file_areas ( )

Get file areas returns a list of areas this plugin stores files.

Return values
array- An array of fileareas (keys) and descriptions (values)

Reimplemented from assign_plugin.

◆ get_file_info()

assign_plugin::get_file_info ( $browser,
$filearea,
$itemid,
$filepath,
$filename )
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.

Parameters
file_browser$browser
string$filearea
int$itemid
string$filepath
string$filename
Return values
file_info_stored

◆ get_files()

assign_submission_onlinetext::get_files ( stdClass $submission,
stdClass $user )

Produce a list of files suitable for export that represent this submission.

Parameters
stdClass$submission- For this is the submission data
stdClass$user- This is the user record for this submission
Return values
array- return an array of files indexed by filename

Reimplemented from assign_plugin.

◆ get_form_elements()

assign_submission_onlinetext::get_form_elements ( $submission,
MoodleQuickForm $mform,
stdClass $data )

Add form elements for settings.

Parameters
mixed$submissioncan be null
MoodleQuickForm$mform
stdClass$data
Return values
trueif elements were added to the form

Reimplemented from assign_plugin.

◆ get_form_elements_for_user()

assign_plugin::get_form_elements_for_user ( $submissionorgrade,
MoodleQuickForm $mform,
stdClass $data,
$userid )
inherited

Get any additional fields for the submission/grading form for this assignment.

Parameters
mixed$submissionorgradesubmission|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.
Return values
boolean- true if we added anything to the form

Reimplemented in assign_feedback_comments, assign_feedback_editpdf, and assign_feedback_file.

◆ get_name()

assign_submission_onlinetext::get_name ( )

Get the name of the online text submission plugin.

Return values
string

Reimplemented from assign_plugin.

◆ get_requires()

assign_plugin::get_requires ( )
finalinherited

Get the required moodle version for this plugin.

Return values
string

◆ get_settings()

assign_submission_onlinetext::get_settings ( MoodleQuickForm $mform)

Get the settings for onlinetext submission plugin.

Parameters
MoodleQuickForm$mformThe form to add elements to
Return values
void

Reimplemented from assign_plugin.

◆ get_sort_order()

assign_plugin::get_sort_order ( )
finalinherited

Get the numerical sort order for this plugin.

Return values
int

◆ get_subtype()

assign_submission_plugin::get_subtype ( )
finalinherited

return subtype name of the plugin

Return values
string

Reimplemented from assign_plugin.

◆ get_type()

assign_plugin::get_type ( )
finalinherited

Should return the type of this plugin.

Return values
string- the type

◆ get_version()

assign_plugin::get_version ( )
finalinherited

Get the installed version of this plugin.

Return values
string

◆ has_admin_settings()

assign_plugin::has_admin_settings ( )
finalinherited

Has this plugin got a custom settings.php file?

Return values
bool

◆ has_user_summary()

assign_plugin::has_user_summary ( )
inherited

If this plugin should not include a column in the grading table or a row on the summary page then return false.

Return values
bool

Reimplemented in assign_feedback_offline.

◆ is_configurable()

assign_plugin::is_configurable ( )
inherited

If true, the plugin will appear on the module settings page and can be enabled/disabled per assignment instance.

Return values
bool

Reimplemented in assign_feedback_editpdf, and assign_submission_comments.

◆ is_empty()

assign_submission_onlinetext::is_empty ( stdClass $submission)

No text is set for this plugin.

Parameters
stdClass$submission
Return values
bool

Reimplemented from assign_plugin.

◆ is_enabled()

assign_plugin::is_enabled ( )
inherited

Allows hiding this plugin from the submission/feedback screen if it is not enabled.

Return values
bool- if false - this plugin will not accept submissions / feedback

Reimplemented in assign_feedback_offline, and assign_submission_comments.

◆ is_first()

assign_plugin::is_first ( )
finalinherited

Is this the first plugin in the list?

Return values
bool

◆ is_last()

assign_plugin::is_last ( )
finalinherited

Is this the last plugin in the list?

Return values
bool

◆ is_visible()

assign_plugin::is_visible ( )
finalinherited

Is this plugin enaled?

Return values
bool

◆ lock()

assign_submission_plugin::lock ( $submission,
stdClass $flags )
inherited

Carry out any extra processing required when the work is locked.

Parameters
stdClass | false$submission- assign_submission data if any
stdClass$flags- User flags record
Return values
void

◆ precheck_submission()

assign_submission_plugin::precheck_submission ( $submission)
inherited

Check if the submission plugin has all the required data to allow the work to be submitted for grading.

Parameters
stdClass$submissionthe assign_submission record being submitted.
Return values
bool|string'true' if OK to proceed with submission, otherwise a a message to display to the user

◆ remove()

assign_submission_onlinetext::remove ( stdClass $submission)

Remove a submission.

Parameters
stdClass$submissionThe submission
Return values
boolean

Reimplemented from assign_submission_plugin.

◆ revert_to_draft()

assign_submission_plugin::revert_to_draft ( stdClass $submission)
inherited

Carry out any extra processing required when the work reverted to draft.

Parameters
stdClass$submission- assign_submission data
Return values
void

◆ save()

assign_submission_onlinetext::save ( stdClass $submission,
stdClass $data )

Save data to the database and trigger plagiarism plugin, if enabled, to scan the uploaded content via events trigger.

Parameters
stdClass$submission
stdClass$data
Return values
bool

Reimplemented from assign_plugin.

◆ save_settings()

assign_submission_onlinetext::save_settings ( stdClass $data)

Save the settings for onlinetext submission plugin.

Parameters
stdClass$data
Return values
bool

Reimplemented from assign_plugin.

◆ set_config()

assign_plugin::set_config ( $name,
$value )
finalinherited

Set a configuration value for this plugin.

Parameters
string$nameThe config key
string$valueThe config value
Return values
bool

◆ set_editor_format()

assign_plugin::set_editor_format ( $name,
$format,
$submissionorgradeid )
inherited

Given a field name and value should update the format for this field in the plugins submission or grade.

Parameters
string$nameName of the field.
int$formatUpdated format.
int$submissionorgradeidThe id of the submission or grade.
Return values
bool- true if the value was updated

◆ set_editor_text()

assign_plugin::set_editor_text ( $name,
$value,
$submissionorgradeid )
inherited

Given a field name and value should update the text for this field in the plugins submission or grade.

Parameters
string$nameName of the field.
string$valueUpdated text
int$submissionorgradeidThe id of the submission or grade
Return values
bool- true if the value was updated

Reimplemented in assign_feedback_comments.

◆ set_error()

assign_plugin::set_error ( $msg)
finalprotectedinherited

Save the error message from the last error.

Parameters
string$msg- the error description

◆ submission_is_empty()

assign_submission_onlinetext::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.

Parameters
stdClass$dataThe submission data
Return values
bool

Reimplemented from assign_submission_plugin.

◆ submit_for_grading()

assign_submission_plugin::submit_for_grading ( $submission)
inherited

Carry out any extra processing required when the work is submitted for grading.

Parameters
stdClass$submissionthe assign_submission record being submitted.
Return values
void

◆ unlock()

assign_submission_plugin::unlock ( $submission,
stdClass $flags )
inherited

Carry out any extra processing required when the work is unlocked.

Parameters
stdClass | false$submission- assign_submission data if any
stdClass$flags- User flags record
Return values
void

◆ upgrade()

assign_submission_onlinetext::upgrade ( context $oldcontext,
stdClass $oldassignment,
stdClass $oldsubmission,
stdClass $submission,
& $log )

Upgrade the submission from the old assignment to the new one.

Parameters
context$oldcontext- the database for the old assignment context
stdClass$oldassignmentThe data record for the old assignment
stdClass$oldsubmissionThe data record for the old submission
stdClass$submissionThe data record for the new submission
string$logRecord upgrade messages in the log
Return values
booltrue or false - false will trigger a rollback

Reimplemented from assign_plugin.

◆ upgrade_settings()

assign_submission_onlinetext::upgrade_settings ( context $oldcontext,
stdClass $oldassignment,
& $log )

Upgrade the settings from the old assignment to the new plugin based one.

Parameters
context$oldcontext- the database for the old assignment context
stdClass$oldassignment- the database for the old assignment instance
string$logrecord log events here
Return values
boolWas it a success?

Reimplemented from assign_plugin.

◆ view()

assign_submission_onlinetext::view ( stdClass $submission)

Display the saved text content from the editor in the view table.

Parameters
stdClass$submission
Return values
string

Reimplemented from assign_plugin.

◆ view_header()

assign_plugin::view_header ( )
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.

Return values
string

◆ view_page()

assign_plugin::view_page ( $action)
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

Parameters
string$actionThe plugin specified action
Return values
string

Reimplemented in assign_feedback_file, and assign_feedback_offline.

◆ view_summary()

assign_submission_onlinetext::view_summary ( stdClass $submission,
& $showviewlink )

Display onlinetext word count in the submission status table.

Parameters
stdClass$submission
bool$showviewlink- If the summary has been truncated set this to true
Return values
string

Reimplemented from assign_plugin.


The documentation for this class was generated from the following file: