Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
|
Static Public Member Functions | |
static | add_group_members ($members) |
Add group members. More... | |
static | add_group_members_parameters () |
Returns description of method parameters. More... | |
static | add_group_members_returns () |
Returns description of method result value. More... | |
static | assign_grouping ($assignments) |
Assign a group to a grouping. More... | |
static | assign_grouping_parameters () |
Returns description of method parameters. More... | |
static | assign_grouping_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_groupings ($groupings) |
Create groupings. More... | |
static | create_groupings_parameters () |
Returns description of method parameters. More... | |
static | create_groupings_returns () |
Returns description of method result value. More... | |
static | create_groups ($groups) |
Create groups. More... | |
static | create_groups_parameters () |
Returns description of method parameters. More... | |
static | create_groups_returns () |
Returns description of method result value. More... | |
static | delete_group_members ($members) |
Delete group members. More... | |
static | delete_group_members_parameters () |
Returns description of method parameters. More... | |
static | delete_group_members_returns () |
Returns description of method result value. More... | |
static | delete_groupings ($groupingids) |
Delete groupings. More... | |
static | delete_groupings_parameters () |
Returns description of method parameters. More... | |
static | delete_groupings_returns () |
Returns description of method result value. More... | |
static | delete_groups ($groupids) |
Delete groups. More... | |
static | delete_groups_parameters () |
Returns description of method parameters. More... | |
static | delete_groups_returns () |
Returns description of method result value. More... | |
static | external_function_info ($function, $strictness=MUST_EXIST) |
Returns detailed function information. More... | |
static | get_activity_allowed_groups ($cmid, $userid=0) |
Gets a list of groups that the user is allowed to access within the specified activity. More... | |
static | get_activity_allowed_groups_parameters () |
Returns description of method parameters. More... | |
static | get_activity_allowed_groups_returns () |
Returns description of method result value. More... | |
static | get_activity_groupmode ($cmid) |
Returns effective groupmode used in a given activity. More... | |
static | get_activity_groupmode_parameters () |
Returns description of method parameters. More... | |
static | get_activity_groupmode_returns () |
Returns description of method result value. More... | |
static | get_course_groupings ($courseid) |
Get all groupings in the specified course. More... | |
static | get_course_groupings_parameters () |
Returns description of method parameters. More... | |
static | get_course_groupings_returns () |
Returns description of method result value. More... | |
static | get_course_groups ($courseid) |
Get all groups in the specified course. More... | |
static | get_course_groups_parameters () |
Returns description of method parameters. More... | |
static | get_course_groups_returns () |
Returns description of method result value. More... | |
static | get_course_user_groups ($courseid=0, $userid=0, $groupingid=0) |
Get all groups in the specified course for the specified user. More... | |
static | get_course_user_groups_parameters () |
Returns description of method parameters. More... | |
static | get_course_user_groups_returns () |
Returns description of method result value. More... | |
static | get_group_members ($groupids) |
Return all members for a group. More... | |
static | get_group_members_parameters () |
Returns description of method parameters. More... | |
static | get_group_members_returns () |
Returns description of method result value. More... | |
static | get_groupings ($groupingids, $returngroups=false) |
Get groupings definition specified by ids. More... | |
static | get_groupings_parameters () |
Returns description of method parameters. More... | |
static | get_groupings_returns () |
Returns description of method result value. More... | |
static | get_groups ($groupids) |
Get groups definition specified by ids. More... | |
static | get_groups_parameters () |
Returns description of method parameters. More... | |
static | get_groups_returns () |
Returns description of method result value. More... | |
static | group_description () |
Create group return value description. 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 | unassign_grouping ($unassignments) |
Unassign a group from a grouping. More... | |
static | unassign_grouping_parameters () |
Returns description of method parameters. More... | |
static | unassign_grouping_returns () |
Returns description of method result value. More... | |
static | update_groupings ($groupings) |
Update groupings. More... | |
static | update_groupings_parameters () |
Returns description of method parameters. More... | |
static | update_groupings_returns () |
Returns description of method result value. More... | |
static | update_groups ($groups) |
Update groups. More... | |
static | update_groups_parameters () |
Returns description of method parameters. More... | |
static | update_groups_returns () |
Returns description of method 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... | |
|
static |
Add group members.
array | $members | of arrays with keys userid, groupid |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
Returns description of method result value.
null |
|
static |
Assign a group to a grouping.
array | $assignments | of arrays with keys groupid, groupingid |
void |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
Returns description of method result value.
null |
|
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.
string | $function | A webservice function name. |
array | $args | Params array (named params) |
boolean | $ajaxonly | If true, an extra check will be peformed to see if ajax is required. |
array | containing keys for error (bool), exception and data. |
|
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.
external_description | $description | description of the return values |
mixed | $response | the actual response |
mixed | response with added defaults for optional items, invalid_response_exception thrown if any problem found |
|
static |
Create groupings.
array | $groupings | array of grouping description arrays (with keys groupname and courseid) |
array | of newly created groupings |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
|
static |
Create groups.
array | $groups | array of group description arrays (with keys groupname and courseid) |
array | of newly created groups |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
|
static |
Delete group members.
array | $members | of arrays with keys userid, groupid |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
Returns description of method result value.
null |
|
static |
Delete groupings.
array | $groupingids | array of grouping ids |
void |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
|
static |
Delete groups.
array | $groupids | array of group ids |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
Returns description of method result value.
null |
|
staticinherited |
Returns detailed function information.
string | object | $function | name of external function or record from external_function |
int | $strictness | IGNORE_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 |
stdClass | description or false if not found or exception thrown |
|
static |
Gets a list of groups that the user is allowed to access within the specified activity.
moodle_exception |
int | $cmid | course module id |
int | $userid | id of user. |
array | of group objects (id, name, description, format) and possible warnings. |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
Returns description of method result value.
external_description | A single structure containing groups and possible warnings. |
|
static |
Returns effective groupmode used in a given activity.
moodle_exception |
int | $cmid | course module id. |
array | containing the group mode and possible warnings. |
moodle_exception |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
|
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.
array | $param |
invalid_parameter_exception |
context |
|
staticprotectedinherited |
Returns a prepared structure to use a context parameters.
external_single_structure |
Reimplemented in tool_lp\external, and core_competency\external.
|
static |
Get all groupings in the specified course.
int | $courseid | id of course |
array | of grouping objects (id, courseid, name, enrolmentkey) |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
|
static |
Get all groups in the specified course.
int | $courseid | id of course |
array | of group objects (id, courseid, name, enrolmentkey) |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
|
static |
Get all groups in the specified course for the specified user.
moodle_exception |
int | $courseid | id of course. |
int | $userid | id of user. |
int | $groupingid | optional returns only groups in the specified grouping. |
array | of group objects (id, name, description, format) and possible warnings. |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
Returns description of method result value.
external_description | A single structure containing groups and possible warnings. |
|
static |
Return all members for a group.
array | $groupids | array of group ids |
array | with group id keys containing arrays of user ids |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
|
static |
Get groupings definition specified by ids.
array | $groupingids | arrays of grouping ids |
boolean | $returngroups | return the associated groups if true. The default is false. |
array | of grouping objects (id, courseid, name) |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
|
static |
Get groups definition specified by ids.
array | $groupids | arrays of group ids |
array | of group objects (id, courseid, name, enrolmentkey) |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
|
static |
Create group return value description.
external_single_structure | The group description |
|
staticinherited |
Set context restriction for all following subsequent function calls.
stdClass | $context | the context restriction |
|
staticinherited |
This method has to be called before every operation that takes a longer time to finish!
int | $seconds | max expected time the next operation needs |
|
static |
Unassign a group from a grouping.
array | $unassignments | of arrays with keys groupid, groupingid |
void |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
Returns description of method result value.
null |
|
static |
Update groupings.
array | $groupings | array of grouping description arrays (with keys groupname and courseid) |
array | of newly updated groupings |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
|
static |
Update groups.
array | $groups |
null |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
Returns description of method result value.
null |
|
staticinherited |
Makes sure user may execute functions in this context.
stdClass | $context |
|
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.
external_description | $description | description of parameters |
mixed | $params | the actual parameters |
mixed | params with added defaults for optional items, invalid_parameters_exception thrown if any problem found |