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]
Library of functions specific to course/modedit.php and course API functions. The course API function calling them are course/lib.php:create_module() and update_module(). This file has been created has an alternative solution to a full refactor of course/modedit.php in order to create the course API functions.
Copyright: | 2013 Jerome Mouneyrac |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 877 lines (38 kb) |
Included or required: | 0 times |
Referenced: | 8 times |
Includes or requires: | 0 files |
add_moduleinfo($moduleinfo, $course, $mform = null) X-Ref |
Add course module. The function does not check user capabilities. The function creates course module, module instance, add the module to the correct section. It also trigger common action that need to be done after adding/updating a module. return: object the updated module info param: object $moduleinfo the moudle data param: object $course the course of the module param: object $mform this is required by an existing hack to deal with files during MODULENAME_add_instance() |
plugin_extend_coursemodule_edit_post_actions($moduleinfo, $course) X-Ref |
Hook for plugins to take action when a module is created or updated. return: stdClass moduleinfo updated by plugins. param: stdClass $moduleinfo the module info param: stdClass $course the course of the module |
edit_module_post_actions($moduleinfo, $course) X-Ref |
Common create/update module module actions that need to be processed as soon as a module is created/updaded. For example:create grade parent category, add outcomes, rebuild caches, regrade, save plagiarism settings... Please note this api does not trigger events as of MOODLE 2.6. Please trigger events before calling this api. return: object moduleinfo update with grading management info param: object $moduleinfo the module info param: object $course the course of the module |
set_moduleinfo_defaults($moduleinfo) X-Ref |
Set module info default values for the unset module attributs. return: object the completed module info param: object $moduleinfo the current known data of the module |
can_add_moduleinfo($course, $modulename, $section) X-Ref |
Check that the user can add a module. Also returns some information like the module, context and course section info. The fucntion create the course section if it doesn't exist. return: array list containing module, context, course section. param: object $course the course of the module param: object $modulename the module name param: object $section the section of the module |
can_update_moduleinfo($cm) X-Ref |
Check if user is allowed to update module info and returns related item/data to the module. return: array - list of course module, context, module, moduleinfo, and course section. param: object $cm course module |
update_moduleinfo($cm, $moduleinfo, $course, $mform = null) X-Ref |
Update the module info. This function doesn't check the user capabilities. It updates the course module and the module instance. Then execute common action to create/update module process (trigger event, rebuild cache, save plagiarism settings...). return: array list of course module and module info. param: object $cm course module param: object $moduleinfo module info param: object $course course of the module param: object $mform - the mform is required by some specific module in the function MODULE_update_instance(). This is due to a hack in this function. |
include_modulelib($modulename) X-Ref |
Include once the module lib file. param: string $modulename module name of the lib to include |
get_moduleinfo_data($cm, $course) X-Ref |
Get module information data required for updating the module. return: array required data for updating a module param: stdClass $cm course module object param: stdClass $course course object |
prepare_new_moduleinfo_data($course, $modulename, $section) X-Ref |
Prepare the standard module information for a new module instance. return: array module information about other required data param: stdClass $course course object param: string $modulename module name param: int $section section number |