Skip to content

Commit

Permalink
Merge pull request #720 from ilyatregubov/enrolcsv
Browse files Browse the repository at this point in the history
[docs] Enrol plugin API update related to csv course upload
  • Loading branch information
andrewnicols authored Sep 11, 2023
2 parents d1cbf42 + 18707fb commit d436192
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions data/component-spelling.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ qbehaviour
qformat
qtype
question
quicktime
rating
report
reportbuilder
Expand Down
18 changes: 18 additions & 0 deletions docs/apis/subsystems/enrol.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
22 changes: 22 additions & 0 deletions docs/devupdate.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit d436192

Please sign in to comment.