You are here

function short_answer_edit_score in Quiz 6.5

Same name and namespace in other branches
  1. 8.4 question_types/short_answer/short_answer.admin.inc \short_answer_edit_score()
  2. 6.6 question_types/short_answer/short_answer.admin.inc \short_answer_edit_score()
  3. 6.3 question_types/short_answer/short_answer.admin.inc \short_answer_edit_score()
  4. 6.4 question_types/short_answer/short_answer.admin.inc \short_answer_edit_score()
  5. 7.6 question_types/short_answer/short_answer.admin.inc \short_answer_edit_score()
  6. 7 question_types/short_answer/short_answer.admin.inc \short_answer_edit_score()
  7. 7.4 question_types/short_answer/short_answer.admin.inc \short_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 'short_answer_edit_score'
short_answer_menu in question_types/short_answer/short_answer.module
Implementation of hook_menu().

File

question_types/short_answer/short_answer.admin.inc, line 30
short_answer.admin

Code

function short_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.
  $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 != 'short_answer') {
    drupal_not_found();
    return;
  }
  $answer = (object) short_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('short_answer_score_form', $node, $answer);
}