function theme_multichoice_response in Quiz 6.4
Same name and namespace in other branches
- 8.4 question_types/multichoice/multichoice.theme.inc \theme_multichoice_response()
- 7 question_types/multichoice/theme/multichoice.theme.inc \theme_multichoice_response()
- 7.4 question_types/multichoice/theme/multichoice.theme.inc \theme_multichoice_response()
Theme function for the multichoice report
Parameters
$data: Array of data to be presented in the report
1 theme call to theme_multichoice_response()
- MultichoiceResponse::getReportFormResponse in question_types/
multichoice/ multichoice.classes.inc - Implementation of getReportFormResponse
File
- question_types/
multichoice/ theme/ multichoice.theme.inc, line 80 - The theme file for multichoice.
Code
function theme_multichoice_response($data) {
$rows = array();
$p = drupal_get_path('module', 'multichoice') . '/theme/images';
foreach ($data as $id => $alternative) {
$cols = array();
$rowspan = drupal_strlen($alternative['feedback']) > 0 ? 2 : 1;
$not = '';
if ($alternative['is_chosen']) {
switch ($alternative['is_correct']) {
case 0:
$cols[] = array(
'data' => theme('image', "{$p}/wrong.png", t('Wrong'), t('This answer is wrong'), array(
'class' => 'feedback-icon',
)),
'width' => 35,
'rowspan' => $rowspan,
'class' => 'selector-td',
);
break;
case 1:
$cols[] = array(
'data' => theme('image', "{$p}/almost.png", t('Almost correct'), t('This answer is correct, but there is an answer that gives a higher score'), array(
'class' => 'feedback-icon',
)),
'width' => 35,
'rowspan' => $rowspan,
'class' => 'selector-td',
);
break;
case 2:
$cols[] = array(
'data' => theme('image', "{$p}/correct.png", t('Correct'), t('This answer is correct'), array(
'class' => 'feedback-icon',
)),
'width' => 35,
'rowspan' => $rowspan,
'class' => 'selector-td',
);
break;
}
}
else {
if ($alternative['is_correct'] == 2) {
$cols[] = array(
'data' => theme('image', "{$p}/should.png", t('Should have chosen'), t("This answer is correct, but you didn't choose it"), array(
'class' => 'feedback-icon',
)),
'width' => 35,
'rowspan' => $rowspan,
'class' => 'selector-td',
);
}
else {
$cols[] = array(
'data' => '',
'width' => 35,
'rowspan' => $rowspan,
'class' => 'selector-td',
);
}
}
$cols[] = $alternative['answer'];
$rows[] = $cols;
if ($rowspan == 2) {
$rows[] = array(
'<strong>' . t('Feedback:') . '</strong><div class="quiz_answer_feedback">' . $alternative['feedback'] . '</div>',
);
}
}
return theme('table', NULL, $rows);
}