Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Static Public Member Functions | Static Protected Member Functions | List of all members
core_enrol_external Class Reference
Inheritance diagram for core_enrol_external:
external_api

Static Public Member Functions

static call_external_function ($function, $args, $ajaxonly=false)
 Call an external function validating all params/returns correctly. More...
 
static clean_returnvalue (external_description $description, $response)
 Clean response If a response attribute is unknown from the description, we just ignore the attribute. More...
 
static edit_user_enrolment ($courseid, $ueid, $status, $timestart=0, $timeend=0)
 External function that updates a given user enrolment. More...
 
static edit_user_enrolment_is_deprecated ()
 Mark the edit_user_enrolment web service as deprecated. More...
 
static edit_user_enrolment_parameters ()
 Returns description of edit_user_enrolment() parameters. More...
 
static edit_user_enrolment_returns ()
 Returns description of edit_user_enrolment() result value. More...
 
static external_function_info ($function, $strictness=MUST_EXIST)
 Returns detailed function information. More...
 
static get_course_enrolment_methods ($courseid)
 Get list of active course enrolment methods for current user. More...
 
static get_course_enrolment_methods_parameters ()
 Returns description of get_course_enrolment_methods() parameters. More...
 
static get_course_enrolment_methods_returns ()
 Returns description of get_course_enrolment_methods() result value. More...
 
static get_enrolled_users ($courseid, $options=array())
 Get course participants details. More...
 
static get_enrolled_users_parameters ()
 Returns description of method parameters. More...
 
static get_enrolled_users_returns ()
 Returns description of method result value. More...
 
static get_enrolled_users_with_capability ($coursecapabilities, $options)
 Return users that have the capabilities for each course specified. More...
 
static get_enrolled_users_with_capability_parameters ()
 Returns description of method parameters. More...
 
static get_enrolled_users_with_capability_returns ()
 Returns description of method result value. More...
 
static get_potential_users ($courseid, $enrolid, $search, $searchanywhere, $page, $perpage)
 Get potential users. More...
 
static get_potential_users_parameters ()
 Returns description of method parameters value. More...
 
static get_potential_users_returns ()
 Returns description of method result value. More...
 
static get_users_courses ($userid, $returnusercount=true)
 Get list of courses user is enrolled in (only active enrolments are returned). More...
 
static get_users_courses_parameters ()
 Returns description of method parameters. More...
 
static get_users_courses_returns ()
 Returns description of method result value. More...
 
static search_users (int $courseid, string $search, bool $searchanywhere, int $page, int $perpage)
 Search course participants. More...
 
static search_users_parameters ()
 Returns description of method parameters. More...
 
static search_users_returns ()
 Returns description of method result value. More...
 
static set_context_restriction ($context)
 Set context restriction for all following subsequent function calls. More...
 
static set_timeout ($seconds=360)
 This method has to be called before every operation that takes a longer time to finish! More...
 
static submit_user_enrolment_form ($formdata)
 External function that handles the user enrolment form submission. More...
 
static submit_user_enrolment_form_parameters ()
 Returns description of submit_user_enrolment_form parameters. More...
 
static submit_user_enrolment_form_returns ()
 Returns description of submit_user_enrolment_form() result value. More...
 
static unenrol_user_enrolment ($ueid)
 External function that unenrols a given user enrolment. More...
 
static unenrol_user_enrolment_parameters ()
 Returns description of unenrol_user_enrolment() parameters. More...
 
static unenrol_user_enrolment_returns ()
 Returns description of unenrol_user_enrolment() result value. More...
 
static validate_context ($context)
 Makes sure user may execute functions in this context. More...
 
static validate_parameters (external_description $description, $params)
 Validates submitted function parameters, if anything is incorrect invalid_parameter_exception is thrown. More...
 

Static Protected Member Functions

static get_context_from_params ($param)
 Get context from passed parameters. More...
 
static get_context_parameters ()
 Returns a prepared structure to use a context parameters. More...
 

Member Function Documentation

◆ call_external_function()

static external_api::call_external_function (   $function,
  $args,
  $ajaxonly = false 
)
staticinherited

Call an external function validating all params/returns correctly.

Note that an external function may modify the state of the current page, so this wrapper saves and restores tha PAGE and COURSE global variables before/after calling the external function.

Parameters
string$functionA webservice function name.
array$argsParams array (named params)
boolean$ajaxonlyIf true, an extra check will be peformed to see if ajax is required.
Return values
arraycontaining keys for error (bool), exception and data.

