static public function buildStaticMapURL($latitude, $longitude, $color, $separator = '&')
{
+ if (!$latitude || !$longitude) {
+ return null;
+ }
+
$parameters = array(
'size' => '300x100',
'markers' => 'color:' . $color . '|' . $latitude . ',' . $longitude,
'zoom' => '12',
'sensor' => 'false'
);
- global $globals;
return Platal::globals()->maps->static_map . '?' . http_build_query($parameters, '', $separator);
}
var text = $('#' + prefid + '_cont').find("[name*='[text]']").val();
$('#' + prefid + '_cont').find('[name*=changed]').val("1");
$.xpost('map_url/', { text:text, color:color }, function(data) {
- $('#' + prefid + '_static_map_url').show();
- $('#' + prefid + '_static_map_url').find('img').attr('src', data);
+ if (data) {
+ $('#' + prefid + '_static_map_url').show();
+ $('#' + prefid + '_static_map_url').find('img').attr('src', data);
+ } else {
+ $('#' + prefid + '_static_map_url').hide();
+ $('#' + prefid + '_geocoding_removal').find('[name*=request]:checkbox').removeAttr('checked');
+ }
});
}
</td>
<td>
{/if}
- <div id="{$prefid}_static_map_url" {if !t($address.latitude)}style="display: none"{/if}>
+ <div id="{$prefid}_static_map_url" {if !t($address.componentsIds)}style="display: none"{/if}>
<img src="{insert name="getStaticMapURL" latitude=$address.latitude longitude=$address.longitude color=$profile->promoColor()}" alt="Position de l'adresse" />
{if t($geocoding_removal)}
<br />