You are here

function _ad_channel_load_node in Advertisement 7

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

Load channels associated with specified node.

1 call to _ad_channel_load_node()
ad_channel_nodeapi in channel/ad_channel.module
Implementation of hook_nodeapi().

File

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

Code

function _ad_channel_load_node($node) {
  $result = db_query('SELECT chid FROM {ad_channel_node} WHERE nid = %d', $node->nid);
  $output['channel'] = array();
  while ($chid = $result
    ->fetch()) {
    $output['channel'][$chid->chid] = $chid->chid;
  }

  // currently 0 or 1, with one being a 'premiere' advertisement.
  $output['premiere'] = (int) db_query('SELECT priority FROM {ad_priority} WHERE aid = %d', $node->nid)
    ->fetchField();
  $output['remnant'] = (int) db_query('SELECT remnant FROM {ad_channel_remnant} WHERE aid = %d', $node->nid)
    ->fetchField();
  return $output;
}