diff --git a/.gitignore b/.gitignore index 42cd73d..ee4e287 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -/vendor/ \ No newline at end of file +/composer.lock +/public/ +/vendor/ diff --git a/Classes/Command/DestinationDataImportCommand.php b/Classes/Command/DestinationDataImportCommand.php index 79e45b1..ca638ff 100644 --- a/Classes/Command/DestinationDataImportCommand.php +++ b/Classes/Command/DestinationDataImportCommand.php @@ -1,18 +1,18 @@ addArgument('rest-experience', + $this->addArgument( + 'rest-experience', InputArgument::OPTIONAL, 'What is the rest experience?', 'stadtmarketing-erfurt' ); - $this->addArgument('files-folder', + $this->addArgument( + 'files-folder', InputArgument::OPTIONAL, 'Where to save the image files?', 'staedte/erfurt/events/' @@ -56,4 +58,4 @@ class DestinationDataImportCommand extends Command { $input->getArgument('files-folder') ); } -} \ No newline at end of file +} diff --git a/Classes/Command/RemoveAllCommand.php b/Classes/Command/RemoveAllCommand.php index 38306ab..c338f45 100644 --- a/Classes/Command/RemoveAllCommand.php +++ b/Classes/Command/RemoveAllCommand.php @@ -1,4 +1,5 @@ get(CleanupService::class) ->deleteAllData(); + + return 0; } } diff --git a/Classes/Command/RemovePastCommand.php b/Classes/Command/RemovePastCommand.php index c661c39..01c1a55 100644 --- a/Classes/Command/RemovePastCommand.php +++ b/Classes/Command/RemovePastCommand.php @@ -1,4 +1,5 @@ + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; +use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; + +class AbstractController extends ActionController +{ + /** + * Extend original to also add data from current cobject if available. + */ + protected function resolveView() + { + $view = parent::resolveView(); + + $view->assign('data', []); + $cObject = $this->configurationManager->getContentObject(); + if ($cObject instanceof ContentObjectRenderer && is_array($cObject->data)) { + $view->assign('data', $cObject->data); + } + + return $view; + } +} diff --git a/Classes/Controller/DateController.php b/Classes/Controller/DateController.php index 511cdab..db6bea3 100644 --- a/Classes/Controller/DateController.php +++ b/Classes/Controller/DateController.php @@ -1,19 +1,22 @@ categoryRepository = $categoryRepository; } + /** + * @param DataProcessingForModels $dataProcessing + */ + public function injectDataProcessingForModels(DataProcessingForModels $dataProcessing) + { + $this->dataProcessing = $dataProcessing; + } + /** * Action initializer */ protected function initializeAction() { + $this->dataProcessing->setConfigurationManager($this->configurationManager); $this->pluginSettings = $this->configurationManager->getConfiguration( ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK ); @@ -124,10 +141,12 @@ class DateController extends ActionController /** * action show * + * @Extbase\IgnoreValidation("date") + * * @param \Wrm\Events\Domain\Model\Date $date * @return void */ - public function showAction(\Wrm\Events\Domain\Model\Date $date) + public function showAction(Date $date) { $this->view->assign('date', $date); } @@ -147,6 +166,8 @@ class DateController extends ActionController $demand->setSortBy((string)$this->settings['sortByDate']); $demand->setSortOrder((string)$this->settings['sortOrder']); $demand->setHighlight((int)$this->settings['highlight']); + $demand->setStart((string)$this->settings['start'] ?? ''); + $demand->setEnd((string)$this->settings['end'] ?? ''); if (!empty($this->settings['limit'])) { $demand->setLimit($this->settings['limit']); diff --git a/Classes/Controller/EventController.php b/Classes/Controller/EventController.php index 805b2a4..c247b06 100644 --- a/Classes/Controller/EventController.php +++ b/Classes/Controller/EventController.php @@ -1,130 +1,75 @@ eventRepository = $eventRepository; + $this->dataProcessing = $dataProcessing; + $this->demandFactory = $demandFactory; } - /** - * Action initializer - */ protected function initializeAction() { - $this->pluginSettings = $this->configurationManager->getConfiguration( - ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK - ); + $this->dataProcessing->setConfigurationManager($this->configurationManager); } - /** - * Action list - * - * @return void - */ - public function listAction() + public function listAction(): void { - - $demand = $this->createDemandFromSettings(); + $demand = $this->demandFactory->fromSettings($this->settings); $events = $this->eventRepository->findByDemand($demand); $this->view->assign('events', $events); - } /** - * Action show - * - * @param Event $event - * @return void + * @Extbase\IgnoreValidation("event") */ - public function showAction(Event $event) + public function showAction(Event $event): void { $this->view->assign('event', $event); } /** - * action teaser - * - * @return void + * @deprecated Use listAction instead and configure settings properly. + * Use Settings or something else to switch between list and teaser rendering. */ - public function teaserAction() + public function teaserAction(): void { - $events = $this->eventRepository->findByUids($this->settings['eventUids']); - $this->view->assign('events', $events); + $this->view->assignMultiple([ + 'events' => $this->eventRepository->findByUids($this->settings['eventUids']), + ]); } - /** - * @param string $search - */ - public function searchAction(): void + public function searchAction(string $search = ''): void { - $search = ''; - if ($this->request->hasArgument('search')) { - $search = $this->request->getArgument('search'); - } - $this->view->assign('search', $search); $this->view->assign('events', $this->eventRepository->findSearchWord($search)); - - } - - /** - * @return EventDemand - */ - - protected function createDemandFromSettings(): EventDemand - { - $demand = $this->objectManager->get(EventDemand::class); - - $demand->setRegion((string)$this->settings['region']); - - $demand->setCategories((string)$this->settings['categories']); - $categoryCombination = (int)$this->settings['categoryCombination'] === 1 ? 'or' : 'and'; - - $demand->setCategoryCombination($categoryCombination); - - $demand->setIncludeSubCategories((bool)$this->settings['includeSubcategories']); - - $demand->setSortBy((string)$this->settings['sortByEvent']); - $demand->setSortOrder((string)$this->settings['sortOrder']); - - $demand->setHighlight((bool)$this->settings['highlight']); - - if (!empty($this->settings['limit'])) { - $demand->setLimit($this->settings['limit']); - } - - return $demand; } } diff --git a/Classes/Domain/Model/Category.php b/Classes/Domain/Model/Category.php new file mode 100644 index 0000000..1b1412e --- /dev/null +++ b/Classes/Domain/Model/Category.php @@ -0,0 +1,40 @@ + + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +use TYPO3\CMS\Extbase\Domain\Model\Category as ExtbaseCategory; + +/** + * Extend original model to include furher properties. + */ +class Category extends ExtbaseCategory +{ + /** + * @var int + */ + protected $sorting = 0; + + public function getSorting(): int + { + return $this->sorting; + } +} diff --git a/Classes/Domain/Model/Date.php b/Classes/Domain/Model/Date.php index 84d596b..06384b9 100644 --- a/Classes/Domain/Model/Date.php +++ b/Classes/Domain/Model/Date.php @@ -1,11 +1,13 @@ end = $end; } + + /** * @return Event */ @@ -83,15 +107,56 @@ class Date extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity * @param int $languageUid * @return void */ - public function setLanguageUid($languageUid) { + public function setLanguageUid($languageUid) + { $this->_languageUid = $languageUid; } /** * @return int */ - public function getLanguageUid() { + public function getLanguageUid() + { return $this->_languageUid; } + /** + * @return string + */ + public function getCanceled(): string + { + return $this->canceled; + } + + /** + * @param string $canceled + * @return void + */ + public function setCanceled(string $canceled) + { + $this->canceled = $canceled; + } + + public function getPostponedDate(): ?Date + { + if ($this->getCanceled() === 'postponed') { + return $this->postponedDate; + } + + return null; + } + + public function getOriginalDate(): ?Date + { + return $this->originalDate; + } + + public function getCanceledLink(): string + { + if ($this->getCanceled() === 'canceled') { + return $this->canceledLink; + } + + return ''; + } } diff --git a/Classes/Domain/Model/Dto/DateDemand.php b/Classes/Domain/Model/Dto/DateDemand.php index fe6d447..319b40c 100644 --- a/Classes/Domain/Model/Dto/DateDemand.php +++ b/Classes/Domain/Model/Dto/DateDemand.php @@ -4,7 +4,8 @@ namespace Wrm\Events\Domain\Model\Dto; use TYPO3\CMS\Core\Utility\GeneralUtility; -class DateDemand { +class DateDemand +{ /** * @var string diff --git a/Classes/Domain/Model/Dto/EventDemand.php b/Classes/Domain/Model/Dto/EventDemand.php index 0367554..f07f843 100644 --- a/Classes/Domain/Model/Dto/EventDemand.php +++ b/Classes/Domain/Model/Dto/EventDemand.php @@ -2,7 +2,8 @@ namespace Wrm\Events\Domain\Model\Dto; -class EventDemand { +class EventDemand +{ /** * @var string @@ -44,6 +45,11 @@ class EventDemand { */ protected $limit = ''; + /** + * @var array + */ + protected $recordUids = []; + /** * @return string */ @@ -172,6 +178,19 @@ class EventDemand { $this->limit = $limit; } + /** + * @return array + */ + public function getRecordUids(): array + { + return $this->recordUids; + } - -} \ No newline at end of file + /** + * @param array $recordUids + */ + public function setRecordUids(array $recordUids): void + { + $this->recordUids = $recordUids; + } +} diff --git a/Classes/Domain/Model/Dto/EventDemandFactory.php b/Classes/Domain/Model/Dto/EventDemandFactory.php new file mode 100644 index 0000000..7011fc7 --- /dev/null +++ b/Classes/Domain/Model/Dto/EventDemandFactory.php @@ -0,0 +1,58 @@ + + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +use TYPO3\CMS\Core\Utility\GeneralUtility; + +class EventDemandFactory +{ + public function fromSettings(array $settings): EventDemand + { + /** @var EventDemand $demand */ + $demand = GeneralUtility::makeInstance(EventDemand::class); + + $demand->setRegion((string)$settings['region']); + + $demand->setCategories((string)$settings['categories']); + + $categoryCombination = 'and'; + if ((int)$settings['categoryCombination'] === 1) { + $categoryCombination = 'or'; + } + $demand->setCategoryCombination($categoryCombination); + + $demand->setIncludeSubCategories((bool)$settings['includeSubcategories']); + + $demand->setSortBy((string)$settings['sortByEvent']); + $demand->setSortOrder((string)$settings['sortOrder']); + + $demand->setHighlight((bool)$settings['highlight']); + + $demand->setRecordUids(GeneralUtility::intExplode(',', $settings['selectedRecords'], true)); + + if (!empty($settings['limit'])) { + $demand->setLimit($settings['limit']); + } + + return $demand; + } +} diff --git a/Classes/Domain/Model/Event.php b/Classes/Domain/Model/Event.php index 1e82129..b877f71 100644 --- a/Classes/Domain/Model/Event.php +++ b/Classes/Domain/Model/Event.php @@ -1,12 +1,14 @@ + * @Extbase\ORM\Cascade remove */ - protected $images = null; + protected $images; /** * dates - * - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Wrm\Events\Domain\Model\Date> - * @cascade remove + * + * @var ObjectStorage + * @Extbase\ORM\Cascade remove */ - protected $dates = null; + protected $dates; /** * organizer - * + * * @var \Wrm\Events\Domain\Model\Organizer */ protected $organizer = null; /** * region - * - * @var \Wrm\Events\Domain\Model\Region + * + * @var Region */ protected $region = null; + /** + * @var string + */ + protected $pages = ''; + /** * categories - * - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\Category> + * + * @var ObjectStorage */ protected $categories; + /** + * @var ObjectStorage + */ + protected $partner; + + /** + * @var ObjectStorage + */ + protected $referencesEvents; + /** * @var int */ protected $_languageUid; /** - * __construct + * @var DataProcessingForModels */ + protected $dataProcessing = null; + public function __construct() { + $this->initStorageObjects(); + } - //Do not remove the next line: It would break the functionality + /** + * @param DataProcessingForModels $dataProcessing + */ + public function injectDataProcessingForModels(DataProcessingForModels $dataProcessing) + { + $this->dataProcessing = $dataProcessing; + } + + public function initializeObject() + { $this->initStorageObjects(); } @@ -218,12 +255,16 @@ class Event extends AbstractEntity */ protected function initStorageObjects() { + $this->images = new ObjectStorage(); $this->dates = new ObjectStorage(); + $this->categories = new ObjectStorage(); + $this->partner = new ObjectStorage(); + $this->referencesEvents = new ObjectStorage(); } /** * Returns the globalId - * + * * @return string $globalId */ public function getGlobalId() @@ -257,6 +298,23 @@ class Event extends AbstractEntity $this->title = $title; } + /** + * @return string $subtitle + */ + public function getSubtitle() + { + return $this->subtitle; + } + + /** + * @param string $subtitle + * @return void + */ + public function setSubtitle($subtitle) + { + $this->subtitle = $subtitle; + } + /** * @return string $teaser */ @@ -479,7 +537,7 @@ class Event extends AbstractEntity /** * @return string $instagram - */ + */ public function getInstagram() { return $this->instagram; @@ -487,12 +545,12 @@ class Event extends AbstractEntity /** * @param string $instagram - */ + */ public function setInstagram(string $instagram) { $this->instagram = $instagram; } - + /** * @return string $latitude */ @@ -528,18 +586,18 @@ class Event extends AbstractEntity } /** - * @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $images + * @return ObjectStorage $images */ - public function getImages() + public function getImages(): ObjectStorage { return $this->images; } /** - * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $images + * @param ObjectStorage $images * @return void */ - public function setImages(\TYPO3\CMS\Extbase\Domain\Model\FileReference $images) + public function setImages(FileReference $images) { $this->images = $images; } @@ -604,7 +662,8 @@ class Event extends AbstractEntity * @param ObjectStorage $dates * @return void */ - public function removeAllDates(ObjectStorage $dates) { + public function removeAllDates(ObjectStorage $dates) + { $this->dates->removeAll($dates); } @@ -616,11 +675,27 @@ class Event extends AbstractEntity return $this->organizer; } + /** + * @return ObjectStorage + */ + public function getPartner(): ObjectStorage + { + return $this->partner; + } + + /** + * @return ObjectStorage + */ + public function getReferencesEvents(): ObjectStorage + { + return $this->referencesEvents; + } + /** * @param \Wrm\Events\Domain\Model\Organizer $organizer * @return void */ - public function setOrganizer(\Wrm\Events\Domain\Model\Organizer $organizer) + public function setOrganizer(Organizer $organizer) { $this->organizer = $organizer; } @@ -637,7 +712,7 @@ class Event extends AbstractEntity * @param \Wrm\Events\Domain\Model\Region $region * @return void */ - public function setRegion(\Wrm\Events\Domain\Model\Region $region) + public function setRegion(Region $region) { $this->region = $region; } @@ -684,20 +759,35 @@ class Event extends AbstractEntity $this->country = $country; } + public function getPages(): array + { + static $pages = null; + if (is_array($pages)) { + return $pages; + } + + $pages = $this->dataProcessing->process($this); + + return $pages; + } + /** * @param \TYPO3\CMS\Extbase\Domain\Model\Category<\TYPO3\CMS\Extbase\Domain\Model\Category> $category */ - public function addCategory(\TYPO3\CMS\Extbase\Domain\Model\Category $category) + public function addCategory(Category $category) { $this->categories->attach($category); } - /** - * @return $categories - */ - public function getCategories() + public function getCategories(): array { - return $this->categories; + $categories = $this->categories->toArray(); + + usort($categories, function (Category $catA, Category $catB) { + return $catA->getSorting() <=> $catB->getSorting(); + }); + + return $categories; } /** @@ -712,14 +802,24 @@ class Event extends AbstractEntity * @param int $languageUid * @return void */ - public function setLanguageUid($languageUid) { + public function setLanguageUid($languageUid) + { $this->_languageUid = $languageUid; } /** * @return int */ - public function getLanguageUid() { + public function getLanguageUid() + { return $this->_languageUid; } + + /** + * @return int + */ + public function getLocalizedUid() + { + return $this->_localizedUid; + } } diff --git a/Classes/Domain/Model/Organizer.php b/Classes/Domain/Model/Organizer.php index b0c73d0..583b1e6 100644 --- a/Classes/Domain/Model/Organizer.php +++ b/Classes/Domain/Model/Organizer.php @@ -1,8 +1,8 @@ * - ***/ + */ + +use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; + /** * Organizer */ -class Organizer extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity +class Organizer extends AbstractEntity { /** * name - * + * * @var string */ protected $name = ''; /** * street - * + * * @var string */ protected $street = ''; /** * district - * + * * @var string */ protected $district = ''; /** * city - * + * * @var string */ protected $city = ''; /** * zip - * + * * @var string */ protected $zip = ''; /** * phone - * + * * @var string */ protected $phone = ''; /** * web - * + * * @var string */ protected $web = ''; /** * email - * + * * @var string */ protected $email = ''; @@ -81,7 +84,7 @@ class Organizer extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity /** * Returns the name - * + * * @return string $name */ public function getName() @@ -91,7 +94,7 @@ class Organizer extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity /** * Sets the name - * + * * @param string $name * @return void */ @@ -102,7 +105,7 @@ class Organizer extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity /** * Returns the street - * + * * @return string $street */ public function getStreet() @@ -112,7 +115,7 @@ class Organizer extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity /** * Sets the street - * + * * @param string $street * @return void */ @@ -123,7 +126,7 @@ class Organizer extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity /** * Returns the district - * + * * @return string $district */ public function getDistrict() @@ -133,7 +136,7 @@ class Organizer extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity /** * Sets the district - * + * * @param string $district * @return void */ @@ -144,7 +147,7 @@ class Organizer extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity /** * Returns the city - * + * * @return string $city */ public function getCity() @@ -154,7 +157,7 @@ class Organizer extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity /** * Sets the city - * + * * @param string $city * @return void */ @@ -165,7 +168,7 @@ class Organizer extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity /** * Returns the zip - * + * * @return string $zip */ public function getZip() @@ -175,7 +178,7 @@ class Organizer extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity /** * Sets the zip - * + * * @param string $zip * @return void */ @@ -186,7 +189,7 @@ class Organizer extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity /** * Returns the phone - * + * * @return string $phone */ public function getPhone() @@ -196,7 +199,7 @@ class Organizer extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity /** * Sets the phone - * + * * @param string $phone * @return void */ @@ -207,7 +210,7 @@ class Organizer extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity /** * Returns the web - * + * * @return string $web */ public function getWeb() @@ -217,7 +220,7 @@ class Organizer extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity /** * Sets the web - * + * * @param string $web * @return void */ @@ -228,7 +231,7 @@ class Organizer extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity /** * Returns the email - * + * * @return string $email */ public function getEmail() @@ -238,7 +241,7 @@ class Organizer extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity /** * Sets the email - * + * * @param string $email * @return void */ @@ -262,7 +265,7 @@ class Organizer extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity * Do not modify this method! * It will be rewritten on each save in the extension builder * You may modify the constructor of this class instead - * + * * @return void */ protected function initStorageObjects() @@ -273,14 +276,16 @@ class Organizer extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity * @param int $languageUid * @return void */ - public function setLanguageUid($languageUid) { + public function setLanguageUid($languageUid) + { $this->_languageUid = $languageUid; } /** * @return int */ - public function getLanguageUid() { + public function getLanguageUid() + { return $this->_languageUid; } } diff --git a/Classes/Domain/Model/Partner.php b/Classes/Domain/Model/Partner.php new file mode 100644 index 0000000..2b9a607 --- /dev/null +++ b/Classes/Domain/Model/Partner.php @@ -0,0 +1,59 @@ + + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; +use TYPO3\CMS\Extbase\Domain\Model\FileReference; +use TYPO3\CMS\Extbase\Persistence\ObjectStorage; + +class Partner extends AbstractEntity +{ + /** + * @var string + */ + protected $title = ''; + + /** + * @var string + */ + protected $link = ''; + + /** + * @var ObjectStorage + */ + protected $images = null; + + public function getTitle(): string + { + return $this->title; + } + + public function getLink(): string + { + return $this->link; + } + + public function getImages(): ObjectStorage + { + return $this->images; + } +} diff --git a/Classes/Domain/Model/Region.php b/Classes/Domain/Model/Region.php index 8a2b74e..8c8bae2 100644 --- a/Classes/Domain/Model/Region.php +++ b/Classes/Domain/Model/Region.php @@ -1,8 +1,8 @@ * - ***/ + */ + +use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; + /** * Region */ -class Region extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity +class Region extends AbstractEntity { /** * title - * + * * @var string */ protected $title = ''; - + /** * @var int */ @@ -32,7 +35,7 @@ class Region extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity /** * Returns the title - * + * * @return string $title */ public function getTitle() @@ -42,7 +45,7 @@ class Region extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity /** * Sets the title - * + * * @param string $title * @return void */ @@ -66,7 +69,7 @@ class Region extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity * Do not modify this method! * It will be rewritten on each save in the extension builder * You may modify the constructor of this class instead - * + * * @return void */ protected function initStorageObjects() @@ -77,14 +80,16 @@ class Region extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity * @param int $languageUid * @return void */ - public function setLanguageUid($languageUid) { + public function setLanguageUid($languageUid) + { $this->_languageUid = $languageUid; } /** * @return int */ - public function getLanguageUid() { + public function getLanguageUid() + { return $this->_languageUid; } } diff --git a/Classes/Domain/Repository/DateRepository.php b/Classes/Domain/Repository/DateRepository.php index 746abba..6204037 100644 --- a/Classes/Domain/Repository/DateRepository.php +++ b/Classes/Domain/Repository/DateRepository.php @@ -1,15 +1,17 @@ equals('event.region', $demand->getRegion()); } - if ($demand->getHighlight() !== FALSE) { + if ($demand->getHighlight() !== false) { $constraints['highlight'] = $query->equals('event.highlight', $demand->getHighlight()); } @@ -78,14 +80,14 @@ class DateRepository extends \TYPO3\CMS\Extbase\Persistence\Repository $constraints['userCategories'] = $query->in('event.categories.uid', $demand->getUserCategories()); } - if ($demand->getStart() !== '' && $demand->getEnd() != '') { - $constraints['daterange'] = $query->logicalAnd( - [ - $query->greaterThanOrEqual('start', $demand->getStart()), - $query->lessThanOrEqual('end', $demand->getEnd()) - ] - ); - } else { + if ($demand->getStart() !== '') { + $constraints['starts'] = $query->greaterThanOrEqual('start', $demand->getStart()); + } + if ($demand->getEnd() != '') { + $constraints['ends'] = $query->lessThanOrEqual('end', $demand->getEnd()); + } + + if ($demand->getStart() === '' && $demand->getEnd() === '') { $now = new \DateTime('now', new \DateTimeZone('Europe/Berlin')); $constraints['untilnow'] = $query->greaterThanOrEqual('start', $now); } @@ -182,5 +184,4 @@ class DateRepository extends \TYPO3\CMS\Extbase\Persistence\Repository return $statement->execute()->fetchAll(); } - } diff --git a/Classes/Domain/Repository/EventRepository.php b/Classes/Domain/Repository/EventRepository.php index c20a99e..2797deb 100644 --- a/Classes/Domain/Repository/EventRepository.php +++ b/Classes/Domain/Repository/EventRepository.php @@ -1,7 +1,8 @@ createQuery(); - //$query->getQuerySettings()->setRespectStoragePage(false); - - $query->matching( - $query->in('uid', $uids) - ); - - //return $this->orderByField($query->execute(), $uids); + $query->matching($query->in('uid', GeneralUtility::intExplode(',', $uids))); return $query->execute(); } /** - * @param EventDemand $demand - * @return QueryResultInterface + * @return QueryResultInterface|array * @throws InvalidQueryException */ public function findByDemand(EventDemand $demand) { $query = $this->createDemandQuery($demand); + + if ($demand->getRecordUids() !== [] && $demand->getSortBy() === 'default') { + return $this->sortByDemand($query, $demand); + } + return $query->execute(); } /** - * @param EventDemand $demand - * @return QueryInterface * @throws InvalidQueryException */ protected function createDemandQuery(EventDemand $demand): QueryInterface { $query = $this->createQuery(); + $query = $this->setOrderings($query, $demand); - // sorting - $sortBy = $demand->getSortBy(); - if ($sortBy && $sortBy !== 'singleSelection' && $sortBy !== 'default') { - $order = strtolower($demand->getSortOrder()) === 'desc' ? QueryInterface::ORDER_DESCENDING : QueryInterface::ORDER_ASCENDING; - $query->setOrderings([$sortBy => $order]); + $constraints = $this->getConstraints($query, $demand); + if (!empty($constraints)) { + $query->matching($query->logicalAnd($constraints)); } + if ($demand->getLimit() !== '') { + $query->setLimit((int) $demand->getLimit()); + } + + return $query; + } + + private function setOrderings(QueryInterface $query, EventDemand $demand): QueryInterface + { + $sortBy = $demand->getSortBy(); + $sortingsToIgnore = ['singleSelection', 'default']; + + if (!$sortBy || in_array($sortBy, $sortingsToIgnore)) { + return $query; + } + + $order = QueryInterface::ORDER_ASCENDING; + if (strtolower($demand->getSortOrder()) === 'desc') { + $order = QueryInterface::ORDER_DESCENDING; + } + + $query->setOrderings([$sortBy => $order]); + + return $query; + } + + private function sortByDemand(QueryInterface $query, EventDemand $demand): array + { + $result = $query->execute()->toArray(); + $expectedSorting = $demand->getRecordUids(); + + usort($result, function (Event $eventA, Event $eventB) use ($expectedSorting) { + $positionOfA = array_search($eventA->getUid(), $expectedSorting); + if ($positionOfA === false) { + $positionOfA = array_search($eventA->getLocalizedUid(), $expectedSorting); + } + + $positionOfB = array_search($eventB->getUid(), $expectedSorting); + if ($positionOfB === false) { + $positionOfB = array_search($eventB->getLocalizedUid(), $expectedSorting); + } + + return $positionOfA <=> $positionOfB; + }); + + return $result; + } + + private function getConstraints(QueryInterface $query, EventDemand $demand): array + { $constraints = []; - $categories = $demand->getCategories(); + if ($demand->getCategories()) { + $constraints['categories'] = $this->createCategoryConstraint($query, $demand); + } - if ($categories) { - $categoryConstraints = $this->createCategoryConstraint($query, $categories, $demand->getIncludeSubCategories()); - if ($demand->getCategoryCombination() === 'or') { - $constraints['categories'] = $query->logicalOr($categoryConstraints); - } else { - $constraints['categories'] = $query->logicalAnd($categoryConstraints); - } + if ($demand->getRecordUids() !== []) { + $constraints['recordUids'] = $query->in('uid', $demand->getRecordUids()); } if ($demand->getRegion() !== '') { @@ -94,53 +130,42 @@ class EventRepository extends \TYPO3\CMS\Extbase\Persistence\Repository $constraints['highlight'] = $query->equals('highlight', $demand->getHighlight()); } - if ($demand->getLimit() !== '') { - $query->setLimit((int) $demand->getLimit()); - } - - if (!empty($constraints)) { - $query->matching($query->logicalAnd($constraints)); - } - return $query; + return $constraints; } /** - * @param QueryInterface $query - * @param string $categories - * @param bool $includeSubCategories - * @return array * @throws InvalidQueryException */ - protected function createCategoryConstraint(QueryInterface $query, $categories, bool $includeSubCategories = false): array + protected function createCategoryConstraint(QueryInterface $query, EventDemand $demand): ConstraintInterface { $constraints = []; - if ($includeSubCategories) { + $allCategories = GeneralUtility::intExplode(',', $demand->getCategories(), true); + + if ($demand->getIncludeSubCategories()) { $categoryService = GeneralUtility::makeInstance(CategoryService::class); - $allCategories = $categoryService->getChildrenCategories($categories); + $allCategories = $categoryService->getChildrenCategories($demand->getCategories()); if (!\is_array($allCategories)) { $allCategories = GeneralUtility::intExplode(',', $allCategories, true); } - } else { - $allCategories = GeneralUtility::intExplode(',', $categories, true); } foreach ($allCategories as $category) { $constraints[] = $query->contains('categories', $category); } - return $constraints; - } + if ($demand->getCategoryCombination() === 'or') { + return $query->logicalOr($constraints); + } + return $query->logicalAnd($constraints); + } public function findSearchWord($search) { $query = $this->createQuery(); - $query->matching( - $query->like('title', '%' . $search . '%') - ); + $query->matching($query->like('title', '%' . $search . '%')); $query->setOrderings(['title' => QueryInterface::ORDER_ASCENDING]); $query->setLimit(20); return $query->execute(); } - -} \ No newline at end of file +} diff --git a/Classes/Domain/Repository/OrganizerRepository.php b/Classes/Domain/Repository/OrganizerRepository.php index cc2b07f..e43570f 100644 --- a/Classes/Domain/Repository/OrganizerRepository.php +++ b/Classes/Domain/Repository/OrganizerRepository.php @@ -1,7 +1,8 @@ + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Extbase\Event\Persistence\AfterObjectThawedEvent; +use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper; +use Wrm\Events\Domain\Model\Date; + +class AddSpecialProperties +{ + /** + * @var ConnectionPool + */ + private $connectionPool; + + /** + * @var DataMapper + */ + private $dataMapper; + + /** + * Internal info to speed things up if we know there are none. + * @var bool + */ + private $doPostponedDatesExist = true; + + public function __construct( + ConnectionPool $connectionPool, + DataMapper $dataMapper + ) { + $this->connectionPool = $connectionPool; + $this->dataMapper = $dataMapper; + + $qb = $this->connectionPool->getQueryBuilderForTable('tx_events_domain_model_date'); + $qb->count('uid'); + $qb->from('tx_events_domain_model_date'); + $qb->where($qb->expr()->gt('postponed_date', $qb->createNamedParameter(0))); + $this->doPostponedDatesExist = $qb->execute()->fetchColumn() > 0; + } + + public function __invoke(AfterObjectThawedEvent $event): void + { + if ( + $this->doPostponedDatesExist + && $event->getObject() instanceof Date + ) { + /** @var Date $date */ + $date = $event->getObject(); + $date->_setProperty('originalDate', $this->getOriginalDate($date->_getProperty('_localizedUid'))); + } + } + + private function getOriginalDate(int $uidOfReferencedDate): ?Date + { + $qb = $this->connectionPool->getQueryBuilderForTable('tx_events_domain_model_date'); + $qb->select('*'); + $qb->from('tx_events_domain_model_date'); + $qb->where($qb->expr()->eq('postponed_date', $uidOfReferencedDate)); + $qb->setMaxResults(1); + + $result = $qb->execute()->fetch(); + + if ($result === false) { + return null; + } + + $dates = $this->dataMapper->map(Date::class, [$result]); + return $dates[0] ?? null; + } +} diff --git a/Classes/Service/CategoryService.php b/Classes/Service/CategoryService.php index d11aa32..a7b1637 100755 --- a/Classes/Service/CategoryService.php +++ b/Classes/Service/CategoryService.php @@ -21,7 +21,7 @@ class CategoryService public function __construct() { $this->timeTracker = GeneralUtility::makeInstance(TimeTracker::class); - $this->cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('cache_Events_category'); + $this->cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('events_category'); } /** diff --git a/Classes/Service/DataProcessingForModels.php b/Classes/Service/DataProcessingForModels.php new file mode 100644 index 0000000..bc5a596 --- /dev/null +++ b/Classes/Service/DataProcessingForModels.php @@ -0,0 +1,176 @@ + + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +use TYPO3\CMS\Core\Database\Connection; +use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Core\SingletonInterface; +use TYPO3\CMS\Core\TypoScript\TypoScriptService; +use TYPO3\CMS\Core\Utility\ArrayUtility; +use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; +use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; +use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory; +use TYPO3\CMS\Frontend\ContentObject\ContentDataProcessor; +use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; + +/** + * Used by models to apply data processing. + * This allows for flexibility of integrators. + * + * E.g. pages are saved for each event. + * An integrator now can resolve them via data processing to arrays or menus. + * + * dataProcessing is configured via TypoScript for each plugin or whole extension via + * settings.dataProcessing.fqcn, e.g.: + * + * plugin.tx_events { + * settings { + * dataProcessing { + * Wrm\Events\Domain\Model\Event { + * 10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor + * 10 { + * special = list + * special.value.field = pages + * dataProcessing { + * 10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor + * 10 { + * references.fieldName = media + * } + * } + * } + * } + * } + * } + * } + * + * Currently supported by: + * + * - Event->getPages() + */ +class DataProcessingForModels implements SingletonInterface +{ + /** + * @var ContentObjectRenderer + */ + private $cObject; + + /** + * @var ContentDataProcessor + */ + private $processorHandler; + + /** + * @var Connection + */ + private $connection; + + /** + * @var DataMapFactory + */ + private $dataMapFactory; + + /** + * @var ConfigurationManagerInterface|null + */ + private $configurationManager; + + /** + * @var TypoScriptService + */ + private $typoScriptService; + + public function __construct( + ContentDataProcessor $processorHandler, + ConnectionPool $connectionPool, + DataMapFactory $dataMapFactory, + TypoScriptService $typoScriptService + ) { + $this->cObject = GeneralUtility::makeInstance(ContentObjectRenderer::class); + $this->processorHandler = $processorHandler; + $this->connection = $connectionPool->getConnectionByName('Default'); + $this->dataMapFactory = $dataMapFactory; + $this->typoScriptService = $typoScriptService; + } + + /** + * Used to set current configuration from within plugin. + * + * Inject and call this method, e.g. within initializeAction. + * Necessary to get plugin configuration containing dataProcessing configuration. + */ + public function setConfigurationManager(ConfigurationManagerInterface $configurationManager): void + { + $this->configurationManager = $configurationManager; + } + + public function process( + AbstractEntity $entity + ): array { + $configuration = $this->getConfiguration($entity); + + if ($configuration === []) { + return []; + } + + $this->cObject->start($this->getData($entity), $this->getTable($entity)); + return $this->processorHandler->process($this->cObject, $configuration, []); + } + + private function getData(AbstractEntity $entity): array + { + $row = $this->connection->select(['*'], $this->getTable($entity), ['uid' => $entity->getUid()])->fetch(); + if (is_array($row)) { + return $row; + } + + return []; + } + + private function getTable(AbstractEntity $entity): string + { + $dataMap = $this->dataMapFactory->buildDataMap(get_class($entity)); + return $dataMap->getTableName(); + } + + private function getConfiguration(AbstractEntity $entity): array + { + if ($this->configurationManager === null) { + return []; + } + + $className = get_class($entity); + $settings = $this->configurationManager->getConfiguration( + ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS + ); + + if (ArrayUtility::isValidPath($settings, 'dataProcessing.' . $className, '.') === false) { + return []; + } + + $configuration = ArrayUtility::getValueByPath($settings, 'dataProcessing.' . $className, '.'); + $configuration = $this->typoScriptService->convertPlainArrayToTypoScriptArray($configuration); + return [ + 'dataProcessing.' => $configuration, + ]; + } +} diff --git a/Classes/Service/DestinationDataImportService.php b/Classes/Service/DestinationDataImportService.php index 118f970..d0b7c85 100644 --- a/Classes/Service/DestinationDataImportService.php +++ b/Classes/Service/DestinationDataImportService.php @@ -3,28 +3,32 @@ namespace Wrm\Events\Service; use TYPO3\CMS\Core\Core\Environment; +use TYPO3\CMS\Core\DataHandling\DataHandler; +use TYPO3\CMS\Core\DataHandling\SlugHelper; +use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Core\Log\LogManager; +use TYPO3\CMS\Core\Resource\Exception\FolderDoesNotExistException; use TYPO3\CMS\Core\Resource\FileRepository; use TYPO3\CMS\Core\Resource\Index\MetaDataRepository; use TYPO3\CMS\Core\Resource\ResourceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\DataHandling\SlugHelper; -use TYPO3\CMS\Core\Database\ConnectionPool; -use TYPO3\CMS\Core\Log\LogManager; - use TYPO3\CMS\Extbase\Configuration\ConfigurationManager; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; -use TYPO3\CMS\Extbase\Domain\Repository\CategoryRepository; -use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; +use TYPO3\CMS\Extbase\Domain\Model\Category; use TYPO3\CMS\Extbase\Object\ObjectManager; +use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; use TYPO3\CMS\Extbase\Persistence\ObjectStorage; - +use Wrm\Events\Domain\Model\Date; +use Wrm\Events\Domain\Model\Event; +use Wrm\Events\Domain\Model\Organizer; +use Wrm\Events\Domain\Repository\CategoryRepository; use Wrm\Events\Domain\Repository\DateRepository; use Wrm\Events\Domain\Repository\EventRepository; use Wrm\Events\Domain\Repository\OrganizerRepository; use Wrm\Events\Domain\Repository\RegionRepository; - -class DestinationDataImportService { +class DestinationDataImportService +{ /** * @var @@ -205,7 +209,8 @@ class DestinationDataImportService { * @param $regionUid * @param $filesFolder */ - public function import($restExperience, $storagePid, $regionUid, $filesFolder) { + public function import($restExperience, $storagePid, $regionUid, $filesFolder) + { $this->restExperience = $restExperience; $this->storagePid = $storagePid; @@ -232,21 +237,21 @@ class DestinationDataImportService { $restUrl = $this->restUrl . '?experience=' . $this->restExperience . '&licensekey=' . $this->restLicenseKey . '&type=' . $this->restType . '&mode=' . $this->restMode . '&limit=' . $this->restLimit . '&template=' . $this->restTemplate; $this->logger->info('Try to get data from ' . $restUrl); - if ($jsonResponse = json_decode(file_get_contents($restUrl),true)) { + if ($jsonResponse = json_decode(file_get_contents($restUrl), true)) { $this->logger->info('Received data with ' . count($jsonResponse['items']) . ' items'); return $this->processData($jsonResponse); } else { $this->logger->error('Could not receive data.'); return 1; } - } /** * @param $data * @return int */ - public function processData($data) { + public function processData($data) + { $this->logger->info('Processing json ' . count($data['items'])); @@ -254,7 +259,6 @@ class DestinationDataImportService { $selectedRegion = $this->regionRepository->findByUid($this->regionUid); foreach ($data['items'] as $event) { - $this->logger->info('Processing event ' . substr($event['title'], 0, 20)); // Event already exists? If not create one! @@ -270,50 +274,59 @@ class DestinationDataImportService { $this->tmpCurrentEvent->setTitle(substr($event['title'], 0, 254)); // Set Highlight (Is only set in rest if true) - if($event['highlight']) + if ($event['highlight']) { $this->tmpCurrentEvent->setHighlight($event['highlight']); + } // Set Texts - if($event['texts']) + if ($event['texts']) { $this->setTexts($event['texts']); + } // Set address and geo data - if($event['name'] || $event['street'] || $event['city'] || $event['zip'] || $event['country'] || $event['web']) + if ($event['name'] || $event['street'] || $event['city'] || $event['zip'] || $event['country'] || $event['web']) { $this->setAddress($event); + } // Set LatLng - if($event['geo']['main']['latitude'] && $event['geo']['main']['longitude']) + if ($event['geo']['main']['latitude'] && $event['geo']['main']['longitude']) { $this->setLatLng($event['geo']['main']['latitude'], $event['geo']['main']['longitude']); + } // Set Categories - if($event['categories']) + if ($event['categories']) { $this->setCategories($event['categories']); + } // Set Organizer - if($event['addresses']) + if ($event['addresses']) { $this->setOrganizer($event['addresses']); + } // Set Social - if($event['media_objects']) + if ($event['media_objects']) { $this->setSocial($event['media_objects']); + } // Set Tickets - if($event['media_objects']) + if ($event['media_objects']) { $this->setTickets($event['media_objects']); + } // Set Dates - if($event['timeIntervals']) + if ($event['timeIntervals']) { $this->setDates($event['timeIntervals']); + } // Set Assets - if($event['media_objects']) + if ($event['media_objects']) { $this->setAssets($event['media_objects']); + } // Update and persist $this->logger->info('Persist database'); $this->eventRepository->update($this->tmpCurrentEvent); $this->persistenceManager->persistAll(); - } $this->doSlugUpdate(); $this->logger->info('Finished import'); @@ -324,13 +337,14 @@ class DestinationDataImportService { * * @param array $categories */ - protected function setCategories(Array $categories) { + protected function setCategories(array $categories) + { $sysParentCategory = $this->sysCategoriesRepository->findByUid($this->categoryParentUid); foreach ($categories as $categoryTitle) { $tmpSysCategory = $this->sysCategoriesRepository->findOneByTitle($categoryTitle); if (!$tmpSysCategory) { $this->logger->info('Creating new category: ' . $categoryTitle); - $tmpSysCategory = $this->objectManager->get(\TYPO3\CMS\Extbase\Domain\Model\Category::class); + $tmpSysCategory = $this->objectManager->get(Category::class); $tmpSysCategory->setTitle($categoryTitle); $tmpSysCategory->setParent($sysParentCategory); $tmpSysCategory->setPid($this->sysCategoriesPid); @@ -346,7 +360,8 @@ class DestinationDataImportService { * @param array $timeIntervals * @TODO: split into functions */ - protected function setDates(Array $timeIntervals) { + protected function setDates(array $timeIntervals) + { // @TODO: does not seem to work --> //$currentEventDates = $this->tmpCurrentEvent->getDates(); @@ -365,13 +380,11 @@ class DestinationDataImportService { $today = $today->getTimestamp(); foreach ($timeIntervals as $date) { - // Check if dates are given as interval or not if (empty($date['interval'])) { - if (strtotime($date['start']) > $today) { $this->logger->info('Setup single date'); - $dateObj = $this->objectManager->get(\Wrm\Events\Domain\Model\Date::class); + $dateObj = $this->objectManager->get(Date::class); $start = new \DateTime($date['start'], new \DateTimeZone($date['tz'])); $end = new \DateTime($date['end'], new \DateTimeZone($date['tz'])); $this->logger->info('Start transformed ' . $start->format('Y-m-d H:i')); @@ -382,18 +395,15 @@ class DestinationDataImportService { $dateObj->setEnd($end); $this->tmpCurrentEvent->addDate($dateObj); } - } else { - if ($date['freq'] == 'Daily' && empty($date['weekdays']) && !empty($date['repeatUntil'])) { - $this->logger->info('Setup daily interval dates'); $this->logger->info('Start ' . $date['start']); $this->logger->info('End ' . $date['repeatUntil']); $start = new \DateTime($date['start'], new \DateTimeZone($date['tz'])); $until = new \DateTime($date['repeatUntil'], new \DateTimeZone($date['tz'])); - for($i = strtotime($start->format('l'), $start->getTimestamp()); $i <= $until->getTimestamp(); $i = strtotime('+1 day', $i)) { + for ($i = strtotime($start->format('l'), $start->getTimestamp()); $i <= $until->getTimestamp(); $i = strtotime('+1 day', $i)) { if ($i >= $today) { $eventStart = new \DateTime(); $eventStart->setTimestamp($i); @@ -401,17 +411,14 @@ class DestinationDataImportService { $eventEnd = new \DateTime(); $eventEnd->setTimestamp($i); $eventEnd->setTime($until->format('H'), $until->format('i')); - $dateObj = $this->objectManager->get(\Wrm\Events\Domain\Model\Date::class); + $dateObj = $this->objectManager->get(Date::class); $dateObj->setLanguageUid(-1); $dateObj->setStart($eventStart); $dateObj->setEnd($eventEnd); $this->tmpCurrentEvent->addDate($dateObj); } } - - } - - else if ($date['freq'] == 'Weekly' && !empty($date['weekdays']) && !empty($date['repeatUntil'])) { + } elseif ($date['freq'] == 'Weekly' && !empty($date['weekdays']) && !empty($date['repeatUntil'])) { foreach ($date['weekdays'] as $day) { $this->logger->info('Setup weekly interval dates for ' . $day); $this->logger->info('Start ' . $date['start']); @@ -419,7 +426,7 @@ class DestinationDataImportService { $start = new \DateTime($date['start'], new \DateTimeZone($date['tz'])); $until = new \DateTime($date['repeatUntil'], new \DateTimeZone($date['tz'])); - for($i = strtotime($day, $start->getTimestamp()); $i <= $until->getTimestamp(); $i = strtotime('+1 week', $i)) { + for ($i = strtotime($day, $start->getTimestamp()); $i <= $until->getTimestamp(); $i = strtotime('+1 week', $i)) { if ($i >= $today) { $eventStart = new \DateTime(); $eventStart->setTimestamp($i); @@ -427,7 +434,7 @@ class DestinationDataImportService { $eventEnd = new \DateTime(); $eventEnd->setTimestamp($i); $eventEnd->setTime($until->format('H'), $until->format('i')); - $dateObj = $this->objectManager->get(\Wrm\Events\Domain\Model\Date::class); + $dateObj = $this->objectManager->get(Date::class); $dateObj->setLanguageUid(-1); $dateObj->setStart($eventStart); $dateObj->setEnd($eventEnd); @@ -444,16 +451,16 @@ class DestinationDataImportService { /** * @param array $addresses */ - protected function setOrganizer(Array $addresses) { - foreach ($addresses as $address) - { + protected function setOrganizer(array $addresses) + { + foreach ($addresses as $address) { if ($address['rel'] == "organizer") { $tmpOrganizer = $this->organizerRepository->findOneByName($address['name']); if ($tmpOrganizer) { $this->tmpCurrentEvent->setOrganizer($tmpOrganizer); continue; } - $tmpOrganizer = $this->objectManager->get(\Wrm\Events\Domain\Model\Organizer::class); + $tmpOrganizer = $this->objectManager->get(Organizer::class); $tmpOrganizer->setLanguageUid(-1); $tmpOrganizer->setName($address['name']); $tmpOrganizer->setCity($address['city']); @@ -472,44 +479,55 @@ class DestinationDataImportService { /** * @param array $event */ - protected function setAddress(Array $event) { - if (!empty($event['name'])) + protected function setAddress(array $event) + { + if (!empty($event['name'])) { $this->tmpCurrentEvent->setName($event['name']); - if (!empty($event['street'])) + } + if (!empty($event['street'])) { $this->tmpCurrentEvent->setStreet($event['street']); - if (!empty($event['city'])) + } + if (!empty($event['city'])) { $this->tmpCurrentEvent->setCity($event['city']); - if (!empty($event['zip'])) + } + if (!empty($event['zip'])) { $this->tmpCurrentEvent->setZip($event['zip']); - if (!empty($event['country'])) + } + if (!empty($event['country'])) { $this->tmpCurrentEvent->setCountry($event['country']); - if (!empty($event['phone'])) + } + if (!empty($event['phone'])) { $this->tmpCurrentEvent->setPhone($event['phone']); - if (!empty($event['web'])) + } + if (!empty($event['web'])) { $this->tmpCurrentEvent->setWeb($event['web']); - } - - /** - * @param array $media - */ - protected function setSocial(Array $media) { - foreach ($media as $link) - { - if ($link['rel'] == "socialmedia" && $link['value'] == "Facebook") - $this->tmpCurrentEvent->setFacebook($link['url']); - if ($link['rel'] == "socialmedia" && $link['value'] == "YouTube") - $this->tmpCurrentEvent->setYouTube($link['url']); - if ($link['rel'] == "socialmedia" && $link['value'] == "Instagram") - $this->tmpCurrentEvent->setInstagram($link['url']); } } /** * @param array $media */ - protected function setTickets(Array $media) { - foreach ($media as $link) - { + protected function setSocial(array $media) + { + foreach ($media as $link) { + if ($link['rel'] == "socialmedia" && $link['value'] == "Facebook") { + $this->tmpCurrentEvent->setFacebook($link['url']); + } + if ($link['rel'] == "socialmedia" && $link['value'] == "YouTube") { + $this->tmpCurrentEvent->setYouTube($link['url']); + } + if ($link['rel'] == "socialmedia" && $link['value'] == "Instagram") { + $this->tmpCurrentEvent->setInstagram($link['url']); + } + } + } + + /** + * @param array $media + */ + protected function setTickets(array $media) + { + foreach ($media as $link) { if ($link['rel'] == "ticket") { $this->tmpCurrentEvent->setTicket($link['url']); break; @@ -526,14 +544,15 @@ class DestinationDataImportService { * @param string $needle * @param array $haystack */ - protected function multi_array_key_exists( $needle, $haystack ) { + protected function multi_array_key_exists($needle, $haystack) + { - foreach ( $haystack as $key => $value ) { - if ( $needle == $key ) { + foreach ($haystack as $key => $value) { + if ($needle == $key) { return true; } - if ( is_array( $value ) ) { - if ( $this->multi_array_key_exists( $needle, $value ) == true ) { + if (is_array($value)) { + if ($this->multi_array_key_exists($needle, $value) == true) { return true; } } @@ -545,7 +564,8 @@ class DestinationDataImportService { * @param string $lat * @param string $lng */ - protected function setLatLng(String $lat, String $lng) { + protected function setLatLng(string $lat, string $lng) + { $this->tmpCurrentEvent->setLatitude($lat); $this->tmpCurrentEvent->setLongitude($lng); } @@ -554,9 +574,9 @@ class DestinationDataImportService { * Set Texts * @param Array $texts */ - protected function setTexts(Array $texts) { - foreach ($texts as $text) - { + protected function setTexts(array $texts) + { + foreach ($texts as $text) { if ($text['rel'] == "details" && $text['type'] == "text/plain") { $this->tmpCurrentEvent->setDetails(str_replace('\n\n', '\n', $text['value'])); } @@ -574,7 +594,8 @@ class DestinationDataImportService { * @param String $globalId * @param String $title */ - protected function getOrCreateEvent(String $globalId, String $title) { + protected function getOrCreateEvent(string $globalId, string $title) + { $event = $this->eventRepository->findOneByGlobalId($globalId); @@ -587,7 +608,7 @@ class DestinationDataImportService { // New event is created $this->logger->info(substr($title, 0, 20) . ' does not exist'); - $event = $this->objectManager->get(\Wrm\Events\Domain\Model\Event::class); + $event = $this->objectManager->get(Event::class); // Create event and persist $event->setGlobalId($globalId); $event->setCategories(new ObjectStorage()); @@ -600,16 +621,15 @@ class DestinationDataImportService { /** * @param array $assets */ - protected function setAssets(Array $assets) { + protected function setAssets(array $assets) + { $this->logger->info("Set assets"); $error = false; - foreach ($assets as $media_object) - { - if($media_object['rel'] == "default" && $media_object['type'] == "image/jpeg") { - + foreach ($assets as $media_object) { + if ($media_object['rel'] == "default" && $media_object['type'] == "image/jpeg") { $this->storage = $this->resourceFactory->getDefaultStorage(); $orgFileUrl = urldecode($media_object['url']); @@ -637,24 +657,30 @@ class DestinationDataImportService { if ($file = $this->loadFile($orgFileUrl)) { // Move file to defined folder $this->logger->info('Adding file ' . $file); - $this->storage->addFile($this->environment->getPublicPath() . "/uploads/tx_events/" . $file, $this->storage->getFolder($this->filesFolder)); + + try { + $targetFolder = $this->storage->getFolder($this->filesFolder); + } catch (FolderDoesNotExistException $e) { + $targetFolder = $this->storage->createFolder($this->filesFolder); + } + + $this->storage->addFile($this->environment->getPublicPath() . "/uploads/tx_events/" . $file, $targetFolder); } else { $error = true; } } if ($error !== true) { - if ($this->tmpCurrentEvent->getImages() !== null) { + if ($this->tmpCurrentEvent->getImages()->count() > 0) { $this->logger->info('Relation found'); // TODO: How to delete file references? } else { $this->logger->info('No relation found'); $file = $this->storage->getFile($this->filesFolder . $orgFileNameSanitized); $this->metaDataRepository->update($file->getUid(), array('title' => $media_object['value'], 'description' => $media_object['description'], 'alternative' => 'DD Import')); - $this->createFileRelations($file->getUid(), 'tx_events_domain_model_event', $this->tmpCurrentEvent->getUid(), 'images', $this->storagePid); + $this->createFileRelations($file->getUid(), 'tx_events_domain_model_event', $this->tmpCurrentEvent->getUid(), 'images', $this->storagePid); } } - } $error = false; } @@ -665,7 +691,8 @@ class DestinationDataImportService { * @param string $file * @return string */ - protected function loadFile($file) { + protected function loadFile($file) + { $directory = $this->environment->getPublicPath() . "/uploads/tx_events/"; $filename = basename($file); $this->logger->info('Getting file ' . $file . ' as ' . $filename); @@ -687,7 +714,8 @@ class DestinationDataImportService { * @param string $storagePid * @return bool */ - protected function createFileRelations($uid_local, $tablenames, $uid_foreign, $fieldname, $storagePid) { + protected function createFileRelations($uid_local, $tablenames, $uid_foreign, $fieldname, $storagePid) + { $newId = 'NEW1234'; @@ -706,7 +734,7 @@ class DestinationDataImportService { $fieldname => $newId ); - $dataHandler = $this->objectManager->get(\TYPO3\CMS\Core\DataHandling\DataHandler::class); + $dataHandler = $this->objectManager->get(DataHandler::class); $dataHandler->start($data, array()); $dataHandler->process_datamap(); @@ -714,7 +742,7 @@ class DestinationDataImportService { return true; } - foreach($dataHandler->errorLog as $error) { + foreach ($dataHandler->errorLog as $error) { $this->logger->info($error); } return false; diff --git a/Classes/ViewHelpers/FormViewHelper.php b/Classes/ViewHelpers/FormViewHelper.php index 9231214..d7af5f8 100644 --- a/Classes/ViewHelpers/FormViewHelper.php +++ b/Classes/ViewHelpers/FormViewHelper.php @@ -2,8 +2,10 @@ namespace Wrm\Events\ViewHelpers; -class FormViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper { - protected function renderHiddenReferrerFields(){ +class FormViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper +{ + protected function renderHiddenReferrerFields() + { return ''; } -} \ No newline at end of file +} diff --git a/Configuration/Commands.php b/Configuration/Commands.php deleted file mode 100644 index 91b6d7f..0000000 --- a/Configuration/Commands.php +++ /dev/null @@ -1,12 +0,0 @@ - [ - 'class' => \Wrm\Events\Command\DestinationDataImportCommand::class - ], - 'events:removeAll' => [ - 'class' => \Wrm\Events\Command\RemoveAllCommand::class - ], - 'events:removePast' => [ - 'class' => \Wrm\Events\Command\RemovePastCommand::class - ], -]; diff --git a/Configuration/Extbase/Persistence/Classes.php b/Configuration/Extbase/Persistence/Classes.php new file mode 100644 index 0000000..ff15775 --- /dev/null +++ b/Configuration/Extbase/Persistence/Classes.php @@ -0,0 +1,9 @@ + [ + 'tableName' => 'sys_category', + ], +]; diff --git a/Configuration/ExtensionBuilder/settings.yaml b/Configuration/ExtensionBuilder/settings.yaml deleted file mode 100644 index 3b52d12..0000000 --- a/Configuration/ExtensionBuilder/settings.yaml +++ /dev/null @@ -1,101 +0,0 @@ -# -# Extension Builder settings for extension events -# generated 2019-04-01T14:33:00Z -# -# See http://www.yaml.org/spec/1.2/spec.html -# - ---- - -########### Overwrite settings ########### -# -# These settings only apply, if the roundtrip feature of the extension builder -# is enabled in the extension manager -# -# Usage: -# nesting reflects the file structure -# a setting applies to a file or recursive to all files and subfolders -# -# merge: -# means for classes: All properties ,methods and method bodies -# of the existing class will be modified according to the new settings -# but not overwritten -# -# for locallang xlf files: Existing keys and labels are always -# preserved (renaming a property or DomainObject will result in new keys and new labels) -# -# for other files: You will find a Split token at the end of the file -# see: \EBT\ExtensionBuilder\Service\RoundTrip::SPLIT_TOKEN -# -# After this token you can write whatever you want and it will be appended -# everytime the code is generated -# -# keep: -# files are never overwritten -# These settings may break the functionality of the extension builder! -# Handle with care! -# -# - -############ extension settings ############## - -overwriteSettings: - Classes: - Controller: merge - Domain: - Model: merge - Repository: merge - - Configuration: - #TCA merge not possible - use overrides directory - #TypoScript: keep - - Resources: - Private: - #Language: merge - #Templates: keep - - user_extension.svg: keep - -# ext_localconf.php: merge - -# ext_tables.php: merge - -# ext_tables.sql: merge - -## use static date attribute in xliff files ## -#staticDateInXliffFiles: 2019-04-01T14:33:00Z - -## skip docComment (license header) ## -#skipDocComment - -## list of error codes for warnings that should be ignored ## -#ignoreWarnings: - #503 - -######### settings for classBuilder ############################# -# -# here you may define default parent classes for your classes -# these settings only apply for new generated classes -# you may also just change the parent class in the generated class file. -# It will be kept on next code generation, if the overwrite settings -# are configured to merge it -# -################################################################# - -classBuilder: - - Controller: - parentClass: \TYPO3\CMS\Extbase\Mvc\Controller\ActionController - - Model: - AbstractEntity: - parentClass: \TYPO3\CMS\Extbase\DomainObject\AbstractEntity - - AbstractValueObject: - parentClass: \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject - - Repository: - parentClass: \TYPO3\CMS\Extbase\Persistence\Repository - - setDefaultValuesForClassProperties: true \ No newline at end of file diff --git a/Configuration/FlexForms/DateList.xml b/Configuration/FlexForms/DateList.xml index e971c51..8c9f409 100644 --- a/Configuration/FlexForms/DateList.xml +++ b/Configuration/FlexForms/DateList.xml @@ -13,6 +13,7 @@ select + selectSingle Start @@ -33,6 +34,7 @@ select + selectSingle @@ -128,6 +130,7 @@ select + selectSingle Default @@ -164,11 +167,12 @@ select + selectSingle tx_events_domain_model_region AND tx_events_domain_model_region.deleted = 0 AND tx_events_domain_model_region.hidden = 0 - 3 + 1 0 - 2 + 1 @@ -179,6 +183,7 @@ select + selectSingle And @@ -202,6 +207,7 @@ select + selectTree 20 sys_category AND sys_category.sys_language_uid IN (-1, 0) ORDER BY sys_category.title ASC @@ -233,4 +239,4 @@ - \ No newline at end of file + diff --git a/Configuration/FlexForms/Pi1.xml b/Configuration/FlexForms/Pi1.xml deleted file mode 100644 index 2b7084d..0000000 --- a/Configuration/FlexForms/Pi1.xml +++ /dev/null @@ -1,402 +0,0 @@ - - - - - - Options - - array - - - - - reload - - select - - - Event List - Event->list - - - Event Teaser - Event->teaser - - - Event Show - Event->show - - - Date List - Date->list - - - - Date Show - Date->show - - - - Event Search - Event->search - - - - Date Search - Date->search - - - - - - - - - - 1 - - FIELD:switchableControllerActions:=:Event->list - - select - - - Title - title - - - Region - region - - - - - - - - - 1 - - - - FIELD:switchableControllerActions:=:Date->list - FIELD:switchableControllerActions:=:Date->search - - - - select - - - Start - start - - - End - end - - - - - - - - - 1 - - - - FIELD:switchableControllerActions:=:Event->list - FIELD:switchableControllerActions:=:Date->list - FIELD:switchableControllerActions:=:Date->search - - - - select - - - - Ascending - - ASC - - - - Descending - - DESC - - - ASC - - - - - - - 1 - - - - FIELD:switchableControllerActions:=:Event->list - FIELD:switchableControllerActions:=:Date->list - FIELD:switchableControllerActions:=:Date->search - - - - input - 10 - 30 - trim - - - - - - - 1 - - - - FIELD:switchableControllerActions:=:Event->list - FIELD:switchableControllerActions:=:Date->list - - - - check - 0 - - - - - - - 1 - - - - FIELD:switchableControllerActions:=:Event->list - FIELD:switchableControllerActions:=:Date->list - - - - check - 0 - - - - - - - 1 - - - - FIELD:switchableControllerActions:=:Event->list - FIELD:switchableControllerActions:=:Date->list - - - - check - 0 - - - - - - - 1 - - - - FIELD:switchableControllerActions:=:Event->list - FIELD:switchableControllerActions:=:Event->teaser - FIELD:switchableControllerActions:=:Event->search - FIELD:switchableControllerActions:=:Date->list - FIELD:switchableControllerActions:=:Date->teaser - FIELD:switchableControllerActions:=:Date->search - - - - group - db - pages - 1 - 1 - 0 - 1 - - - - - - - - - - FIELD:switchableControllerActions:=:Event->teaser - FIELD:switchableControllerActions:=:Date->teaser - - - - select - tx_events_domain_model_event - AND tx_events_domain_model_event.deleted = 0 AND tx_events_domain_model_event.hidden = 0 - 3 - 1 - 0 - 99 - - - - - - - - - - Template - - array - - - 1 - - - - FIELD:sDEF.switchableControllerActions:=:Event->list - FIELD:sDEF.switchableControllerActions:=:Date->list - - - - select - - - Default - default - - - Costum - costum - - - Table - table - - - Grid - grid - - - default - - - - - - - - - Regions & Categories - - array - - - - - - - FIELD:sDEF.switchableControllerActions:=:Event->list - FIELD:sDEF.switchableControllerActions:=:Date->list - - - - select - tx_events_domain_model_region - AND tx_events_domain_model_region.deleted = 0 AND tx_events_domain_model_region.hidden = 0 - 3 - 0 - 2 - - - - - - - 1 - - - - FIELD:sDEF.switchableControllerActions:=:Event->list - FIELD:sDEF.switchableControllerActions:=:Date->list - - - - select - - - And - 0 - - - Or - 1 - - - 0 - - - - - - - 1 - - - - FIELD:sDEF.switchableControllerActions:=:Event->list - FIELD:sDEF.switchableControllerActions:=:Date->list - - - - select - 20 - sys_category - AND sys_category.sys_language_uid IN (-1, 0) ORDER BY sys_category.title ASC - 1 - tree - 8 - - - 1 - 1 - - parent - - - - - - - - 1 - - FIELD:sDEF.switchableControllerActions:=:Event->list - - check - 0 - - - - - - - - \ No newline at end of file diff --git a/Configuration/FlexForms/Selected.xml b/Configuration/FlexForms/Selected.xml new file mode 100644 index 0000000..d4a590e --- /dev/null +++ b/Configuration/FlexForms/Selected.xml @@ -0,0 +1,24 @@ + + + + + array + + + + 1 + + + group + db + tx_events_domain_model_event + 1 + 1 + + + + + + + + diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml new file mode 100644 index 0000000..a0fd323 --- /dev/null +++ b/Configuration/Services.yaml @@ -0,0 +1,34 @@ +services: + _defaults: + autowire: true + autoconfigure: true + public: false + + Wrm\Events\: + resource: '../Classes/*' + + Wrm\Events\Command\DestinationDataImportCommand: + tags: + - name: 'console.command' + command: 'events:destinationdataimport' + events.levacy_comannd_identifier: + class: 'Wrm\Events\Command\DestinationDataImportCommand' + tags: + - name: 'console.command' + command: 'events:destinationdataimport‚' + + Wrm\Events\Command\RemoveAllCommand: + tags: + - name: 'console.command' + command: 'events:removeAll' + + Wrm\Events\Command\RemovePastCommand: + tags: + - name: 'console.command' + command: 'events:removePast' + + Wrm\Events\Extbase\AddSpecialProperties: + tags: + - name: event.listener + identifier: 'WrmEventsAddSpecialPropertiesToDate' + event: TYPO3\CMS\Extbase\Event\Persistence\AfterObjectThawedEvent diff --git a/Configuration/TCA/Overrides/sys_category.php b/Configuration/TCA/Overrides/sys_category.php new file mode 100644 index 0000000..4c79736 --- /dev/null +++ b/Configuration/TCA/Overrides/sys_category.php @@ -0,0 +1,16 @@ + [ + 'sorting' => [ + 'config' => [ + // Allow extbase to map this column to model + 'type' => 'passthrough', + ], + ], + ], + ]); +})('events', 'sys_category'); diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index ab4974d..45af5df 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -1,32 +1,16 @@ 'Categories', 'fieldConfiguration' => [ 'minitems' => 0, - 'maxitems' => 3, 'multiple' => true, ] ] -); \ No newline at end of file +); diff --git a/Configuration/TCA/tx_events_domain_model_date.php b/Configuration/TCA/tx_events_domain_model_date.php index 16d7b1e..f8a25ba 100644 --- a/Configuration/TCA/tx_events_domain_model_date.php +++ b/Configuration/TCA/tx_events_domain_model_date.php @@ -1,8 +1,11 @@ [ 'title' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date', 'label' => 'start', + 'label_alt' => 'end, canceled', + 'label_alt_force' => true, 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', @@ -17,13 +20,10 @@ return [ 'endtime' => 'endtime', ], 'searchFields' => '', - 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_date.gif' - ], - 'interface' => [ - 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, start, end', + 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_date.svg' ], 'types' => [ - '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, start, end, event, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], + '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, start, end, canceled, postponed_date, canceled_link, event, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], ], 'columns' => [ 'sys_language_uid' => [ @@ -45,7 +45,6 @@ return [ ], 'l10n_parent' => [ 'displayCond' => 'FIELD:sys_language_uid:>:0', - 'exclude' => true, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', 'config' => [ 'type' => 'select', @@ -140,6 +139,66 @@ return [ 'default' => null, ], ], + 'canceled' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.canceled', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectSingle', + 'default' => 'no', + 'items' => [ + '0' => [ + '0' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.canceled.options.no', + '1' => 'no', + ], + '1' => [ + '0' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.canceled.options.canceled', + '1' => 'canceled', + ], + '2' => [ + '0' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.canceled.options.postponed', + '1' => 'postponed', + ], + ], + ], + ], + 'postponed_date' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.postponed_date', + 'displayCond' => 'FIELD:canceled:=:postponed', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectSingle', + 'foreign_table' => 'tx_events_domain_model_date', + 'foreign_table_where' => ' AND {#tx_events_domain_model_date}.{#event} = ###REC_FIELD_event### AND {#tx_events_domain_model_date}.{#uid} != ###THIS_UID###', + 'default' => '0', + 'items' => [ + '0' => [ + '0' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.postponed_date.0', + '1' => '0', + ], + ], + ], + ], + 'canceled_link' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.canceled_link', + 'displayCond' => 'FIELD:canceled:=:canceled', + 'config' => [ + 'type' => 'input', + 'softref' => 'typolink', + 'renderType' => 'inputLink', + 'max' => 1024, + 'eval' => 'trim', + 'fieldControl' => [ + 'linkPopup' => [ + 'options' => [ + 'title' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:header_link_formlabel', + ], + ], + ], + ], + ], 'event' => array( 'exclude' => 1, diff --git a/Configuration/TCA/tx_events_domain_model_event.php b/Configuration/TCA/tx_events_domain_model_event.php index c354a0e..0570c5f 100644 --- a/Configuration/TCA/tx_events_domain_model_event.php +++ b/Configuration/TCA/tx_events_domain_model_event.php @@ -1,8 +1,17 @@ [ - 'title' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event', + 'title' => $l10nPath . ':tx_events_domain_model_event', 'label' => 'title', + 'thumbnail' => 'images', 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', @@ -16,26 +25,69 @@ return [ 'starttime' => 'starttime', 'endtime' => 'endtime', ], - 'searchFields' => 'title,global_id,slug,teaser,details,price_info,street,district,city,zip,country,web,booking,ticket,facebook,youtube,latitude,longitude', - 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_event.gif' - ], - 'interface' => [ - 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, global_id, slug, highlight, teaser, details, price_info, name, street, district, city, zip, country, phone, web, ticket, facebook, youtube, instagram, latitude, longitude, images, categories, dates, organizer, region', + 'searchFields' => 'title,subtitle,global_id,teaser', + 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_event.svg' ], 'types' => [ - '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, global_id, slug, highlight, teaser, details, price_info, name, street, district, city, zip, country, phone, web, ticket, facebook, youtube, instagram, latitude, longitude, images, categories, dates, organizer, region, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], + '1' => [ + 'showitem' => '--palette--;' . $l10nPathFE . ':palette.general;general, + sys_language_uid, + l10n_parent, + l10n_diffsource, + hidden, + highlight, + title, + subtitle, + teaser, + slug, + ticket, + global_id, + --div--;' . $l10nPath . ':tx_events_domain_model_event.tabs.text, + details, + price_info, + --div--;' . $l10nPath . ':tx_events_domain_model_event.tabs.dates, + dates, + --div--;' . $l10nPath . ':tx_events_domain_model_event.tabs.location, + name, + street, + district, + city, + zip, + country, + phone, + web, + latitude, + longitude, + --div--;' . $l10nPath . ':tx_events_domain_model_event.tabs.relations, + organizer, + region, + partner, + categories, + references_events, + pages, + --div--;' . $l10nPath . ':tx_events_domain_model_event.tabs.media, + images, + --div--;' . $l10nPath . ':tx_events_domain_model_event.tabs.social, + facebook, + youtube, + instagram, + --div--;' . $l10nPathFE . ':tabs.access, + starttime, + endtime' + ], ], + 'columns' => [ 'sys_language_uid' => [ 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language', + 'label' => $l10nPathGeneral . ':LGL.language', 'config' => [ 'type' => 'select', 'renderType' => 'selectSingle', 'special' => 'languages', 'items' => [ [ - 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', + $l10nPathGeneral . ':LGL.allLanguages', -1, 'flags-multiple' ] @@ -45,8 +97,7 @@ return [ ], 'l10n_parent' => [ 'displayCond' => 'FIELD:sys_language_uid:>:0', - 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', + 'label' => $l10nPathGeneral . ':LGL.l18n_parent', 'config' => [ 'type' => 'select', 'renderType' => 'selectSingle', @@ -64,7 +115,7 @@ return [ ], ], 't3ver_label' => [ - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.versionLabel', + 'label' => $l10nPathGeneral . ':LGL.versionLabel', 'config' => [ 'type' => 'input', 'size' => 30, @@ -73,7 +124,7 @@ return [ ], 'hidden' => [ 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.visible', + 'label' => $l10nPathGeneral . ':LGL.visible', 'config' => [ 'type' => 'check', 'renderType' => 'checkboxToggle', @@ -88,7 +139,7 @@ return [ ], 'starttime' => [ 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime', + 'label' => $l10nPathGeneral . ':LGL.starttime', 'config' => [ 'type' => 'input', 'renderType' => 'inputDateTime', @@ -101,7 +152,7 @@ return [ ], 'endtime' => [ 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime', + 'label' => $l10nPathGeneral . ':LGL.endtime', 'config' => [ 'type' => 'input', 'renderType' => 'inputDateTime', @@ -118,16 +169,27 @@ return [ 'title' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.title', + 'label' => $l10nPath . ':tx_events_domain_model_event.title', 'config' => [ - 'type' => 'input', - 'size' => 30, + 'type' => 'text', + 'cols' => 40, + 'rows' => 2, + 'eval' => 'trim' + ] + ], + 'subtitle' => [ + 'exclude' => true, + 'label' => $l10nPath . ':tx_events_domain_model_event.subtitle', + 'config' => [ + 'type' => 'text', + 'cols' => 40, + 'rows' => 2, 'eval' => 'trim' ] ], 'global_id' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.global_id', + 'label' => $l10nPath . ':tx_events_domain_model_event.global_id', 'config' => [ 'type' => 'input', 'size' => 30, @@ -136,7 +198,7 @@ return [ ], 'slug' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.slug', + 'label' => $l10nPath . ':tx_events_domain_model_event.slug', 'config' => [ 'type' => 'slug', 'size' => 50, @@ -152,12 +214,12 @@ return [ ], 'highlight' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.highlight', + 'label' => $l10nPath . ':tx_events_domain_model_event.highlight', 'config' => [ 'type' => 'check', 'items' => [ '1' => [ - '0' => 'LLL:EXT:lang/locallang_core.xlf:labels.enabled' + '0' => $l10nPathLang . ':labels.enabled' ] ], 'default' => 0, @@ -165,21 +227,21 @@ return [ ], 'teaser' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.teaser', + 'label' => $l10nPath . ':tx_events_domain_model_event.teaser', 'config' => [ 'type' => 'text', - 'cols' => 40, - 'rows' => 15, + 'cols' => 30, + 'rows' => 5, 'eval' => 'trim' ] ], 'details' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.details', + 'label' => $l10nPath . ':tx_events_domain_model_event.details', 'config' => [ 'type' => 'text', 'enableRichtext' => true, - 'richtextConfiguration' => 'default', + 'richtextConfiguration' => 'Default', 'fieldControl' => [ 'fullScreenRichtext' => [ 'disabled' => false, @@ -189,11 +251,11 @@ return [ 'rows' => 15, 'eval' => 'trim', ], - + ], 'price_info' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.price_info', + 'label' => $l10nPath . ':tx_events_domain_model_event.price_info', 'config' => [ 'type' => 'text', 'cols' => 40, @@ -203,7 +265,7 @@ return [ ], 'name' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.name', + 'label' => $l10nPath . ':tx_events_domain_model_event.name', 'config' => [ 'type' => 'input', 'size' => 30, @@ -212,7 +274,7 @@ return [ ], 'street' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.street', + 'label' => $l10nPath . ':tx_events_domain_model_event.street', 'config' => [ 'type' => 'input', 'size' => 30, @@ -221,7 +283,7 @@ return [ ], 'district' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.district', + 'label' => $l10nPath . ':tx_events_domain_model_event.district', 'config' => [ 'type' => 'input', 'size' => 30, @@ -230,7 +292,7 @@ return [ ], 'city' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.city', + 'label' => $l10nPath . ':tx_events_domain_model_event.city', 'config' => [ 'type' => 'input', 'size' => 30, @@ -239,7 +301,7 @@ return [ ], 'zip' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.zip', + 'label' => $l10nPath . ':tx_events_domain_model_event.zip', 'config' => [ 'type' => 'input', 'size' => 30, @@ -248,7 +310,7 @@ return [ ], 'country' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.country', + 'label' => $l10nPath . ':tx_events_domain_model_event.country', 'config' => [ 'type' => 'input', 'size' => 30, @@ -257,7 +319,7 @@ return [ ], 'phone' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.phone', + 'label' => $l10nPath . ':tx_events_domain_model_event.phone', 'config' => [ 'type' => 'input', 'size' => 30, @@ -266,7 +328,7 @@ return [ ], 'web' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.web', + 'label' => $l10nPath . ':tx_events_domain_model_event.web', 'config' => [ 'type' => 'input', 'size' => 30, @@ -275,16 +337,19 @@ return [ ], 'ticket' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.ticket', + 'label' => $l10nPath . ':tx_events_domain_model_event.ticket', 'config' => [ 'type' => 'input', - 'size' => 30, - 'eval' => 'trim' + 'renderType' => 'inputLink', + 'eval' => 'trim', + 'max' => 1024, + 'size' => 50, + 'softref' => 'typolink', ], ], 'facebook' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.facebook', + 'label' => $l10nPath . ':tx_events_domain_model_event.facebook', 'config' => [ 'type' => 'input', 'size' => 30, @@ -293,7 +358,7 @@ return [ ], 'youtube' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.youtube', + 'label' => $l10nPath . ':tx_events_domain_model_event.youtube', 'config' => [ 'type' => 'input', 'size' => 30, @@ -302,7 +367,7 @@ return [ ], 'instagram' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.instagram', + 'label' => $l10nPath . ':tx_events_domain_model_event.instagram', 'config' => [ 'type' => 'input', 'size' => 30, @@ -311,7 +376,7 @@ return [ ], 'latitude' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.latitude', + 'label' => $l10nPath . ':tx_events_domain_model_event.latitude', 'config' => [ 'type' => 'input', 'size' => 30, @@ -320,7 +385,7 @@ return [ ], 'longitude' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.longitude', + 'label' => $l10nPath . ':tx_events_domain_model_event.longitude', 'config' => [ 'type' => 'input', 'size' => 30, @@ -329,12 +394,12 @@ return [ ], 'images' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.images', + 'label' => $l10nPath . ':tx_events_domain_model_event.images', 'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig( 'images', [ 'appearance' => [ - 'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference', + 'createNewRelationLinkTitle' => $l10nPathFE . ':images.addFileReference', 'showPossibleLocalizationRecords' => true, 'showRemovedLocalizationRecords' => true, 'showAllLocalizationLink' => true, @@ -348,44 +413,54 @@ return [ 'foreign_types' => [ '0' => [ 'showitem' => ' - --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, + --palette--;' . $l10nPathFE . ':sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette' ], \TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => [ 'showitem' => ' - --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, + --palette--;' . $l10nPathFE . ':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--;' . $l10nPathFE . ':sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette' ], \TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => [ 'showitem' => ' - --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, + --palette--;' . $l10nPathFE . ':sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette' ], \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [ 'showitem' => ' - --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, + --palette--;' . $l10nPathFE . ':sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette' ], \TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => [ 'showitem' => ' - --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, + --palette--;' . $l10nPathFE . ':sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette' ] ], - 'maxitems' => 1 + 'maxitems' => 8 ], $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] ), ], + 'pages' => [ + 'exclude' => true, + 'label' => $l10nPath . ':tx_events_domain_model_event.pages', + 'config' => [ + 'type' => 'group', + 'internal_type' => 'db', + 'allowed' => 'pages', + ], + ], + 'categories' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.categories', + 'label' => $l10nPath . ':tx_events_domain_model_event.categories', 'config' => [ 'type' => 'input', 'size' => 4, @@ -395,7 +470,7 @@ return [ 'dates' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.dates', + 'label' => $l10nPath . ':tx_events_domain_model_event.dates', 'config' => [ 'type' => 'inline', 'foreign_table' => 'tx_events_domain_model_date', @@ -411,7 +486,7 @@ return [ 'dragdrop' => false, 'sort' => false, 'hide' => false, - 'delete' => false, + 'delete' => true, 'localize' => false, ), 'levelLinksPosition' => 'top', @@ -427,26 +502,59 @@ return [ 'organizer' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.organizer', + 'label' => $l10nPath . ':tx_events_domain_model_event.organizer', 'config' => [ 'type' => 'select', 'renderType' => 'selectSingle', 'foreign_table' => 'tx_events_domain_model_organizer', + 'default' => 0, 'minitems' => 0, 'maxitems' => 1, ], ], 'region' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.region', + 'label' => $l10nPath . ':tx_events_domain_model_event.region', 'config' => [ 'type' => 'select', 'renderType' => 'selectSingle', 'foreign_table' => 'tx_events_domain_model_region', + 'default' => 0, 'minitems' => 0, 'maxitems' => 1, ], ], - + + 'references_events' => [ + 'exclude' => true, + 'label' => $l10nPath . ':tx_events_domain_model_event.references_events', + 'config' => [ + 'type' => 'group', + 'internal_type' => 'db', + 'allowed' => 'tx_events_domain_model_event', + 'suggestOptions' => [ + 'tx_events_domain_model_event' => [ + 'searchCondition' => 'tx_events_domain_model_event.sys_language_uid IN (0, -1)', + ], + ], + ], + ], + + 'partner' => [ + 'exclude' => true, + 'label' => $l10nPath . ':tx_events_domain_model_event.partner', + 'config' => [ + 'type' => 'group', + 'internal_type' => 'db', + 'allowed' => 'tx_events_domain_model_partner', + 'fieldControl' => [ + 'addRecord' => [ + 'disabled' => false, + 'pid' => '###CURRENT_PID###', + 'table' => 'tx_events_domain_model_partner', + ], + ], + ], + ], ], ]; diff --git a/Configuration/TCA/tx_events_domain_model_organizer.php b/Configuration/TCA/tx_events_domain_model_organizer.php index 4cf94db..b3b80c0 100644 --- a/Configuration/TCA/tx_events_domain_model_organizer.php +++ b/Configuration/TCA/tx_events_domain_model_organizer.php @@ -17,10 +17,7 @@ return [ 'endtime' => 'endtime', ], 'searchFields' => 'name,street,district,city,zip,phone,web,email', - 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_organizer.gif' - ], - 'interface' => [ - 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, name, street, district, city, zip, phone, web, email', + 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_organizer.svg' ], 'types' => [ '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, name, street, district, city, zip, phone, web, email, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], @@ -45,7 +42,6 @@ return [ ], 'l10n_parent' => [ 'displayCond' => 'FIELD:sys_language_uid:>:0', - 'exclude' => true, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', 'config' => [ 'type' => 'select', @@ -188,6 +184,6 @@ return [ 'eval' => 'trim' ], ], - + ], ]; diff --git a/Configuration/TCA/tx_events_domain_model_partner.php b/Configuration/TCA/tx_events_domain_model_partner.php new file mode 100644 index 0000000..e4e142c --- /dev/null +++ b/Configuration/TCA/tx_events_domain_model_partner.php @@ -0,0 +1,133 @@ + [ + 'title' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_partner.xlf:tx_events_domain_model_partner', + 'label' => 'title', + 'thumbnail' => 'images', + 'tstamp' => 'tstamp', + 'crdate' => 'crdate', + 'cruser_id' => 'cruser_id', + 'versioningWS' => true, + 'languageField' => 'sys_language_uid', + 'transOrigPointerField' => 'l10n_parent', + 'transOrigDiffSourceField' => 'l10n_diffsource', + 'delete' => 'deleted', + 'enablecolumns' => [ + 'disabled' => 'hidden', + ], + 'searchFields' => 'title', + 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_partner.svg' + ], + 'types' => [ + '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, link, images, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access'], + ], + 'columns' => [ + 'sys_language_uid' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectSingle', + 'special' => 'languages', + 'items' => [ + [ + 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', + -1, + 'flags-multiple' + ] + ], + 'default' => 0, + ], + ], + 'l10n_parent' => [ + 'displayCond' => 'FIELD:sys_language_uid:>:0', + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectSingle', + 'default' => 0, + 'items' => [ + ['', 0], + ], + 'foreign_table' => 'tx_events_domain_model_partner', + 'foreign_table_where' => 'AND {#tx_events_domain_model_partner}.{#pid}=###CURRENT_PID### AND {#tx_events_domain_model_partner}.{#sys_language_uid} IN (-1,0)', + ], + ], + 'l10n_diffsource' => [ + 'config' => [ + 'type' => 'passthrough', + ], + ], + 't3ver_label' => [ + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.versionLabel', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'max' => 255, + ], + ], + 'hidden' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.visible', + 'config' => [ + 'type' => 'check', + 'renderType' => 'checkboxToggle', + 'items' => [ + [ + 0 => '', + 1 => '', + 'invertStateDisplay' => true + ] + ], + ], + ], + + 'title' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_partner.xlf:tx_events_domain_model_partner.title', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ] + ], + 'link' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_partner.xlf:tx_events_domain_model_partner.link', + 'config' => [ + 'type' => 'input', + 'renderType' => 'inputLink', + 'eval' => 'trim', + 'max' => 1024, + 'size' => 50, + 'softref' => 'typolink', + ], + ], + 'images' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_partner.xlf:tx_events_domain_model_partner.images', + 'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('images', [ + 'appearance' => [ + 'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference' + ], + // custom configuration for displaying fields in the overlay/reference table + // to use the imageoverlayPalette instead of the basicoverlayPalette + 'overrideChildTca' => [ + 'types' => [ + '0' => [ + 'showitem' => ' + --palette--;;imageoverlayPalette, + --palette--;;filePalette' + ], + \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [ + 'showitem' => ' + --palette--;;imageoverlayPalette, + --palette--;;filePalette' + ], + ], + ], + ], $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']) + ], + ], +]; diff --git a/Configuration/TCA/tx_events_domain_model_region.php b/Configuration/TCA/tx_events_domain_model_region.php index b2cbaf8..822b513 100644 --- a/Configuration/TCA/tx_events_domain_model_region.php +++ b/Configuration/TCA/tx_events_domain_model_region.php @@ -17,10 +17,7 @@ return [ 'endtime' => 'endtime', ], 'searchFields' => 'title', - 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_region.gif' - ], - 'interface' => [ - 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title', + 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_region.svg' ], 'types' => [ '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], @@ -45,7 +42,6 @@ return [ ], 'l10n_parent' => [ 'displayCond' => 'FIELD:sys_language_uid:>:0', - 'exclude' => true, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', 'config' => [ 'type' => 'select', @@ -125,6 +121,6 @@ return [ 'eval' => 'trim' ], ], - + ], ]; diff --git a/Configuration/TypoScript/setup.typoscript b/Configuration/TypoScript/setup.typoscript index 46197a6..71c4f8c 100644 --- a/Configuration/TypoScript/setup.typoscript +++ b/Configuration/TypoScript/setup.typoscript @@ -56,6 +56,21 @@ plugin.tx_events { categoriesPid = {$plugin.tx_events.settings.destinationData.categoriesPid} categoryParentUid = {$plugin.tx_events.settings.destinationData.categoryParentUid} } + dataProcessing { + Wrm\Events\Domain\Model\Event { + 10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor + 10 { + special = list + special.value.field = pages + dataProcessing { + 10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor + 10 { + references.fieldName = media + } + } + } + } + } } } diff --git a/Resources/Private/Language/de.locallang_csh_date.xlf b/Resources/Private/Language/de.locallang_csh_date.xlf index f52c5ef..b931349 100644 --- a/Resources/Private/Language/de.locallang_csh_date.xlf +++ b/Resources/Private/Language/de.locallang_csh_date.xlf @@ -1,24 +1,52 @@ - -
- - - Date - Termin - - - Start - Beginn - - - End - Ende - - - Associated event - Verknüpfte Veranstaltungen - - - + +
+ + + Date + Termin + + + Start + Beginn + + + End + Ende + + + Canceled or postponed? + Abgesagt oder verschoben? + + + No + Nein + + + Canceled + Abgesagt + + + Postponed + Verschoben + + + Postponed date + Verschoben auf folgendes Datum + + + Not defined + Noch nicht definiert + + + Link regarding cancellation + Link bezüglich Absage + + + Associated event + Verknüpfte Veranstaltungen + + + diff --git a/Resources/Private/Language/de.locallang_csh_event.xlf b/Resources/Private/Language/de.locallang_csh_event.xlf index 0b8d472..59e8704 100644 --- a/Resources/Private/Language/de.locallang_csh_event.xlf +++ b/Resources/Private/Language/de.locallang_csh_event.xlf @@ -1,128 +1,168 @@ - -
- - - Events - Veranstaltungen - - - Event Modul - Veranstaltungs Modul - - - Event - Veranstaltung - - - Title - Titel - - - Global UID - Globale UID - - - Slug - URL-Segment - - - Highlight - Höhepunkt - - - Teaser - Kurztext - - - Details - Text - - - Price Info - Preis Information - - - Name - Name - - - Street - Straße - - - District - Bundesland - - - City - Stadt - - - Zip - Postleitzahl - - - Country - Land - - - Web - Internet - - - Phone - Telefon - - - Ticket - Ticket - - - Facebook - Facebook - - - YouTube - YouTube - - - Instagram - Instagram - - - Latitude - Breitengrad - - - Longitude - Längengrad - - - Images - Bilder - - - Categories - Kategorien - - - Dates - Termine - - - Organizer - Organisator - - - Region - Region - - - Organizer - Organisator - - - + +
+ + + Events + Veranstaltungen + + + Event Modul + Veranstaltungs Modul + + + Text + Texte + + + Dates + Termine + + + Location + Veranstaltungsort + + + Relations + Relationen + + + Media + Medien + + + Social Media + Social Media + + + Event + Veranstaltung + + + Title + Titel + + + Subtitle + Untertitel + + + Global UID + Globale UID + + + Slug + URL-Segment + + + Highlight + Höhepunkt + + + Teaser + Kurztext + + + Details + Text + + + Price Info + Preis Information + + + Name + Name + + + Street + Straße + + + District + Bundesland + + + City + Stadt + + + Zip + Postleitzahl + + + Country + Land + + + Web + Internet + + + Phone + Telefon + + + Ticket + Ticket + + + Facebook + Facebook + + + YouTube + YouTube + + + Instagram + Instagram + + + Latitude + Breitengrad + + + Longitude + Längengrad + + + Images + Bilder + + + Pages + Seiten + + + Categories + Kategorien + + + Dates + Termine + + + Organizer + Organisator + + + Region + Region + + + Organizer + Organisator + + + Partner + Partner + + + Related Events + Ähnliche Veranstaltungen + + + diff --git a/Resources/Private/Language/de.locallang_csh_partner.xlf b/Resources/Private/Language/de.locallang_csh_partner.xlf new file mode 100644 index 0000000..4f026b9 --- /dev/null +++ b/Resources/Private/Language/de.locallang_csh_partner.xlf @@ -0,0 +1,24 @@ + + + +
+ + + Partner + Partner + + + Title + Titel + + + Link + Link + + + Images + Bilder + + + + diff --git a/Resources/Private/Language/de.locallang_db.xlf b/Resources/Private/Language/de.locallang_db.xlf index 468831a..53d8dbd 100644 --- a/Resources/Private/Language/de.locallang_db.xlf +++ b/Resources/Private/Language/de.locallang_db.xlf @@ -1,16 +1,20 @@ - -
- - - Events - Veranstaltungen - - - Event Modul - Veranstaltungs Modul - - - + +
+ + + Events + Veranstaltungen + + + Event Modul + Veranstaltungs Modul + + + Records to show + Anzuzeigende Veranstaltungen + + + diff --git a/Resources/Private/Language/locallang_csh_date.xlf b/Resources/Private/Language/locallang_csh_date.xlf index 3270004..42a521b 100644 --- a/Resources/Private/Language/locallang_csh_date.xlf +++ b/Resources/Private/Language/locallang_csh_date.xlf @@ -1,20 +1,41 @@ - -
- - - Date - - - Start - - - End - - - Associated event - - - + +
+ + + Date + + + Start + + + End + + + Canceled or postponed? + + + No + + + Canceled + + + Postponed + + + Postponed date + + + Not defined + + + Link regarding cancellation + + + Associated event + + + diff --git a/Resources/Private/Language/locallang_csh_event.xlf b/Resources/Private/Language/locallang_csh_event.xlf index 6608918..97cb2f0 100644 --- a/Resources/Private/Language/locallang_csh_event.xlf +++ b/Resources/Private/Language/locallang_csh_event.xlf @@ -1,95 +1,125 @@ - -
- - - Events - - - Event Modul - - - Event - - - Title - - - Global UID - - - Slug - - - Highlight - - - Teaser - - - Details - - - Price Info - - - Name - - - Street - - - District - - - City - - - Zip - - - Country - - - Web - - - Phone - - - Ticket - - - Facebook - - - Youtube - - - Instagram - - - Latitude - - - Longitude - - - Images - - - Categories - - - Dates - - - Organizer - - - Region - - - + +
+ + + Events + + + Event Modul + + + Event + + + Text + + + Dates + + + Location + + + Relations + + + Media + + + Social Media + + + Title + + + Subtitle + + + Global UID + + + Slug + + + Highlight + + + Teaser + + + Details + + + Price Info + + + Name + + + Street + + + District + + + City + + + Zip + + + Country + + + Web + + + Phone + + + Ticket + + + Facebook + + + Youtube + + + Instagram + + + Latitude + + + Longitude + + + Images + + + Pages + + + Categories + + + Dates + + + Organizer + + + Region + + + Partner + + + Related Events + + + diff --git a/Resources/Private/Language/locallang_csh_partner.xlf b/Resources/Private/Language/locallang_csh_partner.xlf new file mode 100644 index 0000000..cbfc87b --- /dev/null +++ b/Resources/Private/Language/locallang_csh_partner.xlf @@ -0,0 +1,20 @@ + + + +
+ + + Partner + + + Title + + + Link + + + Images + + + + diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf index 9462876..03080c4 100644 --- a/Resources/Private/Language/locallang_db.xlf +++ b/Resources/Private/Language/locallang_db.xlf @@ -1,14 +1,17 @@ - -
- - - Events - - - Event Modul - - - + +
+ + + Events + + + Event Modul + + + Records to show + + + diff --git a/Resources/Private/Partials/Date/ListDefault.html b/Resources/Private/Partials/Date/ListDefault.html index c62a6fb..dfc44c8 100644 --- a/Resources/Private/Partials/Date/ListDefault.html +++ b/Resources/Private/Partials/Date/ListDefault.html @@ -3,10 +3,10 @@