Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Groups: Difference between revisions

From MoodleDocs
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Moodle 1.9}}
==Improved groups/groupings design in Moodle 1.9==
==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.
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.


==Other proposals==
==Alternative rejected proposals==
* [[Groupings OU]]
* [[Obsolete:Groupings OU]]
* [[Groupings and Groups]]
* [[Obsolete:Groupings and Groups]]


==Change groups/groupings relationship==
==Changed groups/groupings relationship==
At present 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.
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 would link the course id directly. Groupings would be 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.
''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.


[[Image:groupsdb.png]]
[[Image:groupsdb.png]]
Line 19: Line 20:
===course_modules===
===course_modules===
* groupingid - grouping used in activity
* groupingid - grouping used in activity
* grouponly - limit access to and visibility of activity based on group membership - if user is not member of at least one group in grouping, the activity is invisible for them; this needs a new shared option in course/moodleform_mod.php
===groupings===
renamed table
* exclusivegroups - hint for UI group distribution tools - non overlapping groups requested
* maxgroupsize - hint for UI group distribution tools - requested number of users in each group


===groupings_groups===
===groupings_groups===
Line 37: Line 32:
*simpler SQL
*simpler SQL
*easier backup/restore implementation
*easier backup/restore implementation
*more compatible with old group implementation in 1.7
*fully compatible with old group implementation in 1.7


==Linked groups==
==Global groups==
Maybe in future - 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.
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.


==Group/grouping cloning==
==Groups API==
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.
Main public API is in lib/grouplib.php, modules should use only these functions.


==Other code cleanup==
Moodle core may use other functions defined in group/lib.php
Current group code does not follow Moodle coding guide, has several unfinished/broken/obsoleted parts, is not integrated into core, etc.
To do:
*integrate setup and upgrade into main lib/db/*.*
*remove columns from groupings table that can be replaced by permissions
*reduce the number of functions, rewrite or fix them, move them into lib/grouplib.php
*rewrite UI in /group/
*implement module and course groupings support, fix all mods to use it (course edit form, mod edit form, etc.)
*fix legacy functions
*documentation


==Needed time==
== See also ==
1 month for implementation and testing.
* [[Groupings and Groups|Enrique Castro group specification]].
* [[Groupings OU|Open University group specification]].




==New feature ideas==


== See also ==
===Student self selection of group from grouping===
* [[Groupings and Groups|Enrique Castro group specification]].
To be implemented as normal module.
* [[Groupings OU|Open University group specification]].
 
===Linked groups===
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''.


===Group/grouping cloning===
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.


[[Category:Groups]]
[[Category:Groups]]

Revision as of 10:51, 13 August 2018

Moodle1.9

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.

groupsdb.png

course

  • groupingid - default grouping used in course (new activities, etc.)

course_modules

  • groupingid - grouping used in activity

groupings_groups

renamed table

groups

reverted to pre 1.8 state (with the password exception)

Benefits

  • fewer tables
  • normalized
  • simpler SQL
  • easier backup/restore implementation
  • fully compatible with old group implementation in 1.7

Global groups

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.

Groups API

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

See also


New feature ideas

Student self selection of group from grouping

To be implemented as normal module.

Linked groups

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.

Group/grouping cloning

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.