You are here

function theme_quiz_admin in Quiz 5

Same name and namespace in other branches
  1. 5.2 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 1539
Quiz Module

Code

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