MDL-43820 enrol: Add method to find plugin enrol instance

When upload courses we need to match instance with provided data.
This commit is contained in:
Ilya Tregubov
2023-10-26 14:27:02 +08:00
parent d76e211be6
commit bf7ff76bcd
3 changed files with 25 additions and 8 deletions
+2 -8
View File
@@ -1022,16 +1022,10 @@ class tool_uploadcourse_course {
}
$enrolmentplugins = tool_uploadcourse_helper::get_enrolment_plugins();
$instances = enrol_get_instances($course->id, false);
foreach ($enrolmentdata as $enrolmethod => $method) {
$instance = null;
foreach ($instances as $i) {
if ($i->enrol == $enrolmethod) {
$instance = $i;
break;
}
}
$plugin = $enrolmentplugins[$enrolmethod];
$instance = $plugin->find_instance($method, $course->id);
$todelete = isset($method['delete']) && $method['delete'];
$todisable = isset($method['disable']) && $method['disable'];