See Release Notes
Long Term Support Release
Differences Between: [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 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: | 843 lines (36 kb) |
Included or required: | 0 times |
Referenced: | 9 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. 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() return: object the updated module info |
plugin_extend_coursemodule_edit_post_actions($moduleinfo, $course) X-Ref |
Hook for plugins to take action when a module is created or updated. param: stdClass $moduleinfo the module info param: stdClass $course the course of the module return: stdClass moduleinfo updated by plugins. |
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. param: object $moduleinfo the module info param: object $course the course of the module return: object moduleinfo update with grading management info |
set_moduleinfo_defaults($moduleinfo) X-Ref |
Set module info default values for the unset module attributs. param: object $moduleinfo the current known data of the module return: object the completed module info |
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. param: object $course the course of the module param: object $modulename the module name param: object $section the section of the module return: array list containing module, context, course section. |
can_update_moduleinfo($cm) X-Ref |
Check if user is allowed to update module info and returns related item/data to the module. param: object $cm course module return: array - list of course module, context, module, moduleinfo, and course section. |
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...). 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. return: array list of course module and module info. |
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. param: stdClass $cm course module object param: stdClass $course course object return: array required data for updating a module |
prepare_new_moduleinfo_data($course, $modulename, $section) X-Ref |
Prepare the standard module information for a new module instance. param: stdClass $course course object param: string $modulename module name param: int $section section number return: array module information about other required data |