function getdirections_user_setlocation in Get Directions 6.2
Same name and namespace in other branches
- 6 getdirections.module \getdirections_user_setlocation()
- 7.3 getdirections.module \getdirections_user_setlocation()
- 7.2 getdirections.module \getdirections_user_setlocation()
Function to setup the map and form
Parameters
string $direction: Required. The direction the supplied input applies to
int $uid: Required. The uid of the location owner
Return value
Returns the themed map and form
1 call to getdirections_user_setlocation()
1 string reference to 'getdirections_user_setlocation'
- getdirections_menu in ./
getdirections.module - Implementation of hook_menu().
File
- ./
getdirections.module, line 847 - Fetches google map directions.
Code
function getdirections_user_setlocation($direction, $uid, $width = '', $height = '') {
if (module_exists('location') && $uid) {
$location = location_load_locations($uid, 'uid');
if (count($location)) {
$country = isset($location[0]['country']) ? $location[0]['country'] : '';
$latlon = $location[0]['latitude'] . ',' . $location[0]['longitude'];
// sanity check
if (!getdirections_latlon_check($latlon)) {
watchdog('getdirections', 'Lat, Lon failed for user id !uid', array(
'!uid' => $uid,
), WATCHDOG_WARNING);
$latlon = getdirections_load_latlon_defaults();
}
// $locs only used for display now
$locs = _getdirections_loadaddress($location[0]);
$content = getdirections_direction($direction, $locs, $country, $latlon, $uid, 'user', $width, $height);
return $content;
}
}
return getdirections_direction();
}