◆ clean_returnvalue()

static external_api::clean_returnvalue ( external_description  $description,
  $response 
)
staticinherited

Clean response If a response attribute is unknown from the description, we just ignore the attribute.

If a response attribute is incorrect, invalid_response_exception is thrown. Note: this function is similar to validate parameters, however it is distinct because parameters validation must be distinct from cleaning return values.

Parameters
external_description$descriptiondescription of the return values
mixed$responsethe actual response
Return values
mixedresponse with added defaults for optional items, invalid_response_exception thrown if any problem found
Author
2010 Jerome Mouneyrac
Since
Moodle 2.0

◆ edit_user_enrolment()

static core_enrol_external::edit_user_enrolment (   $courseid,
  $ueid,
  $status,
  $timestart = 0,
  $timeend = 0 
)
static

External function that updates a given user enrolment.

Deprecated:
since 3.8
Parameters
int$courseidThe course ID.
int$ueidThe user enrolment ID.
int$statusThe enrolment status.
int$timestartEnrolment start timestamp.
int$timeendEnrolment end timestamp.
Return values
arrayAn array consisting of the processing result, errors and form output, if available.

◆ edit_user_enrolment_is_deprecated()

static core_enrol_external::edit_user_enrolment_is_deprecated ( )
static

Mark the edit_user_enrolment web service as deprecated.

Return values
bool

◆ edit_user_enrolment_parameters()

static core_enrol_external::edit_user_enrolment_parameters ( )
static

Returns description of edit_user_enrolment() parameters.

Deprecated:
since 3.8
Return values
external_function_parameters

◆ edit_user_enrolment_returns()

static core_enrol_external::edit_user_enrolment_returns ( )
static

Returns description of edit_user_enrolment() result value.

Deprecated:
since 3.8
Return values
external_description

◆ external_function_info()

static external_api::external_function_info (   $function,
  $strictness = MUST_EXIST 
)
staticinherited

Returns detailed function information.

Parameters
string | object$functionname of external function or record from external_function
int$strictnessIGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found; MUST_EXIST means throw exception if no record or multiple records found
Return values
stdClassdescription or false if not found or exception thrown
Since
Moodle 2.0

◆ get_context_from_params()

static external_api::get_context_from_params (   $param)
staticprotectedinherited

Get context from passed parameters.

The passed array must either contain a contextid or a combination of context level and instance id to fetch the context. For example, the context level can be "course" and instanceid can be courseid.

See context_helper::get_all_levels() for a list of valid context levels.

Parameters
array$param
Since
Moodle 2.6
Exceptions
invalid_parameter_exception
Return values
context

◆ get_context_parameters()

static external_api::get_context_parameters ( )
staticprotectedinherited

Returns a prepared structure to use a context parameters.

Return values
external_single_structure

Reimplemented in core_competency\external, and tool_lp\external.

◆ get_course_enrolment_methods()

static core_enrol_external::get_course_enrolment_methods (   $courseid)
static

Get list of active course enrolment methods for current user.

Parameters
int$courseid
Return values
arrayof course enrolment methods
Exceptions
moodle_exception

◆ get_course_enrolment_methods_parameters()

static core_enrol_external::get_course_enrolment_methods_parameters ( )
static

Returns description of get_course_enrolment_methods() parameters.

Return values
external_function_parameters

◆ get_course_enrolment_methods_returns()

static core_enrol_external::get_course_enrolment_methods_returns ( )
static

Returns description of get_course_enrolment_methods() result value.

Return values
external_description

◆ get_enrolled_users()

static core_enrol_external::get_enrolled_users (   $courseid,
  $options = array() 
)
static

Get course participants details.

Parameters
int$courseidcourse id
array$optionsoptions { 'name' => option name 'value' => option value }
Return values
arrayAn array of users

◆ get_enrolled_users_parameters()

static core_enrol_external::get_enrolled_users_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters

◆ get_enrolled_users_returns()

static core_enrol_external::get_enrolled_users_returns ( )
static

Returns description of method result value.

Return values
external_description

◆ get_enrolled_users_with_capability()

static core_enrol_external::get_enrolled_users_with_capability (   $coursecapabilities,
  $options 
)
static

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.

Parameters
array$coursecapabilitiesarray of course ids and associated capability names {courseid, {capabilities}}
Return values
arrayAn array of arrays describing users for each associated courseid and capability
Since
Moodle 2.4

◆ get_enrolled_users_with_capability_parameters()

static core_enrol_external::get_enrolled_users_with_capability_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.4

