function _cloze_get_correct_answer in Cloze 6
Same name and namespace in other branches
- 7 cloze.module \_cloze_get_correct_answer()
1 call to _cloze_get_correct_answer()
- ClozeResponse::getReportFormResponse in ./
cloze.classes.inc - Implementation of getReportFormResponse
File
- ./
cloze.module, line 143
Code
function _cloze_get_correct_answer($question) {
$output = '';
$chunks = _cloze_get_question_chunks($question);
$answer = _cloze_get_correct_answer_chunks($question);
$correct_answer = array();
foreach ($chunks as $key => $chunk) {
if (isset($answer[$key])) {
$correct_answer[] = '<span class="answer correct correct-answer">' . $answer[$key] . '</span>';
}
else {
$correct_answer[] = $chunk;
}
}
$output = implode(' ', $correct_answer);
return str_replace("\n", "<br/>", $output);
}