Skip to content

Commit d436192

Browse files
authored
Merge pull request #720 from ilyatregubov/enrolcsv
[docs] Enrol plugin API update related to csv course upload
2 parents d1cbf42 + 18707fb commit d436192

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

data/component-spelling.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ qbehaviour
8989
qformat
9090
qtype
9191
question
92+
quicktime
9293
rating
9394
report
9495
reportbuilder

docs/apis/subsystems/enrol.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,19 @@ The method takes the following parameters:
223223
$enrolplugin->add_default_instance($course->id);
224224
```
225225

226+
### $enrol_plugin->add_custom_instance()
227+
228+
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.
229+
230+
The method takes the following parameters:
231+
232+
- Course object
233+
- Array of instance settings
234+
235+
```php
236+
$enrolplugin->add_custom_instance($course, $settings);
237+
```
238+
226239
### $enrol_plugin->delete_instance()
227240

228241
Remove an enrolment instance form a course and invalidate all related user enrolments.
@@ -235,6 +248,11 @@ The method takes the following parameters:
235248
$enrolplugin->delete_instance($instance);
236249
```
237250

251+
### $enrol_plugin->is_csv_upload_supported()
252+
253+
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
254+
be supported in CSV course upload.
255+
238256
## See also
239257

240258
- [Enrolment plugins](../plugintypes/enrol/index.md)

docs/devupdate.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,3 +502,25 @@ See MDL-78934 for more details and changes applied.
502502
### Removal of the `--skip-passed` option
503503

504504
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).
505+
506+
## Enrolment methods support in CSV course upload
507+
508+
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
509+
510+
Example below for method to be supported:
511+
512+
```php title="CSV supported"
513+
public function is_csv_upload_supported(): bool {
514+
return true;
515+
}
516+
```
517+
518+
Also a new method has been created for `enrol_plugin` to create enrolment instance with custom settings
519+
520+
```php title="Add custom instance"
521+
public function add_custom_instance(stdClass $course, ?array $fields = null): ?int {
522+
return $this->add_instance($course, $fields);
523+
}
524+
```
525+
526+
In [MDL-73839](https://tracker.moodle.org/browse/MDL-73839) cohort enrolment method has been updated to support CSV course upload.

0 commit comments

Comments
 (0)