Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
enrollib.php File Reference

Classes

class  enrol_plugin
 Enrolment plugins abstract class. More...
 

Functions

 count_enrolled_users (context $context, $withcapability='', $groupids=0, $onlyactive=false)
 Counts list of users enrolled into course (as per above function)
 
 enrol_accessing_via_instance (stdClass $instance)
 Is current user accessing course via this enrolment method?
 
 enrol_add_course_navigation (navigation_node $coursenode, $course)
 Add navigation nodes.
 
 enrol_calculate_duration ($timestart, $timeend)
 Calculate duration base on start time and end time.
 
 enrol_check_plugins ($user, bool $ignoreintervalcheck=true)
 Check all the login enrolment information for the given user object by querying the enrolment plugins This function may be very slow, use only once after log-in or login-as.
 
 enrol_course_delete ($course, $userid=null)
 Called when course is about to be deleted.
 
 enrol_course_edit_form (MoodleQuickForm $mform, $data, $context)
 This function adds necessary enrol plugins UI into the course edit form.
 
 enrol_course_edit_validation (array $data, $context)
 Validate course edit form data.
 
 enrol_course_updated ($inserted, $course, $data)
 Update enrol instances after course edit form submission.
 
 enrol_get_all_users_courses ($userid, $onlyactive=false, $fields=null, $sort=null)
 Returns list of courses user is enrolled into without performing any capability checks.
 
 enrol_get_course_by_user_enrolment_id ($ueid)
 Returns the course where a user enrolment belong to.
 
 enrol_get_course_description_texts ($course)
 Returns course enrolment detailed information.
 
 enrol_get_course_info_icons ($course, array $instances=NULL)
 Returns course enrolment information icons.
 
 enrol_get_course_users ($courseid=false, $onlyactive=false, $usersfilter=[], $uefilter=[], $usergroups=[])
 Return all users enrolled in a course.
 
 enrol_get_course_users_roles (int $courseid)
 Returns list of roles per users into course.
 
 enrol_get_courses_sortingsql ($sort=null)
 Returns SQL ORDER arguments which reflect the admin settings to sort my courses.
 
 enrol_get_enrolment_end ($courseid, $userid)
 This function returns the end of current active user enrolment.
 
 enrol_get_instances ($courseid, $enabled)
 Returns enrolment instances in given course.
 
 enrol_get_my_courses ($fields=null, $sort=null, $limit=0, $courseids=[], $allaccessible=false, $offset=0, $excludecourses=[])
 Returns list of courses current $USER is enrolled in and can access.
 
 enrol_get_period_list ()
 Get the list of options for the enrolment period dropdown.
 
 enrol_get_plugin ($name)
 Returns instance of enrol plugin.
 
 enrol_get_plugins ($enabled)
 Returns instances of enrol plugins.
 
moodle_database enrol_get_shared_courses ($user1, $user2, $preloadcontexts=false, $checkexistsonly=false)
 Returns any courses shared by the two users.
 
 enrol_get_users_courses ($userid, $onlyactive=false, $fields=null, $sort=null)
 Returns list of courses user is enrolled into.
 
 enrol_is_enabled ($enrol)
 Checks if a given plugin is in the list of enabled enrolment plugins.
 
 enrol_output_fragment_user_enrolment_form ($args)
 Serve the user enrolment form as a fragment.
 
 enrol_selfenrol_available ($courseid)
 Is there a chance users might self enrol.
 
 enrol_send_welcome_email_options ()
 Send welcome email "from" options.
 
 enrol_sharing_course ($user1, $user2)
 Do these two students share any course?
 
 enrol_try_internal_enrol ($courseid, $userid, $roleid=null, $timestart=0, $timeend=0)
 Try to enrol user via default internal auth plugin.
 
 enrol_user_delete ($user)
 Called when user is about to be deleted.
 
 enrol_user_sees_own_courses ($user=null)
 Can user access at least one enrolled course?
 
 get_enrolled_join (context $context, $useridcolumn, $onlyactive=false, $onlysuspended=false, $enrolid=0)
 Returns array with sql joins and parameters returning all ids of users enrolled into course.
 
 get_enrolled_sql (context $context, $withcapability='', $groupids=0, $onlyactive=false, $onlysuspended=false, $enrolid=0)
 Returns array with sql code and parameters returning all ids of users enrolled into course.
 
 get_enrolled_users (context $context, $withcapability='', $groupids=0, $userfields='u.*', $orderby=null, $limitfrom=0, $limitnum=0, $onlyactive=false)
 Returns list of users enrolled into course.
 
 get_enrolled_with_capabilities_join (context $context, $prefix='', $capability='', $groupids=0, $onlyactive=false, $onlysuspended=false, $enrolid=0)
 Returns an array of joins, wheres and params that will limit the group of users to only those enrolled and with given capability (if specified).
 
 is_enrolled (context $context, $user=null, $withcapability='', $onlyactive=false)
 Returns true if user is enrolled (is participating) in course this is intended for students and teachers.
 

Variables

const ENROL_ACTION_EDIT 'editenrolment'
 Edit enrolment action.
 
const ENROL_ACTION_UNENROL 'unenrol'
 Unenrol action.
 
const ENROL_DO_NOT_SEND_EMAIL 0
 Do not send email.
 
const ENROL_EXT_REMOVED_KEEP 1
 When user disappears from external source, the enrolment is kept as is - one way sync.
 
const ENROL_EXT_REMOVED_SUSPEND 2
 When user disappears from external source, user enrolment is suspended, roles are kept as is.
 
const ENROL_EXT_REMOVED_SUSPENDNOROLES 3
 When user disappears from external source, the enrolment is suspended and roles assigned by enrol instance are removed.
 
const ENROL_EXT_REMOVED_UNENROL 0
 When user disappears from external source, the enrolment is completely removed.
 
const ENROL_INSTANCE_DISABLED 1
 Course enrol instance disabled, user may enter course if other enrol instance enabled.
 
const ENROL_INSTANCE_ENABLED 0
 Course enrol instance enabled.
 
const ENROL_MAX_TIMESTAMP 2147483647
 The timestamp indicating forever.
 
const ENROL_REQUIRE_LOGIN_CACHE_PERIOD 1800
 
const ENROL_RESTORE_TYPE 'enrolrestore'
 
const ENROL_SEND_EMAIL_FROM_COURSE_CONTACT 1
 Send email from course contact.
 
const ENROL_SEND_EMAIL_FROM_KEY_HOLDER 2
 Send email from enrolment key holder.
 
const ENROL_SEND_EMAIL_FROM_NOREPLY 3
 Send email from no reply address.
 
const ENROL_USER_ACTIVE 0
 User is active participant (used in user_enrolments->status)
 
const ENROL_USER_SUSPENDED 1
 User participation in course is suspended (used in user_enrolments->status)