public function QuizQuestionResponse::getMaxScore in Quiz 7.5
Same name and namespace in other branches
- 6.4 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getMaxScore()
- 7.6 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getMaxScore()
- 7 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getMaxScore()
- 7.4 question_types/quiz_question/quiz_question.core.inc \QuizQuestionResponse::getMaxScore()
Get the max score of this question response.
Parameters
bool $weight_adjusted: If the max score should be scaled based on the Quiz question max score.
Return value
int The max score of this question response.
6 calls to QuizQuestionResponse::getMaxScore()
- LongAnswerResponse::getFeedbackValues in question_types/
long_answer/ long_answer.classes.inc - Implementation of getFeedbackValues().
- QuizQuestionResponse::getReportFormScore in question_types/
quiz_question/ quiz_question.core.inc - Implementation of getReportFormScore().
- QuizQuestionResponse::getReportFormValidate in question_types/
quiz_question/ quiz_question.core.inc - Get the validate function for the reportForm.
- QuizQuestionResponse::getWeightedRatio in question_types/
quiz_question/ quiz_question.core.inc - Get the weighted score ratio.
- QuizQuestionResponse::isCorrect in question_types/
quiz_question/ quiz_question.core.inc - Check to see if the answer is marked as correct.
1 method overrides QuizQuestionResponse::getMaxScore()
- QuizQuestionResponseBroken::getMaxScore in question_types/
quiz_question/ quiz_question.core.inc
File
- question_types/
quiz_question/ quiz_question.core.inc, line 619 - Classes used in the Quiz Question module.
Class
- QuizQuestionResponse
- Each question type must store its own response data and be able to calculate a score for that data.
Code
public function getMaxScore($weight_adjusted = TRUE) {
if ($weight_adjusted) {
$quiz_result = quiz_result_load($this->result_id);
$relationships = entity_load('quiz_question_relationship', FALSE, array(
'parent_nid' => $quiz_result->nid,
'parent_vid' => $quiz_result->vid,
'child_nid' => $this->question->nid,
'child_vid' => $this->question->vid,
));
if ($relationships) {
// This is the weighted max score of the question.
return reset($relationships)->max_score;
}
$quiz = node_load($quiz_result->nid);
if ($quiz->randomization == 2) {
// This isn't necessary, since setting a max score for random questions
// updates them all.
}
if ($quiz->randomization == 3) {
$max_score = db_select('quiz_terms', 'qt')
->fields('qt', array(
'max_score',
))
->condition('tid', $this->tid)
->condition('nid', $quiz_result->nid)
->condition('vid', $quiz_result->vid)
->execute()
->fetchField();
return $max_score;
}
}
return $this->quizQuestion
->getMaximumScore();
}