diff --git a/blocks/timeline/templates/event-list-item.mustache b/blocks/timeline/templates/event-list-item.mustache
index 1f83c0d24c7..b824dafdf63 100644
--- a/blocks/timeline/templates/event-list-item.mustache
+++ b/blocks/timeline/templates/event-list-item.mustache
@@ -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 @@
{{#action.actionable}}
diff --git a/blocks/timeline/tests/behat/block_timeline_courses.feature b/blocks/timeline/tests/behat/block_timeline_courses.feature
index bde9ef6bbcf..dcc924bae6e 100644
--- a/blocks/timeline/tests/behat/block_timeline_courses.feature
+++ b/blocks/timeline/tests/behat/block_timeline_courses.feature
@@ -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"
diff --git a/blocks/timeline/tests/behat/block_timeline_dates.feature b/blocks/timeline/tests/behat/block_timeline_dates.feature
index 3e7810f66e9..a0acb890cea 100644
--- a/blocks/timeline/tests/behat/block_timeline_dates.feature
+++ b/blocks/timeline/tests/behat/block_timeline_dates.feature
@@ -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"
diff --git a/calendar/classes/external/event_exporter_base.php b/calendar/classes/external/event_exporter_base.php
index 21074140642..7f761193539 100644
--- a/calendar/classes/external/event_exporter_base.php
+++ b/calendar/classes/external/event_exporter_base.php
@@ -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,
diff --git a/lang/en/calendar.php b/lang/en/calendar.php
index 73a16904de9..d4a970880de 100644
--- a/lang/en/calendar.php
+++ b/lang/en/calendar.php
@@ -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';
diff --git a/mod/assign/lib.php b/mod/assign/lib.php
index bc26ae44083..79d3ba9ab56 100644
--- a/mod/assign/lib.php
+++ b/mod/assign/lib.php
@@ -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);
+}
diff --git a/mod/choice/lib.php b/mod/choice/lib.php
index 9242511ab2b..bd8031a549c 100644
--- a/mod/choice/lib.php
+++ b/mod/choice/lib.php
@@ -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);
+}
diff --git a/mod/data/lib.php b/mod/data/lib.php
index 7b6014427bd..d2fb5a7d2f4 100644
--- a/mod/data/lib.php
+++ b/mod/data/lib.php
@@ -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);
+}
diff --git a/mod/feedback/lib.php b/mod/feedback/lib.php
index 417bb1d7cc5..681dfa6fbcd 100644
--- a/mod/feedback/lib.php
+++ b/mod/feedback/lib.php
@@ -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);
+}
diff --git a/mod/forum/lib.php b/mod/forum/lib.php
index aaa8dc1acf0..3348ac8efa1 100644
--- a/mod/forum/lib.php
+++ b/mod/forum/lib.php
@@ -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);
+ }
+}
diff --git a/mod/lesson/lib.php b/mod/lesson/lib.php
index 6063ea2638d..64a745a7118 100644
--- a/mod/lesson/lib.php
+++ b/mod/lesson/lib.php
@@ -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);
+}
diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php
index c0209589272..6d1445ad262 100644
--- a/mod/quiz/lib.php
+++ b/mod/quiz/lib.php
@@ -2451,3 +2451,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);
+}
diff --git a/mod/scorm/lib.php b/mod/scorm/lib.php
index 8b5a8f01645..4cd969e5f68 100644
--- a/mod/scorm/lib.php
+++ b/mod/scorm/lib.php
@@ -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);
+}
diff --git a/mod/workshop/lib.php b/mod/workshop/lib.php
index 41fbb0efc0f..4bfa6ea2d77 100644
--- a/mod/workshop/lib.php
+++ b/mod/workshop/lib.php
@@ -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);
+}