Developer Documentation

  • Bug fixes for general core bugs in 2.8.x ended 9 November 2015 (12 months).
  • Bug fixes for security issues in 2.8.x ended 9 May 2016 (18 months).
  • minimum PHP 5.4.4 (always use latest PHP 5.4.x or 5.5.x on Windows -, PHP 7 is NOT supported
  • /course/ -> modlib.php (source)

    Differences Between: [Versions 28 and 29] [Versions 28 and 30] [Versions 28 and 31] [Versions 28 and 32] [Versions 28 and 33] [Versions 28 and 34] [Versions 28 and 35] [Versions 28 and 36] [Versions 28 and 37]

    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: GNU GPL v3 or later
    File Size: 561 lines (23 kb)
    Included or required:0 times
    Referenced: 4 times
    Includes or requires: 0 files

    Defines 7 functions

    Functions that are not part of a class:

    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()

    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

    Search This Site: