Skip to content

Commit

Permalink
MDL-59668 mod_lti: trigger completion event in view.php
Browse files Browse the repository at this point in the history
This was done so that the navigation links are rendered
correctly with accurate completion info.

Part of MDL-59313.
  • Loading branch information
mdjnelson committed Aug 3, 2017
1 parent 9bed446 commit c54af7f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion mod/lti/launch.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
require_once($CFG->dirroot.'/mod/lti/locallib.php');

$id = required_param('id', PARAM_INT); // Course Module ID.
$triggerview = optional_param('triggerview', 1, PARAM_BOOL);

$cm = get_coursemodule_from_id('lti', $id, 0, false, MUST_EXIST);
$lti = $DB->get_record('lti', array('id' => $cm->instance), '*', MUST_EXIST);
Expand All @@ -62,7 +63,9 @@
require_capability('mod/lti:view', $context);

// Completion and trigger events.
lti_view($lti, $course, $cm, $context);
if ($triggerview) {
lti_view($lti, $course, $cm, $context);
}

$lti->cmid = $cm->id;
lti_launch_tool($lti);
Expand Down
6 changes: 4 additions & 2 deletions mod/lti/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@
$PAGE->set_pagelayout('incourse');
}

lti_view($lti, $course, $cm, $context);

$pagetitle = strip_tags($course->shortname.': '.format_string($lti->name));
$PAGE->set_title($pagetitle);
$PAGE->set_heading($course->fullname);
Expand All @@ -112,7 +114,7 @@

if ( $launchcontainer == LTI_LAUNCH_CONTAINER_WINDOW ) {
echo "<script language=\"javascript\">//<![CDATA[\n";
echo "window.open('launch.php?id=".$cm->id."','lti-".$cm->id."');";
echo "window.open('launch.php?id=".$cm->id."&triggerview=0','lti-".$cm->id."');";
echo "//]]\n";
echo "</script>\n";
echo "<p>".get_string("basiclti_in_new_window", "lti")."</p>\n";
Expand All @@ -122,7 +124,7 @@
echo html_writer::end_tag('p');
} else {
// Request the launch content with an iframe tag.
echo '<iframe id="contentframe" height="600px" width="100%" src="launch.php?id='.$cm->id.'"></iframe>';
echo '<iframe id="contentframe" height="600px" width="100%" src="launch.php?id='.$cm->id.'&triggerview=0"></iframe>';

// Output script to make the iframe tag be as large as possible.
$resize = '
Expand Down

0 comments on commit c54af7f

Please sign in to comment.