You are here

function _location_driving_directions_link_de_suchen in Location 5.3

Same name and namespace in other branches
  1. 6.3 supported/location.de.inc \_location_driving_directions_link_de_suchen()
  2. 7.5 supported/location.de.inc \_location_driving_directions_link_de_suchen()
  3. 7.3 supported/location.de.inc \_location_driving_directions_link_de_suchen()
  4. 7.4 supported/location.de.inc \_location_driving_directions_link_de_suchen()

Parameters: Function that is called by location_driving_directions_link_ca() under assumption that it is the chosen function

Returns: a 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
Parameters: -> $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…

File

supported/location.de.inc, line 118

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;
  }
}