Start with cascading cohort sync
This commit is contained in:
parent
e698377dca
commit
678a864ec4
36
classes/enrolcohortsync.php
Normal file
36
classes/enrolcohortsync.php
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
namespace local_treestudyplan;
|
||||
require_once($CFG->libdir.'/externallib.php');
|
||||
|
||||
use \local_treestudyplan\studyplan;
|
||||
|
||||
class enrolcohortsync {
|
||||
|
||||
private $studyplan;
|
||||
|
||||
function __construct($studyplan){
|
||||
$this->studyplan = $studyplan;
|
||||
}
|
||||
|
||||
function sync(){
|
||||
// Find the courses that need to be synced to the associated cohorts
|
||||
$courses = $this->studyplan->get_linked_course_ids();
|
||||
|
||||
// And find the cohorts that are linked to this studyplan.
|
||||
|
||||
// Next, for each course that is linked:
|
||||
// 1: check if a link exists
|
||||
// If not, make it (maybe use some of the custom text to list the studyplans involved)
|
||||
|
||||
// 2: Check if there are cohort links for this studyplan that should be removed
|
||||
// A: Check if there are cohort links that are no longer related to this studyplan
|
||||
// B: Check if these links are valid through another studyplan...
|
||||
// If no one uses the link anymore, deactivate it...
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user