This content of this page has been updated and migrated to the new Moodle Developer Resources. The information contained on the page should no longer be seen up-to-date.
|Warning: This page is no longer in use. The information contained on the page should NOT be seen as relevant or reliable.|
Improved groups/groupings design in Moodle 1.9
The groups related database structure in 1.9 was reverted to 1.7, groupings are now implemented in a different way than in 1.8. The current design is compatible with 1.7 style groups.
Alternative rejected proposals
Changed groups/groupings relationship
In 1.8 both groups and groupings are not linked strictly to one course, you could use one group in several courses and groupings at the same time. This loose relationship of groups and groupings adds too much complexity and could be/is a source of bugs in code.
Solution: Each group and grouping links the course id directly. Groupings are only limiting the number of usable groups in activities. This allows free sharing of groups in groupings inside course without potential problems. This idea was proposed by Enrique. See attached db schema.
- groupingid - default grouping used in course (new activities, etc.)
- groupingid - grouping used in activity
reverted to pre 1.8 state (with the password exception)
- fewer tables
- simpler SQL
- easier backup/restore implementation
- fully compatible with old group implementation in 1.7
Global groups are not implemented in 1.9. They are not going to be implemented at the database level. Instead some other solution should be present in 2.0. This will require patching of enrolment framework and group/lib.php.
Main public API is in lib/grouplib.php, modules should use only these functions.
Moodle core may use other functions defined in group/lib.php
New feature ideas
Student self selection of group from grouping
To be implemented as normal module.
It would allow synchronizing of group membership from different courses; the idea is to have linkid in groups table and synchronize the groups membership in group functions for adding/removing of members for groups with the same linkid.
Cloning or duplicating is UI feature only, it helps to prefill new groups/groupings with existing data. In theory it could also copy existing grouping setups from other courses too.