You are here

function ad_channel_admin_overview in Advertisement 5.2

Same name and namespace in other branches
  1. 6.3 channel/ad_channel.module \ad_channel_admin_overview()
  2. 6.2 channel/ad_channel.module \ad_channel_admin_overview()
  3. 7 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 361
Ad Channel

Code

function ad_channel_admin_overview() {

  // Stay consistent with other advertisement adminsitrative pages, and display
  // a warning if something is not configured properly.
  _ad_check_install();
  drupal_add_css(drupal_get_path('module', 'ad_channel') . '/ad_channel.css');
  $containers = _ad_channel_get_containers();
  if (count($containers)) {
    $header = array(
      t('Name'),
      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' => 2,
          ),
        );
      }
      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";
        $rows[] = array(
          array(
            'data' => $description,
            '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;
}