+
@@ -143,7 +158,7 @@ if ($ADMIN->fulltree) {
-
-";
- $settings->add(new admin_setting_heading('lti_types', new lang_string('external_tool_types', 'lti') . $OUTPUT->help_icon('main_admin', 'lti'), $template));
+EOD;
+ $settings->add(new admin_setting_heading('lti_types', new lang_string('external_tool_types', 'lti') .
+ $OUTPUT->help_icon('main_admin', 'lti'), $template));
}
-if (count($modltifolder->children) <= 1) {
- // No need for a folder, revert to default activity settings page.
- $ADMIN->prune('modltifolder');
-} else {
- // Using the folder, update settings name.
- $settings->visiblename = new lang_string('ltisettings', 'mod_lti');
+// Tell core we already added the settings structure.
+$settings = null;
- // Tell core we already added the settings structure.
- $settings = null;
-}
diff --git a/mod/lti/tests/event/unknown_service_api_called_test.php b/mod/lti/tests/event/unknown_service_api_called_test.php
index 86359cbb4d1..0198d2d8fd5 100644
--- a/mod/lti/tests/event/unknown_service_api_called_test.php
+++ b/mod/lti/tests/event/unknown_service_api_called_test.php
@@ -34,7 +34,7 @@ use mod_lti\event\unknown_service_api_called;
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mod_lti_event_unknown_service_api_called_test extends advanced_testcase {
- /**
+ /*
* Ensure create event works.
*/
public function test_create_event() {
@@ -42,7 +42,7 @@ class mod_lti_event_unknown_service_api_called_test extends advanced_testcase {
$this->assertInstanceOf('\mod_lti\event\unknown_service_api_called', $event);
}
- /**
+ /*
* Ensure event context works.
*/
public function test_event_context() {
@@ -50,7 +50,7 @@ class mod_lti_event_unknown_service_api_called_test extends advanced_testcase {
$this->assertEquals(context_system::instance(), $event->get_context());
}
- /**
+ /*
* Ensure we can trigger the event.
*/
public function test_trigger_event() {
@@ -62,7 +62,7 @@ class mod_lti_event_unknown_service_api_called_test extends advanced_testcase {
$this->assertCount(1, $events);
}
- /**
+ /*
* Ensure get/set message data is functioning as expected.
*/
public function test_get_message_data() {
@@ -71,9 +71,11 @@ class mod_lti_event_unknown_service_api_called_test extends advanced_testcase {
'bat' => 'baz',
);
- /** @var unknown_service_api_called $event */
+ /*
+ * @var unknown_service_api_called $event
+ */
$event = unknown_service_api_called::create();
$event->set_message_data($data);
$this->assertSame($data, $event->get_message_data());
}
-}
\ No newline at end of file
+}
diff --git a/mod/lti/tests/generator_test.php b/mod/lti/tests/generator_test.php
index 8a2bbcfe889..d43af297284 100644
--- a/mod/lti/tests/generator_test.php
+++ b/mod/lti/tests/generator_test.php
@@ -45,7 +45,9 @@ class mod_lti_generator_testcase extends advanced_testcase {
$course = $this->getDataGenerator()->create_course();
- /** @var mod_lti_generator $generator */
+ /*
+ * @var mod_lti_generator $generator
+ */
$generator = $this->getDataGenerator()->get_plugin_generator('mod_lti');
$this->assertInstanceOf('mod_lti_generator', $generator);
$this->assertEquals('lti', $generator->get_modulename());
@@ -63,9 +65,10 @@ class mod_lti_generator_testcase extends advanced_testcase {
$context = context_module::instance($cm->id);
$this->assertEquals($lti->cmid, $context->instanceid);
- // test gradebook integration using low level DB access - DO NOT USE IN PLUGIN CODE!
+ // Test gradebook integration using low level DB access - DO NOT USE IN PLUGIN CODE!
$lti = $generator->create_instance(array('course' => $course->id, 'assessed' => 1, 'scale' => 100));
- $gitem = $DB->get_record('grade_items', array('courseid' => $course->id, 'itemtype' => 'mod', 'itemmodule' => 'lti', 'iteminstance' => $lti->id));
+ $gitem = $DB->get_record('grade_items', array('courseid' => $course->id, 'itemtype' => 'mod',
+ 'itemmodule' => 'lti', 'iteminstance' => $lti->id));
$this->assertNotEmpty($gitem);
$this->assertEquals(100, $gitem->grademax);
$this->assertEquals(0, $gitem->grademin);
diff --git a/mod/lti/tests/locallib_test.php b/mod/lti/tests/locallib_test.php
index 2875f59a7ab..18e939c4071 100644
--- a/mod/lti/tests/locallib_test.php
+++ b/mod/lti/tests/locallib_test.php
@@ -30,7 +30,7 @@
//
// BasicLTI4Moodle is copyright 2009 by Marc Alier Forment, Jordi Piguillem and Nikolas Galanis
// of the Universitat Politecnica de Catalunya http://www.upc.edu
-// Contact info: Marc Alier Forment granludo @ gmail.com or marc.alier @ upc.edu
+// Contact info: Marc Alier Forment granludo @ gmail.com or marc.alier @ upc.edu.
/**
* This file contains unit tests for (some of) lti/locallib.php
@@ -63,17 +63,19 @@ require_once($CFG->dirroot . '/mod/lti/servicelib.php');
class mod_lti_locallib_testcase extends advanced_testcase {
public function test_split_custom_parameters() {
- $this->assertEquals(lti_split_custom_parameters("x=1\ny=2"),
- array('custom_x' => '1', 'custom_y'=> '2'));
+ $tool = new stdClass();
+ $tool->enabledcapability = '';
+ $this->assertEquals(lti_split_custom_parameters(null, $tool, array(), "x=1\ny=2", false),
+ array('custom_x' => '1', 'custom_y' => '2'));
- $this->assertEquals(lti_split_custom_parameters('x=1;y=2'),
- array('custom_x' => '1', 'custom_y'=> '2'));
+ // Removed repeat of previous test with a semicolon separator.
- $this->assertEquals(lti_split_custom_parameters('Review:Chapter=1.2.56'),
+ $this->assertEquals(lti_split_custom_parameters(null, $tool, array(), 'Review:Chapter=1.2.56', false),
array('custom_review_chapter' => '1.2.56'));
- $this->assertEquals(lti_split_custom_parameters('Complex!@#$^*(){}[]KEY=Complex!@#$^*(){}[]Value'),
- array('custom_complex____________key' => 'Complex!@#$^*(){}[]Value'));
+ $this->assertEquals(lti_split_custom_parameters(null, $tool, array(),
+ 'Complex!@#$^*(){}[]KEY=Complex!@#$^*;(){}[]½Value', false),
+ array('custom_complex____________key' => 'Complex!@#$^*;(){}[]½Value'));
}
/**
@@ -83,9 +85,16 @@ class mod_lti_locallib_testcase extends advanced_testcase {
* outside-checks to the conformance tests. MDL-30347
*/
public function disabled_test_sign_parameters() {
- $correct = array ( 'context_id' => '12345', 'context_label' => 'SI124', 'context_title' => 'Social Computing', 'ext_submit' => 'Click Me', 'lti_message_type' => 'basic-lti-launch-request', 'lti_version' => 'LTI-1p0', 'oauth_consumer_key' => 'lmsng.school.edu', 'oauth_nonce' => '47458148e33a8f9dafb888c3684cf476', 'oauth_signature' => 'qWgaBIezihCbeHgcwUy14tZcyDQ=', 'oauth_signature_method' => 'HMAC-SHA1', 'oauth_timestamp' => '1307141660', 'oauth_version' => '1.0', 'resource_link_id' => '123', 'resource_link_title' => 'Weekly Blog', 'roles' => 'Learner', 'tool_consumer_instance_guid' => 'lmsng.school.edu', 'user_id' => '789');
+ $correct = array ( 'context_id' => '12345', 'context_label' => 'SI124', 'context_title' => 'Social Computing',
+ 'ext_submit' => 'Click Me', 'lti_message_type' => 'basic-lti-launch-request', 'lti_version' => 'LTI-1p0',
+ 'oauth_consumer_key' => 'lmsng.school.edu', 'oauth_nonce' => '47458148e33a8f9dafb888c3684cf476',
+ 'oauth_signature' => 'qWgaBIezihCbeHgcwUy14tZcyDQ=', 'oauth_signature_method' => 'HMAC-SHA1',
+ 'oauth_timestamp' => '1307141660', 'oauth_version' => '1.0', 'resource_link_id' => '123',
+ 'resource_link_title' => 'Weekly Blog', 'roles' => 'Learner', 'tool_consumer_instance_guid' => 'lmsng.school.edu',
+ 'user_id' => '789');
- $requestparams = array('resource_link_id' => '123', 'resource_link_title' => 'Weekly Blog', 'user_id' => '789', 'roles' => 'Learner', 'context_id' => '12345', 'context_label' => 'SI124', 'context_title' => 'Social Computing');
+ $requestparams = array('resource_link_id' => '123', 'resource_link_title' => 'Weekly Blog', 'user_id' => '789',
+ 'roles' => 'Learner', 'context_id' => '12345', 'context_label' => 'SI124', 'context_title' => 'Social Computing');
$parms = lti_sign_parameters($requestparams, 'http://www.imsglobal.org/developer/LTI/tool.php', 'POST',
'lmsng.school.edu', 'secret', 'Click Me', 'lmsng.school.edu' /*, $org_desc*/);
@@ -93,7 +102,7 @@ class mod_lti_locallib_testcase extends advanced_testcase {
$this->assertTrue(isset($parms['oauth_signature']));
$this->assertTrue(isset($parms['oauth_timestamp']));
- // Those things that are hard to mock
+ // Those things that are hard to mock.
$correct['oauth_nonce'] = $parms['oauth_nonce'];
$correct['oauth_signature'] = $parms['oauth_signature'];
$correct['oauth_timestamp'] = $parms['oauth_timestamp'];
@@ -121,7 +130,10 @@ class mod_lti_locallib_testcase extends advanced_testcase {
- {"data":{"instanceid":"2","userid":"2"},"hash":"0b5078feab59b9938c333ceaae21d8e003a7b295e43cdf55338445254421076b"}
+ ' .
+ '{"data":{"instanceid":"2","userid":"2"},"hash":' .
+ '"0b5078feab59b9938c333ceaae21d8e003a7b295e43cdf55338445254421076b"}' .
+ '
diff --git a/mod/lti/tests/upgradelib_test.php b/mod/lti/tests/upgradelib_test.php
new file mode 100644
index 00000000000..87accdda27c
--- /dev/null
+++ b/mod/lti/tests/upgradelib_test.php
@@ -0,0 +1,90 @@
+.
+
+/**
+ * LTI upgrade script.
+ *
+ * @package mod_lti
+ * @copyright 2014 Vital Source Technologies http://vitalsource.com
+ * @author Stephen Vickers
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+
+defined('MOODLE_INTERNAL') || die();
+
+global $CFG;
+require_once($CFG->dirroot . '/mod/lti/locallib.php');
+require_once($CFG->dirroot . '/mod/lti/db/upgradelib.php');
+
+
+/**
+ * Unit tests for mod_lti upgrades.
+ *
+ * @package mod_lti
+ * @since Moodle 2.8
+ * @copyright 2014 Vital Source Technologies http://vitalsource.com
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+class mod_lti_upgradelib_testcase extends advanced_testcase {
+
+ /**
+ * Test conversion of semicolon separated custom parameters.
+ */
+ public function test_custom_parameter() {
+ global $DB, $SITE, $USER;
+
+ $custom1 = 'a=one;b=two;three=3';
+ $custom2 = "a=one\nb=two\nthree=3";
+
+ $this->resetAfterTest(true);
+
+ $ltigenerator = $this->getDataGenerator()->get_plugin_generator('mod_lti');
+
+ // Create 2 tools with custom parameters.
+ $toolid1 = $DB->insert_record('lti_types', array('course' => $SITE->id, 'baseurl' => '', 'createdby' => $USER->id,
+ 'timecreated' => time(), 'timemodified' => time()));
+ $configid1 = $DB->insert_record('lti_types_config', array('typeid' => $toolid1, 'name' => 'customparameters',
+ 'value' => $custom1));
+ $toolid2 = $DB->insert_record('lti_types', array('course' => $SITE->id, 'baseurl' => '', 'createdby' => $USER->id,
+ 'timecreated' => time(), 'timemodified' => time()));
+ $configid2 = $DB->insert_record('lti_types_config', array('typeid' => $toolid2, 'name' => 'customparameters',
+ 'value' => $custom2));
+
+ // Create 2 instances with custom parameters.
+ $activity1 = $ltigenerator->create_instance(array('course' => $SITE->id, 'name' => 'LTI activity 1',
+ 'typeid' => $toolid1, 'toolurl' => '', 'instructorcustomparameters' => $custom1));
+ $activity2 = $ltigenerator->create_instance(array('course' => $SITE->id, 'name' => 'LTI activity 2',
+ 'typeid' => $toolid2, 'toolurl' => '', 'instructorcustomparameters' => $custom2));
+
+ // Run upgrade script.
+ mod_lti_upgrade_custom_separator();
+
+ // Check semicolon-separated custom parameters have been updated but others have not.
+ $config = $DB->get_record('lti_types_config', array('id' => $configid1));
+ $this->assertEquals($config->value, $custom2);
+
+ $config = $DB->get_record('lti_types_config', array('id' => $configid2));
+ $this->assertEquals($config->value, $custom2);
+
+ $config = $DB->get_record('lti', array('id' => $activity1->id));
+ $this->assertEquals($config->instructorcustomparameters, $custom2);
+
+ $config = $DB->get_record('lti', array('id' => $activity2->id));
+ $this->assertEquals($config->instructorcustomparameters, $custom2);
+ }
+
+}
diff --git a/mod/lti/toolproxies.php b/mod/lti/toolproxies.php
new file mode 100644
index 00000000000..7926ef94ce0
--- /dev/null
+++ b/mod/lti/toolproxies.php
@@ -0,0 +1,193 @@
+.
+
+/**
+ * This file contains all necessary code to launch a Tool Proxy registration
+ *
+ * @package mod_lti
+ * @copyright 2014 Vital Source Technologies http://vitalsource.com
+ * @author Stephen Vickers
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+require_once('../../config.php');
+require_once($CFG->libdir.'/adminlib.php');
+require_once($CFG->dirroot.'/mod/lti/locallib.php');
+
+// No guest autologin.
+require_login(0, false);
+
+$pageurl = new moodle_url('/mod/lti/toolproxies.php');
+$PAGE->set_url($pageurl);
+
+admin_externalpage_setup('ltitoolproxies');
+
+$PAGE->set_title("{$SITE->shortname}: " . get_string('toolregistration', 'lti'));
+
+$configuredtoolproxieshtml = '';
+$pendingtoolproxieshtml = '';
+$acceptedtoolproxieshtml = '';
+$rejectedtoolproxieshtml = '';
+
+$configured = get_string('configured', 'lti');
+$pending = get_string('pending', 'lti');
+$accepted = get_string('accepted', 'lti');
+$rejected = get_string('rejected', 'lti');
+
+$name = get_string('name', 'lti');
+$url = get_string('registrationurl', 'lti');
+$action = get_string('action', 'lti');
+$createdon = get_string('createdon', 'lti');
+
+$toolproxies = $DB->get_records('lti_tool_proxies');
+
+$configuredtoolproxies = lti_filter_tool_proxy_types($toolproxies, LTI_TOOL_PROXY_STATE_CONFIGURED);
+$configuredtoolproxieshtml = lti_get_tool_proxy_table($configuredtoolproxies, 'tp_configured');
+
+$pendingtoolproxies = lti_filter_tool_proxy_types($toolproxies, LTI_TOOL_PROXY_STATE_PENDING);
+$pendingtoolproxieshtml = lti_get_tool_proxy_table($pendingtoolproxies, 'tp_pending');
+
+$acceptedtoolproxies = lti_filter_tool_proxy_types($toolproxies, LTI_TOOL_PROXY_STATE_ACCEPTED);
+$acceptedtoolproxieshtml = lti_get_tool_proxy_table($acceptedtoolproxies, 'tp_accepted');
+
+$rejectedtoolproxies = lti_filter_tool_proxy_types($toolproxies, LTI_TOOL_PROXY_STATE_REJECTED);
+$rejectedtoolproxieshtml = lti_get_tool_proxy_table($rejectedtoolproxies, 'tp_rejected');
+
+$tab = optional_param('tab', '', PARAM_ALPHAEXT);
+$configuredselected = '';
+$pendingselected = '';
+$acceptedselected = '';
+$rejectedselected = '';
+switch ($tab) {
+ case 'tp_pending':
+ $pendingselected = 'class="selected"';
+ break;
+ case 'tp_accepted':
+ $acceptedselected = 'class="selected"';
+ break;
+ case 'tp_rejected':
+ $rejectedselected = 'class="selected"';
+ break;
+ default:
+ $configuredselected = 'class="selected"';
+ break;
+}
+$registertype = get_string('registertype', 'lti');
+$config = get_string('manage_tools', 'lti');
+
+$registertypeurl = "{$CFG->wwwroot}/mod/lti/registersettings.php?action=add&sesskey={$USER->sesskey}&tab=tool_proxy";
+
+$template = <<< EOD
+
+
+
+
+
+ $configuredtoolproxieshtml
+
+
+ $pendingtoolproxieshtml
+
+
+ $acceptedtoolproxieshtml
+
+
+ $rejectedtoolproxieshtml
+
+
+
+
+
+EOD;
+
+echo $OUTPUT->header();
+echo $OUTPUT->heading(get_string('manage_tool_proxies', 'lti'), 2);
+echo $OUTPUT->heading(new lang_string('toolproxy', 'lti') .
+ $OUTPUT->help_icon('toolproxy', 'lti'), 3);
+
+echo $OUTPUT->box_start('generalbox');
+
+echo $template;
+
+echo $OUTPUT->box_end();
+echo $OUTPUT->footer();
diff --git a/mod/lti/toolssettings.php b/mod/lti/toolssettings.php
new file mode 100644
index 00000000000..144ea395110
--- /dev/null
+++ b/mod/lti/toolssettings.php
@@ -0,0 +1,102 @@
+.
+
+/**
+ * This file contains the script used to register a new external tool.
+ *
+ * It is used to create a new form used to configure the capabilities
+ * and services to be offered to the tool provider.
+ *
+ * @package mod_lti
+ * @copyright 2014 Vital Source Technologies http://vitalsource.com
+ * @author Stephen Vickers
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+require_once('../../config.php');
+require_once($CFG->libdir.'/adminlib.php');
+require_once($CFG->dirroot.'/mod/lti/edit_form.php');
+require_once($CFG->dirroot.'/mod/lti/locallib.php');
+
+$action = optional_param('action', '', PARAM_ALPHANUMEXT);
+$id = optional_param('id', '', PARAM_INT);
+$tab = optional_param('tab', '', PARAM_ALPHAEXT);
+
+// No guest autologin.
+require_login(0, false);
+
+require_sesskey();
+
+// Check this is for a tool created from a tool proxy.
+$err = empty($id);
+if (!$err) {
+ $type = lti_get_type_type_config($id);
+ $err = empty($type->toolproxyid);
+}
+if ($err) {
+ $redirect = new moodle_url('/mod/lti/typessettings.php',
+ array('action' => $action, 'id' => $id, 'sesskey' => sesskey(), 'tab' => $tab));
+ redirect($redirect);
+}
+
+$pageurl = new moodle_url('/mod/lti/toolssettings.php');
+if (!empty($id)) {
+ $pageurl->param('id', $id);
+}
+$PAGE->set_url($pageurl);
+
+admin_externalpage_setup('managemodules'); // Hacky solution for printing the admin page.
+
+$redirect = "$CFG->wwwroot/$CFG->admin/settings.php?section=modsettinglti&tab={$tab}";
+
+if ($action == 'accept') {
+ lti_set_state_for_type($id, LTI_TOOL_STATE_CONFIGURED);
+ redirect($redirect);
+} else if (($action == 'reject') || ($action == 'delete')) {
+ lti_set_state_for_type($id, LTI_TOOL_STATE_REJECTED);
+ redirect($redirect);
+}
+
+$form = new mod_lti_edit_types_form($pageurl, (object)array('isadmin' => true, 'istool' => true));
+
+if ($data = $form->get_data()) {
+ $type = new stdClass();
+ if (!empty($id)) {
+ $type->id = $id;
+ lti_update_type($type, $data);
+ } else {
+ $type->state = LTI_TOOL_STATE_CONFIGURED;
+ lti_add_type($type, $data);
+ }
+ redirect($redirect);
+} else if ($form->is_cancelled()) {
+ redirect($redirect);
+}
+
+$PAGE->set_title(format_string($SITE->shortname) . ': ' . get_string('toolsetup', 'lti'));
+$PAGE->navbar->add(get_string('lti_administration', 'lti'), $CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=modsettinglti');
+
+echo $OUTPUT->header();
+echo $OUTPUT->heading(get_string('toolsetup', 'lti'));
+echo $OUTPUT->box_start('generalbox');
+
+if ($action == 'update') {
+ $form->set_data($type);
+}
+
+$form->display();
+echo $OUTPUT->box_end();
+echo $OUTPUT->footer();
diff --git a/mod/lti/typessettings.php b/mod/lti/typessettings.php
index ab5895a2488..582e564b2f1 100644
--- a/mod/lti/typessettings.php
+++ b/mod/lti/typessettings.php
@@ -30,10 +30,11 @@
//
// BasicLTI4Moodle is copyright 2009 by Marc Alier Forment, Jordi Piguillem and Nikolas Galanis
// of the Universitat Politecnica de Catalunya http://www.upc.edu
-// Contact info: Marc Alier Forment granludo @ gmail.com or marc.alier @ upc.edu
+// Contact info: Marc Alier Forment granludo @ gmail.com or marc.alier @ upc.edu.
/**
* This file contains the script used to clone Moodle admin setting page.
+ *
* It is used to create a new form used to pre-configure lti activities
*
* @package mod_lti
@@ -56,21 +57,34 @@ $action = optional_param('action', null, PARAM_ALPHANUMEXT);
$id = optional_param('id', null, PARAM_INT);
$tab = optional_param('tab', '', PARAM_ALPHAEXT);
-// no guest autologin
+// No guest autologin.
require_login(0, false);
+require_sesskey();
+
+// Check this is not for a tool created from a tool proxy.
+if (!empty($id)) {
+ $type = lti_get_type_type_config($id);
+ if (!empty($type->toolproxyid)) {
+ $sesskey = required_param('sesskey', PARAM_RAW);
+ $redirect = new moodle_url('/mod/lti/toolssettings.php',
+ array('action' => $action, 'id' => $id, 'sesskey' => $sesskey, 'tab' => $tab));
+ redirect($redirect);
+ }
+} else {
+ $type = new stdClass();
+}
+
$pageurl = new moodle_url('/mod/lti/typessettings.php');
if (!empty($id)) {
$pageurl->param('id', $id);
}
$PAGE->set_url($pageurl);
-admin_externalpage_setup('managemodules'); // Hacky solution for printing the admin page
+admin_externalpage_setup('managemodules'); // Hacky solution for printing the admin page.
$redirect = "$CFG->wwwroot/$CFG->admin/settings.php?section=modsettinglti&tab={$tab}";
-require_sesskey();
-
if ($action == 'accept') {
lti_set_state_for_type($id, LTI_TOOL_STATE_CONFIGURED);
redirect($redirect);
@@ -82,20 +96,17 @@ if ($action == 'accept') {
redirect($redirect);
}
-$form = new mod_lti_edit_types_form($pageurl, (object)array('isadmin' => true));
+$form = new mod_lti_edit_types_form($pageurl, (object)array('isadmin' => true, 'istool' => false));
if ($data = $form->get_data()) {
$type = new stdClass();
-
if (!empty($id)) {
$type->id = $id;
-
lti_update_type($type, $data);
redirect($redirect);
} else {
$type->state = LTI_TOOL_STATE_CONFIGURED;
-
lti_add_type($type, $data);
redirect($redirect);
@@ -112,7 +123,6 @@ echo $OUTPUT->heading(get_string('toolsetup', 'lti'));
echo $OUTPUT->box_start('generalbox');
if ($action == 'update') {
- $type = lti_get_type_type_config($id);
$form->set_data($type);
}
diff --git a/mod/lti/upgrade.txt b/mod/lti/upgrade.txt
index dda6f1f5069..825f27173f7 100644
--- a/mod/lti/upgrade.txt
+++ b/mod/lti/upgrade.txt
@@ -9,3 +9,8 @@ This files describes API changes in the lti code.
* mod_lti\event\unknown_service_api_called now has less data stored in 'other'
but everything is still available for event observers via method get_message_data()
+
+=== 2.8 ===
+
+* Support for LTI 2 added, including extensible services implemented as ltiservice plugins.
+* Function sendOAuthBodyPOST removed from OAuthBody.php because it was not being used.
diff --git a/mod/lti/version.php b/mod/lti/version.php
index a20a0e60c7e..70caf223a5f 100644
--- a/mod/lti/version.php
+++ b/mod/lti/version.php
@@ -30,7 +30,7 @@
//
// BasicLTI4Moodle is copyright 2009 by Marc Alier Forment, Jordi Piguillem and Nikolas Galanis
// of the Universitat Politecnica de Catalunya http://www.upc.edu
-// Contact info: Marc Alier Forment granludo @ gmail.com or marc.alier @ upc.edu
+// Contact info: Marc Alier Forment granludo @ gmail.com or marc.alier @ upc.edu.
/**
* This file defines the version of lti
@@ -48,7 +48,7 @@
defined('MOODLE_INTERNAL') || die;
-$plugin->version = 2014060201; // The current module version (Date: YYYYMMDDXX)
-$plugin->requires = 2014050800; // Requires this Moodle version
-$plugin->component = 'mod_lti'; // Full name of the plugin (used for diagnostics)
+$plugin->version = 2014100300; // The current module version (Date: YYYYMMDDXX).
+$plugin->requires = 2014050800; // Requires this Moodle version.
+$plugin->component = 'mod_lti'; // Full name of the plugin (used for diagnostics).
$plugin->cron = 0;
diff --git a/mod/lti/view.php b/mod/lti/view.php
index 874ac0a1344..4d0b8c41385 100644
--- a/mod/lti/view.php
+++ b/mod/lti/view.php
@@ -30,7 +30,7 @@
//
// BasicLTI4Moodle is copyright 2009 by Marc Alier Forment, Jordi Piguillem and Nikolas Galanis
// of the Universitat Politecnica de Catalunya http://www.upc.edu
-// Contact info: Marc Alier Forment granludo @ gmail.com or marc.alier @ upc.edu
+// Contact info: Marc Alier Forment granludo @ gmail.com or marc.alier @ upc.edu.
/**
* This file contains all necessary code to view a lti activity instance
@@ -52,9 +52,9 @@ require_once($CFG->dirroot.'/mod/lti/lib.php');
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
+$l = optional_param('l', 0, PARAM_INT); // lti ID.
-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);
$cm = get_coursemodule_from_instance('lti', $lti->id, $lti->course, false, MUST_EXIST);
@@ -72,21 +72,21 @@ if ($tool) {
$toolconfig = array();
}
-$PAGE->set_cm($cm, $course); // set's up global $COURSE
+$PAGE->set_cm($cm, $course); // Set's up global $COURSE.
$context = context_module::instance($cm->id);
$PAGE->set_context($context);
require_login($course, true, $cm);
require_capability('mod/lti:view', $context);
-$url = new moodle_url('/mod/lti/view.php', array('id'=>$cm->id));
+$url = new moodle_url('/mod/lti/view.php', array('id' => $cm->id));
$PAGE->set_url($url);
$launchcontainer = lti_get_launch_container($lti, $toolconfig);
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
+ $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 {
@@ -111,11 +111,11 @@ $pagetitle = strip_tags($course->shortname.': '.format_string($lti->name));
$PAGE->set_title($pagetitle);
$PAGE->set_heading($course->fullname);
-// Print the page header
+// Print the page header.
echo $OUTPUT->header();
if ($lti->showtitlelaunch) {
- // Print the main part of the page
+ // Print the main part of the page.
echo $OUTPUT->heading(format_string($lti->name, true, array('context' => $context)));
}
@@ -133,7 +133,7 @@ if ( $launchcontainer == LTI_LAUNCH_CONTAINER_WINDOW ) {
// Request the launch content with an iframe tag.
echo '';
- // Output script to make the iframe be as large as possible.
+ // Output script to make the iframe tag be as large as possible.
$resize = '