Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Static Public Member Functions | Static Protected Member Functions | List of all members
core_course_external Class Reference
Inheritance diagram for core_course_external:
external_api block_starredcourses_external

Static Public Member Functions

static add_content_item_to_user_favourites (string $componentname, int $contentitemid)
 Add a content item to a user's favourites. More...
 
static add_content_item_to_user_favourites_parameters ()
 Returns description of method parameters. More...
 
static add_content_item_to_user_favourites_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 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_activity_chooser_footer (int $courseid, int $sectionid)
 Given a course ID we need to build up a footre for the chooser. More...
 
static get_activity_chooser_footer_parameters ()
 Returns description of method parameters. More...
 
static get_activity_chooser_footer_returns ()
 Returns description of method result value. 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_content_items (int $courseid)
 Given a course ID fetch all accessible modules for that course. More...
 
static get_course_content_items_parameters ()
 Returns description of method parameters. More...
 
static get_course_content_items_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_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 remove_content_item_from_user_favourites (string $componentname, int $contentitemid)
 Remove a content item from a user's favourites. More...
 
static remove_content_item_from_user_favourites_parameters ()
 Returns description of method parameters. More...
 
static remove_content_item_from_user_favourites_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 toggle_activity_recommendation (string $area, int $id)
 Update the recommendation for an activity item. More...
 
static toggle_activity_recommendation_parameters ()
 Returns description of method parameters. More...
 
static toggle_activity_recommendation_returns ()
 Returns warnings. 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...
 

Member Function Documentation

◆ add_content_item_to_user_favourites()

static core_course_external::add_content_item_to_user_favourites ( string  $componentname,
int  $contentitemid 
)
static

Add a content item to a user's favourites.

Parameters
string$componentnamethe name of the component from which this content item originates.
int$contentitemidthe id of the content item.
Return values
stdClassthe exporter content item.

◆ add_content_item_to_user_favourites_parameters()

static core_course_external::add_content_item_to_user_favourites_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters

◆ add_content_item_to_user_favourites_returns()

static core_course_external::add_content_item_to_user_favourites_returns ( )
static

Returns description of method result value.

Return values
external_description

◆ 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.

◆ check_updates()

static core_course_external::check_updates (   $courseid,
  $tocheck,
  $filter = array() 
)
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.

Parameters
int$courseidthe list of modules to check
array$tocheckthe list of modules to check
array$filtercheck only for updates in these areas
Return values
arraylist of updates and warnings
Exceptions
moodle_exception
Since
Moodle 3.2

◆ check_updates_parameters()

static core_course_external::check_updates_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 3.2

◆ check_updates_returns()

static core_course_external::check_updates_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 3.2

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

static core_course_external::create_categories (   $categories)
static

Create categories.

Parameters
array$categories- see create_categories_parameters() for the array structure
Return values
array- see create_categories_returns() for the array structure
Since
Moodle 2.3

◆ create_categories_parameters()

static core_course_external::create_categories_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.3

◆ create_categories_returns()

static core_course_external::create_categories_returns ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.3

◆ create_courses()

static core_course_external::create_courses (   $courses)
static

Create courses.

Parameters
array$courses
Return values
arraycourses (id and shortname only)
Since
Moodle 2.2

◆ create_courses_parameters()

static core_course_external::create_courses_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.2

◆ create_courses_returns()

static core_course_external::create_courses_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 2.2

◆ delete_categories()

static core_course_external::delete_categories (   $categories)
static

Delete categories.

Parameters
array$categoriesA list of category ids
Return values
array
Since
Moodle 2.3

◆ delete_categories_parameters()

static core_course_external::delete_categories_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.3

◆ delete_categories_returns()

static core_course_external::delete_categories_returns ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.3

◆ delete_courses()

static core_course_external::delete_courses (   $courseids)
static

Delete courses.

Parameters
array$courseidsA list of course ids
Since
Moodle 2.2

◆ delete_courses_parameters()

static core_course_external::delete_courses_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.2

◆ delete_courses_returns()

