mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 04:52:36 +02:00
Merge branch 'MDL-75571-401' of https://github.com/jacdsouza/moodle into MOODLE_401_STABLE
This commit is contained in:
commit
987542f609
admin/tool/componentlibrary/content/moodle/components
blocks/timeline/templates
calendar
theme/boost/classes/output
@ -81,6 +81,30 @@ $activity-icon-colors: (
|
||||
);
|
||||
{{</ highlight >}}
|
||||
|
||||
### Custom activity icons
|
||||
|
||||
Some activities allow icons to be customised. This can be done by implementing callback XXX_get_coursemodule_info() returning instance of object e.g. mod/lti/lib.php
|
||||
|
||||
{{< php >}}
|
||||
$info = new cached_cm_info();
|
||||
$info->iconurl = new moodle_url('https://moodle.org/theme/moodleorg/pix/moodle_logo_small.svg');
|
||||
{{< /php >}}
|
||||
|
||||
To get this customised icon, use:
|
||||
|
||||
{{< php >}}
|
||||
$iconurl = get_fast_modinfo($courseid)->get_cm($cmid)->get_icon_url()->out(false);
|
||||
{{< /php >}}
|
||||
|
||||
<div class="media mb-3">
|
||||
<div class="activityiconcontainer lti mr-3">
|
||||
<img alt="lti icon" title="lti icon" src="https://moodle.org/theme/moodleorg/pix/moodle_logo_small.svg" class="activityicon "> </div>
|
||||
<div class="media-body align-self-center">
|
||||
<div class="text-uppercase small">external</div>
|
||||
<div class="activityname"><a href="#">External tool module</a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
## Examples
|
||||
|
||||
<div class="media mb-3">
|
||||
|
@ -40,7 +40,8 @@
|
||||
"icon": {
|
||||
"key": "icon",
|
||||
"component": "mod_assign",
|
||||
"alttext": "Assignment icon"
|
||||
"alttext": "Assignment icon",
|
||||
"iconurl": "#"
|
||||
},
|
||||
"overdue": false,
|
||||
"purpose": "assessment"
|
||||
@ -54,7 +55,14 @@
|
||||
{{#userdate}} {{timesort}}, {{#str}} strftimetime24, core_langconfig {{/str}} {{/userdate}}
|
||||
</small>
|
||||
<div class="activityiconcontainer small {{purpose}} courseicon align-self-top align-self-center mx-3 mb-1 mb-sm-0 text-nowrap">
|
||||
{{#icon}}{{#pix}} {{key}}, {{component}}, {{alttext}} {{/pix}}{{/icon}}
|
||||
{{#icon}}
|
||||
{{#iconurl}}
|
||||
<img alt="{{alttext}}" title="{{alttext}}" src="{{{ iconurl }}}" class="icon ">
|
||||
{{/iconurl}}
|
||||
{{^iconurl}}
|
||||
{{#pix}} {{key}}, {{component}}, {{alttext}} {{/pix}}
|
||||
{{/iconurl}}
|
||||
{{/icon}}
|
||||
</div>
|
||||
<div class="event-name-container flex-grow-1 line-height-3 nowrap text-truncate">
|
||||
<div class="d-flex">
|
||||
|
@ -61,11 +61,13 @@ class event_icon_exporter extends exporter {
|
||||
$iscourseevent = ($course && !empty($courseid) && $courseid != SITEID && empty($groupid));
|
||||
$isgroupevent = ($group && !empty($groupid));
|
||||
$isuserevent = ($user && !empty($userid));
|
||||
$iconurl = '';
|
||||
|
||||
if ($isactivityevent) {
|
||||
$key = 'monologo';
|
||||
$component = $coursemodule->get('modname');
|
||||
|
||||
$iconurl = get_fast_modinfo($courseid)->get_cm($coursemodule->get('id'))->get_icon_url()->out(false);
|
||||
if (get_string_manager()->string_exists($event->get_type(), $component)) {
|
||||
$alttext = get_string($event->get_type(), $component);
|
||||
} else {
|
||||
@ -118,6 +120,7 @@ class event_icon_exporter extends exporter {
|
||||
$data->key = $key;
|
||||
$data->component = $component;
|
||||
$data->alttext = $alttext;
|
||||
$data->iconurl = $iconurl;
|
||||
|
||||
parent::__construct($data, $related);
|
||||
}
|
||||
@ -132,6 +135,7 @@ class event_icon_exporter extends exporter {
|
||||
'key' => ['type' => PARAM_TEXT],
|
||||
'component' => ['type' => PARAM_TEXT],
|
||||
'alttext' => ['type' => PARAM_TEXT],
|
||||
'iconurl' => ['type' => PARAM_TEXT],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,8 @@
|
||||
"icon": {
|
||||
"key": "i/courseevent",
|
||||
"component": "core",
|
||||
"alttext": "Some course event"
|
||||
"alttext": "Some course event",
|
||||
"iconurl": "#"
|
||||
},
|
||||
"editurl": "#",
|
||||
"url": "#"
|
||||
|
@ -45,7 +45,14 @@
|
||||
}} data-region="event-item"{{!
|
||||
}}>
|
||||
<div class="activityiconcontainer small {{{purpose}}} courseicon mr-3">
|
||||
{{#icon}}{{#pix}} {{key}}, {{component}}, {{alttext}} {{/pix}}{{/icon}}
|
||||
{{#icon}}
|
||||
{{#iconurl}}
|
||||
<img alt="{{alttext}}" title="{{alttext}}" src="{{{ iconurl }}}" class="icon ">
|
||||
{{/iconurl}}
|
||||
{{^iconurl}}
|
||||
{{#pix}} {{key}}, {{component}}, {{alttext}} {{/pix}}
|
||||
{{/iconurl}}
|
||||
{{/icon}}
|
||||
</div>
|
||||
<div class="overflow-auto">
|
||||
<h6 class="d-flex mb-1">
|
||||
|
@ -161,7 +161,8 @@ class core_renderer extends \core_renderer {
|
||||
$heading = $this->page->course->fullname;
|
||||
} else {
|
||||
$heading = $this->page->cm->get_formatted_name();
|
||||
$imagedata = $this->pix_icon('monologo', '', $this->page->activityname, ['class' => 'activityicon']);
|
||||
$imagedata = html_writer::img($this->page->cm->get_icon_url()->out(false), '',
|
||||
['class' => 'icon activityicon', 'aria-hidden' => 'true']);
|
||||
$purposeclass = plugin_supports('mod', $this->page->activityname, FEATURE_MOD_PURPOSE);
|
||||
$purposeclass .= ' activityiconcontainer';
|
||||
$purposeclass .= ' modicon_' . $this->page->activityname;
|
||||
|
Loading…
x
Reference in New Issue
Block a user