mirror of
https://github.com/moodle/moodle.git
synced 2025-08-10 11:26:41 +02:00
Merge branch 'MDL-66810-master' of git://github.com/peterRd/moodle
This commit is contained in:
commit
fbf3ca0705
1 changed files with 28 additions and 2 deletions
|
@ -145,9 +145,35 @@ if (($launchcontainer == LTI_LAUNCH_CONTAINER_WINDOW) &&
|
||||||
$content = lti_initiate_login($cm->course, $id, $lti, $config);
|
$content = lti_initiate_login($cm->course, $id, $lti, $config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Build the allowed URL, since we know what it will be from $lti->toolurl,
|
||||||
|
// If the specified toolurl is invalid the iframe won't load, but we still want to avoid parse related errors here.
|
||||||
|
// So we set an empty default allowed url, and only build a real one if the parse is successful.
|
||||||
|
$ltiallow = '';
|
||||||
|
$urlparts = parse_url($lti->toolurl);
|
||||||
|
if ($urlparts && array_key_exists('scheme', $urlparts) && array_key_exists('host', $urlparts)) {
|
||||||
|
$ltiallow = $urlparts['scheme'] . '://' . $urlparts['host'];
|
||||||
|
// If a port has been specified we append that too.
|
||||||
|
if (array_key_exists('port', $urlparts)) {
|
||||||
|
$ltiallow .= ':' . $urlparts['port'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 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 .
|
$attributes = [];
|
||||||
"&triggerview=0\" webkitallowfullscreen mozallowfullscreen allowfullscreen>{$content}</iframe>";
|
$attributes['id'] = "contentframe";
|
||||||
|
$attributes['height'] = '600px';
|
||||||
|
$attributes['width'] = '100%';
|
||||||
|
$attributes['src'] = 'launch.php?id=' . $cm->id . '&triggerview=0';
|
||||||
|
$attributes['allow'] = "microphone $ltiallow; " .
|
||||||
|
"camera $ltiallow; " .
|
||||||
|
"geolocation $ltiallow; " .
|
||||||
|
"midi $ltiallow; " .
|
||||||
|
"encrypted-media $ltiallow; " .
|
||||||
|
"autoplay $ltiallow";
|
||||||
|
$attributes['allowfullscreen'] = 1;
|
||||||
|
$iframehtml = html_writer::tag('iframe', $content, $attributes);
|
||||||
|
echo $iframehtml;
|
||||||
|
|
||||||
|
|
||||||
// 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