X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=lib%2Ffunctions.php;h=ec0b35ade4763feb1890792972f1f01166b1e107;hb=d4756a23630bd3de036e2e4d09b168b56d14b0ae;hp=73ea46443743007dd483b8a2d5d80bc6dd888516;hpb=1fb7460a871d2342eca8a99d5e6a4af26c019372;p=readifood.git diff --git a/lib/functions.php b/lib/functions.php index 73ea464..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"; } } @@ -486,40 +511,71 @@ } function show_date_form($name, $date = null) { - $past = 60; - $future = 60; - echo "\n"; - return; - if (! isset($date)) $date = date('Y-m-d'); - list($y, $m, $d) = iso8601_to_ymd($date); + } - echo "Year: "; - echo "Month: "; - echo "Day: "; + 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); } function get_small_link() { /* Args are , , [ ...] */ $args = func_get_args(); - $html = htmlspecialchars(array_shift($args)); - $url = array_shift($args); - return vsprintf("$html\n", $args); + array_unshift($args, null); + return call_user_func_array("get_small_link_with_id", $args); } function small_link() {