function _location_driving_directions_link_de_suchen in Location 7.3
Same name and namespace in other branches
- 5.3 supported/location.de.inc \_location_driving_directions_link_de_suchen()
- 6.3 supported/location.de.inc \_location_driving_directions_link_de_suchen()
- 7.5 supported/location.de.inc \_location_driving_directions_link_de_suchen()
- 7.4 supported/location.de.inc \_location_driving_directions_link_de_suchen()
Directions link.
Parameters
array $location_a: Is an associative array that represents a full location where 'street' => the street portions of the location 'supplemental' => additional street portion of the location 'province' => the province, state, or territory 'country' => lower-cased two-letter ISO code (REQUIRED)
array $location_b: Is associative array that represents a full location in the same way that parameter $location_b does.
Return value
string URL with HTTP GET variables Depending on how full the locationes are, the URL will either point to the driving directions on tinfo! or, if only partial locationes are provided, a URL that points to the *form* for tinfo! driving directions where the form is filled with whatever fields have been provided for the partial location(es).
1 call to _location_driving_directions_link_de_suchen()
- location_driving_directions_link_de in supported/
location.de.inc - Directions link.
File
- supported/
location.de.inc, line 153 - Deutschland.
Code
function _location_driving_directions_link_de_suchen($location_a, $location_b) {
foreach ($location_a as $field => $value) {
$location_a[$field] = trim($value);
}
foreach ($location_b as $field => $value) {
$location_b[$field] = trim($value);
}
if ($location_a['country'] == 'de' and $location_b['country'] == 'de') {
$get_query = '?';
// VON.
$query_parts = array();
if (isset($location_a['street'])) {
$query_parts[] = $location_a['street'];
}
if ($location_a['postal_code'] != '') {
$query_parts[] = $location_a['postal_code'];
}
if ($location_a['city'] != '') {
$query_parts[] = $location_a['city'];
}
$get_query .= 'route_from=' . urlencode(implode(', ', $query_parts));
// NACH.
$query_parts = array();
if (isset($location_b['street'])) {
$query_parts[] = $location_b['street'];
}
if ($location_b['postal_code'] != '') {
$query_parts[] = $location_b['postal_code'];
}
if ($location_b['city'] != '') {
$query_parts[] = $location_b['city'];
}
$get_query .= '&route_to=' . urlencode(implode(', ', $query_parts));
return 'http://www.suchen.de/route' . $get_query;
}
}