Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]
Module generator base class.
Copyright: | 2012 Petr Skoda {@link http://skodak.org} |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 304 lines (12 kb) |
Included or required: | 1 time |
Referenced: | 0 times |
Includes or requires: | 0 files |
testing_module_generator:: (2 methods):
reset()
get_modulename()
name:: (5 methods):
precreate_course_module()
post_add_instance()
prepare_moduleinfo_record()
create_instance()
create_content()
name:: (5 methods):
precreate_course_module()
post_add_instance()
prepare_moduleinfo_record()
create_instance()
create_content()
Class: testing_module_generator - X-Ref
Module generator base class.reset() X-Ref |
To be called from data reset code only, do not use in tests. return: void |
get_modulename() X-Ref |
Returns module name return: string name of module that this class describes |
precreate_course_module($courseid, array $options) X-Ref |
Create course module and link it to course Since 2.6 it is recommended to use function add_moduleinfo() to create a module. return: integer $cm instance id param: integer $courseid param: array $options section, visible |
post_add_instance($id, $cmid) X-Ref |
Called after *_add_instance() Since 2.6 it is recommended to use function add_moduleinfo() to create a module. return: stdClass module instance param: int $id param: int $cmid |
prepare_moduleinfo_record($record, $options) X-Ref |
Merges together arguments $record and $options and fills default module fields that are shared by all module types param: object|array $record fields (different from defaults) for this module param: null|array $options for backward-compatibility this may include fields from course_modules |
create_instance($record = null, array $options = null) X-Ref |
Creates an instance of the module for testing purposes. Module type will be taken from the class name. Each module type may overwrite this function to add other default values used by it. return: stdClass record from module-defined table with additional field param: array|stdClass $record data for module being generated. Requires 'course' key param: null|array $options general options for course module. Since 2.6 it is |
create_content($instance, $record = array() X-Ref |
Generates a piece of content for the module. User is usually taken from global $USER variable. return: stdClass generated object param: stdClass $instance object returned from create_instance() call param: stdClass|array $record |
precreate_course_module($courseid, array $options) X-Ref |
Create course module and link it to course Since 2.6 it is recommended to use function add_moduleinfo() to create a module. return: integer $cm instance id param: integer $courseid param: array $options section, visible |
post_add_instance($id, $cmid) X-Ref |
Called after *_add_instance() Since 2.6 it is recommended to use function add_moduleinfo() to create a module. return: stdClass module instance param: int $id param: int $cmid |
prepare_moduleinfo_record($record, $options) X-Ref |
Merges together arguments $record and $options and fills default module fields that are shared by all module types param: object|array $record fields (different from defaults) for this module param: null|array $options for backward-compatibility this may include fields from course_modules |
create_instance($record = null, array $options = null) X-Ref |
Creates an instance of the module for testing purposes. Module type will be taken from the class name. Each module type may overwrite this function to add other default values used by it. return: stdClass record from module-defined table with additional field param: array|stdClass $record data for module being generated. Requires 'course' key param: null|array $options general options for course module. Since 2.6 it is |
create_content($instance, $record = array() X-Ref |
Generates a piece of content for the module. User is usually taken from global $USER variable. return: stdClass generated object param: stdClass $instance object returned from create_instance() call param: stdClass|array $record |