Add dedicated field for reseller images to hotels

This commit is contained in:
Björn Fromme
2018-08-01 10:34:33 +02:00
parent 73e79ad2ff
commit cf9cb3b719
5 changed files with 147 additions and 79 deletions
@@ -153,6 +153,11 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te
*/ */
protected $images; protected $images;
/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
*/
protected $resellerImages;
/** /**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
*/ */
@@ -224,6 +229,7 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te
protected function initStorageObjects() protected function initStorageObjects()
{ {
$this->images = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); $this->images = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->resellerImages = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->teaserImages = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); $this->teaserImages = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->headerImages = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); $this->headerImages = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->teamer = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); $this->teamer = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
@@ -510,6 +516,22 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te
$this->images = $images; $this->images = $images;
} }
/**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> $resellerImages
*/
public function getResellerImages()
{
return $this->resellerImages;
}
/**
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> $resellerImages
*/
public function setResellerImages($resellerImages)
{
$this->resellerImages = $resellerImages;
}
/** /**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
*/ */
@@ -56,6 +56,11 @@ class Hotel
*/ */
public $features; public $features;
/**
* @var array
*/
public $images = [];
/** /**
* @var array * @var array
*/ */
@@ -74,6 +79,7 @@ class Hotel
$hotel->type = \EP\EpProducts\Domain\Model\Hotel::$typeLabels[$entity->getType()]; $hotel->type = \EP\EpProducts\Domain\Model\Hotel::$typeLabels[$entity->getType()];
$hotel->description = SerializationUtility::sanitizeText($entity->getDescription()); $hotel->description = SerializationUtility::sanitizeText($entity->getDescription());
$hotel->features = SerializationUtility::sanitizeText($entity->getFeatures()); $hotel->features = SerializationUtility::sanitizeText($entity->getFeatures());
$hotel->images['image'] = SerializationUtility::preprocessImages($entity->getResellerImages());
return $hotel; return $hotel;
} }
@@ -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,code,type,category,country,region,city,teamer,products,', header_images,images,reseller_images,code,type,category,country,region,city,teamer,products,',
'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, code, type, category, country, region, city, facts, teamer, products, teaser_images, header_images, images, reseller_images, code, type, category, country, region, city, facts,
header_title,header_subtitle, earlybird, low_contingent, show_as_teaser', teamer, products, header_title,header_subtitle, earlybird, low_contingent, show_as_teaser',
], ],
'types' => [ 'types' => [
'1' => [ '1' => [
@@ -37,7 +37,7 @@ return [
--palette--;;destinations, --palette--;;categories, keywords, --palette--;;destinations, --palette--;;categories, keywords,
--div--;Texte, teaser, description, features, room_types, additional_information, --div--;Texte, teaser, description, features, room_types, additional_information,
--div--;Verknüpfungen, facts, teamer, additional_codes, --div--;Verknüpfungen, facts, teamer, additional_codes,
--div--;Bilder/Dateien, teaser_images, header_images, images', --div--;Bilder/Dateien, teaser_images, header_images, images, reseller_images',
'columnsOverrides' => [ 'columnsOverrides' => [
'teaser' => [ 'teaser' => [
'defaultExtras' => 'richtext[]:rte_transform[mode=ts_links]', 'defaultExtras' => 'richtext[]:rte_transform[mode=ts_links]',
@@ -344,7 +344,7 @@ return [
], ],
'images' => [ 'images' => [
'exclude' => 0, 'exclude' => 0,
'label' => 'LLL:EXT:ep_products/Resources/Private/Language/locallang.xlf:tx_epproducts_domain_model_hotel.images', 'label' => 'Bilder',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig( 'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'images', 'images',
[ [
@@ -368,6 +368,32 @@ return [
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
), ),
], ],
'reseller_images' => [
'exclude' => 0,
'label' => 'Bilder für Vertriebspartner',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'reseller_images',
[
'appearance' => [
'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference'
],
'foreign_types' => [
'0' => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
],
'maxitems' => 10
],
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
],
'code' => [ 'code' => [
'exclude' => 0, 'exclude' => 0,
'label' => 'LLL:EXT:ep_products/Resources/Private/Language/locallang.xlf:tx_epproducts_domain_model_hotel.code', 'label' => 'LLL:EXT:ep_products/Resources/Private/Language/locallang.xlf:tx_epproducts_domain_model_hotel.code',
@@ -202,6 +202,7 @@ CREATE TABLE tx_epproducts_domain_model_hotel (
teaser_images int(11) unsigned NOT NULL default '0', teaser_images int(11) unsigned NOT NULL default '0',
header_images int(11) unsigned NOT NULL default '0', header_images int(11) unsigned NOT NULL default '0',
images int(11) unsigned NOT NULL default '0', 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,
type varchar(255) DEFAULT '' NOT NULL, type varchar(255) DEFAULT '' NOT NULL,
@@ -23,9 +23,9 @@
<f:render section="CollapsibleSimple" arguments="{id: 8, label: 'Verpflegung', description: productData.board}"/> <f:render section="CollapsibleSimple" arguments="{id: 8, label: 'Verpflegung', description: productData.board}"/>
<f:render section="CollapsibleSimple" arguments="{id: 9, label: 'Programm', description: productData.programme}"/> <f:render section="CollapsibleSimple" arguments="{id: 9, label: 'Programm', description: productData.programme}"/>
<f:for each="{productData.hotels.hotel}" as="hotel" iteration="iteration"> <f:for each="{productData.hotels.hotel}" as="hotel" iteration="iteration">
<f:render section="CollapsibleHotel" arguments="{id: '10-{iteration.cycle}', label: 'Unterkunft{f:if(condition: \'{productData.hotels.hotel -> f:count()} > 1\', then: \' {iteration.cycle}\')}, Termine, Zimmer, Leistungen', hotel: hotel}"/> <f:render section="CollapsibleHotel" arguments="{id: '10-{iteration.cycle}', label: 'Unterkunft{f:if(condition: \'{productData.hotels.hotel -> f:count()} > 1\', then: \' {iteration.cycle}\')} (Termine, Zimmer, Leistungen, Bilder)', hotel: hotel}"/>
</f:for> </f:for>
<f:render section="CollapsibleImages" arguments="{id: 11, label: 'Bilder', images: productData.images.image}"/> <f:render section="CollapsibleImages" arguments="{id: 11, label: 'Allgemeine Bilder', images: productData.images.image}"/>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
@@ -99,6 +99,8 @@
<textarea rows="5" class="form-control" onclick="this.select()">{hotel.features}</textarea> <textarea rows="5" class="form-control" onclick="this.select()">{hotel.features}</textarea>
</div> </div>
<h4>Termine, Zimmer und Leistungen</h4> <h4>Termine, Zimmer und Leistungen</h4>
<f:if condition="{hotel.dates.date}">
<f:then>
<f:for each="{hotel.dates.date}" as="date"> <f:for each="{hotel.dates.date}" as="date">
<table class="table table-condensed table-striped"> <table class="table table-condensed table-striped">
<tr> <tr>
@@ -173,6 +175,17 @@
</tr> </tr>
</table> </table>
</f:for> </f:for>
</f:then>
<f:else>
<p>Aktuell nicht buchbar.</p>
</f:else>
</f:if>
<f:if condition="{hotel.images.image}">
<h4>Bilder</h4>
<f:for each="{hotel.images.image}" as="image">
<a href="{image}" target="_blank">{image}</a><br>
</f:for>
</f:if>
</div> </div>
</div> </div>
</div> </div>