Add external links for hotels to be used in maps

This commit is contained in:
Björn Fromme
2018-09-13 10:13:39 +02:00
parent 241dafb8fa
commit 3afb5a7fd6
6 changed files with 71 additions and 14 deletions
@@ -92,6 +92,7 @@ class MapController extends ActionController
$markerData[] = [ $markerData[] = [
'name' => $product->getName(), 'name' => $product->getName(),
'uri' => $this->getUriForPageUid($product->getDetailPage()), 'uri' => $this->getUriForPageUid($product->getDetailPage()),
'externalLink' => $hotel->getExternalLink(),
'teaser' => $product->getTeaser(), 'teaser' => $product->getTeaser(),
'lat' => $hotel->getLatitude(), 'lat' => $hotel->getLatitude(),
'lng' => $hotel->getLongitude(), 'lng' => $hotel->getLongitude(),
@@ -222,6 +222,11 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te
*/ */
protected $facts; protected $facts;
/**
* @var string
*/
protected $externalLink;
public function __construct() public function __construct()
{ {
$this->initStorageObjects(); $this->initStorageObjects();
@@ -832,4 +837,20 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te
$this->facts = $facts; $this->facts = $facts;
} }
/**
* @return string
*/
public function getExternalLink()
{
return $this->externalLink;
}
/**
* @param string $externalLink
*/
public function setExternalLink($externalLink)
{
$this->externalLink = $externalLink;
}
} }
@@ -22,14 +22,14 @@ return [
'endtime' => 'endtime', 'endtime' => 'endtime',
], ],
'searchFields' => 'name,headline,teaser,description,features,room_types,additional_information,teaser_images, 'searchFields' => 'name,headline,teaser,description,features,room_types,additional_information,teaser_images,
header_images,images,reseller_images,code,type,category,country,region,city,teamer,products,', header_images,images,reseller_images,code,type,category,country,region,city,teamer,products,external_link',
'iconfile' => 'EXT:ep_products/Resources/Public/Icons/tx_epproducts_domain_model_hotel.gif' 'iconfile' => 'EXT:ep_products/Resources/Public/Icons/tx_epproducts_domain_model_hotel.gif'
], ],
'interface' => [ 'interface' => [
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, name, detail_page, keywords, 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, name, detail_page, keywords,
address, longitude, latitude, headline, teaser, description, features, room_types, additional_information, address, longitude, latitude, headline, teaser, description, features, room_types, additional_information,
teaser_images, header_images, images, reseller_images, code, type, category, country, region, city, facts, teaser_images, header_images, images, reseller_images, code, type, category, country, region, city, facts,
teamer, products, header_title,header_subtitle, earlybird, low_contingent, show_as_teaser', teamer, products, header_title,header_subtitle, earlybird, low_contingent, show_as_teaser, external_link',
], ],
'types' => [ 'types' => [
'1' => [ '1' => [
@@ -58,7 +58,7 @@ return [
], ],
], ],
'palettes' => [ 'palettes' => [
'top' => ['showitem' => 'hidden,earlybird,low_contingent,show_as_teaser,--linebreak--,groupsch_id,detail_page'], 'top' => ['showitem' => 'hidden,earlybird,low_contingent,show_as_teaser,--linebreak--,groupsch_id,detail_page,--linebreak--,external_link'],
'geolocation' => ['showitem' => 'address, longitude, latitude'], 'geolocation' => ['showitem' => 'address, longitude, latitude'],
'destinations' => ['showitem' => 'country,region,city'], 'destinations' => ['showitem' => 'country,region,city'],
'name' => ['showitem' => 'name,code,--linebreak--,header_title,header_subtitle'], 'name' => ['showitem' => 'name,code,--linebreak--,header_title,header_subtitle'],
@@ -412,6 +412,29 @@ return [
'eval' => 'trim,int' 'eval' => 'trim,int'
], ],
], ],
'external_link' => [
'exclude' => 0,
'label' => 'Externer Link (Google MyBusiness)',
'config' => [
'type' => 'input',
'size' => 30,
'eval' => 'trim',
'wizards' => [
'link' => [
'type' => 'popup',
'title' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:header_link_formlabel',
'icon' => 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_link.gif',
'module' => [
'name' => 'wizard_link',
'urlParameters' => [
'mode' => 'wizard'
]
],
'JSopenParams' => 'height=300,width=500,status=0,menubar=0,scrollbars=1'
]
],
],
],
'type' => [ 'type' => [
'exclude' => 0, 'exclude' => 0,
'label' => 'LLL:EXT:ep_products/Resources/Private/Language/locallang.xlf:tx_epproducts_domain_model_hotel.type', 'label' => 'LLL:EXT:ep_products/Resources/Private/Language/locallang.xlf:tx_epproducts_domain_model_hotel.type',
@@ -208,6 +208,7 @@ CREATE TABLE tx_epproducts_domain_model_hotel (
reseller_images int(11) unsigned NOT NULL default '0', reseller_images int(11) unsigned NOT NULL default '0',
code varchar(255) DEFAULT '' NOT NULL, code varchar(255) DEFAULT '' NOT NULL,
groupsch_id varchar(8) DEFAULT '' NOT NULL, groupsch_id varchar(8) DEFAULT '' NOT NULL,
external_link varchar(255) DEFAULT '' NOT NULL,
type varchar(255) DEFAULT '' NOT NULL, type varchar(255) DEFAULT '' NOT NULL,
category int(11) DEFAULT '0' NOT NULL, category int(11) DEFAULT '0' NOT NULL,
country int(11) unsigned DEFAULT '0', country int(11) unsigned DEFAULT '0',
@@ -21,6 +21,10 @@
markers: { markers: {
type: Array, type: Array,
default: null default: null
},
externalLink: {
type: String,
default: null
} }
}, },
data () { data () {
@@ -37,6 +41,11 @@
if (this.lat && this.lng) { if (this.lat && this.lng) {
const position = L.latLng(this.lat, this.lng); const position = L.latLng(this.lat, this.lng);
const marker = L.marker(position); const marker = L.marker(position);
if (this.externalLink) {
marker.on('click', () => {
window.open(this.externalLink, '_blank');
});
}
marker.addTo(this.map); marker.addTo(this.map);
this.map.setView(position); this.map.setView(position);
} else if (this.markers) { } else if (this.markers) {
@@ -44,12 +53,16 @@
for (let item of this.markers) { for (let item of this.markers) {
const position = L.latLng(item.lat, item.lng); const position = L.latLng(item.lat, item.lng);
const marker = L.marker(position); const marker = L.marker(position);
if (item.externalLink) {
marker.on('click', () => {
window.open(item.externalLink, '_blank');
});
} else {
const popupContent = '<div><strong>' + item.name + '</strong><br>' + item.teaser +
'<br><a href="' + item.uri + '">zu den Details</a></div>';
marker.bindPopup(popupContent);
}
marker.addTo(this.map); marker.addTo(this.map);
const popupContent = '<div><strong>' + item.name + '</strong><br>' + item.teaser +
'<br><a href="' + item.uri + '">zu den Details</a></div>';
marker.bindPopup(popupContent);
bounds.extend(position); bounds.extend(position);
} }
this.map.fitBounds(bounds); this.map.fitBounds(bounds);
@@ -92,9 +92,8 @@
<div class="ep-sidebar ep-snow"> <div class="ep-sidebar ep-snow">
<p><strong>Lage</strong></p> <p><strong>Lage</strong></p>
<div> <div>
<a href="{ep:gmapsUrl(hotel: hotel)}" target="_blank" title="{hotel.name}"> <gmap lat="{hotel.latitude}" lng="{hotel.longitude}" :zoom="12"
<gmap lat="{hotel.latitude}" lng="{hotel.longitude}" :zoom="12"></gmap> external-link="{f:uri.typolink(parameter: hotel.externalLink)}"></gmap>
</a>
</div> </div>
</div> </div>
<f:render partial="Region/Webcam" arguments="{region: region}"/> <f:render partial="Region/Webcam" arguments="{region: region}"/>
@@ -192,9 +191,8 @@
<div class="ep-sidebar ep-snow"> <div class="ep-sidebar ep-snow">
<p><strong>Lage</strong></p> <p><strong>Lage</strong></p>
<div> <div>
<a href="{ep:gmapsUrl(hotel: hotel)}" target="_blank" title="{hotel.name}"> <gmap lat="{hotel.latitude}" lng="{hotel.longitude}" :zoom="12"
<gmap lat="{hotel.latitude}" lng="{hotel.longitude}" :zoom="12"></gmap> external-link="{f:uri.typolink(parameter: hotel.externalLink)}"></gmap>
</a>
</div> </div>
</div> </div>
<f:render partial="Region/Webcam" arguments="{region: region}"/> <f:render partial="Region/Webcam" arguments="{region: region}"/>