Differences Between: [Versions 400 and 403]
This file contains the functions for assign_plugin abstract class
Copyright: | 2012 NetSpot {@link http://www.netspot.com.au} |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 705 lines (24 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
assign_plugin:: (46 methods):
__construct()
is_first()
is_last()
get_settings()
data_preprocessing()
save_settings()
set_error()
get_error()
get_type()
get_version()
get_requires()
save()
enable()
disable()
is_enabled()
get_form_elements_for_user()
get_form_elements()
view()
get_sort_order()
is_visible()
has_admin_settings()
set_config()
get_config()
get_config_file_areas()
view_summary()
set_editor_text()
set_editor_format()
get_editor_fields()
get_editor_text()
get_files()
get_editor_format()
can_upgrade()
upgrade_settings()
upgrade()
format_for_log()
delete_instance()
cron()
is_empty()
get_file_areas()
get_file_info()
view_page()
view_header()
has_user_summary()
get_external_parameters()
is_configurable()
get_config_for_external()
Class: assign_plugin - X-Ref
Abstract class for assign_plugin (submission/feedback).__construct(assign $assignment, $type) X-Ref |
Constructor for the abstract plugin type class param: assign $assignment param: string $type |
is_first() X-Ref |
Is this the first plugin in the list? return: bool |
is_last() X-Ref |
Is this the last plugin in the list? return: bool |
get_settings(MoodleQuickForm $mform) X-Ref |
This function should be overridden to provide an array of elements that can be added to a moodle form for display in the settings page for the assignment. return: $array param: MoodleQuickForm $mform The form to add the elements to |
data_preprocessing(&$defaultvalues) X-Ref |
Allows the plugin to update the defaultvalues passed in to the settings form (needed to set up draft areas for editor and filemanager elements) param: array $defaultvalues |
save_settings(stdClass $formdata) X-Ref |
The assignment subtype is responsible for saving it's own settings as the database table for the standard type cannot be modified. return: bool - on error the subtype should call set_error and return false. param: stdClass $formdata - the data submitted from the form |
set_error($msg) X-Ref |
Save the error message from the last error param: string $msg - the error description |
get_error() X-Ref |
What was the last error? return: string |
get_type() X-Ref |
Should return the type of this plugin. return: string - the type |
get_version() X-Ref |
Get the installed version of this plugin return: string |
get_requires() X-Ref |
Get the required moodle version for this plugin return: string |
save(stdClass $submissionorgrade, stdClass $data) X-Ref |
Save any custom data for this form submission return: bool - on error the subtype should call set_error and return false. param: stdClass $submissionorgrade - assign_submission or assign_grade. param: stdClass $data - the data submitted from the form |
enable() X-Ref |
Set this plugin to enabled return: bool |
disable() X-Ref |
Set this plugin to disabled return: bool |
is_enabled() X-Ref |
Allows hiding this plugin from the submission/feedback screen if it is not enabled. return: bool - if false - this plugin will not accept submissions / feedback |
get_form_elements_for_user($submissionorgrade, MoodleQuickForm $mform, stdClass $data, $userid) X-Ref |
Get any additional fields for the submission/grading form for this assignment. return: boolean - true if we added anything to the form param: mixed $submissionorgrade submission|grade - For submission plugins this is the submission data, param: MoodleQuickForm $mform - This is the form param: stdClass $data - This is the form data that can be modified for example by a filemanager element param: int $userid - This is the userid for the current submission. |
get_form_elements($submissionorgrade, MoodleQuickForm $mform, stdClass $data) X-Ref |
Get any additional fields for the submission/grading form for this assignment. This function is retained for backwards compatibility - new plugins should override {@link get_form_elements_for_user()}. return: boolean - true if we added anything to the form param: mixed $submissionorgrade submission|grade - For submission plugins this is the submission data, param: MoodleQuickForm $mform - This is the form param: stdClass $data - This is the form data that can be modified for example by a filemanager element |
view(stdClass $submissionorgrade) X-Ref |
Should not output anything - return the result as a string so it can be consumed by webservices. return: string - return a string representation of the submission in full param: stdClass $submissionorgrade assign_submission or assign_grade |
get_sort_order() X-Ref |
Get the numerical sort order for this plugin return: int |
is_visible() X-Ref |
Is this plugin enaled? return: bool |
has_admin_settings() X-Ref |
Has this plugin got a custom settings.php file? return: bool |
set_config($name, $value) X-Ref |
Set a configuration value for this plugin return: bool param: string $name The config key param: string $value The config value |
get_config($setting = null) X-Ref |
Get a configuration value for this plugin return: mixed string | false param: mixed $setting The config key (string) or null |
get_config_file_areas() X-Ref |
Get a list of file areas associated with the plugin configuration. This is used for backup/restore. return: array names of the fileareas, can be an empty array |
view_summary(stdClass $submissionorgrade, & $showviewlink) X-Ref |
Should not output anything - return the result as a string so it can be consumed by webservices. return: string - return a string representation of the submission in full param: stdClass $submissionorgrade assign_submission or assign_grade param: bool $showviewlink Modifed to return whether or not to show a link to the full submission/feedback |
set_editor_text($name, $value, $submissionorgradeid) X-Ref |
Given a field name and value should update the text for this field in the plugins submission or grade return: bool - true if the value was updated param: string $name Name of the field. param: string $value Updated text param: int $submissionorgradeid The id of the submission or grade |
set_editor_format($name, $format, $submissionorgradeid) X-Ref |
Given a field name and value should update the format for this field in the plugins submission or grade return: bool - true if the value was updated param: string $name Name of the field. param: int $format Updated format. param: int $submissionorgradeid The id of the submission or grade. |
get_editor_fields() X-Ref |
Return a list of the fields that can be exported or imported via text. return: array - The list of field names (strings) and descriptions. ($name => $description) |
get_editor_text($name, $submissionorgradeid) X-Ref |
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. return: string - The text for the editor field param: string $name Name of the field. param: int $submissionorgradeid The id of the submission or grade |
get_files(stdClass $submissionorgrade, stdClass $user) X-Ref |
Produce a list of files suitable for export that represent this feedback or submission return: array - return an array of files indexed by filename param: stdClass $submissionorgrade assign_submission or assign_grade param: stdClass $user The user record for the current submission. |
get_editor_format($name, $submissionid) X-Ref |
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. return: int - The format for the editor field param: string $name Name of the field. param: int $submissionid The id of the submission |
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 The old assignment subtype param: int $version The old assignment version |
upgrade_settings(context $oldcontext, stdClass $oldassignment, & $log) X-Ref |
Upgrade the settings from the old assignment to the new one return: bool true or false - false will trigger a rollback param: context $oldcontext The context for the old assignment module param: stdClass $oldassignment The data record for the old assignment param: string $log Record upgrade messages in the log |
upgrade(context $oldcontext,stdClass $oldassignment,stdClass $oldsubmissionorgrade,stdClass $submissionorgrade,& $log) X-Ref |
Upgrade the submission from the old assignment to the new one return: boolean true or false - false will trigger a rollback param: context $oldcontext The data record for the old context param: stdClass $oldassignment The data record for the old assignment param: stdClass $oldsubmissionorgrade The data record for the old submission param: stdClass $submissionorgrade assign_submission or assign_grade The new submission or grade param: string $log Record upgrade messages in the log |
format_for_log(stdClass $submissionorgrade) X-Ref |
Formatting for log info return: string param: stdClass $submissionorgrade assign_submission or assign_grade The new submission or grade |
delete_instance() X-Ref |
The assignment has been deleted - remove the plugin specific data return: bool |
cron() X-Ref |
Run cron for this plugin |
is_empty(stdClass $submissionorgrade) X-Ref |
Is this assignment plugin empty? (ie no submission or feedback) return: bool param: stdClass $submissionorgrade assign_submission or assign_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_file_info($browser, $filearea, $itemid, $filepath, $filename) X-Ref |
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. return: file_info_stored param: file_browser $browser param: string $filearea param: int $itemid param: string $filepath param: string $filename |
view_page($action) X-Ref |
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 return: string param: string $action The plugin specified action |
view_header() X-Ref |
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: string |
has_user_summary() X-Ref |
If this plugin should not include a column in the grading table or a row on the summary page then return false return: bool |
get_external_parameters() X-Ref |
If this plugin can participate in a webservice (save_submission or save_grade), return a list of external_params to be included in the definition of that webservice. return: external_description|null |
is_configurable() X-Ref |
If true, the plugin will appear on the module settings page and can be enabled/disabled per assignment instance. return: bool |
get_config_for_external() X-Ref |
Return the plugin configs for external functions, in some cases the configs will need formatting or be returned only if the current user has some capabilities enabled. return: array the list of settings |