Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402] [Versions 402 and 403]
This library includes the basic parts of enrol api. It is available on each page.
Copyright: | 2010 Petr Skoda {@link http://skodak.org} |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 3362 lines (125 kb) |
Included or required: | 3 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
enrol_plugin:: (64 methods):
get_name()
get_instance_name()
get_info_icons()
get_description_text()
load_config()
get_config()
set_config()
roles_protected()
allow_enrol()
allow_unenrol()
allow_unenrol_user()
allow_manage()
show_enrolme_link()
is_self_enrol_available()
try_autoenrol()
try_guestaccess()
enrol_user()
update_user_enrol()
unenrol_user()
sync_user_enrolments()
use_standard_editing_ui()
can_add_instance()
can_edit_instance()
get_newinstance_link()
instance_deleteable()
can_delete_instance()
can_hide_show_instance()
get_manual_enrol_link()
get_unenrolself_link()
course_edit_form()
edit_instance_form()
edit_instance_validation()
course_edit_validation()
course_updated()
add_instance()
update_instance()
add_default_instance()
update_status()
delete_instance()
enrol_page_hook()
can_self_enrol()
get_enrol_info()
add_course_navigation()
get_action_icons()
is_cron_required()
cron()
user_delete()
get_manual_enrol_button()
get_user_enrolment_actions()
has_bulk_operations()
get_bulk_operations()
process_expirations()
send_expiry_notifications()
get_enroller()
notify_expiry_enrolled()
notify_expiry_enroller()
backup_annotate_custom_fields()
restore_sync_course()
restore_instance()
restore_user_enrolment()
restore_role_assignment()
restore_group_member()
get_instance_defaults()
validate_param_types()
Class: enrol_plugin - X-Ref
Enrolment plugins abstract class.get_name() X-Ref |
Returns name of this enrol plugin return: string |
get_instance_name($instance) X-Ref |
Returns localised name of enrol instance param: object $instance (null is accepted too) return: string |
get_info_icons(array $instances) X-Ref |
Returns optional enrolment information icons. This is used in course list for quick overview of enrolment options. We are not using single instance parameter because sometimes we might want to prevent icon repetition when multiple instances of one type exist. One instance may also produce several icons. param: array $instances all enrol instances of this type in one course return: array of pix_icon |
get_description_text($instance) X-Ref |
Returns optional enrolment instance description text. This is used in detailed course information. param: object $instance return: string short html text |
load_config() X-Ref |
Makes sure config is loaded and cached. return: void |
get_config($name, $default = NULL) X-Ref |
Returns plugin config value param: string $name param: string $default value if config does not exist yet return: string value or default |
set_config($name, $value) X-Ref |
Sets plugin config value param: string $name name of config param: string $value string config value, null means delete return: string value |
roles_protected() X-Ref |
Does this plugin assign protected roles are can they be manually removed? return: bool - false means anybody may tweak roles, it does not use itemid and component when assigning roles |
allow_enrol(stdClass $instance) X-Ref |
Does this plugin allow manual enrolments? param: stdClass $instance course enrol instance return: bool - true means user with 'enrol/xxx:enrol' may enrol others freely, false means nobody may add more enrolments manually |
allow_unenrol(stdClass $instance) X-Ref |
Does this plugin allow manual unenrolment of all users? All plugins allowing this must implement 'enrol/xxx:unenrol' capability param: stdClass $instance course enrol instance return: bool - true means user with 'enrol/xxx:unenrol' may unenrol others freely, false means nobody may touch user_enrolments |
allow_unenrol_user(stdClass $instance, stdClass $ue) X-Ref |
Does this plugin allow manual unenrolment of a specific user? All plugins allowing this must implement 'enrol/xxx:unenrol' capability This is useful especially for synchronisation plugins that do suspend instead of full unenrolment. param: stdClass $instance course enrol instance param: stdClass $ue record from user_enrolments table, specifies user return: bool - true means user with 'enrol/xxx:unenrol' may unenrol this user, false means nobody may touch this user enrolment |
allow_manage(stdClass $instance) X-Ref |
Does this plugin allow manual changes in user_enrolments table? All plugins allowing this must implement 'enrol/xxx:manage' capability param: stdClass $instance course enrol instance return: bool - true means it is possible to change enrol period and status in user_enrolments table |
show_enrolme_link(stdClass $instance) X-Ref |
Does this plugin support some way to user to self enrol? param: stdClass $instance course enrol instance return: bool - true means show "Enrol me in this course" link in course UI |
is_self_enrol_available(stdClass $instance) X-Ref |
Does this plugin support some way to self enrol? This function doesn't check user capabilities. Use can_self_enrol to check capabilities. param: stdClass $instance enrolment instance return: bool - true means "Enrol me in this course" link could be available. |
try_autoenrol(stdClass $instance) X-Ref |
Attempt to automatically enrol current user in course without any interaction, calling code has to make sure the plugin and instance are active. This should return either a timestamp in the future or false. param: stdClass $instance course enrol instance return: bool|int false means not enrolled, integer means timeend |
try_guestaccess(stdClass $instance) X-Ref |
Attempt to automatically gain temporary guest access to course, calling code has to make sure the plugin and instance are active. This should return either a timestamp in the future or false. param: stdClass $instance course enrol instance return: bool|int false means no guest access, integer means timeend |
enrol_user(stdClass $instance, $userid, $roleid = null, $timestart = 0, $timeend = 0, $status = null, $recovergrades = null) X-Ref |
Enrol user into course via enrol instance. param: stdClass $instance param: int $userid 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: void |
update_user_enrol(stdClass $instance, $userid, $status = NULL, $timestart = NULL, $timeend = NULL) X-Ref |
Store user_enrolments changes and trigger event. param: stdClass $instance param: int $userid param: int $status param: int $timestart param: int $timeend return: void |
unenrol_user(stdClass $instance, $userid) X-Ref |
Unenrol user from course, the last unenrolment removes all remaining roles. param: stdClass $instance param: int $userid return: void |
sync_user_enrolments($user) X-Ref |
Forces synchronisation of user enrolments. This is important especially for external enrol plugins, this function is called for all enabled enrol plugins right after every user login. param: object $user user record return: void |
use_standard_editing_ui() X-Ref |
This returns false for backwards compatibility, but it is really recommended. return: boolean |
can_add_instance($courseid) X-Ref |
Return whether or not, given the current state, it is possible to add a new instance of this enrolment plugin to the course. Default implementation is just for backwards compatibility. param: int $courseid return: boolean |
can_edit_instance($instance) X-Ref |
Return whether or not, given the current state, it is possible to edit an instance of this enrolment plugin in the course. Used by the standard editing UI to generate a link to the edit instance form if editing is allowed. param: stdClass $instance return: boolean |
get_newinstance_link($courseid) X-Ref |
Returns link to page which may be used to add new instance of enrolment plugin in course. param: int $courseid return: moodle_url page url |
instance_deleteable($instance) X-Ref |
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 |
get_manual_enrol_link($instance) X-Ref |
Returns link to manual enrol UI if exists. Does the access control tests automatically. param: object $instance return: moodle_url |
get_unenrolself_link($instance) X-Ref |
Returns list of unenrol links for all enrol instances in course. param: stdClass $instance return: moodle_url or NULL if self unenrolment not supported |
course_edit_form($instance, MoodleQuickForm $mform, $data, $context) X-Ref |
Adds enrol instance UI to course edit form param: object $instance enrol instance or null if does not exist yet param: MoodleQuickForm $mform param: object $data param: object $context context of existing course or parent category if course does not exist return: void |
edit_instance_form($instance, MoodleQuickForm $mform, $context) X-Ref |
Adds form elements to add/edit instance form. param: object $instance enrol instance or null if does not exist yet param: MoodleQuickForm $mform param: context $context return: void |
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 data 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, |
course_edit_validation($instance, array $data, $context) X-Ref |
Validates course edit form data param: object $instance enrol instance or null if does not exist yet param: array $data param: object $context context of existing course or parent category if course does not exist return: array errors array |
course_updated($inserted, $course, $data) X-Ref |
Called after updating/inserting course. param: bool $inserted true if course just inserted param: object $course param: object $data form data return: void |
add_instance($course, array $fields = NULL) X-Ref |
Add new instance of enrol plugin. param: object $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 |
add_default_instance($course) X-Ref |
Add new instance of enrol plugin with default settings, called when adding new instance manually or when adding new course. Not all plugins support this. param: object $course return: int id of new instance or null if no default supported |
update_status($instance, $newstatus) X-Ref |
Update instance status Override when plugin needs to do some action when enabled or disabled. param: stdClass $instance param: int $newstatus ENROL_INSTANCE_ENABLED, ENROL_INSTANCE_DISABLED return: void |
delete_instance($instance) X-Ref |
Delete course enrol plugin instance, unenrol all users. param: object $instance return: void |
enrol_page_hook(stdClass $instance) X-Ref |
Creates course enrol form, checks if form submitted and enrols user if necessary. It can also redirect. param: stdClass $instance return: string html text, usually a form in a text box |
can_self_enrol(stdClass $instance, $checkuserenrolment = true) X-Ref |
Checks if user can self enrol. param: stdClass $instance enrolment instance param: bool $checkuserenrolment if true will check if user enrolment is inactive. return: bool|string true if successful, else error message or false |
get_enrol_info(stdClass $instance) X-Ref |
Return information for enrolment instance containing list of parameters required for enrolment, name of enrolment plugin etc. param: stdClass $instance enrolment instance return: stdClass|null instance info. |
add_course_navigation($instancesnode, stdClass $instance) X-Ref |
Adds navigation links into course admin block. By defaults looks for manage links only. param: navigation_node $instancesnode param: stdClass $instance return: void |
get_action_icons(stdClass $instance) X-Ref |
Returns edit icons for the page with list of instances param: stdClass $instance return: array |
is_cron_required() X-Ref |
Reads version.php and determines if it is necessary to execute the cron job now. return: bool |
cron() X-Ref |
Called for all enabled enrol plugins that returned true from is_cron_required(). return: void |
user_delete($user) X-Ref |
Called when user is about to be deleted param: object $user return: void |
get_manual_enrol_button(course_enrolment_manager $manager) X-Ref |
Returns an enrol_user_button that takes the user to a page where they are able to enrol users into the managers course through this plugin. Optional: If the plugin supports manual enrolments it can choose to override this otherwise it shouldn't param: course_enrolment_manager $manager return: enrol_user_button|false |
get_user_enrolment_actions(course_enrolment_manager $manager, $ue) X-Ref |
Gets an array of the user enrolment actions param: course_enrolment_manager $manager param: stdClass $ue return: array An array of user_enrolment_actions |
has_bulk_operations(course_enrolment_manager $manager) X-Ref |
Returns true if the plugin has one or more bulk operations that can be performed on user enrolments. param: course_enrolment_manager $manager return: bool |
get_bulk_operations(course_enrolment_manager $manager) X-Ref |
Return an array of enrol_bulk_enrolment_operation objects that define the bulk actions that can be performed on user enrolments by the plugin. param: course_enrolment_manager $manager return: array |
process_expirations(progress_trace $trace, $courseid = null) X-Ref |
Do any enrolments need expiration processing. Plugins that want to call this functionality must implement 'expiredaction' config setting. param: progress_trace $trace param: int $courseid one course, empty mean all return: bool true if any data processed, false if not |
send_expiry_notifications($trace) X-Ref |
Send expiry notifications. Plugin that wants to have expiry notification MUST implement following: - expirynotifyhour plugin setting, - configuration options in instance edit form (expirynotify, notifyall and expirythreshold), - notification strings (expirymessageenrollersubject, expirymessageenrollerbody, expirymessageenrolledsubject and expirymessageenrolledbody), - expiry_notification provider in db/messages.php, - upgrade code that sets default thresholds for existing courses (should be 1 day), - something that calls this method, such as cron. param: progress_trace $trace (accepts bool for backwards compatibility only) |
get_enroller($instanceid) X-Ref |
Returns the user who is responsible for enrolments for given instance. Override if plugin knows anybody better than admin. param: int $instanceid enrolment instance id return: stdClass user record |
notify_expiry_enrolled($user, $ue, progress_trace $trace) X-Ref |
Notify user about incoming expiration of their enrolment, it is called only if notification of enrolled users (aka students) is enabled in course. This is executed only once for each expiring enrolment right at the start of the expiration threshold. param: stdClass $user param: stdClass $ue param: progress_trace $trace |
notify_expiry_enroller($eid, $users, progress_trace $trace) X-Ref |
Notify person responsible for enrolments that some user enrolments will be expired soon, it is called only if notification of enrollers (aka teachers) is enabled in course. This is called repeatedly every day for each course if there are any pending expiration in the expiration threshold. param: int $eid param: array $users param: progress_trace $trace |
backup_annotate_custom_fields(backup_enrolments_execution_step $step, stdClass $enrol) X-Ref |
Backup execution step hook to annotate custom fields. param: backup_enrolments_execution_step $step param: stdClass $enrol |
restore_sync_course($course) X-Ref |
Automatic enrol sync executed during restore. Useful for automatic sync by course->idnumber or course category. 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 |
restore_group_member($instance, $groupid, $userid) X-Ref |
Restore user group membership. param: stdClass $instance param: int $groupid param: int $userid |
get_instance_defaults() X-Ref |
Returns defaults for new instances. return: array |
validate_param_types($data, $rules) X-Ref |
Validate a list of parameter names and types. param: array $data array of ("fieldname"=>value) of submitted data param: array $rules array of ("fieldname"=>PARAM_X types - or "fieldname"=>array( list of valid options ) return: array of "element_name"=>"error_description" if there are errors, |
enrol_get_plugins($enabled) X-Ref |
Returns instances of enrol plugins param: bool $enabled return enabled only return: array of enrol plugins name=>instance |
enrol_get_plugin($name) X-Ref |
Returns instance of enrol plugin param: string $name name of enrol plugin ('manual', 'guest', ...) return: enrol_plugin |
enrol_get_instances($courseid, $enabled) X-Ref |
Returns enrolment instances in given course. param: int $courseid param: bool $enabled return: array of enrol instances |
enrol_is_enabled($enrol) X-Ref |
Checks if a given plugin is in the list of enabled enrolment plugins. param: string $enrol Enrolment plugin name return: boolean Whether the plugin is enabled |
enrol_check_plugins($user, bool $ignoreintervalcheck = true) X-Ref |
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. param: stdClass $user User object. param: bool $ignoreintervalcheck Force to ignore checking configured sync intervals. return: void |
enrol_sharing_course($user1, $user2) X-Ref |
Do these two students share any course? The courses has to be visible and enrolments has to be active, timestart and timeend restrictions are ignored. This function calls {@see enrol_get_shared_courses()} setting checkexistsonly to true. param: stdClass|int $user1 param: stdClass|int $user2 return: bool |
enrol_get_shared_courses($user1, $user2, $preloadcontexts = false, $checkexistsonly = false) X-Ref |
Returns any courses shared by the two users The courses has to be visible and enrolments has to be active, timestart and timeend restrictions are ignored. param: stdClass|int $user1 param: stdClass|int $user2 param: bool $preloadcontexts If set to true contexts for the returned courses param: bool $checkexistsonly If set to true then this function will return true return: array|bool An array of courses that both users are enrolled in OR if |
enrol_course_edit_form(MoodleQuickForm $mform, $data, $context) X-Ref |
This function adds necessary enrol plugins UI into the course edit form. param: MoodleQuickForm $mform param: object $data course edit form data param: object $context context of existing course or parent category if course does not exist return: void |
enrol_course_edit_validation(array $data, $context) X-Ref |
Validate course edit form data param: array $data raw form data param: object $context context of existing course or parent category if course does not exist return: array errors array |
enrol_course_updated($inserted, $course, $data) X-Ref |
Update enrol instances after course edit form submission param: bool $inserted true means new course added, false course already existed param: object $course param: object $data form data return: void |
enrol_add_course_navigation(navigation_node $coursenode, $course) X-Ref |
Add navigation nodes param: navigation_node $coursenode param: object $course return: void |
enrol_get_my_courses($fields = null, $sort = null, $limit = 0, $courseids = [], $allaccessible = false,$offset = 0, $excludecourses = []) X-Ref |
Returns list of courses current $USER is enrolled in and can access The $fields param is a list of field names to ADD so name just the fields you really need, which will be added and uniq'd. If $allaccessible is true, this will additionally return courses that the current user is not enrolled in, but can access because they are open to the user for other reasons (course view permission, currently viewing course as a guest, or course allows guest access without password). param: string|array $fields Extra fields to be returned (array or comma-separated list). param: string|null $sort Comma separated list of fields to sort by, defaults to respecting navsortmycoursessort. param: int $limit max number of courses param: array $courseids the list of course ids to filter by param: bool $allaccessible Include courses user is not enrolled in, but can access param: int $offset Offset the result set by this number param: array $excludecourses IDs of hidden courses to exclude from search return: array |
enrol_get_course_info_icons($course, array $instances = NULL) X-Ref |
Returns course enrolment information icons. param: object $course param: array $instances enrol instances of this course, improves performance return: array of pix_icon |
enrol_get_courses_sortingsql($sort = null) X-Ref |
Returns SQL ORDER arguments which reflect the admin settings to sort my courses. param: string|null $sort SQL ORDER arguments which were originally requested (optionally). return: string SQL ORDER arguments. |
enrol_get_course_description_texts($course) X-Ref |
Returns course enrolment detailed information. param: object $course return: array of html fragments - can be used to construct lists |
enrol_get_users_courses($userid, $onlyactive = false, $fields = null, $sort = null) X-Ref |
Returns list of courses user is enrolled into. Note: Use {@link enrol_get_all_users_courses()} if you need the list without any capability checks. The $fields param is a list of field names to ADD so name just the fields you really need, which will be added and uniq'd. param: int $userid User whose courses are returned, defaults to the current user. param: bool $onlyactive Return only active enrolments in courses user may see. param: string|array $fields Extra fields to be returned (array or comma-separated list). param: string|null $sort Comma separated list of fields to sort by, defaults to respecting navsortmycoursessort. return: array |
enrol_get_course_users_roles(int $courseid) X-Ref |
Returns list of roles per users into course. param: int $courseid Course id. return: array Array[$userid][$roleid] = role_assignment. |
enrol_user_sees_own_courses($user = null) X-Ref |
Can user access at least one enrolled course? Cheat if necessary, but find out as fast as possible! param: int|stdClass $user null means use current user return: bool |
enrol_get_all_users_courses($userid, $onlyactive = false, $fields = null, $sort = null) X-Ref |
Returns list of courses user is enrolled into without performing any capability checks. The $fields param is a list of field names to ADD so name just the fields you really need, which will be added and uniq'd. param: int $userid User whose courses are returned, defaults to the current user. param: bool $onlyactive Return only active enrolments in courses user may see. param: string|array $fields Extra fields to be returned (array or comma-separated list). param: string|null $sort Comma separated list of fields to sort by, defaults to respecting navsortmycoursessort. return: array |
enrol_user_delete($user) X-Ref |
Called when user is about to be deleted. param: object $user return: void |
enrol_course_delete($course, $userid = null) X-Ref |
Called when course is about to be deleted. If a user id is passed, only enrolments that the user has permission to un-enrol will be removed, otherwise all enrolments in the course will be removed. param: stdClass $course param: int|null $userid return: void |
enrol_try_internal_enrol($courseid, $userid, $roleid = null, $timestart = 0, $timeend = 0) X-Ref |
Try to enrol user via default internal auth plugin. For now this is always using the manual enrol plugin... param: $courseid param: $userid param: $roleid param: $timestart param: $timeend return: bool success |
enrol_selfenrol_available($courseid) X-Ref |
Is there a chance users might self enrol param: int $courseid return: bool |
enrol_get_enrolment_end($courseid, $userid) X-Ref |
This function returns the end of current active user enrolment. It deals correctly with multiple overlapping user enrolments. param: int $courseid param: int $userid return: int|bool timestamp when active enrolment ends, false means no active enrolment now, 0 means never |
enrol_accessing_via_instance(stdClass $instance) X-Ref |
Is current user accessing course via this enrolment method? This is intended for operations that are going to affect enrol instances. param: stdClass $instance enrol instance return: bool |
is_enrolled(context $context, $user = null, $withcapability = '', $onlyactive = false) X-Ref |
Returns true if user is enrolled (is participating) in course this is intended for students and teachers. Since 2.2 the result for active enrolments and current user are cached. param: context $context param: int|stdClass $user if null $USER is used, otherwise user object or id expected param: string $withcapability extra capability name param: bool $onlyactive consider only active enrolments in enabled plugins and time restrictions return: bool |
get_enrolled_with_capabilities_join(context $context, $prefix = '', $capability = '', $groupids = 0,$onlyactive = false, $onlysuspended = false, $enrolid = 0) X-Ref |
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). Note this join will return duplicate rows for users who have been enrolled several times (e.g. as manual enrolment, and as self enrolment). You may need to use a SELECT DISTINCT in your query (see get_enrolled_sql for example). In case is guaranteed some of the joins never match any rows, the resulting join_sql->cannotmatchanyrows will be true. This happens when the capability is prohibited. param: context $context param: string $prefix optional, a prefix to the user id column param: string|array $capability optional, may include a capability name, or array of names. param: int|array $groupids The groupids, 0 or [] means all groups and USERSWITHOUTGROUP no group param: bool $onlyactive consider only active enrolments in enabled plugins and time restrictions param: bool $onlysuspended inverse of onlyactive, consider only suspended enrolments param: int $enrolid The enrolment ID. If not 0, only users enrolled using this enrolment method will be returned. return: \core\dml\sql_join Contains joins, wheres, params and cannotmatchanyrows |
get_enrolled_sql(context $context, $withcapability = '', $groupids = 0, $onlyactive = false, $onlysuspended = false,$enrolid = 0) X-Ref |
Returns array with sql code and parameters returning all ids of users enrolled into course. This function is using 'eu[0-9]+_' prefix for table names and parameters. param: context $context param: string $withcapability param: int|array $groupids The groupids, 0 or [] means all groups and USERSWITHOUTGROUP no group param: bool $onlyactive consider only active enrolments in enabled plugins and time restrictions param: bool $onlysuspended inverse of onlyactive, consider only suspended enrolments param: int $enrolid The enrolment ID. If not 0, only users enrolled using this enrolment method will be returned. return: array list($sql, $params) |
get_enrolled_join(context $context, $useridcolumn, $onlyactive = false, $onlysuspended = false, $enrolid = 0) X-Ref |
Returns array with sql joins and parameters returning all ids of users enrolled into course. This function is using 'ej[0-9]+_' prefix for table names and parameters. param: context $context param: string $useridcolumn User id column used the calling query, e.g. u.id param: bool $onlyactive consider only active enrolments in enabled plugins and time restrictions param: bool $onlysuspended inverse of onlyactive, consider only suspended enrolments param: int $enrolid The enrolment ID. If not 0, only users enrolled using this enrolment method will be returned. return: \core\dml\sql_join Contains joins, wheres, params |
get_enrolled_users(context $context, $withcapability = '', $groupids = 0, $userfields = 'u.*', $orderby = null,$limitfrom = 0, $limitnum = 0, $onlyactive = false) X-Ref |
Returns list of users enrolled into course. param: context $context param: string $withcapability param: int|array $groupids The groupids, 0 or [] means all groups and USERSWITHOUTGROUP no group param: string $userfields requested user record fields param: string $orderby param: int $limitfrom return a subset of records, starting at this point (optional, required if $limitnum is set). param: int $limitnum return a subset comprising this many records (optional, required if $limitfrom is set). param: bool $onlyactive consider only active enrolments in enabled plugins and time restrictions return: array of user records |
count_enrolled_users(context $context, $withcapability = '', $groupids = 0, $onlyactive = false) X-Ref |
Counts list of users enrolled into course (as per above function) param: context $context param: string $withcapability param: int|array $groupids The groupids, 0 or [] means all groups and USERSWITHOUTGROUP no group param: bool $onlyactive consider only active enrolments in enabled plugins and time restrictions return: int number of users enrolled into course |
enrol_send_welcome_email_options() X-Ref |
Send welcome email "from" options. return: array list of from options |
enrol_output_fragment_user_enrolment_form($args) X-Ref |
Serve the user enrolment form as a fragment. param: array $args List of named arguments for the fragment loader. return: string |
enrol_get_course_by_user_enrolment_id($ueid) X-Ref |
Returns the course where a user enrolment belong to. param: int $ueid user_enrolments id return: stdClass |
enrol_get_course_users($courseid = false, $onlyactive = false, $usersfilter = [], $uefilter = [],$usergroups = []) X-Ref |
Return all users enrolled in a course. param: int $courseid Course id or false if using $uefilter (user enrolment ids may belong to different courses) param: bool $onlyactive consider only active enrolments in enabled plugins and time restrictions param: array $usersfilter Limit the results obtained to this list of user ids. $uefilter compatibility not guaranteed. param: array $uefilter Limit the results obtained to this list of user enrolment ids. $usersfilter compatibility not guaranteed. param: array $usergroups Limit the results of users to the ones that belong to one of the submitted group ids. return: stdClass[] |
enrol_get_period_list() X-Ref |
Get the list of options for the enrolment period dropdown return: array List of options for the enrolment period dropdown |
enrol_calculate_duration($timestart, $timeend) X-Ref |
Calculate duration base on start time and end time param: int $timestart Time start param: int $timeend Time end return: float|int Calculated duration |