You are here

function ad_channel_menu in Advertisement 5.2

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

Implementation of hook_menu.

File

channel/ad_channel.module, line 42
Ad Channel

Code

function ad_channel_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/content/ad/channel',
      'title' => t('Channels'),
      'callback' => 'ad_channel_admin_overview',
      'type' => MENU_LOCAL_TASK,
      'weight' => 6,
    );
    $items[] = array(
      'path' => 'admin/content/ad/channel/list',
      'title' => t('List'),
      'callback' => 'ad_channel_admin_overview',
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => 0,
    );
    $items[] = array(
      'path' => 'admin/content/ad/channel/container',
      'title' => t('Create container'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'ad_channel_admin_container',
      ),
      'type' => MENU_LOCAL_TASK,
      'weight' => 2,
    );
    $items[] = array(
      'path' => 'admin/content/ad/channel/channel',
      'title' => t('Create channel'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'ad_channel_admin_channel',
      ),
      'type' => MENU_LOCAL_TASK,
      'weight' => 4,
    );
    $items[] = array(
      'path' => 'admin/content/ad/channel/settings',
      'title' => t('Settings'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'ad_channel_admin_settings',
      ),
      'type' => MENU_LOCAL_TASK,
      'weight' => 9,
    );
  }
  else {
    if (arg(3) == 'channel' && is_numeric(arg(5))) {
      if (arg(4) == 'container') {
        $conid = arg(5);
        if ($conid == 0) {

          // Can't update the default container, as it doesn't really exist.
          drupal_goto('admin/content/ad/channel');
        }
      }
      else {
        if (arg(4) == 'channel') {
          $chid = arg(5);
          if ($chid == 0) {

            // No such channel.
            drupal_goto('admin/content/ad/channel');
          }
        }
      }
      $items[] = array(
        'path' => "admin/content/ad/channel/container/{$conid}",
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'ad_channel_admin_container',
          $conid,
        ),
        'type' => MENU_LOCAL_TASK,
      );
      $items[] = array(
        'path' => "admin/content/ad/channel/container/{$conid}/delete",
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'ad_channel_admin_confirm_delete_container',
          $conid,
        ),
        'type' => MENU_CALLBACK,
      );
      $items[] = array(
        'path' => "admin/content/ad/channel/channel/{$chid}",
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'ad_channel_admin_channel',
          $chid,
        ),
        'type' => MENU_LOCAL_TASK,
      );
      $items[] = array(
        'path' => "admin/content/ad/channel/channel/{$chid}/delete",
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'ad_channel_admin_confirm_delete_channel',
          $chid,
        ),
        'type' => MENU_CALLBACK,
      );
    }
  }
  return $items;
}