Removed auto enable check rom enrolcohortsync class
This commit is contained in:
parent
29a2472bd2
commit
70a005d574
3 changed files with 105 additions and 107 deletions
|
@ -7,6 +7,7 @@ use \local_treestudyplan\studyplan;
|
|||
class enrolcohortsync {
|
||||
private const METHOD = "cohort";
|
||||
private $studyplan;
|
||||
private $studyplanid;
|
||||
|
||||
function __construct($studyplan){
|
||||
$this->studyplan = $studyplan;
|
||||
|
@ -24,8 +25,6 @@ class enrolcohortsync {
|
|||
// TODO: Determine if it would be better to add a database table of our own to store references between studyplan and cohort sync enrolment
|
||||
// instead of using customtext4 for this
|
||||
|
||||
|
||||
if(get_config("local_treestudyplan","csync_enable")){
|
||||
$enrol = enrol_get_plugin(self::METHOD);
|
||||
// Find the courses that need to be synced to the associated cohorts
|
||||
$courseids = $this->studyplan->get_linked_course_ids();
|
||||
|
@ -70,7 +69,7 @@ class enrolcohortsync {
|
|||
else{
|
||||
$plans = json_decode($instance->customtext4);
|
||||
}
|
||||
if(!$in_array($this->studyplanid ,$plans)){
|
||||
if(!in_array($this->studyplanid ,$plans)){
|
||||
// if not, add it to the reference
|
||||
$plans[] = $this->studyplanid;
|
||||
$enrol->update_instance($instance,["customtext4"=>json_encode($plans)]);
|
||||
|
@ -93,7 +92,7 @@ class enrolcohortsync {
|
|||
|
||||
// Successfully added a valid new instance, so now instantiate it.
|
||||
// First synchronise the enrolment.
|
||||
$cohorttrace = new null_progress_trace();
|
||||
$cohorttrace = new \null_progress_trace();
|
||||
enrol_cohort_sync($cohorttrace, $cohortid);
|
||||
$cohorttrace->finished();
|
||||
|
||||
|
@ -150,5 +149,4 @@ class enrolcohortsync {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -59,9 +59,9 @@ $string['settingdesc_display_field'] = 'Select the field to use for the display
|
|||
$string['settingspage_csync'] = 'Studyplan cohort sync';
|
||||
$string['setting_csync_heading'] = 'Automatically create a cohort sync in all courses linked to a studyplan for all cohorts linked to a studyplan';
|
||||
$string['settingdesc_csync_heading'] = '';
|
||||
$string['setting_csync_enable_field'] = 'Enable';
|
||||
$string['setting_csync_enable_field'] = 'Automatic cohort sync';
|
||||
$string['settingdesc_csync_enable_field'] = 'Enable automatic cohort sync';
|
||||
$string['setting_csync_autoremove_field'] = 'Automatisch deletion';
|
||||
$string['setting_csync_autoremove_field'] = 'Automatic deletion';
|
||||
$string['settingdesc_csync_autoremove_field'] = 'Delete syncronization from courses once a cohort is removed from the studyplan';
|
||||
$string['setting_csync_creategroup_field'] = 'Create groups';
|
||||
$string['settingdesc_csync_creategroup_field'] = 'Create a group in the course for each cohort sync';
|
||||
|
|
|
@ -61,7 +61,7 @@ $string['settingdesc_display_field'] = 'Kies welk veld gebruikt moet worden als
|
|||
$string['settingspage_csync'] = 'Studieplan site-groep synchronisatie';
|
||||
$string['setting_csync_heading'] = 'Site-groepen die aan een studieplan gekoppeld zijn automatisch als site-groep synchronisatie koppelen aan alle cursussen in het studieplan.';
|
||||
$string['settingdesc_csync_heading'] = '';
|
||||
$string['setting_csync_enable_field'] = 'Inschakelen';
|
||||
$string['setting_csync_enable_field'] = 'Automatisch koppelen inschakelen';
|
||||
$string['settingdesc_csync_enable_field'] = 'Automatische koppelen van site-groep synchronisatie inschakelen';
|
||||
$string['setting_csync_autoremove_field'] = 'Automatisch verwijderen';
|
||||
$string['settingdesc_csync_autoremove_field'] = 'Verwijder sychronisaties in cursussen als deze uit het studieplan worden verwijderd';
|
||||
|
|
Loading…
Reference in a new issue