Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
enrol_category

Namespaces

namespace  enrol_category\privacy
  
 
namespace  enrol_category\task
  
 

Classes

class  enrol_category\privacy\provider
 Privacy Subsystem for enrol_category implementing null_provider. More...
 
class  enrol_category\task\enrol_category_sync
 Syncing enrolments task. More...
 
class  enrol_category_observer
 Event handler for category enrolment plugin. More...
 
class  enrol_category_plugin
 category enrolment plugin implementation. More...
 

Functions

 enrol_category_sync_course ($course)
 Sync all category enrolments in one course.
 
 enrol_category_sync_full (progress_trace $trace)
 Synchronise courses in all categories.
 
 xmldb_enrol_category_install ()
 

Variables

 $capabilities
 
 $observers
 
 $plugin = 2023041800
 
 $tasks
 
$plugin component = 'enrol_category'
 
$plugin version = 2023042400
 

Detailed Description

Function Documentation

◆ enrol_category_sync_course()

enrol_category_sync_course ( $course)

Sync all category enrolments in one course.

Parameters
stdClass$course
Return values
void

◆ enrol_category_sync_full()

enrol_category_sync_full ( progress_trace $trace)

Synchronise courses in all categories.

It gets out-of-sync if:

  • you move course to different category
  • reorder categories
  • disable enrol_category and enable it again
Parameters
progress_trace$trace
Return values
intexit code - 0 is ok, 1 means error, 2 if plugin disabled

Variable Documentation

◆ $capabilities

$capabilities
Initial value:
= array(
'enrol/category:synchronised' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => array(
)
),
'enrol/category:config' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'manager' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
)
),
)
const CONTEXT_SYSTEM
System context level - only one instance in every system.
Definition accesslib.php:122
const CONTEXT_COURSE
Course context level - one instances for each course.
Definition accesslib.php:128
const CAP_ALLOW
Allow permission, overrides CAP_PREVENT defined in parent contexts.
Definition accesslib.php:115

◆ $observers

$observers
Initial value:
= array (
array (
'eventname' => '\core\event\role_assigned',
'callback' => 'enrol_category_observer::role_assigned',
),
array (
'eventname' => '\core\event\role_unassigned',
'callback' => 'enrol_category_observer::role_unassigned',
),
)

◆ $tasks

$tasks
Initial value:
= array(
array(
'classname' => '\enrol_category\task\enrol_category_sync',
'blocking' => 0,
'minute' => '*',
'hour' => '*',
'day' => '*',
'month' => '*',
'dayofweek' => '*',
'disabled' => 0
)
)