root/trunk/lib/helper/GoogleMapsHelper.php

Revision 2, 1.1 kB (checked in by nperriault, 10 months ago)

First commit of the extracted code from production, I hope no passwd has been forgotten :-)

Line 
1 <?php
2 function link_to_gmap($label, $address)
3 {
4   $address = strip_tags(html_entity_decode($address, ENT_NOQUOTES, 'UTF-8'));
5   return link_to($label,
6                  sprintf('http://maps.google.com/maps?f=q&hl=%s&geocode=&time=&date=&ttype=&q=%s&ie=UTF8&z=16&iwloc=addr&om=1',
7                          sfContext::getInstance()->getUser()->getCulture(),
8                          urlencode($address)));
9 }
10
11 function iframe_to_map($address, $width = 450, $height = 350)
12 {
13   $address = strip_tags(html_entity_decode($address, ENT_NOQUOTES, 'UTF-8'));
14   return sprintf('<iframe width="%d" height="%d" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&amp;hl=%s&amp;geocode=&amp;time=&amp;date=&amp;ttype=&amp;q=%s&amp;ie=UTF8&amp;z=14&amp;iwloc=addr&amp;om=1&amp;ll=48.221413,-1.502895&amp;output=embed&amp;s=ABQIAAAAJzW00hpIW6OUahxCsNamFRRpdZGFbCZsMtmsPjIdeMMCI9gCvBS9aSX1jeBBFDcUpmIr9yUizgWCvQ"></iframe>',
15                  $width, $height,
16                  sfContext::getInstance()->getUser()->getCulture(),
17                  urlencode($address));
18 }
19
Note: See TracBrowser for help on using the browser.