static core_course_external::delete_courses_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 2.2

◆ delete_modules()

static core_course_external::delete_modules (   $cmids)
static

Deletes a list of provided module instances.

Parameters
array$cmidsthe course module ids
Since
Moodle 2.5

◆ delete_modules_parameters()

static core_course_external::delete_modules_parameters ( )
static

Describes the parameters for delete_modules.

Return values
external_function_parameters
Since
Moodle 2.5

◆ delete_modules_returns()

static core_course_external::delete_modules_returns ( )
static

Describes the delete_modules return value.

Return values
external_single_structure
Since
Moodle 2.5

◆ duplicate_course()

static core_course_external::duplicate_course (   $courseid,
  $fullname,
  $shortname,
  $categoryid,
  $visible = 1,
  $options = array() 
)
static

Duplicate a course.

Parameters
int$courseid
string$fullnameDuplicated course fullname
string$shortnameDuplicated course shortname
int$categoryidDuplicated course parent category id
int$visibleDuplicated course availability
array$optionsList of backup options
Return values
arrayNew course info
Since
Moodle 2.3

◆ duplicate_course_parameters()

static core_course_external::duplicate_course_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.3

◆ duplicate_course_returns()

static core_course_external::duplicate_course_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 2.3

◆ edit_module()

static core_course_external::edit_module (   $action,
  $id,
  $sectionreturn = null 
)
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:

  • empty string for "delete" action,
  • two modules html for "duplicate" action
  • updated module html for everything else

Throws exception if operation is not permitted/possible

Since
Moodle 3.3
Parameters
string$action
int$id
null | int$sectionreturn
Return values
string

◆ edit_module_parameters()

static core_course_external::edit_module_parameters ( )
static

Parameters for function edit_module()

Since
Moodle 3.3
Return values
external_function_parameters

◆ edit_module_returns()

static core_course_external::edit_module_returns ( )
static

Return structure for edit_module()

Since
Moodle 3.3
Return values
external_description

◆ edit_section()

static core_course_external::edit_section (   $action,
  $id,
  $sectionreturn 
)
static

Performs one of the edit section actions.

Since
Moodle 3.3
Parameters
string$action
int$idsection id
int$sectionreturnsection to return to
Return values
string

◆ edit_section_parameters()

static core_course_external::edit_section_parameters ( )
static

Parameters for function edit_section()

Since
Moodle 3.3
Return values
external_function_parameters

◆ edit_section_returns()

static core_course_external::edit_section_returns ( )
static

Return structure for edit_section()

Since
Moodle 3.3
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_activity_chooser_footer()

static core_course_external::get_activity_chooser_footer ( int  $courseid,
int  $sectionid 
)
static

Given a course ID we need to build up a footre for the chooser.

Parameters
int$courseidThe course we want to fetch the modules for
int$sectionidThe section we want to fetch the modules for
Return values
array

◆ get_activity_chooser_footer_parameters()

static core_course_external::get_activity_chooser_footer_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters

◆ get_activity_chooser_footer_returns()

static core_course_external::get_activity_chooser_footer_returns ( )
static

Returns description of method result value.

Return values
external_description

◆ get_categories()

static core_course_external::get_categories (   $criteria = array(),
  $addsubcategories = true 
)
static

Get categories.

Parameters
array$criteriaCriteria to match the results
booln$addsubcategoriesobtain only the category (false) or its subcategories (true - default)
Return values
arraylist of categories
Since
Moodle 2.3

◆ get_categories_parameters()

static core_course_external::get_categories_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.3

◆ get_categories_returns()

static core_course_external::get_categories_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 2.3

◆ 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 tool_lp\external, and core_competency\external.

◆ get_course_content_items()

static core_course_external::get_course_content_items ( int  $courseid)
static

Given a course ID fetch all accessible modules for that course.

Parameters
int$courseidThe course we want to fetch the modules for
Return values
arrayContains array of modules and their metadata

◆ get_course_content_items_parameters()

static core_course_external::get_course_content_items_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters

◆ get_course_content_items_returns()

