| 
    Moodle APIs
    3.8
    
   Moodle 3.8.6 (Build: 20201109) 
   | 
 
Starred courses block external functions. More...
  
Static Public Member Functions | |
| static | call_external_function ($function, $args, $ajaxonly=false) | 
| Call an external function validating all params/returns correctly.  More... | |
| static | check_updates ($courseid, $tocheck, $filter=array()) | 
| Check if there is updates affecting the user for the given course and contexts.  More... | |
| static | check_updates_parameters () | 
| Returns description of method parameters.  More... | |
| static | check_updates_returns () | 
| Returns description of method result value.  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_categories ($categories) | 
| Create categories.  More... | |
| static | create_categories_parameters () | 
| Returns description of method parameters.  More... | |
| static | create_categories_returns () | 
| Returns description of method parameters.  More... | |
| static | create_courses ($courses) | 
| Create courses.  More... | |
| static | create_courses_parameters () | 
| Returns description of method parameters.  More... | |
| static | create_courses_returns () | 
| Returns description of method result value.  More... | |
| static | delete_categories ($categories) | 
| Delete categories.  More... | |
| static | delete_categories_parameters () | 
| Returns description of method parameters.  More... | |
| static | delete_categories_returns () | 
| Returns description of method parameters.  More... | |
| static | delete_courses ($courseids) | 
| Delete courses.  More... | |
| static | delete_courses_parameters () | 
| Returns description of method parameters.  More... | |
| static | delete_courses_returns () | 
| Returns description of method result value.  More... | |
| static | delete_modules ($cmids) | 
| Deletes a list of provided module instances.  More... | |
| static | delete_modules_parameters () | 
| Describes the parameters for delete_modules.  More... | |
| static | delete_modules_returns () | 
| Describes the delete_modules return value.  More... | |
| static | duplicate_course ($courseid, $fullname, $shortname, $categoryid, $visible=1, $options=array()) | 
| Duplicate a course.  More... | |
| static | duplicate_course_parameters () | 
| Returns description of method parameters.  More... | |
| static | duplicate_course_returns () | 
| Returns description of method result value.  More... | |
| static | edit_module ($action, $id, $sectionreturn=null) | 
| Performs one of the edit module actions and return new html for AJAX.  More... | |
| static | edit_module_parameters () | 
| Parameters for function edit_module()  More... | |
| static | edit_module_returns () | 
| Return structure for edit_module()  More... | |
| static | edit_section ($action, $id, $sectionreturn) | 
| Performs one of the edit section actions.  More... | |
| static | edit_section_parameters () | 
| Parameters for function edit_section()  More... | |
| static | edit_section_returns () | 
| Return structure for edit_section()  More... | |
| static | external_function_info ($function, $strictness=MUST_EXIST) | 
| Returns detailed function information.  More... | |
| static | get_categories ($criteria=array(), $addsubcategories=true) | 
| Get categories.  More... | |
| static | get_categories_parameters () | 
| Returns description of method parameters.  More... | |
| static | get_categories_returns () | 
| Returns description of method result value.  More... | |
| static | get_course_contents ($courseid, $options=array()) | 
| Get course contents.  More... | |
| static | get_course_contents_parameters () | 
| Returns description of method parameters.  More... | |
| static | get_course_contents_returns () | 
| Returns description of method result value.  More... | |
| static | get_course_module ($cmid) | 
| Return information about a course module.  More... | |
| static | get_course_module_by_instance ($module, $instance) | 
| Return information about a course module.  More... | |
| static | get_course_module_by_instance_parameters () | 
| Returns description of method parameters.  More... | |
| static | get_course_module_by_instance_returns () | 
| Returns description of method result value.  More... | |
| static | get_course_module_parameters () | 
| Returns description of method parameters.  More... | |
| static | get_course_module_returns () | 
| Returns description of method result value.  More... | |
| static | get_courses ($options=array()) | 
| Get courses.  More... | |
| static | get_courses_by_field ($field='', $value='') | 
| Get courses matching a specific field (id/s, shortname, idnumber, category)  More... | |
| static | get_courses_by_field_parameters () | 
| Returns description of method parameters.  More... | |
| static | get_courses_by_field_returns () | 
| Returns description of method result value.  More... | |
| static | get_courses_parameters () | 
| Returns description of method parameters.  More... | |
| static | get_courses_returns () | 
| Returns description of method result value.  More... | |
| static | get_enrolled_courses_by_timeline_classification (string $classification, int $limit=0, int $offset=0, string $sort=null, string $customfieldname=null, string $customfieldvalue=null) | 
| Get courses matching the given timeline classification.  More... | |
| static | get_enrolled_courses_by_timeline_classification_parameters () | 
| Returns description of method parameters.  More... | |
| static | get_enrolled_courses_by_timeline_classification_returns () | 
| Returns description of method result value.  More... | |
| static | get_enrolled_users_by_cmid (int $cmid, int $groupid=0) | 
| Get all users in a course for a given cmid.  More... | |
| static | get_enrolled_users_by_cmid_parameters () | 
| Returns description of method parameters.  More... | |
| static | get_enrolled_users_by_cmid_returns () | 
| Returns description of method result value.  More... | |
| static | get_module ($id, $sectionreturn=null) | 
| Returns html for displaying one activity module on course page.  More... | |
| static | get_module_parameters () | 
| Parameters for function get_module()  More... | |
| static | get_module_returns () | 
| Return structure for get_module()  More... | |
| static | get_recent_courses (int $userid=0, int $limit=0, int $offset=0, string $sort=null) | 
| Get last accessed courses adding additional course information like images.  More... | |
| static | get_recent_courses_parameters () | 
| Returns description of method parameters.  More... | |
| static | get_recent_courses_returns () | 
| Returns description of method result value.  More... | |
| static | get_starred_courses ($limit, $offset) | 
| Get users starred courses.  More... | |
| static | get_starred_courses_parameters () | 
| Returns description of method parameters.  More... | |
| static | get_starred_courses_returns () | 
| Returns description of method result value.  More... | |
| static | get_updates_since ($courseid, $since, $filter=array()) | 
| Check if there are updates affecting the user for the given course since the given time stamp.  More... | |
| static | get_updates_since_parameters () | 
| Returns description of method parameters.  More... | |
| static | get_updates_since_returns () | 
| Returns description of method result value.  More... | |
| static | get_user_administration_options ($courseids) | 
| Return a list of administration options in a set of courses that are available or not for the current user.  More... | |
| static | get_user_administration_options_parameters () | 
| Returns description of method parameters.  More... | |
| static | get_user_administration_options_returns () | 
| Returns description of method result value.  More... | |
| static | get_user_navigation_options ($courseids) | 
| Return a list of navigation options in a set of courses that are avaialable or not for the current user.  More... | |
| static | get_user_navigation_options_parameters () | 
| Returns description of method parameters.  More... | |
| static | get_user_navigation_options_returns () | 
| Returns description of method result value.  More... | |
| static | import_course ($importfrom, $importto, $deletecontent=0, $options=array()) | 
| Imports a course.  More... | |
| static | import_course_parameters () | 
| Returns description of method parameters for import_course.  More... | |
| static | import_course_returns () | 
| Returns description of method result value.  More... | |
| static | search_courses ($criterianame, $criteriavalue, $page=0, $perpage=0, $requiredcapabilities=array(), $limittoenrolled=0, $onlywithcompletion=0) | 
| Search courses following the specified criteria.  More... | |
| static | search_courses_parameters () | 
| Returns description of method parameters.  More... | |
| static | search_courses_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_favourite_courses (array $courses) | 
| Set the course favourite status for an array of courses.  More... | |
| static | set_favourite_courses_parameters () | 
| Returns description of method parameters.  More... | |
| static | set_favourite_courses_returns () | 
| Returns description of method result value.  More... | |
| static | set_timeout ($seconds=360) | 
| This method has to be called before every operation that takes a longer time to finish!  More... | |
| static | update_categories ($categories) | 
| Update categories.  More... | |
| static | update_categories_parameters () | 
| Returns description of method parameters.  More... | |
| static | update_categories_returns () | 
| Returns description of method result value.  More... | |
| static | update_courses ($courses) | 
| Update courses.  More... | |
| static | update_courses_parameters () | 
| Update courses.  More... | |
| static | update_courses_returns () | 
| Returns description of method result value.  More... | |
| static | user_description () | 
| 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_course ($courseid, $sectionnumber=0) | 
| Trigger the course viewed event.  More... | |
| static | view_course_parameters () | 
| Returns description of method parameters.  More... | |
| static | view_course_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... | |
| static | get_course_public_information (core_course_list_element $course, $coursecontext) | 
| Return the course information that is public (visible by every one)  More... | |
| static | get_course_structure ($onlypublicdata=true) | 
| Returns a course structure definition.  More... | |
Starred courses block external functions.
      
  | 
  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 | 
