Merge branch 'MDL-67902-master' of git://github.com/rezaies/moodle

This commit is contained in:
Sara Arjona 2020-03-09 15:06:35 +01:00
commit 19766ef9ad
7 changed files with 38 additions and 11 deletions

File diff suppressed because one or more lines are too long

View File

@ -20,7 +20,7 @@
* components by listening for and responding to different events
* triggered within the calendar UI.
*
* @module core_calendar/calendar
* @module core_calendar/calendar_mini
* @package core_calendar
* @copyright 2017 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

View File

@ -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;
}
}

View File

@ -292,13 +292,15 @@ class core_calendar_renderer extends plugin_renderer_base {
$courseurl = new moodle_url($returnurl);
$courseurl->remove_params('course');
if ($label === null) {
$labelattributes = [];
if (empty($label)) {
$label = get_string('listofcourses');
$labelattributes['class'] = 'sr-only';
}
$select = html_writer::label($label, 'course', false, ['class' => 'mr-1']);
$select = html_writer::label($label, 'course', false, $labelattributes);
$select .= html_writer::select($courseoptions, 'course', $selected, false,
['class' => 'cal_courses_flt mr-auto']);
['class' => 'cal_courses_flt ml-1 mr-auto', 'id' => 'course']);
return $select;
}

View File

@ -34,7 +34,7 @@
}} data-toggle="popover"{{!
}} data-html="true"{{!
}} data-region="mini-day-link"{{!
}} data-trigger="hover"{{!
}} data-trigger="hover focus"{{!
}} data-placement="top"{{!
}} data-year="{{year}}"{{!
}} data-month="{{date.mon}}"{{!
@ -42,6 +42,7 @@
}} data-categoryid="{{categoryid}}"{{!
}} data-title="{{$title}}{{title}}{{/title}}"{{!
}} data-alternate="{{$nocontent}}{{/nocontent}}"{{!
}} aria-label="{{viewdaylinktitle}}"{{!
}}>{{$day}}{{day}}{{/day}}</a>
<div class="hidden">
{{$content}}{{/content}}

View File

@ -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>

View File

@ -15,7 +15,7 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template calendar/calendar_threemonth
@template calendar/threemonth_month
Calendar view to show three months as a block.