You are here

function _quiz_results_mr_data_provider in Quiz 7

Same name and namespace in other branches
  1. 8.4 quiz.admin.inc \_quiz_results_mr_data_provider()
  2. 6.4 quiz.admin.inc \_quiz_results_mr_data_provider()
  3. 7.4 quiz.admin.inc \_quiz_results_mr_data_provider()

Parameters

$header: header array for theme_table

$quiz: The quiz node

Return value

Query result set

1 call to _quiz_results_mr_data_provider()
quiz_results_manage_results_form in ./quiz.admin.inc
Form for searching after and manipulating results for a quiz

File

./quiz.admin.inc, line 2282
Administrator interface for Quiz module.

Code

function _quiz_results_mr_data_provider($header, $quiz) {
  $filter = _quiz_results_mr_prepare_filter($quiz);
  $sql = "SELECT u.name, qnrs.uid, qnrs.result_id, qnrs.score, qnrs.is_evaluated AS evaluated, qnrs.time_start as started, qnrs.time_end as finished, qnp.pass_rate, qnrs.time_end - qnrs.time_start as duration\n          FROM {quiz_node_results} qnrs\n          LEFT JOIN {users} u ON u.uid = qnrs.uid\n          LEFT JOIN {quiz_node_properties} qnp ON qnrs.vid = qnp.vid\n          " . $filter['join'] . "\n          WHERE qnrs.nid = :quiz_nid " . $filter['where'] . $filter['group'];

  // . tablesort_sql($header) . ', qnrs.result_id DESC';

  //echo $sql;exit;
  return db_query($sql, array(
    ':quiz_nid' => $quiz->nid,
  ));

  /*
  // We remove the links to the last page and use a custom query to fetch the number of pages
  // Doing this we wastly improve performance
  $page = isset($_GET['page']) ? intval($_GET['page']) : 0;
  $num = 50;
  $pager_sql = "SELECT COUNT(*) FROM (
                SELECT qnrs.result_id
                FROM {quiz_node_results} qnrs
                LEFT JOIN {users} u ON u.uid = qnrs.uid
                LEFT JOIN {quiz_node_properties} qnp ON qnrs.vid = qnp.vid
                " . $filter['join'] . "
                WHERE  qnrs.nid = %d " . $filter['where'] . $filter['group'] . ' LIMIT 0, ' . max($page * $num + $num * 7, $num * 10) . ") tbl";

  return pager_query($sql, $num, 0, $pager_sql, $filter['params']);
  */
}