You are here

public function QuizQuestionResponse::getParentQuiz in OG Quiz 7

Fetch the parent quiz.

Return value

stdClass|null

1 call to QuizQuestionResponse::getParentQuiz()
QuizQuestionResponse::quizContextAccessToScore in includes/og_quiz_question.php
Helper function to determine if a user has access to score a quiz.

File

includes/og_quiz_question.php, line 870
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 getParentQuiz() {
  if (isset($this->question->nid)) {
    $quiz = db_select('quiz_node_relationship', 'r')
      ->fields('r', array(
      'parent_nid',
      'parent_vid',
    ))
      ->condition('child_nid', $this->question->nid)
      ->condition('child_vid', $this->question->vid)
      ->execute()
      ->fetchObject();
    if (isset($quiz->nid)) {
      return node_load($quiz->nid, $quiz->vid);
    }
  }
  return NULL;
}