Fix incorrect coordinates determination in gmaps ce

This commit is contained in:
Björn Fromme
2018-07-03 09:13:27 +02:00
parent 272ca0bd8a
commit 36e3a09682
3 changed files with 26 additions and 22 deletions
@@ -97,11 +97,10 @@ class PageLayoutView implements PageLayoutViewDrawItemHookInterface
$drawItem = false; $drawItem = false;
$region = BackendUtility::getRecord('tx_epproducts_domain_model_region', $row['tx_eptheme_context_region']); $region = BackendUtility::getRecord('tx_epproducts_domain_model_region', $row['tx_eptheme_context_region']);
$itemContent = '<strong>Google Map</strong><br />' . $region['name']; $itemContent = '<strong>Google Map</strong><br />' . $region['name'];
if ((int) $row['tx_eptheme_context_hotel'] > 0) { } elseif ((int) $row['tx_eptheme_context_hotel'] > 0) {
$hotel = BackendUtility::getRecord('tx_epproducts_domain_model_hotel', $drawItem = false;
$row['tx_eptheme_context_hotel']); $hotel = BackendUtility::getRecord('tx_epproducts_domain_model_hotel', $row['tx_eptheme_context_hotel']);
$itemContent .= ', ' . $hotel['name']; $itemContent = '<strong>Google Map</strong><br />' . $hotel['name'];
}
} }
break; break;
case 'disturber': case 'disturber':
@@ -9,19 +9,16 @@ tt_content.gmap {
where.wrap = uid=| where.wrap = uid=|
pidInList = {$plugin.tx_epproducts.settings.hotelsStoragePid} pidInList = {$plugin.tx_epproducts.settings.hotelsStoragePid}
as = hotel as = hotel
}
dataProcessing { 20 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor 20 {
10 {
table = tx_epproducts_domain_model_region table = tx_epproducts_domain_model_region
where.data = field:region where.data = field:tx_eptheme_context_region
where.wrap = uid=| where.wrap = uid=|
pidInList = {$plugin.tx_epproducts.settings.destinationsStoragePid} pidInList = {$plugin.tx_epproducts.settings.destinationsStoragePid}
recursive = 2 recursive = 2
as = region as = region
} }
} }
}
}
settings.googleMapsApiKey = {$plugin.tx_eptheme.settings.googleMapsApiKey} settings.googleMapsApiKey = {$plugin.tx_eptheme.settings.googleMapsApiKey}
} }
@@ -1,17 +1,25 @@
<html data-namespace-typo3-fluid="true" lang="en" <html data-namespace-typo3-fluid="true" lang="en"
xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers" xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers">
<f:layout name="Default"/> <f:layout name="Default"/>
<f:section name="Content"> <f:section name="Content">
<f:if condition="{hotel}">
<f:render section="Map" arguments="{latitude: hotel.0.data.latitude, longitude: hotel.0.data.longitude, googleMapsApiKey: settings.googleMapsApiKey}"/>
</f:if>
<f:if condition="{region}">
<f:render section="Map" arguments="{latitude: region.0.data.latitude, longitude: region.0.data.longitude, googleMapsApiKey: settings.googleMapsApiKey}"/>
</f:if>
</f:section>
<f:section name="Map">
<div class="row"> <div class="row">
<gmap <gmap
lat="{hotel.0.data.latitude -> v:or(alternative: hotel.0.region.0.data.latitude)}" lat="{latitude}"
lng="{hotel.0.data.longitude -> v:or(alternative: hotel.0.region.0.data.longitude)}" lng="{longitude}"
:zoom="17" :zoom="17"
api-key="{settings.googleMapsApiKey}" api-key="{googleMapsApiKey}"
></gmap> ></gmap>
</div> </div>
</f:section> </f:section>