Skip to content

Commit

Permalink
MDL-39261 mod_lesson: Rewrite the answer URL for grading
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter committed Apr 11, 2019
1 parent 3afdfce commit 676eca7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mod/lesson/essay.php
Expand Up @@ -247,7 +247,9 @@
// Set rest of the message values
$currentpage = $lesson->load_page($attempt->pageid);
$a->question = format_text($currentpage->contents, $currentpage->contentsformat, $formattextdefoptions);
$a->response = format_text($essayinfo->answer, $essayinfo->answerformat,
$answer = file_rewrite_pluginfile_urls($essayinfo->answer, 'pluginfile.php', $context->id,
'mod_lesson', 'essay_responses', $attempt->id);
$a->response = format_text($answer, $essayinfo->answerformat,
array('context' => $context, 'para' => true));
$a->comment = $essayinfo->response;
$a->comment = file_rewrite_pluginfile_urls($a->comment, 'pluginfile.php', $context->id,
Expand Down Expand Up @@ -454,6 +456,8 @@
// Grading form
// Expects the following to be set: $attemptid, $answer, $user, $page, $attempt
$essayinfo = lesson_page_type_essay::extract_useranswer($attempt->useranswer);
$answer = file_rewrite_pluginfile_urls($essayinfo->answer, 'pluginfile.php', $context->id,
'mod_lesson', 'essay_responses', $attempt->id);
$currentpage = $lesson->load_page($attempt->pageid);

$mform = new essay_grading_form(null, array('scoreoptions'=>$scoreoptions, 'user'=>$user));
Expand All @@ -462,7 +466,7 @@
$data->attemptid = $attemptid;
$data->score = $essayinfo->score;
$data->question = format_text($currentpage->contents, $currentpage->contentsformat, $formattextdefoptions);
$data->studentanswer = format_text($essayinfo->answer, $essayinfo->answerformat,
$data->studentanswer = format_text($answer, $essayinfo->answerformat,
array('context' => $context, 'para' => true));
$data->response = $essayinfo->response;
$data->responseformat = $essayinfo->responseformat;
Expand Down

0 comments on commit 676eca7

Please sign in to comment.