Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updating launch container for mobile devices

  • Loading branch information...
commit cca9d3f76947d669c31fc356d25e6d2397f11563 1 parent f4f711d
@scriby scriby authored
Showing with 13 additions and 1 deletion.
  1. +1 −0  mod/lti/locallib.php
  2. +12 −1 mod/lti/view.php
View
1  mod/lti/locallib.php
@@ -57,6 +57,7 @@
define('LTI_LAUNCH_CONTAINER_EMBED', 2);
define('LTI_LAUNCH_CONTAINER_EMBED_NO_BLOCKS', 3);
define('LTI_LAUNCH_CONTAINER_WINDOW', 4);
+define('LTI_LAUNCH_CONTAINER_REPLACE_MOODLE_WINDOW', 5);
define('LTI_TOOL_STATE_ANY', 0);
define('LTI_TOOL_STATE_CONFIGURED', 1);
View
13 mod/lti/view.php
@@ -95,9 +95,20 @@
$toolconfig['launchcontainer'] :
$basiclti->launchcontainer;
+$devicetype = get_device_type();
+
+//Scrolling within the object element doesn't work on iOS or Android
+//Opening the popup window also had some issues in testing
+//For mobile devices, always take up the entire screen to ensure the best experience
+if($devicetype === 'mobile' || $devicetype === 'tablet' ){
+ $launchcontainer = LTI_LAUNCH_CONTAINER_REPLACE_MOODLE_WINDOW;
+}
+
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);
} else {
$PAGE->set_pagelayout('incourse');
}
@@ -130,7 +141,7 @@
echo "<p>".get_string("basiclti_in_new_window", "lti")."</p>\n";
} else {
// Request the launch content with an object tag
- echo '<object id="contentframe" height="600px" width="100%" type="text/html" data="launch.php?id='.$cm->id.'&amp;withobject=true"></object>';
+ echo '<object id="contentframe" height="600px" width="100%" type="text/html" data="launch.php?id='.$cm->id.'"></object>';
//Output script to make the object tag be as large as possible
$resize = <<<'SCRIPT'
Please sign in to comment.
Something went wrong with that request. Please try again.