Merge branch 'MDL-60752-master' of git://github.com/andrewnicols/moodle

This commit is contained in:
Damyon Wiese 2017-11-09 15:08:11 +08:00
commit bef5a8ca10

View File

@ -85,10 +85,20 @@ class moodle1_mod_lti_handler extends moodle1_mod_handler {
$ignorefields = array('id', 'modtype');
if (!$DB->record_exists('lti_types', array('id' => $data['typeid']))) {
$ntypeid = $DB->get_field('lti_types_config',
'typeid',
array('name' => 'toolurl', 'value' => $data['toolurl']),
IGNORE_MULTIPLE);
$ntypeid = false;
$toolurls = $DB->get_records_select(
'lti_types_config',
"name = 'toolurl' AND " . $DB->sql_compare_text('value', 256) . ' = ' . $DB->sql_compare_text('?', 256),
[$data['toolurl']],
'',
'id, value'
);
foreach ($toolurls as $id => $value) {
if ($value == $data['toolurl']) {
$ntypeid = $id;
break;
}
}
if ($ntypeid === false) {
$ntypeid = $DB->get_field('lti_types_config',
'typeid',