You are here

function theme_quiz_dashboard_get_basic_stats in Quiz 6.6

1 theme call to theme_quiz_dashboard_get_basic_stats()
quiz_dashboard_get_basic_stats in includes/quiz_dashboard/quiz_dashboard.admin.inc

File

includes/quiz_dashboard/quiz_dashboard.admin.inc, line 411

Code

function theme_quiz_dashboard_get_basic_stats($results = array()) {
  $header = $rows = array();

  //$title_link = user_access('access author dashboard') ? 'admin/quiz/reports/dashboard/creator/'. $result['nid'] .'/view' : 'user/%/dashboard/%/view'; .
  $title_link = user_access('access author dashboard') ? 'admin/quiz/reports/dashboard/creator/' : 'user/' . arg(1) . '/dashboard/';
  if (empty($results)) {
    return '<p>' . t('No questions were found.') . '</p>';
  }
  $header = array(
    'nid' => t('Quiz Nid <br/> <h6> Link to Quiz </h6>'),
    'title' => t('Title <br/> <h6> Link to Report </h6>'),
    'creator' => t('Author Name <h6> Link to Profile </h6>'),
    'created' => t('Create Date'),
    'questions_count' => user_access('access author dashboard') ? t('Questions Count') : t(''),
    'attempt_count' => user_access('access author dashboard') ? t('Attempt Count') : t(''),
  );
  foreach ($results as $result) {
    $rows[] = array(
      'nid' => l($result['nid'], 'node/' . $result['nid']),
      'title' => l($result['title'], $title_link . $result['nid'] . '/view'),
      'creator' => l($result['name'], 'user/' . $result['uid']),
      'created' => format_date($result['created'], 'small'),
      'questions_count' => user_access('access author dashboard') ? _quiz_get_questions_count($result['nid']) : t(''),
      'attempt_count' => user_access('access author dashboard') ? _quiz_get_attempt_count($result['nid']) : t(''),
    );
  }
  module_load_include('inc', 'quiz', 'quiz.pages');

  // FIX IT need to get community feedback.

  //quiz_add_table_sorter();

  // quiz_add_table_sorter(); function defined in quiz.page.inc includes css and js for jQuery table sorter.
  return theme('table', $header, $rows, array(
    'id' => 'tablesorter',
  ));
}