You are here

function weather_menu in Weather 5.6

Same name and namespace in other branches
  1. 5 weather.module \weather_menu()
  2. 6.5 weather.module \weather_menu()
  3. 7.3 weather.module \weather_menu()
  4. 7 weather.module \weather_menu()
  5. 7.2 weather.module \weather_menu()

Implementation of hook_menu().

File

./weather.module, line 67
Display <acronym title="METeorological Aerodrome Report">METAR</acronym> weather data from anywhere in the world

Code

function weather_menu($may_cache) {
  global $user;
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/settings/weather',
      'title' => t('Weather'),
      'description' => t('Configure the system-wide weather block and the default configuration for new locations.'),
      'callback' => 'weather_main_page',
      'callback arguments' => array(
        WEATHER_SYSTEM_BLOCK,
      ),
      'access' => user_access('administer site configuration'),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/settings/weather/edit',
      'title' => t('Edit location'),
      'description' => t('Configure the system-wide weather block.'),
      'callback' => 'weather_custom_block',
      'callback arguments' => array(
        WEATHER_SYSTEM_BLOCK,
      ),
      'access' => user_access('administer site configuration'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/settings/weather/delete',
      'title' => t('Delete location'),
      'description' => t('Delete a location from the system-wide weather block.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'weather_custom_block_delete_confirm',
        WEATHER_SYSTEM_BLOCK,
      ),
      'access' => user_access('administer site configuration'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/settings/weather/default',
      'title' => t('Default configuration'),
      'description' => t('Setup the default configuration for new locations.'),
      'callback' => 'weather_custom_block',
      'callback arguments' => array(
        WEATHER_DEFAULT_BLOCK,
      ),
      'access' => user_access('administer site configuration'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/settings/weather/places',
      'title' => t('Place'),
      'callback' => 'weather_get_places_xml',
      'access' => user_access('administer site configuration'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'user/' . $user->uid . '/weather',
      'title' => t('My weather'),
      'description' => t('Configure your custom weather block.'),
      'callback' => 'weather_main_page',
      'callback arguments' => array(
        $user->uid,
      ),
      'access' => user_access('administer custom weather block'),
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'user/' . $user->uid . '/weather/edit',
      'title' => t('Edit location'),
      'description' => t('Configure your custom weather block.'),
      'callback' => 'weather_custom_block',
      'callback arguments' => array(
        $user->uid,
      ),
      'access' => user_access('administer custom weather block'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'user/' . $user->uid . '/weather/delete',
      'title' => t('Delete location'),
      'description' => t('Delete a location from your custom weather block.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'weather_custom_block_delete_confirm',
        $user->uid,
      ),
      'access' => user_access('administer custom weather block'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'user/' . $user->uid . '/weather/places',
      'title' => t('Place'),
      'callback' => 'weather_get_places_xml',
      'access' => user_access('administer custom weather block'),
      'type' => MENU_CALLBACK,
    );
  }
  return $items;
}