From eddad77f488913f98d639f57a4f6c00142a26be6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Fri, 15 Nov 2024 08:31:29 +0100 Subject: [PATCH] feat: render courses teaser only if applicable --- .../ep_products/Classes/Domain/Model/Date.php | 17 +++++ .../Classes/Domain/Model/TravelinfoTeaser.php | 10 +-- .../Classes/Service/DateImportService.php | 1 + ...products_domain_model_travelinfoteaser.php | 8 +- .../typo3conf/ext/ep_products/ext_tables.sql | 3 +- .../Private/Templates/Travelinfo/Index.html | 75 +++++++++++-------- 6 files changed, 74 insertions(+), 40 deletions(-) diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Model/Date.php b/public/typo3conf/ext/ep_products/Classes/Domain/Model/Date.php index 5fd90f18..03bb23d1 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Model/Date.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Model/Date.php @@ -134,6 +134,11 @@ class Date extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity */ protected $servicesGeneral = ''; + /** + * @var string + */ + protected $coursesIncluded = ''; + /** * @var string */ @@ -470,6 +475,18 @@ class Date extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity $this->servicesGeneral = serialize($servicesGeneral); } + public function getCoursesIncluded() + { + return unserialize($this->coursesIncluded); + } + + public function setCoursesIncluded($coursesIncluded) + { + $this->coursesIncluded = $coursesIncluded; + + return $this; + } + /** * @return string */ diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Model/TravelinfoTeaser.php b/public/typo3conf/ext/ep_products/Classes/Domain/Model/TravelinfoTeaser.php index dadbd70a..ae153452 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Model/TravelinfoTeaser.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Model/TravelinfoTeaser.php @@ -20,7 +20,7 @@ class TravelinfoTeaser extends AbstractEntity /** * @var string */ - protected $icon; + protected $category; /** * @var FileReference @@ -53,14 +53,14 @@ class TravelinfoTeaser extends AbstractEntity $this->bodytext = $bodytext; } - public function getIcon() + public function getCategory() { - return $this->icon; + return $this->category; } - public function setIcon($icon) + public function setCategory($category) { - $this->icon = $icon; + $this->category = $category; } public function getImage() diff --git a/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php b/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php index 21af8780..35581246 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/DateImportService.php @@ -394,6 +394,7 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface ]; $date['services_included'] = serialize($includedServices); + $date['courses_included'] = serialize($includedCourses); if ($includedBoard) { $date['board'] = implode(', ', $includedBoard); diff --git a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_travelinfoteaser.php b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_travelinfoteaser.php index ee58aaf8..ff55a812 100644 --- a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_travelinfoteaser.php +++ b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_travelinfoteaser.php @@ -27,7 +27,7 @@ return [ ], ], 'palettes' => [ - 'basics' => ['showitem' => 'title,icon,hidden'], + 'basics' => ['showitem' => 'title,category,hidden'], ], 'columns' => [ @@ -173,9 +173,9 @@ return [ $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] ), ], - 'icon' => [ + 'category' => [ 'exclude' => 0, - 'label' => 'Icon', + 'label' => 'Kategorie/Icon', 'config' => [ 'type' => 'select', 'renderType' => 'selectSingle', @@ -190,6 +190,8 @@ return [ ['Wetter', 'weather'], ['Wissenswertes', 'chat'], ], + 'maxitems' => 1, + 'minitems' => 1, ], ], 'tx_epproducts_travelinfo' => [ diff --git a/public/typo3conf/ext/ep_products/ext_tables.sql b/public/typo3conf/ext/ep_products/ext_tables.sql index d239a503..6ab240b8 100644 --- a/public/typo3conf/ext/ep_products/ext_tables.sql +++ b/public/typo3conf/ext/ep_products/ext_tables.sql @@ -119,6 +119,7 @@ CREATE TABLE tx_epproducts_domain_model_date bus_price int(11) DEFAULT '0' NOT NULL, services_included text NOT NULL, services_general text NOT NULL, + courses_included text NOT NULL, pickups text NOT NULL, discount int(11) DEFAULT '0' NOT NULL, min_price int(11) DEFAULT '0' NOT NULL, @@ -1420,7 +1421,7 @@ CREATE TABLE tx_epproducts_domain_model_travelinfoteaser title varchar(255) DEFAULT '' NOT NULL, bodytext text DEFAULT '0' NOT NULL, image int(11) DEFAULT '0' NOT NULL, - icon varchar(255) DEFAULT '' NOT NULL, + category varchar(255) DEFAULT '' NOT NULL, tx_epproducts_travelinfo int(11) unsigned DEFAULT '0' NOT NULL, sorting int(11) unsigned DEFAULT '0' NOT NULL, diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Travelinfo/Index.html b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Travelinfo/Index.html index 78079d9b..76d6a812 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Travelinfo/Index.html +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Travelinfo/Index.html @@ -114,37 +114,16 @@
-
-
- -
-
- -
-
-
-
-
-

- {teaser.title} -

- {teaser.bodytext -> f:format.html()} -
-
- -
-
-
-
+ + + + + + + + + +
@@ -199,6 +178,40 @@
+ +
+
+ +
+
+ +
+
+
+
+
+

+ {teaser.title} +

+ {teaser.bodytext -> f:format.html()} +
+
+ +
+
+
+
+
+