You are here

function ad_channel_admin_overview in Advertisement 7

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

Display containers and channels.

1 string reference to 'ad_channel_admin_overview'
ad_channel_menu in channel/ad_channel.module
Implementation of hook_menu.

File

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

Code

function ad_channel_admin_overview() {
  drupal_add_css(drupal_get_path('module', 'ad_channel') . '/ad_channel.css');
  $containers = _ad_channel_get_containers();
  $rows = array();
  if (count($containers)) {
    $header = array(
      t('Name'),
      t('Inventory'),
      t('Options'),
    );
    $output = '<div id="ad-channel">';
    foreach ($containers as $conid => $container) {
      $channels = _ad_channel_get_container_channels($conid);
      if ($conid > 0 || count($channels)) {
        if ($conid > 0) {
          $description = '<div class="name">' . l($container->name, "admin/content/ad/channel/container/{$conid}/edit") . "</div>\n";
        }
        else {
          $description = '<div class="name">' . $container->name . "</div>\n";
        }
        if ($container->description) {
          $description .= '<div class="description">' . filter_xss_admin($container->description) . "</div>\n";
        }
        $rows[] = array(
          array(
            'data' => $description,
            'class' => 'container',
            'colspan' => 3,
          ),
        );
      }
      foreach ($channels as $chid => $channel) {
        $description = "<div style=\"margin-left: 30px;\">\n";
        $description .= ' <div class="name">' . $channel->name . "</div>\n";
        if ($channel->description) {
          $description .= ' <div class="description">' . filter_xss_admin($channel->description) . "</div>\n";
        }
        $description .= "</div>\n";
        $inventory = ' <div class="inventory">' . $channel->inventory . "</div>\n";
        $rows[] = array(
          array(
            'data' => $description,
            'class' => 'channel',
          ),
          array(
            'data' => $inventory,
            'class' => 'channel',
          ),
          l(t('edit'), "admin/content/ad/channel/channel/{$channel->chid}/edit") . '&nbsp;&nbsp;&nbsp;' . l(t('delete'), "admin/content/ad/channel/channel/{$channel->chid}/delete"),
        );
      }
    }
    $output .= theme('table', $header, $rows);
    $output .= '</div>';
  }
  return $output;
}