| Moodle APIs 4.3
    Moodle 4.3.6 (Build: 20240812) | 
Course external functions. More...
| Static Public Member Functions | |
| static | add_content_item_to_user_favourites (string $componentname, int $contentitemid) | 
| Add a content item to a user's favourites. | |
| static | add_content_item_to_user_favourites_parameters () | 
| Returns description of method parameters. | |
| static | add_content_item_to_user_favourites_returns () | 
| Returns description of method result value. | |
| static | check_updates ($courseid, $tocheck, $filter=array()) | 
| Check if there is updates affecting the user for the given course and contexts. | |
| static | check_updates_parameters () | 
| Returns description of method parameters. | |
| static | check_updates_returns () | 
| Returns description of method result value. | |
| static | create_categories ($categories) | 
| Create categories. | |
| static | create_categories_parameters () | 
| Returns description of method parameters. | |
| static | create_categories_returns () | 
| Returns description of method parameters. | |
| static | create_courses ($courses) | 
| Create courses. | |
| static | create_courses_parameters () | 
| Returns description of method parameters. | |
| static | create_courses_returns () | 
| Returns description of method result value. | |
| static | delete_categories ($categories) | 
| Delete categories. | |
| static | delete_categories_parameters () | 
| Returns description of method parameters. | |
| static | delete_categories_returns () | 
| Returns description of method parameters. | |
| static | delete_courses ($courseids) | 
| Delete courses. | |
| static | delete_courses_parameters () | 
| Returns description of method parameters. | |
| static | delete_courses_returns () | 
| Returns description of method result value. | |
| static | delete_modules ($cmids) | 
| Deletes a list of provided module instances. | |
| static | delete_modules_parameters () | 
| Describes the parameters for delete_modules. | |
| static | delete_modules_returns () | 
| Describes the delete_modules return value. | |
| static | duplicate_course ($courseid, $fullname, $shortname, $categoryid, $visible=1, $options=array()) | 
| Duplicate a course. | |
| static | duplicate_course_parameters () | 
| Returns description of method parameters. | |
| static | duplicate_course_returns () | 
| Returns description of method result value. | |
| static | edit_module ($action, $id, $sectionreturn=null) | 
| Performs one of the edit module actions and return new html for AJAX. | |
| static | edit_module_parameters () | 
| Parameters for function edit_module() | |
| static | edit_module_returns () | 
| Return structure for edit_module() | |
| static | edit_section ($action, $id, $sectionreturn) | 
| Performs one of the edit section actions. | |
| static | edit_section_parameters () | 
| Parameters for function edit_section() | |
| static | edit_section_returns () | 
| Return structure for edit_section() | |
| static | get_activity_chooser_footer (int $courseid, int $sectionid) | 
| Given a course ID we need to build up a footre for the chooser. | |
| static | get_activity_chooser_footer_parameters () | 
| Returns description of method parameters. | |
| static | get_activity_chooser_footer_returns () | 
| Returns description of method result value. | |
| static | get_categories ($criteria=array(), $addsubcategories=true) | 
| Get categories. | |
| static | get_categories_parameters () | 
| Returns description of method parameters. | |
| static | get_categories_returns () | 
| Returns description of method result value. | |
| static | get_course_content_items (int $courseid) | 
| Given a course ID fetch all accessible modules for that course. | |
| static | get_course_content_items_parameters () | 
| Returns description of method parameters. | |
| static | get_course_content_items_returns () | 
| Returns description of method result value. | |
| static | get_course_contents ($courseid, $options=array()) | 
| Get course contents. | |
| static | get_course_contents_parameters () | 
| Returns description of method parameters. | |
| static | get_course_contents_returns () | 
| Returns description of method result value. | |
| static | get_course_module ($cmid) | 
| Return information about a course module. | |
| static | get_course_module_by_instance ($module, $instance) | 
| Return information about a course module. | |
| static | get_course_module_by_instance_parameters () | 
| Returns description of method parameters. | |
| static | get_course_module_by_instance_returns () | 
| Returns description of method result value. | |
| static | get_course_module_parameters () | 
| Returns description of method parameters. | |
| static | get_course_module_returns () | 
| Returns description of method result value. | |
| static | get_courses ($options=array()) | 
| Get courses. | |
| static | get_courses_by_field ($field='', $value='') | 
| Get courses matching a specific field (id/s, shortname, idnumber, category) | |
| static | get_courses_by_field_parameters () | 
| Returns description of method parameters. | |
| static | get_courses_by_field_returns () | 
| Returns description of method result value. | |
| static | get_courses_parameters () | 
| Returns description of method parameters. | |
| static | get_courses_returns () | 
| Returns description of method result value. | |
| static | get_editable_customfields (\context $context, int $courseid=0) | 
| Return array of all editable course custom fields indexed by their shortname. | |
| static | get_enrolled_courses_by_timeline_classification (string $classification, int $limit=0, int $offset=0, string $sort=null, string $customfieldname=null, string $customfieldvalue=null, string $searchvalue=null) | 
| Get courses matching the given timeline classification. | |
| static | get_enrolled_courses_by_timeline_classification_parameters () | 
| Returns description of method parameters. | |
| static | get_enrolled_courses_by_timeline_classification_returns () | 
| Returns description of method result value. | |
| static | get_enrolled_users_by_cmid (int $cmid, int $groupid=0, bool $onlyactive=false) | 
| Get all users in a course for a given cmid. | |
| static | get_enrolled_users_by_cmid_parameters () | 
| Returns description of method parameters. | |
| static | get_enrolled_users_by_cmid_returns () | 
| Returns description of method result value. | |
| static | get_module ($id, $sectionreturn=null) | 
| Returns html for displaying one activity module on course page. | |
| static | get_module_parameters () | 
| Parameters for function get_module() | |
| static | get_module_returns () | 
| Return structure for get_module() | |
| 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. | |
| static | get_recent_courses_parameters () | 
| Returns description of method parameters. | |
| static | get_recent_courses_returns () | 
| Returns description of method result value. | |
| 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. | |
| static | get_updates_since_parameters () | 
| Returns description of method parameters. | |
| static | get_updates_since_returns () | 
| Returns description of method result value. | |
| 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. | |
| static | get_user_administration_options_parameters () | 
| Returns description of method parameters. | |
| static | get_user_administration_options_returns () | 
| Returns description of method result value. | |
| 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. | |
| static | get_user_navigation_options_parameters () | 
| Returns description of method parameters. | |
| static | get_user_navigation_options_returns () | 
| Returns description of method result value. | |
| static | import_course ($importfrom, $importto, $deletecontent=0, $options=array()) | 
| Imports a course. | |
| static | import_course_parameters () | 
| Returns description of method parameters for import_course. | |
| static | import_course_returns () | 
| Returns description of method result value. | |
| static | remove_content_item_from_user_favourites (string $componentname, int $contentitemid) | 
| Remove a content item from a user's favourites. | |
| static | remove_content_item_from_user_favourites_parameters () | 
| Returns description of method parameters. | |
| static | remove_content_item_from_user_favourites_returns () | 
| Returns description of method result value. | |
| static | search_courses ($criterianame, $criteriavalue, $page=0, $perpage=0, $requiredcapabilities=array(), $limittoenrolled=0, $onlywithcompletion=0) | 
| Search courses following the specified criteria. | |
| static | search_courses_parameters () | 
| Returns description of method parameters. | |
| static | search_courses_returns () | 
| Returns description of method result value. | |
| static | set_favourite_courses (array $courses) | 
| Set the course favourite status for an array of courses. | |
| static | set_favourite_courses_parameters () | 
| Returns description of method parameters. | |
| static | set_favourite_courses_returns () | 
| Returns description of method result value. | |
| static | toggle_activity_recommendation (string $area, int $id) | 
| Update the recommendation for an activity item. | |
| static | toggle_activity_recommendation_parameters () | 
| Returns description of method parameters. | |
| static | toggle_activity_recommendation_returns () | 
| Returns warnings. | |
| static | update_categories ($categories) | 
| Update categories. | |
| static | update_categories_parameters () | 
| Returns description of method parameters. | |
| static | update_categories_returns () | 
| Returns description of method result value. | |
| static | update_courses ($courses) | 
| Update courses. | |
| static | update_courses_parameters () | 
| Update courses. | |
| static | update_courses_returns () | 
| Returns description of method result value. | |
| static | user_description () | 
| Create user return value description. | |
| static | view_course ($courseid, $sectionnumber=0) | 
| Trigger the course viewed event. | |
| static | view_course_parameters () | 
| Returns description of method parameters. | |
| static | view_course_returns () | 
| Returns description of method result value. | |
| Static Protected Member Functions | |
| static | get_activitybadge_structure () | 
| Returns description of activitybadge data. | |
| static | get_course_public_information (core_course_list_element $course, $coursecontext) | 
| Return the course information that is public (visible by every one) | |
| static | get_course_structure ($onlypublicdata=true) | 
| Returns a course structure definition. | |
Course external functions.
| 
 | static | 
