mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
Merge branch 'MDL-79937_fixlessonmatching' of https://github.com/catalystfd/moodle
This commit is contained in:
commit
4179fa2dfc
@ -79,19 +79,22 @@ class lesson_page_type_matching extends lesson_page {
|
||||
$answers[$getanswer->id] = $getanswer;
|
||||
}
|
||||
|
||||
// Calculate the text for the dropdown, keyed by the non formatted version.
|
||||
$responses = array();
|
||||
foreach ($answers as $answer) {
|
||||
// get all the response
|
||||
// Get all the response.
|
||||
if ($answer->response != null) {
|
||||
$responses[] = format_text(trim($answer->response));
|
||||
$responses[trim($answer->response)] = format_text(trim($answer->response));
|
||||
}
|
||||
}
|
||||
|
||||
$responseoptions = array(''=>get_string('choosedots'));
|
||||
// Now shuffle the answers to randomise the order of the items in the dropdown.
|
||||
$responseoptions = ['' => get_string('choosedots')];
|
||||
if (!empty($responses)) {
|
||||
shuffle($responses);
|
||||
foreach ($responses as $response) {
|
||||
$responseoptions[htmlspecialchars($response, ENT_COMPAT)] = $response;
|
||||
$keys = array_keys($responses);
|
||||
shuffle($keys);
|
||||
foreach ($keys as $key) {
|
||||
$responseoptions[$key] = $responses[$key];
|
||||
}
|
||||
}
|
||||
if (isset($USER->modattempts[$this->lesson->id]) && !empty($attempt->useranswer)) {
|
||||
@ -211,7 +214,6 @@ class lesson_page_type_matching extends lesson_page {
|
||||
$result->noanswer = true;
|
||||
return $result;
|
||||
}
|
||||
$value = htmlspecialchars_decode($value, ENT_COMPAT);
|
||||
$userresponse[] = $value;
|
||||
// Make sure the user's answer exists in question's answer
|
||||
if (array_key_exists($id, $answers)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user