mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-79863 qtype_ordering: qtype_ordering (github-issue #43 and #44): rename upper case numberstyles to ABCD and IIII in order to differentiate from lower case styles on DBs, such as MySQL, which use case insensitive indexes.
This commit is contained in:
parent
d784021b8d
commit
ae7ee93bf0
@ -257,10 +257,31 @@ function xmldb_qtype_ordering_upgrade($oldversion) {
|
||||
} else {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Ordering savepoint reached.
|
||||
upgrade_plugin_savepoint(true, $newversion, 'qtype', 'ordering');
|
||||
}
|
||||
|
||||
$newversion = '2019073193';
|
||||
if ($oldversion < $newversion) {
|
||||
$table = 'qtype_ordering_options';
|
||||
$field = 'numberingstyle';
|
||||
$select = "$field = ? OR $field = ?";
|
||||
$params = array('III', 'ABC');
|
||||
if ($options = $DB->get_records_select($table, $select, $params, $field, "id,$field")) {
|
||||
foreach ($options as $option) {
|
||||
switch ($option->numberingstyle) {
|
||||
case 'ABC':
|
||||
$DB->set_field($table, $field, 'ABCD', array('id' => $option->id));
|
||||
break;
|
||||
case 'III':
|
||||
$DB->set_field($table, $field, 'IIII', array('id' => $option->id));
|
||||
break;
|
||||
// Ignore "abc", "iii", and anything else.
|
||||
}
|
||||
}
|
||||
}
|
||||
upgrade_plugin_savepoint(true, $newversion, 'qtype', 'ordering');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -83,9 +83,9 @@ $string['numberingstyle'] = 'Number the choices?';
|
||||
$string['numberingstylenone'] = 'No numbering';
|
||||
$string['numberingstyle123'] = '1., 2., 3., ...';
|
||||
$string['numberingstyleabc'] = 'a., b., c., ...';
|
||||
$string['numberingstyleABC'] = 'A., B., C., ...';
|
||||
$string['numberingstyleABCD'] = 'A., B., C., ...';
|
||||
$string['numberingstyleiii'] = 'i., ii., iii., ...';
|
||||
$string['numberingstyleIII'] = 'I., II., III., ...';
|
||||
$string['numberingstyleIIII'] = 'I., II., III., ...';
|
||||
$string['numberingstyle_desc'] = 'The default numbering style.';
|
||||
$string['numberingstyle_help'] = 'Choose the numbering style for draggable items in this question.';
|
||||
|
||||
|
@ -839,10 +839,10 @@ class qtype_ordering_question extends question_graded_automatically {
|
||||
$plugin = 'qtype_ordering';
|
||||
$styles = array('none' => get_string('numberingstylenone', $plugin),
|
||||
'abc' => get_string('numberingstyleabc', $plugin),
|
||||
'ABC' => get_string('numberingstyleABC', $plugin),
|
||||
'ABCD' => get_string('numberingstyleABCD', $plugin),
|
||||
'123' => get_string('numberingstyle123', $plugin),
|
||||
'iii' => get_string('numberingstyleiii', $plugin),
|
||||
'III' => get_string('numberingstyleIII', $plugin));
|
||||
'IIII' => get_string('numberingstyleIIII', $plugin));
|
||||
return self::get_types($styles, $style);
|
||||
}
|
||||
}
|
||||
|
@ -357,7 +357,7 @@ class qtype_ordering extends question_type {
|
||||
'LONGEST_ORDERED_SUBSET|'.
|
||||
'LONGEST_CONTIGUOUS_SUBSET)?';
|
||||
$showgrading = '(?:SHOW|TRUE|YES|1|HIDE|FALSE|NO|0)?';
|
||||
$numberingstyle = '(?:none|123|abc|ABC|iii|III)?';
|
||||
$numberingstyle = '(?:none|123|abc|ABCD|iii|IIII)?';
|
||||
$search = '/^\s*>\s*('.$selectcount.')\s*'.
|
||||
'('.$selecttype.')\s*'.
|
||||
'('.$layouttype.')\s*'.
|
||||
@ -884,9 +884,9 @@ class qtype_ordering extends question_type {
|
||||
case 'none':
|
||||
case '123':
|
||||
case 'abc':
|
||||
case 'ABC':
|
||||
case 'ABCD':
|
||||
case 'iii':
|
||||
case 'III':
|
||||
case 'IIII':
|
||||
$question->numberingstyle = $numberingstyle;
|
||||
break;
|
||||
|
||||
|
@ -29,5 +29,5 @@ $plugin->cron = 0;
|
||||
$plugin->component = 'qtype_ordering';
|
||||
$plugin->maturity = MATURITY_STABLE;
|
||||
$plugin->requires = 2015051100; // Moodle 2.9.
|
||||
$plugin->version = 2019071292;
|
||||
$plugin->release = '2019-07-12 (92)';
|
||||
$plugin->version = 2019073193;
|
||||
$plugin->release = '2019-07-31 (93)';
|
||||
|
Loading…
x
Reference in New Issue
Block a user