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

Static Public Member Functions

static add_user_device ($appid, $name, $model, $platform, $version, $pushid, $uuid)
 Add a user device in Moodle database (for PUSH notifications usually). More...
 
static add_user_device_parameters ()
 Returns description of method parameters. More...
 
static add_user_device_returns ()
 Returns description of method result value. More...
 
static add_user_private_files ($draftid)
 Copy files from a draft area to users private files area. More...
 
static add_user_private_files_parameters ()
 Returns description of method parameters. More...
 
static add_user_private_files_returns ()
 Returns description of method result value. More...
 
static agree_site_policy ()
 Agree the site policy for the current user. More...
 
static agree_site_policy_parameters ()
 Returns description of method parameters. More...
 
static agree_site_policy_returns ()
 Returns description of method result value. More...
 
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 create_users ($users)
 Create one or more users. More...
 
static create_users_parameters ()
 Returns description of method parameters. More...
 
static create_users_returns ()
 Returns description of method result value. More...
 
static delete_users ($userids)
 Delete users. More...
 
static delete_users_parameters ()
 Returns description of method parameters. More...
 
static delete_users_returns ()
 Returns description of method result value. More...
 
static external_function_info ($function, $strictness=MUST_EXIST)
 Returns detailed function information. More...
 
static get_course_user_profiles ($userlist)
 Get course participant's details. More...
 
static get_course_user_profiles_parameters ()
 Returns description of method parameters. More...
 
static get_course_user_profiles_returns ()
 Returns description of method result value. More...
 
static get_private_files_info ($userid=0)
 Returns general information about files in the user private files area. More...
 
static get_private_files_info_parameters ()
 Returns description of method parameters. More...
 
static get_private_files_info_returns ()
 Returns description of method result value. More...
 
static get_user_preferences ($name='', $userid=0)
 Return user preferences. More...
 
static get_user_preferences_parameters ()
 Returns description of method parameters. More...
 
static get_user_preferences_returns ()
 Returns description of method result value. More...
 
static get_users ($criteria=array())
 Retrieve matching user. More...
 
static get_users_by_field ($field, $values)
 Get user information for a unique field. More...
 
static get_users_by_field_parameters ()
 Returns description of method parameters. More...
 
static get_users_by_field_returns ()
 Returns description of method result value. More...
 
static get_users_parameters ()
 Returns description of get_users() parameters. More...
 
static get_users_returns ()
 Returns description of get_users result value. More...
 
static remove_user_device ($uuid, $appid="")
 Remove a user device from the Moodle database (for PUSH notifications usually). More...
 
static remove_user_device_parameters ()
 Returns description of method parameters. More...
 
static remove_user_device_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 set_user_preferences ($preferences)
 Set user preferences. More...
 
static set_user_preferences_parameters ()
 Returns description of method parameters. More...
 
static set_user_preferences_returns ()
 Returns description of method result value. More...
 
static update_picture ($draftitemid, $delete=false, $userid=0)
 Update or delete the user picture in the site. More...
 
static update_picture_parameters ()
 Returns description of method parameters. More...
 
static update_picture_returns ()
 Returns description of method result value. More...
 
static update_user_preferences ($userid=0, $emailstop=null, $preferences=array())
 Update the user's preferences. More...
 
static update_user_preferences_parameters ()
 Returns description of method parameters. More...
 
static update_user_preferences_returns ()
 Returns description of method result value. More...
 
static update_users ($users)
 Update users. More...
 
static update_users_parameters ()
 Returns description of method parameters. More...
 
static update_users_returns ()
 Returns description of method result value. More...
 
static user_description ($additionalfields=array())
 Create user return value description. 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 view_user_list ($courseid)
 Trigger the user_list_viewed event. More...
 
static view_user_list_parameters ()
 Returns description of method parameters. More...
 
static view_user_list_returns ()
 Returns description of method result value. More...
 
static view_user_profile ($userid, $courseid=0)
 Trigger the user profile viewed event. More...
 
static view_user_profile_parameters ()
 Returns description of method parameters. More...
 
static view_user_profile_returns ()
 Returns description of method result value. 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

◆ add_user_device()

static core_user_external::add_user_device (   $appid,
  $name,
  $model,
  $platform,
  $version,
  $pushid,
  $uuid 
)
static

Add a user device in Moodle database (for PUSH notifications usually).

