From 18707fbb59675197e087887751c94ba11ef342bb Mon Sep 17 00:00:00 2001 From: Ilya Tregubov Date: Wed, 30 Aug 2023 10:33:21 +0800 Subject: [PATCH] [docs] Enrol plugin API update related to csv course upload --- data/component-spelling.txt | 1 + docs/apis/subsystems/enrol.md | 18 ++++++++++++++++++ docs/devupdate.md | 22 ++++++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/data/component-spelling.txt b/data/component-spelling.txt index 27e0f5c114..1671091138 100644 --- a/data/component-spelling.txt +++ b/data/component-spelling.txt @@ -89,6 +89,7 @@ qbehaviour qformat qtype question +quicktime rating report reportbuilder diff --git a/docs/apis/subsystems/enrol.md b/docs/apis/subsystems/enrol.md index 661039e071..c1044c66a8 100644 --- a/docs/apis/subsystems/enrol.md +++ b/docs/apis/subsystems/enrol.md @@ -223,6 +223,19 @@ The method takes the following parameters: $enrolplugin->add_default_instance($course->id); ``` +### $enrol_plugin->add_custom_instance() + +Add a new enrolment instance to a specific course with custom settings an returns the instance id. This method will create a new instance record in the `enrol` table with the specified settings. + +The method takes the following parameters: + +- Course object +- Array of instance settings + +```php +$enrolplugin->add_custom_instance($course, $settings); +``` + ### $enrol_plugin->delete_instance() Remove an enrolment instance form a course and invalidate all related user enrolments. @@ -235,6 +248,11 @@ The method takes the following parameters: $enrolplugin->delete_instance($instance); ``` +### $enrol_plugin->is_csv_upload_supported() + +Checks whether enrolment plugin is supported in CSV course upload. Defaults to false. Override this function in your enrolment plugin if you want it to +be supported in CSV course upload. + ## See also - [Enrolment plugins](../plugintypes/enrol/index.md) diff --git a/docs/devupdate.md b/docs/devupdate.md index f2c6b3f206..da1a8e3115 100644 --- a/docs/devupdate.md +++ b/docs/devupdate.md @@ -502,3 +502,25 @@ See MDL-78934 for more details and changes applied. ### Removal of the `--skip-passed` option The legacy (and custom) Behat `--skip-passed` option has been removed completely. Please, use the standard `--rerun` option that provides exactly the same (execution of failed scenarios only). + +## Enrolment methods support in CSV course upload + +As part of [MDL-78855](https://tracker.moodle.org/browse/MDL-78855) new methods have been created for `enrol_plugin` to explicitly mark those enrolment methods that are supported in CSV course upload + +Example below for method to be supported: + +```php title="CSV supported" +public function is_csv_upload_supported(): bool { + return true; +} +``` + +Also a new method has been created for `enrol_plugin` to create enrolment instance with custom settings + +```php title="Add custom instance" +public function add_custom_instance(stdClass $course, ?array $fields = null): ?int { + return $this->add_instance($course, $fields); +} +``` + +In [MDL-73839](https://tracker.moodle.org/browse/MDL-73839) cohort enrolment method has been updated to support CSV course upload.