Merge branch 'MDL-72543-master' of git://github.com/lameze/moodle

This commit is contained in:
abgreeve 2021-10-07 15:11:12 +08:00
commit 24eac0b051
14 changed files with 367 additions and 97 deletions

View File

@ -21,7 +21,10 @@
Example context (json):
{
"name": "Assignment due 1",
"name": "Assignment 1 is due",
"activityname": "Assignment",
"activitystr": "Assignment is due",
"courseview": true,
"url": "https://www.google.com",
"timesort": 1490320388,
"course": {
@ -53,12 +56,17 @@
<div class="event-name-container flex-grow-1 text-truncate line-height-3">
<a href="{{url}}"
title={{#quote}}{{{name}}}{{/quote}}
aria-label='{{#str}} ariaeventlistitem, block_timeline, { "name": {{#quote}}{{{name}}}{{/quote}}, "course": {{#quote}}{{{course.fullnamedisplay}}}{{/quote}}, "date": "{{#userdate}} {{timesort}}, {{#str}} strftimedatetime, core_langconfig {{/str}} {{/userdate}}" } {{/str}}'>
<h6 class="event-name text-truncate mb-0">{{{name}}}</h6>
aria-label='{{#str}} ariaeventlistitem, block_timeline, { "name": {{#quote}}{{{activityname}}}{{/quote}}, "course": {{#quote}}{{{course.fullnamedisplay}}}{{/quote}}, "date": "{{#userdate}} {{timesort}}, {{#str}} strftimedatetime, core_langconfig {{/str}} {{/userdate}}" } {{/str}}'>
<h6 class="event-name text-truncate mb-0">{{{activityname}}}</h6>
</a>
{{#course.fullnamedisplay}}
<small class="text-muted text-truncate mb-0">{{{course.fullnamedisplay}}}</small>
{{/course.fullnamedisplay}}
<small class="text-truncate mb-0">
{{#courseview}}
{{activitystr}}
{{/courseview}}
{{^courseview}}
{{#course.fullnamedisplay}}{{{course.fullnamedisplay}}} &middot; {{/course.fullnamedisplay}}{{activitystr}}
{{/courseview}}
</small>
</div>
{{#action.actionable}}
<h6 class="event-action">

View File

@ -41,14 +41,17 @@ Feature: The timeline block allows users to see upcoming courses
Then I should see "Course 1" in the "Timeline" "block"
And I should see "Course 2" in the "Timeline" "block"
And I should see "More courses" in the "Timeline" "block"
And I should see "Test choice 1 closes" in the "Timeline" "block"
And I should see "Test feedback 1 closes" in the "Timeline" "block"
And "Test choice 1" "link" should exist in the "Timeline" "block"
And I should see "Choice closes" in the "Timeline" "block"
And "Test feedback 1" "link" should exist in the "Timeline" "block"
And I should see "Feedback closes" in the "Timeline" "block"
And I should not see "Course 3" in the "Timeline" "block"
And I should not see "Test choice 2 closes" in the "Timeline" "block"
And I should not see "Test choice 3 closes" in the "Timeline" "block"
And I should not see "Test feedback 2 closes" in the "Timeline" "block"
And I should not see "Test feedback 3 closes" in the "Timeline" "block"
And I should not see "Test assign 1 is due" in the "Timeline" "block"
And "Test choice 2" "link" should not exist in the "Timeline" "block"
And "Test choice 3" "link" should not exist in the "Timeline" "block"
And "Test feedback 2" "link" should not exist in the "Timeline" "block"
And "Test feedback 3" "link" should not exist in the "Timeline" "block"
And "Test assign 1" "link" should not exist in the "Timeline" "block"
And I should not see "Assignment is due" in the "Timeline" "block"
Scenario: All in course view
Given I log in as "student1"
@ -60,16 +63,18 @@ Feature: The timeline block allows users to see upcoming courses
Then I should see "Course 3" in the "Timeline" "block"
And I should see "Course 2" in the "Timeline" "block"
And I should see "Course 1" in the "Timeline" "block"
And I should see "Test choice 1 closes" in the "Timeline" "block"
And I should see "Test choice 3 closes" in the "Timeline" "block"
And I should see "Test feedback 1 closes" in the "Timeline" "block"
And I should see "Test feedback 2 closes" in the "Timeline" "block"
And I should see "Test feedback 3 closes" in the "Timeline" "block"
And I should see "Test assign 1 is due" in the "Timeline" "block"
And "Test choice 1" "link" should exist in the "Timeline" "block"
And "Test choice 3" "link" should exist in the "Timeline" "block"
And "Test feedback 1" "link" should exist in the "Timeline" "block"
And "Test feedback 2" "link" should exist in the "Timeline" "block"
And "Test feedback 3" "link" should exist in the "Timeline" "block"
And "Test assign 1" "link" should exist in the "Timeline" "block"
And I should see "Assignment is due" in the "Timeline" "block"
And I should see "Choice closes" in the "Timeline" "block"
And I should not see "More courses" in the "Timeline" "block"
And I should not see "Course 4" in the "Timeline" "block"
And I should not see "Test choice 2 closes" in the "Timeline" "block"
And I should not see "Test feedback 4 closes" in the "Timeline" "block"
And "Test choice 2" "link" should not exist in the "Timeline" "block"
And I should not see "Test feedback 4" in the "Timeline" "block"
Scenario: Persistent sort filter
Given I log in as "student1"
@ -81,14 +86,14 @@ Feature: The timeline block allows users to see upcoming courses
Then I should see "Course 1" in the "Timeline" "block"
And I should see "Course 2" in the "Timeline" "block"
And I should see "More courses" in the "Timeline" "block"
And I should see "Test choice 1 closes" in the "Timeline" "block"
And I should see "Test feedback 1 closes" in the "Timeline" "block"
And "Test choice 1" "link" should exist in the "Timeline" "block"
And "Test feedback 1" "link" should exist in the "Timeline" "block"
And I should not see "Course 3" in the "Timeline" "block"
And I should not see "Test choice 2 closes" in the "Timeline" "block"
And I should not see "Test choice 3 closes" in the "Timeline" "block"
And I should not see "Test feedback 2 closes" in the "Timeline" "block"
And I should not see "Test feedback 3 closes" in the "Timeline" "block"
And I should not see "Test assign 1 is due" in the "Timeline" "block"
And "Test choice 2" "link" should not exist in the "Timeline" "block"
And "Test choice 3" "link" should not exist in the "Timeline" "block"
And "Test feedback 2" "link" should not exist in the "Timeline" "block"
And "Test feedback 3" "link" should not exist in the "Timeline" "block"
And "Test assign 1" "link" should not exist in the "Timeline" "block"
Scenario: Persistent All in course view
Given I log in as "student1"
@ -101,16 +106,16 @@ Feature: The timeline block allows users to see upcoming courses
Then I should see "Course 3" in the "Timeline" "block"
And I should see "Course 2" in the "Timeline" "block"
And I should see "Course 1" in the "Timeline" "block"
And I should see "Test choice 1 closes" in the "Timeline" "block"
And I should see "Test choice 3 closes" in the "Timeline" "block"
And I should see "Test feedback 1 closes" in the "Timeline" "block"
And I should see "Test feedback 2 closes" in the "Timeline" "block"
And I should see "Test feedback 3 closes" in the "Timeline" "block"
And I should see "Test assign 1 is due" in the "Timeline" "block"
And "Test choice 1" "link" should exist in the "Timeline" "block"
And "Test choice 3" "link" should exist in the "Timeline" "block"
And "Test feedback 1" "link" should exist in the "Timeline" "block"
And "Test feedback 2" "link" should exist in the "Timeline" "block"
And "Test feedback 3" "link" should exist in the "Timeline" "block"
And "Test assign 1" "link" should exist in the "Timeline" "block"
And I should not see "More courses" in the "Timeline" "block"
And I should not see "Course 4" in the "Timeline" "block"
And I should not see "Test choice 2 closes" in the "Timeline" "block"
And I should not see "Test feedback 4 closes" in the "Timeline" "block"
And "Test choice 2" "link" should not exist in the "Timeline" "block"
And "Test feedback 4" "link" should not exist in the "Timeline" "block"
Scenario: Current filtering always applies in courses view
Given I log in as "student1"
@ -119,8 +124,8 @@ Feature: The timeline block allows users to see upcoming courses
And I click on "Filter timeline by date" "button" in the "Timeline" "block"
And I click on "Overdue" "link" in the "Timeline" "block"
And I reload the page
And I should see "Test assign 1 is due" in the "Timeline" "block"
And I should not see "Test feedback 2 closes" in the "Timeline" "block"
And "Test assign 1" "link" should exist in the "Timeline" "block"
And "Test feedback 2" "link" should not exist in the "Timeline" "block"
And I click on "Sort timeline items" "button" in the "Timeline" "block"
And I click on "Sort by dates" "link" in the "Timeline" "block"
And I click on "Filter timeline by date" "button" in the "Timeline" "block"
@ -129,5 +134,5 @@ Feature: The timeline block allows users to see upcoming courses
And I click on "Sort timeline items" "button" in the "Timeline" "block"
And I click on "Sort by courses" "link" in the "Timeline" "block"
And I click on "More courses" "button" in the "Timeline" "block"
Then I should see "Test assign 1 is due" in the "Timeline" "block"
And I should see "Test feedback 2 closes" in the "Timeline" "block"
Then "Test assign 1" "link" should exist in the "Timeline" "block"
And "Test feedback 2" "link" should exist in the "Timeline" "block"

View File

@ -35,43 +35,53 @@ Feature: The timeline block allows users to see upcoming activities
Given I log in as "student1"
And I click on "Filter timeline by date" "button" in the "Timeline" "block"
When I click on "Next 7 days" "link" in the "Timeline" "block"
Then I should see "Test choice 1 closes" in the "Timeline" "block"
And I should see "Test feedback 1 closes" in the "Timeline" "block"
And I should not see "Test choice 2 closes" in the "Timeline" "block"
And I should not see "Test choice 3 closes" in the "Timeline" "block"
And I should not see "Test feedback 3 closes" in the "Timeline" "block"
And I should not see "Test assign 1 is due" in the "Timeline" "block"
Then "Test choice 1" "link" should exist in the "Timeline" "block"
And I should see "Course 2 · Choice closes" in the "Timeline" "block"
And "Test feedback 1" "link" should exist in the "Timeline" "block"
And I should see "Course 2 · Feedback closes" in the "Timeline" "block"
And "Test choice 2" "link" should not exist in the "Timeline" "block"
And "Test choice 3" "link" should not exist in the "Timeline" "block"
And "Test feedback 3" "link" should not exist in the "Timeline" "block"
And "Test assign 1" "link" should not exist in the "Timeline" "block"
And I should not see "Course 1 · Assignment is due" in the "Timeline" "block"
Scenario: Overdue in date view
Given I log in as "student1"
And I click on "Filter timeline by date" "button" in the "Timeline" "block"
When I click on "Overdue" "link" in the "Timeline" "block"
Then I should see "Test assign 1 is due" in the "Timeline" "block"
And I should not see "Test choice 2 closes" in the "Timeline" "block"
And I should not see "Test feedback 1 closes" in the "Timeline" "block"
And I should not see "Test choice 1 closes" in the "Timeline" "block"
And I should not see "Test choice 3 closes" in the "Timeline" "block"
And I should not see "Test feedback 3 closes" in the "Timeline" "block"
And "Test assign 1" "link" should exist in the "Timeline" "block"
Then I should see "Course 1 · Assignment is due" in the "Timeline" "block"
And "Test choice 2" "link" should not exist in the "Timeline" "block"
And "Test feedback 1" "link" should not exist in the "Timeline" "block"
And "Test choice 1" "link" should not exist in the "Timeline" "block"
And "Test choice 3" "link" should not exist in the "Timeline" "block"
And "Test feedback 3" "link" should not exist in the "Timeline" "block"
Scenario: All in date view
Given I log in as "student1"
And I click on "Filter timeline by date" "button" in the "Timeline" "block"
When I click on "All" "link" in the "Timeline" "block"
Then I should see "Test assign 1 is due" in the "Timeline" "block"
And I should see "Test feedback 1 closes" in the "Timeline" "block"
And I should see "Test choice 1 closes" in the "Timeline" "block"
And I should see "Test choice 3 closes" in the "Timeline" "block"
And I should see "Test feedback 3 closes" in the "Timeline" "block"
And I should not see "Test choice 2 closes" in the "Timeline" "block"
And I should not see "Test feedback 2 closes" in the "Timeline" "block"
Then "Test assign 1" "link" should exist in the "Timeline" "block"
And I should see "Course 1 · Assignment is due" in the "Timeline" "block"
And "Test feedback 1" "link" should exist in the "Timeline" "block"
And I should see "Course 2 · Feedback closes" in the "Timeline" "block"
And "Test choice 1" "link" should exist in the "Timeline" "block"
And I should see "Course 2 · Choice closes" in the "Timeline" "block"
And "Test choice 3" "link" should exist in the "Timeline" "block"
And I should see "Course 3 · Choice closes" in the "Timeline" "block"
And "Test feedback 3" "link" should exist in the "Timeline" "block"
And I should see "Course 3 · Feedback closes" in the "Timeline" "block"
And "Test choice 2" "link" should not exist in the "Timeline" "block"
And "Test feedback 2" "link" should not exist in the "Timeline" "block"
And I click on "[data-region='paging-bar'] [data-control='next'] [data-region='page-link']" "css_element" in the "Timeline" "block"
And I should see "Test feedback 2 closes" in the "Timeline" "block"
And I should not see "Test assign 1 is due" in the "Timeline" "block"
And I should not see "Test feedback 1 closes" in the "Timeline" "block"
And I should not see "Test choice 1 closes" in the "Timeline" "block"
And I should not see "Test choice 3 closes" in the "Timeline" "block"
And I should not see "Test feedback 3 closes" in the "Timeline" "block"
And I should not see "Test choice 2 closes" in the "Timeline" "block"
And "Test feedback 2" "link" should exist in the "Timeline" "block"
And I should see "Course 1 · Feedback closes" in the "Timeline" "block"
And I should not see "Test assign 1" in the "Timeline" "block"
And I should not see "Test feedback 1" in the "Timeline" "block"
And I should not see "Test choice 1" in the "Timeline" "block"
And I should not see "Test choice 3" in the "Timeline" "block"
And I should not see "Test feedback 3" in the "Timeline" "block"
And I should not see "Test choice 2" in the "Timeline" "block"
Scenario: All in date view no next
Given I log in as "student1"
@ -79,46 +89,58 @@ Feature: The timeline block allows users to see upcoming activities
And I click on "All" "link" in the "Timeline" "block"
And I click on "5" "button" in the "Timeline" "block"
When I click on "25" "link" in the "Timeline" "block"
Then I should see "Test assign 1 is due" in the "Timeline" "block"
And I should see "Test feedback 1 closes" in the "Timeline" "block"
And I should see "Test choice 1 closes" in the "Timeline" "block"
And I should see "Test choice 3 closes" in the "Timeline" "block"
And I should see "Test feedback 3 closes" in the "Timeline" "block"
And I should see "Test feedback 2 closes" in the "Timeline" "block"
And I should not see "Test choice 2 closes" in the "Timeline" "block"
Then "Test assign 1" "link" should exist in the "Timeline" "block"
And I should see "Course 1 · Assignment is due" in the "Timeline" "block"
And "Test feedback 1" "link" should exist in the "Timeline" "block"
And I should see "Course 2 · Feedback closes" in the "Timeline" "block"
And "Test choice 1" "link" should exist in the "Timeline" "block"
And I should see "Course 2 · Choice closes" in the "Timeline" "block"
And "Test choice 3" "link" should exist in the "Timeline" "block"
And I should see "Course 3 · Choice closes" in the "Timeline" "block"
And "Test feedback 3" "link" should exist in the "Timeline" "block"
And I should see "Course 3 · Feedback closes" in the "Timeline" "block"
And "Test feedback 2" "link" should exist in the "Timeline" "block"
And I should see "Course 1 · Feedback closes" in the "Timeline" "block"
And I should not see "Test choice 2" in the "Timeline" "block"
Scenario: Persistent All in date view
Given I log in as "student1"
And I click on "Filter timeline by date" "button" in the "Timeline" "block"
When I click on "All" "link" in the "Timeline" "block"
And I reload the page
Then I should see "Test assign 1 is due" in the "Timeline" "block"
And I should see "Test feedback 1 closes" in the "Timeline" "block"
And I should see "Test choice 1 closes" in the "Timeline" "block"
And I should see "Test choice 3 closes" in the "Timeline" "block"
And I should see "Test feedback 3 closes" in the "Timeline" "block"
And I should not see "Test choice 2 closes" in the "Timeline" "block"
And I should not see "Test feedback 2 closes" in the "Timeline" "block"
Then "Test assign 1" "link" should exist in the "Timeline" "block"
And I should see "Course 1 · Assignment is due" in the "Timeline" "block"
And "Test feedback 1" "link" should exist in the "Timeline" "block"
And I should see "Course 2 · Feedback closes" in the "Timeline" "block"
And "Test choice 1" "link" should exist in the "Timeline" "block"
And I should see "Course 2 · Choice closes" in the "Timeline" "block"
And "Test choice 3" "link" should exist in the "Timeline" "block"
And I should see "Course 3 · Choice closes" in the "Timeline" "block"
And "Test feedback 3" "link" should exist in the "Timeline" "block"
And I should see "Course 3 · Feedback closes" in the "Timeline" "block"
And I should not see "Test choice 2" in the "Timeline" "block"
And I should not see "Test feedback 2" in the "Timeline" "block"
And I click on "[data-region='paging-bar'] [data-control='next']" "css_element" in the "Timeline" "block"
And I should see "Test feedback 2 closes" in the "Timeline" "block"
And I should not see "Test assign 1 is due" in the "Timeline" "block"
And I should not see "Test feedback 1 closes" in the "Timeline" "block"
And I should not see "Test choice 1 closes" in the "Timeline" "block"
And I should not see "Test choice 3 closes" in the "Timeline" "block"
And I should not see "Test feedback 3 closes" in the "Timeline" "block"
And I should not see "Test choice 2 closes" in the "Timeline" "block"
And "Test feedback 2" "link" should exist in the "Timeline" "block"
And I should see "Course 1 · Feedback closes" in the "Timeline" "block"
And I should not see "Test assign 1" in the "Timeline" "block"
And I should not see "Test feedback 1" in the "Timeline" "block"
And I should not see "Test feedback 3" in the "Timeline" "block"
And I should not see "Test choice 1" in the "Timeline" "block"
And I should not see "Test choice 2" in the "Timeline" "block"
And I should not see "Test choice 3" in the "Timeline" "block"
Scenario: Persistent Overdue in date view
Given I log in as "student1"
And I click on "Filter timeline by date" "button" in the "Timeline" "block"
When I click on "Overdue" "link" in the "Timeline" "block"
And I reload the page
Then I should see "Test assign 1 is due" in the "Timeline" "block"
And I should not see "Test choice 2 closes" in the "Timeline" "block"
And I should not see "Test feedback 1 closes" in the "Timeline" "block"
And I should not see "Test choice 1 closes" in the "Timeline" "block"
And I should not see "Test choice 3 closes" in the "Timeline" "block"
And I should not see "Test feedback 3 closes" in the "Timeline" "block"
Then "Test assign 1" "link" should exist in the "Timeline" "block"
And "Test choice 2" "link" should not exist in the "Timeline" "block"
And "Test feedback 1" "link" should not exist in the "Timeline" "block"
And "Test choice 1" "link" should not exist in the "Timeline" "block"
And "Test choice 3" "link" should not exist in the "Timeline" "block"
And "Test feedback 3" "link" should not exist in the "Timeline" "block"
Scenario: Current filtering always applies in date view
Given I log in as "student1"
@ -128,8 +150,8 @@ Feature: The timeline block allows users to see upcoming activities
# Expand to 25 results, to ensure we see the earliest and latest timeline items.
And I click on "Show 5 activities per page" "button" in the "Timeline" "block"
And I click on "25" "link"
And I should see "Test assign 1 is due" in the "Timeline" "block"
And I should not see "Test feedback 2 closes" in the "Timeline" "block"
And "Test assign 1" "link" should exist in the "Timeline" "block"
And "Test feedback 2" "link" should not exist in the "Timeline" "block"
And I click on "Sort timeline items" "button" in the "Timeline" "block"
And I click on "Sort by courses" "link" in the "Timeline" "block"
And I click on "Filter timeline by date" "button" in the "Timeline" "block"
@ -137,5 +159,5 @@ Feature: The timeline block allows users to see upcoming activities
When I click on "All" "link" in the "Timeline" "block"
And I click on "Sort timeline items" "button" in the "Timeline" "block"
And I click on "Sort by dates" "link" in the "Timeline" "block"
Then I should see "Test assign 1 is due" in the "Timeline" "block"
And I should see "Test feedback 2 closes" in the "Timeline" "block"
Then "Test assign 1" "link" should exist in the "Timeline" "block"
And "Test feedback 2" "link" should exist in the "Timeline" "block"

View File

@ -100,6 +100,19 @@ class event_exporter_base extends exporter {
if ($cm = $event->get_course_module()) {
$data->modulename = $cm->get('modname');
$data->instance = $cm->get('id');
$data->activityname = $cm->get('name');
$component = 'mod_' . $data->modulename;
if (!component_callback_exists($component, 'core_calendar_get_event_action_string')) {
$modulename = get_string('modulename', $data->modulename);
$data->activitystr = get_string('requiresaction', 'calendar', $modulename);
} else {
$data->activitystr = component_callback(
$component,
'core_calendar_get_event_action_string',
[$event->get_type()]
);
}
}
parent::__construct($data, $related);
@ -174,6 +187,18 @@ class event_exporter_base extends exporter {
'default' => null,
'null' => NULL_ALLOWED
],
'activityname' => [
'type' => PARAM_TEXT,
'optional' => true,
'default' => null,
'null' => NULL_ALLOWED
],
'activitystr' => [
'type' => PARAM_TEXT,
'optional' => true,
'default' => null,
'null' => NULL_ALLOWED
],
'instance' => [
'type' => PARAM_INT,
'optional' => true,

View File

@ -228,6 +228,7 @@ $string['repeatevent'] = 'Repeat this event';
$string['repeatnone'] = 'No repeats';
$string['repeatweeksl'] = 'Repeat weekly, creating altogether';
$string['repeatweeksr'] = 'events';
$string['requiresaction'] = '{$a} requires action';
$string['sat'] = 'Sat';
$string['saturday'] = 'Saturday';
$string['shown'] = 'shown';

View File

@ -1826,3 +1826,26 @@ function mod_assign_get_path_from_pluginfile(string $filearea, array $args) : ar
'filepath' => $filepath,
];
}
/**
* Callback to fetch the activity event type lang string.
*
* @param string $eventtype The event type.
* @return lang_string The event type lang string.
*/
function mod_assign_core_calendar_get_event_action_string(string $eventtype): string {
$modulename = get_string('modulename', 'assign');
switch ($eventtype) {
case ASSIGN_EVENT_TYPE_DUE:
$identifier = 'calendardue';
break;
case ASSIGN_EVENT_TYPE_GRADINGDUE:
$identifier = 'calendargradingdue';
break;
default:
return get_string('requiresaction', 'calendar', $modulename);
}
return get_string($identifier, 'assign', $modulename);
}

View File

@ -1348,3 +1348,26 @@ function mod_choice_get_completion_active_rule_descriptions($cm) {
}
return $descriptions;
}
/**
* Callback to fetch the activity event type lang string.
*
* @param string $eventtype The event type.
* @return lang_string The event type lang string.
*/
function mod_choice_core_calendar_get_event_action_string(string $eventtype): string {
$modulename = get_string('modulename', 'choice');
switch ($eventtype) {
case CHOICE_EVENT_TYPE_OPEN:
$identifier = 'calendarstart';
break;
case CHOICE_EVENT_TYPE_CLOSE:
$identifier = 'calendarend';
break;
default:
return get_string('requiresaction', 'calendar', $modulename);
}
return get_string($identifier, 'choice', $modulename);
}

View File

@ -4799,3 +4799,26 @@ function mod_data_core_calendar_event_timestart_updated(\calendar_event $event,
$event->trigger();
}
}
/**
* Callback to fetch the activity event type lang string.
*
* @param string $eventtype The event type.
* @return lang_string The event type lang string.
*/
function mod_data_core_calendar_get_event_action_string(string $eventtype): string {
$modulename = get_string('modulename', 'data');
switch ($eventtype) {
case DATA_EVENT_TYPE_OPEN:
$identifier = 'calendarstart';
break;
case DATA_EVENT_TYPE_CLOSE:
$identifier = 'calendarend';
break;
default:
return get_string('requiresaction', 'calendar', $modulename);
}
return get_string($identifier, 'data', $modulename);
}

View File

@ -3251,3 +3251,26 @@ function mod_feedback_core_calendar_event_timestart_updated(\calendar_event $eve
$event->trigger();
}
}
/**
* Callback to fetch the activity event type lang string.
*
* @param string $eventtype The event type.
* @return lang_string The event type lang string.
*/
function mod_feedback_core_calendar_get_event_action_string(string $eventtype): string {
$modulename = get_string('modulename', 'feedback');
switch ($eventtype) {
case FEEDBACK_EVENT_TYPE_OPEN:
$identifier = 'calendarstart';
break;
case FEEDBACK_EVENT_TYPE_CLOSE:
$identifier = 'calendarend';
break;
default:
return get_string('requiresaction', 'calendar', $modulename);
}
return get_string($identifier, 'feedback', $modulename);
}

View File

@ -7016,3 +7016,22 @@ function forum_grading_areas_list() {
'forum' => get_string('grade_forum_header', 'forum'),
];
}
/**
* Callback to fetch the activity event type lang string.
*
* @param string $eventtype The event type.
* @return lang_string The event type lang string.
*/
function mod_forum_core_calendar_get_event_action_string(string $eventtype): string {
global $CFG;
require_once($CFG->dirroot . '/mod/forum/locallib.php');
$modulename = get_string('modulename', 'forum');
if ($eventtype == FORUM_EVENT_TYPE_DUE) {
return get_string('calendardue', 'forum', $modulename);
} else {
return get_string('requiresaction', 'calendar', $modulename);
}
}

View File

@ -1739,3 +1739,26 @@ function mod_lesson_core_calendar_event_timestart_updated(\calendar_event $event
$event->trigger();
}
}
/**
* Callback to fetch the activity event type lang string.
*
* @param string $eventtype The event type.
* @return lang_string The event type lang string.
*/
function mod_lesson_core_calendar_get_event_action_string(string $eventtype): string {
$modulename = get_string('modulename', 'lesson');
switch ($eventtype) {
case LESSON_EVENT_TYPE_OPEN:
$identifier = 'lessoneventopens';
break;
case LESSON_EVENT_TYPE_CLOSE:
$identifier = 'lessoneventcloses';
break;
default:
return get_string('requiresaction', 'calendar', $modulename);
}
return get_string($identifier, 'lesson', $modulename);
}

View File

@ -2455,3 +2455,26 @@ function mod_quiz_output_fragment_add_random_question_form($args) {
return $form->render();
}
/**
* Callback to fetch the activity event type lang string.
*
* @param string $eventtype The event type.
* @return lang_string The event type lang string.
*/
function mod_quiz_core_calendar_get_event_action_string(string $eventtype): string {
$modulename = get_string('modulename', 'quiz');
switch ($eventtype) {
case QUIZ_EVENT_TYPE_OPEN:
$identifier = 'quizeventopens';
break;
case QUIZ_EVENT_TYPE_CLOSE:
$identifier = 'quizeventcloses';
break;
default:
return get_string('requiresaction', 'calendar', $modulename);
}
return get_string($identifier, 'quiz', $modulename);
}

View File

@ -1802,3 +1802,26 @@ function mod_scorm_get_path_from_pluginfile(string $filearea, array $args) : arr
'filepath' => $filepath,
];
}
/**
* Callback to fetch the activity event type lang string.
*
* @param string $eventtype The event type.
* @return lang_string The event type lang string.
*/
function mod_scorm_core_calendar_get_event_action_string(string $eventtype): string {
$modulename = get_string('modulename', 'scorm');
switch ($eventtype) {
case SCORM_EVENT_TYPE_OPEN:
$identifier = 'calendarstart';
break;
case SCORM_EVENT_TYPE_CLOSE:
$identifier = 'calendarend';
break;
default:
return get_string('requiresaction', 'calendar', $modulename);
}
return get_string($identifier, 'scorm', $modulename);
}

View File

@ -2253,3 +2253,32 @@ function workshop_get_coursemodule_info($coursemodule) {
return $result;
}
/**
* Callback to fetch the activity event type lang string.
*
* @param string $eventtype The event type.
* @return lang_string The event type lang string.
*/
function mod_workshop_core_calendar_get_event_action_string($eventtype): string {
$modulename = get_string('modulename', 'workshop');
switch ($eventtype) {
case WORKSHOP_EVENT_TYPE_SUBMISSION_OPEN:
$identifier = 'submissionstartevent';
break;
case WORKSHOP_EVENT_TYPE_SUBMISSION_CLOSE:
$identifier = 'submissionendevent';
break;
case WORKSHOP_EVENT_TYPE_ASSESSMENT_OPEN:
$identifier = 'assessmentstartevent';
break;
case WORKSHOP_EVENT_TYPE_ASSESSMENT_CLOSE;
$identifier = 'assessmentendevent';
break;
default:
return get_string('requiresaction', 'calendar', $modulename);
}
return get_string($identifier, 'workshop', $modulename);
}