Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 401 and 402] [Versions 401 and 403]

External course participation api. This api is mostly read only, the actual enrol and unenrol support is in each enrol plugin.

Copyright: 2010 Jerome Mouneyrac
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 1330 lines (65 kb)
Included or required:0 times
Referenced: 10 times
Includes or requires: 0 files

Defines 3 classes


Class: core_enrol_external  - X-Ref

Enrol external functions

get_enrolled_users_with_capability_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

get_enrolled_users_with_capability($coursecapabilities, $options)   X-Ref
Return users that have the capabilities for each course specified. For each course and capability specified,
a list of the users that are enrolled in the course and have that capability are returned.

param: array $coursecapabilities array of course ids and associated capability names {courseid, {capabilities}}
return: array An array of arrays describing users for each associated courseid and capability

get_enrolled_users_with_capability_returns()   X-Ref
Returns description of method result value

return: external_multiple_structure

get_users_courses_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

get_users_courses($userid, $returnusercount = true)   X-Ref
Get list of courses user is enrolled in (only active enrolments are returned).
Please note the current user must be able to access the course, otherwise the course is not included.

param: int $userid
param: bool $returnusercount
return: array of courses

get_users_courses_returns()   X-Ref
No description

get_potential_users_parameters()   X-Ref
Returns description of method parameters value

return: external_description

get_potential_users($courseid, $enrolid, $search, $searchanywhere, $page, $perpage)   X-Ref
Get potential users.

param: int $courseid Course id
param: int $enrolid Enrolment id
param: string $search The query
param: boolean $searchanywhere Match anywhere in the string
param: int $page Page number
param: int $perpage Max per page
return: array An array of users

get_potential_users_returns()   X-Ref
Returns description of method result value

return: external_description

search_users_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

search_users(int $courseid, string $search, bool $searchanywhere, int $page, int $perpage)   X-Ref
Search course participants.

param: int $courseid Course id
param: string $search The query
param: bool $searchanywhere Match anywhere in the string
param: int $page Page number
param: int $perpage Max per page
return: array An array of users

search_users_returns()   X-Ref
Returns description of method result value

return: external_multiple_structure

get_enrolled_users_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

get_enrolled_users($courseid, $options = [])   X-Ref
Get course participants details

param: int $courseid  course id
param: array $options options {
return: array An array of users

get_enrolled_users_returns()   X-Ref
Returns description of method result value

return: external_description

Class: in  - X-Ref

get_course_enrolment_methods_parameters()   X-Ref
Returns description of get_course_enrolment_methods() parameters

return: external_function_parameters

get_course_enrolment_methods($courseid)   X-Ref
Get list of active course enrolment methods for current user.

param: int $courseid
return: array of course enrolment methods

get_course_enrolment_methods_returns()   X-Ref
Returns description of get_course_enrolment_methods() result value

return: external_description

submit_user_enrolment_form_parameters()   X-Ref
Returns description of submit_user_enrolment_form parameters.

return: external_function_parameters.

submit_user_enrolment_form($formdata)   X-Ref
External function that handles the user enrolment form submission.

param: string $formdata The user enrolment form data in s URI encoded param string
return: array An array consisting of the processing result and error flag, if available

submit_user_enrolment_form_returns()   X-Ref
Returns description of submit_user_enrolment_form() result value

return: external_description

unenrol_user_enrolment_parameters()   X-Ref
Returns description of unenrol_user_enrolment() parameters

return: external_function_parameters

unenrol_user_enrolment($ueid)   X-Ref
External function that unenrols a given user enrolment.

param: int $ueid The user enrolment ID.
return: array An array consisting of the processing result, errors.

unenrol_user_enrolment_returns()   X-Ref
Returns description of unenrol_user_enrolment() result value

return: external_description

Class: core_role_external  - X-Ref

Role external functions

assign_roles_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

assign_roles($assignments)   X-Ref
Manual role assignments to users

param: array $assignments An array of manual role assignment

assign_roles_returns()   X-Ref
Returns description of method result value

return: null

unassign_roles_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

unassign_roles($unassignments)   X-Ref
Unassign roles from users

param: array $unassignments An array of unassignment

unassign_roles_returns()   X-Ref
Returns description of method result value

return: null