public static function ShortAnswerResponse::fetchAllUnscoredAnswers in Quiz 6.4
Same name and namespace in other branches
- 6.6 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::fetchAllUnscoredAnswers()
- 6.3 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::fetchAllUnscoredAnswers()
- 6.5 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::fetchAllUnscoredAnswers()
- 7.6 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::fetchAllUnscoredAnswers()
- 7 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::fetchAllUnscoredAnswers()
- 7.4 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::fetchAllUnscoredAnswers()
Get all quiz scores that haven't been evaluated yet.
Parameters
$count: Number of items to return (default: 50).
$offset: Where in the results we should start (default: 0).
Return value
Array of objects describing unanswered questions. Each object will have result_id, question_nid, and question_vid.
1 call to ShortAnswerResponse::fetchAllUnscoredAnswers()
- short_answer_view_unscored in question_types/
short_answer/ short_answer.admin.inc - Generate a view of all unscored short_answer questions.
File
- question_types/
short_answer/ short_answer.classes.inc, line 263 - The main classes for the short answer question type.
Class
- ShortAnswerResponse
- Extension of QuizQuestionResponse
Code
public static function fetchAllUnscoredAnswers($count = 50, $offset = 0) {
global $user;
$sql = 'SELECT a.result_id, a.question_nid, a.question_vid, a.answer_feedback, r.title, qnr.time_end, qnr.time_start, qnr.uid
FROM {quiz_short_answer_user_answers} AS a
INNER JOIN {node_revisions} r ON a.question_vid = r.vid
INNER JOIN {quiz_node_results} qnr ON a.result_id = qnr.result_id
JOIN {node} n ON qnr.nid = n.nid
WHERE a.is_evaluated = 0';
if (!user_access('score any quiz')) {
$sql .= ' AND n.uid = %d';
}
$results = db_query_range(db_rewrite_sql($sql), $user->uid, $offset, $count);
$unscored = array();
if ($results) {
while ($row = db_fetch_object($results)) {
$unscored[] = $row;
}
}
return $unscored;
}