mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-46710 mod_lti: fix logging and completion tracking in new windows
This commit is contained in:
parent
fd57d685c7
commit
86b314c7b0
@ -61,6 +61,20 @@ $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();
|
||||
|
||||
$lti->cmid = $cm->id;
|
||||
lti_view($lti);
|
||||
|
||||
|
@ -102,11 +102,15 @@ $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();
|
||||
|
||||
// Prevent double logging when launching in a new window is configured.
|
||||
if ($launchcontainer != LTI_LAUNCH_CONTAINER_WINDOW) {
|
||||
$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();
|
||||
}
|
||||
|
||||
$pagetitle = strip_tags($course->shortname.': '.format_string($lti->name));
|
||||
$PAGE->set_title($pagetitle);
|
||||
|
Loading…
x
Reference in New Issue
Block a user