public function QuizQuestion::getParentQuiz in OG Quiz 7
Fetch the parent quiz.
Return value
stdClass|null
1 call to QuizQuestion::getParentQuiz()
- QuizQuestion::checkContextAccess in includes/
og_quiz_question.php - Check user permissions based on the context (inside a group or global).
File
- includes/
og_quiz_question.php, line 124 - Classes used in the Quiz Question module.
Class
- QuizQuestion
- A base implementation of a quiz_question, adding a layer of abstraction between the node API, quiz API and the question types.
Code
public function getParentQuiz() {
if (isset($this->node->nid)) {
$quiz = db_select('quiz_node_relationship', 'r')
->fields('r', array(
'parent_nid',
'parent_vid',
))
->condition('child_nid', $this->node->nid)
->condition('child_vid', $this->node->vid)
->execute()
->fetchObject();
if (isset($quiz->nid)) {
return node_load($quiz->nid, $quiz->vid);
}
}
if (isset($_GET['quiz_nid']) && isset($_GET['quiz_vid'])) {
return node_load($_GET['quiz_nid'], $_GET['quiz_vid']);
}
return NULL;
}