You are here

function long_answer_get_answer in Quiz 6.5

Same name and namespace in other branches
  1. 8.4 question_types/long_answer/long_answer.module \long_answer_get_answer()
  2. 6.6 question_types/long_answer/long_answer.module \long_answer_get_answer()
  3. 6.3 question_types/long_answer/long_answer.module \long_answer_get_answer()
  4. 6.4 question_types/long_answer/long_answer.module \long_answer_get_answer()
  5. 7.6 question_types/long_answer/long_answer.module \long_answer_get_answer()
  6. 7 question_types/long_answer/long_answer.module \long_answer_get_answer()
  7. 7.4 question_types/long_answer/long_answer.module \long_answer_get_answer()

Set the answer for a question.

This stores a score for a long answer question and marks that question as having been evaluated.

Parameters

$nid: Node ID of question.

$vid: Version ID of question.

$rid: Result ID for the quiz results.

Return value

Assoc array An array if successful, or FALSE if no result could be found. The array contains the following properties: <code> answer_id; // The answer ID answer; // The full text of the answer is_evaluated; // 0 if the question has not been evaluated, 1 if it has score; // The score the evaluator gave the user; this should be 0 if is_evaluated is 0. question_vid question_nid result_id </code>

2 calls to long_answer_get_answer()
LongAnswerUnitTest::unitTestGetAnswer in question_types/long_answer/long_answer.test
long_answer_edit_score in question_types/long_answer/long_answer.admin.inc
Page handler for displaying a scoring form. This function is called directly from the menu router. It generates a form for scoring a quiz.

File

question_types/long_answer/long_answer.module, line 194
This module defines a long answer question type for quizzes.

Code

function long_answer_get_answer($question_nid, $question_vid, $result_id) {
  $sql = "SELECT answer_id, answer, is_evaluated, score, question_vid, question_nid, result_id \n    FROM {quiz_long_answer_user_answers} \n    WHERE question_nid = %d AND question_vid = %d AND result_id = %d";
  $results = db_query($sql, $question_nid, $question_vid, $result_id);
  if (!$results) {
    return FALSE;
  }
  return db_fetch_array($results);
}