X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=lib%2Ffunctions.php;h=ec0b35ade4763feb1890792972f1f01166b1e107;hb=f181270af10ecded4b40d9ad3f838216835eb5f4;hp=2fcbe0e493e3dace99565a6bbb75e9bdf7674e4b;hpb=3b2e8214805eb2bdebb7485ce29c072815361eef;p=readifood.git diff --git a/lib/functions.php b/lib/functions.php index 2fcbe0e..ec0b35a 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -320,7 +320,32 @@ 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)); + # mrt=loc specifies a location search. + $map = "maps.google.co.uk/maps?q=" . urlencode($postcode) . "&mrt=loc"; + $url = "http://$map"; + # output=embed allows display in an iframe. + # iwloc=near hides the popup window for the embedded view. + $embed = $GLOBALS['http'] . "://$map&output=embed&iwloc=near"; + $html = " "; + $html .= get_small_link_with_id("map", "Map", $url); + $html .= ""; + return $html; } } @@ -428,9 +453,9 @@ function show_role_form($role, $roles) { for ($i = 0; $i < count($roles); $i++) { - echo " $roles[$i]\n"; + echo ">\n"; } } @@ -536,12 +561,21 @@ } } - function get_small_link() { - /* Args are , , [ ...] */ + function get_small_link_with_id() { + /* Args are , , , [ ...] */ $args = func_get_args(); + $id = array_shift($args); + if (isset($id)) $id = " id=\"$id\""; $html = htmlspecialchars(array_shift($args)); $url = array_shift($args); - return vsprintf("$html\n", $args); + return vsprintf("$html\n", $args); + } + + function get_small_link() { + /* Args are , , [ ...] */ + $args = func_get_args(); + array_unshift($args, null); + return call_user_func_array("get_small_link_with_id", $args); } function small_link() {