if (!$endpoint) { echo "<p>Error, did not find a launch_url or secure_launch_url in the XML descriptor</p>\n"; exit; } $custom = $cx["custom"]; $parms = array_merge($custom, $lmsdata); } // Cleanup parms before we sign foreach ($parms as $k => $val) { if (strlen(trim($parms[$k])) < 1) { unset($parms[$k]); } } // Add oauth_callback to be compliant with the 1.0A spec $parms["oauth_callback"] = "about:blank"; $parms = signParameters($parms, $endpoint, "POST", $key, $secret, "Press to Launch", $tool_consumer_instance_guid, $tool_consumer_instance_description); $content = postLaunchHTML($parms, $endpoint, true, "width=\"100%\" height=\"900\" scrolling=\"auto\" frameborder=\"1\" transparency"); print $content; ?> <hr> <p> Note: Unpublished drafts of IMS Specifications are only available to IMS members and any software based on an unpublished draft is subject to change. Sample code is provided to help developers understand the specification more quickly. Simply interoperating with this sample implementation code does not allow one to claim compliance with a specification. <p> <a href=http://www.imsglobal.org/toolsinteroperability2.cfm>IMS Learning Tools Interoperability Working Group</a> <br/> <a href="http://www.imsglobal.org/ProductDirectory/directory.cfm">IMS Compliance Detail</a> <br/> <a href="http://www.imsglobal.org/community/forum/index.cfm?forumid=11">IMS Developer Community</a> <br/> <a href="http:///www.imsglobal.org/" class="footerlink">© 2009 IMS Global Learning Consortium, Inc.</a> under the Apache 2 License.</p>
} else { if ($_REQUEST['submit'] == "Delete Setting") { $message = 'basic-lti-deletesetting'; } else { exit; } } } if (!isset($_REQUEST['setting'])) { exit; } $url = 'http://localhost:8080/imsblis/service/'; $url = $_REQUEST['url']; $data = array('lti_message_type' => $message, 'id' => $_REQUEST['id'], 'setting' => $_REQUEST['setting']); $oauth_consumer_key = $_REQUEST['key']; $newdata = signParameters($data, $url, 'POST', $oauth_consumer_key, $oauth_consumer_secret); echo "<pre>\n"; echo "Posting to URL {$url} \n"; ksort($newdata); foreach ($newdata as $key => $value) { if (get_magic_quotes_gpc()) { $value = stripslashes($value); } print "{$key}={$value} (" . mb_detect_encoding($value) . ")\n"; } global $last_base_string; echo "\nBase String:\n</pre><p>\n"; echo $last_base_string; echo "\n</p>\n<pre>\n"; $retval = do_post_request($url, http_build_query($newdata)); $retval = str_replace("<", "<", $retval);
private function _LTIrequest($endpoint) { $parms = signParameters($this->_Launch_Data, $endpoint, "POST", $this->_LTI_Resource['key'], $this->_LTI_Resource['secret'], "Press to Launch", $this->_Launch_Data['tool_consumer_instance_guid'], $this->_Launch_Data['tool_consumer_instance_desc']); $result = $this->_curlFormAutoSubmit($endpoint, $parms); if (!strstr($result, 'AContent_LiveContentLink')) { $result = $this->_LTIrequest($endpoint); } return $result; }
$oauth_consumer_key = isset($_REQUEST['key']) ? $_REQUEST['key'] : $_SESSION['reg_key']; $oauth_consumer_secret = isset($_REQUEST['secret']) ? $_REQUEST['secret'] : $_SESSION['reg_password']; $grade = isset($_REQUEST['grade']) ? $_REQUEST['grade'] : ''; $comment = isset($_REQUEST['comment']) ? $_REQUEST['comment'] : ''; if (strlen($oauth_consumer_secret) < 1 || strlen($oauth_consumer_key) < 1 || strlen($result_url) < 1) { var_dump($_SESSION); die("Must have url, reg_password and reg_key in sesison or as GET parameters"); } if (isset($_REQUEST['send'])) { $parms = array(); $parms["lti_message_type"] = "ContentItemSelection"; $parms["lti_version"] = "LTI-1p0"; $parms["data"] = "Yo Yo"; $retval = json_encode(getContentJSON($content_url)); $parms["content_items"] = $retval; $parms = signParameters($parms, $result_url, "POST", $oauth_consumer_key, $oauth_consumer_secret, "Finish Content Return"); $content = postLaunchHTML($parms, $result_url, true); echo $content; return; } ?> <html> <head> <title>IMS Content Item Service</title> <?php echo ltiUtilToggleHead(); ?> </head> <body style="font-family:sans-serif; background-color:#add8e6"> <p><b>Calling IMS LTI Content Item Service</b></p> <?php
} echo "<fieldset id=\"lmsDataForm\"><legend>LTI I</legend>\n"; $disabled = ''; echo "Launch URL: <input size=\"60\" type=\"text\" {$disabled} size=\"60\" name=\"endpoint\" value=\"{$endpoint}\">\n"; echo "</fieldset><p>"; echo "<fieldset><legend>Launch Data</legend>\n"; foreach ($lmsdata as $k => $val) { echo $k . ": <input type=\"text\" name=\"" . $k . "\" value=\""; echo htmlspecialchars($val); echo "\"><br/>\n"; } echo "</fieldset>\n"; echo "</form>\n"; echo "</div>\n"; echo "<hr>"; $parms = $lmsdata; // Cleanup parms before we sign foreach ($parms as $k => $val) { if (strlen(trim($parms[$k])) < 1) { unset($parms[$k]); } } // Add oauth_callback to be compliant with the 1.0A spec $parms["oauth_callback"] = "about:blank"; // $parms['launch_presentation_css_url'] = $cssurl; if (isset($_POST['launch']) || isset($_POST['debug'])) { $parms = signParameters($parms, $endpoint, "POST", $key, $secret, "Finish Launch", "", ""); $content = postLaunchHTML($parms, $endpoint, isset($_POST['debug']), "_blank"); // "width=\"100%\" height=\"900\" scrolling=\"auto\" frameborder=\"1\" transparency"); print $content; }
} else { $parms['launch_presentation_locale'] = 'en-US'; } if ($_GET['target'] == 'new') { $parms['launch_presentation_document_target'] = 'window'; } else { $parms['launch_presentation_document_target'] = 'iframe'; $parms['launch_presentation_height'] = '500'; $parms['launch_presentation_width'] = '600'; } $parms['launch_presentation_return_url'] = $urlmode . $_SERVER['HTTP_HOST'] . $imasroot . '/course/course.php?cid=' . $cid; if (isset($CFG['GEN']['LTIorgid'])) { $org_id = $CFG['GEN']['LTIorgid']; } else { $org_id = $_SERVER['HTTP_HOST']; } $org_desc = $installname; if ($toolcustomurl != '') { $line['url'] = $toolcustomurl; } if ($line['url'] == '') { echo '<html><body>This tool does not have a default launch URL. Custom launch URL is required.</body></html>'; exit; } try { $parms = signParameters($parms, $line['url'], "POST", $line['ltikey'], $line['secret'], null, $org_id, $org_desc); $content = postLaunchHTML($parms, $line['url'], isset($parms['custom_debug'])); print $content; } catch (Exception $e) { echo $e->getMessage(); }
$endpoint = $_SESSION['endpoint']; if (isset($parms['lis_outcome_service_url'])) { $serviceurl = curPageURL(); $serviceurl = str_replace("toolcert.php", "tool_consumer_outcome.php", $serviceurl); $serviceurl .= "?b64=" . htmlentities($b64); $parms['lis_outcome_service_url'] = $serviceurl; $sourcedid = $parms['context_id'] . ':::' . $parms['resource_link_id'] . ':::' . $parms['user_id']; $parms['lis_result_sourcedid'] = $sourcedid; } $dodebug = false; if (isset($_GET['debug'])) { $dodebug = true; } $org_id = "IMS Testing"; $org_desc = "IMS Testing Description"; $parms = signParameters($parms, $endpoint, "POST", $key, $secret, $org_secret, $org_id, $org_desc); $content = postLaunchHTML($parms, $endpoint, $dodebug); print $content; exit; } include "header.php"; load_cert_data(); echo "<center>\n"; if (isset($_SESSION['cert_consumer_key'])) { echo '<p>LTI 1.1 Certification: ' . $_SESSION['software'] . ' (' . $_SESSION['version'] . ') '; echo 'KEY=' . $_SESSION['cert_consumer_key']; echo ' <a href="toolsetup.php">Setup</a>' . "\n"; if (isset($b64)) { echo ' <a href="toolgradebook.php?b64=' . htmlentities($b64) . '" target="_new">View Gradebook</a>' . "\n"; } }