See Release Notes
Long Term Support Release
Differences Between: [Versions 401 and 402] [Versions 401 and 403]
Cohort related management functions, this file needs to be included manually.
Copyright: | 2010 Petr Skoda {@link http://skodak.org} |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 637 lines (23 kb) |
Included or required: | 0 times |
Referenced: | 18 times |
Includes or requires: | 0 files |
cohort_add_cohort($cohort) X-Ref |
Add new cohort. param: stdClass $cohort return: int new cohort id |
cohort_update_cohort($cohort) X-Ref |
Update existing cohort. param: stdClass $cohort return: void |
cohort_delete_cohort($cohort) X-Ref |
Delete cohort. param: stdClass $cohort return: void |
cohort_delete_category($category) X-Ref |
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. param: stdClass|core_course_category $category return: void |
cohort_add_member($cohortid, $userid) X-Ref |
Add cohort member param: int $cohortid param: int $userid return: void |
cohort_remove_member($cohortid, $userid) X-Ref |
Remove cohort member param: int $cohortid param: int $userid return: void |
cohort_is_member($cohortid, $userid) X-Ref |
Is this user a cohort member? param: int $cohortid param: int $userid return: bool |
cohort_get_available_cohorts($currentcontext, $withmembers = 0, $offset = 0, $limit = 25, $search = '') X-Ref |
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 param: context $currentcontext param: int $withmembers one of the COHORT_XXX constants that allows to return non empty cohorts only param: int $offset param: int $limit param: string $search return: array |
cohort_can_view_cohort($cohortorid, $currentcontext) X-Ref |
No description |
cohort_get_cohort($cohortorid, $currentcontext) X-Ref |
Get a cohort by id. Also does a visibility check and returns false if the user cannot see this cohort. param: stdClass|int $cohortorid cohort object or id param: context $currentcontext current context (course) where visibility is checked return: stdClass|boolean |
cohort_get_search_query($search, $tablealias = '') X-Ref |
Produces a part of SQL query to filter cohorts by the search string Called from {@link cohort_get_cohorts()}, {@link cohort_get_all_cohorts()} and {@link cohort_get_available_cohorts()} param: string $search search string param: string $tablealias alias of cohort table in the SQL query (highly recommended if other tables are used in query) return: array of two elements - SQL condition and array of named parameters |
cohort_get_cohorts($contextid, $page = 0, $perpage = 25, $search = '') X-Ref |
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. param: int $contextid param: int $page number of the current page param: int $perpage items per page param: string $search search string return: array Array(totalcohorts => int, cohorts => array, allcohorts => int) |
cohort_get_all_cohorts($page = 0, $perpage = 25, $search = '') X-Ref |
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. param: int $page number of the current page param: int $perpage items per page param: string $search search string return: array Array(totalcohorts => int, cohorts => array, allcohorts => int) |
cohort_get_user_cohorts($userid) X-Ref |
Get all the cohorts where the given user is member of. param: int $userid return: array Array |
cohort_get_user_cohort_theme($userid) X-Ref |
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). param: int $userid return: string|null |
cohort_get_invisible_contexts() X-Ref |
Returns list of contexts where cohorts are present but current user does not have capability to view/manage them. This function is called from {@link cohort_get_all_cohorts()} to ensure correct pagination in rare cases when user is revoked capability in child contexts. It assumes that user's capability to view/manage cohorts on system level has already been verified. return: array array of context ids |
cohort_edit_controls(context $context, moodle_url $currenturl) X-Ref |
Returns navigation controls (tabtree) to be displayed on cohort management pages param: context $context system or category context where cohorts controls are about to be displayed param: moodle_url $currenturl return: null|renderable |
core_cohort_inplace_editable($itemtype, $itemid, $newvalue) X-Ref |
Implements callback inplace_editable() allowing to edit values in-place param: string $itemtype param: int $itemid param: mixed $newvalue return: \core\output\inplace_editable |
cohort_get_list_of_themes() X-Ref |
Returns a list of valid themes which can be displayed in a selector. return: array as (string)themename => (string)get_string_theme |