function getdirections_u2n_setlocation in Get Directions 7.2
Same name and namespace in other branches
- 6.2 getdirections.module \getdirections_u2n_setlocation()
- 6 getdirections.module \getdirections_u2n_setlocation()
- 7.3 getdirections.module \getdirections_u2n_setlocation()
Function to setup the map and form
Parameters
int $uid: Required. The uid of the starting point
int $nid: Required. The nid of the destination
Return value
Returns the themed map
1 call to getdirections_u2n_setlocation()
1 string reference to 'getdirections_u2n_setlocation'
- getdirections_menu in ./
getdirections.module - Implement hook_menu().
File
- ./
getdirections.module, line 1141 - Fetches google map directions.
Code
function getdirections_u2n_setlocation($uid, $nid, $width = '', $height = '') {
if (is_numeric($uid) && $uid && is_numeric($nid) && $nid) {
// From
$fromlocation = getdirections_load_locations($uid, 'uid');
if (count($fromlocation)) {
$fromlatlon = $fromlocation[0]['latitude'] . ',' . $fromlocation[0]['longitude'];
// sanity check
if (!getdirections_latlon_check($fromlatlon)) {
watchdog('getdirections', 'Lat, Lon failed for user id !nid', array(
'!nid' => $uid,
), WATCHDOG_WARNING);
$fromlatlon = getdirections_load_latlon_defaults();
}
$fromlocs = _getdirections_loadaddress($fromlocation[0]);
// To
$vid = getdirections_get_vid($nid);
$tolocation = getdirections_load_locations($vid);
if (count($tolocation)) {
$tolatlon = $tolocation[0]['latitude'] . ',' . $tolocation[0]['longitude'];
// sanity check
if (!getdirections_latlon_check($tolatlon)) {
watchdog('getdirections', 'Lat, Lon failed for node id !nid', array(
'!nid' => $nid,
), WATCHDOG_WARNING);
$tolatlon = getdirections_load_latlon_defaults();
}
$tolocs = _getdirections_loadaddress($tolocation[0]);
$content = getdirections_locations($fromlocs, $fromlatlon, $tolocs, $tolatlon, $width, $height);
return $content;
}
}
}
return getdirections_direction();
}