group_support
class group_support
| internal |
Utility functions for Moodle groups.
Methods
static array
get_groups(int $courseid, int $userid)
Retrieves groups that a user belongs to within a course.
static array
get_group_options(context|null $coursecontext = null)
Retrieves options for group selection [name => name].
static bool
is_member(int $groupid, int $userid)
Checks if a specific user is a member of a group.
static bool
add_member(int $groupid, int $userid)
Adds a user to a group.
static int|null
create_group(int $courseid, string $groupname, string $idnumber = '', string $description = '')
Creates a new group in a course.
static bool|int
get_group_by_name(int $courseid, string $groupname)
Retrieves a group ID by its name within a specific course.
static bool
add_user_in_group(int $courseid, int $userid, string $groupname)
Ensures a user is in a group, creating the group if necessary.
Details
at line 47
static array
get_groups(int $courseid, int $userid)
Retrieves groups that a user belongs to within a course.
at line 72
static array
get_group_options(context|null $coursecontext = null)
Retrieves options for group selection [name => name].
at line 109
static bool
is_member(int $groupid, int $userid)
Checks if a specific user is a member of a group.
at line 122
static bool
add_member(int $groupid, int $userid)
Adds a user to a group.
at line 143
static int|null
create_group(int $courseid, string $groupname, string $idnumber = '', string $description = '')
Creates a new group in a course.
at line 165
static bool|int
get_group_by_name(int $courseid, string $groupname)
Retrieves a group ID by its name within a specific course.
at line 181
static bool
add_user_in_group(int $courseid, int $userid, string $groupname)
Ensures a user is in a group, creating the group if necessary.