Added get_address_map_link().
authorIain Patterson <me@iain.cx>
Mon, 13 May 2013 10:21:01 +0000 (06:21 -0400)
committerIain Patterson <me@iain.cx>
Mon, 13 May 2013 12:48:48 +0000 (08:48 -0400)
Function to return a Google Maps URL for an address.

lib/functions.php

index 7a02b2a..73ea464 100644 (file)
     return $q->findOneById($address->getAreaId());
   }
 
+  function get_address_map_link($address) {
+    $postcode = trim($address->getPostcode());
+    if ($postcode) {
+      return " " . get_small_link("Map", "http://maps.google.co.uk/maps?q=" . urlencode($postcode));
+    }
+  }
+
   function get_contact_address($contact) {
     $q = new AddressQuery;
     return $q->findOneById($contact->getAddressId());