static core_course_external::get_course_content_items_returns ( )
static

Returns description of method result value.

Return values
external_description

◆ get_course_contents()

static core_course_external::get_course_contents (   $courseid,
  $options = array() 
)
static

Get course contents.

Parameters
int$courseidcourse id
array$optionsOptions for filtering the results, used since Moodle 2.9
Return values
array
Since
Moodle 2.9 Options available
Moodle 2.2

◆ get_course_contents_parameters()

static core_course_external::get_course_contents_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.9 Options available
Moodle 2.2

◆ get_course_contents_returns()

static core_course_external::get_course_contents_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 2.2

◆ get_course_module()

static core_course_external::get_course_module (   $cmid)
static

Return information about a course module.

Parameters
int$cmidthe course module id
Return values
arrayof warnings and the course module
Since
Moodle 3.0
Exceptions
moodle_exception

◆ get_course_module_by_instance()

static core_course_external::get_course_module_by_instance (   $module,
  $instance 
)
static

Return information about a course module.

Parameters
string$modulethe module name
int$instancethe activity instance id
Return values
arrayof warnings and the course module
Since
Moodle 3.0
Exceptions
moodle_exception

◆ get_course_module_by_instance_parameters()

static core_course_external::get_course_module_by_instance_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 3.0

◆ get_course_module_by_instance_returns()

static core_course_external::get_course_module_by_instance_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 3.0

◆ get_course_module_parameters()

static core_course_external::get_course_module_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 3.0

◆ get_course_module_returns()

static core_course_external::get_course_module_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 3.0

◆ get_course_public_information()

static core_course_external::get_course_public_information ( core_course_list_element  $course,
  $coursecontext 
)
staticprotected

Return the course information that is public (visible by every one)

Parameters
core_course_list_element$coursecourse in list object
stdClass$coursecontextcourse context object
Return values
arraythe course information
Since
Moodle 3.2

◆ get_course_structure()

static core_course_external::get_course_structure (   $onlypublicdata = true)
staticprotected

Returns a course structure definition.

Parameters
boolean$onlypublicdataset to true, to retrieve only fields viewable by anyone when the course is visible
Return values
arraythe course structure
Since
Moodle 3.2

◆ get_courses()

static core_course_external::get_courses (   $options = array())
static

Get courses.

Parameters
array$optionsIt contains an array (list of ids)
Return values
array
Since
Moodle 2.2

◆ get_courses_by_field()

static core_course_external::get_courses_by_field (   $field = '',
  $value = '' 
)
static

Get courses matching a specific field (id/s, shortname, idnumber, category)

Parameters
string$fieldfield name to search, or empty for all courses
string$valuevalue to search
Return values
arraylist of courses and warnings
Exceptions
invalid_parameter_exception
Since
Moodle 3.2

◆ get_courses_by_field_parameters()

static core_course_external::get_courses_by_field_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 3.2

◆ get_courses_by_field_returns()

static core_course_external::get_courses_by_field_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 3.2

◆ get_courses_parameters()

static core_course_external::get_courses_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.3

◆ get_courses_returns()

static core_course_external::get_courses_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 2.2

◆ get_enrolled_courses_by_timeline_classification()

static core_course_external::get_enrolled_courses_by_timeline_classification ( string  $classification,
int  $limit = 0,
int  $offset = 0,
string  $sort = null,
string  $customfieldname = null,
string  $customfieldvalue = null 
)
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.

Parameters
string$classificationpast, inprogress, or future
int$limitResult set limit
int$offsetOffset the full course set before timeline classification is applied
string$sortSQL sort string for results
string$customfieldname
string$customfieldvalue
Return values
arraylist of courses and warnings
Exceptions
invalid_parameter_exception

◆ get_enrolled_courses_by_timeline_classification_parameters()

static core_course_external::get_enrolled_courses_by_timeline_classification_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters

◆ get_enrolled_courses_by_timeline_classification_returns()

static core_course_external::get_enrolled_courses_by_timeline_classification_returns ( )
static

Returns description of method result value.

