Group visibility methods
Author: | Mark Johnson <mark.johnson@catalyst-eu.net> |
Copyright: | 2022 onwards Catalyst IT EU {@link https://catalyst-eu.net} |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 181 lines (7 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
visibility:: (6 methods):
update_hiddengroups_cache()
course_has_hidden_groups()
can_view_all_groups()
sql_group_visibility_where()
sql_member_visibility_where()
sql_members_visibility_condition()
Class: visibility - X-Ref
Group visibility methods.update_hiddengroups_cache(int $courseid, ?\cache $cache = null) X-Ref |
Store the number groups with visibility other than ALL on the course. param: int $courseid Course ID to update the cache for. param: \cache|null $cache Existing cache instance. If null, once will be created. return: void |
course_has_hidden_groups(int $courseid) X-Ref |
Return whether a course currently had hidden groups. This can be used as a shortcut to decide whether visibility restrictions need to be applied. If this returns false, we may be able to use cached data, or do a much simpler query. param: int $courseid return: bool |
can_view_all_groups(int $courseid) X-Ref |
Can the current user view all the groups on the course? Returns true if there are no groups on the course with visibility != ALL, or if the user has viewhiddengroups. This is useful for deciding whether we need to perform additional visibility checkes such as the sql_* methods of this class. param: int $courseid return: bool |
sql_group_visibility_where(int $userid,string $groupsalias = 'g', string $groupsmembersalias = 'gm') X-Ref |
Return SQL conditions for determining whether a user can see a group and its memberships. param: int $userid param: string $groupsalias The SQL alias being used for the groups table. param: string $groupsmembersalias The SQL alias being used for the groups_members table. return: array [$where, $params] |
sql_member_visibility_where(string $groupsalias = 'g',string $groupsmembersalias = 'gm',string $useralias = 'u',string $paramprefix = '',) X-Ref |
Return SQL conditions for determining whether a user can see a group's members. param: string $groupsalias The SQL alias being used for the groups table. param: string $groupsmembersalias The SQL alias being used for the groups_members table. param: string $useralias The SQL alias being used for the user table. param: string $paramprefix Prefix for the parameter names. return: array [$where, $params] |
sql_members_visibility_condition(string $groupsalias = 'g',string $groupsmembersalias = 'gm',string $paramprefix = '',) X-Ref |
Return a condition to check if a user can view a group because it has MEMBERS visibility and they are a member. param: string $groupsalias The SQL alias being used for the groups table. param: string $groupsmembersalias The SQL alias being used for the groups_members table. param: string $paramprefix Prefix for the parameter names. return: array [$sql, $params] |