mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Merge branch 'MDL-59668_master' of git://github.com/markn86/moodle
This commit is contained in:
commit
68c406ffdd
2 changed files with 19 additions and 8 deletions
|
@ -51,6 +51,7 @@ require_once($CFG->dirroot.'/mod/lti/lib.php');
|
||||||
require_once($CFG->dirroot.'/mod/lti/locallib.php');
|
require_once($CFG->dirroot.'/mod/lti/locallib.php');
|
||||||
|
|
||||||
$id = required_param('id', PARAM_INT); // Course Module ID.
|
$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);
|
$cm = get_coursemodule_from_id('lti', $id, 0, false, MUST_EXIST);
|
||||||
$lti = $DB->get_record('lti', array('id' => $cm->instance), '*', 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);
|
require_capability('mod/lti:view', $context);
|
||||||
|
|
||||||
// Completion and trigger events.
|
// Completion and trigger events.
|
||||||
lti_view($lti, $course, $cm, $context);
|
if ($triggerview) {
|
||||||
|
lti_view($lti, $course, $cm, $context);
|
||||||
|
}
|
||||||
|
|
||||||
$lti->cmid = $cm->id;
|
$lti->cmid = $cm->id;
|
||||||
lti_launch_tool($lti);
|
lti_launch_tool($lti);
|
||||||
|
|
|
@ -53,6 +53,7 @@ require_once($CFG->dirroot.'/mod/lti/locallib.php');
|
||||||
|
|
||||||
$id = optional_param('id', 0, PARAM_INT); // Course Module ID, or
|
$id = optional_param('id', 0, PARAM_INT); // Course Module ID, or
|
||||||
$l = optional_param('l', 0, PARAM_INT); // lti ID.
|
$l = optional_param('l', 0, PARAM_INT); // lti ID.
|
||||||
|
$forceview = optional_param('forceview', 0, PARAM_BOOL);
|
||||||
|
|
||||||
if ($l) { // Two ways to specify the module.
|
if ($l) { // Two ways to specify the module.
|
||||||
$lti = $DB->get_record('lti', array('id' => $l), '*', MUST_EXIST);
|
$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->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.
|
$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) {
|
} 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 {
|
} else {
|
||||||
$PAGE->set_pagelayout('incourse');
|
$PAGE->set_pagelayout('incourse');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lti_view($lti, $course, $cm, $context);
|
||||||
|
|
||||||
$pagetitle = strip_tags($course->shortname.': '.format_string($lti->name));
|
$pagetitle = strip_tags($course->shortname.': '.format_string($lti->name));
|
||||||
$PAGE->set_title($pagetitle);
|
$PAGE->set_title($pagetitle);
|
||||||
$PAGE->set_heading($course->fullname);
|
$PAGE->set_heading($course->fullname);
|
||||||
|
@ -111,18 +117,20 @@ if ($lti->showdescriptionlaunch && $lti->intro) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $launchcontainer == LTI_LAUNCH_CONTAINER_WINDOW ) {
|
if ( $launchcontainer == LTI_LAUNCH_CONTAINER_WINDOW ) {
|
||||||
echo "<script language=\"javascript\">//<![CDATA[\n";
|
if (!$forceview) {
|
||||||
echo "window.open('launch.php?id=".$cm->id."','lti-".$cm->id."');";
|
echo "<script language=\"javascript\">//<![CDATA[\n";
|
||||||
echo "//]]\n";
|
echo "window.open('launch.php?id=" . $cm->id . "&triggerview=0','lti-" . $cm->id . "');";
|
||||||
echo "</script>\n";
|
echo "//]]\n";
|
||||||
echo "<p>".get_string("basiclti_in_new_window", "lti")."</p>\n";
|
echo "</script>\n";
|
||||||
|
echo "<p>".get_string("basiclti_in_new_window", "lti")."</p>\n";
|
||||||
|
}
|
||||||
$url = new moodle_url('/mod/lti/launch.php', array('id' => $cm->id));
|
$url = new moodle_url('/mod/lti/launch.php', array('id' => $cm->id));
|
||||||
echo html_writer::start_tag('p');
|
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::link($url, get_string("basiclti_in_new_window_open", "lti"), array('target' => '_blank'));
|
||||||
echo html_writer::end_tag('p');
|
echo html_writer::end_tag('p');
|
||||||
} else {
|
} else {
|
||||||
// Request the launch content with an iframe tag.
|
// 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.
|
// Output script to make the iframe tag be as large as possible.
|
||||||
$resize = '
|
$resize = '
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue