@@ -165,6 +165,22 @@ abstract public function get_settings(cm_info $cm);
165165 */
166166 abstract public function validate_dates (cm_info $ cm , array $ dates );
167167
168+ /**
169+ * Save the new dates for this course_module instance.
170+ *
171+ * Having this method final gives us a possibilities to
172+ * add any logic (e.g. triggering events) before or after saving dates for any activity.
173+ *
174+ * @param \cm_info $cm the activity to save the dates for.
175+ * @param array $dates a list of new dates.
176+ *
177+ * @throws \coding_exception
178+ */
179+ final public function save_new_dates (cm_info $ cm , array $ dates ) {
180+ $ this ->save_dates ($ cm , $ dates );
181+ \core \event \course_module_updated::create_from_cm ($ cm )->trigger ();
182+ }
183+
168184 /**
169185 * Save the new dates for this course_module instance.
170186 * @param cm_info $cm the activity to save the dates for.
@@ -281,9 +297,23 @@ abstract public function get_settings(block_base $block);
281297 */
282298 abstract public function validate_dates (block_base $ block , array $ dates );
283299
300+ /**
301+ * Save the new dates for this block instance.
302+ *
303+ * Having this method final gives us a possibilities to
304+ * add any logic (e.g. triggering events) before or after saving dates for any block.
305+ *
306+ * @param \block_base $block the block to save the dates for.
307+ * @param array $dates a list of new dates.
308+ */
309+ final public function save_new_dates (block_base $ block , array $ dates ) {
310+ $ this ->save_dates ($ block , $ dates );
311+ }
312+
284313 /**
285314 * Save the new dates for this course_module instance.
286- * @param cm_info $cm the activity to save the dates for.
315+ * @param \block_base $block the block to save the dates for.
316+ * @param array $dates a list of new dates.
287317 */
288318 public function save_dates (block_base $ block , array $ dates ) {
289319 global $ DB ;
@@ -435,7 +465,7 @@ function report_editdates_update_dates_by_section($courseid, array $sectionnums,
435465
436466 $ modinstance = report_editdates_mod_data_date_extractor::make ($ cm ->modname , $ course );
437467 if ($ modinstance ) {
438- $ modinstance ->save_dates ($ cm , $ datesettings );
468+ $ modinstance ->save_new_dates ($ cm , $ datesettings );
439469 }
440470 }
441471 $ transaction ->allow_commit ();
0 commit comments