diff --git a/mod/lti/launch.php b/mod/lti/launch.php index 56f25af8d2a..ca27416fab0 100644 --- a/mod/lti/launch.php +++ b/mod/lti/launch.php @@ -51,6 +51,7 @@ require_once($CFG->dirroot.'/mod/lti/lib.php'); 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); @@ -62,7 +63,9 @@ require_login($course, true, $cm); 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); diff --git a/mod/lti/view.php b/mod/lti/view.php index cc0c255551c..224b219c6bf 100644 --- a/mod/lti/view.php +++ b/mod/lti/view.php @@ -53,6 +53,7 @@ require_once($CFG->dirroot.'/mod/lti/locallib.php'); $id = optional_param('id', 0, PARAM_INT); // Course Module ID, or $l = optional_param('l', 0, PARAM_INT); // lti ID. +$forceview = optional_param('forceview', 0, PARAM_BOOL); if ($l) { // Two ways to specify the module. $lti = $DB->get_record('lti', array('id' => $l), '*', MUST_EXIST); @@ -89,11 +90,16 @@ if ($launchcontainer == LTI_LAUNCH_CONTAINER_EMBED_NO_BLOCKS) { $PAGE->set_pagelayout('frametop'); // Most frametops don't include footer, and pre-post blocks. $PAGE->blocks->show_only_fake_blocks(); // Disable blocks for layouts which do include pre-post blocks. } else if ($launchcontainer == LTI_LAUNCH_CONTAINER_REPLACE_MOODLE_WINDOW) { - redirect('launch.php?id=' . $cm->id); + if (!$forceview) { + $url = new moodle_url('/mod/lti/launch.php', array('id' => $cm->id)); + redirect($url); + } } else { $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); @@ -111,18 +117,20 @@ if ($lti->showdescriptionlaunch && $lti->intro) { } if ( $launchcontainer == LTI_LAUNCH_CONTAINER_WINDOW ) { - echo "\n"; - echo "

".get_string("basiclti_in_new_window", "lti")."

\n"; + if (!$forceview) { + echo "\n"; + echo "

".get_string("basiclti_in_new_window", "lti")."

\n"; + } $url = new moodle_url('/mod/lti/launch.php', array('id' => $cm->id)); echo html_writer::start_tag('p'); echo html_writer::link($url, get_string("basiclti_in_new_window_open", "lti"), array('target' => '_blank')); echo html_writer::end_tag('p'); } else { // Request the launch content with an iframe tag. - echo ''; + echo ''; // Output script to make the iframe tag be as large as possible. $resize = '