public static function TrueFalseResponse::viewsGetAnswers in Quiz 7.5
Get answers for a question in a result.
This static method assists in building views for the mass export of question answers.
Overrides QuizQuestionResponse::viewsGetAnswers
See also
views_handler_field_prerender_list for the expected return value.
File
- question_types/
truefalse/ truefalse.classes.inc, line 321 - TrueFalse classes.
Class
- TrueFalseResponse
- Extension of QuizQuestionResponse.
Code
public static function viewsGetAnswers(array $result_answer_ids = array()) {
$items = array();
foreach ($result_answer_ids as $result_answer_id) {
$ra = entity_load_single('quiz_result_answer', $result_answer_id);
$question = node_load($ra->question_nid, $ra->question_vid);
/* @var $ra_i QuizQuestionResponse */
$ra_i = _quiz_question_response_get_instance($ra->result_id, $question);
$items[$ra->result_id][] = array(
'answer' => $ra_i
->getResponse() ? t('True') : t('False'),
);
}
return $items;
}