I strongly miss to thing in the docs and API
a) there is NO description of what a grouping or set of groups is, what is forThe concept must be explained in detail, since it is the core of the possible functionality. Please, tell me if I'm wrong in the following description/explanation (I'm more a teacher than a developer).
A grouping is a way to organize groups, is a group of groups, a set of groups. You can distribute the same students in Groups A,B,C.. and in Groups 1, 2, 3, 4. Groups A,B,C constitute Grouping X and groups 1,2,3,4 constitute Grouping Y. Are a way to gather together students differently with different criteria. You can think of Groupings as the criteria or motives to have students grouped in difefrnet ways.
The important point to remark is that module instances can choose what Groupings they will use. Thus, at the module configuration form the teacher will see the "group mode" option and a "grouping" option that specifies to which set of groups that groupmode applies to.
Groupings can the be used to restrict activity access. Let say you want to create an assignment activity only for the more advanced 25% and the less able 25% of the class. Simply create a new Grouping "Extra" with two groups 'Advanced' and 'Special', all the other students of the class are not members of any of this two groups. Set the assigment to user Grouping Extra and "Separate groups" (or the equivalent under Roles & permissions)
et voilá, students that are members of 'advanced' or 'special' can see the activity and submit an assignment, the other people will see the error message "sorry, you need to be member of a group to see this activity"
There are two ways to setup groupings
a) as a set of groups: the teacher creates a lot of groups and afterwards decide to assign one to GroupingA and the other to GroupingB. The existence of the groups is independent of the groupings. A particular group can be assigned to several Groupings.
b) as a scope were the group "lives": Once created a Grouping, groups are created within that Grouping. Groups that belong to a grouping cannot be assigned to other grouping.
There are activities that support multiple group membership. For other activities a given student should be member of just one group. (for instance consider the assignment, example. It doesn't makes sense to receive two submissions from the same student in a single assignment, one as member of group 'advanced' and other as member of group 'special necessities')
Thus it makes sense for Groupings to provide functionality to:
- distribute students between groups of the grouping
- self-assignment of students to a group of the grouping
- check for multiple membership conflicts
A Grouping should have settings to define if multiple membership is allowed for students between groups of the grouping (exclusive single group or multiple membership), to set the maximum number or places in each group of the grouping (for student self-assignment) and a visibility setting to make the Grouping public and usable by modules/students or not, and ever more potential parameters (creating groups within the Grouping by students, not teacher, or at least setting the group profile as editable by students etc,)
In see functions in the API to get groups in use and members and permissions of members of that groups but I do not see in the API anything to manage Goupings themselves, or to specify that a module should use a particular grouping. Without this part of grouping management, the functions listed in your proposed API are more focused on
permissions than in exposing the new functional possibilities that Groupings open.
By the way, what I did the last year was to add a "Scopeid" field to the course_modules table. This field set from a new option in the config form mod.html for the modules (I add it to standard 'footer' settings groupmode and visibility). I created two new tables for Scopes (Groupings) definitions and scopes memberships (which groups were in what scope). And modified all datalib.php group functions to accept a new parameter scope (default to 0, meaning getting all groups disregarding the scope). For instance in a module the config setting stores a "scopeid" parameter. When entering the module view.php script and getting the $cm object you get a $cm->scopeid attribute. Then to manage groups you can call setup_and_print_groups($course, $groupmode, $urlroot,
$scopeid). Changing just half a dozen of lines for each module was enough to adapt it to Grouping/Scopes.
b) there is NO provision for the concept of a group as a team of studentsAs a teacher the main fault I see in Moodle is the lack of the Team concept: a small group of students that work together in the same activity. The example is the typical assignment to be done by teams of 2-5 students, all of then receiving the same base grade plus some "extra" points to refine assessment with basis in individual contribution to group work.
Moodle concept of groups is more that of cohorts or
sections: different classes within the same course. However, in many sites each section has its own moodle "course". I and others have been using moodle groups to manage small teams of students. These are two completely separate meanings but concepts that can co-exists, even more now in an scenario with multiple groups membership and fine permissions contexts.
I have been thinking about adding to Moodle a new type of user, a Team, not like a group but as a user that can submit assignments, post in forum, answer quizzes. And I think that it introduces more problems than solves. From the beginning: a registered user would need to pass for a an additional login-like step to post as a Team, rather than as himself, etc.
I would prefer an scenario where some Grouping could be set at
course level to define classes or sections of the course. And then other groupings used by individual activities. Some activities can even manage themselves the team concept: treat contributions from a user that is member of a group as a group-contribution. This makes sense for some activities, but not for others. A good example is the wiki module (the old ewiki from Mike Chuchward) when set in group-wiki mode (a separate setting from groupmode, that actually drives to 9 different behaviours for the wiki module). I do have a version of Assignment that allow group-submission and group-assessment: a single member submit and all members appear as submitted, the teacher only sees a file, not n-replicas of the same file (one for each member), grade the group and each member gets graded automatically (browse the Assignment forum for ULPGCassigment).
What is important is that this type of usage of groups must be in mind, and acknowledged when designing a library to extend groups functionality in Moodle.
I hope these thinkings would be useful.