Merge branch 'MDL-67902-37' of git://github.com/rezaies/moodle into MOODLE_37_STABLE

This commit is contained in:
Sara Arjona
2020-03-09 15:06:58 +01:00
6 changed files with 39 additions and 10 deletions
+1 -1
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 <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+26
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;
}
}
+7 -3
View File
@@ -292,12 +292,16 @@ class core_calendar_renderer extends plugin_renderer_base {
$courseurl = new moodle_url($returnurl);
$courseurl->remove_params('course');
if ($label === null) {
if (empty($label)) {
$label = get_string('listofcourses');
$labelclass = 'sr-only';
} else {
$labelclass = 'mr-1';
}
$select = html_writer::label($label, 'course', false, ['class' => 'mr-1']);
$select .= html_writer::select($courseoptions, 'course', $selected, false, ['class' => 'cal_courses_flt']);
$select = html_writer::label($label, 'course', false, ['class' => $labelclass]);
$select .= html_writer::select($courseoptions, 'course', $selected, false,
['class' => 'cal_courses_flt', 'id' => 'course']);
return $select;
}
@@ -33,10 +33,11 @@
}} data-container="body"{{!
}} data-toggle="popover"{{!
}} data-html="true"{{!
}} data-trigger="hover"{{!
}} data-trigger="hover focus"{{!
}} data-placement="top"{{!
}} data-title="{{$title}}{{title}}{{/title}}"{{!
}} data-alternate="{{$nocontent}}{{/nocontent}}"{{!
}} aria-label="{{viewdaylinktitle}}"{{!
}}>{{$day}}{{day}}{{/day}}</a>
<div class="hidden">
{{$content}}{{/content}}
+2 -4
View File
@@ -73,7 +73,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="{{viewdaylink}}" class="day" title="{{viewdaylinktitle}}">{{mday}}</a>
<a data-action="view-day-link" href="{{viewdaylink}}" class="day" aria-label="{{viewdaylinktitle}}">{{mday}}</a>
{{/hasevents}}
{{^hasevents}}
{{mday}}
@@ -121,12 +121,10 @@
</div>
<div class="d-md-none hidden-desktop hidden-tablet">
{{#hasevents}}
<a data-action="view-day-link" href="{{viewdaylink}}" class="day" title="{{viewdaylinktitle}}">{{mday}}</a>
<a data-action="view-day-link" href="{{viewdaylink}}" class="day" aria-label="{{viewdaylinktitle}}">{{mday}}</a>
{{/hasevents}}
{{^hasevents}}
<div data-region="day-content">
{{mday}}
</div>
{{/hasevents}}
</div>
</td>
+1 -1
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.