Check if there is updates affecting the user for the given course and contexts.
Right now only modules are supported. This WS calls mod_check_updates_since for each module to check if there is any update the user should we aware of.
| int | $courseid | the list of modules to check | 
| array | $tocheck | the list of modules to check | 
| array | $filter | check only for updates in these areas | 
| array | list of updates and warnings | 
| moodle_exception | 
      
  | 
  staticinherited | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  staticinherited | 
      
  | 
  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 | 
      
  | 
  staticinherited | 
Create categories.
| array | $categories | - see create_categories_parameters() for the array structure | 
| array | - see create_categories_returns() for the array structure | 
      
  | 
  staticinherited | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  staticinherited | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  staticinherited | 
Create courses.
| array | $courses | 
| array | courses (id and shortname only) | 
      
  | 
  staticinherited | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  staticinherited | 
      
  | 
  staticinherited | 
Delete categories.
| array | $categories | A list of category ids | 
| array | 
      
  | 
  staticinherited | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  staticinherited | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  staticinherited | 
Delete courses.
| array | $courseids | A list of course ids | 
      
  | 
  staticinherited | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  staticinherited | 
      
  | 
  staticinherited | 
Deletes a list of provided module instances.
| array | $cmids | the course module ids | 
      
  | 
  staticinherited | 
