mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 04:52:36 +02:00
MDL-67902 calendar: informative aria label for event days in calendar
This commit is contained in:
parent
d24f97c456
commit
369fc01391
26
calendar/classes/external/day_exporter.php
vendored
26
calendar/classes/external/day_exporter.php
vendored
@ -126,6 +126,10 @@ class day_exporter extends exporter {
|
||||
'type' => PARAM_URL,
|
||||
'optional' => true,
|
||||
],
|
||||
'viewdaylinktitle' => [
|
||||
'type' => PARAM_RAW,
|
||||
'optional' => true,
|
||||
],
|
||||
'events' => [
|
||||
'type' => calendar_event_exporter::read_properties_definition(),
|
||||
'multiple' => true,
|
||||
@ -183,6 +187,10 @@ class day_exporter extends exporter {
|
||||
'viewdaylink' => $this->url->out(false),
|
||||
];
|
||||
|
||||
if ($viewdaylinktitle = $this->get_view_link_title()) {
|
||||
$return['viewdaylinktitle'] = $viewdaylinktitle;
|
||||
}
|
||||
|
||||
|
||||
$cache = $this->related['cache'];
|
||||
$eventexporters = array_map(function($event) use ($cache, $output) {
|
||||
@ -267,4 +275,22 @@ class day_exporter extends exporter {
|
||||
'time' => $this->calendar->time,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the title for view link.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_view_link_title() {
|
||||
$title = null;
|
||||
|
||||
$userdate = userdate($this->data[0], get_string('strftimedayshort'));
|
||||
if ($this->data['istoday']) {
|
||||
$title = get_string('todayplustitle', 'calendar', $userdate);
|
||||
} else if (count($this->related['events'])) {
|
||||
$title = get_string('eventsfor', 'calendar', $userdate);
|
||||
}
|
||||
|
||||
return $title;
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@
|
||||
data-new-event-timestamp="{{neweventtimestamp}}">
|
||||
<div class="d-none d-md-block hidden-phone text-xs-center">
|
||||
{{#hasevents}}
|
||||
<a data-action="view-day-link" href="#" class="day" title="{{viewdaylinktitle}}"
|
||||
<a data-action="view-day-link" href="#" class="day" aria-label="{{viewdaylinktitle}}"
|
||||
data-year="{{date.year}}" data-month="{{date.mon}}" data-day="{{mday}}"
|
||||
data-courseid="{{courseid}}" data-categoryid="{{categoryid}}"
|
||||
data-timestamp="{{timestamp}}">{{mday}}</a>
|
||||
@ -123,15 +123,13 @@
|
||||
</div>
|
||||
<div class="d-md-none hidden-desktop hidden-tablet">
|
||||
{{#hasevents}}
|
||||
<a data-action="view-day-link" href="#" class="day" title="{{viewdaylinktitle}}"
|
||||
<a data-action="view-day-link" href="#" class="day" aria-label="{{viewdaylinktitle}}"
|
||||
data-year="{{date.year}}" data-month="{{date.mon}}" data-day="{{mday}}"
|
||||
data-courseid="{{courseid}}" data-categoryid="{{categoryid}}"
|
||||
data-timestamp="{{timestamp}}">{{mday}}</a>
|
||||
{{/hasevents}}
|
||||
{{^hasevents}}
|
||||
<div data-region="day-content">
|
||||
{{mday}}
|
||||
</div>
|
||||
{{/hasevents}}
|
||||
</div>
|
||||
</td>
|
||||
|
Loading…
x
Reference in New Issue
Block a user