function getdirections_user_setlocations in Get Directions 6
Same name and namespace in other branches
- 6.2 getdirections.module \getdirections_user_setlocations()
- 7.3 getdirections.module \getdirections_user_setlocations()
- 7.2 getdirections.module \getdirections_user_setlocations()
Function to setup the map
Parameters
$fromuid: Required. The uid of the starting point
$touid: Required. The uid of the destination
Return value
Returns the themed map
1 string reference to 'getdirections_user_setlocations'
- getdirections_menu in ./
getdirections.module - Implementation of hook_menu().
File
- ./
getdirections.module, line 597 - Fetches google map directions.
Code
function getdirections_user_setlocations($fromuid, $touid) {
if (module_exists('location') && is_numeric($fromuid) && is_numeric($touid)) {
// From
$fromlocation = location_load_locations($fromuid, 'uid');
if (count($fromlocation)) {
$fromlatlon = $fromlocation[0]['latitude'] . ',' . $fromlocation[0]['longitude'];
$fromloc = _getdirections_loadaddress($fromlocation[0]);
if ($fromlocation[0]['country']) {
$fromloc[] = drupal_strtoupper($fromlocation[0]['country']);
}
$fromlocs = implode(', ', $fromloc);
// To
$tolocation = location_load_locations($touid, 'uid');
if (count($tolocation)) {
$tolatlon = $tolocation[0]['latitude'] . ',' . $tolocation[0]['longitude'];
$toloc = _getdirections_loadaddress($tolocation[0]);
if ($tolocation[0]['country']) {
$toloc[] = drupal_strtoupper($tolocation[0]['country']);
}
$tolocs = implode(', ', $toloc);
$content = getdirections_locations($fromlocs, $fromlatlon, $tolocs, $tolatlon);
return $content;
}
}
}
}