Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
|
Namespaces | |
namespace | core_cohort\customfield |
| |
namespace | core_cohort\external |
| |
namespace | core_cohort\output |
| |
namespace | core_cohort\privacy |
| |
namespace | core_cohort\reportbuilder\datasource |
| |
namespace | core_cohort\reportbuilder\local\entities |
| |
namespace | core_cohort\reportbuilder\local\systemreports |
| |
Classes | |
class | behat_cohort |
Steps definitions for cohort actions. More... | |
class | cohort_candidate_selector |
Cohort assignment candidates. More... | |
class | cohort_edit_form |
class | cohort_existing_selector |
Cohort assignment candidates. More... | |
class | cohort_upload_form |
Cohort upload form class. More... | |
class | core_cohort\customfield\cohort_handler |
class | core_cohort\external\cohort_summary_exporter |
Class for exporting a cohort summary from an stdClass. More... | |
class | core_cohort\output\cohortidnumber |
Class to prepare a cohort idnumber for display. More... | |
class | core_cohort\output\cohortname |
Class to prepare a cohort name for display. More... | |
class | core_cohort\privacy\provider |
Privacy class for requesting user data. More... | |
class | core_cohort\reportbuilder\datasource\cohorts |
class | core_cohort\reportbuilder\local\entities\cohort |
class | core_cohort\reportbuilder\local\entities\cohort_member |
class | core_cohort\reportbuilder\local\systemreports\cohorts |
Functions | |
cohort_add_cohort ($cohort) | |
Add new cohort. | |
cohort_add_member ($cohortid, $userid) | |
Add cohort member. | |
cohort_can_view_cohort ($cohortorid, $currentcontext) | |
Check if cohort exists and user is allowed to access it from the given context. | |
cohort_delete_category ($category) | |
Somehow deal with cohorts when deleting course category, we can not just delete them because they might be used in enrol plugins or referenced in external systems. | |
cohort_delete_cohort ($cohort) | |
Delete cohort. | |
cohort_edit_controls (context $context, moodle_url $currenturl) | |
Returns navigation controls (tabtree) to be displayed on cohort management pages. | |
cohort_get_all_cohorts ($page=0, $perpage=25, $search='', $withcustomfields=false) | |
Get all the cohorts defined anywhere in system. | |
cohort_get_available_cohorts ($currentcontext, $withmembers=0, $offset=0, $limit=25, $search='', $withcustomfields=false) | |
Returns the list of cohorts visible to the current user in the given course. | |
cohort_get_cohort ($cohortorid, $currentcontext, $withcustomfields=false) | |
Get a cohort by id. | |
cohort_get_cohorts ($contextid, $page=0, $perpage=25, $search='', $withcustomfields=false) | |
Get all the cohorts defined in given context. | |
cohort_get_custom_fields_data (array $cohortids) | |
Returns custom fields data for provided cohorts. | |
cohort_get_list_of_themes () | |
Returns a list of valid themes which can be displayed in a selector. | |
cohort_get_user_cohort_theme ($userid) | |
Get the user cohort theme. | |
cohort_get_user_cohorts ($userid, $withcustomfields=false) | |
Get all the cohorts where the given user is member of. | |
cohort_is_member ($cohortid, $userid) | |
Is this user a cohort member? | |
cohort_remove_member ($cohortid, $userid) | |
Remove cohort member. | |
cohort_update_cohort ($cohort) | |
Update existing cohort. | |
core_cohort_inplace_editable ($itemtype, $itemid, $newvalue) | |
Implements callback inplace_editable() allowing to edit values in-place. | |
cohort_add_cohort | ( | $cohort | ) |
Add new cohort.
stdClass | $cohort |
int | new cohort id |
cohort_add_member | ( | $cohortid, | |
$userid ) |
Add cohort member.
int | $cohortid | |
int | $userid |
void |
cohort_can_view_cohort | ( | $cohortorid, | |
$currentcontext ) |
Check if cohort exists and user is allowed to access it from the given context.
stdClass | int | $cohortorid | cohort object or id |
context | $currentcontext | current context (course) where visibility is checked |
boolean |
cohort_delete_category | ( | $category | ) |
Somehow deal with cohorts when deleting course category, we can not just delete them because they might be used in enrol plugins or referenced in external systems.
stdClass | core_course_category | $category |
void |
cohort_delete_cohort | ( | $cohort | ) |
Delete cohort.
stdClass | $cohort |
void |
cohort_edit_controls | ( | context | $context, |
moodle_url | $currenturl ) |
Returns navigation controls (tabtree) to be displayed on cohort management pages.
context | $context | system or category context where cohorts controls are about to be displayed |
moodle_url | $currenturl |
null|renderable |
cohort_get_all_cohorts | ( | $page = 0, | |
$perpage = 25, | |||
$search = '', | |||
$withcustomfields = false ) |
Get all the cohorts defined anywhere in system.
The function assumes that user capability to view/manage cohorts on system level has already been verified. This function only checks if such capabilities have been revoked in child (categories) contexts.
int | $page | number of the current page |
int | $perpage | items per page |
string | $search | search string |
bool | $withcustomfields | if set to yes, then cohort custom fields will be included in the results. |
array | Array(totalcohorts => int, cohorts => array, allcohorts => int) |
cohort_get_available_cohorts | ( | $currentcontext, | |
$withmembers = 0, | |||
$offset = 0, | |||
$limit = 25, | |||
$search = '', | |||
$withcustomfields = false ) |
Returns the list of cohorts visible to the current user in the given course.
The following fields are returned in each record: id, name, contextid, idnumber, visible Fields memberscnt and enrolledcnt will be also returned if requested
context | $currentcontext | |
int | $withmembers | one of the COHORT_XXX constants that allows to return non empty cohorts only or cohorts with enroled/not enroled users, or just return members count |
int | $offset | |
int | $limit | |
string | $search | |
bool | $withcustomfields | if set to yes, then cohort custom fields will be included in the results. |
array |
cohort_get_cohort | ( | $cohortorid, | |
$currentcontext, | |||
$withcustomfields = false ) |
Get a cohort by id.
Also does a visibility check and returns false if the user cannot see this cohort.
stdClass | int | $cohortorid | cohort object or id |
context | $currentcontext | current context (course) where visibility is checked |
bool | $withcustomfields | if set to yes, then cohort custom fields will be included in the results. |
stdClass|boolean |
cohort_get_cohorts | ( | $contextid, | |
$page = 0, | |||
$perpage = 25, | |||
$search = '', | |||
$withcustomfields = false ) |
Get all the cohorts defined in given context.
The function does not check user capability to view/manage cohorts in the given context assuming that it has been already verified.
int | $contextid | |
int | $page | number of the current page |
int | $perpage | items per page |
string | $search | search string |
bool | $withcustomfields | if set to yes, then cohort custom fields will be included in the results. |
array | Array(totalcohorts => int, cohorts => array, allcohorts => int) |
cohort_get_custom_fields_data | ( | array | $cohortids | ) |
Returns custom fields data for provided cohorts.
array | $cohortids | a list of cohort IDs to provide data for. |
core_customfield\data_controller[] |
cohort_get_list_of_themes | ( | ) |
Returns a list of valid themes which can be displayed in a selector.
array | as (string)themename => (string)get_string_theme |
cohort_get_user_cohort_theme | ( | $userid | ) |
Get the user cohort theme.
If the user is member of one cohort, will return this cohort theme (if defined). If the user is member of 2 or more cohorts, will return the theme if all them have the same theme (null themes are ignored).
int | $userid |
string|null |
cohort_get_user_cohorts | ( | $userid, | |
$withcustomfields = false ) |
Get all the cohorts where the given user is member of.
int | $userid | |
bool | $withcustomfields | if set to yes, then cohort custom fields will be included in the results. |
array | Array |
cohort_is_member | ( | $cohortid, | |
$userid ) |
Is this user a cohort member?
int | $cohortid | |
int | $userid |
bool |
cohort_remove_member | ( | $cohortid, | |
$userid ) |
Remove cohort member.
int | $cohortid | |
int | $userid |
void |
cohort_update_cohort | ( | $cohort | ) |
Update existing cohort.
stdClass | $cohort |
void |
core_cohort_inplace_editable | ( | $itemtype, | |
$itemid, | |||
$newvalue ) |
Implements callback inplace_editable() allowing to edit values in-place.
string | $itemtype | |
int | $itemid | |
mixed | $newvalue |
core\output\inplace_editable |