You are here

function getdirections_user_setlocations_via in Get Directions 6

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

Function to setup the map to display waypoints

Parameters

$uids: Required. A comma delimited list of uids

Return value

Returns the themed map

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

File

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

Code

function getdirections_user_setlocations_via($uids) {
  if (module_exists('location')) {
    $arruids = explode(',', $uids);
    foreach ($arruids as $key => $uid) {

      // no more than 25 allowed
      if ($key > 23 && $key < count($arruids)) {
        continue;
      }
      $location = location_load_locations($uid, 'uid');
      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;
  }
}