function qformat_examview::parse_co in Quiz 6.5
Same name and namespace in other branches
- 6.6 includes/moodle/question/format/examview/format.php \qformat_examview::parse_co()
1 call to qformat_examview::parse_co()
- qformat_examview::readquestion in includes/
moodle/ question/ format/ examview/ 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/ examview/ format.php, line 238
Class
Code
function parse_co($qrec, $question) {
$question->usecase = 0;
$answer = trim($this
->unxmlise($qrec['answer'][0]['#']));
$answer = strip_tags($answer);
$answers = explode("\n", $answer);
foreach ($answers as $key => $value) {
$value = trim($value);
if (strlen($value) > 0) {
$question->answer[$key] = addslashes($value);
$question->fraction[$key] = 1;
$question->feedback[$key] = "Correct";
}
}
return $question;
}