You are here

function getdirections_locations in Get Directions 6.2

Same name and namespace in other branches
  1. 6 getdirections.module \getdirections_locations()
  2. 7.3 getdirections.module \getdirections_locations()
  3. 7.2 getdirections.module \getdirections_locations()

Function to setup the map

Parameters

string $fromlocs: Required. The string to display for From.

string $fromlatlon: Required. The location point for From. In decimal latitude,longitude

string $tolocs: Required. The string to display for To.

string $tolatlon: Required. The location point for To. In decimal latitude,longitude

Return value

Returns the themed map.

5 calls to getdirections_locations()
getdirections_locations_bylatlon in ./getdirections.api.inc
API Function to setup a map with two points
getdirections_n2u_setlocation in ./getdirections.module
Function to setup the map
getdirections_setlocations in ./getdirections.module
Function to setup the map
getdirections_u2n_setlocation in ./getdirections.module
Function to setup the map and form
getdirections_user_setlocations in ./getdirections.module
Function to setup the map

File

./getdirections.module, line 287
Fetches google map directions.

Code

function getdirections_locations($fromlocs, $fromlatlon, $tolocs, $tolatlon, $width = '', $height = '') {
  if (!getdirections_check()) {
    return t('You need to !c first.', array(
      '!c' => l('configure Getdirections', 'admin/settings/getdirections'),
    ));
  }
  $getdirections_defaults = getdirections_defaults();
  $getdirections_misc = getdirections_misc_defaults();
  getdirections_setup_map($getdirections_defaults, $getdirections_misc);
  $getdirections_settings = getdirections_get_settings($getdirections_defaults, $getdirections_misc);

  // remove brackets if any
  $fromlatlon = preg_replace("/^\\(|\\)\$/", '', $fromlatlon);
  $getdirections_settings['fromlatlon'] = $fromlatlon;
  $tolatlon = preg_replace("/^\\(|\\)\$/", '', $tolatlon);
  $getdirections_settings['tolatlon'] = $tolatlon;
  drupal_add_js(array(
    'getdirections' => $getdirections_settings,
  ), 'setting');
  if (empty($width)) {
    $width = $getdirections_defaults['width'];
  }
  if (empty($height)) {
    $height = $getdirections_defaults['height'];
  }
  return theme('getdirections_show_locations', $width, $height, $fromlocs, $tolocs);
}