course: "[data-eventtype-course]",
group: "[data-eventtype-group]",
user: "[data-eventtype-user]",
+ other: "[data-eventtype-other]",
},
popoverType: {
site: "[data-popover-eventtype-site]",
course: "[data-popover-eventtype-course]",
group: "[data-popover-eventtype-group]",
user: "[data-popover-eventtype-user]",
+ other: "[data-popover-eventtype-other]",
},
calendarPeriods: {
month: "[data-period='month']",
$iconexporter = new event_icon_exporter($event, ['context' => $context]);
$identifier = 'type' . $values['normalisedeventtype'];
$stringexists = get_string_manager()->string_exists($identifier, 'calendar');
+ if (!$stringexists) {
+ // Property normalisedeventtype is used to build the name of the CSS class for the events.
+ $values['normalisedeventtype'] = 'other';
+ }
$values['normalisedeventtypetext'] = $stringexists ? get_string($identifier, 'calendar') : '';
$values['icon'] = $iconexporter->export($output);
* @param array $related The related data.
*/
public function __construct(event_interface $event, $related = []) {
+ global $PAGE;
$coursemodule = $event->get_course_module();
$category = $event->get_category();
$categoryid = $category ? $category->get('id') : null;
} else {
$alttext = get_string('activityevent', 'calendar');
}
+ } else if ($event->get_component()) {
+ // Guess the icon and the title for the component event. By default display calendar icon and the
+ // plugin name as the alttext.
+ if ($PAGE->theme->resolve_image_location($event->get_type(), $event->get_component())) {
+ $key = $event->get_type();
+ $component = $event->get_component();
+ } else {
+ $key = 'i/otherevent';
+ $component = 'core';
+ }
+
+ if (get_string_manager()->string_exists($event->get_type(), $event->get_component())) {
+ $alttext = get_string($event->get_type(), $event->get_component());
+ } else {
+ $alttext = get_string('pluginname', $event->get_component());
+ }
} else if ($issiteevent) {
$key = 'i/siteevent';
$component = 'core';
}
}
- // At present we only have a bail-out check for events in course modules.
+ // For non-module events we assume that all checks were done in core_calendar_is_event_visible callback.
+ // For module events we also check that the course module and course itself are visible to the user.
if (empty($dbrow->modulename)) {
return false;
}
return array_merge($carry, $groupings[0]);
}, []);
+ // Always include the site events.
+ $courseids = $courseids ? array_merge($courseids, [SITEID]) : $courseids;
+
return $this->get_events(
null,
null,
}
if ($manualedit && !empty($event->component)) {
+ // TODO possibly we can later add a callback similar to core_calendar_event_timestart_updated in the modules.
return false;
}
'course',
'group',
'user',
+ 'other'
];
return array_map(function($type) {
}} data-course-id="{{course.id}}"{{!
}} data-event-id="{{id}}"{{!
}} class="event m-t-1"{{!
+ }} data-event-component="{{component}}"{{!
+ }} data-event-eventtype="{{eventtype}}"{{!
}} data-eventtype-{{normalisedeventtype}}="1"{{!
}} data-event-title="{{name}}"{{!
}} data-event-count="{{eventcount}}"{{!
{{/underway}}
{{^underway}}
<li data-region="event-item"
+ dava-event-component="{{component}}"
+ data-event-eventtype="{{eventtype}}"
data-eventtype-{{normalisedeventtype}}="1"
{{#draggable}}
draggable="true"
$string['eventtypecourse'] = 'course';
$string['eventtypemodule'] = 'module';
$string['eventtypegroup'] = 'group';
+$string['eventtypeother'] = 'other';
$string['eventtypeuser'] = 'user';
$string['hideeventtype'] = 'Hide {$a} events';
$string['showeventtype'] = 'Show {$a} events';
'core:i/nosubcat' => 'fa-plus-square-o',
'core:i/notifications' => 'fa-bell',
'core:i/open' => 'fa-folder-open',
+ 'core:i/otherevent' => 'fa-calendar',
'core:i/outcomes' => 'fa-tasks',
'core:i/payment' => 'fa-money',
'core:i/permissionlock' => 'fa-lock',
$calendarEventGlobalColor: #d6f8cd !default; // Pale green.
$calendarEventGroupColor: #fee7ae !default; // Pale yellow.
$calendarEventUserColor: #dce7ec !default; // Pale blue.
+$calendarEventOtherColor: #ced4da !default; // Pale gray.
// Calendar event background colours defined.
.calendar_event_category {
background-color: $calendarEventUserColor;
}
+.calendar_event_other {
+ background-color: $calendarEventOtherColor;
+}
+
// Calendar restyling.
.path-calendar {
.calendartable {
&.calendar_event_user {
background-color: $calendarEventUserColor;
}
+
+ &.calendar_event_other {
+ background-color: $calendarEventOtherColor;
+ }
}
}
}
border-color: $calendarEventUserColor;
}
+ .calendar_event_other {
+ border-color: $calendarEventOtherColor;
+ }
+
.calendartable {
td,
li {
background-color: $calendarEventUserColor;
}
}
+
+ &.duration_other {
+ border-top: 1px solid $calendarEventOtherColor;
+ border-bottom: 1px solid $calendarEventOtherColor;
+
+ &.duration_finish {
+ background-color: $calendarEventOtherColor;
+ }
+ }
}
caption {
.calendar_event_user {
background-color: #dce7ec; }
+.calendar_event_other {
+ background-color: #ced4da; }
+
.path-calendar .calendartable {
width: 100%;
table-layout: fixed; }
background-color: #fee7ae; }
.path-calendar .maincalendar .calendarmonth ul li .badge.badge-circle.calendar_event_user {
background-color: #dce7ec; }
+ .path-calendar .maincalendar .calendarmonth ul li .badge.badge-circle.calendar_event_other {
+ background-color: #ced4da; }
.path-calendar .maincalendar .calendarmonth td {
height: 5em; }
.path-calendar .maincalendar .calendarmonth .clickable:hover {
border-color: #fee7ae; }
.path-calendar .maincalendar .calendar_event_user {
border-color: #dce7ec; }
+ .path-calendar .maincalendar .calendar_event_other {
+ border-color: #ced4da; }
.path-calendar .maincalendar .calendartable td,
.path-calendar .maincalendar .calendartable li {
padding: 0 4px 4px 4px; }
border-bottom: 1px solid #dce7ec; }
.block .minicalendar td.duration_user.duration_finish {
background-color: #dce7ec; }
+ .block .minicalendar td.duration_other {
+ border-top: 1px solid #ced4da;
+ border-bottom: 1px solid #ced4da; }
+ .block .minicalendar td.duration_other.duration_finish {
+ background-color: #ced4da; }
.block .minicalendar caption {
font-size: inherit;
font-weight: inherit;
.calendar_event_user {
background-color: #dce7ec; }
+.calendar_event_other {
+ background-color: #ced4da; }
+
.path-calendar .calendartable {
width: 100%;
table-layout: fixed; }
background-color: #fee7ae; }
.path-calendar .maincalendar .calendarmonth ul li .badge.badge-circle.calendar_event_user {
background-color: #dce7ec; }
+ .path-calendar .maincalendar .calendarmonth ul li .badge.badge-circle.calendar_event_other {
+ background-color: #ced4da; }
.path-calendar .maincalendar .calendarmonth td {
height: 5em; }
.path-calendar .maincalendar .calendarmonth .clickable:hover {
border-color: #fee7ae; }
.path-calendar .maincalendar .calendar_event_user {
border-color: #dce7ec; }
+ .path-calendar .maincalendar .calendar_event_other {
+ border-color: #ced4da; }
.path-calendar .maincalendar .calendartable td,
.path-calendar .maincalendar .calendartable li {
padding: 0 4px 4px 4px; }
border-bottom: 1px solid #dce7ec; }
.block .minicalendar td.duration_user.duration_finish {
background-color: #dce7ec; }
+ .block .minicalendar td.duration_other {
+ border-top: 1px solid #ced4da;
+ border-bottom: 1px solid #ced4da; }
+ .block .minicalendar td.duration_other.duration_finish {
+ background-color: #ced4da; }
.block .minicalendar caption {
font-size: inherit;
font-weight: inherit;