Describes the parameters for delete_modules.
| external_function_parameters | 
      
  | 
  staticinherited | 
      
  | 
  staticinherited | 
Duplicate a course.
| int | $courseid | |
| string | $fullname | Duplicated course fullname | 
| string | $shortname | Duplicated course shortname | 
| int | $categoryid | Duplicated course parent category id | 
| int | $visible | Duplicated course availability | 
| array | $options | List of backup options | 
| array | New course info | 
      
  | 
  staticinherited | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  staticinherited | 
      
  | 
  staticinherited | 
Performs one of the edit module actions and return new html for AJAX.
Returns html to replace the current module html with, for example:
Throws exception if operation is not permitted/possible
| string | $action | |
| int | $id | |
| null | int | $sectionreturn | 
| string | 
      
  | 
  staticinherited | 
      
  | 
  staticinherited | 
      
  | 
  staticinherited | 
Performs one of the edit section actions.
| string | $action | |
| int | $id | section id | 
| int | $sectionreturn | section to return to | 
| string | 
      
  | 
  staticinherited | 
      
  | 
  staticinherited | 
      
  | 
  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 | 
      
  | 
  staticinherited | 
Get categories.
| array | $criteria | Criteria to match the results | 
| booln | $addsubcategories | obtain only the category (false) or its subcategories (true - default) | 
| array | list of categories | 
      
  | 
  staticinherited | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  staticinherited | 
      
  | 
  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 core_competency\external, and tool_lp\external.
      
  | 
  staticinherited | 
Get course contents.
| int | $courseid | course id | 
| array | $options | Options for filtering the results, used since Moodle 2.9 | 
| array | 
      
  | 
  staticinherited | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  staticinherited | 
      
  | 
  staticinherited | 
Return information about a course module.
| int | $cmid | the course module id | 
| array | of warnings and the course module | 
| moodle_exception | 
      
  | 
  staticinherited | 
Return information about a course module.
| string | $module | the module name | 
| int | $instance | the activity instance id | 
| array | of warnings and the course module | 
| moodle_exception | 
      
  | 
  staticinherited | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  staticinherited | 
      
  | 
  staticinherited | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  staticinherited | 
      
  | 
  staticprotectedinherited | 
Return the course information that is public (visible by every one)
| core_course_list_element | $course | course in list object | 
| stdClass | $coursecontext | course context object | 
| array | the course information | 
      
  | 
  staticprotectedinherited | 
Returns a course structure definition.
| boolean | $onlypublicdata | set to true, to retrieve only fields viewable by anyone when the course is visible | 
| array | the course structure | 
      
  | 
  staticinherited | 
Get courses.
| array | $options | It contains an array (list of ids) | 
| array | 
      
  | 
  staticinherited | 
Get courses matching a specific field (id/s, shortname, idnumber, category)
| string | $field | field name to search, or empty for all courses | 
| string | $value | value to search | 
| array | list of courses and warnings | 
| invalid_parameter_exception | 
      
  | 
  staticinherited | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  staticinherited | 
      
  | 
  staticinherited | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  staticinherited | 
      
  | 
  staticinherited | 
Get courses matching the given timeline classification.
NOTE: The offset applies to the unfiltered full set of courses before the classification filtering is done. E.g. If the user is enrolled in 5 courses: c1, c2, c3, c4, and c5 And c4 and c5 are 'future' courses
If a request comes in for future courses with an offset of 1 it will mean that c1 is skipped (because the offset applies before the classification filtering) and c4 and c5 will be return.
| string | $classification | past, inprogress, or future | 
| int | $limit | Result set limit | 
| int | $offset | Offset the full course set before timeline classification is applied | 
| string | $sort | SQL sort string for results | 
| string | $customfieldname | |
| string | $customfieldvalue | 
| array | list of courses and warnings | 
| invalid_parameter_exception | 
      
  | 
  staticinherited | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  staticinherited | 
