Skip to content

Commit

Permalink
cleaning up comments
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusgreen committed Jun 12, 2020
1 parent 4a7d327 commit 16d8bc2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
3 changes: 1 addition & 2 deletions backup/moodle2/restore_qtype_gapfill_plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,12 @@ public function process_question_answer($data) {
$params = array($newquestionid, $data->answertext);
$newitemid = $DB->get_field_sql($sql, $params, IGNORE_MULTIPLE);

// Not able to find the answer, let's try cleaning the answertext
// Not able to find the answer, let's try cleaning the answertext.
// of all the question answers in DB as slower fallback. MDL-30018.
if (!$newitemid) {
$params = array('question' => $newquestionid);
$answers = $DB->get_records('question_answers', $params, '', 'id, answer');
foreach ($answers as $answer) {
// Clean in the same way than {@link xml_writer::xml_safe_utf8()}.
$clean = preg_replace('/[\x-\x8\xb-\xc\xe-\x1f\x7f]/is', '', $answer->answer); // Clean CTRL chars.
$clean = preg_replace("/\r\n|\r/", "\n", $clean); // Normalize line ending.
if ($clean === $data->answertext) {
Expand Down
6 changes: 0 additions & 6 deletions questiontype.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ public function extra_question_fields() {
'noduplicates', 'disableregex', 'fixedgapsize', 'optionsaftertext', 'letterhints');
}

/**
* Utility method used by {@link qtype_renderer::head_code()}
* It looks for any of the files script.js or script.php that
* exist in the plugin folder and ensures they get included.
* It also includes the jquery files required for this plugin
*/

/**
* Called during question editing
Expand Down
5 changes: 3 additions & 2 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,13 @@ public function formulation_and_controls(question_attempt $qa, question_display_
$output .= $answeroptions . '</div>' . $questiontext;
}
} else {
/*for gapfill and dropdown rendering */
// For gapfill and dropdown rendering.
$output .= $questiontext;
}

if ($qa->get_state() == question_state::$invalid) {
$output .= html_writer::nonempty_tag('div', $question->get_validation_error(array('answer' => $output)), array('class' => 'validationerror'));
$output .= html_writer::nonempty_tag('div', $question->get_validation_error(array('answer' => $output)),
['class' => 'validationerror']);
}
$output .= html_writer::end_div();

Expand Down

0 comments on commit 16d8bc2

Please sign in to comment.