You are here

function theme_quiz_get_user_results in Quiz 5

Same name and namespace in other branches
  1. 8.4 quiz.pages.inc \theme_quiz_get_user_results()
  2. 5.2 quiz.module \theme_quiz_get_user_results()
  3. 6.6 quiz.pages.inc \theme_quiz_get_user_results()
  4. 6.2 quiz.pages.inc \theme_quiz_get_user_results()
  5. 6.3 quiz.pages.inc \theme_quiz_get_user_results()
  6. 6.4 quiz.pages.inc \theme_quiz_get_user_results()
  7. 6.5 quiz.pages.inc \theme_quiz_get_user_results()
  8. 7 quiz.pages.inc \theme_quiz_get_user_results()
  9. 7.4 quiz.pages.inc \theme_quiz_get_user_results()

Theme the user results page

Parameters

$results: An array of quiz information

Return value

Themed html

1 theme call to theme_quiz_get_user_results()
quiz_get_user_results in ./quiz.module
Displays all the quizs the user has taken part in

File

./quiz.module, line 1579
Quiz Module

Code

function theme_quiz_get_user_results($results) {
  $output = '';
  $rows = array();
  while (list($key, $result) = each($results)) {
    $rows[] = array(
      l('view', 'user/quiz/' . $result['rid'] . '/userresults'),
      check_plain($result['title']),
      check_plain($result['name']),
      $result['rid'],
      format_date($result['time_start'], 'small'),
      $result['time_end'] > 0 ? format_date($result['time_end'], 'small') : t('In Progress'),
    );
  }
  $header = array(
    t('Action'),
    t('@quiz Title', array(
      '@quiz' => QUIZ_NAME,
    )),
    t('Username'),
    t('Result<br />ID'),
    t('Time Started'),
    t('Finished?'),
  );
  if (!empty($rows)) {
    $output .= theme('table', $header, $rows);
  }
  else {
    $output .= t('No @quiz results found.', array(
      '@quiz' => QUIZ_NAME,
    ));
  }
  return $output;
}