Return values
external_description

◆ get_enrolled_users_by_cmid()

static core_course_external::get_enrolled_users_by_cmid ( int  $cmid,
int  $groupid = 0 
)
static

Get all users in a course for a given cmid.

Parameters
int$cmidCourse Module id from which the users will be obtained
int$groupidGroup id from which the users will be obtained
Return values
arrayList of users
Exceptions
invalid_parameter_exception

◆ get_enrolled_users_by_cmid_parameters()

static core_course_external::get_enrolled_users_by_cmid_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters

◆ get_enrolled_users_by_cmid_returns()

static core_course_external::get_enrolled_users_by_cmid_returns ( )
static

Returns description of method result value.

Return values
external_description

◆ get_module()

static core_course_external::get_module (   $id,
  $sectionreturn = null 
)
static

Returns html for displaying one activity module on course page.

Since
Moodle 3.3
Parameters
int$id
null | int$sectionreturn
Return values
string

◆ get_module_parameters()

static core_course_external::get_module_parameters ( )
static

Parameters for function get_module()

Since
Moodle 3.3
Return values
external_function_parameters

◆ get_module_returns()

static core_course_external::get_module_returns ( )
static

Return structure for get_module()

Since
Moodle 3.3
Return values
external_description

◆ get_recent_courses()

static core_course_external::get_recent_courses ( int  $userid = 0,
int  $limit = 0,
int  $offset = 0,
string  $sort = null 
)
static

Get last accessed courses adding additional course information like images.

Parameters
int$useridUser id from which the courses will be obtained
int$limitRestrict result set to this amount
int$offsetSkip this number of records from the start of the result set
string | null$sortSQL string for sorting
Return values
arrayList of courses
Exceptions
invalid_parameter_exception

◆ get_recent_courses_parameters()

static core_course_external::get_recent_courses_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 3.6

◆ get_recent_courses_returns()

static core_course_external::get_recent_courses_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 3.6

◆ get_updates_since()

static core_course_external::get_updates_since (   $courseid,
  $since,
  $filter = array() 
)
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.

Parameters
int$courseidthe list of modules to check
int$sincecheck updates since this time stamp
array$filtercheck only for updates in these areas
Return values
arraylist of updates and warnings
Exceptions
moodle_exception
Since
Moodle 3.3

◆ get_updates_since_parameters()

static core_course_external::get_updates_since_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 3.3

◆ get_updates_since_returns()

static core_course_external::get_updates_since_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 3.3

◆ get_user_administration_options()

static core_course_external::get_user_administration_options (   $courseids)
static

Return a list of administration options in a set of courses that are available or not for the current user.

Parameters
array$courseidsa list of course ids
Return values
arrayof warnings and the options availability
Since
Moodle 3.2
Exceptions
moodle_exception

◆ get_user_administration_options_parameters()

static core_course_external::get_user_administration_options_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 3.2

◆ get_user_administration_options_returns()

static core_course_external::get_user_administration_options_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 3.2

◆ get_user_navigation_options()

static core_course_external::get_user_navigation_options (   $courseids)
static

Return a list of navigation options in a set of courses that are avaialable or not for the current user.

Parameters
array$courseidsa list of course ids
Return values
arrayof warnings and the options availability
Since
Moodle 3.2
Exceptions
moodle_exception

◆ get_user_navigation_options_parameters()

static core_course_external::get_user_navigation_options_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 3.2

◆ get_user_navigation_options_returns()

static core_course_external::get_user_navigation_options_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 3.2

◆ import_course()

static core_course_external::import_course (   $importfrom,
  $importto,
  $deletecontent = 0,
  $options = array() 
)
static

Imports a course.

Parameters
int$importfromThe id of the course we are importing from
int$importtoThe id of the course we are importing to
bool$deletecontentWhether to delete the course we are importing to content
array$optionsList of backup options
Return values
null
Since
Moodle 2.4

◆ import_course_parameters()

static core_course_external::import_course_parameters ( )
static

Returns description of method parameters for import_course.

