Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Files | Namespaces | Classes | Functions | Variables
enrol_cohort

Files

file  access.php
 Capabilities for cohort access plugin.
 
file  enrol_cohort_sync.php
 Syncing enrolments task.
 
file  events.php
 Cohort enrolment plugin event handler definition.
 
file  lib.php
 Cohort enrolment plugin.
 
file  locallib.php
 Local stuff for cohort enrolment plugin.
 
file  provider.php
 Privacy Subsystem implementation for enrol_cohort.
 
file  settings.php
 Cohort enrolment plugin settings and presets.
 
file  tasks.php
 Task definition for enrol_cohort.
 
file  uninstall.php
 Meta link enrolment plugin uninstallation.
 
file  version.php
 Cohort enrolment plugin version specification.
 

Namespaces

 enrol_cohort\privacy
  
 
 enrol_cohort\task
  
 

Classes

class  enrol_cohort\privacy\provider
 Privacy provider for enrol_cohort. More...
 
class  enrol_cohort\task\enrol_cohort_sync
 Syncing enrolments task. More...
 
class  enrol_cohort_handler
 Event handler for cohort enrolment plugin. More...
 
class  enrol_cohort_plugin
 Cohort enrolment plugin implementation. More...
 

Functions

 enrol_cohort_allow_group_member_remove ($itemid, $groupid, $userid)
 Prevent removal of enrol roles. More...
 
 enrol_cohort_create_new_group ($courseid, $cohortid)
 Create a new group with the cohorts name. More...
 
 enrol_cohort_sync (progress_trace $trace, $courseid=NULL)
 Sync all cohort course links. More...
 
 xmldb_enrol_cohort_uninstall ()
 

Variables

 $capabilities
 
 $observers
 
 $tasks
 
const COHORT_CREATE_GROUP -1
 COHORT_CREATEGROUP constant for automatically creating a group for a cohort.
 
$plugin component = 'enrol_cohort'
 
$plugin requires = 2019111200
 
$plugin version = 2019111800
 

Detailed Description

Function Documentation

◆ enrol_cohort_allow_group_member_remove()

enrol_cohort_allow_group_member_remove (   $itemid,
  $groupid,
  $userid 
)

Prevent removal of enrol roles.

Parameters
int$itemid
int$groupid
int$userid
Return values
bool

◆ enrol_cohort_create_new_group()

enrol_cohort_create_new_group (   $courseid,
  $cohortid 
)

Create a new group with the cohorts name.

Parameters
int$courseid
int$cohortid
Return values
int::$groupidGroup ID for this cohort.

◆ enrol_cohort_sync()

enrol_cohort_sync ( progress_trace  $trace,
  $courseid = NULL 
)

Sync all cohort course links.

Parameters
progress_trace$trace
int$courseidone course, empty mean all
Return values
int0 means ok, 1 means error, 2 means plugin disabled

Variable Documentation

◆ $capabilities

$capabilities
Initial value:
= array(
'enrol/cohort:config' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW,
)
),
'enrol/cohort:unenrol' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'manager' => CAP_ALLOW,
)
),
)

◆ $observers

$observers
Initial value:
= array(
array(
'eventname' => '\core\event\cohort_member_added',
'callback' => 'enrol_cohort_handler::member_added',
'includefile' => '/enrol/cohort/locallib.php'
),
array(
'eventname' => '\core\event\cohort_member_removed',
'callback' => 'enrol_cohort_handler::member_removed',
'includefile' => '/enrol/cohort/locallib.php'
),
array(
'eventname' => '\core\event\cohort_deleted',
'callback' => 'enrol_cohort_handler::deleted',
'includefile' => '/enrol/cohort/locallib.php'
),
)

◆ $tasks

$tasks
Initial value:
= array(
array(
'classname' => '\enrol_cohort\task\enrol_cohort_sync',
'blocking' => 0,
'minute' => 'R',
'hour' => '*',
'day' => '*',
'month' => '*',
'dayofweek' => '*',
'disabled' => 0
)
)
CONTEXT_COURSE
const CONTEXT_COURSE
Course context level - one instances for each course.
Definition: accesslib.php:128
CAP_ALLOW
const CAP_ALLOW
Allow permission, overrides CAP_PREVENT defined in parent contexts.
Definition: accesslib.php:115