Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Classes | Functions | Variables
enrollib.php File Reference

This library includes the basic parts of enrol api. More...

Classes

class  enrol_plugin
 Enrolment plugins abstract class. More...
 

Functions

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

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. More...
 
const ENROL_EXT_REMOVED_SUSPENDNOROLES 3
 When user disappears from external source, the enrolment is suspended and roles assigned by enrol instance are removed. More...
 
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. More...
 
const ENROL_INSTANCE_ENABLED 0
 Course enrol instance enabled. More...
 
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)
 

Detailed Description

This library includes the basic parts of enrol api.

It is available on each page.

@subpackage enrol

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later