You are here

function getdirections_locations in Get Directions 6

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

Function to setup the map

Parameters

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

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

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

$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 202
Fetches google map directions.

Code

function getdirections_locations($fromlocs, $fromlatlon, $tolocs, $tolatlon) {
  global $language;
  $getdirections_defaults = getdirections_defaults();
  getdirections_setup_map($getdirections_defaults);
  $lla = split(',', $getdirections_defaults['latlong']);
  $getdirections_settings = array(
    'lat' => $lla[0],
    'lng' => $lla[1],
    'zoom' => $getdirections_defaults['zoom'],
    'maptype' => $getdirections_defaults['maptype'],
    'controltype' => $getdirections_defaults['controltype'],
    'mtc' => $getdirections_defaults['mtc'],
    'baselayers' => $getdirections_defaults['baselayers'],
    'scale' => $getdirections_defaults['behavior']['scale'],
    'overview' => $getdirections_defaults['behavior']['overview'],
    'scrollwheel' => $getdirections_defaults['behavior']['scrollwheel'],
    'draggable' => $getdirections_defaults['behavior']['draggable'],
    'unitsystem' => $getdirections_defaults['unitsystem'],
    'fromlatlon' => $fromlatlon,
    'tolatlon' => $tolatlon,
    'mylocale' => $language->language,
  );
  drupal_add_js(array(
    'getdirections' => $getdirections_settings,
  ), 'setting');
  drupal_set_title(t("Get Directions"));
  $width = $getdirections_defaults['width'];
  $height = $getdirections_defaults['height'];
  return theme('getdirections_show_locations', $width, $height, $fromlocs, $tolocs);
}