Go to the source code of this file.
Namespaces |
| namespace | groups |
Functions |
| | groups_add_member ($grouporid, $userorid) |
| | groups_remove_member ($grouporid, $userorid) |
| | groups_create_group ($data, $editform=false, $editoroptions=false) |
| | groups_create_grouping ($data, $editoroptions=null) |
| | groups_update_group_icon ($group, $data, $editform) |
| | groups_update_group ($data, $editform=false, $editoroptions=false) |
| | groups_update_grouping ($data, $editoroptions=null) |
| | groups_delete_group ($grouporid) |
| | groups_delete_grouping ($groupingorid) |
| | groups_delete_group_members ($courseid, $userid=0, $showfeedback=false) |
| | groups_delete_groupings_groups ($courseid, $showfeedback=false) |
| | groups_delete_groups ($courseid, $showfeedback=false) |
| | groups_delete_groupings ($courseid, $showfeedback=false) |
| | groups_get_possible_roles ($context) |
| | groups_get_potential_members ($courseid, $roleid=null, $cohortid=null, $orderby= 'lastname ASC, firstname ASC') |
| | groups_parse_name ($format, $groupnumber) |
| | groups_assign_grouping ($groupingid, $groupid) |
| | groups_unassign_grouping ($groupingid, $groupid) |
| | groups_get_members_by_role ($groupid, $courseid, $fields='u.*', $sort='u.lastname ASC', $extrawheretest='', $whereparams=array()) |
| | groups_calculate_role_people ($rs, $context) |
Function Documentation
Adds a specified user to a group
- Parameters:
-
| mixed | $groupid | The group id or group object |
| mixed | $userid | The user id or user object |
- Returns:
- boolean True if user added successfully or the user is already a member of the group, false otherwise.
Definition at line 23 of file lib.php.
Assigns group into grouping
- Parameters:
-
- Returns:
- bool true or exception
Definition at line 579 of file lib.php.
Internal function used by groups_get_members_by_role to handle the results of a database query that includes a list of users and possible roles on a course.
- Parameters:
-
| object | $rs | The record set (may be false) |
| int | $contextid | ID of course context |
- Returns:
- array As described in groups_get_members_by_role
Definition at line 661 of file lib.php.
Add a new group
- Parameters:
-
| object | $data | group properties |
| object | $um | upload manager with group picture |
- Returns:
- id of group or false if error
Definition at line 119 of file lib.php.
Add a new grouping
- Parameters:
-
| object | $data | grouping properties |
- Returns:
- id of grouping or false if error
Definition at line 164 of file lib.php.
Delete a group best effort, first removing members and links with courses and groupings. Removes group avatar too.
- Parameters:
-
| mixed | $grouporid | The id of group to delete or full group object |
- Returns:
- boolean True if deletion was successful, false otherwise
Definition at line 281 of file lib.php.
Remove all users (or one user) from all groups in course
- Parameters:
-
| int | $courseid | |
| int | $userid | 0 means all users |
| bool | $showfeedback | |
- Returns:
- bool success
Definition at line 365 of file lib.php.
Delete grouping
- Parameters:
-
- Returns:
- bool success
Definition at line 322 of file lib.php.
Delete all groupings from course
- Parameters:
-
| int | $courseid | |
| bool | $showfeedback | |
- Returns:
- bool success
Definition at line 463 of file lib.php.
Remove all groups from all groupings in course
- Parameters:
-
| int | $courseid | |
| bool | $showfeedback | |
- Returns:
- bool success
Definition at line 404 of file lib.php.
Delete all groups from course
- Parameters:
-
| int | $courseid | |
| bool | $showfeedback | |
- Returns:
- bool success
Definition at line 424 of file lib.php.
Lists users in a group based on their role on the course. Returns false if there's an error or there are no users in the group. Otherwise returns an array of role ID => role data, where role data includes: (role) $id, $shortname, $name $users: array of objects for each user which include the specified fields Users who do not have a role are stored in the returned array with key '-' and pseudo-role details (including a name, 'No role'). Users with multiple roles, same deal with key '*' and name 'Multiple roles'. You can find out which roles each has by looking in the $roles array of the user object.
- Parameters:
-
| int | $groupid | |
| int | $courseid | Course ID (should match the group's course) |
| string | $fields | List of fields from user table prefixed with u, default 'u.*' |
| string | $sort | SQL ORDER BY clause, default 'u.lastname ASC' |
| string | $extrawheretest | extra SQL conditions ANDed with the existing where clause. |
| array | $whereparams | any parameters required by $extrawheretest (named parameters). |
- Returns:
- array Complex array as described above
Definition at line 625 of file lib.php.
Obtains a list of the possible roles that group members might come from, on a course. Generally this includes only profile roles.
- Parameters:
-
| object | $context | Context of course |
- Returns:
- Array of role ID integers, or false if error/none.
Definition at line 503 of file lib.php.
Gets potential group members for grouping
- Parameters:
-
| int | $courseid | The id of the course |
| int | $roleid | The role to select users from |
| int | $cohortid | restrict to cohort id |
| string | $orderby | The column to sort users by |
- Returns:
- array An array of the users
Definition at line 517 of file lib.php.
Parse a group name for characters to replace
- Parameters:
-
| string | $format | The format a group name will follow |
| int | $groupnumber | The number of the group to be used in the parsed format string |
- Returns:
- string the parsed format string
Definition at line 560 of file lib.php.
Deletes the link between the specified user and group.
- Parameters:
-
| mixed | $groupid | The group id or group object |
| mixed | $userid | The user id or user object |
- Returns:
- boolean True if deletion was successful, false otherwise
Definition at line 76 of file lib.php.
Unassigns group grom grouping
- Parameters:
-
- Returns:
- bool success
Definition at line 600 of file lib.php.
Update group
- Parameters:
-
| object | $data | group properties (with magic quotes) |
| object | $editform | |
| array | $editoroptions | |
- Returns:
- boolean true or exception
Definition at line 229 of file lib.php.
Update the group icon from form data
- Parameters:
-
Definition at line 200 of file lib.php.
Update grouping
- Parameters:
-
| object | $data | grouping properties (with magic quotes) |
- Returns:
- boolean true or exception
Definition at line 261 of file lib.php.