You are here

function getdirections_setlocations_via in Get Directions 6

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

Function to setup the map to display waypoints

Parameters

$vids: Required. A comma delimited list of vids

Return value

Returns the themed map

1 string reference to 'getdirections_setlocations_via'
getdirections_menu in ./getdirections.module
Implementation of hook_menu().

File

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

Code

function getdirections_setlocations_via($vids) {
  if (module_exists('location')) {
    $arrvids = explode(',', $vids);
    foreach ($arrvids as $key => $vid) {

      // no more than 25 allowed
      if ($key > 23 && $key < count($arrvids)) {
        continue;
      }
      $location = location_load_locations($vid);
      if (!count($location)) {
        continue;
      }
      $loc = _getdirections_loadaddress($location[0]);
      if ($location[0]['country']) {
        $loc[] = drupal_strtoupper($location[0]['country']);
      }
      $locs[] = implode(', ', $loc);
      $latlons[] = $location[0]['latitude'] . ',' . $location[0]['longitude'];
    }
    $content = getdirections_locations_via($locs, $latlons);
    return $content;
  }
}