Return values
external_function_parameters
Since
Moodle 2.4

◆ import_course_returns()

static core_course_external::import_course_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 2.4

◆ remove_content_item_from_user_favourites()

static core_course_external::remove_content_item_from_user_favourites ( string  $componentname,
int  $contentitemid 
)
static

Remove a content item from a user's favourites.

Parameters
string$componentnamethe name of the component from which this content item originates.
int$contentitemidthe id of the content item.
Return values
stdClassthe exported content item.

◆ remove_content_item_from_user_favourites_parameters()

static core_course_external::remove_content_item_from_user_favourites_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters

◆ remove_content_item_from_user_favourites_returns()

static core_course_external::remove_content_item_from_user_favourites_returns ( )
static

Returns description of method result value.

Return values
external_description

◆ search_courses()

static core_course_external::search_courses (   $criterianame,
  $criteriavalue,
  $page = 0,
  $perpage = 0,
  $requiredcapabilities = array(),
  $limittoenrolled = 0,
  $onlywithcompletion = 0 
)
static

Search courses following the specified criteria.

Parameters
string$criterianameCriteria name (search, modulelist (only admins), blocklist (only admins), tagid)
string$criteriavalueCriteria value
int$pagePage number (for pagination)
int$perpageItems per page
array$requiredcapabilitiesOptional list of required capabilities (used to filter the list).
int$limittoenrolledLimit to only enrolled courses
intonlywithcompletion Limit to only courses where completion is enabled
Return values
arrayof course objects and warnings
Since
Moodle 3.0
Exceptions
moodle_exception

◆ search_courses_parameters()

static core_course_external::search_courses_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 3.0

◆ search_courses_returns()

static core_course_external::search_courses_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 3.0

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

static core_course_external::set_favourite_courses ( array  $courses)
static

Set the course favourite status for an array of courses.

Parameters
array$coursesList with course id's and favourite status.
Return values
arrayArray with an array of favourite courses.

◆ set_favourite_courses_parameters()

static core_course_external::set_favourite_courses_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters

◆ set_favourite_courses_returns()

static core_course_external::set_favourite_courses_returns ( )
static

Returns description of method result value.

Return values
external_description

◆ 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

◆ toggle_activity_recommendation()

static core_course_external::toggle_activity_recommendation ( string  $area,
int  $id 
)
static

Update the recommendation for an activity item.

Parameters
string$areaidentifier for this activity.
int$idAssociated id. This is needed in conjunction with the area to find the recommendation.
Return values
arraysome warnings or something.

◆ toggle_activity_recommendation_parameters()

static core_course_external::toggle_activity_recommendation_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters

◆ toggle_activity_recommendation_returns()

static core_course_external::toggle_activity_recommendation_returns ( )
static

Returns warnings.

Return values
external_description

◆ update_categories()

static core_course_external::update_categories (   $categories)
static

Update categories.

Parameters
array$categoriesThe list of categories to update
Return values
null
Since
Moodle 2.3

◆ update_categories_parameters()

static core_course_external::update_categories_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.3

◆ update_categories_returns()

static core_course_external::update_categories_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 2.3

◆ update_courses()

static core_course_external::update_courses (   $courses)
static

Update courses.

Parameters
array$courses
Since
Moodle 2.5

◆ update_courses_parameters()

static core_course_external::update_courses_parameters ( )
static

Update courses.

Return values
external_function_parameters
Since
Moodle 2.5

◆ update_courses_returns()

static core_course_external::update_courses_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 2.5

◆ user_description()

static core_course_external::user_description ( )
static

Create user return value description.

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

◆ view_course()

static core_course_external::view_course (   $courseid,
  $sectionnumber = 0 
)
static

Trigger the course viewed event.

Parameters
int$courseidid of course
int$sectionnumbersectionnumber (0, 1, 2...)
Return values
arrayof warnings and status result
Since
Moodle 2.9
Exceptions
moodle_exception

◆ view_course_parameters()

static core_course_external::view_course_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.9

◆ view_course_returns()

static core_course_external::view_course_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: