You are here

function getlocations_menu in Get Locations 7

Same name and namespace in other branches
  1. 6.2 getlocations.module \getlocations_menu()
  2. 6 getlocations.module \getlocations_menu()
  3. 7.2 getlocations.module \getlocations_menu()

Implements hook_menu().

File

./getlocations.module, line 82
getlocations.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function getlocations_menu() {
  $items = array();
  $items[GETLOCATIONS_ADMIN_PATH] = array(
    'title' => 'Getlocations',
    'description' => 'Configure Getlocations',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'getlocations_settings_form',
    ),
    'access arguments' => array(
      'administer site configuration',
    ),
    'type' => MENU_NORMAL_ITEM,
    'file' => 'getlocations.admin.inc',
  );
  $items[GETLOCATIONS_ADMIN_PATH . '/base'] = array(
    'title' => 'Base',
    'description' => 'Getlocations base configuration',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'getlocations_settings_form',
    ),
    'access arguments' => array(
      'administer site configuration',
    ),
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'file' => 'getlocations.admin.inc',
    'weight' => 1,
  );

  // getlocations/node/$nid    # show all location on one node
  $items['getlocations/node/%getlocations_id'] = array(
    'title' => 'Get locations',
    'access callback' => 'getlocations_access_location',
    'page callback' => 'getlocations_nodemap',
    'page arguments' => array(
      2,
    ),
    'type' => MENU_CALLBACK,
  );
  if (getlocations_check_entity_type('user') || getlocations_check_entity_type('profile2')) {

    // getlocations/user/$uid    # show all locations for a user
    $items['getlocations/user/%getlocations_id'] = array(
      'title' => 'Get user locations',
      'access callback' => 'getlocations_access_user_location',
      'page callback' => 'getlocations_usermap',
      'page arguments' => array(
        2,
      ),
      'type' => MENU_CALLBACK,
    );

    // getlocations/users    # show all locations for all users
    $items['getlocations/users'] = array(
      'title' => 'View all user locations',
      'access callback' => 'getlocations_access_user_location',
      'page callback' => 'getlocations_usersmap',
      'type' => MENU_CALLBACK,
    );
  }
  if (module_exists('taxonomy')) {

    // getlocations/term/$tid    # show all locations for a term
    $items['getlocations/term/%getlocations_id'] = array(
      'title' => 'Get term locations',
      'access callback' => 'getlocations_access_location',
      'page callback' => 'getlocations_termmap',
      'page arguments' => array(
        2,
      ),
      'type' => MENU_CALLBACK,
    );
  }
  if (module_exists('comment')) {
    if (getlocations_check_entity_type('comment')) {

      // getlocations/comment/$cid    # show all locations for a comment
      $items['getlocations/comment/%getlocations_id'] = array(
        'title' => 'Get comment locations',
        'access callback' => 'getlocations_access_location',
        'page callback' => 'getlocations_commentmap',
        'page arguments' => array(
          2,
        ),
        'type' => MENU_CALLBACK,
      );
    }
  }

  // getlocations/type/$type     # show all locations of nodes of content-type machine name
  $items['getlocations/type/%getlocations_type'] = array(
    'title' => 'Get locations',
    'access callback' => 'getlocations_access_location',
    'page callback' => 'getlocations_typemap',
    'page arguments' => array(
      2,
      3,
      4,
    ),
    'type' => MENU_CALLBACK,
  );

  // getlocations/lids/1,2,3,4    # show lids
  $items['getlocations/lids/%getlocations_cdints'] = array(
    'title' => 'Get locations',
    'access callback' => 'getlocations_access_location',
    'page callback' => 'getlocations_lids',
    'page arguments' => array(
      2,
    ),
    'type' => MENU_CALLBACK,
  );

  // getlocations/nids/1,2,3,4    # show nids locations
  $items['getlocations/nids/%getlocations_cdints'] = array(
    'title' => 'Get locations',
    'access callback' => 'getlocations_access_location',
    'page callback' => 'getlocations_nids',
    'page arguments' => array(
      2,
    ),
    'type' => MENU_CALLBACK,
  );

  // ajax callbacks
  // getlocations/info?lid     # ajax callback to fetch an address
  $items['getlocations_cb/info'] = array(
    'page callback' => 'getlocations_adinfo',
    'access arguments' => array(
      'access content',
    ),
    'type' => MENU_CALLBACK,
  );

  // getlocations/lidinfo?lid    # ajax callback to fetch a link to the 'owner'
  $items['getlocations_cb/lidinfo'] = array(
    'page callback' => 'getlocations_lidinfo',
    'access arguments' => array(
      'access content',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['getlocations_box'] = array(
    'title' => 'Get locations',
    'access arguments' => array(
      'access getlocations',
    ),
    'page callback' => 'getlocations_box',
    'type' => MENU_CALLBACK,
  );
  $items['getlocations/markerinfo'] = array(
    'access callback' => TRUE,
    'page callback' => 'getlocations_markerinfo',
    'type' => MENU_CALLBACK,
  );
  $items['getlocations/cb_w3w'] = array(
    'access callback' => TRUE,
    'page callback' => 'getlocations_cb_w3w',
    'type' => MENU_CALLBACK,
  );
  return $items;
}