commit 9c6539eb28a8c7a99fef1c7c5157ab204286e833 Author: Dirk Date: Thu Jul 18 13:44:19 2019 +0200 Refactored EXT dd_events to events, added fields to page type poi diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..42cd73d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/vendor/ \ No newline at end of file diff --git a/Classes/Command/ImportCommand.php b/Classes/Command/ImportCommand.php new file mode 100644 index 0000000..a23daac --- /dev/null +++ b/Classes/Command/ImportCommand.php @@ -0,0 +1,601 @@ +setDescription('Import Destination Data Events'); + $this->setHelp('Destination Data Events are imported'); + + $this->addArgument( + 'storage-pid', + InputArgument::OPTIONAL, + 'What is the storage pid?', + '281' + ); + $this->addArgument( + 'region-uid', + InputArgument::OPTIONAL, + 'What is the region uid?', + '3' + ); + $this->addArgument( + 'category-parent-uid', + InputArgument::OPTIONAL, + 'What is the default category parent uid?', + '6' + ); + $this->addArgument('rest-url', + InputArgument::OPTIONAL, + 'What is the rest url?', + 'http://meta.et4.de/rest.ashx/search/' + ); + $this->addArgument('rest-experience', + InputArgument::OPTIONAL, + 'What is the rest experience?', + 'arnstadt' + ); + $this->addArgument('rest-license-key', + InputArgument::OPTIONAL, + 'What is the rest license key?', + '***REMOVED***' + ); + $this->addArgument('rest-type', + InputArgument::OPTIONAL, + 'What is the rest data type?', + 'Event' + ); + $this->addArgument('rest-limit', + InputArgument::OPTIONAL, + 'What is the rest data limit?', + '200' + ); + $this->addArgument('rest-template', + InputArgument::OPTIONAL, + 'What is the rest data template?', + 'ET2014A.json' + ); + $this->addArgument('files-folder', + InputArgument::OPTIONAL, + 'Where to save the image files?', + 'redaktion/arnstadt/events/' + ); + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $this->cliOutput = $output; + $this->cliInput = $input; + + $this->storagePid = $input->getArgument('storage-pid'); + $this->regionUid = $input->getArgument('region-uid'); + $this->categoryParentUid = $input->getArgument('category-parent-uid'); + $this->filesFolder = $input->getArgument('files-folder'); + + $this->restUrl = $input->getArgument('rest-url'); + $this->restExperience = $input->getArgument('rest-experience'); + $this->restLicenseKey = $input->getArgument('rest-license-key'); + $this->restType = $input->getArgument('rest-type'); + $this->restLimit = $input->getArgument('rest-limit'); + $this->restTemplate = $input->getArgument('rest-template'); + + $this->cliOutput->writeln('Hello from destination data event import'); + + Bootstrap::initializeBackendAuthentication(); + + return $this->import(); + } + + protected function import() { + + try { + // Debug limit to one select event via query + // $restUrl = $this->restUrl . '?experience=' . $this->restExperience . '&licensekey=' . $this->restLicenseKey . '&type=' . $this->restType . '&limit=' . $this->restLimit . '&template=' . $this->restTemplate . "&q=title:Schüler"; + + $restUrl = $this->restUrl . '?experience=' . $this->restExperience . '&licensekey=' . $this->restLicenseKey . '&type=' . $this->restType . '&limit=' . $this->restLimit . '&template=' . $this->restTemplate; + $this->cliOutput->writeln($restUrl); + $jsonResponse = json_decode(file_get_contents($restUrl),true); + + } catch (\Exception $e) { + return 1; + } + + if (!empty($jsonResponse)) { + + $this->objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'); + $this->configurationManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface'); + $this->persistenceManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager'); + + $this->eventRepository = $this->objectManager->get('Wrm\\Events\\Domain\\Repository\\EventRepository'); + $this->regionRepository = $this->objectManager->get('Wrm\\Events\\Domain\\Repository\\RegionRepository'); + $this->organizerRepository = $this->objectManager->get('Wrm\\Events\\Domain\\Repository\\OrganizerRepository'); + $this->dateRepository = $this->objectManager->get('Wrm\\Events\\Domain\\Repository\\DateRepository'); + + $this->sysCategoriesRepository = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Domain\\Repository\\CategoryRepository'); + + $frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); + $persistenceConfiguration = [ + 'persistence' => [ + 'storagePid' => $this->storagePid, + ], + ]; + $this->configurationManager->setConfiguration(array_merge($frameworkConfiguration, $persistenceConfiguration)); + + $this->cliOutput->writeln('Received json data.'); + $this->cliOutput->writeln('Received ' . $jsonResponse['count'] . ' items.'); + + // get selected Region from Database + $selectedRegion = $this->regionRepository->findByUid($this->regionUid); + + // TODO: How to delete event Dates + // until than delet all dates --> + + // $this->dateRepository->removeByEvent(); + + // <-- + + foreach ($jsonResponse['items'] as $event) + { + + $this->tmpCurrentEvent = $this->eventRepository->findOneByGlobalId($event['global_id']); + + if (!$this->tmpCurrentEvent) + { + // Global ID not found + $this->tmpCurrentEvent = $this->objectManager->get('Wrm\\Events\\Domain\\Model\\Event'); + //$this->currentEventIsNew = TRUE; + + // Create event and persist + $this->tmpCurrentEvent->setGlobalId($event['global_id']); + $this->tmpCurrentEvent->setCategories(new ObjectStorage()); + $this->eventRepository->add($this->tmpCurrentEvent); + $this->persistenceManager->persistAll(); + + $this->cliOutput->writeln('Not found "' . substr($event['title'], 0, 20) . '..." with global id ' . $event['global_id'] . ' in database. Created new one.'); + } else { + // Global ID is found and events gets updated + $this->tmpCurrentEvent = $this->eventRepository->findOneByGlobalId($event['global_id']); + //$this->currentEventIsNew = FALSE; + $this->cliOutput->writeln('Found "' . substr($event['title'], 0, 20) . '..." with global id ' . $event['global_id'] . ' in database'); + } + + // Set selected Region + $this->tmpCurrentEvent->setRegion($selectedRegion); + // Set Title + $this->tmpCurrentEvent->setTitle(substr($event['title'], 0, 254)); + // Set Highlight (Is only set in rest if true) + if($event['highlight']) + $this->tmpCurrentEvent->setHighlight($event['highlight']); + + // Set Texts + foreach ($event['texts'] as $text) + { + if ($text['rel'] == "details" && $text['type'] == "text/plain") { + $this->tmpCurrentEvent->setDetails($text['value']); + } + if ($text['rel'] == "teaser" && $text['type'] == "text/plain") { + $this->tmpCurrentEvent->setTeaser($text['value']); + } + } + + ////////////// + // Set Address + $this->tmpCurrentEvent->setStreet($event['street']); + $this->tmpCurrentEvent->setCity($event['city']); + $this->tmpCurrentEvent->setZip($event['zip']); + $this->tmpCurrentEvent->setCountry($event['country']); + + ////////// + // Set Geo + $this->tmpCurrentEvent->setLatitude($event['geo']['main']['latitude']); + $this->tmpCurrentEvent->setLongitude($event['geo']['main']['longitude']); + + ///////////////// + // Set Categories + $tmpSysCategory = FALSE; + $sysParentCategory = $this->sysCategoriesRepository->findByUid($this->categoryParentUid); + + foreach ($event['categories'] as $categoryTitle) { + + $tmpSysCategory = $this->sysCategoriesRepository->findOneByTitle($categoryTitle); + + if (!$tmpSysCategory) + { + $this->cliOutput->writeln('Creating new category: ' . $categoryTitle); + $tmpSysCategory = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Domain\\Model\\Category'); + $tmpSysCategory->setTitle($categoryTitle); + $tmpSysCategory->setParent($sysParentCategory); + $this->sysCategoriesRepository->add($tmpSysCategory); + $this->tmpCurrentEvent->addCategory($tmpSysCategory); + } else { + + $this->tmpCurrentEvent->addCategory($tmpSysCategory); + } + + $tmpSysCategory = FALSE; + } + + //////////////// + // Set Organizer + + $tmpOrganizer = FALSE; + foreach ($event['addresses'] as $address) + { + if ($address['rel'] == "organizer") { + $tmpOrganizer = $this->organizerRepository->findOneByName($address['name']); + if (!$tmpOrganizer) + { + $tmpOrganizer = $this->objectManager->get('Wrm\\Events\\Domain\\Model\\Organizer'); + + $tmpOrganizer->setName($address['name']); + $tmpOrganizer->setCity($address['city']); + $tmpOrganizer->setZip($address['zip']); + $tmpOrganizer->setStreet($address['street']); + $tmpOrganizer->setPhone($address['phone']); + $tmpOrganizer->setWeb($address['web']); + $tmpOrganizer->setEmail($address['email']); + $tmpOrganizer->setDistrict($address['district']); + + $this->organizerRepository->add($tmpOrganizer); + $this->tmpCurrentEvent->setOrganizer($tmpOrganizer); + + } else { + $this->tmpCurrentEvent->setOrganizer($tmpOrganizer); + } + $tmpOrganizer = FALSE; + } + } + + //////////// + // Set Dates + + // TODO: does not seem to work --> + //$currentEventDates = $this->tmpCurrentEvent->getDates(); + //$this->tmpCurrentEvent->removeAllDates($currentEventDates); + // <-- + + // TODO: Workaround delete dates + $currentEventDates = $this->tmpCurrentEvent->getDates(); + $this->cliOutput->writeln('Found ' . count($currentEventDates) . ' to delete'); + + foreach ($currentEventDates as $currentDate) { + //$this->cliOutput->writeln('Delete ' . $currentDate->getStart()->format('Y-m-d')); + $this->dateRepository->remove($currentDate); + } + + $now = new \DateTime(); + $now = $now->getTimestamp(); + + foreach ($event['timeIntervals'] as $date) { + + // Check if dates are given as interval or not + if (empty($date['interval'])) { + + if (strtotime($date['start']) > $now) { + + $this->cliOutput->writeln('Setup single date'); + //$this->cliOutput->writeln('Start ' . $date['start']); + //$this->cliOutput->writeln('End ' . $date['end']); + + $dateObj = $this->objectManager->get('Wrm\\Events\\Domain\\Model\\Date'); + + $start = new \DateTime($date['start'], new \DateTimeZone($date['tz'])); + $end = new \DateTime($date['end'], new \DateTimeZone($date['tz'])); + + $this->cliOutput->writeln('Start transformed ' . $start->format('Y-m-d H:i')); + $this->cliOutput->writeln('End transformed ' . $end->format('Y-m-d H:i')); + + $dateObj->setStart($start); + $dateObj->setEnd($end); + + $this->tmpCurrentEvent->addDate($dateObj); + + } + + } else { + + + if ($date['freq'] == 'Daily' && empty($date['weekdays'])) { + + $this->cliOutput->writeln('Setup daily interval dates'); + $this->cliOutput->writeln('Start ' . $date['start']); + $this->cliOutput->writeln('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)) { + + if ($i > $now) { + + $eventStart = new \DateTime(); + $eventStart->setTimestamp($i); + $eventStart->setTime($start->format('H'), $start->format('i')); + + $eventEnd = new \DateTime(); + $eventEnd->setTimestamp($i); + $eventEnd->setTime($until->format('H'), $until->format('i')); + + //$this->cliOutput->writeln($eventStart->format('Y-m-d H:i')); + //$this->cliOutput->writeln($eventEnd->format('Y-m-d H:i')); + + $dateObj = $this->objectManager->get('Wrm\\Events\\Domain\\Model\\Date'); + $dateObj->setStart($eventStart); + $dateObj->setEnd($eventEnd); + $this->tmpCurrentEvent->addDate($dateObj); + + } + + } + + } + + else if ($date['freq'] == 'Weekly' && !empty($date['weekdays'])) { + + foreach ($date['weekdays'] as $day) { + + $this->cliOutput->writeln('Setup weekly interval dates for ' . $day); + $this->cliOutput->writeln('Start ' . $date['start']); + $this->cliOutput->writeln('End ' . $date['repeatUntil']); + + $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)) { + + if ($i > $now) { + + $eventStart = new \DateTime(); + $eventStart->setTimestamp($i); + $eventStart->setTime($start->format('H'), $start->format('i')); + + $eventEnd = new \DateTime(); + $eventEnd->setTimestamp($i); + $eventEnd->setTime($until->format('H'), $until->format('i')); + + //$this->cliOutput->writeln($eventStart->format('Y-m-d H:i')); + //$this->cliOutput->writeln($eventEnd->format('Y-m-d H:i')); + + $dateObj = $this->objectManager->get('Wrm\\Events\\Domain\\Model\\Date'); + $dateObj->setStart($eventStart); + $dateObj->setEnd($eventEnd); + $this->tmpCurrentEvent->addDate($dateObj); + + } + + } + } + + } + + } + + } + + ///////////// + // Set Assets + + $this->resourceFactory = $this->objectManager->get('TYPO3\\CMS\\Core\\Resource\\ResourceFactory'); + $this->fileRepository = $this->objectManager->get('TYPO3\\CMS\\Core\\Resource\\FileRepository'); + $this->metaDataRepository = $this->objectManager->get('TYPO3\\CMS\\Core\\Resource\\Index\\MetaDataRepository'); + + foreach ($event['media_objects'] as $media_object) + { + if($media_object['rel'] == "default" && $media_object['type'] == "image/jpeg") { + + // + + $this->storage = $this->resourceFactory->getDefaultStorage(); + + // Check if file already exists + if (file_exists(PATH_site . '/fileadmin/' . $this->filesFolder . strtolower(basename($media_object['url'])))) { + $this->cliOutput->writeln('[NOTICE] File already exists'); + } else { + $this->cliOutput->writeln("[NOTICE] File don't exist"); + // Load the file + if ($file = $this->loadFile($media_object['url'])) { + // Move file to defined folder + $this->cliOutput->writeln('[INFO] Adding file ' . $file); + $this->storage->addFile(PATH_site . "uploads/tx_Events/" . $file, $this->storage->getFolder($this->filesFolder), basename($media_object['url'])); + } else { + $error = true; + } + } + + if ($error !== true) { + if ($this->tmpCurrentEvent->getImages() !== null) { + $this->cliOutput->writeln('Relation found'); + // TODO: How to delete file references? + } else { + $this->cliOutput->writeln('No relation found'); + $file = $this->storage->getFile($this->filesFolder . basename($media_object['url'])); + $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); + } + } + + } + } + + // Update and persist + $this->cliOutput->writeln('Persist database'); + $this->eventRepository->update($this->tmpCurrentEvent); + $this->persistenceManager->persistAll(); + + } + } + + $this->doSlugUpdate(); + + return 0; + } + + /** + * Load File + * + * @param string $asset + * @return bool + */ + protected function loadFile($file) { + $directory = PATH_site . "uploads/tx_Events/"; + $filename = basename($file); + $this->cliOutput->writeln('[INFO] Getting file ' . $file . ' as ' . $filename); + $asset = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($file); + + if ($asset) { + $fp = fopen($directory . $filename, 'w'); + fputs($fp, $asset); + fclose($fp); + + return $filename; + } + $this->cliOutput->writeln('[ERROR] cannot load file ' . $file); + return false; + } + + /** + * Build relations for FAL + * + * @param int $uid_local + * @param string $tablenames + * @param int $uid_foreign + * @param string $fieldname + * @param string $storagePid + * @return bool + */ + protected function createFileRelations($uid_local, $tablenames, $uid_foreign, $fieldname, $storagePid) { + + $newId = 'NEW1234'; + + $data = array(); + $data['sys_file_reference'][$newId] = array( + 'table_local' => 'sys_file', + 'uid_local' => $uid_local, + 'tablenames' => $tablenames, + 'uid_foreign' => $uid_foreign, + 'fieldname' => $fieldname, + 'pid' => $storagePid + ); + + $data[$tablenames][$uid_foreign] = array( + 'pid' => $storagePid, + $fieldname => $newId + ); + + $dataHandler = $this->objectManager->get('TYPO3\\CMS\\Core\\DataHandling\\DataHandler'); + $dataHandler->start($data, array()); + $dataHandler->process_datamap(); + + if (count($dataHandler->errorLog) === 0) { + return true; + } else { + foreach($dataHandler->errorLog as $error) { + $this->cliOutput->writeln($error); + } + return false; + } + } + + /* + * Generate random hash for filenames + */ + protected function randHash($len=32) + { + return substr(md5(openssl_random_pseudo_bytes(20)),-$len); + } + + /** + * Performs slug update + * + * @return bool + */ + protected function doSlugUpdate() + { + + $this->cliOutput->writeln('Update slugs'); + + $slugHelper = GeneralUtility::makeInstance( + SlugHelper::class, + 'tx_events_domain_model_event', + 'slug', + $GLOBALS['TCA']['tx_events_domain_model_event']['columns']['slug']['config'] + ); + + $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('tx_events_domain_model_event'); + $queryBuilder = $connection->createQueryBuilder(); + $queryBuilder->getRestrictions()->removeAll(); + + $statement = $queryBuilder->select('uid', 'global_id') + ->from('tx_events_domain_model_event') + ->where( + $queryBuilder->expr()->orX( + $queryBuilder->expr()->eq('slug', $queryBuilder->createNamedParameter('', \PDO::PARAM_STR)), + $queryBuilder->expr()->isNull('slug') + ) + ) + ->execute(); + + while ($record = $statement->fetch()) { + $queryBuilder = $connection->createQueryBuilder(); + $queryBuilder->update('tx_events_domain_model_event') + ->where( + $queryBuilder->expr()->eq( + 'uid', + $queryBuilder->createNamedParameter($record['uid'], \PDO::PARAM_INT) + ) + ) + ->set('slug', $slugHelper->sanitize((string)$record['global_id'])); + $queryBuilder->getSQL(); + $queryBuilder->execute(); + } + + return true; + } + +} \ No newline at end of file diff --git a/Classes/Controller/DateController.php b/Classes/Controller/DateController.php new file mode 100644 index 0000000..73a2f1a --- /dev/null +++ b/Classes/Controller/DateController.php @@ -0,0 +1,124 @@ + + * + ***/ + +use Wrm\Events\Domain\Model\Dto\DateDemand; +use Wrm\Events\Domain\Model\Date; +use Wrm\Events\Domain\Repository\DateRepository; +use TYPO3\CMS\Core\Database\QueryGenerator; +use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; +use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; + +/** + * DateController + */ +class DateController extends ActionController +{ + + /** + * @var dateRepository + */ + protected $dateRepository = null; + + /** + * @var QueryGenerator + */ + protected $queryGenerator; + + /** + * @var array + */ + protected $pluginSettings; + + /** + * @param DateRepository $dateRepository + */ + public function injectDateRepository(DateRepository $dateRepository) + { + $this->dateRepository = $dateRepository; + } + + /** + * Action initializer + */ + protected function initializeAction() + { + $this->pluginSettings = $this->configurationManager->getConfiguration( + ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK + ); + } + + /** + * action list + * + * @return void + */ + public function listAction() + { + $demand = $this->createDemandFromSettings(); + $dates = $this->dateRepository->findByDemand($demand); + $this->view->assign('dates', $dates); + } + + /** + * action teaser + * + * @return void + */ + public function teaserAction() + { + $dates = $this->dateRepository->findByUids($this->settings['eventUids']); + $this->view->assign('dates', $dates); + } + + /** + * action show + * + * @param \Wrm\Events\Domain\Model\Date $date + * @return void + */ + public function showAction(\Wrm\Events\Domain\Model\Date $date) + { + $this->view->assign('date', $date); + } + + /** + * @return DateDemand + */ + + protected function createDemandFromSettings(): DateDemand + { + $demand = $this->objectManager->get(DateDemand::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['sortByDate']); + $demand->setSortOrder((string)$this->settings['sortOrder']); + + $demand->setHighlight((string)$this->settings['highlight']); + + if (!empty($this->settings['limit'])) { + $demand->setLimit($this->settings['limit']); + } + + return $demand; + } +} diff --git a/Classes/Controller/EventController.php b/Classes/Controller/EventController.php new file mode 100644 index 0000000..def1182 --- /dev/null +++ b/Classes/Controller/EventController.php @@ -0,0 +1,115 @@ +eventRepository = $eventRepository; + } + + /** + * Action initializer + */ + protected function initializeAction() + { + $this->pluginSettings = $this->configurationManager->getConfiguration( + ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK + ); + } + + /** + * Action list + * + * @return void + */ + public function listAction() + { + + $demand = $this->createDemandFromSettings(); + $events = $this->eventRepository->findByDemand($demand); + $this->view->assign('events', $events); + + } + + /** + * Action show + * + * @param Event $event + * @return void + */ + public function showAction(Event $event) + { + $this->view->assign('event', $event); + } + + /** + * action teaser + * + * @return void + */ + public function teaserAction() + { + $events = $this->eventRepository->findByUids($this->settings['eventUids']); + $this->view->assign('events', $events); + } + + /** + * @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/Date.php b/Classes/Domain/Model/Date.php new file mode 100644 index 0000000..cd059db --- /dev/null +++ b/Classes/Domain/Model/Date.php @@ -0,0 +1,89 @@ + + * + ***/ + + +/** + * Date + */ +class Date extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity +{ + + /** + * @var \DateTime + */ + protected $start = null; + + /** + * @var \DateTime + */ + protected $end = ''; + + /** + * @var \Wrm\Events\Domain\Model\Event + */ + protected $event = null; + + /** + * @return \DateTime $start + */ + public function getStart() + { + return $this->start; + } + + /** + * @param \DateTime $start + * @return void + */ + public function setStart(\DateTime $start) + { + $this->start = $start; + } + + /** + * @return \DateTime end + */ + public function getEnd() + { + return $this->end; + } + + /** + * @param string $end + * @return void + */ + public function setEnd($end) + { + $this->end = $end; + } + + /** + * @return Event + */ + public function getEvent(): Event + { + return $this->event; + } + + /** + * @param Event $event + */ + public function setEvent(Event $event): self + { + $this->event = $event; + return $this; + } + +} diff --git a/Classes/Domain/Model/Dto/DateDemand.php b/Classes/Domain/Model/Dto/DateDemand.php new file mode 100644 index 0000000..4b4597f --- /dev/null +++ b/Classes/Domain/Model/Dto/DateDemand.php @@ -0,0 +1,177 @@ +sortBy; + } + + /** + * @param string $sortBy + */ + public function setSortBy(string $sortBy) + { + $this->sortBy = $sortBy; + } + + /** + * @return string + */ + public function getSortOrder(): string + { + return $this->sortOrder; + } + + /** + * @param string $sortOrder + */ + public function setSortOrder(string $sortOrder) + { + $this->sortOrder = $sortOrder; + } + + /** + * @return string + */ + public function getCategories(): string + { + return $this->categories; + } + + /** + * @param string $categories + */ + public function setCategories(string $categories) + { + $this->categories = $categories; + } + + /** + * @return bool + */ + public function getIncludeSubCategories(): bool + { + return $this->includeSubCategories; + } + + /** + * @param bool $includeSubCategories + */ + public function setIncludeSubCategories(bool $includeSubCategories) + { + $this->includeSubCategories = $includeSubCategories; + } + + /** + * @return string + */ + public function getCategoryCombination(): string + { + return $this->categoryCombination; + } + + /** + * @param string $categoryCombination + */ + public function setCategoryCombination(string $categoryCombination) + { + $this->categoryCombination = $categoryCombination; + } + + /** + * @return string + */ + public function getRegion(): string + { + return $this->region; + } + + /** + * @param \Wrm\DdEvents\Domain\Model\Region $region + */ + public function setRegion(string $region): void + { + $this->region = $region; + } + + /** + * @return string + */ + public function getHighlight(): string + { + return $this->highlight; + } + + /** + * @param string $hightlight + */ + public function setHighlight(string $highlight): void + { + $this->highlight = $highlight; + } + + /** + * @return string + */ + public function getLimit(): string + { + return $this->limit; + } + + /** + * @param string $limit + */ + public function setLimit(string $limit): void + { + $this->limit = $limit; + } + + + +} \ No newline at end of file diff --git a/Classes/Domain/Model/Dto/EventDemand.php b/Classes/Domain/Model/Dto/EventDemand.php new file mode 100644 index 0000000..0367554 --- /dev/null +++ b/Classes/Domain/Model/Dto/EventDemand.php @@ -0,0 +1,177 @@ +sortBy; + } + + /** + * @param string $sortBy + */ + public function setSortBy(string $sortBy) + { + $this->sortBy = $sortBy; + } + + /** + * @return string + */ + public function getSortOrder(): string + { + return $this->sortOrder; + } + + /** + * @param string $sortOrder + */ + public function setSortOrder(string $sortOrder) + { + $this->sortOrder = $sortOrder; + } + + /** + * @return string + */ + public function getCategories(): string + { + return $this->categories; + } + + /** + * @param string $categories + */ + public function setCategories(string $categories) + { + $this->categories = $categories; + } + + /** + * @return bool + */ + public function getIncludeSubCategories(): bool + { + return $this->includeSubCategories; + } + + /** + * @param bool $includeSubCategories + */ + public function setIncludeSubCategories(bool $includeSubCategories) + { + $this->includeSubCategories = $includeSubCategories; + } + + /** + * @return string + */ + public function getCategoryCombination(): string + { + return $this->categoryCombination; + } + + /** + * @param string $categoryCombination + */ + public function setCategoryCombination(string $categoryCombination) + { + $this->categoryCombination = $categoryCombination; + } + + /** + * @return string + */ + public function getRegion(): string + { + return $this->region; + } + + /** + * @param \Wrm\DdEvents\Domain\Model\Region $region + */ + public function setRegion(string $region): void + { + $this->region = $region; + } + + /** + * @return bool + */ + public function getHighlight(): bool + { + return $this->highlight; + } + + /** + * @param bool $hightlight + */ + public function setHighlight(bool $highlight): void + { + $this->highlight = $highlight; + } + + /** + * @return string + */ + public function getLimit(): string + { + return $this->limit; + } + + /** + * @param string $limit + */ + public function setLimit(string $limit): void + { + $this->limit = $limit; + } + + + +} \ No newline at end of file diff --git a/Classes/Domain/Model/Event.php b/Classes/Domain/Model/Event.php new file mode 100644 index 0000000..09ae89a --- /dev/null +++ b/Classes/Domain/Model/Event.php @@ -0,0 +1,659 @@ + + * @cascade remove + */ + protected $dates = null; + + /** + * organizer + * + * @var \Wrm\Events\Domain\Model\Organizer + */ + protected $organizer = null; + + /** + * region + * + * @var \Wrm\Events\Domain\Model\Region + */ + protected $region = null; + + /** + * categories + * + * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\Category> + */ + protected $categories; + + /** + * __construct + */ + public function __construct() + { + + //Do not remove the next line: It would break the functionality + $this->initStorageObjects(); + } + + /** + * @return void + */ + protected function initStorageObjects() + { + $this->dates = new ObjectStorage(); + } + + /** + * Returns the globalId + * + * @return string $globalId + */ + public function getGlobalId() + { + return $this->globalId; + } + + /** + * @param string $globalId + * @return void + */ + public function setGlobalId($globalId) + { + $this->globalId = $globalId; + } + + /** + * @return string $title + */ + public function getTitle() + { + return $this->title; + } + + /** + * @param string $title + * @return void + */ + public function setTitle($title) + { + $this->title = $title; + } + + /** + * @return string $teaser + */ + public function getTeaser() + { + return $this->teaser; + } + + /** + * @param string $teaser + * @return void + */ + public function setTeaser($teaser) + { + $this->teaser = $teaser; + } + + /** + * @return string $details + */ + public function getDetails() + { + return $this->details; + } + + /** + * @param string $details + * @return void + */ + public function setDetails($details) + { + $this->details = $details; + } + + /** + * @return string $priceInfo + */ + public function getPriceInfo() + { + return $this->priceInfo; + } + + /** + * @param string $priceInfo + * @return void + */ + public function setPriceInfo($priceInfo) + { + $this->priceInfo = $priceInfo; + } + + /** + * @return string $street + */ + public function getStreet() + { + return $this->street; + } + + /** + * @param string $street + * @return void + */ + public function setStreet($street) + { + $this->street = $street; + } + + /** + * @return string $district + */ + public function getDistrict() + { + return $this->district; + } + + /** + * @param string $district + * @return void + */ + public function setDistrict($district) + { + $this->district = $district; + } + + /** + * @return string $city + */ + public function getCity() + { + return $this->city; + } + + /** + * @param string $city + * @return void + */ + public function setCity($city) + { + $this->city = $city; + } + + /** + * @return string $zip + */ + public function getZip() + { + return $this->zip; + } + + /** + * @param string $zip + * @return void + */ + public function setZip($zip) + { + $this->zip = $zip; + } + + /** + * @return string $web + */ + public function getWeb() + { + return $this->web; + } + + /** + * @param string $web + * @return void + */ + public function setWeb($web) + { + $this->web = $web; + } + + /** + * @return string $booking + */ + public function getBooking() + { + return $this->booking; + } + + /** + * @param string $booking + * @return void + */ + public function setBooking($booking) + { + $this->booking = $booking; + } + + /** + * @return string $ticket + */ + public function getTicket() + { + return $this->ticket; + } + + /** + * @param string $ticket + * @return void + */ + public function setTicket($ticket) + { + $this->ticket = $ticket; + } + + /** + * @return string $facebook + */ + public function getFacebook() + { + return $this->facebook; + } + + /** + * @param string $facebook + * @return void + */ + public function setFacebook($facebook) + { + $this->facebook = $facebook; + } + + /** + * @return string $youtube + */ + public function getYoutube() + { + return $this->youtube; + } + + /** + * @param string $youtube + * @return void + */ + public function setYoutube($youtube) + { + $this->youtube = $youtube; + } + + /** + * @return string $latitude + */ + public function getLatitude() + { + return $this->latitude; + } + + /** + * @param string $latitude + * @return void + */ + public function setLatitude($latitude) + { + $this->latitude = $latitude; + } + + /** + * @return string $longitude + */ + public function getLongitude() + { + return $this->longitude; + } + + /** + * @param string $longitude + * @return void + */ + public function setLongitude($longitude) + { + $this->longitude = $longitude; + } + + /** + * @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $images + */ + public function getImages() + { + return $this->images; + } + + /** + * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $images + * @return void + */ + public function setImages(\TYPO3\CMS\Extbase\Domain\Model\FileReference $images) + { + $this->images = $images; + } + + /** + * @return string $slug + */ + public function getSlug() + { + return $this->slug; + } + + /** + * @param string $slug + * @return void + */ + public function setSlug($slug) + { + $this->slug = $slug; + } + + /** + * @param Date $date + * @return Event + */ + public function addDate(Date $date): self + { + $this->dates->attach($date); + return $this; + } + + /** + * @param Date $date + * @return Event + */ + public function removeDate(Date $date): self + { + $this->dates->detach($date); + return $this; + } + + /** + * @return ObjectStorage + */ + public function getDates(): ObjectStorage + { + return $this->dates; + } + + /** + * @param ObjectStorage $dates + * + * @return Event + */ + public function setDates($dates): self + { + $this->dates = $dates; + return $this; + } + + /** + * @param ObjectStorage $dates + * @return void + */ + public function removeAllDates(ObjectStorage $dates) { + $this->dates->removeAll($dates); + } + + /** + * @return \Wrm\Events\Domain\Model\Organizer $organizer + */ + public function getOrganizer() + { + return $this->organizer; + } + + /** + * @param \Wrm\Events\Domain\Model\Organizer $organizer + * @return void + */ + public function setOrganizer(\Wrm\Events\Domain\Model\Organizer $organizer) + { + $this->organizer = $organizer; + } + + /** + * @return \Wrm\Events\Domain\Model\Region $region + */ + public function getRegion() + { + return $this->region; + } + + /** + * @param \Wrm\Events\Domain\Model\Region $region + * @return void + */ + public function setRegion(\Wrm\Events\Domain\Model\Region $region) + { + $this->region = $region; + } + + /** + * @return bool $highlight + */ + public function getHighlight() + { + return $this->highlight; + } + + /** + * @param bool $highlight + * @return void + */ + public function setHighlight($highlight) + { + $this->highlight = $highlight; + } + + /** + * @return bool + */ + public function isHighlight() + { + return $this->highlight; + } + + /** + * @return string $country + */ + public function getCountry() + { + return $this->country; + } + + /** + * @param string $country + * @return void + */ + public function setCountry($country) + { + $this->country = $country; + } + + /** + * @param \TYPO3\CMS\Extbase\Domain\Model\Category<\TYPO3\CMS\Extbase\Domain\Model\Category> $category + */ + public function addCategory(\TYPO3\CMS\Extbase\Domain\Model\Category $category) + { + $this->categories->attach($category); + } + + /** + * @return $categories + */ + public function getCategories() + { + return $this->categories; + } + + /** + * @param TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\Category> $categories + */ + public function setCategories(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $categories) + { + $this->categories = $categories; + } +} diff --git a/Classes/Domain/Model/Organizer.php b/Classes/Domain/Model/Organizer.php new file mode 100644 index 0000000..643549b --- /dev/null +++ b/Classes/Domain/Model/Organizer.php @@ -0,0 +1,266 @@ + + * + ***/ +/** + * Organizer + */ +class Organizer extends \TYPO3\CMS\Extbase\DomainObject\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 = ''; + + /** + * Returns the name + * + * @return string $name + */ + public function getName() + { + return $this->name; + } + + /** + * Sets the name + * + * @param string $name + * @return void + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * Returns the street + * + * @return string $street + */ + public function getStreet() + { + return $this->street; + } + + /** + * Sets the street + * + * @param string $street + * @return void + */ + public function setStreet($street) + { + $this->street = $street; + } + + /** + * Returns the district + * + * @return string $district + */ + public function getDistrict() + { + return $this->district; + } + + /** + * Sets the district + * + * @param string $district + * @return void + */ + public function setDistrict($district) + { + $this->district = $district; + } + + /** + * Returns the city + * + * @return string $city + */ + public function getCity() + { + return $this->city; + } + + /** + * Sets the city + * + * @param string $city + * @return void + */ + public function setCity($city) + { + $this->city = $city; + } + + /** + * Returns the zip + * + * @return string $zip + */ + public function getZip() + { + return $this->zip; + } + + /** + * Sets the zip + * + * @param string $zip + * @return void + */ + public function setZip($zip) + { + $this->zip = $zip; + } + + /** + * Returns the phone + * + * @return string $phone + */ + public function getPhone() + { + return $this->phone; + } + + /** + * Sets the phone + * + * @param string $phone + * @return void + */ + public function setPhone($phone) + { + $this->phone = $phone; + } + + /** + * Returns the web + * + * @return string $web + */ + public function getWeb() + { + return $this->web; + } + + /** + * Sets the web + * + * @param string $web + * @return void + */ + public function setWeb($web) + { + $this->web = $web; + } + + /** + * Returns the email + * + * @return string $email + */ + public function getEmail() + { + return $this->email; + } + + /** + * Sets the email + * + * @param string $email + * @return void + */ + public function setEmail($email) + { + $this->email = $email; + } + + /** + * __construct + */ + public function __construct() + { + + //Do not remove the next line: It would break the functionality + $this->initStorageObjects(); + } + + /** + * Initializes all ObjectStorage properties + * 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() + { + } +} diff --git a/Classes/Domain/Model/Region.php b/Classes/Domain/Model/Region.php new file mode 100644 index 0000000..3cba915 --- /dev/null +++ b/Classes/Domain/Model/Region.php @@ -0,0 +1,70 @@ + + * + ***/ +/** + * Region + */ +class Region extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity +{ + + /** + * title + * + * @var string + */ + protected $title = ''; + + /** + * Returns the title + * + * @return string $title + */ + public function getTitle() + { + return $this->title; + } + + /** + * Sets the title + * + * @param string $title + * @return void + */ + public function setTitle($title) + { + $this->title = $title; + } + + /** + * __construct + */ + public function __construct() + { + + //Do not remove the next line: It would break the functionality + $this->initStorageObjects(); + } + + /** + * Initializes all ObjectStorage properties + * 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() + { + } +} diff --git a/Classes/Domain/Repository/DateRepository.php b/Classes/Domain/Repository/DateRepository.php new file mode 100644 index 0000000..611bef5 --- /dev/null +++ b/Classes/Domain/Repository/DateRepository.php @@ -0,0 +1,176 @@ +createQuery(); + //$query->getQuerySettings()->setRespectStoragePage(false); + + $query->matching( + $query->in('uid', $uids) + ); + + //return $this->orderByField($query->execute(), $uids); + + return $query->execute(); + } + + /** + * @param DateDemand $demand + * @return QueryResultInterface + * @throws InvalidQueryException + */ + public function findByDemand(DateDemand $demand) + { + $query = $this->createDemandQuery($demand); + + // For testing purposes + // $query = $this->createDemandQueryViaBuilder($demand); + + return $query->execute(); + } + + /** + * @param DateDemand $demand + * @return QueryInterface + * @throws InvalidQueryException + */ + protected function createDemandQuery(DateDemand $demand): QueryInterface + { + $query = $this->createQuery(); + + $constraints = []; + + $categories = $demand->getCategories(); + + 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->getRegion() !== '') { + $constraints['region'] = $query->equals('event.region', $demand->getRegion()); + } + + if ($demand->getRegion() !== null) { + $constraints['highlight'] = $query->equals('event.highlight', $demand->getHighlight()); + } + + if ($demand->getLimit() !== '') { + $query->setLimit((int) $demand->getLimit()); + } + + + if (!empty($constraints)) { + $query->matching($query->logicalAnd($constraints)); + } + + + $sortBy = $demand->getSortBy(); + if ($sortBy && $sortBy !== 'singleSelection' && $sortBy !== 'default') { + $order = strtolower($demand->getSortOrder()) === 'desc' ? QueryInterface::ORDER_DESCENDING : QueryInterface::ORDER_ASCENDING; + $query->setOrderings([$sortBy => $order]); + } + + return $query; + } + + /** + * @param QueryInterface $query + * @param string $categories + * @param bool $includeSubCategories + * @return array + * @throws InvalidQueryException + */ + protected function createCategoryConstraint(QueryInterface $query, $categories, bool $includeSubCategories = false): array + { + $constraints = []; + + if ($includeSubCategories) { + $categoryService = GeneralUtility::makeInstance(CategoryService::class); + $allCategories = $categoryService->getChildrenCategories($categories); + if (!\is_array($allCategories)) { + $allCategories = GeneralUtility::intExplode(',', $allCategories, true); + } + } else { + $allCategories = GeneralUtility::intExplode(',', $categories, true); + } + + foreach ($allCategories as $category) { + $constraints[] = $query->contains('event.categories', $category); + } + return $constraints; + } + + /** + * @param DateDemand + * @return $statement + * @throws InvalidQueryException + */ + + protected function createDemandQueryViaBuilder(DateDemand $demand) { + + //$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tx_Events_domain_model_date'); + + $connection = GeneralUtility::makeInstance(ConnectionPool::class) + ->getConnectionForTable('tx_Events_domain_model_date'); + + $queryBuilder = $connection->createQueryBuilder(); + + $statement = $queryBuilder + ->select('tx_Events_domain_model_date.start', 'tx_Events_domain_model_date.end', 'tx_Events_domain_model_date.event') + ->from('tx_Events_domain_model_date') + ->join( + 'tx_Events_domain_model_date', + 'tx_Events_domain_model_event', + 'event', + $queryBuilder->expr()->eq('tx_Events_domain_model_date.event', $queryBuilder->quoteIdentifier('event.uid')) + )->where( + $queryBuilder->expr()->eq('event.title', $queryBuilder->createNamedParameter('Bachführung')) + ); + + if ($demand->getLimit() !== '') { + $statement->setMaxResults((int) $demand->getLimit()); + } + + return $statement; + } + +} \ No newline at end of file diff --git a/Classes/Domain/Repository/EventRepository.php b/Classes/Domain/Repository/EventRepository.php new file mode 100644 index 0000000..3f0c9f3 --- /dev/null +++ b/Classes/Domain/Repository/EventRepository.php @@ -0,0 +1,134 @@ +createQuery(); + //$query->getQuerySettings()->setRespectStoragePage(false); + + $query->matching( + $query->in('uid', $uids) + ); + + //return $this->orderByField($query->execute(), $uids); + + return $query->execute(); + } + + /** + * @param EventDemand $demand + * @return QueryResultInterface + * @throws InvalidQueryException + */ + public function findByDemand(EventDemand $demand) + { + $query = $this->createDemandQuery($demand); + return $query->execute(); + } + + /** + * @param EventDemand $demand + * @return QueryInterface + * @throws InvalidQueryException + */ + protected function createDemandQuery(EventDemand $demand): QueryInterface + { + $query = $this->createQuery(); + + // 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 = []; + + $categories = $demand->getCategories(); + + 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->getRegion() !== '') { + $constraints['region'] = $query->equals('region', $demand->getRegion()); + } + + if ($demand->getHighlight()) { + $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; + } + + /** + * @param QueryInterface $query + * @param string $categories + * @param bool $includeSubCategories + * @return array + * @throws InvalidQueryException + */ + protected function createCategoryConstraint(QueryInterface $query, $categories, bool $includeSubCategories = false): array + { + $constraints = []; + + if ($includeSubCategories) { + $categoryService = GeneralUtility::makeInstance(CategoryService::class); + $allCategories = $categoryService->getChildrenCategories($categories); + 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; + } + +} \ No newline at end of file diff --git a/Classes/Domain/Repository/OrganizerRepository.php b/Classes/Domain/Repository/OrganizerRepository.php new file mode 100644 index 0000000..cc2b07f --- /dev/null +++ b/Classes/Domain/Repository/OrganizerRepository.php @@ -0,0 +1,22 @@ +timeTracker = GeneralUtility::makeInstance(TimeTracker::class); + $this->cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('cache_Events_category'); + } + + /** + * Get child categories by calling recursive function + * and using the caching framework to save some queries + * + * @param string $idList list of category ids to start + * @param int $counter + * @return string comma separated list of category ids + */ + public function getChildrenCategories($idList, int $counter = 0) + { + $cacheIdentifier = sha1('children' . $idList); + + $entry = $this->cache->get($cacheIdentifier); + if (!$entry) { + $entry = $this->getChildrenCategoriesRecursive($idList, $counter); + $this->cache->set($cacheIdentifier, $entry); + } + + return $entry; + } + + /** + * Get child categories + * + * @param string $idList list of category ids to start + * @param int $counter + * @return string comma separated list of category ids + */ + protected function getChildrenCategoriesRecursive($idList, $counter = 0): string + { + $result = []; + + // add id list to the output + if ($counter === 0) { + $newList = $this->getUidListFromRecords($idList); + if ($newList) { + $result[] = $newList; + } + } + + $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) + ->getQueryBuilderForTable('sys_category'); + $res = $queryBuilder + ->select('uid') + ->from('sys_category') + ->where( + $queryBuilder->expr()->in('parent', $queryBuilder->createNamedParameter(explode(',', $idList), Connection::PARAM_INT_ARRAY)) + ) + ->execute(); + + while ($row = $res->fetch()) { + $counter++; + if ($counter > 10000) { + $this->timeTracker->setTSlogMessage('EXT:dd_events: one or more recursive categories where found'); + return implode(',', $result); + } + $subcategories = $this->getChildrenCategoriesRecursive($row['uid'], $counter); + $result[] = $row['uid'] . ($subcategories ? ',' . $subcategories : ''); + } + + $result = implode(',', $result); + return $result; + } + + /** + * Fetch ids again from DB to avoid false positives + * + * @param string $idList + * @return string + */ + protected function getUidListFromRecords(string $idList): string + { + $list = []; + $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) + ->getQueryBuilderForTable('sys_category'); + $rows = $queryBuilder + ->select('uid') + ->from('sys_category') + ->where( + $queryBuilder->expr()->in('uid', $queryBuilder->createNamedParameter(explode(',', $idList), Connection::PARAM_INT_ARRAY)) + ) + ->execute() + ->fetchAll(); + foreach ($rows as $row) { + $list[] = $row['uid']; + } + + return implode(',', $list); + } +} diff --git a/Configuration/Commands.php b/Configuration/Commands.php new file mode 100644 index 0000000..97058a2 --- /dev/null +++ b/Configuration/Commands.php @@ -0,0 +1,6 @@ + [ + 'class' => \Wrm\Events\Command\ImportCommand::class + ] +]; \ No newline at end of file diff --git a/Configuration/ExtensionBuilder/settings.yaml b/Configuration/ExtensionBuilder/settings.yaml new file mode 100644 index 0000000..3b52d12 --- /dev/null +++ b/Configuration/ExtensionBuilder/settings.yaml @@ -0,0 +1,101 @@ +# +# 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/Pi1.xml b/Configuration/FlexForms/Pi1.xml new file mode 100644 index 0000000..fdfb0bd --- /dev/null +++ b/Configuration/FlexForms/Pi1.xml @@ -0,0 +1,397 @@ + + + + + + Options + + array + + + + + reload + + select + + + Event List + Event->list + + + Event Teaser + Event->teaser + + + Event Show + Event->show + + + Date List + Date->list + + + + Date Show + Date->show + + + + + + + + + + 1 + + FIELD:switchableControllerActions:=:Event->list + + select + + + Default + default + + + Title + title + + + Region + region + + + + + + + + + + 1 + + FIELD:switchableControllerActions:=:Date->list + + select + + + Default + default + + + Start + start + + + End + end + + + + + + + + + + 1 + + + + FIELD:switchableControllerActions:=:Event->list + FIELD:switchableControllerActions:=:Date->list + + + + select + + + + Ascending + + ASC + + + + Descending + + DESC + + + ASC + + + + + + + 1 + + + + FIELD:switchableControllerActions:=:Event->list + FIELD:switchableControllerActions:=:Date->list + + + + 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:=:Date->list + FIELD:switchableControllerActions:=:Date->teaser + + + + 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/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php new file mode 100644 index 0000000..f83f45a --- /dev/null +++ b/Configuration/TCA/Overrides/tt_content.php @@ -0,0 +1,24 @@ + '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 new file mode 100644 index 0000000..41e3ea9 --- /dev/null +++ b/Configuration/TCA/tx_events_domain_model_date.php @@ -0,0 +1,166 @@ + [ + 'title' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_date', + 'label' => 'start', + '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', + 'starttime' => 'starttime', + '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', + ], + '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'], + ], + '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', + 'exclude' => true, + '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_date', + 'foreign_table_where' => 'AND {#tx_events_domain_model_date}.{#pid}=###CURRENT_PID### AND {#tx_events_domain_model_date}.{#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 + ] + ], + ], + ], + 'starttime' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime', + 'config' => [ + 'type' => 'input', + 'renderType' => 'inputDateTime', + 'eval' => 'datetime,int', + 'default' => 0, + 'behaviour' => [ + 'allowLanguageSynchronization' => true + ] + ], + ], + 'endtime' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime', + 'config' => [ + 'type' => 'input', + 'renderType' => 'inputDateTime', + 'eval' => 'datetime,int', + 'default' => 0, + 'range' => [ + 'upper' => mktime(0, 0, 0, 1, 1, 2038) + ], + 'behaviour' => [ + 'allowLanguageSynchronization' => true + ] + ], + ], + + 'start' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_date.start', + 'config' => [ + 'dbType' => 'datetime', + 'type' => 'input', + 'renderType' => 'inputDateTime', + 'size' => 12, + 'eval' => 'datetime', + 'default' => null, + ], + ], + 'end' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_date.end', + 'config' => [ + 'dbType' => 'datetime', + 'type' => 'input', + 'renderType' => 'inputDateTime', + 'size' => 12, + 'eval' => 'datetime', + 'default' => null, + ], + ], + + /* + 'event' => [ + 'config' => [ + 'type' => 'passthrough', + ], + ], + */ + + 'event' => array( + 'exclude' => 1, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_date.event', + 'config' => array( + 'type' => 'select', + 'renderType' => 'selectSingle', + 'foreign_table' => 'tx_events_domain_model_event', + 'size' => 1, + 'minitems' => 0, + 'maxitems' => 1, + 'readOnly' =>1, + ) + ) + ], +]; diff --git a/Configuration/TCA/tx_events_domain_model_event.php b/Configuration/TCA/tx_events_domain_model_event.php new file mode 100644 index 0000000..4ee748d --- /dev/null +++ b/Configuration/TCA/tx_events_domain_model_event.php @@ -0,0 +1,445 @@ + [ + 'title' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event', + 'label' => 'title', + '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', + '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, street, district, city, zip, country, web, booking, ticket, facebook, youtube, latitude, longitude, images, categories, dates, organizer, region', + ], + 'types' => [ + '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, global_id, slug, highlight, teaser, details, price_info, street, district, city, zip, country, web, booking, ticket, facebook, youtube, latitude, longitude, images, categories, dates, organizer, region, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], + ], + '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', + 'exclude' => true, + '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_event', + 'foreign_table_where' => 'AND {#tx_events_domain_model_event}.{#pid}=###CURRENT_PID### AND {#tx_events_domain_model_event}.{#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 + ] + ], + ], + ], + 'starttime' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime', + 'config' => [ + 'type' => 'input', + 'renderType' => 'inputDateTime', + 'eval' => 'datetime,int', + 'default' => 0, + 'behaviour' => [ + 'allowLanguageSynchronization' => true + ] + ], + ], + 'endtime' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime', + 'config' => [ + 'type' => 'input', + 'renderType' => 'inputDateTime', + 'eval' => 'datetime,int', + 'default' => 0, + 'range' => [ + 'upper' => mktime(0, 0, 0, 1, 1, 2038) + ], + 'behaviour' => [ + 'allowLanguageSynchronization' => true + ] + ], + ], + + 'title' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.title', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ] + ], + 'global_id' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.global_id', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + 'slug' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.slug', + 'config' => [ + 'type' => 'slug', + 'size' => 50, + 'generatorOptions' => [ + 'fields' => ['title'], + 'fieldSeparator' => '/', + 'prefixParentPageSlug' => false, + ], + 'fallbackCharacter' => '-', + 'eval' => 'uniqueInSite', + 'default' => '', + ], + ], + /* + 'slug' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.slug', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + */ + 'highlight' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.highlight', + 'config' => [ + 'type' => 'check', + 'items' => [ + '1' => [ + '0' => 'LLL:EXT:lang/locallang_core.xlf:labels.enabled' + ] + ], + 'default' => 0, + ] + ], + 'teaser' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.teaser', + 'config' => [ + 'type' => 'text', + 'cols' => 40, + 'rows' => 15, + 'eval' => 'trim' + ] + ], + 'details' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.details', + 'config' => [ + 'type' => 'text', + 'enableRichtext' => true, + 'richtextConfiguration' => 'default', + 'fieldControl' => [ + 'fullScreenRichtext' => [ + 'disabled' => false, + ], + ], + 'cols' => 40, + 'rows' => 15, + 'eval' => 'trim', + ], + + ], + 'price_info' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.price_info', + 'config' => [ + 'type' => 'text', + 'cols' => 40, + 'rows' => 15, + 'eval' => 'trim' + ] + ], + 'street' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.street', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + 'district' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.district', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + 'city' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.city', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + 'zip' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.zip', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + 'country' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.country', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + 'web' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.web', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + 'booking' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.booking', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + 'ticket' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.ticket', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + 'facebook' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.facebook', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + 'youtube' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.youtube', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + 'latitude' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.latitude', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + 'longitude' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.longitude', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + 'images' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf: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', + 'showPossibleLocalizationRecords' => true, + 'showRemovedLocalizationRecords' => true, + 'showAllLocalizationLink' => true, + 'showSynchronizationLink' => true, + ], + 'foreign_match_fields' => [ + 'fieldname' => 'images', + 'tablenames' => 'tx_events_domain_model_event', + 'table_local' => 'sys_file', + ], + 'foreign_types' => [ + '0' => [ + 'showitem' => ' + --palette--;LLL:EXT:lang/locallang_tca.xlf: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--;;filePalette' + ], + \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [ + 'showitem' => ' + --palette--;LLL:EXT:lang/locallang_tca.xlf: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--;;filePalette' + ], + \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [ + 'showitem' => ' + --palette--;LLL:EXT:lang/locallang_tca.xlf: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--;;filePalette' + ] + ], + 'maxitems' => 1 + ], + $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] + ), + ], + + 'categories' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.categories', + 'config' => [ + 'type' => 'input', + 'size' => 4, + 'eval' => 'int' + ] + ], + + 'dates' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.dates', + 'config' => [ + 'type' => 'inline', + 'foreign_table' => 'tx_events_domain_model_date', + 'foreign_field' => 'event', + 'maxitems' => 9999, + 'appearance' => [ + 'collapseAll' => 1, + 'useSortable' => 0, + 'expandSingle' => 1, + 'enabledControls' => array( + 'info' => false, + 'new' => false, + 'dragdrop' => false, + 'sort' => false, + 'hide' => false, + 'delete' => false, + 'localize' => false, + ), + 'levelLinksPosition' => 'top', + 'showPossibleLocalizationRecords' => false, + 'showRemovedLocalizationRecords' => false, + 'showSynchronizationLink' => false, + 'showAllLocalizationLink' => false, + ], + + ], + + ], + + 'organizer' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.organizer', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectSingle', + 'foreign_table' => 'tx_events_domain_model_organizer', + 'minitems' => 0, + 'maxitems' => 1, + ], + ], + 'region' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_event.region', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectSingle', + 'foreign_table' => 'tx_events_domain_model_region', + 'minitems' => 0, + 'maxitems' => 1, + ], + ], + + ], +]; diff --git a/Configuration/TCA/tx_events_domain_model_organizer.php b/Configuration/TCA/tx_events_domain_model_organizer.php new file mode 100644 index 0000000..319492e --- /dev/null +++ b/Configuration/TCA/tx_events_domain_model_organizer.php @@ -0,0 +1,193 @@ + [ + 'title' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_organizer', + 'label' => 'name', + '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', + 'starttime' => 'starttime', + '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', + ], + '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'], + ], + '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', + 'exclude' => true, + '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_organizer', + 'foreign_table_where' => 'AND {#tx_events_domain_model_organizer}.{#pid}=###CURRENT_PID### AND {#tx_events_domain_model_organizer}.{#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 + ] + ], + ], + ], + 'starttime' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime', + 'config' => [ + 'type' => 'input', + 'renderType' => 'inputDateTime', + 'eval' => 'datetime,int', + 'default' => 0, + 'behaviour' => [ + 'allowLanguageSynchronization' => true + ] + ], + ], + 'endtime' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime', + 'config' => [ + 'type' => 'input', + 'renderType' => 'inputDateTime', + 'eval' => 'datetime,int', + 'default' => 0, + 'range' => [ + 'upper' => mktime(0, 0, 0, 1, 1, 2038) + ], + 'behaviour' => [ + 'allowLanguageSynchronization' => true + ] + ], + ], + + 'name' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_organizer.name', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + 'street' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_organizer.street', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + 'district' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_organizer.district', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + 'city' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_organizer.city', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + 'zip' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_organizer.zip', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + 'phone' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_organizer.phone', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + 'web' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_organizer.web', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + 'email' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_organizer.email', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + + ], +]; diff --git a/Configuration/TCA/tx_events_domain_model_region.php b/Configuration/TCA/tx_events_domain_model_region.php new file mode 100644 index 0000000..afea5fe --- /dev/null +++ b/Configuration/TCA/tx_events_domain_model_region.php @@ -0,0 +1,130 @@ + [ + 'title' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_region', + 'label' => 'title', + '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', + 'starttime' => 'starttime', + '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', + ], + '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'], + ], + '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', + 'exclude' => true, + '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_region', + 'foreign_table_where' => 'AND {#tx_events_domain_model_region}.{#pid}=###CURRENT_PID### AND {#tx_events_domain_model_region}.{#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 + ] + ], + ], + ], + 'starttime' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime', + 'config' => [ + 'type' => 'input', + 'renderType' => 'inputDateTime', + 'eval' => 'datetime,int', + 'default' => 0, + 'behaviour' => [ + 'allowLanguageSynchronization' => true + ] + ], + ], + 'endtime' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime', + 'config' => [ + 'type' => 'input', + 'renderType' => 'inputDateTime', + 'eval' => 'datetime,int', + 'default' => 0, + 'range' => [ + 'upper' => mktime(0, 0, 0, 1, 1, 2038) + ], + 'behaviour' => [ + 'allowLanguageSynchronization' => true + ] + ], + ], + + 'title' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_domain_model_region.title', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ], + ], + + ], +]; diff --git a/Configuration/TypoScript/constants.typoscript b/Configuration/TypoScript/constants.typoscript new file mode 100644 index 0000000..fe3c153 --- /dev/null +++ b/Configuration/TypoScript/constants.typoscript @@ -0,0 +1,15 @@ + +plugin.tx_events { + view { + # cat=plugin.tx_ddevents/file; type=string; label=Path to template root (FE) + templateRootPath = EXT:events/Resources/Private/Templates/ + # cat=plugin.tx_ddevents/file; type=string; label=Path to template partials (FE) + partialRootPath = EXTevents/Resources/Private/Partials/ + # cat=plugin.tx_ddevents/file; type=string; label=Path to template layouts (FE) + layoutRootPath = EXT:events/Resources/Private/Layouts/ + } + persistence { + # cat=plugin.tx_ddevents//a; type=string; label=Default storage PID + storagePid = + } +} diff --git a/Configuration/TypoScript/setup.typoscript b/Configuration/TypoScript/setup.typoscript new file mode 100644 index 0000000..2d9f9cf --- /dev/null +++ b/Configuration/TypoScript/setup.typoscript @@ -0,0 +1,49 @@ + +plugin.tx_events { + view { + templateRootPaths { + 0 = EXT:events/Resources/Private/Templates/ + 1 = {$plugin.tx_events.view.templateRootPath} + } + partialRootPaths { + 0 = EXT:events/Resources/Private/Partials/ + 1 = {$plugin.tx_events.view.partialRootPath} + } + layoutRootPaths { + 0 = EXT:events/Resources/Private/Layouts/ + 1 = {$plugin.tx_events.view.layoutRootPath} + } + widget { + TYPO3\CMS\Fluid\ViewHelpers\Widget\PaginateViewHelper { + templateRootPath = {$plugin.tx_events.view.templateRootPath} + } + } + } + persistence { + storagePid = {$plugin.tx_events.persistence.storagePid} + recursive = 1 + } + features { + #skipDefaultArguments = 1 + # if set to 1, the enable fields are ignored in BE context + ignoreAllEnableFieldsInBe = 0 + # Should be on by default, but can be disabled if all action in the plugin are uncached + requireCHashArgumentForActionArguments = 1 + } + mvc { + #callDefaultActionIfActionCantBeResolved = 1 + } + settings { + + defaulDetailEventsPid = + defaultDetailDatesPid = + + paginate { + # can be overriden by plugin + itemsPerPage = 10 + insertAbove = 0 + insertBelow = 1 + maximumNumberOfLinks = 10 + } + } +} \ No newline at end of file diff --git a/Documentation/Administrator/Index.rst b/Documentation/Administrator/Index.rst new file mode 100644 index 0000000..10bc545 --- /dev/null +++ b/Documentation/Administrator/Index.rst @@ -0,0 +1,82 @@ +.. ================================================== +.. FOR YOUR INFORMATION +.. -------------------------------------------------- +.. -*- coding: utf-8 -*- with BOM. + +.. include:: ../Includes.txt + + +.. _admin-manual: + +Administrator Manual +==================== + +Target group: **Administrators** + +Describes how to manage the extension from an administrator point of view. +That relates to Page/User TSconfig, permissions, configuration etc., +which administrator level users have access to. + +Language should be non / semi-technical, explaining, using small examples. + + +.. _admin-installation: + +Installation +------------ + +- How should the extension be installed? +- Are they dependencies to resolve? +- Is it a static template file to be included? + +To install the extension, perform the following steps: + +#. Go to the Extension Manager +#. Install the extension +#. Load the static template +#. ... + +For a list of configuration options, using a definition list is recommended: + +Some Configuration + This option enables... + +Other configuration + This other option is for all the rest... + + +.. figure:: ../Images/AdministratorManual/ExtensionManager.png + :alt: Extension Manager + + Extension Manager (caption of the image) + + List of extensions within the Extension Manager also shorten with "EM" (legend of the image) + + +.. _admin-configuration: + +Configuration +------------- + +* Where and how the extension should be configured? TypoScript? PHP? + +* Are there other prerequisite to full fill beforehand? + For example, configure a setting in a special way somewhere. + + +.. _admin-faq: + +FAQ +--- + +Possible subsection: FAQ + +Subsection +^^^^^^^^^^ + +Some subsection + +Sub-subsection +"""""""""""""" + +Deeper into the structure... diff --git a/Documentation/ChangeLog/Index.rst b/Documentation/ChangeLog/Index.rst new file mode 100644 index 0000000..4972785 --- /dev/null +++ b/Documentation/ChangeLog/Index.rst @@ -0,0 +1,16 @@ +.. ================================================== +.. FOR YOUR INFORMATION +.. -------------------------------------------------- +.. -*- coding: utf-8 -*- with BOM. + +.. include:: ../Includes.txt + + +.. _changelog: + +ChangeLog +========= + +Providing a change log chapter is optional. You can also refer +users to the ChangeLog file inside the extension or to some repository's +commit listing. diff --git a/Documentation/Configuration/Index.rst b/Documentation/Configuration/Index.rst new file mode 100644 index 0000000..0dac787 --- /dev/null +++ b/Documentation/Configuration/Index.rst @@ -0,0 +1,106 @@ +.. ================================================== +.. FOR YOUR INFORMATION +.. -------------------------------------------------- +.. -*- coding: utf-8 -*- with BOM. + +.. include:: ../Includes.txt + + +.. _configuration: + +Configuration Reference +======================= + +Technical information: Installation, Reference of TypoScript options, +configuration options on system level, how to extend it, the technical +details, how to debug it and so on. + +Language should be technical, assuming developer knowledge of TYPO3. +Small examples/visuals are always encouraged. + +Target group: **Developers** + + +.. _configuration-typoscript: + +TypoScript Reference +-------------------- + +Possible subsections: Reference of TypoScript options. +The construct below show the recommended structure for +TypoScript properties listing and description. + +Properties should be listed in the order in which they +are executed by your extension, but the first should be +alphabetical for easier access. + +When detailing data types or standard TypoScript +features, don't hesitate to cross-link to the TypoScript +Reference as shown below. See the :file:`Settings.yml` +file for the declaration of cross-linking keys. + + +Properties +^^^^^^^^^^ + +.. container:: ts-properties + + =========================== ===================================== ======================= ==================== + Property Data type :ref:`t3tsref:stdwrap` Default + =========================== ===================================== ======================= ==================== + allWrap_ :ref:`t3tsref:data-type-wrap` yes :code:`
|
` + `subst\_elementUid`_ :ref:`t3tsref:data-type-boolean` no 0 + wrapItemAndSub_ :ref:`t3tsref:data-type-wrap` + =========================== ===================================== ======================= ==================== + + +Property details +^^^^^^^^^^^^^^^^ + +.. only:: html + + .. contents:: + :local: + :depth: 1 + + +.. _ts-plugin-tx-extensionkey-stdwrap: + +allWrap +""""""" + +:typoscript:`plugin.tx_extensionkey.allWrap =` :ref:`t3tsref:data-type-wrap` + +Wraps the whole item. + + +.. _ts-plugin-tx-extensionkey-wrapitemandsub: + +wrapItemAndSub +"""""""""""""" + +:typoscript:`plugin.tx_extensionkey.wrapItemAndSub =` :ref:`t3tsref:data-type-wrap` + +Wraps the whole item and any submenu concatenated to it. + + +.. _ts-plugin-tx-extensionkey-substelementUid: + +subst_elementUid +"""""""""""""""" + +:typoscript:`plugin.tx_extensionkey.subst_elementUid =` :ref:`t3tsref:data-type-boolean` + +If set, all appearances of the string ``{elementUid}`` in the total +element html-code (after wrapped in allWrap_) are substituted with the +uid number of the menu item. This is useful if you want to insert an +identification code in the HTML in order to manipulate properties with +JavaScript. + + +.. _configuration-faq: + +FAQ +--- + +Possible subsection: FAQ diff --git a/Documentation/Developer/Index.rst b/Documentation/Developer/Index.rst new file mode 100644 index 0000000..57d4447 --- /dev/null +++ b/Documentation/Developer/Index.rst @@ -0,0 +1,60 @@ +.. ================================================== +.. FOR YOUR INFORMATION +.. -------------------------------------------------- +.. -*- coding: utf-8 -*- with BOM. + +.. include:: ../Includes.txt + + +.. _developer: + +Developer Corner +================ + +Target group: **Developers** + +Use this section for *providing code examples* or any **useful** information code wise. + + +.. _developer-hooks: + +Hooks +----- + +Possible hook examples. Input parameters are: + ++----------------+---------------+---------------------------------+ +| Parameter | Data type | Description | ++================+===============+=================================+ +| $table | string | Name of the table | ++----------------+---------------+---------------------------------+ +| $field | string | Name of the field | ++----------------+---------------+---------------------------------+ + +Use parameter :code:`$table` to retrieve the table name... + +.. _developer-api: + +API +--- + +How to use the API... + +.. code-block:: php + + $stuff = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( + '\\Foo\\Bar\\Utility\\Stuff' + ); + $stuff->do(); + +or some other language: + +.. code-block:: javascript + :linenos: + :emphasize-lines: 2-4 + + $(document).ready( + function () { + doStuff(); + } + ); diff --git a/Documentation/Images/AdministratorManual/ExtensionManager.png b/Documentation/Images/AdministratorManual/ExtensionManager.png new file mode 100644 index 0000000..67ea693 Binary files /dev/null and b/Documentation/Images/AdministratorManual/ExtensionManager.png differ diff --git a/Documentation/Images/IntroductionPackage.png b/Documentation/Images/IntroductionPackage.png new file mode 100644 index 0000000..1de0f00 Binary files /dev/null and b/Documentation/Images/IntroductionPackage.png differ diff --git a/Documentation/Images/UserManual/BackendView.png b/Documentation/Images/UserManual/BackendView.png new file mode 100644 index 0000000..46f90a8 Binary files /dev/null and b/Documentation/Images/UserManual/BackendView.png differ diff --git a/Documentation/Includes.txt b/Documentation/Includes.txt new file mode 100644 index 0000000..a111144 --- /dev/null +++ b/Documentation/Includes.txt @@ -0,0 +1,21 @@ +.. ================================================== +.. FOR YOUR INFORMATION +.. -------------------------------------------------- +.. -*- coding: utf-8 -*- with BOM. + +.. This is 'Includes.txt'. It is included at the very top of each and + every ReST source file in this documentation project (= manual). + + +.. ================================================== +.. DEFINE SOME TEXT ROLES +.. -------------------------------------------------- + +.. role:: typoscript(code) + +.. role:: ts(typoscript) + :class: typoscript + +.. role:: php(code) + +.. highlight:: php diff --git a/Documentation/Index.rst b/Documentation/Index.rst new file mode 100644 index 0000000..178e8db --- /dev/null +++ b/Documentation/Index.rst @@ -0,0 +1,64 @@ +.. ================================================== +.. FOR YOUR INFORMATION +.. -------------------------------------------------- +.. -*- coding: utf-8 -*- with BOM. + +.. include:: Includes.txt + +.. _start: + +============================================================= +DD Events +============================================================= + +.. only:: html + + :Classification: + dd_events + + :Version: + |release| + + :Language: + en + + :Description: + Extension to manage Destination Data managed events + + :Keywords: + comma,separated,list,of,keywords + + :Copyright: + 2019 + + :Author: + Dirk Koritnik + + :Email: + koritnik@werkraum-media.de + + :License: + This document is published under the Open Content License + available from http://www.opencontent.org/opl.shtml + + :Rendered: + |today| + + The content of this document is related to TYPO3, + a GNU/GPL CMS/Framework available from `www.typo3.org `_. + + **Table of Contents** + +.. toctree:: + :maxdepth: 3 + :titlesonly: + + Introduction/Index + User/Index + Administrator/Index + Configuration/Index + Developer/Index + KnownProblems/Index + ToDoList/Index + ChangeLog/Index + Links diff --git a/Documentation/Introduction/Index.rst b/Documentation/Introduction/Index.rst new file mode 100644 index 0000000..9044832 --- /dev/null +++ b/Documentation/Introduction/Index.rst @@ -0,0 +1,46 @@ +.. ================================================== +.. FOR YOUR INFORMATION +.. -------------------------------------------------- +.. -*- coding: utf-8 -*- with BOM. + +.. include:: ../Includes.txt + + +.. _introduction: + +Introduction +============ + + +.. _what-it-does: + +What does it do? +---------------- + +This chapter should give a brief overview of the extension. What does it do? What problems does it solve? +Who is interested in this? Basically, this section includes everything people need to know to decide whether they +should go on with this extension or not. + +.. important:: + + Please don't forget to repeat your extension's version number in the + :file:`Settings.yml` file, in the :code:`release` property. It will be + automatically picked up on the cover page by the :code:`|release|` + substitution. + + +.. _screenshots: + +Screenshots +----------- + +This chapter should help people figure how the extension works. Remove it +if not relevant. + +.. figure:: ../Images/IntroductionPackage.png + :width: 500px + :alt: Introduction Package + + Introduction Package just after installation (caption of the image) + + How the Frontend of the Introduction Package looks like just after installation (legend of the image) diff --git a/Documentation/KnownProblems/Index.rst b/Documentation/KnownProblems/Index.rst new file mode 100644 index 0000000..dcb52d7 --- /dev/null +++ b/Documentation/KnownProblems/Index.rst @@ -0,0 +1,17 @@ +.. ================================================== +.. FOR YOUR INFORMATION +.. -------------------------------------------------- +.. -*- coding: utf-8 -*- with BOM. + +.. include:: ../Includes.txt + + +.. _known-problems: + +Known Problems +============== + +Say where bugs can be reported / followed up. Is it a +`bug tracker `_? +Use this section for informing about any type of of problem +that are not necessarily named in the bug tracker such as performance issues, ... diff --git a/Documentation/Links.rst b/Documentation/Links.rst new file mode 100644 index 0000000..93b13e3 --- /dev/null +++ b/Documentation/Links.rst @@ -0,0 +1,24 @@ +.. ================================================== +.. FOR YOUR INFORMATION +.. -------------------------------------------------- +.. -*- coding: utf-8 -*- with BOM. + +.. include:: Includes.txt + + +.. _links: + +Links +----- + +:TER: + https://typo3.org/extensions/repository/view/ + +:Bug Tracker: + https://forge.typo3.org/projects/extension-/issues + +:Git Repository: + https://github.com// + +:Contact: + `@ `__ diff --git a/Documentation/Localization.de_DE.tmpl/Index.rst b/Documentation/Localization.de_DE.tmpl/Index.rst new file mode 100644 index 0000000..50921e0 --- /dev/null +++ b/Documentation/Localization.de_DE.tmpl/Index.rst @@ -0,0 +1,65 @@ +.. ================================================== +.. FOR YOUR INFORMATION +.. -------------------------------------------------- +.. -*- coding: utf-8 -*- with BOM. + +.. include:: ../Includes.txt + + +.. _start: + +============================================================= +###PROJECT_NAME### (Deutsch) +============================================================= + +.. only:: html + + :Klassifikation: + extension_key + + :Version: + |release| + + :Sprache: + de + + :Beschreibung: + Geben Sie eine Beschreibung ein. + + :Schlüsselwörter: + komma-getrennte,Liste,von,Schlüsselwörtern + + :Copyright: + ###YEAR### + + :Autor: + ###AUTHOR### + + :E-Mail: + author@example.com + + :Lizenz: + Dieses Dokument wird unter der Open Publication License, siehe + http://www.opencontent.org/openpub/ veröffentlicht. + + :Gerendert: + |today| + + Der Inhalt dieses Dokuments bezieht sich auf TYPO3, + ein GNU/GPL CMS-Framework auf `www.typo3.org `__. + + + **Inhaltsverzeichnis** + +.. toctree:: + :maxdepth: 3 + :titlesonly: + +.. Introduction/Index +.. UserManual/Index +.. AdministratorManual/Index +.. Configuration/Index +.. DeveloperCorner/Index +.. KnownProblems/Index +.. ToDoList/Index +.. ChangeLog/Index diff --git a/Documentation/Localization.de_DE.tmpl/README b/Documentation/Localization.de_DE.tmpl/README new file mode 100644 index 0000000..c1517e6 --- /dev/null +++ b/Documentation/Localization.de_DE.tmpl/README @@ -0,0 +1,24 @@ +How to translate +================ + +This directory contains the German translation of your documentation. +This is a complete Sphinx project but you may reuse assets from the +main documentation under Documentation/. + +If you plan to translate your documentation to German, you should +rename this directory and remove the suffix ".tmpl": + +Localization.de_DE.tmpl -> Localization.de_DE + +As this file is not needed either, feel free to delete it as well. + + +Supported languages +=================== + +Please visit http://sphinx-doc.org/latest/config.html#intl-options for a +list of languages supported by Sphinx. + +Please note however that TYPO3 is using locales so you may need to +extend the language code from Sphinx into a proper locale to be used +by TYPO3. diff --git a/Documentation/Localization.de_DE.tmpl/Settings.yml b/Documentation/Localization.de_DE.tmpl/Settings.yml new file mode 100644 index 0000000..fefd340 --- /dev/null +++ b/Documentation/Localization.de_DE.tmpl/Settings.yml @@ -0,0 +1,29 @@ +# This is the project specific Settings.yml file. +# Place Sphinx specific build information here. +# Settings given here will replace the settings of 'conf.py'. + +# Below is an example of intersphinx mapping declaration +# Add more mappings depending on what manual you want to link to +# Remove entirely if you don't need cross-linking + +--- +conf.py: + copyright: 2012-2015 + project: Extension Name (Deutsch) + version: x.y + release: x.y.z + intersphinx_mapping: + t3tsref: + - https://docs.typo3.org/typo3cms/TyposcriptReference/ + - null + latex_documents: + - - Index + - .tex + - Extension Name (Français) + - Your Name + - manual + latex_elements: + papersize: a4paper + pointsize: 10pt + preamble: \usepackage{typo3} +... diff --git a/Documentation/Localization.fr_FR.tmpl/Index.rst b/Documentation/Localization.fr_FR.tmpl/Index.rst new file mode 100644 index 0000000..c0071e6 --- /dev/null +++ b/Documentation/Localization.fr_FR.tmpl/Index.rst @@ -0,0 +1,65 @@ +.. ================================================== +.. FOR YOUR INFORMATION +.. -------------------------------------------------- +.. -*- coding: utf-8 -*- with BOM. + +.. include:: ../Includes.txt + + +.. _start: + +============================================================= +###PROJECT_NAME### (Français) +============================================================= + +.. only:: html + + :Classification: + extension_key + + :Version: + |release| + + :Langue: + fr + + :Description: + entrez une description. + + :Mots-clés: + list,mots-clés,séparés,par,virgules + + :Copyright: + ###YEAR### + + :Auteur: + ###AUTHOR### + + :E-mail: + author@example.com + + :Licence: + Ce document est publié sous la licence de publication libre + disponible sur http://www.opencontent.org/openpub/ + + :Généré: + |today| + + Le contenu de ce document est en relation avec TYPO3, + un CMS/Framework GNU/GPL disponible sur `www.typo3.org `__. + + + **Sommaire** + +.. toctree:: + :maxdepth: 3 + :titlesonly: + +.. Introduction/Index +.. UserManual/Index +.. AdministratorManual/Index +.. Configuration/Index +.. DeveloperCorner/Index +.. KnownProblems/Index +.. ToDoList/Index +.. ChangeLog/Index diff --git a/Documentation/Localization.fr_FR.tmpl/README b/Documentation/Localization.fr_FR.tmpl/README new file mode 100644 index 0000000..8436ec0 --- /dev/null +++ b/Documentation/Localization.fr_FR.tmpl/README @@ -0,0 +1,24 @@ +How to translate +================ + +This directory contains the French translation of your documentation. +This is a complete Sphinx project but you may reuse assets from the +main documentation under Documentation/. + +If you plan to translate your documentation to French, you should +rename this directory and remove the suffix ".tmpl": + +Localization.fr_FR.tmpl -> Localization.fr_FR + +As this file is not needed either, feel free to delete it as well. + + +Supported languages +=================== + +Please visit http://sphinx-doc.org/latest/config.html#intl-options for a +list of languages supported by Sphinx. + +Please note however that TYPO3 is using locales so you may need to +extend the language code from Sphinx into a proper locale to be used +by TYPO3. diff --git a/Documentation/Localization.fr_FR.tmpl/Settings.yml b/Documentation/Localization.fr_FR.tmpl/Settings.yml new file mode 100644 index 0000000..0bf2b9d --- /dev/null +++ b/Documentation/Localization.fr_FR.tmpl/Settings.yml @@ -0,0 +1,29 @@ +# This is the project specific Settings.yml file. +# Place Sphinx specific build information here. +# Settings given here will replace the settings of 'conf.py'. + +# Below is an example of intersphinx mapping declaration +# Add more mappings depending on what manual you want to link to +# Remove entirely if you don't need cross-linking + +--- +conf.py: + copyright: 2012-2015 + project: Extension Name (Français) + version: x.y + release: x.y.z + intersphinx_mapping: + t3tsref: + - https://docs.typo3.org/typo3cms/TyposcriptReference/ + - null + latex_documents: + - - Index + - .tex + - Extension Name (Français) + - Your Name + - manual + latex_elements: + papersize: a4paper + pointsize: 10pt + preamble: \usepackage{typo3} +... diff --git a/Documentation/Settings.yml b/Documentation/Settings.yml new file mode 100644 index 0000000..5fd04df --- /dev/null +++ b/Documentation/Settings.yml @@ -0,0 +1,32 @@ +# This is the project specific Settings.yml file. +# Place Sphinx specific build information here. +# Settings given here will replace the settings of 'conf.py'. + +# Below is an example of intersphinx mapping declaration +# Add more mappings depending on what manual you want to link to +# Remove entirely if you don't need cross-linking + +--- +conf.py: + copyright: 2019 + project: DD Events + version: 1.0.0 + release: 1.0.0 + intersphinx_mapping: + t3tsref: + - http://docs.typo3.org/typo3cms/TyposcriptReference/ + - null + latex_documents: + - - Index + - dd_events.tex + - DD Events + - Dirk Koritnik + - manual + latex_elements: + papersize: a4paper + pointsize: 10pt + preamble: \usepackage + html_theme_options: + github_repository: TYPO3-Documentation/TYPO3CMS-Example-ExtensionManual + github_branch: latest +... diff --git a/Documentation/ToDoList/Index.rst b/Documentation/ToDoList/Index.rst new file mode 100644 index 0000000..5cc010c --- /dev/null +++ b/Documentation/ToDoList/Index.rst @@ -0,0 +1,16 @@ +.. ================================================== +.. FOR YOUR INFORMATION +.. -------------------------------------------------- +.. -*- coding: utf-8 -*- with BOM. + +.. include:: ../Includes.txt + + +.. _todo: + +To-Do list +========== + +Give a link pointing to a `roadmap `_. +Alternatively, you can dress up a list of things you want to add or fix in this chapter +or give a vision about where the extension is heading. diff --git a/Documentation/User/Index.rst b/Documentation/User/Index.rst new file mode 100644 index 0000000..036869b --- /dev/null +++ b/Documentation/User/Index.rst @@ -0,0 +1,67 @@ +.. ================================================== +.. FOR YOUR INFORMATION +.. -------------------------------------------------- +.. -*- coding: utf-8 -*- with BOM. + +.. include:: ../Includes.txt + + +.. _user-manual: + +Users Manual +============ + +Target group: **Editors** + +Here should be described how to use the extension from the editor perspective. + +- How does it work? + + - works well when doing this. + + - does not work so well when doing that + but we can live with it. + + - **mind indentation when nesting lists**. + +- How to install the plugin on a web page? + +- What options are available? + +Language should be non-technical, explaining, using small examples. +Don't use to many acronyms unless they have been explained. +Don't be confusing by putting information targeting administrators. + +.. tip:: + + Take a break from time to time. + +Admonitions should be used to warn the users about potential +pitfalls, attract their attention to important elements +or just add some notes for for information (further reading, +for example). + +.. important:: + + Remember to always say "please" when asking your software to + do something. + +Provide screenshots as needed for making things clear. When creating +screenshots, try using the `Introduction Package `_ +as a neutral TYPO3 CMS instance. + +.. figure:: ../Images/UserManual/BackendView.png + :width: 500px + :alt: Backend view + + Default Backend view (caption of the image) + + The Backend view of TYPO3 after the user has clicked on module "Page". (legend of the image) + + +.. _user-faq: + +FAQ +--- + +Possible subsection: FAQ diff --git a/ExtensionBuilder.json b/ExtensionBuilder.json new file mode 100644 index 0000000..173b6eb --- /dev/null +++ b/ExtensionBuilder.json @@ -0,0 +1,638 @@ +{ + "modules": [ + { + "config": { + "position": [ + 830, + 5 + ] + }, + "name": "New Model Object", + "value": { + "actionGroup": { + "_default0_list": true, + "_default1_show": true, + "_default2_new_create": false, + "_default3_edit_update": false, + "_default4_delete": false, + "customActions": [ + "teaser" + ] + }, + "name": "Event", + "objectsettings": { + "addDeletedField": true, + "addHiddenField": true, + "addStarttimeEndtimeFields": true, + "aggregateRoot": false, + "categorizable": false, + "description": "", + "mapToTable": "", + "parentClass": "", + "sorting": false, + "type": "Entity", + "uid": "109921408756" + }, + "propertyGroup": { + "properties": [ + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "title", + "propertyType": "Text", + "uid": "102409777447" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "globalId", + "propertyType": "String", + "uid": "1312474499176" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "slug", + "propertyType": "String", + "uid": "1365923328864" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "highlight", + "propertyType": "Boolean", + "uid": "702208098957" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "teaser", + "propertyType": "Text", + "uid": "1507172184308" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "details", + "propertyType": "RichText", + "uid": "314424153167" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "priceInfo", + "propertyType": "Text", + "uid": "448596702496" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "street", + "propertyType": "String", + "uid": "517245651530" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "district", + "propertyType": "String", + "uid": "701548922501" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "city", + "propertyType": "String", + "uid": "565150091343" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "zip", + "propertyType": "String", + "uid": "1052357865101" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "country", + "propertyType": "String", + "uid": "437952486493" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "web", + "propertyType": "String", + "uid": "886851132875" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "booking", + "propertyType": "String", + "uid": "1258790658884" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "ticket", + "propertyType": "String", + "uid": "832122856559" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "facebook", + "propertyType": "String", + "uid": "1386671701366" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "youtube", + "propertyType": "String", + "uid": "1246060567520" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "latitude", + "propertyType": "String", + "uid": "1312904595125" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "longitude", + "propertyType": "String", + "uid": "671898304575" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "images", + "propertyType": "Image", + "uid": "259140197650" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "categories", + "propertyType": "Integer", + "uid": "677483446855" + } + ] + }, + "relationGroup": { + "relations": [ + { + "foreignRelationClass": "", + "lazyLoading": false, + "propertyIsExcludeField": true, + "relationDescription": "", + "relationName": "dates", + "relationType": "zeroToMany", + "relationWire": "[wired]", + "renderType": "inline", + "uid": "120463841009" + }, + { + "foreignRelationClass": "", + "lazyLoading": false, + "propertyIsExcludeField": true, + "relationDescription": "", + "relationName": "organizer", + "relationType": "manyToOne", + "relationWire": "[wired]", + "renderType": "selectSingle", + "uid": "272437572533" + }, + { + "foreignRelationClass": "", + "lazyLoading": false, + "propertyIsExcludeField": true, + "relationDescription": "", + "relationName": "region", + "relationType": "manyToOne", + "relationWire": "[wired]", + "renderType": "selectSingle", + "uid": "1093126928530" + } + ] + } + } + }, + { + "config": { + "position": [ + 315, + 132 + ] + }, + "name": "New Model Object", + "value": { + "actionGroup": { + "_default0_list": false, + "_default1_show": false, + "_default2_new_create": false, + "_default3_edit_update": false, + "_default4_delete": false, + "customActions": [] + }, + "name": "Organizer", + "objectsettings": { + "addDeletedField": true, + "addHiddenField": true, + "addStarttimeEndtimeFields": true, + "aggregateRoot": false, + "categorizable": false, + "description": "", + "mapToTable": "", + "parentClass": "", + "sorting": false, + "type": "Entity", + "uid": "853312122030" + }, + "propertyGroup": { + "properties": [ + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "name", + "propertyType": "String", + "uid": "1039029201328" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "street", + "propertyType": "String", + "uid": "332930486259" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "district", + "propertyType": "String", + "uid": "1300937445752" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "city", + "propertyType": "String", + "uid": "114683887277" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "zip", + "propertyType": "String", + "uid": "390187572664" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "phone", + "propertyType": "String", + "uid": "16157077259" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "web", + "propertyType": "String", + "uid": "106668624565" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "email", + "propertyType": "String", + "uid": "837795943910" + } + ] + }, + "relationGroup": { + "relations": [] + } + } + }, + { + "config": { + "position": [ + 318, + 376 + ] + }, + "name": "New Model Object", + "value": { + "actionGroup": { + "_default0_list": true, + "_default1_show": true, + "_default2_new_create": false, + "_default3_edit_update": false, + "_default4_delete": false, + "customActions": [ + "teaser" + ] + }, + "name": "Date", + "objectsettings": { + "addDeletedField": true, + "addHiddenField": true, + "addStarttimeEndtimeFields": true, + "aggregateRoot": false, + "categorizable": false, + "description": "", + "mapToTable": "", + "parentClass": "", + "sorting": false, + "type": "Entity", + "uid": "19849981223" + }, + "propertyGroup": { + "properties": [ + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "start", + "propertyType": "NativeDateTime", + "uid": "1175274648657" + }, + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "end", + "propertyType": "NativeDateTime", + "uid": "119149519780" + } + ] + }, + "relationGroup": { + "relations": [] + } + } + }, + { + "config": { + "position": [ + 315, + 613 + ] + }, + "name": "New Model Object", + "value": { + "actionGroup": { + "_default0_list": false, + "_default1_show": false, + "_default2_new_create": false, + "_default3_edit_update": false, + "_default4_delete": false, + "customActions": [] + }, + "name": "Region", + "objectsettings": { + "addDeletedField": true, + "addHiddenField": true, + "addStarttimeEndtimeFields": true, + "aggregateRoot": false, + "categorizable": false, + "description": "", + "mapToTable": "", + "parentClass": "", + "sorting": false, + "type": "Entity", + "uid": "425722520612" + }, + "propertyGroup": { + "properties": [ + { + "allowedFileTypes": "", + "maxItems": "1", + "propertyDescription": "", + "propertyIsExcludeField": true, + "propertyIsL10nModeExclude": false, + "propertyIsRequired": false, + "propertyName": "title", + "propertyType": "String", + "uid": "1316430837945" + } + ] + }, + "relationGroup": { + "relations": [] + } + } + } + ], + "properties": { + "backendModules": [], + "description": "Extension to manage Destination Data managed events", + "emConf": { + "category": "plugin", + "custom_category": "", + "dependsOn": "typo3 => 9.5.0-9.5.99\n", + "disableLocalization": false, + "disableVersioning": false, + "skipGenerateDocumentationTemplate": false, + "sourceLanguage": "en", + "state": "alpha", + "targetVersion": "9.5.0-9.5.99", + "version": "1.0.0" + }, + "extensionKey": "dd_events", + "name": "DD Events", + "originalExtensionKey": "dd_events", + "originalVendorName": "Wrm", + "persons": [ + { + "company": "", + "email": "koritnik@werkraum-media.de", + "name": "Dirk Koritnik", + "role": "Developer" + } + ], + "plugins": [ + { + "actions": { + "controllerActionCombinations": "Event=>teaser, list, show\nDate=>teaser, list, show", + "noncacheableActions": "Event=>teaser, list, show\nDate=>teaser, list, show", + "switchableActions": "Display Events\nEvent=>teaser; Event=>list; Event=>show\nDisplay Dates\nDate=>teaser; Date=>list; Date=>show" + }, + "description": "", + "key": "ddevents", + "name": "DD Events" + } + ], + "vendorName": "Wrm" + }, + "wires": [ + { + "src": { + "moduleId": 0, + "terminal": "relationWire_0", + "uid": "120463841009" + }, + "tgt": { + "moduleId": 2, + "terminal": "SOURCES", + "uid": "19849981223" + } + }, + { + "src": { + "moduleId": 0, + "terminal": "relationWire_1", + "uid": "272437572533" + }, + "tgt": { + "moduleId": 1, + "terminal": "SOURCES", + "uid": "853312122030" + } + }, + { + "src": { + "moduleId": 0, + "terminal": "relationWire_2", + "uid": "1093126928530" + }, + "tgt": { + "moduleId": 3, + "terminal": "SOURCES", + "uid": "425722520612" + } + } + ], + "log": { + "last_modified": "2019-04-03 12:11", + "extension_builder_version": "9.10.0", + "be_user": "Dirk Koritnik (1)" + } +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..d586cb1 --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +### Destination Data Event Import Extension + +##### Start Symfony Command to import Events local + + TYPO3_CONTEXT=Development php vendor/bin/typo3 events:import + +##### Start Symfony Command to import Events on Stage + + TYPO3_CONTEXT=Production/Staging /usr/local/bin/php7.1.6-cli typo3cms/stage.thueringer-staedte.de/current/vendor/bin/typo3 events:import + + +##### Clean category relations + + TRUNCATE TABLE tx_events_domain_model_event; + TRUNCATE TABLE tx_events_domain_model_date; + TRUNCATE TABLE tx_events_domain_model_organizer; + DELETE FROM sys_category_record_mm WHERE tablenames = 'tx_events_domain_model_event'; + DELETE FROM sys_file_reference WHERE tablenames = 'tx_events_domain_model_event'; + DELETE FROM sys_file WHERE identifier LIKE '%/events/%'; + DELETE FROM sys_file_metadata alternative = 'DD Import'; \ No newline at end of file diff --git a/Resources/Private/.htaccess b/Resources/Private/.htaccess new file mode 100644 index 0000000..96d0729 --- /dev/null +++ b/Resources/Private/.htaccess @@ -0,0 +1,11 @@ +# Apache < 2.3 + + Order allow,deny + Deny from all + Satisfy All + + +# Apache >= 2.3 + + Require all denied + diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf new file mode 100644 index 0000000..c5e2892 --- /dev/null +++ b/Resources/Private/Language/locallang.xlf @@ -0,0 +1,125 @@ + + + +
+ + + Event + + + Title + + + Global Id + + + Slug + + + Highlight + + + Teaser + + + Details + + + Price Info + + + Street + + + District + + + City + + + Zip + + + Country + + + Web + + + Booking + + + Ticket + + + Facebook + + + Youtube + + + Latitude + + + Longitude + + + Images + + + Categories + + + Dates + + + Organizer + + + Region + + + Organizer + + + Name + + + Street + + + District + + + City + + + Zip + + + Phone + + + Web + + + Email + + + Date + + + Start + + + End + + + Region + + + Title + + + + \ No newline at end of file diff --git a/Resources/Private/Language/locallang_csh_tx_events_domain_model_date.xlf b/Resources/Private/Language/locallang_csh_tx_events_domain_model_date.xlf new file mode 100644 index 0000000..e117109 --- /dev/null +++ b/Resources/Private/Language/locallang_csh_tx_events_domain_model_date.xlf @@ -0,0 +1,14 @@ + + + +
+ + + start + + + end + + + + \ No newline at end of file diff --git a/Resources/Private/Language/locallang_csh_tx_events_domain_model_event.xlf b/Resources/Private/Language/locallang_csh_tx_events_domain_model_event.xlf new file mode 100644 index 0000000..8bb29ea --- /dev/null +++ b/Resources/Private/Language/locallang_csh_tx_events_domain_model_event.xlf @@ -0,0 +1,80 @@ + + + +
+ + + title + + + globalId + + + slug + + + highlight + + + teaser + + + details + + + priceInfo + + + street + + + district + + + city + + + zip + + + country + + + web + + + booking + + + ticket + + + facebook + + + youtube + + + latitude + + + longitude + + + images + + + categories + + + dates + + + organizer + + + region + + + + \ No newline at end of file diff --git a/Resources/Private/Language/locallang_csh_tx_events_domain_model_events.xlf b/Resources/Private/Language/locallang_csh_tx_events_domain_model_events.xlf new file mode 100644 index 0000000..d70e806 --- /dev/null +++ b/Resources/Private/Language/locallang_csh_tx_events_domain_model_events.xlf @@ -0,0 +1,71 @@ + + + +
+ + + globalId + + + title + + + teaser + + + details + + + priceInfo + + + street + + + district + + + city + + + zip + + + web + + + booking + + + ticket + + + facebook + + + youtube + + + latitude + + + longitude + + + images + + + slug + + + organizer + + + date + + + region + + + + \ No newline at end of file diff --git a/Resources/Private/Language/locallang_csh_tx_events_domain_model_organizer.xlf b/Resources/Private/Language/locallang_csh_tx_events_domain_model_organizer.xlf new file mode 100644 index 0000000..e2d9581 --- /dev/null +++ b/Resources/Private/Language/locallang_csh_tx_events_domain_model_organizer.xlf @@ -0,0 +1,32 @@ + + + +
+ + + name + + + street + + + district + + + city + + + zip + + + phone + + + web + + + email + + + + \ No newline at end of file diff --git a/Resources/Private/Language/locallang_csh_tx_events_domain_model_region.xlf b/Resources/Private/Language/locallang_csh_tx_events_domain_model_region.xlf new file mode 100644 index 0000000..0e2e815 --- /dev/null +++ b/Resources/Private/Language/locallang_csh_tx_events_domain_model_region.xlf @@ -0,0 +1,11 @@ + + + +
+ + + title + + + + \ No newline at end of file diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf new file mode 100644 index 0000000..9cf10c9 --- /dev/null +++ b/Resources/Private/Language/locallang_db.xlf @@ -0,0 +1,134 @@ + + + +
+ + + Event + + + Title + + + Global Id + + + Slug + + + Highlight + + + Teaser + + + Details + + + Price Info + + + Street + + + District + + + City + + + Zip + + + Country + + + Web + + + Booking + + + Ticket + + + Facebook + + + Youtube + + + Latitude + + + Longitude + + + Images + + + Categories + + + Dates + + + Organizer + + + Region + + + Organizer + + + Name + + + Street + + + District + + + City + + + Zip + + + Phone + + + Web + + + Email + + + Date + + + Start + + + End + + + Associated event + + + Region + + + Title + + + DD Events + + + + + + + \ No newline at end of file diff --git a/Resources/Private/Layouts/Default.html b/Resources/Private/Layouts/Default.html new file mode 100644 index 0000000..c6a1ca4 --- /dev/null +++ b/Resources/Private/Layouts/Default.html @@ -0,0 +1,5 @@ + +
+ +
+ \ No newline at end of file diff --git a/Resources/Private/Partials/Date/ListDefault.html b/Resources/Private/Partials/Date/ListDefault.html new file mode 100644 index 0000000..57e8b16 --- /dev/null +++ b/Resources/Private/Partials/Date/ListDefault.html @@ -0,0 +1,32 @@ + +
+ +
+ +
+
+ {date.event.region.title} | {date.start} +

{date.event.title}

+

{date.event.teaser}

+ + + Hightlight + + +
+
+
+
+
+ \ No newline at end of file diff --git a/Resources/Private/Partials/Date/ListTable.html b/Resources/Private/Partials/Date/ListTable.html new file mode 100644 index 0000000..5c1463b --- /dev/null +++ b/Resources/Private/Partials/Date/ListTable.html @@ -0,0 +1,37 @@ + + + + +
+
+ {date.start}
+ {date.start}
+ {date.start}
+ {date.event.region.title}
+
+
+

{date.event.title}

+
{date.event.teaser}
+ {date.event.details} + + + Hightlight + + +
+
+ + + + + + + + Dummy + + +
+
+
+
+ \ No newline at end of file diff --git a/Resources/Private/Partials/Events/Properties.html b/Resources/Private/Partials/Events/Properties.html new file mode 100644 index 0000000..f7bf0fd --- /dev/null +++ b/Resources/Private/Partials/Events/Properties.html @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + {events.globalId} +
+ + + {events.title} +
+ + + {events.teaser} +
+ + + {events.details} +
+ + + {events.priceInfo} +
+ + + {events.street} +
+ + + {events.district} +
+ + + {events.city} +
+ + + {events.zip} +
+ + + {events.web} +
+ + + {events.booking} +
+ + + {events.ticket} +
+ + + {events.facebook} +
+ + + {events.youtube} +
+ + + {events.latitude} +
+ + + {events.longitude} +
+ + + +
+ + + {events.slug} +
+ \ No newline at end of file diff --git a/Resources/Private/Templates/Date/List.html b/Resources/Private/Templates/Date/List.html new file mode 100644 index 0000000..d3f7e43 --- /dev/null +++ b/Resources/Private/Templates/Date/List.html @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Resources/Private/Templates/Date/Show.html b/Resources/Private/Templates/Date/Show.html new file mode 100644 index 0000000..b037174 --- /dev/null +++ b/Resources/Private/Templates/Date/Show.html @@ -0,0 +1,38 @@ + + + +
+
+ + + + + + Dummy + + +
+
+

+ {date.start} + {date.start} + {date.start} Uhr +

+

{date.event.title}

+

{date.event.teaser}

+ {date.event.details} +

{event.price_info}

+ +
+
+

Veranstaltungsort:
+ {date.event.street}
+ {date.event.zip} {date.event.city}
+

+
+
+ +
+
+
+ \ No newline at end of file diff --git a/Resources/Private/Templates/Date/Teaser.html b/Resources/Private/Templates/Date/Teaser.html new file mode 100644 index 0000000..9061dae --- /dev/null +++ b/Resources/Private/Templates/Date/Teaser.html @@ -0,0 +1,40 @@ + + + +
+ +
+ + + + +
+
+ {date.event.region.title} | {date.start} +

{date.event.title}

+

{date.event.teaser}

+ + + Hightlight + + +
+
+
+
+
+
+ \ No newline at end of file diff --git a/Resources/Private/Templates/Event/List.html b/Resources/Private/Templates/Event/List.html new file mode 100644 index 0000000..3cfb726 --- /dev/null +++ b/Resources/Private/Templates/Event/List.html @@ -0,0 +1,31 @@ + + + + +
+ +
+ +
+
+ {event.region.title} +

{event.title}

+

{event.teaser}

+
+
+
+
+
+
+ \ No newline at end of file diff --git a/Resources/Private/Templates/Event/Show.html b/Resources/Private/Templates/Event/Show.html new file mode 100644 index 0000000..4937010 --- /dev/null +++ b/Resources/Private/Templates/Event/Show.html @@ -0,0 +1,35 @@ + + + +
+
+ + + + + + + + Dummy + + +
+
+

{event.title}

+

{event.teaser}

+ {event.details} +

{event.price_info}

+ +
+
+

Veranstaltungsort:
+ {event.street}
+ {event.zip} {event.city}
+

+
+
+ +
+
+
+ \ No newline at end of file diff --git a/Resources/Private/Templates/Event/Teaser.html b/Resources/Private/Templates/Event/Teaser.html new file mode 100644 index 0000000..3840aa4 --- /dev/null +++ b/Resources/Private/Templates/Event/Teaser.html @@ -0,0 +1,31 @@ + + + + +
+ +
+ +
+
+ {event.region.title} +

{event.title}

+

{event.teaser}

+
+
+
+
+
+
+ \ No newline at end of file diff --git a/Resources/Private/Templates/ViewHelpers/Widget/Paginate/Index.html b/Resources/Private/Templates/ViewHelpers/Widget/Paginate/Index.html new file mode 100644 index 0000000..899196f --- /dev/null +++ b/Resources/Private/Templates/ViewHelpers/Widget/Paginate/Index.html @@ -0,0 +1,91 @@ + + + + + + + + + + + + + diff --git a/Resources/Public/Icons/relation.gif b/Resources/Public/Icons/relation.gif new file mode 100644 index 0000000..db61d7e Binary files /dev/null and b/Resources/Public/Icons/relation.gif differ diff --git a/Resources/Public/Icons/tx_events_domain_model_date.gif b/Resources/Public/Icons/tx_events_domain_model_date.gif new file mode 100644 index 0000000..37ba37b Binary files /dev/null and b/Resources/Public/Icons/tx_events_domain_model_date.gif differ diff --git a/Resources/Public/Icons/tx_events_domain_model_event.gif b/Resources/Public/Icons/tx_events_domain_model_event.gif new file mode 100644 index 0000000..37ba37b Binary files /dev/null and b/Resources/Public/Icons/tx_events_domain_model_event.gif differ diff --git a/Resources/Public/Icons/tx_events_domain_model_events.gif b/Resources/Public/Icons/tx_events_domain_model_events.gif new file mode 100644 index 0000000..37ba37b Binary files /dev/null and b/Resources/Public/Icons/tx_events_domain_model_events.gif differ diff --git a/Resources/Public/Icons/tx_events_domain_model_organizer.gif b/Resources/Public/Icons/tx_events_domain_model_organizer.gif new file mode 100644 index 0000000..37ba37b Binary files /dev/null and b/Resources/Public/Icons/tx_events_domain_model_organizer.gif differ diff --git a/Resources/Public/Icons/tx_events_domain_model_region.gif b/Resources/Public/Icons/tx_events_domain_model_region.gif new file mode 100644 index 0000000..37ba37b Binary files /dev/null and b/Resources/Public/Icons/tx_events_domain_model_region.gif differ diff --git a/Resources/Public/Icons/user_plugin_events.svg b/Resources/Public/Icons/user_plugin_events.svg new file mode 100644 index 0000000..17e1eb1 --- /dev/null +++ b/Resources/Public/Icons/user_plugin_events.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Tests/Unit/Controller/DateControllerTest.php b/Tests/Unit/Controller/DateControllerTest.php new file mode 100644 index 0000000..e6cfc3c --- /dev/null +++ b/Tests/Unit/Controller/DateControllerTest.php @@ -0,0 +1,67 @@ + + */ +class DateControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase +{ + /** + * @var \Wrm\Events\Controller\DateController + */ + protected $subject = null; + + protected function setUp() + { + parent::setUp(); + $this->subject = $this->getMockBuilder(\Wrm\Events\Controller\DateController::class) + ->setMethods(['redirect', 'forward', 'addFlashMessage']) + ->disableOriginalConstructor() + ->getMock(); + } + + protected function tearDown() + { + parent::tearDown(); + } + + /** + * @test + */ + public function listActionFetchesAllDatesFromRepositoryAndAssignsThemToView() + { + + $allDates = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class) + ->disableOriginalConstructor() + ->getMock(); + + $dateRepository = $this->getMockBuilder(\::class) + ->setMethods(['findAll']) + ->disableOriginalConstructor() + ->getMock(); + $dateRepository->expects(self::once())->method('findAll')->will(self::returnValue($allDates)); + $this->inject($this->subject, 'dateRepository', $dateRepository); + + $view = $this->getMockBuilder(\TYPO3\CMS\Extbase\Mvc\View\ViewInterface::class)->getMock(); + $view->expects(self::once())->method('assign')->with('dates', $allDates); + $this->inject($this->subject, 'view', $view); + + $this->subject->listAction(); + } + + /** + * @test + */ + public function showActionAssignsTheGivenDateToView() + { + $date = new \Wrm\Events\Domain\Model\Date(); + + $view = $this->getMockBuilder(\TYPO3\CMS\Extbase\Mvc\View\ViewInterface::class)->getMock(); + $this->inject($this->subject, 'view', $view); + $view->expects(self::once())->method('assign')->with('date', $date); + + $this->subject->showAction($date); + } +} diff --git a/Tests/Unit/Controller/EventControllerTest.php b/Tests/Unit/Controller/EventControllerTest.php new file mode 100644 index 0000000..e68341f --- /dev/null +++ b/Tests/Unit/Controller/EventControllerTest.php @@ -0,0 +1,67 @@ + + */ +class EventControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase +{ + /** + * @var \Wrm\Events\Controller\EventController + */ + protected $subject = null; + + protected function setUp() + { + parent::setUp(); + $this->subject = $this->getMockBuilder(\Wrm\Events\Controller\EventController::class) + ->setMethods(['redirect', 'forward', 'addFlashMessage']) + ->disableOriginalConstructor() + ->getMock(); + } + + protected function tearDown() + { + parent::tearDown(); + } + + /** + * @test + */ + public function listActionFetchesAllEventsFromRepositoryAndAssignsThemToView() + { + + $allEvents = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class) + ->disableOriginalConstructor() + ->getMock(); + + $eventRepository = $this->getMockBuilder(\::class) + ->setMethods(['findAll']) + ->disableOriginalConstructor() + ->getMock(); + $eventRepository->expects(self::once())->method('findAll')->will(self::returnValue($allEvents)); + $this->inject($this->subject, 'eventRepository', $eventRepository); + + $view = $this->getMockBuilder(\TYPO3\CMS\Extbase\Mvc\View\ViewInterface::class)->getMock(); + $view->expects(self::once())->method('assign')->with('events', $allEvents); + $this->inject($this->subject, 'view', $view); + + $this->subject->listAction(); + } + + /** + * @test + */ + public function showActionAssignsTheGivenEventToView() + { + $event = new \Wrm\Events\Domain\Model\Event(); + + $view = $this->getMockBuilder(\TYPO3\CMS\Extbase\Mvc\View\ViewInterface::class)->getMock(); + $this->inject($this->subject, 'view', $view); + $view->expects(self::once())->method('assign')->with('event', $event); + + $this->subject->showAction($event); + } +} diff --git a/Tests/Unit/Controller/EventsControllerTest.php b/Tests/Unit/Controller/EventsControllerTest.php new file mode 100644 index 0000000..ce780f6 --- /dev/null +++ b/Tests/Unit/Controller/EventsControllerTest.php @@ -0,0 +1,67 @@ + + */ +class EventsControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase +{ + /** + * @var \Wrm\Events\Controller\EventsController + */ + protected $subject = null; + + protected function setUp() + { + parent::setUp(); + $this->subject = $this->getMockBuilder(\Wrm\Events\Controller\EventsController::class) + ->setMethods(['redirect', 'forward', 'addFlashMessage']) + ->disableOriginalConstructor() + ->getMock(); + } + + protected function tearDown() + { + parent::tearDown(); + } + + /** + * @test + */ + public function listActionFetchesAllEventssFromRepositoryAndAssignsThemToView() + { + + $allEventss = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class) + ->disableOriginalConstructor() + ->getMock(); + + $eventsRepository = $this->getMockBuilder(\::class) + ->setMethods(['findAll']) + ->disableOriginalConstructor() + ->getMock(); + $eventsRepository->expects(self::once())->method('findAll')->will(self::returnValue($allEventss)); + $this->inject($this->subject, 'eventsRepository', $eventsRepository); + + $view = $this->getMockBuilder(\TYPO3\CMS\Extbase\Mvc\View\ViewInterface::class)->getMock(); + $view->expects(self::once())->method('assign')->with('eventss', $allEventss); + $this->inject($this->subject, 'view', $view); + + $this->subject->listAction(); + } + + /** + * @test + */ + public function showActionAssignsTheGivenEventsToView() + { + $events = new \Wrm\Events\Domain\Model\Events(); + + $view = $this->getMockBuilder(\TYPO3\CMS\Extbase\Mvc\View\ViewInterface::class)->getMock(); + $this->inject($this->subject, 'view', $view); + $view->expects(self::once())->method('assign')->with('events', $events); + + $this->subject->showAction($events); + } +} diff --git a/Tests/Unit/Domain/Model/DateTest.php b/Tests/Unit/Domain/Model/DateTest.php new file mode 100644 index 0000000..9c8945c --- /dev/null +++ b/Tests/Unit/Domain/Model/DateTest.php @@ -0,0 +1,78 @@ + + */ +class DateTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase +{ + /** + * @var \Wrm\Events\Domain\Model\Date + */ + protected $subject = null; + + protected function setUp() + { + parent::setUp(); + $this->subject = new \Wrm\Events\Domain\Model\Date(); + } + + protected function tearDown() + { + parent::tearDown(); + } + + /** + * @test + */ + public function getStartReturnsInitialValueForDateTime() + { + self::assertEquals( + null, + $this->subject->getStart() + ); + } + + /** + * @test + */ + public function setStartForDateTimeSetsStart() + { + $dateTimeFixture = new \DateTime(); + $this->subject->setStart($dateTimeFixture); + + self::assertAttributeEquals( + $dateTimeFixture, + 'start', + $this->subject + ); + } + + /** + * @test + */ + public function getEndReturnsInitialValueForDateTime() + { + self::assertEquals( + null, + $this->subject->getEnd() + ); + } + + /** + * @test + */ + public function setEndForDateTimeSetsEnd() + { + $dateTimeFixture = new \DateTime(); + $this->subject->setEnd($dateTimeFixture); + + self::assertAttributeEquals( + $dateTimeFixture, + 'end', + $this->subject + ); + } +} diff --git a/Tests/Unit/Domain/Model/EventTest.php b/Tests/Unit/Domain/Model/EventTest.php new file mode 100644 index 0000000..c6d8af4 --- /dev/null +++ b/Tests/Unit/Domain/Model/EventTest.php @@ -0,0 +1,667 @@ + + */ +class EventTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase +{ + /** + * @var \Wrm\Events\Domain\Model\Event + */ + protected $subject = null; + + protected function setUp() + { + parent::setUp(); + $this->subject = new \Wrm\Events\Domain\Model\Event(); + } + + protected function tearDown() + { + parent::tearDown(); + } + + /** + * @test + */ + public function getTitleReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getTitle() + ); + } + + /** + * @test + */ + public function setTitleForStringSetsTitle() + { + $this->subject->setTitle('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'title', + $this->subject + ); + } + + /** + * @test + */ + public function getGlobalIdReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getGlobalId() + ); + } + + /** + * @test + */ + public function setGlobalIdForStringSetsGlobalId() + { + $this->subject->setGlobalId('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'globalId', + $this->subject + ); + } + + /** + * @test + */ + public function getSlugReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getSlug() + ); + } + + /** + * @test + */ + public function setSlugForStringSetsSlug() + { + $this->subject->setSlug('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'slug', + $this->subject + ); + } + + /** + * @test + */ + public function getHighlightReturnsInitialValueForBool() + { + self::assertSame( + false, + $this->subject->getHighlight() + ); + } + + /** + * @test + */ + public function setHighlightForBoolSetsHighlight() + { + $this->subject->setHighlight(true); + + self::assertAttributeEquals( + true, + 'highlight', + $this->subject + ); + } + + /** + * @test + */ + public function getTeaserReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getTeaser() + ); + } + + /** + * @test + */ + public function setTeaserForStringSetsTeaser() + { + $this->subject->setTeaser('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'teaser', + $this->subject + ); + } + + /** + * @test + */ + public function getDetailsReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getDetails() + ); + } + + /** + * @test + */ + public function setDetailsForStringSetsDetails() + { + $this->subject->setDetails('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'details', + $this->subject + ); + } + + /** + * @test + */ + public function getPriceInfoReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getPriceInfo() + ); + } + + /** + * @test + */ + public function setPriceInfoForStringSetsPriceInfo() + { + $this->subject->setPriceInfo('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'priceInfo', + $this->subject + ); + } + + /** + * @test + */ + public function getStreetReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getStreet() + ); + } + + /** + * @test + */ + public function setStreetForStringSetsStreet() + { + $this->subject->setStreet('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'street', + $this->subject + ); + } + + /** + * @test + */ + public function getDistrictReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getDistrict() + ); + } + + /** + * @test + */ + public function setDistrictForStringSetsDistrict() + { + $this->subject->setDistrict('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'district', + $this->subject + ); + } + + /** + * @test + */ + public function getCityReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getCity() + ); + } + + /** + * @test + */ + public function setCityForStringSetsCity() + { + $this->subject->setCity('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'city', + $this->subject + ); + } + + /** + * @test + */ + public function getZipReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getZip() + ); + } + + /** + * @test + */ + public function setZipForStringSetsZip() + { + $this->subject->setZip('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'zip', + $this->subject + ); + } + + /** + * @test + */ + public function getCountryReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getCountry() + ); + } + + /** + * @test + */ + public function setCountryForStringSetsCountry() + { + $this->subject->setCountry('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'country', + $this->subject + ); + } + + /** + * @test + */ + public function getWebReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getWeb() + ); + } + + /** + * @test + */ + public function setWebForStringSetsWeb() + { + $this->subject->setWeb('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'web', + $this->subject + ); + } + + /** + * @test + */ + public function getBookingReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getBooking() + ); + } + + /** + * @test + */ + public function setBookingForStringSetsBooking() + { + $this->subject->setBooking('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'booking', + $this->subject + ); + } + + /** + * @test + */ + public function getTicketReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getTicket() + ); + } + + /** + * @test + */ + public function setTicketForStringSetsTicket() + { + $this->subject->setTicket('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'ticket', + $this->subject + ); + } + + /** + * @test + */ + public function getFacebookReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getFacebook() + ); + } + + /** + * @test + */ + public function setFacebookForStringSetsFacebook() + { + $this->subject->setFacebook('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'facebook', + $this->subject + ); + } + + /** + * @test + */ + public function getYoutubeReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getYoutube() + ); + } + + /** + * @test + */ + public function setYoutubeForStringSetsYoutube() + { + $this->subject->setYoutube('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'youtube', + $this->subject + ); + } + + /** + * @test + */ + public function getLatitudeReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getLatitude() + ); + } + + /** + * @test + */ + public function setLatitudeForStringSetsLatitude() + { + $this->subject->setLatitude('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'latitude', + $this->subject + ); + } + + /** + * @test + */ + public function getLongitudeReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getLongitude() + ); + } + + /** + * @test + */ + public function setLongitudeForStringSetsLongitude() + { + $this->subject->setLongitude('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'longitude', + $this->subject + ); + } + + /** + * @test + */ + public function getImagesReturnsInitialValueForFileReference() + { + self::assertEquals( + null, + $this->subject->getImages() + ); + } + + /** + * @test + */ + public function setImagesForFileReferenceSetsImages() + { + $fileReferenceFixture = new \TYPO3\CMS\Extbase\Domain\Model\FileReference(); + $this->subject->setImages($fileReferenceFixture); + + self::assertAttributeEquals( + $fileReferenceFixture, + 'images', + $this->subject + ); + } + + /** + * @test + */ + public function getCategoriesReturnsInitialValueForInt() + { + self::assertSame( + 0, + $this->subject->getCategories() + ); + } + + /** + * @test + */ + public function setCategoriesForIntSetsCategories() + { + $this->subject->setCategories(12); + + self::assertAttributeEquals( + 12, + 'categories', + $this->subject + ); + } + + /** + * @test + */ + public function getDatesReturnsInitialValueForDate() + { + $newObjectStorage = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); + self::assertEquals( + $newObjectStorage, + $this->subject->getDates() + ); + } + + /** + * @test + */ + public function setDatesForObjectStorageContainingDateSetsDates() + { + $date = new \Wrm\Events\Domain\Model\Date(); + $objectStorageHoldingExactlyOneDates = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); + $objectStorageHoldingExactlyOneDates->attach($date); + $this->subject->setDates($objectStorageHoldingExactlyOneDates); + + self::assertAttributeEquals( + $objectStorageHoldingExactlyOneDates, + 'dates', + $this->subject + ); + } + + /** + * @test + */ + public function addDateToObjectStorageHoldingDates() + { + $date = new \Wrm\Events\Domain\Model\Date(); + $datesObjectStorageMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class) + ->setMethods(['attach']) + ->disableOriginalConstructor() + ->getMock(); + + $datesObjectStorageMock->expects(self::once())->method('attach')->with(self::equalTo($date)); + $this->inject($this->subject, 'dates', $datesObjectStorageMock); + + $this->subject->addDate($date); + } + + /** + * @test + */ + public function removeDateFromObjectStorageHoldingDates() + { + $date = new \Wrm\Events\Domain\Model\Date(); + $datesObjectStorageMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class) + ->setMethods(['detach']) + ->disableOriginalConstructor() + ->getMock(); + + $datesObjectStorageMock->expects(self::once())->method('detach')->with(self::equalTo($date)); + $this->inject($this->subject, 'dates', $datesObjectStorageMock); + + $this->subject->removeDate($date); + } + + /** + * @test + */ + public function getOrganizerReturnsInitialValueForOrganizer() + { + self::assertEquals( + null, + $this->subject->getOrganizer() + ); + } + + /** + * @test + */ + public function setOrganizerForOrganizerSetsOrganizer() + { + $organizerFixture = new \Wrm\Events\Domain\Model\Organizer(); + $this->subject->setOrganizer($organizerFixture); + + self::assertAttributeEquals( + $organizerFixture, + 'organizer', + $this->subject + ); + } + + /** + * @test + */ + public function getRegionReturnsInitialValueForRegion() + { + self::assertEquals( + null, + $this->subject->getRegion() + ); + } + + /** + * @test + */ + public function setRegionForRegionSetsRegion() + { + $regionFixture = new \Wrm\Events\Domain\Model\Region(); + $this->subject->setRegion($regionFixture); + + self::assertAttributeEquals( + $regionFixture, + 'region', + $this->subject + ); + } +} diff --git a/Tests/Unit/Domain/Model/EventsTest.php b/Tests/Unit/Domain/Model/EventsTest.php new file mode 100644 index 0000000..7510f7a --- /dev/null +++ b/Tests/Unit/Domain/Model/EventsTest.php @@ -0,0 +1,617 @@ + + */ +class EventsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase +{ + /** + * @var \Wrm\Events\Domain\Model\Events + */ + protected $subject = null; + + protected function setUp() + { + parent::setUp(); + $this->subject = new \Wrm\Events\Domain\Model\Events(); + } + + protected function tearDown() + { + parent::tearDown(); + } + + /** + * @test + */ + public function getGlobalIdReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getGlobalId() + ); + } + + /** + * @test + */ + public function setGlobalIdForStringSetsGlobalId() + { + $this->subject->setGlobalId('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'globalId', + $this->subject + ); + } + + /** + * @test + */ + public function getTitleReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getTitle() + ); + } + + /** + * @test + */ + public function setTitleForStringSetsTitle() + { + $this->subject->setTitle('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'title', + $this->subject + ); + } + + /** + * @test + */ + public function getTeaserReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getTeaser() + ); + } + + /** + * @test + */ + public function setTeaserForStringSetsTeaser() + { + $this->subject->setTeaser('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'teaser', + $this->subject + ); + } + + /** + * @test + */ + public function getDetailsReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getDetails() + ); + } + + /** + * @test + */ + public function setDetailsForStringSetsDetails() + { + $this->subject->setDetails('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'details', + $this->subject + ); + } + + /** + * @test + */ + public function getPriceInfoReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getPriceInfo() + ); + } + + /** + * @test + */ + public function setPriceInfoForStringSetsPriceInfo() + { + $this->subject->setPriceInfo('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'priceInfo', + $this->subject + ); + } + + /** + * @test + */ + public function getStreetReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getStreet() + ); + } + + /** + * @test + */ + public function setStreetForStringSetsStreet() + { + $this->subject->setStreet('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'street', + $this->subject + ); + } + + /** + * @test + */ + public function getDistrictReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getDistrict() + ); + } + + /** + * @test + */ + public function setDistrictForStringSetsDistrict() + { + $this->subject->setDistrict('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'district', + $this->subject + ); + } + + /** + * @test + */ + public function getCityReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getCity() + ); + } + + /** + * @test + */ + public function setCityForStringSetsCity() + { + $this->subject->setCity('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'city', + $this->subject + ); + } + + /** + * @test + */ + public function getZipReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getZip() + ); + } + + /** + * @test + */ + public function setZipForStringSetsZip() + { + $this->subject->setZip('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'zip', + $this->subject + ); + } + + /** + * @test + */ + public function getWebReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getWeb() + ); + } + + /** + * @test + */ + public function setWebForStringSetsWeb() + { + $this->subject->setWeb('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'web', + $this->subject + ); + } + + /** + * @test + */ + public function getBookingReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getBooking() + ); + } + + /** + * @test + */ + public function setBookingForStringSetsBooking() + { + $this->subject->setBooking('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'booking', + $this->subject + ); + } + + /** + * @test + */ + public function getTicketReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getTicket() + ); + } + + /** + * @test + */ + public function setTicketForStringSetsTicket() + { + $this->subject->setTicket('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'ticket', + $this->subject + ); + } + + /** + * @test + */ + public function getFacebookReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getFacebook() + ); + } + + /** + * @test + */ + public function setFacebookForStringSetsFacebook() + { + $this->subject->setFacebook('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'facebook', + $this->subject + ); + } + + /** + * @test + */ + public function getYoutubeReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getYoutube() + ); + } + + /** + * @test + */ + public function setYoutubeForStringSetsYoutube() + { + $this->subject->setYoutube('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'youtube', + $this->subject + ); + } + + /** + * @test + */ + public function getLatitudeReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getLatitude() + ); + } + + /** + * @test + */ + public function setLatitudeForStringSetsLatitude() + { + $this->subject->setLatitude('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'latitude', + $this->subject + ); + } + + /** + * @test + */ + public function getLongitudeReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getLongitude() + ); + } + + /** + * @test + */ + public function setLongitudeForStringSetsLongitude() + { + $this->subject->setLongitude('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'longitude', + $this->subject + ); + } + + /** + * @test + */ + public function getImagesReturnsInitialValueForFileReference() + { + self::assertEquals( + null, + $this->subject->getImages() + ); + } + + /** + * @test + */ + public function setImagesForFileReferenceSetsImages() + { + $fileReferenceFixture = new \TYPO3\CMS\Extbase\Domain\Model\FileReference(); + $this->subject->setImages($fileReferenceFixture); + + self::assertAttributeEquals( + $fileReferenceFixture, + 'images', + $this->subject + ); + } + + /** + * @test + */ + public function getSlugReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getSlug() + ); + } + + /** + * @test + */ + public function setSlugForStringSetsSlug() + { + $this->subject->setSlug('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'slug', + $this->subject + ); + } + + /** + * @test + */ + public function getOrganizerReturnsInitialValueFor() + { + } + + /** + * @test + */ + public function setOrganizerForSetsOrganizer() + { + } + + /** + * @test + */ + public function getDateReturnsInitialValueFor() + { + $newObjectStorage = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); + self::assertEquals( + $newObjectStorage, + $this->subject->getDate() + ); + } + + /** + * @test + */ + public function setDateForObjectStorageContainingSetsDate() + { + $date = new (); + $objectStorageHoldingExactlyOneDate = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); + $objectStorageHoldingExactlyOneDate->attach($date); + $this->subject->setDate($objectStorageHoldingExactlyOneDate); + + self::assertAttributeEquals( + $objectStorageHoldingExactlyOneDate, + 'date', + $this->subject + ); + } + + /** + * @test + */ + public function addDateToObjectStorageHoldingDate() + { + $date = new (); + $dateObjectStorageMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class) + ->setMethods(['attach']) + ->disableOriginalConstructor() + ->getMock(); + + $dateObjectStorageMock->expects(self::once())->method('attach')->with(self::equalTo($date)); + $this->inject($this->subject, 'date', $dateObjectStorageMock); + + $this->subject->addDate($date); + } + + /** + * @test + */ + public function removeDateFromObjectStorageHoldingDate() + { + $date = new (); + $dateObjectStorageMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class) + ->setMethods(['detach']) + ->disableOriginalConstructor() + ->getMock(); + + $dateObjectStorageMock->expects(self::once())->method('detach')->with(self::equalTo($date)); + $this->inject($this->subject, 'date', $dateObjectStorageMock); + + $this->subject->removeDate($date); + } + + /** + * @test + */ + public function getRegionReturnsInitialValueFor() + { + $newObjectStorage = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); + self::assertEquals( + $newObjectStorage, + $this->subject->getRegion() + ); + } + + /** + * @test + */ + public function setRegionForObjectStorageContainingSetsRegion() + { + $region = new (); + $objectStorageHoldingExactlyOneRegion = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); + $objectStorageHoldingExactlyOneRegion->attach($region); + $this->subject->setRegion($objectStorageHoldingExactlyOneRegion); + + self::assertAttributeEquals( + $objectStorageHoldingExactlyOneRegion, + 'region', + $this->subject + ); + } + + /** + * @test + */ + public function addRegionToObjectStorageHoldingRegion() + { + $region = new (); + $regionObjectStorageMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class) + ->setMethods(['attach']) + ->disableOriginalConstructor() + ->getMock(); + + $regionObjectStorageMock->expects(self::once())->method('attach')->with(self::equalTo($region)); + $this->inject($this->subject, 'region', $regionObjectStorageMock); + + $this->subject->addRegion($region); + } + + /** + * @test + */ + public function removeRegionFromObjectStorageHoldingRegion() + { + $region = new (); + $regionObjectStorageMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class) + ->setMethods(['detach']) + ->disableOriginalConstructor() + ->getMock(); + + $regionObjectStorageMock->expects(self::once())->method('detach')->with(self::equalTo($region)); + $this->inject($this->subject, 'region', $regionObjectStorageMock); + + $this->subject->removeRegion($region); + } +} diff --git a/Tests/Unit/Domain/Model/OrganizerTest.php b/Tests/Unit/Domain/Model/OrganizerTest.php new file mode 100644 index 0000000..d4487cf --- /dev/null +++ b/Tests/Unit/Domain/Model/OrganizerTest.php @@ -0,0 +1,226 @@ + + */ +class OrganizerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase +{ + /** + * @var \Wrm\Events\Domain\Model\Organizer + */ + protected $subject = null; + + protected function setUp() + { + parent::setUp(); + $this->subject = new \Wrm\Events\Domain\Model\Organizer(); + } + + protected function tearDown() + { + parent::tearDown(); + } + + /** + * @test + */ + public function getNameReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getName() + ); + } + + /** + * @test + */ + public function setNameForStringSetsName() + { + $this->subject->setName('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'name', + $this->subject + ); + } + + /** + * @test + */ + public function getStreetReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getStreet() + ); + } + + /** + * @test + */ + public function setStreetForStringSetsStreet() + { + $this->subject->setStreet('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'street', + $this->subject + ); + } + + /** + * @test + */ + public function getDistrictReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getDistrict() + ); + } + + /** + * @test + */ + public function setDistrictForStringSetsDistrict() + { + $this->subject->setDistrict('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'district', + $this->subject + ); + } + + /** + * @test + */ + public function getCityReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getCity() + ); + } + + /** + * @test + */ + public function setCityForStringSetsCity() + { + $this->subject->setCity('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'city', + $this->subject + ); + } + + /** + * @test + */ + public function getZipReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getZip() + ); + } + + /** + * @test + */ + public function setZipForStringSetsZip() + { + $this->subject->setZip('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'zip', + $this->subject + ); + } + + /** + * @test + */ + public function getPhoneReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getPhone() + ); + } + + /** + * @test + */ + public function setPhoneForStringSetsPhone() + { + $this->subject->setPhone('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'phone', + $this->subject + ); + } + + /** + * @test + */ + public function getWebReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getWeb() + ); + } + + /** + * @test + */ + public function setWebForStringSetsWeb() + { + $this->subject->setWeb('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'web', + $this->subject + ); + } + + /** + * @test + */ + public function getEmailReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getEmail() + ); + } + + /** + * @test + */ + public function setEmailForStringSetsEmail() + { + $this->subject->setEmail('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'email', + $this->subject + ); + } +} diff --git a/Tests/Unit/Domain/Model/RegionTest.php b/Tests/Unit/Domain/Model/RegionTest.php new file mode 100644 index 0000000..6eeea3b --- /dev/null +++ b/Tests/Unit/Domain/Model/RegionTest.php @@ -0,0 +1,51 @@ + + */ +class RegionTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase +{ + /** + * @var \Wrm\Events\Domain\Model\Region + */ + protected $subject = null; + + protected function setUp() + { + parent::setUp(); + $this->subject = new \Wrm\Events\Domain\Model\Region(); + } + + protected function tearDown() + { + parent::tearDown(); + } + + /** + * @test + */ + public function getTitleReturnsInitialValueForString() + { + self::assertSame( + '', + $this->subject->getTitle() + ); + } + + /** + * @test + */ + public function setTitleForStringSetsTitle() + { + $this->subject->setTitle('Conceived at T3CON10'); + + self::assertAttributeEquals( + 'Conceived at T3CON10', + 'title', + $this->subject + ); + } +} diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..b926898 --- /dev/null +++ b/composer.json @@ -0,0 +1,29 @@ +{ + "name": "wrm/events", + "type": "typo3-cms-extension", + "description": "Extension to manage Destination Data managed events", + "authors": [ + { + "name": "Dirk Koritnik", + "role": "Developer" + } + ], + "version": "1.0.0", + "require": { + "typo3/cms-core": "^9.5" + }, + "autoload": { + "psr-4": { + "Wrm\\Events\\": "Classes" + } + }, + "autoload-dev": { + "psr-4": { + "Wrm\\Events\\Tests\\": "Tests" + } + }, + "replace": { + "events": "self.version", + "typo3-ter/events": "self.version" + } +} \ No newline at end of file diff --git a/ext_emconf.php b/ext_emconf.php new file mode 100644 index 0000000..f1e8e00 --- /dev/null +++ b/ext_emconf.php @@ -0,0 +1,31 @@ + 'Events', + 'description' => 'Extension to manage Destination Data managed events', + 'category' => 'plugin', + 'author' => 'Dirk Koritnik', + 'author_email' => 'koritnik@werkraum-media.de', + 'state' => 'alpha', + 'uploadfolder' => 1, + 'createDirs' => '', + 'clearCacheOnLoad' => 0, + 'version' => '1.0.0', + 'constraints' => [ + 'depends' => [ + 'typo3' => '9.5.0-9.5.99', + ], + 'conflicts' => [], + 'suggests' => [], + ], +]; diff --git a/ext_localconf.php b/ext_localconf.php new file mode 100644 index 0000000..b1b917a --- /dev/null +++ b/ext_localconf.php @@ -0,0 +1,49 @@ + 'teaser, list, show', + 'Date' => 'teaser, list, show' + ], + [ + 'Event' => 'teaser, list, show', + 'Date' => 'teaser, list, show' + ] + ); + + // wizards + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig( + 'mod { + wizards.newContentElement.wizardItems.plugins { + elements { + events { + iconIdentifier = events-plugin-events + title = LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:txevents_events.name + description = LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events_events.description + tt_content_defValues { + CType = list + list_type = events_pi1 + } + } + } + show = * + } + }' + ); + $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class); + + $iconRegistry->registerIcon( + 'events-plugin-events', + \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, + ['source' => 'EXT:events/Resources/Public/Icons/user_plugin_events.svg'] + ); + + } +); diff --git a/ext_tables.php b/ext_tables.php new file mode 100644 index 0000000..debb376 --- /dev/null +++ b/ext_tables.php @@ -0,0 +1,32 @@ +