You are here

function event_menu in Event 5

Same name and namespace in other branches
  1. 5.2 event.module \event_menu()

Implementation of hook_menu()

Related topics

File

./event.module, line 82

Code

function event_menu($may_cache) {
  global $user;
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'event',
      'title' => t('Events'),
      'callback' => 'event_page',
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'event/type',
      'title' => t('Filter by content type'),
      'callback' => 'event_type',
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'event/term',
      'title' => t('Filter by taxonomy'),
      'callback' => 'event_term',
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'event/feed',
      'title' => t('Event rss feed'),
      'callback' => 'event_feed',
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'event/dst',
      'title' => t('Event dst view'),
      'callback' => 'event_dst',
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'event/ical',
      'title' => t('Event ical feed'),
      'callback' => 'event_ical',
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/settings/event',
      'title' => t('Events'),
      'callback' => 'system_admin_menu_block_page',
      'description' => t('Set up how your site handles events.'),
      'access' => user_access('administer site configuration'),
    );
    $items[] = array(
      'path' => 'admin/settings/event/timezone',
      'title' => t('Timezone handling'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'event_admin_timezone_settings',
      ),
      'description' => t('Change how timezone information is saved and displayed.'),
      'access' => user_access('administer site configuration'),
    );
    $items[] = array(
      'path' => 'admin/settings/event/overview',
      'title' => t('Event overview'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'event_admin_overview_settings',
      ),
      'description' => t('Change how event summary information is displayed.'),
      'access' => user_access('administer site configuration'),
    );
  }
  else {
    drupal_add_css(EVENT_PATH . '/event.css');
    if (arg(0) == 'node' && is_numeric(arg(1))) {
      $type = db_result(db_query("SELECT type FROM {node} WHERE nid=%d", arg(1)));
      if (event_is_enabled($type)) {
        $items[] = array(
          'path' => 'node/' . arg(1) . '/ical',
          'title' => t('Event ical'),
          'callback' => 'event_node_ical',
          'access' => user_access('access content'),
          'type' => MENU_CALLBACK,
        );
      }
    }
  }
  return $items;
}