mirror of
https://github.com/moodle/moodle.git
synced 2025-03-18 22:50:19 +01:00
Merge branch 'MDL-43042-master' of git://github.com/mihailges/moodle
This commit is contained in:
commit
7d6d0788f2
@ -4119,23 +4119,38 @@ abstract class lesson_page extends lesson_base {
|
||||
$options->context = $context;
|
||||
|
||||
$result->feedback .= $OUTPUT->box(format_text($this->get_contents(), $this->properties->contentsformat, $options),
|
||||
'generalbox boxaligncenter');
|
||||
$studentanswer = format_text($result->studentanswer, $result->studentanswerformat,
|
||||
array('context' => $context, 'para' => true));
|
||||
'generalbox boxaligncenter p-y-1');
|
||||
$result->feedback .= '<div class="correctanswer generalbox"><em>'
|
||||
. get_string("youranswer", "lesson").'</em> : ' . $studentanswer;
|
||||
if (isset($result->responseformat)) {
|
||||
$result->response = file_rewrite_pluginfile_urls($result->response, 'pluginfile.php', $context->id,
|
||||
'mod_lesson', 'page_responses', $result->answerid);
|
||||
$result->feedback .= $OUTPUT->box(format_text($result->response, $result->responseformat, $options)
|
||||
, $class);
|
||||
} else {
|
||||
$result->feedback .= $OUTPUT->box($result->response, $class);
|
||||
. get_string("youranswer", "lesson").'</em> : <div class="studentanswer m-t-2 m-b-2">';
|
||||
|
||||
$studentanswerarray = explode('<br />', $result->studentanswer);
|
||||
$responsearr = explode('<br />', $result->response);
|
||||
$studentanswerresponse = array_combine($studentanswerarray, $responsearr);
|
||||
// Create a table containing the answers and responses.
|
||||
$table = new html_table();
|
||||
foreach ($studentanswerresponse as $answer => $response) {
|
||||
// Add a table row containing the answer.
|
||||
$studentanswer = format_text($answer, $result->studentanswerformat,
|
||||
array('context' => $context, 'para' => true));
|
||||
$table->data[] = array($studentanswer);
|
||||
// If the response exists, add a table row containing the response. If not, add en empty row.
|
||||
if (!empty(trim($response))) {
|
||||
if (isset($result->responseformat)) {
|
||||
$convertstudentresponse = file_rewrite_pluginfile_urls($response, 'pluginfile.php',
|
||||
$context->id, 'mod_lesson', 'page_responses', $result->answerid);
|
||||
$studentresponse = format_text($convertstudentresponse, $result->responseformat, $options);
|
||||
} else {
|
||||
$studentresponse = $response;
|
||||
}
|
||||
$table->data[] = array('<em>'.get_string("response", "lesson").
|
||||
'</em>: <br/>'.$studentresponse);
|
||||
} else {
|
||||
$table->data[] = array('');
|
||||
}
|
||||
}
|
||||
$result->feedback .= '</div>';
|
||||
$result->feedback .= html_writer::table($table).'</div></div>';
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -169,13 +169,12 @@ class lesson_page_type_multichoice extends lesson_page {
|
||||
foreach ($answers as $answer) {
|
||||
foreach ($studentanswers as $answerid) {
|
||||
if ($answerid == $answer->id) {
|
||||
$result->studentanswer .= '<br />'.format_text($answer->answer, $answer->answerformat, $formattextdefoptions);
|
||||
if (trim(strip_tags($answer->response))) {
|
||||
$responses[$answerid] = format_text($answer->response, $answer->responseformat, $formattextdefoptions);
|
||||
}
|
||||
$studentanswerarray[] = format_text($answer->answer, $answer->answerformat, $formattextdefoptions);
|
||||
$responses[$answerid] = format_text($answer->response, $answer->responseformat, $formattextdefoptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
$result->studentanswer = implode('<br />', $studentanswerarray);
|
||||
$correctpageid = null;
|
||||
$wrongpageid = null;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user