You are here

function qformat_gift::commentparser in Quiz 6.5

Same name and namespace in other branches
  1. 6.6 includes/moodle/question/format/gift/format.php \qformat_gift::commentparser()
1 call to qformat_gift::commentparser()
qformat_gift::readquestion in includes/moodle/question/format/gift/format.php
Given the data known to define a question in this format, this function converts it into a question object suitable for processing and insertion into Moodle.

File

includes/moodle/question/format/gift/format.php, line 58

Class

qformat_gift
@package questionbank @subpackage importexport

Code

function commentparser(&$answer) {
  if (strpos($answer, "#") > 0) {
    $hashpos = strpos($answer, "#");
    $comment = substr($answer, $hashpos + 1);
    $comment = addslashes(trim($this
      ->escapedchar_post($comment)));
    $answer = substr($answer, 0, $hashpos);
  }
  else {
    $comment = " ";
  }
  return $comment;
}