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.
  • Differences Between: [Versions 311 and 400] [Versions 37 and 311]

    Manual enrolment plugin main library file.

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

    Defines 1 class


    Class: enrol_manual_plugin  - X-Ref

    roles_protected()   X-Ref
    No description

    allow_enrol(stdClass $instance)   X-Ref
    No description

    allow_unenrol(stdClass $instance)   X-Ref
    No description

    allow_manage(stdClass $instance)   X-Ref
    No description

    get_manual_enrol_link($instance)   X-Ref
    Returns link to manual enrol UI if exists.
    Does the access control tests automatically.

    param: stdClass $instance
    return: moodle_url

    can_add_instance($courseid)   X-Ref
    Return true if we can add a new instance to this course.

    param: int $courseid
    return: boolean

    get_action_icons(stdClass $instance)   X-Ref
    Returns edit icons for the page with list of instances.

    param: stdClass $instance
    return: array

    add_default_instance($course)   X-Ref
    Add new instance of enrol plugin with default settings.

    param: stdClass $course
    return: int id of new instance, null if can not be created

    add_instance($course, array $fields = NULL)   X-Ref
    Add new instance of enrol plugin.

    param: stdClass $course
    param: array instance fields
    return: int id of new instance, null if can not be created

    update_instance($instance, $data)   X-Ref
    Update instance of enrol plugin.

    param: stdClass $instance
    param: stdClass $data modified instance fields
    return: boolean

    get_manual_enrol_button(course_enrolment_manager $manager)   X-Ref
    Returns a button to manually enrol users through the manual enrolment plugin.

    By default the first manual enrolment plugin instance available in the course is used.
    If no manual enrolment instances exist within the course then false is returned.

    This function also adds a quickenrolment JS ui to the page so that users can be enrolled
    via AJAX.

    param: course_enrolment_manager $manager
    return: enrol_user_button

    sync(progress_trace $trace, $courseid = null)   X-Ref
    Sync all meta course links.

    param: progress_trace $trace
    param: int $courseid one course, empty mean all
    return: int 0 means ok, 1 means error, 2 means plugin disabled

    get_enroller($instanceid)   X-Ref
    Returns the user who is responsible for manual enrolments in given instance.

    Usually it is the first editing teacher - the person with "highest authority"
    as defined by sort_by_roleassignment_authority() having 'enrol/manual:manage'
    capability.

    param: int $instanceid enrolment instance id
    return: stdClass user record

    get_bulk_operations(course_enrolment_manager $manager)   X-Ref
    The manual plugin has several bulk operations that can be performed.

    param: course_enrolment_manager $manager
    return: array

    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

    restore_group_member($instance, $groupid, $userid)   X-Ref
    Restore user group membership.

    param: stdClass $instance
    param: int $groupid
    param: int $userid

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

    param: object $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

    enrol_cohort(stdClass $instance, $cohortid, $roleid = null, $timestart = 0, $timeend = 0, $status = null, $recovergrades = null)   X-Ref
    Enrol all not enrolled cohort members into course via enrol instance.

    param: stdClass $instance
    param: int $cohortid
    param: int $roleid optional role id
    param: int $timestart 0 means unknown
    param: int $timeend 0 means forever
    param: int $status default to ENROL_USER_ACTIVE for new enrolments, no change by default in updates
    param: bool $recovergrades restore grade history
    return: int The number of enrolled cohort users

    use_standard_editing_ui()   X-Ref
    We are a good plugin and don't invent our own UI/validation code path.

    return: boolean

    get_status_options()   X-Ref
    Return an array of valid options for the status.

    return: array

    get_roleid_options($instance, $context)   X-Ref
    Return an array of valid options for the roleid.

    param: stdClass $instance
    param: context $context
    return: array

    get_expirynotify_options()   X-Ref
    Return an array of valid options for the expirynotify.

    return: array

    edit_instance_form($instance, MoodleQuickForm $mform, $context)   X-Ref
    Add elements to the edit instance form.

    param: stdClass $instance
    param: MoodleQuickForm $mform
    param: context $context
    return: bool

    edit_instance_validation($data, $files, $instance, $context)   X-Ref
    Perform custom validation of the data used to edit the instance.

    param: array $data array of ("fieldname"=>value) of submitted data
    param: array $files array of uploaded files "element_name"=>tmp_file_path
    param: object $instance The instance loaded from the DB
    param: context $context The context of the instance we are editing
    return: array of "element_name"=>"error_description" if there are errors,
    return: void

    enrol_manual_output_fragment_enrol_users_form($args)   X-Ref
    Serve the manual enrol users form as a fragment.

    param: array $args List of named arguments for the fragment loader.
    return: string