You are here

function theme_quiz_admin in Quiz 5.2

Same name and namespace in other branches
  1. 5 quiz.module \theme_quiz_admin()
  2. 6.6 quiz.admin.inc \theme_quiz_admin()
  3. 6.2 quiz.admin.inc \theme_quiz_admin()
  4. 6.3 quiz.admin.inc \theme_quiz_admin()
  5. 6.5 quiz.admin.inc \theme_quiz_admin()

Theme the admin results table.

Parameters

$results: As returned by _quiz_get_results().

1 theme call to theme_quiz_admin()
quiz_admin in ./quiz.module
Quiz Admin.

File

./quiz.module, line 2113

Code

function theme_quiz_admin($results) {
  $output = '';
  $rows = array();
  while (list($key, $result) = each($results)) {
    $rows[] = array(
      l('view', 'admin/quiz/' . $result['result_id'] . '/view') . ' | ' . l('delete', 'admin/quiz/' . $result['result_id'] . '/delete'),
      check_plain($result['title']),
      check_plain($result['name']),
      $result['result_id'],
      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;
}