You are here

function long_answer_edit_score in Quiz 6.3

Same name and namespace in other branches
  1. 8.4 question_types/long_answer/long_answer.admin.inc \long_answer_edit_score()
  2. 6.6 question_types/long_answer/long_answer.admin.inc \long_answer_edit_score()
  3. 6.4 question_types/long_answer/long_answer.admin.inc \long_answer_edit_score()
  4. 6.5 question_types/long_answer/long_answer.admin.inc \long_answer_edit_score()
  5. 7.6 question_types/long_answer/long_answer.admin.inc \long_answer_edit_score()
  6. 7 question_types/long_answer/long_answer.admin.inc \long_answer_edit_score()
  7. 7.4 question_types/long_answer/long_answer.admin.inc \long_answer_edit_score()

Page handler for displaying a scoring form. This function is called directly from the menu router. It generates a form for scoring a quiz.

Parameters

$vid: The VID of the question and answer to load.

$rid: The result ID of the answer to load.

Return value

Text to display.

1 string reference to 'long_answer_edit_score'
long_answer_menu in question_types/long_answer/long_answer.module
Implementation of hook_menu().

File

question_types/long_answer/long_answer.admin.inc, line 46
Administration pages for the long answer questions module.

Code

function long_answer_edit_score($vid, $rid) {

  // We have to do the vid -> nid lookup ourselves because node_load uses only node.vid,
  // and we need to be able to access old nodes in node_revisions.vid. (BTW... why is node singular
  // and node_revisions plural?).
  $nid = db_result(db_query("SELECT nid FROM {node_revisions} WHERE vid = %d", $vid));
  if (!$nid) {
    drupal_not_found();
    return;
  }
  $node = node_load($nid, $vid);
  if (!$node || $node->type != 'long_answer') {
    drupal_not_found();
    return;
  }
  $answer = (object) long_answer_get_answer($node->nid, $node->vid, $rid);
  if (!$answer) {
    drupal_not_found();
    return;
  }
  drupal_set_title(t('Score answer to "@title"', array(
    '@title' => $node->title,
  )));
  return drupal_get_form('long_answer_score_form', $node, $answer);
}