You are here

function _ad_channel_view_node in Advertisement 6.3

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

Add channel information when viewing node.

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

File

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

Code

function _ad_channel_view_node($node) {
  if (isset($node->adtype) && user_access('administer channels')) {
    if (isset($node->channel) && is_array($node->channel) && !empty($node->channel)) {
      $channels = array();
      foreach ($node->channel as $chid) {
        $channel = _ad_channel_get_channels($chid);
        $channels[] = $channel->name;
      }
      $node->content['channel'] = array(
        '#value' => theme('box', t('Channels'), theme('item_list', $channels)),
        '#weight' => 1,
      );
    }
    if (isset($node->premiere)) {
      if (isset($node->premiere) && $node->premiere == 1) {
        $output = t('This is a premiere advertisement.');
      }
      else {
        $output = t('This is not a premiere advertisement.');
      }
      $node->content['premiere'] = array(
        '#value' => theme('box', t('Premiere'), $output),
        '#weight' => 1,
      );
    }
    if (isset($node->remnant)) {
      if (isset($node->remnant) && $node->remnant == 1) {
        $output = t('This is a remnant advertisement.');
        $node->content['remnant'] = array(
          '#value' => theme('box', t('Remnant'), $output),
          '#weight' => 1,
        );
      }
    }
  }
}