Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 39 and 401] [Versions 401 and 402] [Versions 401 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.

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

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

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)
return: mixed - A html string containing the html form elements required for quickgrading

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

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

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

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

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.

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

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

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

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

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

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

param: stdClass $data
return: bool

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

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

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.

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

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

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

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

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

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

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

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

param: stdClass $grade
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 context for the old assignment
param: stdClass $oldassignment - the data for the old assignment
param: string $log - can be appended to by the upgrade
return: bool was it a success? (false will trigger a rollback)

upgrade(context $oldcontext,stdClass $oldassignment,stdClass $oldsubmission,stdClass $grade,& $log)   X-Ref
Upgrade the feedback 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 $grade The data record for the new grade
param: string $log Record upgrade messages in the log
return: bool true or false - false will trigger a rollback

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.

param: stdClass $grade The grade
return: int

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.

param: stdClass $grade The grade
return: string

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

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

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.

param: stdClass $grade
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)

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