You are here

function _quiz_redirect_if_empty in Quiz 6.4

Same name and namespace in other branches
  1. 7 quiz.module \_quiz_redirect_if_empty()

Redirects to the manage questions tab if the quiz has no questions.

Parameters

$node: Quiz node.

2 calls to _quiz_redirect_if_empty()
quiz_insert in ./quiz.module
Implementation of hook_insert().
quiz_update in ./quiz.module
Implementation of hook_update().

File

./quiz.module, line 3960
Quiz Module

Code

function _quiz_redirect_if_empty($node) {
  $sql = 'SELECT child_vid
          FROM {quiz_node_relationship}
          WHERE parent_vid = %d';
  $res = db_query($sql, $node->vid);
  if (!($res_o = db_fetch_object($res))) {
    $_REQUEST['destination'] = 'node/' . $node->nid . '/questions';
  }
}