function short_answer_edit_score in Quiz 6.4
Same name and namespace in other branches
- 8.4 question_types/short_answer/short_answer.admin.inc \short_answer_edit_score()
- 6.6 question_types/short_answer/short_answer.admin.inc \short_answer_edit_score()
- 6.3 question_types/short_answer/short_answer.admin.inc \short_answer_edit_score()
- 6.5 question_types/short_answer/short_answer.admin.inc \short_answer_edit_score()
- 7.6 question_types/short_answer/short_answer.admin.inc \short_answer_edit_score()
- 7 question_types/short_answer/short_answer.admin.inc \short_answer_edit_score()
- 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) {
$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 = short_answer_get_answer($node->nid, $node->vid, $rid);
if (!$answer) {
drupal_not_found();
return;
}
if ($node->max_score > 0) {
$answer->rel_score = round($answer->score * $answer->rel_max_score / $node->max_score);
}
else {
$answer->rel_score = 0;
}
drupal_set_title(t('Score answer to "@title"', array(
'@title' => $node->title,
)));
return drupal_get_form('short_answer_score_form', $node, $answer);
}