'mtf' => 99,
'nr' => NUMERICAL,
'pr' => 99,
- 'es' => 99,
+ 'es' => ESSAY,
'ca' => 99,
'ot' => 99,
- 'sa' => ESSAY
+ 'sa' => SHORTANSWER
);
public $matching_questions = array();
return;
}
foreach ($matching_groups as $match_group) {
- $newgroup = null;
+ $newgroup = new stdClass();
$groupname = trim($match_group['@']['name']);
$questiontext = $this->unxmlise($match_group['#']['text'][0]['#']);
$newgroup->questiontext = trim($questiontext);
$phrase = trim($this->unxmlise($qrec['text']['0']['#']));
$answer = trim($this->unxmlise($qrec['answer']['0']['#']));
$answer = strip_tags( $answer );
- $match_group->subquestions[] = $this->text_field($phrase);
+ $match_group->subquestions[] = $phrase;
$match_group->subanswers[] = $match_group->subchoices[$answer];
$this->matching_questions[$groupname] = $match_group;
return null;
$question->subanswers = array();
foreach ($match_group->subquestions as $key => $value) {
$htmltext = s($value);
- $question->subquestions[] = $htmltext;
+ $question->subquestions[] = $this->text_field($htmltext);
$htmltext = s($match_group->subanswers[$key]);
$question->subanswers[] = $htmltext;
$question = $this->parse_co($qrec['#'], $question);
break;
case ESSAY:
- $question = $this->parse_sa($qrec['#'], $question);
+ $question = $this->parse_es($qrec['#'], $question);
break;
case NUMERICAL:
$question = $this->parse_nr($qrec['#'], $question);
return $question;
}
- protected function parse_sa($qrec, $question) {
+ protected function parse_es($qrec, $question) {
$feedback = trim($this->unxmlise($qrec['answer'][0]['#']));
+ $question->graderinfo = $this->text_field($feedback);
$question->feedback = $feedback;
+ $question->responseformat = 'editor';
+ $question->responsefieldlines = 15;
+ $question->attachments = 0;
$question->fraction = 0;
return $question;
}
$question->answer[$key] = $value;
$question->fraction[$key] = 1;
$question->feedback[$key] = $this->text_field("Correct");
- $question->min[$key] = $question->answer[$key] - $errormargin;
- $question->max[$key] = $question->answer[$key] + $errormargin;
+ $question->tolerance[$key] = $errormargin;
}
}
return $question;