function qformat_xml::import_answer in Quiz 6.6
Same name and namespace in other branches
- 6.5 includes/moodle/question/format/xml/format.php \qformat_xml::import_answer()
import the common parts of a single answer
Parameters
array answer xml tree for single answer:
Return value
object answer object
2 calls to qformat_xml::import_answer()
- qformat_xml::import_multichoice in includes/
moodle/ question/ format/ xml/ format.php - import multiple choice question
- qformat_xml::import_shortanswer in includes/
moodle/ question/ format/ xml/ format.php - import short answer type question
File
- includes/
moodle/ question/ format/ xml/ format.php, line 153
Class
Code
function import_answer($answer) {
$fraction = $this
->getpath($answer, array(
'@',
'fraction',
), 0);
$text = $this
->getpath($answer, array(
'#',
'text',
0,
'#',
), '', true);
$feedback = $this
->getpath($answer, array(
'#',
'feedback',
0,
'#',
'text',
0,
'#',
), '', true);
$ans = null;
$ans->answer = $text;
$ans->fraction = $fraction / 100;
$ans->feedback = $feedback;
return $ans;
}