MDL-78427 core_theme: Add theme usage report and icon

In addition to adding in theme usage reports, there is also the
addition of an icon on the theme cards which takes you to the report.
This icon only appears for that theme if it has been used in any
overriding context.
This commit is contained in:
David Woloszyn 2024-01-24 12:15:21 +11:00
parent f30110b5eb
commit 40d397ab5f
24 changed files with 1157 additions and 10 deletions

View file

@ -101,6 +101,15 @@ function cohort_update_cohort($cohort) {
if (empty($CFG->allowcohortthemes) && isset($cohort->theme)) {
unset($cohort->theme);
}
// Delete theme usage cache if the theme has been changed.
if (isset($cohort->theme)) {
$oldcohort = $DB->get_record('cohort', ['id' => $cohort->id]);
if ($cohort->theme != $oldcohort->theme) {
theme_delete_used_in_context_cache($cohort->theme, $oldcohort->theme);
}
}
$cohort->timemodified = time();
// Update custom fields if there are any of them in the form.