function qformat_blackboard_6::process_tf in Quiz 6.5
Same name and namespace in other branches
- 6.6 includes/moodle/question/format/blackboard_6/format.php \qformat_blackboard_6::process_tf()
1 call to qformat_blackboard_6::process_tf()
- qformat_blackboard_6::readquestions in includes/
moodle/ question/ format/ blackboard_6/ format.php - Parses an array of lines into an array of questions, where each item is a question object as defined by readquestion(). Questions are defined as anything between blank lines.
File
- includes/
moodle/ question/ format/ blackboard_6/ format.php, line 572
Class
Code
function process_tf($quest, &$questions) {
$question = $this
->process_common($quest);
$question->qtype = TRUEFALSE;
$question->single = 1;
// Only one answer is allowed
// 0th [response] is the correct answer.
$responses = $quest->responses;
$correctresponse = $responses[0]->ident[0]['varequal'][0]['#'];
if ($correctresponse != 'false') {
$correct = true;
}
else {
$correct = false;
}
foreach ($quest->feedback as $fb) {
$fback->{$fb->ident} = $fb->text;
}
if ($correct) {
// true is correct
$question->answer = 1;
$question->feedbacktrue = addslashes($fback->correct);
$question->feedbackfalse = addslashes($fback->incorrect);
}
else {
// false is correct
$question->answer = 0;
$question->feedbacktrue = addslashes($fback->incorrect);
$question->feedbackfalse = addslashes($fback->correct);
}
$question->correctanswer = $question->answer;
$questions[] = $question;
}