Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[MDL-44170] Added form field for url matched type.

Added a new mod_form field called urlmatchedtypeid which is populated
by mod_form.js when a matched url is entered. On save, if typeid is 0
and urlmatchedtypeid is supplied, the type id is set to the url matched
id.
  • Loading branch information...
commit ea5d05151b880261554c3dc89da51216ddc26b5b 1 parent 692d247
@adrianfish adrianfish authored
Showing with 13 additions and 0 deletions.
  1. +8 −0 mod/lti/lib.php
  2. +2 −0  mod/lti/mod_form.js
  3. +3 −0  mod/lti/mod_form.php
View
8 mod/lti/lib.php
@@ -96,6 +96,10 @@ function lti_add_instance($lti, $mform) {
$lti->timemodified = $lti->timecreated;
$lti->servicesalt = uniqid('', true);
+ if ($lti->typeid == 0 && isset($lti->urlmatchedtypeid)) {
+ $lti->typeid = $lti->urlmatchedtypeid;
+ }
+
if (!isset($lti->grade)) {
$lti->grade = 100; // TODO: Why is this harcoded here and default @ DB
}
@@ -146,6 +150,10 @@ function lti_update_instance($lti, $mform) {
lti_grade_item_delete($lti);
}
+ if ($lti->typeid == 0 && isset($lti->urlmatchedtypeid)) {
+ $lti->typeid = $lti->urlmatchedtypeid;
+ }
+
return $DB->update_record('lti', $lti);
}
View
2  mod/lti/mod_form.js
@@ -170,6 +170,8 @@
self.toolTypeCache[selectedToolType] = toolInfo;
}
+ Y.one('#id_urlmatchedtypeid').set('value', toolInfo.toolid);
+
continuation(toolInfo);
}
});
View
3  mod/lti/mod_form.php
@@ -119,6 +119,9 @@ public function definition() {
$mform->setAdvanced('securetoolurl');
$mform->addHelpButton('securetoolurl', 'secure_launch_url', 'lti');
+ $mform->addElement('hidden', 'urlmatchedtypeid', '', array( 'id' => 'id_urlmatchedtypeid' ));
+ $mform->setType('urlmatchedtypeid', PARAM_INT);
+
$launchoptions=array();
$launchoptions[LTI_LAUNCH_CONTAINER_DEFAULT] = get_string('default', 'lti');
$launchoptions[LTI_LAUNCH_CONTAINER_EMBED] = get_string('embed', 'lti');
Please sign in to comment.
Something went wrong with that request. Please try again.