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;
/**
* @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>
*/
@@ -224,6 +229,7 @@ class Hotel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements Te
protected function initStorageObjects()
{
$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->headerImages = 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;
}
/**
* @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
*/
@@ -56,6 +56,11 @@ class Hotel
*/
public $features;
/**
* @var array
*/
public $images = [];
/**
* @var array
*/
@@ -74,6 +79,7 @@ class Hotel
$hotel->type = \EP\EpProducts\Domain\Model\Hotel::$typeLabels[$entity->getType()];
$hotel->description = SerializationUtility::sanitizeText($entity->getDescription());
$hotel->features = SerializationUtility::sanitizeText($entity->getFeatures());
$hotel->images['image'] = SerializationUtility::preprocessImages($entity->getResellerImages());
return $hotel;
}
@@ -22,14 +22,14 @@ return [
'endtime' => 'endtime',
],
'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'
],
'interface' => [
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, name, detail_page, keywords,
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,
header_title,header_subtitle, earlybird, low_contingent, show_as_teaser',
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',
],
'types' => [
'1' => [
@@ -37,7 +37,7 @@ return [
--palette--;;destinations, --palette--;;categories, keywords,
--div--;Texte, teaser, description, features, room_types, additional_information,
--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' => [
'teaser' => [
'defaultExtras' => 'richtext[]:rte_transform[mode=ts_links]',
@@ -344,7 +344,7 @@ return [
],
'images' => [
'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(
'images',
[
@@ -368,6 +368,32 @@ return [
$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' => [
'exclude' => 0,
'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',
header_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,
groupsch_id varchar(8) 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: 9, label: 'Programm', description: productData.programme}"/>
<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: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 class="row">
<div class="col-xs-12">
@@ -99,80 +99,93 @@
<textarea rows="5" class="form-control" onclick="this.select()">{hotel.features}</textarea>
</div>
<h4>Termine, Zimmer und Leistungen</h4>
<f:for each="{hotel.dates.date}" as="date">
<table class="table table-condensed table-striped">
<tr>
<th>von</th>
<td>{date.from}</td>
</tr>
<tr>
<th>bis</th>
<td>{date.to}</td>
</tr>
<tr>
<th>Nächte</th>
<td>{date.nights}</td>
</tr>
<tr>
<th>Abpreis</th>
<td>{date.minprice} €</td>
</tr>
<tr>
<th>Bus inkl.</th>
<td>{f:if(condition: date.busincluded, then: 'ja', else: 'nein')}</td>
</tr>
<tr>
<th>Skipass inkl.</th>
<td>{f:if(condition: date.skipassincluded, then: 'ja', else: 'nein')}</td>
</tr>
<tr>
<th>Zimmer</th>
<td>
<table class="table table-condensed">
<thead>
<tr>
<th>Bezeichnung</th>
<th>Preis</th>
<th>verfügbar</th>
</tr>
</thead>
<tbody>
<f:for each="{date.rooms.room}" as="room">
<f:if condition="{hotel.dates.date}">
<f:then>
<f:for each="{hotel.dates.date}" as="date">
<table class="table table-condensed table-striped">
<tr>
<th>von</th>
<td>{date.from}</td>
</tr>
<tr>
<th>bis</th>
<td>{date.to}</td>
</tr>
<tr>
<th>Nächte</th>
<td>{date.nights}</td>
</tr>
<tr>
<th>Abpreis</th>
<td>{date.minprice} €</td>
</tr>
<tr>
<th>Bus inkl.</th>
<td>{f:if(condition: date.busincluded, then: 'ja', else: 'nein')}</td>
</tr>
<tr>
<th>Skipass inkl.</th>
<td>{f:if(condition: date.skipassincluded, then: 'ja', else: 'nein')}</td>
</tr>
<tr>
<th>Zimmer</th>
<td>
<table class="table table-condensed">
<thead>
<tr>
<td>{room.name}</td>
<td>{room.price} €</td>
<td>{room.available}</td>
<th>Bezeichnung</th>
<th>Preis</th>
<th>verfügbar</th>
</tr>
</f:for>
</tbody>
</table>
</td>
</tr>
<tr>
<th>Inklusivleistungen</th>
<td>
{date.servicesincluded.service -> v:iterator.implode(glue: '<br/>')}
</td>
</tr>
<tr>
<th>Zusatzleistungen</th>
<td>
<table class="table table-condesed">
<f:for each="{date.services.service}" as="service">
<tr>
<td>{service.label}</td>
<td>{service.price} €</td>
</tr>
</f:for>
</table>
</td>
</tr>
<tr>
<th>Buchungslink</th>
<td><a href="{date.bookingurl}" target="_blank">URL</a></td>
</tr>
</table>
</f:for>
</thead>
<tbody>
<f:for each="{date.rooms.room}" as="room">
<tr>
<td>{room.name}</td>
<td>{room.price} €</td>
<td>{room.available}</td>
</tr>
</f:for>
</tbody>
</table>
</td>
</tr>
<tr>
<th>Inklusivleistungen</th>
<td>
{date.servicesincluded.service -> v:iterator.implode(glue: '<br/>')}
</td>
</tr>
<tr>
<th>Zusatzleistungen</th>
<td>
<table class="table table-condesed">
<f:for each="{date.services.service}" as="service">
<tr>
<td>{service.label}</td>
<td>{service.price} €</td>
</tr>
</f:for>
</table>
</td>
</tr>
<tr>
<th>Buchungslink</th>
<td><a href="{date.bookingurl}" target="_blank">URL</a></td>
</tr>
</table>
</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>