Exceptions
moodle_exception
Parameters
string$appidThe app id, usually something like com.moodle.moodlemobile.
string$nameThe device name, occam or iPhone etc.
string$modelThe device model Nexus4 or iPad1.1 etc.
string$platformThe device platform iOs or Android etc.
string$versionThe device version 6.1.2 or 4.2.2 etc.
string$pushidThe device PUSH token/key/identifier/registration id.
string$uuidThe device UUID.
Return values
arrayList of possible warnings.
Since
Moodle 2.6

◆ add_user_device_parameters()

static core_user_external::add_user_device_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.6

◆ add_user_device_returns()

static core_user_external::add_user_device_returns ( )
static

Returns description of method result value.

Return values
external_multiple_structure
Since
Moodle 2.6

◆ add_user_private_files()

static core_user_external::add_user_private_files (   $draftid)
static

Copy files from a draft area to users private files area.

Exceptions
invalid_parameter_exception
Parameters
int$draftidId of a draft area containing files.
Return values
arrayAn array of warnings
Since
Moodle 2.6

◆ add_user_private_files_parameters()

static core_user_external::add_user_private_files_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.6

◆ add_user_private_files_returns()

static core_user_external::add_user_private_files_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 2.2

◆ agree_site_policy()

static core_user_external::agree_site_policy ( )
static

Agree the site policy for the current user.

Return values
arrayof warnings and status result
Since
Moodle 3.2
Exceptions
moodle_exception

◆ agree_site_policy_parameters()

static core_user_external::agree_site_policy_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 3.2

◆ agree_site_policy_returns()

static core_user_external::agree_site_policy_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 3.2

◆ 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

◆ create_users()

static core_user_external::create_users (   $users)
static

Create one or more users.

Exceptions
invalid_parameter_exception
Parameters
array$usersAn array of users to create.
Return values
arrayAn array of arrays
Since
Moodle 2.2

◆ create_users_parameters()

static core_user_external::create_users_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.2

◆ create_users_returns()

static core_user_external::create_users_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 2.2

◆ delete_users()

static core_user_external::delete_users (   $userids)
static

Delete users.

Exceptions
moodle_exception
Parameters
array$userids
Return values
null
Since
Moodle 2.2

◆ delete_users_parameters()

static core_user_external::delete_users_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.2

◆ delete_users_returns()

static core_user_external::delete_users_returns ( )
static

Returns description of method result value.

Return values
null
Since
Moodle 2.2

◆ 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_user_profiles()

static core_user_external::get_course_user_profiles (   $userlist)
static

Get course participant's details.

Parameters
array$userlistarray of user ids and according course ids
Return values
arrayAn array of arrays describing course participants
Since
Moodle 2.2

◆ get_course_user_profiles_parameters()

static core_user_external::get_course_user_profiles_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.2

◆ get_course_user_profiles_returns()

static core_user_external::get_course_user_profiles_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 2.2

◆ get_private_files_info()

static core_user_external::get_private_files_info (   $userid = 0)
static

Returns general information about files in the user private files area.

Parameters
int$useridId of the user, default to current user.
Return values
arrayof warnings and file area information
Since
Moodle 3.4
Exceptions
moodle_exception

◆ get_private_files_info_parameters()

static core_user_external::get_private_files_info_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 3.4

◆ get_private_files_info_returns()

static core_user_external::get_private_files_info_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 3.4

◆ get_user_preferences()

static core_user_external::get_user_preferences (   $name = '',
  $userid = 0 
)
static

Return user preferences.

Parameters
string$namepreference name, empty for all
int$useridid of the user, 0 for current user
Return values
arrayof warnings and preferences
Since
Moodle 3.2
Exceptions
moodle_exception

◆ get_user_preferences_parameters()

static core_user_external::get_user_preferences_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 3.2

◆ get_user_preferences_returns()

static core_user_external::get_user_preferences_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 3.2

◆ get_users()

static core_user_external::get_users (   $criteria = array())
static

Retrieve matching user.

Exceptions
moodle_exception
Parameters
array$criteriathe allowed array keys are id/lastname/firstname/idnumber/username/email/auth.
Return values
arrayAn array of arrays containing user profiles.
Since
Moodle 2.5

◆ get_users_by_field()

static core_user_external::get_users_by_field (   $field,
  $values 
)
static

Get user information for a unique field.

