'Brandenburg', 'BE' => 'Berlin', 'BW' => 'Baden-Württemberg', 'BY' => 'Bayern', 'HB' => 'Bremen', 'HE' => 'Hessen', 'HH' => 'Hamburg', 'MV' => 'Mecklenburg-Vorpommern', 'NI' => 'Niedersachsen', 'NW' => 'Nordrhein-Westfalen', 'RP' => 'Rheinland-Pfalz', 'SH' => 'Schleswig-Holstein', 'SL' => 'Saarland', 'SN' => 'Sachsen', 'ST' => 'Sachsen-Anhalt', 'TH' => 'Thüringen' ); } /** * 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 location * 'province' => the province, state, or territory * 'country' => lower-cased two-letter ISO code (REQUIRED) * -> $location_b is associative array that represents a full location in the same way that * parameter $location_b does. * * Returns: a link to driving directions */ function location_map_link_de($location = array(), $hide = array()) { $map_links = array(); // For now, just call the suchen (tinfo) function. May want to make this configurable on some level // in order to maintain freedom of choice so users and site-admins don't have to be slaves // to tinfo!.... not that I have anything personal against tinfo!. if ($link = _location_map_link_de_suchen($location)) { $map_links['suchen'] = $link; } return $map_links; } function _location_map_link_de_suchen($location = array()) { $get_query = '?'; $get_query .= 'where='; $query_parts = array(); if (isset($location['street'])) { $query_parts[] = $location['street']; } if ($location['postal_code'] != '') { $query_parts[] = $location['postal_code']; } if ($location['city'] != '') { $query_parts[] = $location['city']; } // if ($location['number'] != '') { // $query_parts[] = $location['number']; // } $get_query .= urlencode(implode(', ', $query_parts)); return ('http://www.suchen.de/lokalmap'. $get_query); } function location_map_link_de_providers() { return array( 'suchen' => array( 'name' => 'suchen.de (T-Info)', 'url' => 'http://www.suchen.de/', 'tos' => 'http://www.suchen.de/agb', ), 'google' => array( 'name' => 'Google Maps', 'url' => 'http://maps.google.com', 'tos' => 'http://www.google.com/help/terms_local.html', ), ); } function location_map_link_de_default_providers() { return array('google'); } /** * 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 location * 'province' => the province, state, or territory * 'country' => lower-cased two-letter ISO code (REQUIRED) * -> $location_b is associative array that represents a full location in the same way that * parameter $location_b does. * * Returns: a link to driving directions * * For now, assume site-admin wants driving directions linked to tinfo! * Maybe later, we can add some kind of country-specific settings page that allows the site-admin to * decide which site to link to for driving directions. */ function location_driving_directions_link_de($location_a, $location_b) { return _location_driving_directions_link_de_suchen($location_a, $location_b); } /** * 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). */ 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); } } function location_map_link_de_google($location = array()) { $query_params = array(); foreach (array('street', 'postal_code', 'city', 'country') as $field) { if (isset($location[$field])) { $query_params[] = $location[$field]; } } if (count($query_params)) { return ('http://maps.google.com?q='. urlencode(implode(', ', $query_params))); } else { return NULL; } } function theme_location_de($location = array(), $hide = array()) { $output = ''; if (count($location)) { $output .= "\n"; $output .= '