function quiz_nodeapi in Quiz 6.4
Same name and namespace in other branches
- 6.6 quiz.module \quiz_nodeapi()
- 6.3 quiz.module \quiz_nodeapi()
- 6.5 quiz.module \quiz_nodeapi()
Implementation of hook_nodeapi()
File
- ./
quiz.module, line 1373 - Quiz Module
Code
function quiz_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
// We need to filter on node type to prevent this from overriding any other
// node.
if ($node->type == 'quiz') {
switch ($op) {
case 'presave':
// Convert the action id to the actual id from the MD5 hash.
// Why the actions module does this I do not know? Maybe to prevent
// invalid values put into the options value="" field.
if ($aid = actions_function_lookup($node->aid)) {
$node->aid = $aid;
}
if (variable_get('quiz_auto_revisioning', 1)) {
$node->revision = quiz_has_been_answered($node) ? 1 : 0;
}
break;
case 'prepare':
// Meet E_STRICT on new nodes.
$defaults = _quiz_get_node_defaults();
if (!isset($node->nid)) {
foreach ($defaults as $key => $value) {
if (!isset($node->{$key})) {
$node->{$key} = $value;
}
}
}
break;
}
}
if (isset($node->is_quiz_question)) {
if (variable_get('quiz_auto_revisioning', 1) && $op == 'presave') {
$node->revision = quiz_question_has_been_answered($node) ? 1 : 0;
}
}
}