mirror of
https://github.com/moodle/moodle.git
synced 2025-08-10 19:36:41 +02:00
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:
parent
f30110b5eb
commit
40d397ab5f
24 changed files with 1157 additions and 10 deletions
|
@ -293,14 +293,27 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) { // sp
|
|||
new lang_string('configthemedesignermode', 'admin'), 0);
|
||||
$setting->set_updatedcallback('theme_reset_all_caches');
|
||||
$temp->add($setting);
|
||||
$temp->add(new admin_setting_configcheckbox('allowuserthemes', new lang_string('allowuserthemes', 'admin'),
|
||||
new lang_string('configallowuserthemes', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('allowcoursethemes', new lang_string('allowcoursethemes', 'admin'),
|
||||
new lang_string('configallowcoursethemes', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('allowcategorythemes', new lang_string('allowcategorythemes', 'admin'),
|
||||
new lang_string('configallowcategorythemes', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('allowcohortthemes', new lang_string('allowcohortthemes', 'admin'),
|
||||
new lang_string('configallowcohortthemes', 'admin'), 0));
|
||||
|
||||
$setting = new admin_setting_configcheckbox('allowuserthemes', new lang_string('allowuserthemes', 'admin'),
|
||||
new lang_string('configallowuserthemes', 'admin'), 0);
|
||||
$setting->set_updatedcallback('theme_purge_used_in_context_caches');
|
||||
$temp->add($setting);
|
||||
|
||||
$setting = new admin_setting_configcheckbox('allowcoursethemes', new lang_string('allowcoursethemes', 'admin'),
|
||||
new lang_string('configallowcoursethemes', 'admin'), 0);
|
||||
$setting->set_updatedcallback('theme_purge_used_in_context_caches');
|
||||
$temp->add($setting);
|
||||
|
||||
$setting = new admin_setting_configcheckbox('allowcategorythemes', new lang_string('allowcategorythemes', 'admin'),
|
||||
new lang_string('configallowcategorythemes', 'admin'), 0);
|
||||
$setting->set_updatedcallback('theme_purge_used_in_context_caches');
|
||||
$temp->add($setting);
|
||||
|
||||
$setting = new admin_setting_configcheckbox('allowcohortthemes', new lang_string('allowcohortthemes', 'admin'),
|
||||
new lang_string('configallowcohortthemes', 'admin'), 0);
|
||||
$setting->set_updatedcallback('theme_purge_used_in_context_caches');
|
||||
$temp->add($setting);
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('allowthemechangeonurl', new lang_string('allowthemechangeonurl', 'admin'),
|
||||
new lang_string('configallowthemechangeonurl', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('allowuserblockhiding', new lang_string('allowuserblockhiding', 'admin'),
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
"current": true,
|
||||
"actionurl": "http://moodlesite/admin/themeselector.php",
|
||||
"sesskey": "123XYZ",
|
||||
"settingsurl": "http://moodlesite/admin/settings.php?section=themesettingboost"
|
||||
"settingsurl": "http://moodlesite/admin/settings.php?section=themesettingboost",
|
||||
"reporturl": "http://moodlesite/report/themeusage/index.php?themechoice=boost"
|
||||
}
|
||||
}}
|
||||
<div class="card dashboard-card" role="listitem" id="theme-card-{{choose}}" aria-labelledby="theme-name-{{choose}} {{#current}}current-theme-{{choose}}{{/current}}">
|
||||
|
@ -53,6 +54,16 @@
|
|||
<i class="icon fa fa-info-circle m-0" aria-hidden="true"></i>
|
||||
<span class="sr-only">{{#str}}previewthemename, moodle, {{name}}{{/str}}</span>
|
||||
</button>
|
||||
{{#reporturl}}
|
||||
<a
|
||||
href="{{reporturl}}"
|
||||
id="theme-usage-report-{{choose}}"
|
||||
class="btn btn-link p-0 ml-2"
|
||||
title="{{#str}}themeusagereportname, admin, {{name}}{{/str}}">
|
||||
<i class="icon fa fa-area-chart m-0" aria-hidden="true"></i>
|
||||
<span class="sr-only">{{#str}}themeusagereportname, admin, {{name}}{{/str}}</span>
|
||||
</a>
|
||||
{{/reporturl}}
|
||||
{{#settingsurl}}
|
||||
<a
|
||||
href="{{settingsurl}}"
|
||||
|
|
|
@ -127,6 +127,13 @@ foreach ($themes as $themename => $themedir) {
|
|||
$themedata['settingsurl'] = $settingsurl;
|
||||
}
|
||||
|
||||
// Link to the theme usage report if override enabled and it is being used in at least one context.
|
||||
if (\core\output\theme_usage::is_theme_used_in_any_context($themename) === \core\output\theme_usage::THEME_IS_USED) {
|
||||
$reporturl = new moodle_url($CFG->wwwroot . '/report/themeusage/index.php');
|
||||
$reporturl->params(['themechoice' => $themename]);
|
||||
$themedata['reporturl'] = $reporturl->out(false);
|
||||
}
|
||||
|
||||
$data[$index] = $themedata;
|
||||
$index++;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue