Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

This file contains the definition for the library class for onlinetext 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: 730 lines (29 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: assign_submission_onlinetext  - X-Ref

library class for onlinetext submission plugin extending submission plugin base class

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

return: string

get_onlinetext_submission($submissionid)   X-Ref
Get onlinetext submission information from the database

param: int $submissionid
return: mixed

remove(stdClass $submission)   X-Ref
Remove a submission.

param: stdClass $submission The submission
return: boolean

get_settings(MoodleQuickForm $mform)   X-Ref
Get the settings for onlinetext submission plugin

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

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

param: stdClass $data
return: bool

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

param: mixed $submission can be null
param: MoodleQuickForm $mform
param: stdClass $data
return: true if elements were added to the form

get_edit_options()   X-Ref
Editor format options

return: array

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

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

get_editor_fields()   X-Ref
Return a list of the text fields that can be imported/exported by this plugin

return: array An array of field names and descriptions. (name=>description, ...)

get_editor_text($name, $submissionid)   X-Ref
Get the saved text content from the editor

param: string $name
param: int $submissionid
return: string

get_editor_format($name, $submissionid)   X-Ref
Get the content format for the editor

param: string $name
param: int $submissionid
return: int

view_summary(stdClass $submission, & $showviewlink)   X-Ref
Display onlinetext word count in the submission status table

param: stdClass $submission
param: bool $showviewlink - If the summary has been truncated set this to true
return: string

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

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

view(stdClass $submission)   X-Ref
Display the saved text content from the editor in the view table

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 old assignment subtype
param: int $version old assignment 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 database for the old assignment context
param: stdClass $oldassignment - the database for the old assignment instance
param: string $log record log events here
return: bool Was it a success?

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 database for the old assignment context
param: stdClass $oldassignment The data record for the old assignment
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

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

param: stdClass $submission The new submission
return: string

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

return: bool

is_empty(stdClass $submission)   X-Ref
No text is set for this plugin

param: stdClass $submission
return: bool

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 an onlinetext submission from a webservice.

return: external_description|null

check_word_count($submissiontext)   X-Ref
Compare word count of onlinetext submission to word limit, and return result.

param: string $submissiontext Onlinetext submission text from editor
return: string Error message if limit is enabled and exceeded, otherwise null

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

return: array the list of settings