Implement XML export functionality for resellers

This commit is contained in:
Björn Fromme
2018-06-26 17:12:21 +02:00
parent 467d96beef
commit 3181fc95a9
35 changed files with 1829 additions and 29 deletions
+3 -1
View File
@@ -63,7 +63,9 @@
"typo3-ter/loginlimit": "^1.0",
"doctrine/dbal": "^2.5",
"yohang/calendr": "^2.1",
"wyrihaximus/html-compress": "^1.4"
"wyrihaximus/html-compress": "^1.4",
"symfony/serializer": "3.3.*",
"symfony/property-access": "^3.4"
},
"scripts": {
"typo3-cms-scripts": [
Generated
+391 -13
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "0268a42800e1640546fc8e83592c9887",
"content-hash": "218f290216c085ca0d43c4cb1fde6c13",
"packages": [
{
"name": "cogpowered/finediff",
@@ -1266,6 +1266,55 @@
],
"time": "2013-09-13T10:26:14+00:00"
},
{
"name": "paragonie/random_compat",
"version": "v2.0.15",
"source": {
"type": "git",
"url": "https://github.com/paragonie/random_compat.git",
"reference": "10bcb46e8f3d365170f6de9d05245aa066b81f09"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/10bcb46e8f3d365170f6de9d05245aa066b81f09",
"reference": "10bcb46e8f3d365170f6de9d05245aa066b81f09",
"shasum": ""
},
"require": {
"php": ">=5.2.0"
},
"require-dev": {
"phpunit/phpunit": "4.*|5.*"
},
"suggest": {
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
},
"type": "library",
"autoload": {
"files": [
"lib/random.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "[email protected]",
"homepage": "https://paragonie.com"
}
],
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
"keywords": [
"csprng",
"polyfill",
"pseudorandom",
"random"
],
"time": "2018-06-08T15:26:40+00:00"
},
{
"name": "patchwork/jsqueeze",
"version": "v2.0.5",
@@ -1809,6 +1858,64 @@
"homepage": "https://symfony.com",
"time": "2018-05-15T21:17:45+00:00"
},
{
"name": "symfony/inflector",
"version": "v3.4.11",
"source": {
"type": "git",
"url": "https://github.com/symfony/inflector.git",
"reference": "bc27e8f793a571313132923b5ad10fdf2843e26c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/inflector/zipball/bc27e8f793a571313132923b5ad10fdf2843e26c",
"reference": "bc27e8f793a571313132923b5ad10fdf2843e26c",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8",
"symfony/polyfill-ctype": "~1.8"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.4-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Inflector\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bernhard Schussek",
"email": "[email protected]"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Inflector Component",
"homepage": "https://symfony.com",
"keywords": [
"inflection",
"pluralize",
"singularize",
"string",
"symfony",
"words"
],
"time": "2018-05-01T22:53:27+00:00"
},
{
"name": "symfony/options-resolver",
"version": "v3.4.11",
@@ -1863,6 +1970,61 @@
],
"time": "2018-01-11T07:56:07+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.8.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7cc359f1b7b80fc25ed7796be7d96adc9b354bae",
"reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.8-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
},
{
"name": "Gert de Pagter",
"email": "[email protected]"
}
],
"description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"ctype",
"polyfill",
"portable"
],
"time": "2018-04-30T19:57:29+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.8.0",
@@ -1922,6 +2084,65 @@
],
"time": "2018-04-26T10:06:28+00:00"
},
{
"name": "symfony/polyfill-php70",
"version": "v1.8.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php70.git",
"reference": "77454693d8f10dd23bb24955cffd2d82db1007a6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/77454693d8f10dd23bb24955cffd2d82db1007a6",
"reference": "77454693d8f10dd23bb24955cffd2d82db1007a6",
"shasum": ""
},
"require": {
"paragonie/random_compat": "~1.0|~2.0",
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.8-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php70\\": ""
},
"files": [
"bootstrap.php"
],
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "[email protected]"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"time": "2018-04-26T10:06:28+00:00"
},
{
"name": "symfony/process",
"version": "v3.4.11",
@@ -1971,6 +2192,152 @@
"homepage": "https://symfony.com",
"time": "2018-05-16T08:49:21+00:00"
},
{
"name": "symfony/property-access",
"version": "v3.4.11",
"source": {
"type": "git",
"url": "https://github.com/symfony/property-access.git",
"reference": "a6e8c778b220dfd5cd5f5dcb09f87ee232dd608a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/property-access/zipball/a6e8c778b220dfd5cd5f5dcb09f87ee232dd608a",
"reference": "a6e8c778b220dfd5cd5f5dcb09f87ee232dd608a",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8",
"symfony/inflector": "~3.1|~4.0",
"symfony/polyfill-php70": "~1.0"
},
"require-dev": {
"symfony/cache": "~3.1|~4.0"
},
"suggest": {
"psr/cache-implementation": "To cache access methods."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.4-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\PropertyAccess\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "[email protected]"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony PropertyAccess Component",
"homepage": "https://symfony.com",
"keywords": [
"access",
"array",
"extraction",
"index",
"injection",
"object",
"property",
"property path",
"reflection"
],
"time": "2018-01-03T07:37:34+00:00"
},
{
"name": "symfony/serializer",
"version": "v3.3.17",
"source": {
"type": "git",
"url": "https://github.com/symfony/serializer.git",
"reference": "49a429eba5a2f96c170e8b4b834ce612c257fb32"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/serializer/zipball/49a429eba5a2f96c170e8b4b834ce612c257fb32",
"reference": "49a429eba5a2f96c170e8b4b834ce612c257fb32",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8"
},
"conflict": {
"phpdocumentor/type-resolver": "<0.2.1",
"symfony/dependency-injection": "<3.2",
"symfony/property-access": ">=3.0,<3.0.4|>=2.8,<2.8.4",
"symfony/property-info": "<3.1",
"symfony/yaml": "<3.3"
},
"require-dev": {
"doctrine/annotations": "~1.0",
"doctrine/cache": "~1.0",
"phpdocumentor/reflection-docblock": "^3.0|^4.0",
"symfony/cache": "~3.1",
"symfony/config": "~2.8|~3.0",
"symfony/dependency-injection": "~3.2",
"symfony/http-foundation": "~2.8|~3.0",
"symfony/property-access": "~2.8|~3.0",
"symfony/property-info": "~3.1",
"symfony/yaml": "~3.3"
},
"suggest": {
"doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.",
"doctrine/cache": "For using the default cached annotation reader and metadata cache.",
"psr/cache-implementation": "For using the metadata cache.",
"symfony/config": "For using the XML mapping loader.",
"symfony/http-foundation": "To use the DataUriNormalizer.",
"symfony/property-access": "For using the ObjectNormalizer.",
"symfony/property-info": "To deserialize relations.",
"symfony/yaml": "For using the default YAML mapping loader."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Serializer\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "[email protected]"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Serializer Component",
"homepage": "https://symfony.com",
"time": "2018-01-17T08:02:20+00:00"
},
{
"name": "tedivm/jshrink",
"version": "v1.3.0",
@@ -2051,6 +2418,7 @@
}
],
"description": "This extension integrates the grid layout concept also to regular content elements - the grid elements.\r\nIt offers a lot of new features like advanced drag & drop or real references, that improve the usability of the page and list module to speed up the daily work with the backend.",
"homepage": "https://extensions.typo3.org/extension/gridelements/",
"time": "2017-12-23T18:15:17+00:00"
},
{
@@ -2084,6 +2452,7 @@
}
],
"description": "Compress/minify your HTML output",
"homepage": "https://extensions.typo3.org/extension/html_compress/",
"time": "2016-12-26T10:19:02+00:00"
},
{
@@ -2116,6 +2485,7 @@
}
],
"description": "Optimize uploaded/processed images with binaries of your choice",
"homepage": "https://extensions.typo3.org/extension/imageoptimizer/",
"time": "2017-03-11T11:37:47+00:00"
},
{
@@ -2148,6 +2518,7 @@
}
],
"description": "Protect backend and/or frontend login against brute-force attacks.",
"homepage": "https://extensions.typo3.org/extension/loginlimit/",
"time": "2017-09-23T10:40:00+00:00"
},
{
@@ -2184,6 +2555,7 @@
}
],
"description": "Media management system for TYPO3 CMS.",
"homepage": "https://extensions.typo3.org/extension/media/",
"time": "2017-11-02T13:08:04+00:00"
},
{
@@ -2217,6 +2589,7 @@
}
],
"description": "Search Engine Optimization (SEO), Indexed Google-Sitemap (TXT- and XML-Sitemap) for all Extensions (pibase, extbase), Metatags, Canonical-URL, Pagetitle manipulations, Crawler verification, Piwik and Google Analytics support and some more... multi-language- and multi-tree-support",
"homepage": "https://extensions.typo3.org/extension/metaseo/",
"time": "2017-06-11T18:32:55+00:00"
},
{
@@ -2256,6 +2629,7 @@
}
],
"description": "Simply manage (permanent 301) redirects in the list view. The extension supports multidomain sites, count the redirect usage and shows the last referer. UPDATE! imports the records from realurl.",
"homepage": "https://extensions.typo3.org/extension/ods_redirects/",
"time": "2017-05-22T22:07:45+00:00"
},
{
@@ -2289,6 +2663,7 @@
}
],
"description": "Provides API for Backend modules to get a proper path to the Frontend page (simulateStatic/RealURL/CoolURI-like)",
"homepage": "https://extensions.typo3.org/extension/pagepath/",
"time": "2017-02-15T15:40:25+00:00"
},
{
@@ -2325,6 +2700,7 @@
"username": "plusb"
}
],
"homepage": "https://extensions.typo3.org/extension/pb_social/",
"time": "2018-02-14T11:05:37+00:00"
},
{
@@ -2358,6 +2734,7 @@
}
],
"description": "Optimization of the final page: reformatting the (x)html output, removal of new lines, and quotes. Move development repository to https://github.com/lochmueller/sourceopt",
"homepage": "https://extensions.typo3.org/extension/sourceopt/",
"time": "2017-06-15T17:25:53+00:00"
},
{
@@ -2390,6 +2767,7 @@
}
],
"description": "Generic listing of records with versatile ways of interacting with the data, e.g. advanced filter, inline editing, mass editing, ... Veni, vidi, vici!",
"homepage": "https://extensions.typo3.org/extension/vidi/",
"time": "2017-11-02T13:05:47+00:00"
},
{
@@ -3733,16 +4111,16 @@
},
{
"name": "react/promise",
"version": "v2.6.0",
"version": "v2.7.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/promise.git",
"reference": "5e60e5596a5422287f9d2205f405bef2ae0cef4b"
"reference": "f4edc2581617431aea50430749db55cc3fc031b3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/promise/zipball/5e60e5596a5422287f9d2205f405bef2ae0cef4b",
"reference": "5e60e5596a5422287f9d2205f405bef2ae0cef4b",
"url": "https://api.github.com/repos/reactphp/promise/zipball/f4edc2581617431aea50430749db55cc3fc031b3",
"reference": "f4edc2581617431aea50430749db55cc3fc031b3",
"shasum": ""
},
"require": {
@@ -3775,26 +4153,26 @@
"promise",
"promises"
],
"time": "2018-06-11T11:05:43+00:00"
"time": "2018-06-13T15:59:06+00:00"
},
{
"name": "react/promise-timer",
"version": "v1.4.0",
"version": "v1.5.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/promise-timer.git",
"reference": "c21781145955892900efba366ec236eb66e3ee35"
"reference": "a11206938ca2394dc7bb368f5da25cd4533fa603"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/promise-timer/zipball/c21781145955892900efba366ec236eb66e3ee35",
"reference": "c21781145955892900efba366ec236eb66e3ee35",
"url": "https://api.github.com/repos/reactphp/promise-timer/zipball/a11206938ca2394dc7bb368f5da25cd4533fa603",
"reference": "a11206938ca2394dc7bb368f5da25cd4533fa603",
"shasum": ""
},
"require": {
"php": ">=5.3",
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3.5",
"react/promise": "^2.6.0 || ^1.2.1"
"react/promise": "^2.7.0 || ^1.2.1"
},
"require-dev": {
"phpunit/phpunit": "^6.4 || ^5.7 || ^4.8.35"
@@ -3819,7 +4197,7 @@
}
],
"description": "A trivial implementation of timeouts for Promises, built on top of ReactPHP.",
"homepage": "https://github.com/react/promise-timer",
"homepage": "https://github.com/reactphp/promise-timer",
"keywords": [
"async",
"event-loop",
@@ -3828,7 +4206,7 @@
"timeout",
"timer"
],
"time": "2018-06-11T14:11:05+00:00"
"time": "2018-06-13T16:45:37+00:00"
},
{
"name": "react/react",
@@ -0,0 +1,112 @@
<?php
namespace EP\EpProducts\Controller;
/***************************************************************
*
* Copyright notice
*
* (c) 2016 Björn Fromme <[email protected]>, dreipunktnull
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use EP\EpProducts\Domain\Model\Product;
use EP\EpProducts\Domain\Model\Reseller;
use EP\EpProducts\Service\ExcelService;
use EP\EpProducts\Service\ResellerService;
use Symfony\Component\Serializer\Encoder\XmlEncoder;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
use Symfony\Component\Serializer\Serializer;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
class ResellerController extends ActionController
{
/**
* @var ResellerService
*/
protected $resellerService;
/**
* @var ExcelService
*/
protected $excelService;
/**
* @param ResellerService $resellerService
* @param ExcelService $excelService
*/
public function __construct(ResellerService $resellerService, ExcelService $excelService)
{
parent::__construct();
$this->resellerService = $resellerService;
$this->excelService = $excelService;
}
/**
* @param Reseller $reseller
*/
public function listAction(Reseller $reseller)
{
$products = $reseller->getProducts();
$this->view->assign('reseller', $reseller);
$this->view->assign('products', $products);
}
/**
* @param Reseller $reseller
* @param Product $product
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
*/
public function excelAction(Reseller $reseller, Product $product)
{
if (!$reseller->getProducts()->contains($product)) {
$this->redirect('list', null, null, [ 'reseller' => $reseller ]);
}
$data = $this->resellerService->preprocessSingle($product);
var_dump($data);exit;
//TODO: Implement Excel sheet generation
}
/**
* @param Reseller $reseller
* @return mixed
*/
public function xmlAction(Reseller $reseller)
{
$products = $reseller->getProducts();
$data = $this->resellerService->preprocessAll($products);
$encoders = [new XmlEncoder('products')];
$normalizers = [new ObjectNormalizer()];
$serializer = new Serializer($normalizers, $encoders);
header('Content-type: text/xml;charset=utf-8');
echo $serializer->serialize($data, 'xml', [ 'xml_encoding' => 'utf-8', 'xml_format_output' => true ]);
exit;
}
}
@@ -140,6 +140,11 @@ class Product extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements
*/
protected $images;
/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
*/
protected $resellerImages;
/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
*/
@@ -585,6 +590,26 @@ class Product extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements
$this->images = $images;
}
/**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference $resellerImages>
*/
public function getResellerImages()
{
if (!$this->resellerImages) {
return $this->images;
}
return $this->resellerImages;
}
/**
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> $images
*/
public function setResellerImages(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $images)
{
$this->resellerImages = $images;
}
/**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
*/
@@ -0,0 +1,104 @@
<?php
namespace EP\EpProducts\Domain\Model;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
/***************************************************************
*
* Copyright notice
*
* (c) 2018 Björn Fromme <[email protected]>, dreipunktnull
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
class Reseller extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* @var string
*/
protected $name;
/**
* @var string
*/
protected $code;
/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EP\EpProducts\Domain\Model\Product>
*/
protected $products;
public function __construct()
{
$this->products = new ObjectStorage();
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return string
*/
public function getCode()
{
return $this->code;
}
/**
* @param string $code
*/
public function setCode($code)
{
$this->code = $code;
}
/**
* @return ObjectStorage
*/
public function getProducts()
{
return $this->products;
}
/**
* @param ObjectStorage $products
*/
public function setProducts($products)
{
$this->products = $products;
}
}
@@ -241,6 +241,43 @@ class ProductRepository extends AbstractRepository
return $query->execute()->fetchAll();
}
/**
* @param Product $product
* @param Hotel $hotel
*
* @return array
*/
public function getDatesForExport(Product $product, Hotel $hotel)
{
$qb = DbUtility::getDbConnection()->createQueryBuilder();
$query = $qb
->select(
'date.date_start dateStart', 'date.date_end dateEnd',
'date.min_price dateMinPrice', 'date.discount dateDiscount', 'date.bus_price busPrice',
'date.nights dateNights', 'date.bus_included dateBusIncluded', 'date.services_included dateServicesIncluded',
'date.services_general dateServicesGeneral', 'date.skipass_included dateSkipassIncluded',
'date.bus_pro_id dateBusProId', 'date.hotel_bus_pro_id hotelBusProId',
'room.uid as roomUid', 'room.bus_pro_id roomBusProId', 'room.name roomName',
'room.price roomPrice', 'date.discount roomDiscount', 'date.bus_price busPrice',
'room.services roomOptionalServices', 'room.nights roomNights', 'room.available roomAvailable'
)
->from('tx_epproducts_domain_model_date', 'date')
->innerJoin('date', 'tx_epproducts_domain_model_room', 'room', 'room.date = date.uid')
->orderBy('date.date_start', 'ASC')
->addOrderBy('date.min_price', 'ASC')
->where('date.date_start >= NOW()')
->andWhere('date.product = :product')
->andWhere('date.hotel = :hotel')
->setParameters([
'product' => $product->getUid(),
'hotel' => $hotel->getUid(),
])
;
return $query->execute()->fetchAll();
}
/**
* @param Product $product
*
@@ -0,0 +1,79 @@
<?php
namespace EP\EpProducts\Domain\Serialization;
/***************************************************************
*
* Copyright notice
*
* (c) 2018 Björn Fromme <[email protected]>, dreipunktnull
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use EP\EpProducts\Utility\SerializationUtility;
class City
{
/**
* @var string
*/
public $name;
/**
* @var string
*/
public $description;
/**
* @var string
*/
public $party;
/**
* @var string
*/
public $leisure;
/**
* @var array
*/
public $facts = [];
/**
* @param \EP\EpProducts\Domain\Model\City $entity
* @return City
*/
public static function fromEntity(\EP\EpProducts\Domain\Model\City $entity)
{
$city = new self;
$city->name = $entity->getName();
$city->description = SerializationUtility::sanitizeText($entity->getDescription());
$city->party = SerializationUtility::sanitizeText($entity->getParty());
$city->leisure = SerializationUtility::sanitizeText($entity->getLeisure());
$city->facts['fact'] = array_map(function ($fact) {
return htmlspecialchars($fact->getName());
}, $entity->getFacts()->toArray());
return $city;
}
}
@@ -0,0 +1,111 @@
<?php
namespace EP\EpProducts\Domain\Serialization;
/***************************************************************
*
* Copyright notice
*
* (c) 2018 Björn Fromme <[email protected]>, dreipunktnull
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
class Date
{
/**
* @var string
*/
public $from;
/**
* @var string
*/
public $to;
/**
* @var string
*/
public $minprice;
/**
* @var string
*/
public $nights;
/**
* @var string
*/
public $busincluded;
/**
* @var string
*/
public $skipassincluded;
/**
* @var array
*/
public $servicesincluded = [];
/**
* @var array
*/
public $services = [];
/**
* @var array
*/
public $rooms = [];
/**
* @var string
*/
public $available;
/**
* @var string
*/
public $bookingurl;
/**
* @param array $array
* @return Date
*/
public static function fromArray(array $array)
{
$date = new self;
$date->from = $array['dateStart'];
$date->to = $array['dateEnd'];
$date->minprice = $array['dateMinPrice'];
$date->nights = $array['dateNights'];
$date->skipassincluded = $array['dateSkipassIncluded'];
$date->busincluded = $array['dateBusIncluded'];
$date->servicesincluded['service'] = unserialize($array['dateServicesIncluded']);
foreach (unserialize($array['dateServicesGeneral']) as $row)
{
$date->services['service'][] = Service::fromArray($row);
}
return $date;
}
}
@@ -0,0 +1,68 @@
<?php
namespace EP\EpProducts\Domain\Serialization;
use EP\EpProducts\Utility\SerializationUtility;
/***************************************************************
*
* Copyright notice
*
* (c) 2018 Björn Fromme <[email protected]>, dreipunktnull
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
class Hotel
{
/**
* @var string
*/
public $name;
/**
* @var string
*/
public $description;
/**
* @var string
*/
public $features;
/**
* @var array
*/
public $dates = [];
/**
* @param \EP\EpProducts\Domain\Model\Hotel $entity
* @return Hotel
*/
public static function fromEntity(\EP\EpProducts\Domain\Model\Hotel $entity)
{
$hotel = new self;
$hotel->name = $entity->getName();
$hotel->description = SerializationUtility::sanitizeText($entity->getDescription());
$hotel->features = SerializationUtility::sanitizeText($entity->getFeatures());
return $hotel;
}
}
@@ -0,0 +1,111 @@
<?php
namespace EP\EpProducts\Domain\Serialization;
/***************************************************************
*
* Copyright notice
*
* (c) 2018 Björn Fromme <[email protected]>, dreipunktnull
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use EP\EpProducts\Utility\SerializationUtility;
class Product
{
/**
* @var string
*/
public $name;
/**
* @var array
*/
public $facts = [];
/**
* @var string
*/
public $skipass;
/**
* @var array
*/
public $concept = [];
/**
* @var string
*/
public $board;
/**
* @var string
*/
public $programme;
/**
* @var Region
*/
public $region;
/**
* @var City
*/
public $city;
/**
* @var array
*/
public $images = [];
/**
* @var array
*/
public $hotels = [];
/**
* @param \EP\EpProducts\Domain\Model\Product $entity
* @return Product
*/
public static function fromEntity(\EP\EpProducts\Domain\Model\Product $entity)
{
$product = new self;
$product->name = preg_replace('/[\r\n\s]+/', ' ', $entity->getName());
$product->facts['fact'] = array_map(function ($fact) {
return htmlspecialchars($fact->getName());
}, $entity->getFacts()->toArray());
$product->skipass = SerializationUtility::sanitizeText($entity->getSkiPassDescription());
$product->concept['name'] = $entity->getConcept()->getName();
$product->concept['description'] = SerializationUtility::sanitizeText($entity->getConcept()->getDescription());
$product->board = SerializationUtility::sanitizeText($entity->getBoardDescription());
$product->programme = SerializationUtility::sanitizeText($entity->getProgrammeDescription());
$product->images['image'] = SerializationUtility::preprocessImages($entity->getResellerImages());
$product->region = Region::fromEntity($entity->getRegion());
$product->city = City::fromEntity($entity->getCity());
return $product;
}
}
@@ -0,0 +1,104 @@
<?php
namespace EP\EpProducts\Domain\Serialization;
/***************************************************************
*
* Copyright notice
*
* (c) 2018 Björn Fromme <[email protected]>, dreipunktnull
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use EP\EpProducts\Utility\SerializationUtility;
class Region
{
/**
* @var string
*/
public $name;
/**
* @var string
*/
public $description;
/**
* @var string
*/
public $descriptionExtended;
/**
* @var string
*/
public $piste;
/**
* @var string
*/
public $height;
/**
* @var string
*/
public $lifts;
/**
* @var string
*/
public $skipass;
/**
* @var
*/
public $news;
/**
* @var array
*/
public $facts = [];
/**
* @param \EP\EpProducts\Domain\Model\Region $entity
* @return Region
*/
public static function fromEntity(\EP\EpProducts\Domain\Model\Region $entity)
{
$region = new self;
$region->name = $entity->getName();
$region->description = SerializationUtility::sanitizeText($entity->getSkiArea());
$region->descriptionExtended = SerializationUtility::sanitizeText($entity->getSkiAreaExtended());
$region->piste = $entity->getLength();
$region->height = $entity->getHeight();
$region->lifts = $entity->getLifts();
$region->skipass = SerializationUtility::sanitizeText($entity->getSkiPass());
$region->news = SerializationUtility::sanitizeText($entity->getNews());
$region->facts['fact'] = array_map(function ($fact) {
return htmlspecialchars($fact->getName());
}, $entity->getFacts()->toArray());
return $region;
}
}
@@ -0,0 +1,81 @@
<?php
namespace EP\EpProducts\Domain\Serialization;
/***************************************************************
*
* Copyright notice
*
* (c) 2018 Björn Fromme <[email protected]>, dreipunktnull
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
class Room
{
/**
* @var string
*/
public $name;
/**
* @var string
*/
public $price;
/**
* @var string
*/
public $busprice;
/**
* @var array
*/
public $services;
/**
* @var string
*/
public $nigthts;
/**
* @var string
*/
public $available;
/**
* @param array $array
* @return Room
*/
public static function fromArray(array $array)
{
$room = new self;
$room->name = $array['roomName'];
$room->price = $array['roomPrice'];
$room->busprice = $array['busPrice'];
foreach (unserialize($array['roomOptionalServices']) as $row)
{
$room->services['service'][] = Service::fromArray($row);
}
return $room;
}
}
@@ -0,0 +1,56 @@
<?php
namespace EP\EpProducts\Domain\Serialization;
/***************************************************************
*
* Copyright notice
*
* (c) 2018 Björn Fromme <[email protected]>, dreipunktnull
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
class Service
{
/**
* @var string
*/
public $label;
/**
* @var string
*/
public $price;
/**
* @param array $array
* @return Service
*/
public static function fromArray(array $array)
{
$service = new self;
$data = reset($array);
$service->label = $data['label'];
$service->price = $data['price'];
return $service;
}
}
@@ -0,0 +1,41 @@
<?php
namespace EP\EpProducts\Service;
/***************************************************************
*
* Copyright notice
*
* (c) 2018 Björn Fromme <[email protected]>, dreipunktnull
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\SingletonInterface;
class ExcelService implements SingletonInterface
{
public function createDocument()
{}
public function addWorksheet()
{}
public function renderDocument()
{}
}
@@ -0,0 +1,112 @@
<?php
namespace EP\EpProducts\Service;
/***************************************************************
*
* Copyright notice
*
* (c) 2018 Björn Fromme <[email protected]>, dreipunktnull
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use EP\EpProducts\Domain\Model\Hotel;
use EP\EpProducts\Domain\Model\Product;
use EP\EpProducts\Domain\Repository\ProductRepository;
use EP\EpProducts\Domain\Serialization\Date;
use EP\EpProducts\Domain\Serialization\Room;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
class ResellerService implements SingletonInterface
{
/**
* @var ProductRepository
*/
protected $productRepository;
/**
* @param ProductRepository $productRepository
*/
public function __construct(ProductRepository $productRepository)
{
$this->productRepository = $productRepository;
}
/**
* @param ObjectStorage $products
* @return array
*/
public function preprocessAll(ObjectStorage $products)
{
$data = [];
foreach ($products as $product)
{
/** @var Product $product */
$data['product'][] = $this->preprocessSingle($product);
}
return $data;
}
/**
* @param Product $product
* @return \EP\EpProducts\Domain\Serialization\Product
*/
public function preprocessSingle(Product $product)
{
$data = \EP\EpProducts\Domain\Serialization\Product::fromEntity($product);
$hotels = $product->getHotels();
foreach ($hotels as $hotel)
{
/** @var Hotel $hotel */
$hotelData = \EP\EpProducts\Domain\Serialization\Hotel::fromEntity($hotel);
$dates = $this->productRepository->getDatesForExport($product, $hotel);
$hotelData->dates['date'] = $this->preprocessDates($dates);
$data->hotels['hotel'] = $hotelData;
}
return $data;
}
/**
* @param array $dates
* @return array
*/
public function preprocessDates(array $dates)
{
$data = [];
foreach ($dates as $row)
{
if (!isset($data[$row['dateStart']])) {
$date = Date::fromArray($row);
$data[$row['dateStart']] = $date;
}
$date->rooms[] = Room::fromArray($row);
}
return array_values($data);
}
}
@@ -0,0 +1,69 @@
<?php
namespace EP\EpProducts\Utility;
/***************************************************************
*
* Copyright notice
*
* (c) 2018 Björn Fromme <[email protected]>, dreipunktnull
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Domain\Model\FileReference;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
class SerializationUtility
{
/**
* @param $text
* @return string
*/
public static function sanitizeText($text)
{
//$text = html_entity_decode($text, null, 'utf-8');
//$text = strip_tags($text);
//$text = htmlspecialchars($text);
//$text = nl2br($text);
$text = str_replace('&nbsp;', ' ', $text);
return trim($text);
}
/**
* @param ObjectStorage $images
* @return array
*/
public static function preprocessImages(ObjectStorage $images)
{
$hostname = GeneralUtility::getHostname();
$data = [];
foreach ($images as $image)
{
/** @var FileReference $image
*/
$data[] = 'https://' . $hostname . '/' . $image->getOriginalResource()->getOriginalFile()->getPublicUrl();
}
return $data;
}
}
@@ -18,7 +18,7 @@
<type>select</type>
<renderType>selectSingle</renderType>
<foreign_table>tx_epproducts_domain_model_city</foreign_table>
<foreign_table_where>ORDER BY name</foreign_table_where>
<foreign_table_where>AND tx_epproducts_domain_model_city.hidden = 0 AND tx_epproducts_domain_model_city.deleted = 0 ORDER BY tx_epproducts_domain_model_city.name</foreign_table_where>
<minitems>1</minitems>
<maxitems>1</maxitems>
</config>
@@ -18,7 +18,7 @@
<type>select</type>
<renderType>selectSingle</renderType>
<foreign_table>tx_epproducts_domain_model_concept</foreign_table>
<foreign_table_where>ORDER BY name</foreign_table_where>
<foreign_table_where>AND tx_epproducts_domain_model_concept.hidden = 0 AND tx_epproducts_domain_model_concept.deleted = 0 ORDER BY tx_epproducts_domain_model_concept.name</foreign_table_where>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">Alle</numIndex>
@@ -18,7 +18,7 @@
<type>select</type>
<renderType>selectSingle</renderType>
<foreign_table>tx_epproducts_domain_model_country</foreign_table>
<foreign_table_where>ORDER BY name</foreign_table_where>
<foreign_table_where>AND tx_epproducts_domain_model_country.hidden = 0 AND tx_epproducts_domain_model_country.deleted = 0 ORDER BY tx_epproducts_domain_model_country.name</foreign_table_where>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0"></numIndex>
@@ -18,7 +18,7 @@
<type>select</type>
<renderType>selectMultipleSideBySide</renderType>
<foreign_table>tx_epproducts_domain_model_faq</foreign_table>
<foreign_table_where>ORDER BY label</foreign_table_where>
<foreign_table_where>AND tx_epproducts_domain_model_faq.hidden = 0 AND tx_epproducts_domain_model_faq.deleted = 0 ORDER BY tx_epproducts_domain_model_faq.label</foreign_table_where>
<minitems>1</minitems>
<maxitems>50</maxitems>
<size>10</size>
@@ -18,7 +18,7 @@
<type>select</type>
<renderType>selectSingle</renderType>
<foreign_table>tx_epproducts_domain_model_hotel</foreign_table>
<foreign_table_where>ORDER BY name</foreign_table_where>
<foreign_table_where>AND tx_epproducts_domain_model_hotel.hidden = 0 AND tx_epproducts_domain_model_hotel.deleted = 0 ORDER BY tx_epproducts_domain_model_hotel.name</foreign_table_where>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">Alle</numIndex>
@@ -18,7 +18,7 @@
<type>select</type>
<renderType>selectSingle</renderType>
<foreign_table>tx_epproducts_domain_model_product</foreign_table>
<foreign_table_where>ORDER BY name</foreign_table_where>
<foreign_table_where>AND tx_epproducts_domain_model_product.hidden = 0 AND tx_epproducts_domain_model_product.deleted = 0 ORDER BY tx_epproducts_domain_model_product.name</foreign_table_where>
<minitems>1</minitems>
<maxitems>1</maxitems>
</config>
@@ -32,7 +32,7 @@
<type>select</type>
<renderType>selectSingle</renderType>
<foreign_table>tx_epproducts_domain_model_hotel</foreign_table>
<foreign_table_where>ORDER BY name</foreign_table_where>
<foreign_table_where>AND tx_epproducts_domain_model_hotel.hidden = 0 AND tx_epproducts_domain_model_hotel.deleted = 0 ORDER BY tx_epproducts_domain_model_hotel.name</foreign_table_where>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">Alle</numIndex>
@@ -51,7 +51,7 @@
<type>select</type>
<renderType>selectSingle</renderType>
<foreign_table>tx_epproducts_domain_model_product</foreign_table>
<foreign_table_where>ORDER BY name</foreign_table_where>
<foreign_table_where>AND tx_epproducts_domain_model_product.hidden = 0 AND tx_epproducts_domain_model_product.deleted = 0 ORDER BY tx_epproducts_domain_model_product.name</foreign_table_where>
<minitems>1</minitems>
<maxitems>1</maxitems>
</config>
@@ -18,7 +18,7 @@
<type>select</type>
<renderType>selectSingle</renderType>
<foreign_table>tx_epproducts_domain_model_product</foreign_table>
<foreign_table_where>ORDER BY name</foreign_table_where>
<foreign_table_where>AND tx_epproducts_domain_model_product.hidden = 0 AND tx_epproducts_domain_model_product.deleted = 0 ORDER BY tx_epproducts_domain_model_product.name</foreign_table_where>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">Alle</numIndex>
@@ -38,7 +38,7 @@
<type>select</type>
<renderType>selectSingle</renderType>
<foreign_table>tx_epproducts_domain_model_hotel</foreign_table>
<foreign_table_where>ORDER BY name</foreign_table_where>
<foreign_table_where>AND tx_epproducts_domain_model_hotel.hidden = 0 AND tx_epproducts_domain_model_hotel.deleted = 0 ORDER BY tx_epproducts_domain_model_hotel.name</foreign_table_where>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">Alle</numIndex>
@@ -18,7 +18,7 @@
<type>select</type>
<renderType>selectSingle</renderType>
<foreign_table>tx_epproducts_domain_model_product</foreign_table>
<foreign_table_where>ORDER BY name</foreign_table_where>
<foreign_table_where>AND tx_epproducts_domain_model_product.hidden = 0 AND tx_epproducts_domain_model_product.deleted = 0 ORDER BY tx_epproducts_domain_model_product.name</foreign_table_where>
<minitems>1</minitems>
<maxitems>1</maxitems>
</config>
@@ -32,7 +32,7 @@
<type>select</type>
<renderType>selectSingle</renderType>
<foreign_table>tx_epproducts_domain_model_hotel</foreign_table>
<foreign_table_where>ORDER BY name</foreign_table_where>
<foreign_table_where>AND tx_epproducts_domain_model_hotel.hidden = 0 AND tx_epproducts_domain_model_hotel.deleted = 0 ORDER BY tx_epproducts_domain_model_hotel.name</foreign_table_where>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">Alle</numIndex>
@@ -18,7 +18,7 @@
<type>select</type>
<renderType>selectSingle</renderType>
<foreign_table>tx_epproducts_domain_model_region</foreign_table>
<foreign_table_where>ORDER BY name</foreign_table_where>
<foreign_table_where>AND tx_epproducts_domain_model_region.hidden = 0 AND tx_epproducts_domain_model_region.deleted = 0 ORDER BY tx_epproducts_domain_model_region.name</foreign_table_where>
<minitems>1</minitems>
<maxitems>1</maxitems>
</config>
@@ -41,7 +41,7 @@ return [
programme_description, ski_pass_description,
--div--;Verknüpfungen, journey, --palette--;;concept, hotels, facts, faqs, officetip,
additional_regions, badge,
--div--;Bilder/Dateien, teaser_images, header_images, images, banner, video',
--div--;Bilder/Dateien, teaser_images, header_images, images, reseller_images, banner, video',
'columnsOverrides' => [
'teaser' => [
'defaultExtras' => 'richtext[]:rte_transform[mode=ts_links]',
@@ -455,6 +455,32 @@ return [
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
],
'reseller_images' => [
'exclude' => 0,
'label' => 'Bilder für Vertriebspartner',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'reseller_images',
[
'appearance' => [
'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference'
],
'foreign_types' => [
'0' => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
],
'maxitems' => 10
],
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
],
'concept' => [
'exclude' => 0,
'label' => 'LLL:EXT:ep_products/Resources/Private/Language/locallang.xlf:tx_epproducts_domain_model_product.concept',
@@ -0,0 +1,149 @@
<?php
return [
'ctrl' => [
'title' => 'LLL:EXT:ep_products/Resources/Private/Language/locallang.xlf:tx_epproducts_domain_model_reseller',
'label' => 'name',
'default_sortby' => 'ORDER BY name',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'dividers2tabs' => true,
'versioningWS' => 2,
'versioning_followPages' => true,
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'transOrigDiffSourceField' => 'l10n_diffsource',
'delete' => 'deleted',
'enablecolumns' => [
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
],
'searchFields' => 'name',
'iconfile' => 'EXT:ep_products/Resources/Public/Icons/tx_epproducts_domain_model_reseller.gif'
],
'interface' => [
'showRecordFieldList' => 'name,code,products',
],
'types' => [
'1' => ['showitem' => 'name, code, products'],
],
'palettes' => [],
'columns' => [
'sys_language_uid' => [
'exclude' => 0,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => [
['LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages', -1],
['LLL:EXT:lang/locallang_general.xlf:LGL.default_value', 0]
],
],
],
'l10n_parent' => [
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 0,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'items' => [
['', 0],
],
'foreign_table' => 'tx_epproducts_domain_model_reseller',
'foreign_table_where' => 'AND tx_epproducts_domain_model_reseller.pid=###CURRENT_PID### AND tx_epproducts_domain_model_reseller.sys_language_uid IN (-1,0)',
],
],
'l10n_diffsource' => [
'config' => [
'type' => 'passthrough',
],
],
't3ver_label' => [
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel',
'config' => [
'type' => 'input',
'size' => 30,
'max' => 255,
]
],
'hidden' => [
'exclude' => 0,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden',
'config' => [
'type' => 'check',
],
],
'starttime' => [
'exclude' => 0,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime',
'config' => [
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => [
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y'))
],
],
],
'endtime' => [
'exclude' => 0,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime',
'config' => [
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => [
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y'))
],
],
],
'name' => [
'exclude' => 0,
'label' => 'LLL:EXT:ep_products/Resources/Private/Language/locallang.xlf:tx_epproducts_domain_model_reseller.name',
'config' => [
'type' => 'input',
'size' => 30,
'eval' => 'trim,required'
],
],
'code' => [
'exclude' => 0,
'label' => 'LLL:EXT:ep_products/Resources/Private/Language/locallang.xlf:tx_epproducts_domain_model_reseller.code',
'config' => [
'type' => 'input',
'size' => 30,
'eval' => 'trim,required'
],
],
'products' => [
'exclude' => 0,
'label' => 'LLL:EXT:ep_products/Resources/Private/Language/locallang.xlf:tx_epproducts_domain_model_reseller.products',
'config' => [
'type' => 'select',
'renderType' => 'selectMultipleSideBySide',
'foreign_table' => 'tx_epproducts_domain_model_product',
'MM' => 'tx_epproducts_reseller_product_mm',
'foreign_table_where' => 'AND 1=1 ORDER BY tx_epproducts_domain_model_product.name',
'minitems' => 1,
'maxitems' => 99,
],
],
],
];
@@ -589,6 +589,18 @@
<trans-unit id="tx_epproducts_domain_model_staticsearchparams">
<source>Statisches Suchergebnis</source>
</trans-unit>
<trans-unit id="tx_epproducts_domain_model_reseller">
<source>Vertriebspartner</source>
</trans-unit>
<trans-unit id="tx_epproducts_domain_model_reseller.name">
<source>Name</source>
</trans-unit>
<trans-unit id="tx_epproducts_domain_model_reseller.code">
<source>Code</source>
</trans-unit>
<trans-unit id="tx_epproducts_domain_model_reseller.products">
<source>Produkte</source>
</trans-unit>
<trans-unit id="label.result_info">
<source>Deine Suche %s%s ergab %s Treffer</source>
Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

@@ -297,6 +297,17 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\EP\EpProducts\T
]
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'EP.' . $_EXTKEY,
'reseller',
[
'Reseller' => 'list,xml,excel',
],
[
'Reseller' => '',
]
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'EP.' . $_EXTKEY,
'ajax',
@@ -137,6 +137,12 @@ if (!defined('TYPO3_MODE')) {
'Preistabelle'
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'EP.' . $_EXTKEY,
'reseller',
'Vertriebspartner Export'
);
$extensionName = strtolower(\TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY));
$pluginSignature = str_replace('_', '', $_EXTKEY) . '_product_detail';
+56 -1
View File
@@ -33,6 +33,7 @@ CREATE TABLE tx_epproducts_domain_model_product (
teaser_images int(11) unsigned NOT NULL default '0',
header_images int(11) unsigned NOT NULL default '0',
images int(11) unsigned NOT NULL default '0',
reseller_images int(11) unsigned NOT NULL default '0',
concept int(11) unsigned DEFAULT '0' NOT NULL,
country int(11) unsigned DEFAULT '0' NOT NULL,
region int(11) unsigned DEFAULT '0' NOT NULL,
@@ -1064,6 +1065,47 @@ CREATE TABLE tx_epproducts_domain_model_staticsearchparams (
KEY path_segment (path_segment)
);
#
# Table structure for table 'tx_epproducts_domain_model_reseller'
#
CREATE TABLE tx_epproducts_domain_model_reseller (
uid int(11) NOT NULL auto_increment,
pid int(11) DEFAULT '0' NOT NULL,
name varchar(255) DEFAULT '' NOT NULL,
code varchar(255) DEFAULT '' NOT NULL,
products int(11) unsigned DEFAULT '0' NOT NULL,
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
crdate int(11) unsigned DEFAULT '0' NOT NULL,
cruser_id int(11) unsigned DEFAULT '0' NOT NULL,
deleted tinyint(4) unsigned DEFAULT '0' NOT NULL,
hidden tinyint(4) unsigned DEFAULT '0' NOT NULL,
starttime int(11) unsigned DEFAULT '0' NOT NULL,
endtime int(11) unsigned DEFAULT '0' NOT NULL,
t3ver_oid int(11) DEFAULT '0' NOT NULL,
t3ver_id int(11) DEFAULT '0' NOT NULL,
t3ver_wsid int(11) DEFAULT '0' NOT NULL,
t3ver_label varchar(255) DEFAULT '' NOT NULL,
t3ver_state tinyint(4) DEFAULT '0' NOT NULL,
t3ver_stage int(11) DEFAULT '0' NOT NULL,
t3ver_count int(11) DEFAULT '0' NOT NULL,
t3ver_tstamp int(11) DEFAULT '0' NOT NULL,
t3ver_move_id int(11) DEFAULT '0' NOT NULL,
sys_language_uid int(11) DEFAULT '0' NOT NULL,
l10n_parent int(11) DEFAULT '0' NOT NULL,
l10n_diffsource mediumblob,
PRIMARY KEY (uid),
KEY parent (pid),
KEY t3ver_oid (t3ver_oid,t3ver_wsid),
KEY language (l10n_parent,sys_language_uid)
);
#
# Table structure for table 'tx_epproducts_product_hotel_mm'
#
@@ -1181,6 +1223,19 @@ CREATE TABLE tx_epproducts_city_fact_mm (
KEY uid_foreign (uid_foreign)
);
#
# Table structure for table 'tx_epproducts_reseller_product_mm'
#
CREATE TABLE tx_epproducts_reseller_product_mm (
uid_local int(11) unsigned DEFAULT '0' NOT NULL,
uid_foreign int(11) unsigned DEFAULT '0' NOT NULL,
sorting int(11) unsigned DEFAULT '0' NOT NULL,
sorting_foreign int(11) unsigned DEFAULT '0' NOT NULL,
KEY uid_local (uid_local),
KEY uid_foreign (uid_foreign)
);
#
# Table structure for table 'tx_epproducts_log'
#
@@ -1193,4 +1248,4 @@ CREATE TABLE tx_epproducts_log (
data text,
KEY request (request_id)
);
);
@@ -0,0 +1,24 @@
<html data-namespace-typo3-fluid="true" lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
<f:layout name="Default"/>
<f:section name="Main">
<div class="container">
<div class="row">
<div class="col-xs-12">
<h2>Gesamtexport XML</h2>
<f:link.action action="xml" arguments="{reseller: reseller}" target="_blank">Export XML</f:link.action>
<h2>Einzelexport Excel</h2>
<ul>
<f:for each="{products}" as="product">
<li><f:link.action action="excel" arguments="{product: product, reseller: reseller}">Export XLS: {product.name}</f:link.action></li>
</f:for>
</ul>
</div>
</div>
</div>
</f:section>
</html>
+27
View File
@@ -125,6 +125,32 @@ $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = [
],
],
],
'reseller' => [
[
'GETvar' => 'tx_epproducts_reseller[controller]',
'noMatch' => 'bypass',
],
[
'GETvar' => 'tx_epproducts_reseller[reseller]',
'lookUpTable' => [
'table' => 'tx_epproducts_domain_model_reseller',
'id_field' => 'uid',
'alias_field' => 'code',
'addWhereClause' => ' AND NOT deleted',
'useUniqueCache' => 1,
'useUniqueCache_conf' => [
'strtolower' => 1,
'spaceCharacter' => '-'
]
],
],
[
'GETvar' => 'tx_epproducts_reseller[action]',
],
[
'GETvar' => 'tx_epproducts_reseller[product]',
],
],
41 => 'searchresult',
855 => 'ajax',
878 => 'ajax',
@@ -135,6 +161,7 @@ $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = [
1446 => 'team',
987 => 'events_contactform',
1300 => 'events_activity',
1448 => 'reseller',
'newsDetailConfiguration' => [
[
'GETvar' => 'tx_news_pi1[news]',