Returns description of method result value.
| external_description | 
      
  | 
  staticinherited | 
Get all users in a course for a given cmid.
| int | $cmid | Course Module id from which the users will be obtained | 
| int | $groupid | Group id from which the users will be obtained | 
| array | List of users | 
| invalid_parameter_exception | 
      
  | 
  staticinherited | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  staticinherited | 
Returns description of method result value.
| external_description | 
      
  | 
  staticinherited | 
Returns html for displaying one activity module on course page.
| int | $id | |
| null | int | $sectionreturn | 
| string | 
      
  | 
  staticinherited | 
      
  | 
  staticinherited | 
      
  | 
  staticinherited | 
Get last accessed courses adding additional course information like images.
| int | $userid | User id from which the courses will be obtained | 
| int | $limit | Restrict result set to this amount | 
| int | $offset | Skip this number of records from the start of the result set | 
| string | null | $sort | SQL string for sorting | 
| array | List of courses | 
| invalid_parameter_exception | 
      
  | 
  staticinherited | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  staticinherited | 
      
  | 
  static | 
Get users starred courses.
| int | $limit | Limit | 
| int | $offset | Offset | 
| array | list of courses and warnings | 
      
  | 
  static | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  static | 
      
  | 
  staticinherited | 
Check if there are updates affecting the user for the given course since the given time stamp.
This function is a wrapper of self::check_updates for retrieving all the updates since a given time for all the activities.
| int | $courseid | the list of modules to check | 
| int | $since | check updates since this time stamp | 
| array | $filter | check only for updates in these areas | 
| array | list of updates and warnings | 
| moodle_exception | 
      
  | 
  staticinherited | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  staticinherited | 
      
  | 
  staticinherited | 
Return a list of administration options in a set of courses that are available or not for the current user.
| array | $courseids | a list of course ids | 
| array | of warnings and the options availability | 
| moodle_exception | 
      
  | 
  staticinherited | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  staticinherited | 
      
  | 
  staticinherited | 
Return a list of navigation options in a set of courses that are avaialable or not for the current user.
| array | $courseids | a list of course ids | 
| array | of warnings and the options availability | 
| moodle_exception | 
      
  | 
  staticinherited | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  staticinherited | 
      
  | 
  staticinherited | 
Imports a course.
| int | $importfrom | The id of the course we are importing from | 
| int | $importto | The id of the course we are importing to | 
| bool | $deletecontent | Whether to delete the course we are importing to content | 
| array | $options | List of backup options | 
| null | 
      
  | 
  staticinherited | 
Returns description of method parameters for import_course.
| external_function_parameters | 
      
  | 
  staticinherited | 
      
  | 
  staticinherited | 
Search courses following the specified criteria.
| string | $criterianame | Criteria name (search, modulelist (only admins), blocklist (only admins), tagid) | 
| string | $criteriavalue | Criteria value | 
| int | $page | Page number (for pagination) | 
| int | $perpage | Items per page | 
| array | $requiredcapabilities | Optional list of required capabilities (used to filter the list). | 
| int | $limittoenrolled | Limit to only enrolled courses | 
| int | onlywithcompletion Limit to only courses where completion is enabled | 
| array | of course objects and warnings | 
| moodle_exception | 
      
  | 
  staticinherited | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  staticinherited | 
      
  | 
  staticinherited | 
Set context restriction for all following subsequent function calls.
| stdClass | $context | the context restriction | 
      
  | 
  staticinherited | 
Set the course favourite status for an array of courses.
| array | $courses | List with course id's and favourite status. | 
| array | Array with an array of favourite courses. | 
      
  | 
  staticinherited | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  staticinherited | 
Returns description of method result value.
| external_description | 
      
  | 
  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 | 
      
  | 
  staticinherited | 
Update categories.
| array | $categories | The list of categories to update | 
| null | 
      
  | 
  staticinherited | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  staticinherited | 
      
  | 
  staticinherited | 
Update courses.
| array | $courses | 
      
  | 
  staticinherited | 
      
  | 
  staticinherited | 
      
  | 
  staticinherited | 
Create user return value description.
| external_description | 
      
  | 
  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 | 
      
  | 
  staticinherited | 
Trigger the course viewed event.
| int | $courseid | id of course | 
| int | $sectionnumber | sectionnumber (0, 1, 2...) | 
| array | of warnings and status result | 
| moodle_exception | 
      
  | 
  staticinherited | 
Returns description of method parameters.
| external_function_parameters | 
      
  | 
  staticinherited |