You are here

function _ad_channel_get_enabled in Advertisement 6.3

Same name and namespace in other branches
  1. 5.2 channel/ad_channel.module \_ad_channel_get_enabled()
  2. 6.2 channel/ad_channel.module \_ad_channel_get_enabled()
  3. 7 channel/ad_channel.module \_ad_channel_get_enabled()

Retrive list of enabled channels from node object.

2 calls to _ad_channel_get_enabled()
_ad_channel_save_node in channel/ad_channel.module
Save channels associated with added or updated node.
_ad_channel_validate_nodes in channel/ad_channel.module
Be sure that the enabled channels actually can be enabled.

File

channel/ad_channel.module, line 796
Ad Channel module.

Code

function _ad_channel_get_enabled($node) {
  static $enabled = array();
  if (!isset($enabled[$node->nid])) {
    $enabled[$node->nid] = array();
    if (isset($node->channel) && is_array($node->channel) && !empty($node->channel)) {
      foreach ($node->channel as $conid => $channels) {
        foreach ($channels as $id => $enable) {
          if ($enable) {
            $chid = explode('-', $id);
            $enabled[$node->nid][] = $chid[1];
          }
        }
      }
    }
  }
  return $enabled[$node->nid];
}