See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401] [Versions 401 and 402] [Versions 401 and 403]
Moodleform.
Copyright: | Andrew Nicols <andrew@nicols.co.uk> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 1382 lines (63 kb) |
Included or required: | 0 times |
Referenced: | 2 times |
Includes or requires: | 0 files |
moodleform_mod:: (2 methods):
__construct()
moodleform_mod()
name:: (28 methods):
get_current()
get_instance()
get_section()
get_course()
get_coursemodule()
get_context()
get_features()
init_features()
data_preprocessing()
definition_after_data()
validation()
plugin_extend_coursemodule_validation()
set_data()
standard_coursemodule_elements()
add_rating_settings()
plugin_extend_coursemodule_standard_elements()
plugin_extend_coursemodule_definition_after_data()
add_completion_rules()
completion_rule_enabled()
standard_hidden_coursemodule_elements()
standard_grading_coursemodule_elements()
add_intro_editor()
standard_intro_elements()
add_action_buttons()
apply_admin_locked_flags()
apply_admin_defaults()
data_postprocessing()
get_data()
Class: moodleform_mod - X-Ref
This class adds extra methods to form wrapper specific to be used for module add / update formsget_current() X-Ref |
Get the current data for the form. return: stdClass|null |
get_instance() X-Ref |
Get the DB record for the current instance. return: stdClass|null |
get_section() X-Ref |
Get the course section number (relative). return: int |
get_course() X-Ref |
Get the course id. return: int |
get_coursemodule() X-Ref |
Get the course module object. return: stdClass|null |
get_context() X-Ref |
Return the course context for new modules, or the module context for existing modules. return: context |
get_features() X-Ref |
Return the features this module supports. return: stdClass |
init_features() X-Ref |
No description |
data_preprocessing(&$default_values) X-Ref |
Allows module to modify data returned by get_moduleinfo_data() or prepare_new_moduleinfo_data() before calling set_data() This method is also called in the bulk activity completion form. Only available on moodleform_mod. param: array $default_values passed by reference |
definition_after_data() X-Ref |
Each module which defines definition_after_data() must call this method using parent::definition_after_data(); |
validation($data, $files) X-Ref |
No description |
plugin_extend_coursemodule_validation($data) X-Ref |
Extend the validation function from any other plugin. param: stdClass $data The form data. return: array $errors The list of errors keyed by element name. |
set_data($default_values) X-Ref |
Load in existing data as form defaults. Usually new entry defaults are stored directly in form definition (new entry form); this function is used to load in data where values already exist and data is being edited (edit entry form). param: mixed $default_values object or array of default values |
standard_coursemodule_elements() X-Ref |
Adds all the standard elements to a form to edit the settings for an activity module. |
add_rating_settings($mform, int $itemnumber) X-Ref |
Add rating settings. param: moodleform_mod $mform param: int $itemnumber |
plugin_extend_coursemodule_standard_elements() X-Ref |
Plugins can extend the coursemodule settings form. |
plugin_extend_coursemodule_definition_after_data() X-Ref |
Plugins can extend the coursemodule settings form after the data is set. |
add_completion_rules() X-Ref |
Can be overridden to add custom completion rules if the module wishes them. If overriding this, you should also override completion_rule_enabled. <p> Just add elements to the form as needed and return the list of IDs. The system will call disabledIf and handle other behaviour for each returned ID. return: array Array of string IDs of added items, empty array if none |
completion_rule_enabled($data) X-Ref |
Called during validation. Override to indicate, based on the data, whether a custom completion rule is enabled (selected). param: array $data Input data (not yet validated) return: bool True if one or more rules is enabled, false if none are; |
standard_hidden_coursemodule_elements() X-Ref |
No description |
standard_grading_coursemodule_elements() X-Ref |
No description |
add_intro_editor($required=null, $customlabel=null) X-Ref |
Add an editor for an activity's introduction field. param: null $required Override system default for requiremodintro param: null $customlabel Override default label for editor |
standard_intro_elements($customlabel=null) X-Ref |
Add an editor for an activity's introduction field. param: null $customlabel Override default label for editor |
add_action_buttons($cancel=true, $submitlabel=null, $submit2label=null) X-Ref |
Overriding formslib's add_action_buttons() method, to add an extra submit "save changes and return" button. param: bool $cancel show cancel button param: string $submitlabel null means default, false means none, string is label text param: string $submit2label null means default, false means none, string is label text return: void |
apply_admin_locked_flags() X-Ref |
Get the list of admin settings for this module and apply any locked settings. This cannot happen in apply_admin_defaults because we do not the current values of the settings in that function because set_data has not been called yet. return: void |
apply_admin_defaults($datetimeoffsets = array() X-Ref |
Get the list of admin settings for this module and apply any defaults/advanced/locked/required settings. param: $datetimeoffsets array - If passed, this is an array of fieldnames => times that the return: void |
data_postprocessing($data) X-Ref |
Allows modules to modify the data returned by form get_data(). This method is also called in the bulk activity completion form. Only available on moodleform_mod. param: stdClass $data passed by reference |
get_data() X-Ref |
Return submitted data if properly submitted or returns NULL if validation fails or if there is no submitted data. Do not override this method, override data_postprocessing() instead. return: object submitted data; NULL if not valid or not submitted or cancelled |