You are here

function theme_matching_response in Quiz 7.5

Same name and namespace in other branches
  1. 8.6 question_types/quiz_matching/theme/matching.theme.inc \theme_matching_response()
  2. 8.4 question_types/matching/matching.theme.inc \theme_matching_response()
  3. 8.5 question_types/quiz_matching/theme/matching.theme.inc \theme_matching_response()
  4. 6.4 question_types/matching/theme/matching.theme.inc \theme_matching_response()
  5. 7.6 question_types/matching/theme/matching.theme.inc \theme_matching_response()
  6. 7 question_types/matching/theme/matching.theme.inc \theme_matching_response()
  7. 7.4 question_types/matching/theme/matching.theme.inc \theme_matching_response()

Theme the contents of the matching response form.

Parameters

$variables:

Return value

string An HTML string.

File

question_types/matching/theme/matching.theme.inc, line 85
Theme functions for the matching question type.

Code

function theme_matching_response($variables) {
  $metadata = $variables['metadata'];
  $data = $variables['data'];
  if (isset($data[0]['is_correct'])) {
    foreach ($data as $id => $match_data) {
      if ($match_data['is_correct'] == 0) {
        $theme = 'quiz_score_incorrect';
      }
      if ($match_data['is_correct'] == 1) {
        $theme = 'quiz_score_correct';
      }
      if ($match_data['is_correct'] == 2) {
        $theme = 'quiz_score_unknown';
      }

      // TODO Please change this theme call to use an associative array for the $variables parameter.
      $data[$id]['is_correct'] = array(
        'data' => theme($theme),
        'class' => 'quiz-summary-qcell',
      );
    }
  }
  return theme('table', array(
    'header' => $metadata,
    'rows' => $data,
  ));
}