You are here

function _quiz_get_attempt_count in Quiz 7

Same name and namespace in other branches
  1. 8.6 modules/quiz_stats/quiz_stats.admin.inc \_quiz_get_attempt_count()
  2. 8.4 modules/quiz_stats/quiz_stats.admin.inc \_quiz_get_attempt_count()
  3. 8.5 modules/quiz_stats/quiz_stats.admin.inc \_quiz_get_attempt_count()
  4. 6.6 includes/quiz_dashboard/quiz_dashboard.admin.inc \_quiz_get_attempt_count()
  5. 6.4 includes/quiz_stats/quiz_stats.admin.inc \_quiz_get_attempt_count()
  6. 7.6 modules/quiz_stats/quiz_stats.admin.inc \_quiz_get_attempt_count()
  7. 7.4 includes/quiz_stats/quiz_stats.admin.inc \_quiz_get_attempt_count()
  8. 7.5 modules/quiz_stats/quiz_stats.admin.inc \_quiz_get_attempt_count()
  9. 6.x modules/quiz_stats/quiz_stats.admin.inc \_quiz_get_attempt_count()

Computes quiz attempt count

Parameters

$vid: quiz node id

$uid: user id for filtering

Return value

Integer containing number of times that a quiz has been attended, can be filtered by uid.

1 call to _quiz_get_attempt_count()
theme_quiz_stats_get_basic_stats in includes/quiz_stats/quiz_stats.admin.inc
Generates table of results from quiz data structure.

File

includes/quiz_stats/quiz_stats.admin.inc, line 266
Administration file for Quiz stats Module

Code

function _quiz_get_attempt_count($nid, $uid = 0) {
  $sql = 'SELECT COUNT(result_id) FROM {quiz_node_results} WHERE nid = :nid';
  $arg[':nid'] = $nid;
  if ($uid != 0) {
    $sql .= ' AND uid = :uid';
    $arg[':uid'] = $uid;
  }
  return db_query($sql, $arg)
    ->fetchField();
}