function theme_quiz_result in Quiz 7.6
Theme the result page.
Parameters
$quiz: The quiz node object.
$questions: The questions array as defined by _quiz_get_answers.
$score: Array of score information as returned by quiz_calculate_score().
$summary: Filtered text of the summary.
Return value
Themed html.
1 theme call to theme_quiz_result()
- quiz_user_results in ./
quiz.pages.inc - Show result page for a given result id
File
- ./
quiz.pages.inc, line 402 - User pages.
Code
function theme_quiz_result($variables) {
global $user;
$quiz = $variables['quiz'];
$questions = $variables['questions'];
$score = $variables['score'];
$summary = $variables['summary'];
$quiz_result = quiz_result_load($variables['result_id']);
$account = $variables['account'];
if (!$score['is_evaluated']) {
$msg = t('Parts of this @quiz have not been evaluated yet. The score below is not final.', array(
'@quiz' => QUIZ_NAME,
));
drupal_set_message($msg, 'warning');
}
// Display overall result.
$output = '';
$params = array(
'%num_correct' => $score['numeric_score'],
'%question_count' => $score['possible_score'],
'!username' => $user->uid == $account->uid ? t('You') : theme('username', array(
'account' => $account,
)),
'@score' => $score['percentage_score'],
'!yourtotal' => $user->uid == $account->uid ? t('Your') : t('Total'),
);
$score_out = '';
if (quiz_feedback_can_review('score', $quiz_result)) {
// Show score.
$score_out .= '<div id="quiz_score_possible">' . t('!username got %num_correct of %question_count possible points.', $params) . '</div>' . "\n";
$score_out .= '<div id="quiz_score_percent">' . t('!yourtotal score: @score%', $params) . '</div>';
}
$report_form = drupal_get_form('quiz_report_form', $questions, $quiz_result->result_id);
$quiz_feedback['#markup'] = '';
if (quiz_feedback_can_review('quiz_feedback', $quiz_result)) {
// Show quiz feedback.
if (!empty($summary['passfail'])) {
$quiz_feedback['#markup'] .= '<div id="quiz-summary">' . $summary['passfail'] . '</div>';
}
if (!empty($summary['result'])) {
$quiz_feedback['#markup'] .= '<div id="quiz-summary">' . $summary['result'] . '</div>';
}
}
$report_form['quiz_feedback'] = $quiz_feedback;
$form = drupal_render($report_form);
return $score_out . $form;
}