Search moodle.org's
Developer Documentation

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.
  • Database enrolment plugin. This plugin synchronises enrolment and roles with external database table.

    Copyright: 2010 Petr Skoda {@link http://skodak.org}
    License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
    File Size: 1080 lines (46 kb)
    Included or required:0 times
    Referenced: 0 times
    Includes or requires: 0 files

    Defines 1 class


    Class: enrol_database_plugin  - X-Ref

    Database enrolment plugin implementation.

    can_delete_instance($instance)   X-Ref
    Is it possible to delete enrol instance via standard UI?

    param: stdClass $instance
    return: bool

    can_hide_show_instance($instance)   X-Ref
    Is it possible to hide/show enrol instance via standard UI?

    param: stdClass $instance
    return: bool

    allow_unenrol_user(stdClass $instance, stdClass $ue)   X-Ref
    Does this plugin allow manual unenrolment of a specific user?
    Yes, but only if user suspended...

    param: stdClass $instance course enrol instance
    param: stdClass $ue record from user_enrolments table
    return: bool - true means user with 'enrol/xxx:unenrol' may unenrol this user, false means nobody may touch this user enrolment

    sync_user_enrolments($user)   X-Ref
    Forces synchronisation of user enrolments with external database,
    does not create new courses.

    param: stdClass $user user record
    return: void

    sync_enrolments(progress_trace $trace, $onecourse = null)   X-Ref
    Forces synchronisation of all enrolments with external database.

    param: progress_trace $trace
    param: null|int $onecourse limit sync to one course only (used primarily in restore)
    return: int 0 means success, 1 db connect failure, 2 db read failure

    sync_courses(progress_trace $trace)   X-Ref
    Performs a full sync with external database.

    First it creates new courses if necessary, then
    enrols and unenrols users.

    param: progress_trace $trace
    return: int 0 means success, 1 db connect failure, 4 db read failure

    db_get_sql($table, array $conditions, array $fields, $distinct = false, $sort = "")   X-Ref
    No description

    db_init()   X-Ref
    Tries to make connection to the external database.

    return: null|ADONewConnection

    db_addslashes($text)   X-Ref
    No description

    db_encode($text)   X-Ref
    No description

    db_decode($text)   X-Ref
    No description

    restore_sync_course($course)   X-Ref
    Automatic enrol sync executed during restore.

    param: stdClass $course course record

    restore_instance(restore_enrolments_structure_step $step, stdClass $data, $course, $oldid)   X-Ref
    Restore instance and map settings.

    param: restore_enrolments_structure_step $step
    param: stdClass $data
    param: stdClass $course
    param: int $oldid

    restore_user_enrolment(restore_enrolments_structure_step $step, $data, $instance, $userid, $oldinstancestatus)   X-Ref
    Restore user enrolment.

    param: restore_enrolments_structure_step $step
    param: stdClass $data
    param: stdClass $instance
    param: int $oldinstancestatus
    param: int $userid

    restore_role_assignment($instance, $roleid, $userid, $contextid)   X-Ref
    Restore role assignment.

    param: stdClass $instance
    param: int $roleid
    param: int $userid
    param: int $contextid

    test_settings()   X-Ref
    Test plugin settings, print info to output.