mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
[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.
This commit is contained in:
parent
692d247a3a
commit
ea5d05151b
@ -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);
|
||||
}
|
||||
|
||||
|
@ -170,6 +170,8 @@
|
||||
self.toolTypeCache[selectedToolType] = toolInfo;
|
||||
}
|
||||
|
||||
Y.one('#id_urlmatchedtypeid').set('value', toolInfo.toolid);
|
||||
|
||||
continuation(toolInfo);
|
||||
}
|
||||
});
|
||||
|
@ -119,6 +119,9 @@ class mod_lti_mod_form extends moodleform_mod {
|
||||
$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');
|
||||
|
Loading…
x
Reference in New Issue
Block a user