Class for doing things with cohort roles.
More...
Class for doing things with cohort roles.
- Copyright
- 2015 Damyon Wiese
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ count_cohort_role_assignments()
static tool_cohortroles\api::count_cohort_role_assignments |
( |
| ) |
|
|
static |
Perform a search based on the provided filters and return a paginated list of records.
Requires moodle/role:manage capability at system context.
- Return values
-
◆ create_cohort_role_assignment()
static tool_cohortroles\api::create_cohort_role_assignment |
( |
stdClass | $record | ) |
|
|
static |
Create a cohort role assignment from a record containing all the data for the class.
Requires moodle/role:manage capability at the system context.
- Parameters
-
stdClass | $record | Record containing all the data for an instance of the class. |
- Return values
-
◆ delete_cohort_role_assignment()
static tool_cohortroles\api::delete_cohort_role_assignment |
( |
| $id | ) |
|
|
static |
Delete a cohort role assignment by id.
Requires moodle/role:manage capability at the system context.
- Parameters
-
int | $id | The record to delete. This will also remove this role from the user for all users in the system. |
- Return values
-
◆ list_cohort_role_assignments()
static tool_cohortroles\api::list_cohort_role_assignments |
( |
| $sort = '', |
|
|
| $order = 'ASC', |
|
|
| $skip = 0, |
|
|
| $limit = 0 ) |
|
static |
Perform a search based on the provided filters and return a paginated list of records.
Requires moodle/role:manage capability at the system context.
- Parameters
-
string | $sort | The column to sort on |
string | $order | ('ASC' or 'DESC') |
int | $skip | Number of records to skip (pagination) |
int | $limit | Max of records to return (pagination) |
- Return values
-
array | of cohort_role_assignment |
◆ sync_all_cohort_roles()
static tool_cohortroles\api::sync_all_cohort_roles |
( |
| ) |
|
|
static |
Sync all roles - adding and deleting role assignments as required.
Slow. Should only be called from a background task.
Requires moodle/role:manage capability at the system context.
- Return values
-
array('rolesadded' | => array of (useridassignedto, useridassignedover, roleid), 'rolesremoved' => array of (useridassignedto, useridassignedover, roleid)) |
The documentation for this class was generated from the following file:
- admin/tool/cohortroles/classes/api.php