MDL-51624 mod_lti: New Web Service mod_lti_view_lti
[moodle.git] / mod / lti / launch.php
index d06cb13..56f25af 100644 (file)
@@ -61,19 +61,8 @@ $context = context_module::instance($cm->id);
 require_login($course, true, $cm);
 require_capability('mod/lti:view', $context);
 
-// Mark viewed by user (if required).
-$completion = new completion_info($course);
-$completion->set_module_viewed($cm);
-
-$params = array(
-    'context' => $context,
-    'objectid' => $lti->id
-);
-$event = \mod_lti\event\course_module_viewed::create($params);
-$event->add_record_snapshot('course_modules', $cm);
-$event->add_record_snapshot('course', $course);
-$event->add_record_snapshot('lti', $lti);
-$event->trigger();
+// Completion and trigger events.
+lti_view($lti, $course, $cm, $context);
 
 $lti->cmid = $cm->id;
 lti_launch_tool($lti);