◆ get_enrolled_users_with_capability_returns()

static core_enrol_external::get_enrolled_users_with_capability_returns ( )
static

Returns description of method result value.

Return values
external_multiple_structure
Since
Moodle 2.4

◆ get_potential_users()

static core_enrol_external::get_potential_users (   $courseid,
  $enrolid,
  $search,
  $searchanywhere,
  $page,
  $perpage 
)
static

Get potential users.

Parameters
int$courseidCourse id
int$enrolidEnrolment id
string$searchThe query
boolean$searchanywhereMatch anywhere in the string
int$pagePage number
int$perpageMax per page
Return values
arrayAn array of users

◆ get_potential_users_parameters()

static core_enrol_external::get_potential_users_parameters ( )
static

Returns description of method parameters value.

Return values
external_description

◆ get_potential_users_returns()

static core_enrol_external::get_potential_users_returns ( )
static

Returns description of method result value.

Return values
external_description

◆ get_users_courses()

static core_enrol_external::get_users_courses (   $userid,
  $returnusercount = true 
)
static

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.

Parameters
int$userid
bool$returnusercount
Return values
arrayof courses

◆ get_users_courses_parameters()

static core_enrol_external::get_users_courses_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters

◆ get_users_courses_returns()

static core_enrol_external::get_users_courses_returns ( )
static

Returns description of method result value.

Return values
external_description

◆ search_users()

static core_enrol_external::search_users ( int  $courseid,
string  $search,
bool  $searchanywhere,
int  $page,
int  $perpage 
)
static

Search course participants.

Parameters
int$courseidCourse id
string$searchThe query
bool$searchanywhereMatch anywhere in the string
int$pagePage number
int$perpageMax per page
Return values
arrayAn array of users
Exceptions
moodle_exception

◆ search_users_parameters()

static core_enrol_external::search_users_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters

◆ search_users_returns()

static core_enrol_external::search_users_returns ( )
static

Returns description of method result value.

Return values
external_multiple_structure

◆ set_context_restriction()

static external_api::set_context_restriction (   $context)
staticinherited

Set context restriction for all following subsequent function calls.

Parameters
stdClass$contextthe context restriction
Since
Moodle 2.0

◆ set_timeout()

static external_api::set_timeout (   $seconds = 360)
staticinherited

This method has to be called before every operation that takes a longer time to finish!

Parameters
int$secondsmax expected time the next operation needs
Since
Moodle 2.0

◆ submit_user_enrolment_form()

static core_enrol_external::submit_user_enrolment_form (   $formdata)
static

External function that handles the user enrolment form submission.

Parameters
string$formdataThe user enrolment form data in s URI encoded param string
Return values
arrayAn array consisting of the processing result and error flag, if available

◆ submit_user_enrolment_form_parameters()

static core_enrol_external::submit_user_enrolment_form_parameters ( )
static

Returns description of submit_user_enrolment_form parameters.

Return values
external_function_parameters.

◆ submit_user_enrolment_form_returns()

static core_enrol_external::submit_user_enrolment_form_returns ( )
static

Returns description of submit_user_enrolment_form() result value.

Return values
external_description

◆ unenrol_user_enrolment()

static core_enrol_external::unenrol_user_enrolment (   $ueid)
static

External function that unenrols a given user enrolment.

Parameters
int$ueidThe user enrolment ID.
Return values
arrayAn array consisting of the processing result, errors.

◆ unenrol_user_enrolment_parameters()

static core_enrol_external::unenrol_user_enrolment_parameters ( )
static

Returns description of unenrol_user_enrolment() parameters.

Return values
external_function_parameters

◆ unenrol_user_enrolment_returns()

static core_enrol_external::unenrol_user_enrolment_returns ( )
static

Returns description of unenrol_user_enrolment() result value.

Return values
external_description

◆ validate_context()

static external_api::validate_context (   $context)
staticinherited

Makes sure user may execute functions in this context.

Parameters
stdClass$context
Since
Moodle 2.0

◆ validate_parameters()

static external_api::validate_parameters ( external_description  $description,
  $params 
)
staticinherited

Validates submitted function parameters, if anything is incorrect invalid_parameter_exception is thrown.

This is a simple recursive method which is intended to be called from each implementation method of external API.

Parameters
external_description$descriptiondescription of parameters
mixed$paramsthe actual parameters
Return values
mixedparams with added defaults for optional items, invalid_parameters_exception thrown if any problem found
Since
Moodle 2.0

The documentation for this class was generated from the following file: