MDL-57757 mod_lesson: Handle empty answers
This is and edge case created by a bug in the numeric question type.
This commit is contained in:
@@ -1860,8 +1860,10 @@ class mod_lesson_external extends external_api {
|
||||
'response' => new external_value(PARAM_RAW, 'The response text.'),
|
||||
'responseformat' => new external_format_value('response.'),
|
||||
'answers' => new external_multiple_structure(
|
||||
new external_multiple_structure(new external_value(PARAM_RAW, 'Possible answers and info.'))
|
||||
)
|
||||
new external_multiple_structure(new external_value(PARAM_RAW, 'Possible answers and info.')),
|
||||
'User answers',
|
||||
VALUE_OPTIONAL
|
||||
),
|
||||
), 'Answer data (empty in content pages created in Moodle 1.x).', VALUE_OPTIONAL
|
||||
)
|
||||
)
|
||||
|
||||
@@ -328,7 +328,7 @@ if ($action === 'delete') {
|
||||
$table->data[] = array($fontstart.get_string("question", "lesson").": <br />".$fontend.$fontstart2.$page->contents.$fontend2, " ");
|
||||
$table->data[] = array($fontstart.get_string("answer", "lesson").":".$fontend, ' ');
|
||||
// apply the font to each answer
|
||||
if (!empty($page->answerdata)) {
|
||||
if (!empty($page->answerdata->answers)) {
|
||||
foreach ($page->answerdata->answers as $answer){
|
||||
$modified = array();
|
||||
foreach ($answer as $single) {
|
||||
|
||||
Reference in New Issue
Block a user