Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 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: | 3347 lines (124 kb) |
Included or required: | 3 times |
Referenced: | 3 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 return: string param: object $instance (null is accepted too) |
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. return: array of pix_icon param: array $instances all enrol instances of this type in one course |
get_description_text($instance) X-Ref |
Returns optional enrolment instance description text. This is used in detailed course information. return: string short html text param: object $instance |
load_config() X-Ref |
Makes sure config is loaded and cached. return: void |
get_config($name, $default = NULL) X-Ref |
Returns plugin config value return: string value or default param: string $name param: string $default value if config does not exist yet |
set_config($name, $value) X-Ref |
Sets plugin config value return: string value param: string $name name of config param: string $value string config value, null means delete |
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? return: bool - true means user with 'enrol/xxx:enrol' may enrol others freely, false means nobody may add more enrolments manually param: stdClass $instance course enrol instance |
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 return: bool - true means user with 'enrol/xxx:unenrol' may unenrol others freely, false means nobody may touch user_enrolments param: stdClass $instance course enrol instance |
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. return: bool - true means user with 'enrol/xxx:unenrol' may unenrol this user, false means nobody may touch this user enrolment param: stdClass $instance course enrol instance param: stdClass $ue record from user_enrolments table, specifies user |
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 return: bool - true means it is possible to change enrol period and status in user_enrolments table param: stdClass $instance course enrol instance |
show_enrolme_link(stdClass $instance) X-Ref |
Does this plugin support some way to user to self enrol? return: bool - true means show "Enrol me in this course" link in course UI param: stdClass $instance course enrol instance |
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. return: bool - true means "Enrol me in this course" link could be available. param: stdClass $instance enrolment instance |
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. return: bool|int false means not enrolled, integer means timeend param: stdClass $instance course enrol instance |
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. return: bool|int false means no guest access, integer means timeend param: stdClass $instance course enrol instance |
enrol_user(stdClass $instance, $userid, $roleid = null, $timestart = 0, $timeend = 0, $status = null, $recovergrades = null) X-Ref |
Enrol user into course via enrol instance. return: void 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 |
update_user_enrol(stdClass $instance, $userid, $status = NULL, $timestart = NULL, $timeend = NULL) X-Ref |
Store user_enrolments changes and trigger event. return: void param: stdClass $instance param: int $userid param: int $status param: int $timestart param: int $timeend |
unenrol_user(stdClass $instance, $userid) X-Ref |
Unenrol user from course, the last unenrolment removes all remaining roles. return: void param: stdClass $instance param: int $userid |
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. return: void param: object $user user record |
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. return: boolean param: int $courseid |
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. return: boolean param: stdClass $instance |
get_newinstance_link($courseid) X-Ref |
Returns link to page which may be used to add new instance of enrolment plugin in course. return: moodle_url page url param: int $courseid |
instance_deleteable($instance) X-Ref |
can_delete_instance($instance) X-Ref |
Is it possible to delete enrol instance via standard UI? return: bool param: stdClass $instance |
can_hide_show_instance($instance) X-Ref |
Is it possible to hide/show enrol instance via standard UI? return: bool param: stdClass $instance |
get_manual_enrol_link($instance) X-Ref |
Returns link to manual enrol UI if exists. Does the access control tests automatically. return: moodle_url param: object $instance |
get_unenrolself_link($instance) X-Ref |
Returns list of unenrol links for all enrol instances in course. return: moodle_url or NULL if self unenrolment not supported param: int $instance |
course_edit_form($instance, MoodleQuickForm $mform, $data, $context) X-Ref |
Adds enrol instance UI to course edit form return: void 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 |
edit_instance_form($instance, MoodleQuickForm $mform, $context) X-Ref |
Adds form elements to add/edit instance form. return: void param: object $instance enrol instance or null if does not exist yet param: MoodleQuickForm $mform param: context $context |
edit_instance_validation($data, $files, $instance, $context) X-Ref |
Perform custom validation of the data used to edit the instance. return: array of "element_name"=>"error_description" if there are errors, 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 |
course_edit_validation($instance, array $data, $context) X-Ref |
Validates course edit form data return: array errors array 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 |
course_updated($inserted, $course, $data) X-Ref |
Called after updating/inserting course. return: void param: bool $inserted true if course just inserted param: object $course param: object $data form data |
add_instance($course, array $fields = NULL) X-Ref |
Add new instance of enrol plugin. return: int id of new instance, null if can not be created param: object $course param: array instance fields |
update_instance($instance, $data) X-Ref |
Update instance of enrol plugin. return: boolean param: stdClass $instance param: stdClass $data modified instance fields |
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. return: int id of new instance or null if no default supported param: object $course |
update_status($instance, $newstatus) X-Ref |
Update instance status Override when plugin needs to do some action when enabled or disabled. return: void param: stdClass $instance param: int $newstatus ENROL_INSTANCE_ENABLED, ENROL_INSTANCE_DISABLED |
delete_instance($instance) X-Ref |
Delete course enrol plugin instance, unenrol all users. return: void param: object $instance |
enrol_page_hook(stdClass $instance) X-Ref |
Creates course enrol form, checks if form submitted and enrols user if necessary. It can also redirect. return: string html text, usually a form in a text box param: stdClass $instance |
can_self_enrol(stdClass $instance, $checkuserenrolment = true) X-Ref |
Checks if user can self enrol. return: bool|string true if successful, else error message or false param: stdClass $instance enrolment instance param: bool $checkuserenrolment if true will check if user enrolment is inactive. |
get_enrol_info(stdClass $instance) X-Ref |
Return information for enrolment instance containing list of parameters required for enrolment, name of enrolment plugin etc. return: array instance info. param: stdClass $instance enrolment instance |
add_course_navigation($instancesnode, stdClass $instance) X-Ref |
Adds navigation links into course admin block. By defaults looks for manage links only. return: void param: navigation_node $instancesnode param: stdClass $instance |
get_action_icons(stdClass $instance) X-Ref |
Returns edit icons for the page with list of instances return: array param: stdClass $instance |
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 return: void param: object $user |
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 return: enrol_user_button|false param: course_enrolment_manager $manager |
get_user_enrolment_actions(course_enrolment_manager $manager, $ue) X-Ref |
Gets an array of the user enrolment actions return: array An array of user_enrolment_actions param: course_enrolment_manager $manager param: stdClass $ue |
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. return: bool param: course_enrolment_manager $manager |
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. return: array param: course_enrolment_manager $manager |
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. return: bool true if any data processed, false if not param: progress_trace $trace param: int $courseid one course, empty mean all |
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. return: stdClass user record param: int $instanceid enrolment instance id |
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. return: array of "element_name"=>"error_description" if there are errors, 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 ) |
enrol_get_plugins($enabled) X-Ref |
Returns instances of enrol plugins return: array of enrol plugins name=>instance param: bool $enabled return enabled only |
enrol_get_plugin($name) X-Ref |
Returns instance of enrol plugin return: enrol_plugin param: string $name name of enrol plugin ('manual', 'guest', ...) |
enrol_get_instances($courseid, $enabled) X-Ref |
Returns enrolment instances in given course. return: array of enrol instances param: int $courseid param: bool $enabled |
enrol_is_enabled($enrol) X-Ref |
Checks if a given plugin is in the list of enabled enrolment plugins. return: boolean Whether the plugin is enabled param: string $enrol Enrolment plugin name |
enrol_check_plugins($user) 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. return: void param: stdClass $user |
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. return: bool param: stdClass|int $user1 param: stdClass|int $user2 |
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. return: array|bool An array of courses that both users are enrolled in OR if 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 |
enrol_course_edit_form(MoodleQuickForm $mform, $data, $context) X-Ref |
This function adds necessary enrol plugins UI into the course edit form. return: void 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 |
enrol_course_edit_validation(array $data, $context) X-Ref |
Validate course edit form data return: array errors array param: array $data raw form data param: object $context context of existing course or parent category if course does not exist |
enrol_course_updated($inserted, $course, $data) X-Ref |
Update enrol instances after course edit form submission return: void param: bool $inserted true means new course added, false course already existed param: object $course param: object $data form data |
enrol_add_course_navigation(navigation_node $coursenode, $course) X-Ref |
Add navigation nodes return: void param: navigation_node $coursenode param: object $course |
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). return: array 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 |
enrol_get_course_info_icons($course, array $instances = NULL) X-Ref |
Returns course enrolment information icons. return: array of pix_icon param: object $course param: array $instances enrol instances of this course, improves performance |
enrol_get_courses_sortingsql($sort = null) X-Ref |
Returns SQL ORDER arguments which reflect the admin settings to sort my courses. return: string SQL ORDER arguments. param: string|null $sort SQL ORDER arguments which were originally requested (optionally). |
enrol_get_course_description_texts($course) X-Ref |
Returns course enrolment detailed information. return: array of html fragments - can be used to construct lists param: object $course |
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. return: array 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. |
enrol_get_course_users_roles(int $courseid) X-Ref |
Returns list of roles per users into course. return: array Array[$userid][$roleid] = role_assignment. param: int $courseid Course id. |
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! return: bool param: int|stdClass $user null means use current user |
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. return: array 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. |
enrol_user_delete($user) X-Ref |
Called when user is about to be deleted. return: void param: object $user |
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. return: void param: stdClass $course param: int|null $userid |
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... return: bool success param: $courseid param: $userid param: $roleid param: $timestart param: $timeend |
enrol_selfenrol_available($courseid) X-Ref |
Is there a chance users might self enrol return: bool param: int $courseid |
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. return: int|bool timestamp when active enrolment ends, false means no active enrolment now, 0 means never param: int $courseid param: int $userid |
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. return: bool param: stdClass $instance enrol instance |
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. return: bool 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 |
get_enrolled_with_capabilities_join(context $context, $prefix = '', $capability = '', $group = 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. return: \core\dml\sql_join Contains joins, wheres, params and cannotmatchanyrows 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 $group optional, 0 indicates no current group and USERSWITHOUTGROUP users without any group; otherwise the group 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. |
get_enrolled_sql(context $context, $withcapability = '', $groupid = 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. return: array list($sql, $params) param: context $context param: string $withcapability param: int $groupid 0 means ignore groups, USERSWITHOUTGROUP without any group and any other value limits the result by group 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. |
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. return: \core\dml\sql_join Contains joins, wheres, params 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. |
get_enrolled_users(context $context, $withcapability = '', $groupid = 0, $userfields = 'u.*', $orderby = null,$limitfrom = 0, $limitnum = 0, $onlyactive = false) X-Ref |
Returns list of users enrolled into course. return: array of user records param: context $context param: string $withcapability param: int $groupid 0 means ignore groups, USERSWITHOUTGROUP without any group and any other value limits the result by group id 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 |
count_enrolled_users(context $context, $withcapability = '', $groupid = 0, $onlyactive = false) X-Ref |
Counts list of users enrolled into course (as per above function) return: int number of users enrolled into course param: context $context param: string $withcapability param: int $groupid 0 means ignore groups, any other value limits the result by group id param: bool $onlyactive consider only active enrolments in enabled plugins and time restrictions |
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. return: string param: array $args List of named arguments for the fragment loader. |
enrol_get_course_by_user_enrolment_id($ueid) X-Ref |
Returns the course where a user enrolment belong to. return: stdClass param: int $ueid user_enrolments id |
enrol_get_course_users($courseid = false, $onlyactive = false, $usersfilter = [], $uefilter = [],$usergroups = []) X-Ref |
Return all users enrolled in a course. return: stdClass[] 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. |
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 return: float|int Calculated duration param: int $timestart Time start param: int $timeend Time end |