Groups API: Difference between revisions
From MoodleDocs
m (→Overview) |
No edit summary |
||
Line 6: | Line 6: | ||
*Adding and removing members from a group. | *Adding and removing members from a group. | ||
*Polling of information regarding accessibility and permissions. | *Polling of information regarding accessibility and permissions. | ||
==Creation and deletion methods== | |||
These methods are located in group/lib.php | |||
* Creating a group. | |||
* Deleting a group. | |||
* Creating a grouping. | |||
* Deleting a grouping. | |||
* Adding a group to a grouping. | |||
* Removing a group from a grouping. | |||
* Adding members to a group. | |||
* Removing members to a group. | |||
==Polling of information== | |||
These methods are located in lib/grouplib.php | |||
* Getting activities allowed for a group. | |||
* Getting all groups. | |||
* Getting a group by a name. | |||
* Getting all groupings. | |||
* Getting the members of a grouping. | |||
* Checking to see if a group exists. | |||
* Checking to see if there are any users in a group. | |||
* Checking whether a user is part of a group. | |||
* Verifying an active group. | |||
==Database Structure== | ==Database Structure== |
Revision as of 01:06, 10 January 2012
Overview
The groups API is a core system in Moodle which allows for:
- Creating and deleting of groups and groupings.
- Adding and removing members from a group.
- Polling of information regarding accessibility and permissions.
Creation and deletion methods
These methods are located in group/lib.php
- Creating a group.
- Deleting a group.
- Creating a grouping.
- Deleting a grouping.
- Adding a group to a grouping.
- Removing a group from a grouping.
- Adding members to a group.
- Removing members to a group.
Polling of information
These methods are located in lib/grouplib.php
- Getting activities allowed for a group.
- Getting all groups.
- Getting a group by a name.
- Getting all groupings.
- Getting the members of a grouping.
- Checking to see if a group exists.
- Checking to see if there are any users in a group.
- Checking whether a user is part of a group.
- Verifying an active group.
Database Structure
There are four core tables for Groups.
groupings
A grouping is a collection of groups.
Field | Type | Info |
id | int(10) | auto increment identifier |
courseid | int(10) | The course id |
name | varchar(255) | Name of the grouping |
description | text | Description of the grouping |
descriptionformat | int(2) | The format of the description |
configdata | text | Configuration data |
timecreated | int(10) | The time that the grouping was created |
timemodified | into(10) | The time last changes were made |
groupings_groups
This table links a grouping to a group. There can be multiple groups in a grouping.
Field | Type | Info |
id | int(10) | auto increment identifier |
groupingid | int(10) | The grouping id |
groupid | int(10) | The group id |
timeadded | int(10) | Time that the group was added to the grouping |
groups
Each record represents a group.
Field | Type | Info |
id | int(10) | auto increment identifier |
courseid | int(10) | The id of the course |
name | varchar(255) | The name of the group |
description | text | A description of the group |
descriptionformat | int(2) | Format for the description |
enrolmentkey | varchar(50) | The key used when self enrolling into a course. This will automatically put the student into a specific group. |
picture | int(10) | picture for the group |
hidepicture | int(1) | Whether the group picture is displayed or hidden |
timecreated | int(10) | The time that the group was created |
timemodified | int(10) | The last time that the group details were changed |
groups_members
This table links a user to a group.
Field | Type | Info |
id | int(10) | auto increment identifier |
groupid | int(10) | The id of the group |
userid | int(10) | The user's id |
timeadded | int(10) | Time the group member was added |