Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Class: core_cohort_external  - X-Ref

External cohort API

create_cohorts_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

create_cohorts($cohorts)   X-Ref
Create one or more cohorts

param: array $cohorts An array of cohorts to create.
return: array An array of arrays

create_cohorts_returns()   X-Ref
Returns description of method result value

return: \core_external\external_description

delete_cohorts_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

delete_cohorts($cohortids)   X-Ref
Delete cohorts

param: array $cohortids
return: null

delete_cohorts_returns()   X-Ref
Returns description of method result value

return: null

get_cohorts_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

get_cohorts($cohortids = array()   X-Ref
Get cohorts definition specified by ids

param: array $cohortids array of cohort ids
return: array of cohort objects (id, courseid, name)

get_cohorts_returns()   X-Ref
Returns description of method result value

return: \core_external\external_description

search_cohorts_parameters()   X-Ref
Returns the description of external function parameters.

return: external_function_parameters

search_cohorts($query, $context, $includes = 'parents', $limitfrom = 0, $limitnum = 25)   X-Ref
Search cohorts.

param: string $query
param: array $context
param: string $includes
param: int $limitfrom
param: int $limitnum
return: array

search_cohorts_returns()   X-Ref
Returns description of external function result value.

return: \core_external\external_description

update_cohorts_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

update_cohorts($cohorts)   X-Ref
Update cohorts

param: array $cohorts
return: null

update_cohorts_returns()   X-Ref
Returns description of method result value

return: null

add_cohort_members_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

add_cohort_members($members)   X-Ref
Add cohort members

param: array $members of arrays with keys userid, cohortid

add_cohort_members_returns()   X-Ref
Returns description of method result value

return: null

delete_cohort_members_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

delete_cohort_members($members)   X-Ref
Delete cohort members

param: array $members of arrays with keys userid, cohortid

delete_cohort_members_returns()   X-Ref
Returns description of method result value

return: null

get_cohort_members_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

get_cohort_members($cohortids)   X-Ref
Return all members for a cohort

param: array $cohortids array of cohort ids
return: array with cohort id keys containing arrays of user ids

get_cohort_members_returns()   X-Ref
Returns description of method result value

return: \core_external\external_description

build_custom_fields_parameters_structure()   X-Ref
Builds a structure for custom fields parameters.

return: \core_external\external_multiple_structure

build_custom_fields_returns_structure()   X-Ref
Builds a structure for custom fields returns.

return: \core_external\external_multiple_structure

Class: in  - X-Ref

get_custom_fields_data(array $cohortids)   X-Ref
Returns custom fields data for provided cohorts.

param: array $cohortids a list of cohort IDs to provide data for.
return: array

build_custom_field_name(string $shortname)   X-Ref
Builds a suitable name of a custom field for a custom field handler based on provided shortname.

param: string $shortname shortname to use.
return: string