Add a content item to a user's favourites.
| string | $componentname | the name of the component from which this content item originates. | 
| int | $contentitemid | the id of the content item. | 
| stdClass | the exporter content item. | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | static | 
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 | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | static | 
Create categories.
| array | $categories | - see create_categories_parameters() for the array structure | 
| array | - see create_categories_returns() for the array structure | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Create courses.
| array | $courses | 
| array | courses (id and shortname only) | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | static | 
Delete categories.
| array | $categories | A list of category ids | 
| array | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Delete courses.
| array | $courseids | A list of course ids | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | static | 
Deletes a list of provided module instances.
| array | $cmids | the course module ids | 
| 
 | static | 
Describes the parameters for delete_modules.
| external_function_parameters | 
| 
 | static | 
Describes the delete_modules return value.
| external_single_structure | 
| 
 | static | 
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 | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | static | 
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 | 
| 
 | static | 
Parameters for function edit_module()
| external_function_parameters | 
| 
 | static | 
| 
 | static | 
Performs one of the edit section actions.
| string | $action | |
| int | $id | section id | 
| int | $sectionreturn | section to return to | 
| string | 
| 
 | static | 
Parameters for function edit_section()
| external_function_parameters | 
| 
 | static | 
Return structure for edit_section()
| core_external\external_description | 
| 
 | static | 
Given a course ID we need to build up a footre for the chooser.
| int | $courseid | The course we want to fetch the modules for | 
| int | $sectionid | The section we want to fetch the modules for | 
| array | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | staticprotected | 
Returns description of activitybadge data.
| external_description | 
| 
 | static | 
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 | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | static | 
Given a course ID fetch all accessible modules for that course.
| int | $courseid | The course we want to fetch the modules for | 
| array | Contains array of modules and their metadata | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | static | 
Get course contents.
| int | $courseid | course id | 
| array | $options | Options for filtering the results, used since Moodle 2.9 | 
| array | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | static | 
Return information about a course module.
| int | $cmid | the course module id | 
| array | of warnings and the course module | 
| moodle_exception | 
| 
 | static | 
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 | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | staticprotected | 
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 | 
| 
 | staticprotected | 
Returns a course structure definition.
| boolean | $onlypublicdata | set to true, to retrieve only fields viewable by anyone when the course is visible | 
| external_single_structure | the course structure | 
| 
 | static | 
Get courses.
| array | $options | It contains an array (list of ids) | 
| array | 
| 
 | static | 
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 | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | static | 
Return array of all editable course custom fields indexed by their shortname.
| context | $context | |
| int | $courseid | 
| core_customfield\field_controller[] | 
| 
 | static | 
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 | |
| string | $searchvalue | 
| array | list of courses and warnings | 
| invalid_parameter_exception | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | static | 
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 | 
| bool | $onlyactive | Whether to return only the active enrolled users or all enrolled users in the course. | 
| array | List of users | 
| invalid_parameter_exception | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | static | 
Returns html for displaying one activity module on course page.
| int | $id | |
| null | int | $sectionreturn | 
| string | 
| 
 | static | 
Parameters for function get_module()
| external_function_parameters | 
| 
 | static | 
| 
 | static | 
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 | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | static | 
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 | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | static | 
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 | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | static | 
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 | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | static | 
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 | 
| 
 | static | 
Returns description of method parameters for import_course.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | static | 
Remove a content item from a user's favourites.
| string | $componentname | the name of the component from which this content item originates. | 
| int | $contentitemid | the id of the content item. | 
| stdClass | the exported content item. | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | static | 
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 | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | static | 
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. | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | static | 
Update the recommendation for an activity item.
| string | $area | identifier for this activity. | 
| int | $id | Associated id. This is needed in conjunction with the area to find the recommendation. | 
| array | some warnings or something. | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns warnings.
| core_external\external_description | 
| 
 | static | 
Update categories.
| array | $categories | The list of categories to update | 
| null | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | static | 
Update courses.
| array | $courses | 
| 
 | static | 
Update courses.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description | 
| 
 | static | 
Create user return value description.
| core_external\external_description | 
| 
 | static | 
Trigger the course viewed event.
| int | $courseid | id of course | 
| int | $sectionnumber | sectionnumber (0, 1, 2...) | 
| array | of warnings and status result | 
| moodle_exception | 
| 
 | static | 
Returns description of method parameters.
| external_function_parameters | 
| 
 | static | 
Returns description of method result value.
| core_external\external_description |