Note:

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

Cohorts: Difference between revisions

From MoodleDocs
Line 37: Line 37:
| foreign key, references context.id
| foreign key, references context.id
|-
|-
| '''name'''
| name
| char(255)
| char(255)
|  
|  
| name of cohort
| homan readable cohort name
|-
| '''idnumber'''
| char(100)
|
| unique identifier of the cohort, can be used in externally
|-
|-
| description
| description

Revision as of 06:59, 7 April 2010

Note: This page is a work-in-progress. Feedback and suggested improvements are welcome. Please join the discussion on moodle.org or use the page comments.

Cohorts
Project state Proposal
Tracker issue MDL-21781
Discussion n/a
Assignee Petr Škoda (škoďák)

Moodle 2.0


Goals

Site-wide groups (aka cohorts) is one of the most requested missing features.

  1. Simplify manual enrolments - instead of enrolling students one by one, it would be possible to enrol a cohort with single click.
  2. Cohort enrolment plugin - new enrolment plugin synchronising users in cohort with enrolments in a course (including role assignment and group membership)
  3. Synchronisation with external systems - some external systems do not know the actual courses, they only contain some user groups, at present we do not have a simple way to reuse these groups in Moodle.
  4. Partially replace meta courses - metacourse is a confusing concept for many people, there are several unsolved problems and performance issues.
  5. Replace category enrolments - category enrolments have major design issues and are not compatible with proposed enrolment changes.

DB tables

Table cohort definition of site-wide groups (aka cohorts)

Field Type Default Description
id int(10) auto-incrementing
contextid int(10) foreign key, references context.id
name char(255) homan readable cohort name
idnumber char(100) unique identifier of the cohort, can be used in externally
description text longer description
descriptionformat int(2) text format
source char(100) full plugin name of a component responsible for assignment of users (ex: auth_ldap, etc.), NULL means manual assignments
timecreated int(10) timestamp, creation date
timemodified int(10) timestamp, last modification

Context specified can be system or course category level, defining of cohort a course context would not make much sense.


Table cohort_members stores cohort members

Field Type Default Description
id int(10) auto-incrementing
cohortid int(10) foreign key, references cohort.id
userid int(10) foreign key, references user.id
timeadded int(10) timestamp, when added

New capabilities

  • moodle/cohort:assign (add/delete members)
  • moodle/cohort:manage (add/delete/move cohorts)
  • moodle/cohort:view (view membership and use cohort elsewhere)

Context id defined in cohort table is used for access control only, the cohort may be actually used in any context (this may happen when moving courses, categories or cohorts).

User interface

  1. Cohort edit link in CONTEXT_SYSTEM and each CONTEXT_COURSECAT- most probably from the settings block
  2. Option for manual cohort enrolment - part of new enrolment UI
  3. New UI in cohort enrolment plugin
  4. New options in group creation UI
  5. New options for sync with external groups in auth or enrol plugins

Partial implementation

Unfortunately only a small part can be implemented because we still depend on capabilities for course enrolment. Most of the features will have to wait till we implement real enrolment tables in Moodle 2.1.

Possible to implement:

  • db tables with the cohort management UI
  • usage of cohorts in manual enrolments - the cohorts not synchronised, just used once
  • API for synchronisation with external systems

Delayed till 2.1:

  • new cohort enrolment plugin - no room for enrol information in course table, enrol plugins are colliding in contexts because only role allowed only once in context, there is no place for settings on the modedit form

Upgrade

No upgrade required in 2.0 because it is a completely new feature.

Complex upgrade code will be necessary for replacement of category enrolments (there is no way this could work with proposed enrolment tables). The replacement of meta courses is optional because we could implement a separate new meta course enrolment plugin.

See also