Exceptions
coding_exception
invalid_parameter_exception
Parameters
string$field
array$values
Return values
arrayAn array of arrays containg user profiles.
Since
Moodle 2.4

◆ get_users_by_field_parameters()

static core_user_external::get_users_by_field_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.4

◆ get_users_by_field_returns()

static core_user_external::get_users_by_field_returns ( )
static

Returns description of method result value.

Return values
external_multiple_structure
Since
Moodle 2.4

◆ get_users_parameters()

static core_user_external::get_users_parameters ( )
static

Returns description of get_users() parameters.

Return values
external_function_parameters
Since
Moodle 2.5

◆ get_users_returns()

static core_user_external::get_users_returns ( )
static

Returns description of get_users result value.

Return values
external_description
Since
Moodle 2.5

◆ remove_user_device()

static core_user_external::remove_user_device (   $uuid,
  $appid = "" 
)
static

Remove a user device from the Moodle database (for PUSH notifications usually).

Parameters
string$uuidThe device UUID.
string$appidThe app id, opitonal parameter. If empty all the devices fmatching the UUID or the user will be removed.
Return values
arrayList of possible warnings and removal status.
Since
Moodle 2.9

◆ remove_user_device_parameters()

static core_user_external::remove_user_device_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.9

◆ remove_user_device_returns()

static core_user_external::remove_user_device_returns ( )
static

Returns description of method result value.

Return values
external_multiple_structure
Since
Moodle 2.9

◆ 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

◆ set_user_preferences()

static core_user_external::set_user_preferences (   $preferences)
static

Set user preferences.

Parameters
array$preferenceslist of preferences including name, value and userid
Return values
arrayof warnings and preferences saved
Since
Moodle 3.2
Exceptions
moodle_exception

◆ set_user_preferences_parameters()

static core_user_external::set_user_preferences_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 3.2

◆ set_user_preferences_returns()

static core_user_external::set_user_preferences_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 3.2

◆ update_picture()

static core_user_external::update_picture (   $draftitemid,
  $delete = false,
  $userid = 0 
)
static

Update or delete the user picture in the site.

Parameters
int$draftitemidid of the user draft file to use as image
bool$deleteif we should delete the user picture
int$useridid of the user, 0 for current user
Return values
arraywarnings and success status
Since
Moodle 3.2
Exceptions
moodle_exception

◆ update_picture_parameters()

static core_user_external::update_picture_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 3.2

◆ update_picture_returns()

static core_user_external::update_picture_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 3.2

◆ update_user_preferences()

static core_user_external::update_user_preferences (   $userid = 0,
  $emailstop = null,
  $preferences = array() 
)
static

Update the user's preferences.

Parameters
int$userid
bool | null$emailstop
array$preferences
Return values
null
Since
Moodle 3.2

◆ update_user_preferences_parameters()

static core_user_external::update_user_preferences_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 3.2

◆ update_user_preferences_returns()

static core_user_external::update_user_preferences_returns ( )
static

Returns description of method result value.

Return values
null
Since
Moodle 3.2

◆ update_users()

static core_user_external::update_users (   $users)
static

Update users.

Parameters
array$users
Return values
null
Since
Moodle 2.2

◆ update_users_parameters()

static core_user_external::update_users_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.2

◆ update_users_returns()

static core_user_external::update_users_returns ( )
static

Returns description of method result value.

Return values
null
Since
Moodle 2.2

◆ user_description()

static core_user_external::user_description (   $additionalfields = array())
static

Create user return value description.

Parameters
array$additionalfieldssome additional field
Return values
single_structure_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

◆ view_user_list()

static core_user_external::view_user_list (   $courseid)
static

Trigger the user_list_viewed event.

Parameters
int$courseidid of course
Return values
arrayof warnings and status result
Since
Moodle 2.9
Exceptions
moodle_exception

◆ view_user_list_parameters()

static core_user_external::view_user_list_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.9

◆ view_user_list_returns()

static core_user_external::view_user_list_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 2.9

◆ view_user_profile()

static core_user_external::view_user_profile (   $userid,
  $courseid = 0 
)
static

Trigger the user profile viewed event.

Parameters
int$useridid of user
int$courseidid of course
Return values
arrayof warnings and status result
Since
Moodle 2.9
Exceptions
moodle_exception

◆ view_user_profile_parameters()

static core_user_external::view_user_profile_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.9

◆ view_user_profile_returns()

static core_user_external::view_user_profile_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 2.9

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