MDL-77991 filelib: Allow groups to generate svgs

This commit is contained in:
Mathew May 2023-05-16 10:57:50 +08:00
parent a4b3b0d044
commit 9bb91ce870
2 changed files with 22 additions and 0 deletions

View File

@ -7,6 +7,16 @@ information provided here is intended especially for developers.
- `core_group_get_course_groups`
- `core_group_get_course_user_groups`
- `core_group_get_activity_allowed_groups`
* Groups now have access to create GeoPattern default images based upon their ID with their associated course context.
This can be done by calling the following:
moodle_url::make_pluginfile_url(
$coursecontext->id,
'group',
'generated',
$group->id,
'/',
'group.svg'
);
=== 4.2 ===
* `\core_group\visibility` class added to support new `visibility` field in group records. This holds the visibility constants

View File

@ -5029,6 +5029,18 @@ function file_pluginfile($relativepath, $forcedownload, $preview = null, $offlin
\core\session\manager::write_close(); // Unlock session during file serving.
send_stored_file($file, 60*60, 0, false, $sendfileoptions);
} else if ($filearea === 'generated') {
if ($CFG->forcelogin) {
require_login($course);
} else if ($course->id != SITEID) {
require_login($course);
}
$svg = $OUTPUT->get_generated_svg_for_id($group->id);
\core\session\manager::write_close(); // Unlock session during file serving.
send_file($svg, 'group.svg', 60 * 60, 0, true, $forcedownload);
} else {
send_file_not_found();
}