mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-79863 qtype_ordering: qtype/ordering fix undefined passwordsaltmain in Moodle >= 2.6
This commit is contained in:
parent
b60ceb1efb
commit
d9e73158b5
@ -133,12 +133,19 @@ class qtype_ordering_renderer extends qtype_renderer {
|
||||
$result .= html_writer::start_tag('div', array('class' => 'answer'));
|
||||
$result .= html_writer::start_tag('ul', array('class' => 'boxy', 'id' => 'sortable'.$question->id));
|
||||
|
||||
// a salt (=random string) to help disguise answer ids
|
||||
if (isset($CFG->passwordsaltmain)) {
|
||||
$salt = $CFG->passwordsaltmain;
|
||||
} else {
|
||||
$salt = complex_random_string();
|
||||
}
|
||||
|
||||
// generate ordering items
|
||||
foreach ($answerids as $i => $answerid) {
|
||||
// the original "id" revealed the correct order of the answers
|
||||
// because $answer->fraction holds the correct order number
|
||||
// $id = 'ordering_item_'.$answerid.'_'.intval($answers[$answerid]->fraction);
|
||||
$id = 'ordering_item_'.md5($CFG->passwordsaltmain.$answers[$answerid]->answer);
|
||||
$id = 'ordering_item_'.md5($salt.$answers[$answerid]->answer);
|
||||
$params = array('class' => 'ui-state-default', 'id' => $id);
|
||||
$result .= html_writer::tag('li', $answers[$answerid]->answer, $params);
|
||||
}
|
||||
|
@ -30,6 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
$plugin->cron = 0;
|
||||
$plugin->component = 'qtype_ordering';
|
||||
$plugin->maturity = MATURITY_STABLE; // ALPHA=50, BETA=100, RC=150, STABLE=200
|
||||
$plugin->release = '2013-06-28.00';
|
||||
$plugin->version = 2013062800;
|
||||
$plugin->release = '2014-05-14.01';
|
||||
$plugin->version = 2014051401;
|
||||
$plugin->requires = 2010112400; // Moodle 2.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user