You are here

function ad_weight_probability_nodeapi in Advertisement 6.3

Same name and namespace in other branches
  1. 5.2 weight/probability/ad_weight_probability.module \ad_weight_probability_nodeapi()
  2. 6.2 weight/probability/ad_weight_probability.module \ad_weight_probability_nodeapi()
  3. 7 weight/probability/ad_weight_probability.module \ad_weight_probability_nodeapi()

Implementation of hook_nodeapi().

File

weight/probability/ad_weight_probability.module, line 59
A plug in for the ad.module, allowing an admin to set the probability that a given advertisement will be displayed.

Code

function ad_weight_probability_nodeapi($node, $op, $arg = 0) {
  switch ($op) {
    case 'load':
      return _ad_weight_probability_node_load($node);
    case 'insert':
    case 'update':
      if (user_access('configure ad probability')) {
        if (is_object($node) && isset($node->adtype) && isset($node->probability) && isset($node->nid)) {
          return _ad_weight_probability_node_save($node, $op);
        }
      }
      break;
    case 'delete':
      return _ad_weight_probability_node_delete($node);
  }
}