Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 39 and 400] [Versions 400 and 402] [Versions 400 and 403]

This file contains the definition for the library class for comment feedback plugin

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

Defines 1 class


Class: assign_feedback_comments  - X-Ref

Library class for comment feedback plugin extending feedback plugin base class.

get_name()   X-Ref
Get the name of the online comment feedback plugin.

return: string

get_feedback_comments($gradeid)   X-Ref
Get the feedback comment from the database.

return: stdClass|false The feedback comments for the given grade if it exists.
param: int $gradeid

get_quickgrading_html($userid, $grade)   X-Ref
Get quickgrading form elements as html.

return: mixed - A html string containing the html form elements required for quickgrading
param: int $userid The user id in the table this quickgrading element relates to
param: mixed $grade - The grade data - may be null if there are no grades for this user (yet)

is_quickgrading_modified($userid, $grade)   X-Ref
Has the plugin quickgrading form element been modified in the current form submission?

return: boolean - true if the quickgrading form element has been modified
param: int $userid The user id in the table this quickgrading element relates to
param: stdClass $grade The grade

is_feedback_modified(stdClass $grade, stdClass $data)   X-Ref
Has the comment feedback been modified?

return: boolean True if the comment feedback has been modified, else false.
param: stdClass $grade The grade object.
param: stdClass $data Data from the form submission.

supports_quickgrading()   X-Ref
Override to indicate a plugin supports quickgrading.

return: boolean - True if the plugin supports quickgrading

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, $gradeid)   X-Ref
Get the saved text content from the editor.

return: string
param: string $name
param: int $gradeid

set_editor_text($name, $value, $gradeid)   X-Ref
Get the saved text content from the editor.

return: string
param: string $name
param: string $value
param: int $gradeid

save_quickgrading_changes($userid, $grade)   X-Ref
Save quickgrading changes.

return: boolean - true if the grade changes were saved correctly
param: int $userid The user id in the table this quickgrading element relates to
param: stdClass $grade The grade

save_settings(stdClass $data)   X-Ref
Save the settings for feedback comments plugin

return: bool
param: stdClass $data

get_settings(MoodleQuickForm $mform)   X-Ref
Get the default setting for feedback comments plugin

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

convert_submission_text_to_feedback($submission, $data, $grade)   X-Ref
Convert the text from any submission plugin that has an editor field to
a format suitable for inserting in the feedback text field.

return: boolean - True if feedback text was set.
param: stdClass $submission
param: stdClass $data - Form data to be filled with the converted submission text and format.
param: stdClass|null $grade

get_form_elements_for_user($grade, MoodleQuickForm $mform, stdClass $data, $userid)   X-Ref
Get form elements for the grading page

return: bool true if elements were added to the form
param: stdClass|null $grade
param: MoodleQuickForm $mform
param: stdClass $data

save(stdClass $grade, stdClass $data)   X-Ref
Saving the comment content into database.

return: bool
param: stdClass $grade
param: stdClass $data

view_summary(stdClass $grade, & $showviewlink)   X-Ref
Display the comment in the feedback table.

return: string
param: stdClass $grade
param: bool $showviewlink Set to true to show a link to view the full feedback

view(stdClass $grade)   X-Ref
Display the comment in the feedback table.

return: string
param: stdClass $grade

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

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

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

return: bool was it a success? (false will trigger a rollback)
param: context $oldcontext - the context for the old assignment
param: stdClass $oldassignment - the data for the old assignment
param: string $log - can be appended to by the upgrade

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

return: bool true or false - false will trigger a rollback
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 $grade The data record for the new grade
param: string $log Record upgrade messages in the log

format_for_gradebook(stdClass $grade)   X-Ref
If this plugin adds to the gradebook comments field, it must specify the format of the text
of the comment

Only one feedback plugin can push comments to the gradebook and that is chosen by the assignment
settings page.

return: int
param: stdClass $grade The grade

text_for_gradebook(stdClass $grade)   X-Ref
If this plugin adds to the gradebook comments field, it must format the text
of the comment

Only one feedback plugin can push comments to the gradebook and that is chosen by the assignment
settings page.

return: string
param: stdClass $grade The grade

files_for_gradebook(stdClass $grade)   X-Ref
Return any files this plugin wishes to save to the gradebook.

return: array
param: stdClass $grade The assign_grades object from the db

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

return: bool

is_empty(stdClass $grade)   X-Ref
Returns true if there are no feedback comments for the given grade.

return: bool
param: stdClass $grade

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)

get_external_parameters()   X-Ref
Return a description of external params suitable for uploading an feedback comment 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

rewrite_feedback_comments_urls(string $text, int $gradeid)   X-Ref
Convert encoded URLs in $text from the @@PLUGINFILE@@/... form to an actual URL.

param: string $text the Text to check
param: int $gradeid The grade ID which refers to the id in the gradebook

get_editor_options()   X-Ref
File format options.

return: array