Skip to content

Commit

Permalink
MDL-63512 mod_lesson: Fix video links provided in feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter committed Dec 20, 2018
1 parent 2fbae51 commit b5cc9d4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mod/lesson/continue.php
Expand Up @@ -92,7 +92,7 @@
echo $lessonoutput->ongoing_score($lesson);
}
if (!$reviewmode) {
echo format_text($result->feedback, FORMAT_MOODLE, array('context' => $context));
echo format_text($result->feedback, FORMAT_MOODLE, array('context' => $context, 'noclean' => true));
}

// User is modifying attempts - save button and some instructions
Expand Down
14 changes: 10 additions & 4 deletions mod/lesson/locallib.php
Expand Up @@ -4181,7 +4181,7 @@ final public function record_attempt($context) {

foreach ($studentanswerresponse as $answer => $response) {
// Add a table row containing the answer.
$studentanswer = $this->format_answer($answer, $context, $result->studentanswerformat);
$studentanswer = $this->format_answer($answer, $context, $result->studentanswerformat, $options);
$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))) {
Expand All @@ -4195,7 +4195,7 @@ final public function record_attempt($context) {
}
} else {
// Add a table row containing the answer.
$studentanswer = $this->format_answer($result->studentanswer, $context, $result->studentanswerformat);
$studentanswer = $this->format_answer($result->studentanswer, $context, $result->studentanswerformat, $options);
$table->data[] = array($studentanswer);
// If the response exists, add a table row containing the response. If not, add en empty row.
if (!empty(trim($result->response))) {
Expand Down Expand Up @@ -4223,9 +4223,15 @@ final public function record_attempt($context) {
* @param int $answerformat
* @return string Returns formatted string
*/
private function format_answer($answer, $context, $answerformat) {
private function format_answer($answer, $context, $answerformat, $options = []) {

return format_text($answer, $answerformat, array('context' => $context, 'para' => true));
if (empty($options)) {
$options = [
'context' => $context,
'para' => true
];
}
return format_text($answer, $answerformat, $options);
}

/**
Expand Down

0 comments on commit b5cc9d4

Please sign in to comment.