Start with cascading cohort sync

This commit is contained in:
PMKuipers 2023-06-16 23:12:25 +02:00
parent e698377dca
commit 678a864ec4

View 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...
}
}