MDL-40054 mod_lesson: replaced 'end' add_to_log call with an event

This commit is contained in:
Mark Nelson 2013-10-17 18:48:16 +08:00
parent 9c192d812b
commit 00c027c7e3
5 changed files with 118 additions and 3 deletions

View file

@ -1255,6 +1255,18 @@ class lesson extends lesson_base {
public function stop_timer() {
global $USER, $DB;
unset($USER->startlesson[$this->properties->id]);
$cm = get_coursemodule_from_instance('lesson', $this->properties()->id, $this->properties()->course,
false, MUST_EXIST);
// Trigger lesson ended event.
$event = \mod_lesson\event\lesson_ended::create(array(
'objectid' => $this->properties()->id,
'context' => context_module::instance($cm->id),
'courseid' => $this->properties()->course
));
$event->trigger();
return $this->update_timer(false, false);
}