From e044a424fa72a383301d1dd52c0e9fc94434c6dc Mon Sep 17 00:00:00 2001 From: Thomas Peterson Date: Sat, 13 Dec 2025 18:02:25 +0100 Subject: [PATCH] Fixes --- .../BasketBundle/Api/Basket/Legacy/Add.php | 45 +- .../Shop/BasketBundle/Api/Layouter/Save.php | 0 .../Controller/Backend/XmlController.php | 67 - .../Controller/DesignerController.php | 99 +- .../Controller/ImageController.php | 73 - .../Controller/PdfController.php | 118 -- .../Controller/PreviewController.php | 144 -- .../Controller/StoreController.php | 67 - .../Controller/UploadController.php | 102 -- .../PSC/LaufkartenLayouter/Document/Image.php | 197 --- .../Document/Repository/ImageRepository.php | 19 - .../Form/Field/BackendFields.php | 81 - .../Form/Field/EnableEditor.php | 143 -- .../LaufkartenLayouter/Form/FormDesigner.php | 67 - .../Form/Group/FormLayouter.php | 31 - .../Form/Group/FormLayouterEditor.php | 31 - .../Form/ProductSettings.php | 60 + .../LaufkartenLayouter/Form/XML/EditType.php | 54 - .../PSC/LaufkartenLayouter/Model/Config.php | 75 - .../LaufkartenLayouter/Model/Config/Pdf.php | 71 - .../Model/Pdf/Elements/Base.php | 214 --- .../Model/Pdf/Elements/Image.php | 132 -- .../Model/Pdf/Elements/Media.php | 109 -- .../Model/Pdf/Elements/Pdf.php | 118 -- .../Model/Pdf/Elements/Text.php | 304 ---- .../Model/Pdf/Elements/TextFlow.php | 65 - .../PSC/LaufkartenLayouter/Model/Pdf/Site.php | 180 --- .../LaufkartenLayouter/Model/Steps/Column.php | 42 - .../Model/Steps/Options/Base.php | 114 -- .../Model/Steps/Options/Image.php | 73 - .../Model/Steps/Options/Preview.php | 35 - .../Model/Steps/Options/Select/Media.php | 73 - .../Model/Steps/Options/Select/Simple.php | 54 - .../Model/Steps/Options/Text.php | 49 - .../Model/Steps/Options/Textarea.php | 54 - .../LaufkartenLayouter/Model/Steps/Step.php | 169 --- .../Parser/Config/Config.php | 49 - .../Parser/Form/Options/Base.php | 40 - .../Parser/Form/Options/Image.php | 35 - .../Parser/Form/Options/Preview.php | 32 - .../Parser/Form/Options/Select/Media.php | 35 - .../Parser/Form/Options/Select/Simple.php | 35 - .../Parser/Form/Options/Text.php | 33 - .../Parser/Form/Options/Textarea.php | 32 - .../LaufkartenLayouter/Parser/Form/Step.php | 71 - .../PSC/LaufkartenLayouter/Parser/Parser.php | 100 -- .../Parser/Pdf/Elements/Base.php | 46 - .../Parser/Pdf/Elements/Image.php | 37 - .../Parser/Pdf/Elements/Media.php | 37 - .../Parser/Pdf/Elements/Pdf.php | 35 - .../Parser/Pdf/Elements/Text.php | 67 - .../Parser/Pdf/Elements/TextFlow.php | 71 - .../LaufkartenLayouter/Parser/Pdf/Site.php | 78 - .../PSC/LaufkartenLayouter/Renderer/Pdf.php | 239 --- .../Resources/config/routing.yml | 7 +- .../Resources/config/services.yml | 20 - .../views/backend/xml/edit.html.twig | 60 - .../Resources/views/designer/start.html.twig | 1190 +++++++++------ .../views/form/field/backend.html.twig | 30 - .../views/form/field/enable_editor.html.twig | 16 - .../views/form/product_settings.html.twig | 17 + .../LaufkartenLayouter/Service/Layouter.php | 70 - .../Session/FormLayouter.php | 119 -- .../PSC/Printess/Form/BackendFields.php | 191 --- .../articletemplates/scripts/6.phtml | 1334 ++++++++++++----- 65 files changed, 1799 insertions(+), 5656 deletions(-) create mode 100644 src/new/src/PSC/Shop/BasketBundle/Api/Layouter/Save.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/Backend/XmlController.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/ImageController.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/PdfController.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/PreviewController.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/StoreController.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/UploadController.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Document/Image.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Document/Repository/ImageRepository.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Field/BackendFields.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Field/EnableEditor.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/FormDesigner.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Group/FormLayouter.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Group/FormLayouterEditor.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/ProductSettings.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/XML/EditType.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Config.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Config/Pdf.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Base.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Image.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Media.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Pdf.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Text.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/TextFlow.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Site.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Column.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Base.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Image.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Preview.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Select/Media.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Select/Simple.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Text.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Textarea.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Step.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Config/Config.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Base.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Image.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Preview.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Select/Media.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Select/Simple.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Text.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Textarea.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Step.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Parser.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Base.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Image.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Media.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Pdf.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Text.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/TextFlow.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Site.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Renderer/Pdf.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/backend/xml/edit.html.twig delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/form/field/backend.html.twig delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/form/field/enable_editor.html.twig create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/form/product_settings.html.twig delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Service/Layouter.php delete mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Session/FormLayouter.php delete mode 100755 src/new/var/plugins/Custom/PSC/Printess/Form/BackendFields.php diff --git a/src/new/src/PSC/Shop/BasketBundle/Api/Basket/Legacy/Add.php b/src/new/src/PSC/Shop/BasketBundle/Api/Basket/Legacy/Add.php index 19c9ac232..a947e3f3b 100755 --- a/src/new/src/PSC/Shop/BasketBundle/Api/Basket/Legacy/Add.php +++ b/src/new/src/PSC/Shop/BasketBundle/Api/Basket/Legacy/Add.php @@ -6,6 +6,7 @@ use Doctrine\ORM\EntityManagerInterface; use Nelmio\ApiDocBundle\Annotation\Model; use Nelmio\ApiDocBundle\Annotation\Security; use OpenApi\Annotations as OA; +use OpenApi\Attributes\Tag; use PSC\Component\ApiBundle\Dto\Error\NotFound; use PSC\Shop\BasketBundle\Dto\Legacy\Input; use PSC\Shop\BasketBundle\Dto\Legacy\Output; @@ -14,19 +15,21 @@ use PSC\Shop\EntityBundle\Entity\Product; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\KernelInterface; -use Symfony\Component\Routing\Annotation\Route; -use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; -use Symfony\Component\Yaml\Yaml; -use Symfony\Component\Security\Http\Attribute\IsGranted; use Symfony\Component\HttpKernel\Attribute\MapRequestPayload; +use Symfony\Component\HttpKernel\KernelInterface; +use Symfony\Component\Routing\Attribute\Route; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; +use Symfony\Component\Security\Http\Attribute\IsGranted; +use Symfony\Component\Yaml\Yaml; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; class Add extends AbstractController { - public function __construct(private readonly EntityManagerInterface $entityManager, private readonly EventDispatcherInterface $eventDispatcher, private readonly TokenStorageInterface $tokenStorage) - { - } + public function __construct( + private readonly EntityManagerInterface $entityManager, + private readonly EventDispatcherInterface $eventDispatcher, + private readonly TokenStorageInterface $tokenStorage, + ) {} /** * change temp basketitem @@ -44,8 +47,9 @@ class Add extends AbstractController * ) * @OA\Tag(name="Basket") */ + #[Tag('Basket')] #[Route(path: '/legacy/add', methods: ['POST'])] - public function add(#[MapRequestPayload] Input $data): JsonResponse + public function add(#[MapRequestPayload] Input $data): JsonResponse { include_once __DIR__ . '/../../../../EntityBundle/Lagacy/TP_Basket_Item.php'; include_once __DIR__ . '/../../../../EntityBundle/Lagacy/TP_Basket_Collection.php'; @@ -59,26 +63,25 @@ class Add extends AbstractController $this->eventDispatcher->dispatch($event, PSCAdd::NAME); } - $articles = $_SESSION['Basket']['Articles']; /** * @var \TP_Basket_Item $basketItem - */ - $basketItem = clone($_SESSION['Basket']['TempProduct'][$data->productUUId]); - $basketItem->setDeliveryDate((string)$data->deliveryDate); - $basketItem->setDeliveryInfo((string)$data->deliveryInfo); - if ((string)$data->ref != "") { + */ + $basketItem = clone $_SESSION['Basket']['TempProduct'][$data->productUUId]; + $basketItem->setDeliveryDate((string) $data->deliveryDate); + $basketItem->setDeliveryInfo((string) $data->deliveryInfo); + if (((string) $data->ref) != '') { $basketItem->setRef($data->ref); } - if ((string)$data->basketField1 != "") { + if (((string) $data->basketField1) != '') { $basketItem->setRef($data->basketField1); } - if ((string)$data->basketField2 != "") { + if (((string) $data->basketField2) != '') { $basketItem->setKst($data->basketField2); } - $basketItem->setXmlProduct((string)$data->xmlProduct); - if ((string)$data->layouterUuid != "") { - $basketItem->setLayouterId((string)$data->layouterUuid); + $basketItem->setXmlProduct((string) $data->xmlProduct); + if (((string) $data->layouterUuid) != '') { + $basketItem->setLayouterId((string) $data->layouterUuid); } $itemId = $articles->addItem($basketItem); if ($data->clearTempItem) { @@ -91,6 +94,6 @@ class Add extends AbstractController return $this->json(new Output()); } - return $this->json(new NotFound("order not found")); + return $this->json(new NotFound('order not found')); } } diff --git a/src/new/src/PSC/Shop/BasketBundle/Api/Layouter/Save.php b/src/new/src/PSC/Shop/BasketBundle/Api/Layouter/Save.php new file mode 100644 index 000000000..e69de29bb diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/Backend/XmlController.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/Backend/XmlController.php deleted file mode 100644 index 990ec8d41..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/Backend/XmlController.php +++ /dev/null @@ -1,67 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Controller\Backend; - -use Doctrine\ODM\MongoDB\DocumentManager; -use Doctrine\ORM\EntityManagerInterface; -use Plugin\Custom\PSC\LaufkartenLayouter\Form\XML\EditType; -use PSC\Shop\EntityBundle\Document\Shop; -use PSC\Shop\EntityBundle\Entity\Account; -use PSC\Shop\EntityBundle\Entity\Product; -use PSC\Shop\EntityBundle\Entity\Stockbooking; -use PSC\Shop\ProductBundle\Form\Backend\ProductType; -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\HttpFoundation\File\UploadedFile; -use Symfony\Component\HttpFoundation\JsonResponse; -use Symfony\Component\Security\Core\SecurityContext; -use Symfony\Component\Routing\Annotation\Route; -use Symfony\Bridge\Twig\Attribute\Template; -use Symfony\Component\Security\Http\Attribute\IsGranted; -use Symfony\Component\HttpFoundation\Request; - -class XmlController extends AbstractController -{ - - #[Template()] - #[Route(path: '/xml/edit/{uuid}', name: 'psc_plugin_laufkartenlayouter_backend_xml_edit')] - public function editAction(Request $request, \PSC\System\SettingsBundle\Service\Shop $shopService, DocumentManager $documentManager, EntityManagerInterface $entityManager, $uuid) - { - $selectedShop = $shopService->getSelectedShop(); - - /** @var Product $product */ - $product = $entityManager - ->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findOneBy(array('uuid' => $uuid, 'shop' => $selectedShop)); - - /** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */ - $productDoc = $documentManager - ->getRepository('PSC\Shop\EntityBundle\Document\Product') - ->findOneBy(array('uid' => (string)$product->getUid())); - - $data = ['uuid' => $product->getUUid(), 'xml' => $productDoc->getPluginSettingModule('laufkartenlayouter', 'xml')]; - - $form = $this->createForm(EditType::class, $data); - - $form->handleRequest($request); - - if ($form->isSubmitted() && $form->isValid()) { - $data = $form->getData(); - dump($data); - $productDoc->setPluginSettingModule('laufkartenlayouter', 'xml', $data['xml']); - $documentManager->persist($productDoc); - $documentManager->flush(); - } - return array( - 'form' => $form->createView(), - 'product' => $product - ); - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/DesignerController.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/DesignerController.php index 0ec0ff059..212d739a6 100644 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/DesignerController.php +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/DesignerController.php @@ -4,50 +4,21 @@ namespace Plugin\Custom\PSC\LaufkartenLayouter\Controller; use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ORM\EntityManagerInterface; -use Plugin\Custom\PSC\LaufkartenLayouter\Form\FormDesigner; -use Plugin\Custom\PSC\LaufkartenLayouter\Service\Layouter; -use Plugin\Custom\PSC\LaufkartenLayouter\Session\LaufkartenLayouter; -use PSC\Shop\EntityBundle\Entity\Layoutdesigndata; use PSC\Shop\EntityBundle\Entity\Product; +use Symfony\Bridge\Twig\Attribute\Template; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Routing\Annotation\Route; -use Twig\Environment; -use Twig\Loader\FilesystemLoader; +use Symfony\Component\Routing\Attribute\Route; #[Route('/designer')] class DesignerController extends AbstractController { - #[Route('/load/{productId}/{layouterId}', name: 'psc_plugin_laufkartenlayouter_load')] - public function loadAction(Request $request, EntityManagerInterface $entityManager, $productId, $layouterId = '') - { - $session = new LaufkartenLayouter(); - if ($request->getSession()->has('laufkartenlayouter')) { - $session = $request->getSession()->get('laufkartenlayouter'); - } - - if ($layouterId != '') { - /** @var Layoutdesigndata $layoutDesignData */ - $layoutDesignData = $entityManager - ->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata') - ->findOneBy(['uuid' => $layouterId]); - - $session->setOptions($productId, $layoutDesignData->getDesign()); - } - - return $this->redirectToRoute('psc_plugin_laufkartenlayouter_start', [ - 'productId' => $productId, - 'layouterId' => $layouterId, - ]); - } - + #[Template('@PluginCustomPSCLaufkartenLayouter/designer/start.html.twig')] #[Route('/start/{productId}/{layouterId}', name: 'psc_plugin_laufkartenlayouter_start')] public function startAction( Request $request, EntityManagerInterface $entityManager, DocumentManager $documentManager, - Layouter $formLayouter, $productId, $layouterId = '', ) { @@ -65,68 +36,6 @@ class DesignerController extends AbstractController ->getRepository('PSC\Shop\EntityBundle\Document\Product') ->findOneBy(['uid' => (string) $product->getUid()]); - $session = new LaufkartenLayouter(); - if ($request->getSession()->has('laufkartenlayouter')) { - $session = $request->getSession()->get('laufkartenlayouter'); - } - - $formLayouter->setXml($productDoc->getPluginSetting('laufkartenlayouter', 'xml')); - - if ($request->get('prev', false) !== false) { - $actStep = $formLayouter->getStep($request->get('actStep', 1) - 1); - } elseif ($request->get('next', false) !== false) { - $actStep = $formLayouter->getStep($request->get('actStep', 1) + 1); - } else { - $actStep = $formLayouter->getStep($request->get('actStep', 1)); - } - $config = $formLayouter->getConfig(); - - $data = []; - - $form = $this->createForm(FormDesigner::class, $data, [ - 'step' => $actStep, - 'session' => $session, - 'productId' => $productId, - ]); - - $request->getSession()->set('laufkartenlayouter', $session); - - $loader = new FilesystemLoader('/data/www/old/application/design/vorlagen/' . - $shop->getLayout() . - '/laufkarten_layouter/'); - $twig = new Environment($loader); - //\var_dump($twig); - - $header = $twig->render('header.html.twig'); - $footer = $twig->render('footer.html.twig'); - return [ - 'step' => $actStep, - 'form' => $form->createView(), - 'product' => $product, - 'firstStart' => $layouterId != '' ? 1 : 0, - 'layouterId' => $layouterId, - 'config' => $config, - 'layout' => $shop->getLayout(), - 'header' => $header, - 'footer' => $footer, - ]; - } - - #[Route('/update/{productId}', name: 'psc_plugin_laufkartenlayouter_update')] - public function updateAction(Request $request, $productId) - { - $data = json_decode($request->getContent(), true); - - $session = new LaufkartenLayouter(); - if ($request->getSession()->has('laufkartenlayouter')) { - $session = $request->getSession()->get('laufkartenlayouter'); - } - - $session->setOptions($productId, array_merge($session->getOptions($productId), $data)); - - $request->getSession()->set('laufkartenlayouter', $session); - - return new JsonResponse(['success' => true]); + return []; } } - diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/ImageController.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/ImageController.php deleted file mode 100644 index f5bbf8566..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/ImageController.php +++ /dev/null @@ -1,73 +0,0 @@ -getRepository('Plugin\Custom\PSC\LaufkartenLayouter\Document\Image') - ->findOneBy(['_id' => new ObjectId($id)]); - - return new JsonResponse([ - 'title' => $image, - 'rotate' => $image->getRotate(), - 'cropBox' => [ - 'width' => $image->getCropWidth(), - 'height' => $image->getCropHeight(), - 'x' => $image->getCropX(), - 'y' => $image->getCropY() - ] - ]); - } - - #[Route('/original/{id}/{width}/{height}', name: 'psc_plugin_laufkartenlayouter_image_original')] - public function imageAction(Request $request, DocumentManager $documentManager, $id, $width = 400, $height = 400) - { - - $width = round($width); - $height = round($height); - - /** @var \Plugin\Custom\PSC\LaufkartenLayouter\Document\Image $image */ - $image = $documentManager - ->getRepository('Plugin\Custom\PSC\LaufkartenLayouter\Document\Image') - ->findOneBy(['_id' => new ObjectId($id)]); - - $outfilename = "temp/".md5($id); - - $im = new \imagick("/data/www/new/web/market/motive/" . $image->getFileName()); - if($im->getImageWidth() < $width) { - $width = $im->getImageWidth(); - } - $im->setResolution(300,300); - $im->thumbnailimage($width, $height, true); - $im->writeimage($outfilename.".png"); - - $response = new Response(); - - $response->headers->set('Cache-Control', 'private'); - $response->headers->set('Content-type', mime_content_type($outfilename.".png")); - $response->headers->set('Content-Disposition', 'attachment; filename="' . basename($outfilename.".png") . '"'); - - $response->sendHeaders(); - - $response->setContent(readfile($outfilename.".png")); - - unlink($outfilename); - - return $response; - - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/PdfController.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/PdfController.php deleted file mode 100644 index 941796d1b..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/PdfController.php +++ /dev/null @@ -1,118 +0,0 @@ -getRepository('PSC\Shop\EntityBundle\Entity\Product') - ->findOneBy(array('uuid' => $productId)); - - /** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */ - $productDoc = $documentManager - ->getRepository('PSC\Shop\EntityBundle\Document\Product') - ->findOneBy(array('uid' => (string)$product->getUid())); - - $session = new LaufkartenLayouter(); - if($request->getSession()->has('laufkartenlayouter')) { - $session = $request->getSession()->get('laufkartenlayouter'); - } - - $formLayouter->setXml($productDoc->getPluginSetting('laufkartenlayouter', 'xml')); - - $config = $formLayouter->getConfig(); - - $outfilename = "temp/".uniqid().".pdf"; - - $session = new LaufkartenLayouter(); - if($request->getSession()->has('laufkartenlayouter')) { - $session = $request->getSession()->get('laufkartenlayouter'); - } - - $renderer->setConfig($config); - $renderer->setOptions($session->getOptions($productId)); - $renderer->renderPreviewPdf($formLayouter->getSites(), $outfilename); - - $response = new Response(); - - $response->headers->set('Cache-Control', 'private'); - $response->headers->set('Content-type', mime_content_type($outfilename)); - $response->headers->set('Content-Disposition', 'attachment; filename="' . basename($outfilename) . '"'); - $response->headers->set('Content-length', filesize($outfilename)); - - $response->sendHeaders(); - - $response->setContent(readfile($outfilename)); - - unlink($outfilename); - - return $response; - - } - - #[Route('/pdf/print/{productId}', name: 'psc_plugin_laufkartenlayouter_pdf_print')] - public function printAction(Request $request, EntityManagerInterface $entityManager, DocumentManager $documentManager, Layouter $formLayouter, Pdf $renderer, $productId) - { - - /** @var Product $product */ - $product = $entityManager - ->getRepository('PSC\Shop\EntityBundle\Entity\Product') - ->findOneBy(array('uuid' => $productId)); - - /** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */ - $productDoc = $documentManager - ->getRepository('PSC\Shop\EntityBundle\Document\Product') - ->findOneBy(array('uid' => (string)$product->getUid())); - - $session = new LaufkartenLayouter(); - if($request->getSession()->has('laufkartenlayouter')) { - $session = $request->getSession()->get('laufkartenlayouter'); - } - - $formLayouter->setXml($productDoc->getPluginSetting('laufkartenlayouter', 'xml')); - - $config = $formLayouter->getConfig(); - - $outfilename = "temp/".uniqid().".pdf"; - - $session = new LaufkartenLayouter(); - if($request->getSession()->has('laufkartenlayouter')) { - $session = $request->getSession()->get('laufkartenlayouter'); - } - - $renderer->setConfig($config); - $renderer->setOptions($session->getOptions($productId)); - $renderer->renderPrintPdf($formLayouter->getSites(), $outfilename); - - $response = new Response(); - - $response->headers->set('Cache-Control', 'private'); - $response->headers->set('Content-type', mime_content_type($outfilename)); - $response->headers->set('Content-Disposition', 'attachment; filename="' . basename($outfilename) . '"'); - - $response->sendHeaders(); - - $response->setContent(readfile($outfilename)); - - unlink($outfilename); - - return $response; - - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/PreviewController.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/PreviewController.php deleted file mode 100644 index 64954a03e..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/PreviewController.php +++ /dev/null @@ -1,144 +0,0 @@ -getRepository('PSC\Shop\EntityBundle\Entity\Product') - ->findOneBy(array('uuid' => $productId)); - - /** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */ - $productDoc = $documentManager - ->getRepository('PSC\Shop\EntityBundle\Document\Product') - ->findOneBy(array('uid' => (string)$product->getUid())); - - $session = new LaufkartenLayouter(); - if($request->getSession()->has('laufkartenlayouter')) { - $session = $request->getSession()->get('laufkartenlayouter'); - } - - $formLayouter->setXml($productDoc->getPluginSetting('laufkartenlayouter', 'xml')); - - $actSite = $formLayouter->getSite($site); - $config = $formLayouter->getConfig(); - - $outfilename = "temp/".uniqid().".pdf"; - - $session = new LaufkartenLayouter(); - if($request->getSession()->has('laufkartenlayouter')) { - $session = $request->getSession()->get('laufkartenlayouter'); - } - - $renderer->setSite($actSite); - $renderer->setConfig($config); - $renderer->setOptions($session->getOptions($productId)); - $renderer->renderStep($outfilename); - - $im = new \imagick(); - - $im->setCompressionQuality(89); - - $im->setResolution(300,300); - $im->readImage($outfilename."[0]"); - $im->thumbnailimage($width, $height, true); - $im->mergeImageLayers(\imagick::LAYERMETHOD_FLATTEN); - // $im->setImageAlphaChannel(\imagick::ALPHACHANNEL_REMOVE); - $im->writeimage($outfilename.".jpeg"); - - unlink($outfilename); - - - $response = new Response(); - - $response->headers->set('Cache-Control', 'private'); - $response->headers->set('Content-type', mime_content_type($outfilename.".jpeg")); - $response->headers->set('Content-Disposition', 'attachment; filename="' . basename($outfilename.".jpeg") . '"'); - - $response->sendHeaders(); - - $response->setContent(readfile($outfilename.".jpeg")); - - unlink($outfilename.".jpeg"); - - return $response; - - } - - #[Route('/layouter/{layouterId}/{site}/{width}/{height}', name: 'psc_plugin_laufkartenlayouter_preview_layouter')] - public function layouterAction(Request $request, EntityManagerInterface $entityManager, DocumentManager $documentManager, Layouter $formLayouter, Pdf $renderer, $layouterId, $site = 1, $width = 400, $height = 900) - { - $width = round($width); - $height = round($height); - - /** @var Layoutdesigndata $layoutDesignData */ - $layoutDesignData = $entityManager - ->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')->findOneBy(array('uuid' => $layouterId)); - - - /** @var Product $product */ - $product = $documentManager - ->getRepository('PSC\Shop\EntityBundle\Entity\Product') - ->findOneBy(array('uuid' => $layoutDesignData->getArticleUuid())); - - /** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */ - $productDoc = $documentManager - ->getRepository('PSC\Shop\EntityBundle\Document\Product') - ->findOneBy(array('uid' => (string)$product->getUid())); - - $formLayouter->setXml($productDoc->getPluginSetting('laufkartenlayouter', 'xml')); - - $actSite = $formLayouter->getSite($site); - $config = $formLayouter->getConfig(); - - $outfilename = "temp/".uniqid().".pdf"; - - $renderer->setSite($actSite); - $renderer->setConfig($config); - $renderer->setOptions($layoutDesignData->getDesign()); - $renderer->renderStep($outfilename); - - $im = new \imagick($outfilename."[0]"); - if($im->getImageWidth() < $width) { - $width = $im->getImageWidth(); - } - $im->setResolution(300,300); - $im->thumbnailimage($width, $height, true); - $im->writeimage($outfilename.".png"); - - unlink($outfilename); - - - $response = new Response(); - - $response->headers->set('Cache-Control', 'private'); - $response->headers->set('Content-type', mime_content_type($outfilename.".png")); - $response->headers->set('Content-Disposition', 'attachment; filename="' . basename($outfilename.".png") . '"'); - - $response->sendHeaders(); - - $response->setContent(readfile($outfilename.".png")); - - unlink($outfilename.".png"); - return $response; - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/StoreController.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/StoreController.php deleted file mode 100644 index 0c4883d32..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/StoreController.php +++ /dev/null @@ -1,67 +0,0 @@ -get("layouter"); - $articleUuid = $request->get("article"); - - $layoutDesignData = new Layoutdesigndata(); - $layoutDesignData->setUuid($uuid); - $layoutDesignData->setArticleUuid($articleUuid); - $session = new LaufkartenLayouter(); - if($request->getSession()->has('laufkartenlayouter')) { - $session = $request->getSession()->get('laufkartenlayouter'); - } - $layoutDesignData->setDesign($session->getOptions($articleUuid)); - - $entityManager->persist($layoutDesignData); - $entityManager->flush(); - - $json = new JsonResponse(); - $json->setContent(json_encode(array('success' => true))); - - return $json; - } - - #[Route('/update', name: 'psc_plugin_laufkartenlayouter_store_update')] - public function updateAction(Request $request, EntityManagerInterface $entityManager) - { - - $uuid = $request->get("layouter"); - $articleUuid = $request->get("article"); - - $layoutDesignData = $entityManager - ->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')->findOneBy(array('uuid' => $uuid)); - - - $session = new LaufkartenLayouter(); - if($request->getSession()->has('laufkartenlayouter')) { - $session = $request->getSession()->get('laufkartenlayouter'); - } - - $layoutDesignData->setDesign($session->getOptions($articleUuid)); - - $entityManager->persist($layoutDesignData); - $entityManager->flush(); - - $json = new JsonResponse(); - $json->setContent(json_encode(array('success' => true))); - - return $json; - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/UploadController.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/UploadController.php deleted file mode 100644 index c1105197f..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/UploadController.php +++ /dev/null @@ -1,102 +0,0 @@ -files->has("file")) { - $file = $request->files->get("file"); - - if($file instanceof UploadedFile) { - - - $filename = sprintf('%s/%s/%s/%s.%s', date('Y'), date('m'), date('d'), uniqid(), $file->getClientOriginalExtension()); - - /** @var Filesystem $fileContainer */ - $fileContainer = $filesystemMap->get('steplayouter_motiv'); - - if( - $file->getMimeType() == "image/png" || - $file->getMimeType() == "image/jpg" || - $file->getMimeType() == "image/jpeg" - ){ - $filename = sprintf('%s/%s/%s/%s.%s', date('Y'), date('m'), date('d'), uniqid(), "jpg"); - - $filenameTemp = sprintf('/tmp/%s.%s', uniqid(), "jpg"); - exec("convert ".$file->getPathname()." -colorspace cmyk -auto-orient ".$filenameTemp); - - $fileContainer->write($filename, file_get_contents($filenameTemp)); - - unlink($filenameTemp); - - }else{ - $fileContainer->write($filename, file_get_contents($file->getPathname())); - } - - - $image = new Image(); - $image->setSessionId($request->getSession()->getId()); - $image->setFileName($fileContainer->get($filename)->getKey()); - $image->setCropWidth(100); - $image->setCropHeight(100); - - $documentManager->persist($image); - $documentManager->flush(); - - return new JsonResponse(['success' => true, 'id' => $image->getId()]); - } - } - - return new JsonResponse(['success' => false]); - } - - #[Route('/cropbox/{id}', name: 'psc_plugin_laufkartenlayouter_upload_crop')] - public function cropAction(Request $request, DocumentManager $documentManager, $id) - { - /** @var \Plugin\Custom\PSC\LaufkartenLayouter\Document\Image $image */ - $image = $documentManager - ->getRepository('Plugin\Custom\PSC\LaufkartenLayouter\Document\Image') - ->findOneBy(['_id' => new ObjectId($id)]); - - $image->setCrop(true); - $image->setCropX($request->get('x')); - $image->setCropY($request->get('y')); - $image->setCropWidth($request->get('width')); - $image->setCropHeight($request->get('height')); - - $documentManager->persist($image); - $documentManager->flush(); - - return new JsonResponse(['success' => true]); - } - - #[Route('/rotate/{id}', name: 'psc_plugin_laufkartenlayouter_upload_rotate')] - public function rotateAction(Request $request, DocumentManager $documentManager, $id) - { - /** @var \Plugin\Custom\PSC\LaufkartenLayouter\Document\Image $image */ - $image = $documentManager - ->getRepository('Plugin\Custom\PSC\LaufkartenLayouter\Document\Image') - ->findOneBy(['_id' => new ObjectId($id)]); - - - exec("convert /data/www/new/web/market/motive/" . $image->getFileName()." -rotate ".($request->get('rotate'))." /data/www/new/web/market/motive/" . $image->getFileName()); - - - return new JsonResponse(['success' => true]); - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Document/Image.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Document/Image.php deleted file mode 100644 index ad19d0b80..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Document/Image.php +++ /dev/null @@ -1,197 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Document; - -use Doctrine\ODM\MongoDB\Mapping\Annotations\Field; -use Doctrine\ODM\MongoDB\Mapping\Annotations\Id; -use Doctrine\ODM\MongoDB\Mapping\Annotations\Document; -use Doctrine\ODM\MongoDB\Mapping\Annotations\Hash; - -#[Document(repositoryClass: 'Plugin\Custom\PSC\LaufkartenLayouter\Document\Repository\ImageRepository', collection: 'plugin_system_psc_laufkartenlayouter_image')] -class Image -{ - #[Id] - protected $id; - - #[Field(type: 'string')] - protected $sessionId; - - #[Field(type: 'string')] - protected $fileName; - - /** - * @var boolean - */ - #[Field(type: 'bool')] - protected $crop = false; - - #[Field(type: 'int')] - protected $cropX = 0; - - #[Field(type: 'int')] - protected $cropY = 0; - - #[Field(type: 'int')] - protected $cropWidth = 0; - - #[Field(type: 'int')] - protected $cropHeight = 0; - - #[Field(type: 'int')] - protected $rotate = 0; - - /** - * @return mixed - */ - public function getId() - { - return $this->id; - } - - /** - * @param mixed $id - */ - public function setId($id) - { - $this->id = $id; - } - - /** - * @return mixed - */ - public function getSessionId() - { - return $this->sessionId; - } - - /** - * @param mixed $sessionId - */ - public function setSessionId($sessionId) - { - $this->sessionId = $sessionId; - } - - /** - * @return mixed - */ - public function getFileName() - { - return $this->fileName; - } - - /** - * @param mixed $fileName - */ - public function setFileName($fileName) - { - $this->fileName = $fileName; - } - - /** - * @return bool - */ - public function isCrop() - { - return $this->crop; - } - - /** - * @param mixed $crop - */ - public function setCrop($crop) - { - $this->crop = $crop; - } - - /** - * @return mixed - */ - public function getCropX() - { - return $this->cropX; - } - - /** - * @param mixed $cropX - */ - public function setCropX($cropX) - { - $this->cropX = $cropX; - } - - /** - * @return mixed - */ - public function getCropY() - { - return $this->cropY; - } - - /** - * @param mixed $cropY - */ - public function setCropY($cropY) - { - $this->cropY = $cropY; - } - - /** - * @return mixed - */ - public function getCropWidth() - { - return $this->cropWidth; - } - - /** - * @param mixed $cropWidth - */ - public function setCropWidth($cropWidth) - { - $this->cropWidth = $cropWidth; - } - - /** - * @return mixed - */ - public function getCropHeight() - { - return $this->cropHeight; - } - - /** - * @param mixed $cropHeight - */ - public function setCropHeight($cropHeight) - { - $this->cropHeight = $cropHeight; - } - - /** - * @return mixed - */ - public function getRotate() - { - return $this->rotate; - } - - /** - * @param mixed $rotate - */ - public function setRotate($rotate) - { - $this->rotate = $rotate; - } - - -} diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Document/Repository/ImageRepository.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Document/Repository/ImageRepository.php deleted file mode 100644 index 8ba200407..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Document/Repository/ImageRepository.php +++ /dev/null @@ -1,19 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Document\Repository; - -use Doctrine\ODM\MongoDB\Repository\DocumentRepository; - -class ImageRepository extends DocumentRepository -{ - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Field/BackendFields.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Field/BackendFields.php deleted file mode 100644 index 771c91853..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Field/BackendFields.php +++ /dev/null @@ -1,81 +0,0 @@ -statusService = $statusService; - } - - public function getTemplate() - { - return '@PluginCustomPSCLaufkartenLayouter/form/field/backend.html.twig'; - } - - public function getModule() - { - return Field::Product; - } - - /** - * @param array $data - */ - public function formPreSubmit(FormEvent $event) - { - - } - - public function buildForm(FormBuilderInterface $builder, array $options) - { - - $builder->add('laufkartenlayouter', CheckboxType::class, array( - 'label' => 'Step Layouter aktivieren', - 'required' => false - )) ->add("laufkartenlayouter2InitalStatus", ChoiceType::class, array( - 'label' => 'Initalstatus', - 'choices' => $this->statusService->getPositionStatusAsArray(), - 'translation_domain' => 'posstatus' - )); - - - return $builder; - } - - public function getGroup() - { - return "laufkartenlayouter"; - } - - public function formPostSetData(FormEvent $event) - { - // TODO: Implement formPostSetData() method. - } - - public function formPostSubmit(FormEvent $event) - { - // TODO: Implement formPostSubmit() method. - } - - public function formPreSetData(FormEvent $event) - { - // TODO: Implement formPreSetData() method. - } - - public function formSubmit(FormEvent $event) - { - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Field/EnableEditor.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Field/EnableEditor.php deleted file mode 100644 index 2ba0b36d7..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Field/EnableEditor.php +++ /dev/null @@ -1,143 +0,0 @@ -options = $options; - - /** @var Shop $shopEntity */ - $shopEntity = $this->options['shopEntity']; - $tempLayouts = []; - if ($shopEntity->isCustomTemplates() == 1) { - foreach (new DirectoryIterator('/data/www/old/application/design/vorlagen') as $file) { - if ($file == '.' || $file == '..' || $file == 'config' || $file == '.svn' || $file == 'datapacks' || $file == '.DS_Store') { - continue; - } - $tempLayouts[$file->getFileName()] = $file->getFileName(); - } - } else { - if (file_exists('/data/www/old/application/design/clients/' . $shopEntity->getUID())) { - foreach (new DirectoryIterator('/data/www/old/application/design/clients/' . $shopEntity->getUID()) as $file) { - if ($file == '.' || $file == '..' || $file == 'config' || $file == '.svn' || $file == 'datapacks' || $file == '.DS_Store') { - continue; - } - $tempLayouts[$file->getFileName()] = $file->getFileName(); - } - } - } - if(isset($_POST["settings"]["bootstrap3Images"]["layout"])) { - header('location: /apps/backend/theme/settings'); - //die(); - } else { - if (!file_exists("/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/laufkarten_layouter")) { - mkdir("/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/laufkarten_layouter", 0777); - } - $filenameheader = "/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/laufkarten_layouter/header.html.twig"; - $filenamefooter = "/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/laufkarten_layouter/footer.html.twig"; - if (!file_exists($filenameheader)) { - touch($filenameheader); - chmod($filenameheader, 0777); - } - if (!file_exists($filenamefooter)) { - touch($filenamefooter); - chmod($filenamefooter, 0777); - } - - $handleheader = fopen($filenameheader, 'r'); - if(filesize($filenameheader)>0) { - $txtheader = fread($handleheader, filesize($filenameheader)); - fclose($handleheader); - } - $handlefooter = fopen($filenamefooter, 'r'); - if(filesize($filenamefooter)) { - $txtfooter = fread($handlefooter, filesize($filenamefooter)); - fclose($handlefooter); - } - - } - - - $builder->add('header', TextareaType::class, array( - 'label' => 'Header', - 'data' => $txtheader, - 'required' => false, - 'attr' => array('rows' => 50) - )) - ->add('footer', TextareaType::class, array( - 'label' => 'Footer', - 'data' => $txtfooter, - 'required' => false, - 'attr' => array('rows' => 50) - )); - ; - - return $builder; - } - - public function getGroup() - { - return LaufkartenLayouterEditor::GROUP_ID; - } - - public function formPostSetData(FormEvent $event) - { - // TODO: Implement formPostSetData() method. - } - - public function formPostSubmit(FormEvent $event) - { - - } - - public function formPreSetData(FormEvent $event) - { - // TODO: Implement formPreSetData() method. - } - - public function formSubmit(FormEvent $event) - { - $filename = "/data/www/old/application/design/vorlagen/" . $_POST["settings"]["bootstrap3General"]["layout"] . "/laufkarten_layouter/header.html.twig"; - $handle = fopen($filename, 'w'); - fputs($handle, $event->getForm()->get('laufkartenlayoutereditor')->get('header')->getData()); - fclose($handle); - - $filename = "/data/www/old/application/design/vorlagen/" . $_POST["settings"]["bootstrap3General"]["layout"] . "/laufkarten_layouter/footer.html.twig"; - $handle = fopen($filename, 'w'); - fputs($handle, $event->getForm()->get('laufkartenlayoutereditor')->get('footer')->getData()); - fclose($handle); - // TODO: Implement formPostSubmit() method. - - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/FormDesigner.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/FormDesigner.php deleted file mode 100644 index 5e62e3f86..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/FormDesigner.php +++ /dev/null @@ -1,67 +0,0 @@ -mediaManager = $mediaManager; - } - - public function buildForm(FormBuilderInterface $builder, array $options) - { - - /** @var LaufkartenLayouter $session */ - $session = $options['session']; - - $productId = $options['productId']; - - /** @var Step $step */ - $step = $options['step']; - - foreach($step->getColumns() as $column) { - foreach($column->getOptions() as $option) { - if($option->isInForm()) { - $option->renderForm($builder, $this->mediaManager); - } - } - } - - foreach($builder->all() as $opt) { - if($session->hasOption($productId, $opt->getName())) { - $opt->setData($session->getOption($productId, $opt->getName())); - } - } - } - - public function getName() - { - return 'designer'; - } - - public function configureOptions(OptionsResolver $resolver) - { - $resolver->setDefaults(array( - 'step' => null, - 'session' => null, - 'productId' => null, - )); - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Group/FormLayouter.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Group/FormLayouter.php deleted file mode 100644 index 14833e79d..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Group/FormLayouter.php +++ /dev/null @@ -1,31 +0,0 @@ -title = 'Step Layouter'; - } - - public function getModule() - { - return Field::Product; - } - - public function getId() - { - return self::GROUP_ID; - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Group/FormLayouterEditor.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Group/FormLayouterEditor.php deleted file mode 100644 index cc5a1cb4b..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Group/FormLayouterEditor.php +++ /dev/null @@ -1,31 +0,0 @@ -title = 'Step Layouter'; - } - - public function getModule() - { - return Field::Theme; - } - - public function getId() - { - return self::GROUP_ID; - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/ProductSettings.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/ProductSettings.php new file mode 100644 index 000000000..6502220c7 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/ProductSettings.php @@ -0,0 +1,60 @@ +add('active', CheckboxType::class, ['required' => false, 'label' => 'Aktivieren']); + return $builder; + } + + public function getGroup(): string + { + return 'laufkartenlayouter'; + } + + public function formPreSubmit(FormEvent $event) + { + // TODO: Implement formPreSubmit() method. + } + + public function formPreSetData(FormEvent $event) + { + } + + public function formPostSubmit(FormEvent $event) + { + } + + public function formPostSetData(FormEvent $event) + { + } + + public function formSubmit(FormEvent $event) + { + } +} diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/XML/EditType.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/XML/EditType.php deleted file mode 100644 index 40c789310..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/XML/EditType.php +++ /dev/null @@ -1,54 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Form\XML; - -use PSC\Libraries\AceEditorBundle\Form\Extension\AceEditorType; -use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\Extension\Core\Type\SubmitType; -use Symfony\Component\Form\Extension\Core\Type\TextType; -use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\OptionsResolver\OptionsResolver; - -class EditType extends AbstractType -{ - public function buildForm(FormBuilderInterface $builder, array $options) - { - $builder - ->add('uuid', TextType::class, array('disabled' => true)) - ->add('xml', AceEditorType::class, array( - 'wrapper_attr' => array(), // aceeditor wrapper html attributes. - 'width' => '100%', - 'height' => '500', - 'font_size' => 14, - 'mode' => 'ace/mode/xml', // every single default mode must have ace/mode/* prefix - 'theme' => 'ace/theme/monokai', // every single default theme must have ace/theme/* prefix - 'tab_size' => null, - 'read_only' => null, - 'use_soft_tabs' => null, - 'use_wrap_mode' => null, - 'show_print_margin' => null, - 'required' => false, - 'highlight_active_line' => null - )) - ->add('save', SubmitType::class, array('label' => 'Speichern')); - } - - public function getName() - { - return 'product'; - } - - public function configureOptions(OptionsResolver $resolver) - { - - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Config.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Config.php deleted file mode 100644 index 3d53eb410..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Config.php +++ /dev/null @@ -1,75 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Model; - - -use Plugin\Custom\PSC\LaufkartenLayouter\Model\Config\Pdf; - -class Config { - - /** @var Pdf */ - private $pdf; - - private $pdfPreviewButton = false; - - private $pdfPrintButton = false; - - /** - * @return Pdf - */ - public function getPdf() - { - return $this->pdf; - } - - /** - * @param Pdf $pdf - */ - public function setPdf($pdf) - { - $this->pdf = $pdf; - } - - /** - * @return bool - */ - public function isPdfPreviewButton() - { - return $this->pdfPreviewButton; - } - - /** - * @param bool $pdfPreviewButton - */ - public function setPdfPreviewButton($pdfPreviewButton) - { - $this->pdfPreviewButton = $pdfPreviewButton; - } - - /** - * @return bool - */ - public function isPdfPrintButton() - { - return $this->pdfPrintButton; - } - - /** - * @param bool $pdfPrintButton - */ - public function setPdfPrintButton($pdfPrintButton) - { - $this->pdfPrintButton = $pdfPrintButton; - } - - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Config/Pdf.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Config/Pdf.php deleted file mode 100644 index 6a791e0ce..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Config/Pdf.php +++ /dev/null @@ -1,71 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Config; - - -class Pdf { - - private $unit = "pt"; - - private $pdfx4 = false; - - private $iccProfile = ""; - - /** - * @return string - */ - public function getUnit() - { - return $this->unit; - } - - /** - * @param string $unit - */ - public function setUnit($unit) - { - $this->unit = $unit; - } - - /** - * @return string - */ - public function getIccProfile() - { - return $this->iccProfile; - } - - /** - * @param string $iccProfile - */ - public function setIccProfile($iccProfile) - { - $this->iccProfile = $iccProfile; - } - - /** - * @return bool - */ - public function isPdfx4() - { - return $this->pdfx4; - } - - /** - * @param bool $pdfx4 - */ - public function setPdfx4($pdfx4) - { - $this->pdfx4 = $pdfx4; - } - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Base.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Base.php deleted file mode 100644 index 9b3b4c348..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Base.php +++ /dev/null @@ -1,214 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements; - - -use Doctrine\ODM\MongoDB\DocumentManager; -use Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Site; - -abstract class Base { - - private $id = ""; - - private $x = 0; - - private $y = 0; - - private $preview = true; - - private $print = true; - - /** @var string? */ - private $border = null; - - /** @var DocumentManager */ - private $mongoDb; - - /** @var float */ - private $scale = 1; - - private $options = []; - - /** @var Site */ - private $site; - /** - * @return string - */ - public function getId() - { - return $this->id; - } - - /** - * @param string $id - */ - public function setId($id) - { - $this->id = $id; - } - - /** - * @return int - */ - public function getX() - { - return $this->x; - } - - /** - * @param int $x - */ - public function setX($x) - { - $this->x = $x; - } - - /** - * @return int - */ - public function getY() - { - return $this->y; - } - - /** - * @param int $y - */ - public function setY($y) - { - $this->y = $y; - } - - /** - * @param \PDFlib $pdf - */ - abstract function renderPdf($pdf); - - /** - * @return bool - */ - public function isPrint() - { - return $this->print; - } - - /** - * @param bool $print - */ - public function setPrint($print) - { - $this->print = $print; - } - - /** - * @return bool - */ - public function isPreview() - { - return $this->preview; - } - - /** - * @param bool $preview - */ - public function setPreview($preview) - { - $this->preview = $preview; - } - - /** - * @return float - */ - public function getScale() - { - return $this->scale; - } - - /** - * @param float $scale - */ - public function setScale($scale) - { - $this->scale = $scale; - } - - public function setOptions($options) - { - $this->options = $options; - } - - /** - * @return mixed - */ - public function getOption($key) - { - return $this->options[$key]; - } - - /** - * @param $key - * @return boolean - */ - public function hasOption($key) - { - return isset($this->options[$key]); - } - - /** - * @return DocumentManager - */ - public function getMongoDb() - { - return $this->mongoDb; - } - - /** - * @param DocumentManager $mongoDb - */ - public function setMongoDb($mongoDb) - { - $this->mongoDb = $mongoDb; - } - - /** - * @return Site - */ - public function getSite() - { - return $this->site; - } - - /** - * @param Site $site - */ - public function setSite($site) - { - $this->site = $site; - } - - /** - * @return string - */ - public function getBorder() - { - return $this->border; - } - - /** - * @param string $border - */ - public function setBorder($border) - { - $this->border = $border; - } - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Image.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Image.php deleted file mode 100644 index 9d74ea795..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Image.php +++ /dev/null @@ -1,132 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements; - -use MongoDB\BSON\ObjectId; -use Monolog\Handler\Mongo; - -class Image extends Base -{ - - private $file = ""; - - private $width = 0; - - private $height = 0; - - - /** - * @return string - */ - public function getFile() - { - if($this->hasOption($this->getId().'_original')) { - return $this->getOption($this->getId().'_original'); - } - return $this->getId(); - } - - - public function renderPdf($pdf) - { - if($this->getFile() != "") { - $id = new ObjectId($this->getFile()); - - $render = true; - /** @var \Plugin\Custom\PSC\LaufkartenLayouter\Document\Image $imageObj */ - $imageObj = $this->getMongoDb() - ->getRepository('Plugin\Custom\PSC\LaufkartenLayouter\Document\Image') - ->findOneBy(['_id' => new ObjectId($this->getFile())]); - # Load the image - $image = $pdf->load_image("auto", "/data/www/new/web/market/motive/" . $imageObj->getFileName(), ""); - if ($image == 0) { - echo("Error: " . $pdf->get_errmsg()); - exit(1); - } - $opt = "position={top left} boxsize={" . $this->getWidth()*$this->getScale() . " " . $this->getHeight()*$this->getScale() . - "} fitmethod=meet"; - - -// $opt = $opt . " matchbox={clipping={1% 1% 50% 50%}}"; - if($imageObj->isCrop()) { - $opt = $opt . " matchbox={name=" . $this->getId() . " clipping={" . - ($imageObj->getCropX()) . "% " . (100-$imageObj->getCropHeight()-$imageObj->getCropY()) . "% " . ($imageObj->getCropWidth()+$imageObj->getCropX()) . "% " . (100-$imageObj->getCropY()) . "%}}"; - - if($imageObj->getCropWidth() == 0 || $imageObj->getCropHeight() == 0) { - $render = false; - } - }else{ - $opt = $opt . " matchbox={name=" . $this->getId() . "}"; - } - if($imageObj->getRotate() != 0) { - //$opt .= " rotate=". $imageObj->getRotate() . ""; - } - - if($render) { - $pdf->fit_image($image, $this->getX() * $this->getScale(), - ($this->getHeight() + $this->getY()) * $this->getScale(), $opt); - } - - if($this->getBorder() != null) { - $path = (int)$pdf->info_matchbox($this->getId(), 1, "boundingbox"); - $pdf->draw_path($path, 0, 0, $this->getBorder()); - $pdf->delete_path($path); - } - - $pdf->close_image($image); - } - } - - /** - * @return int - */ - public function getWidth() - { - return $this->width; - } - - /** - * @param int $width - */ - public function setWidth($width) - { - $this->width = $width; - } - - /** - * @return int - */ - public function getHeight() - { - return $this->height; - } - - /** - * @param int $height - */ - public function setHeight($height) - { - $this->height = $height; - } - - /** - * @param string $file - * @return Image - */ - public function setFile($file) - { - $this->file = $file; - return $this; - } - - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Media.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Media.php deleted file mode 100644 index fd62be874..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Media.php +++ /dev/null @@ -1,109 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements; - -use MongoDB\BSON\ObjectId; -use Monolog\Handler\Mongo; - -class Media extends Base -{ - - private $file = ""; - - private $width = 0; - - private $height = 0; - - /** - * @return string - */ - public function getFile() - { - if ($this->hasOption($this->getId())) { - return $this->getOption($this->getId()); - } else { - return $this->file; - } - } - - public function renderPdf($pdf) - { - - if( false && $this->getFile() != "") { - $id = new ObjectId($this->getFile()); - - $render = true; - /** @var \PSC\Shop\MediaBundle\Document\Media $imageObj */ - $imageObj = $this->getMongoDb() - ->getRepository('PSC\Shop\MediaBundle\Document\Media') - ->findOneBy(['_id' => new ObjectId($this->getFile())]); - # Load the image - $image = $pdf->load_image("auto", "/data/www/new/web/" . $imageObj->getUrl(), ""); - if ($image == 0) { - echo("Error: " . $pdf->get_errmsg()); - exit(1); - } - $opt = "position={top left} boxsize={" . $this->getWidth()*$this->getScale() . " " . $this->getHeight()*$this->getScale() . - "} fitmethod=meet"; - - - if($render) { - $pdf->fit_image($image, $this->getX() * $this->getScale(), - ($this->getHeight() + $this->getY()) * $this->getScale(), $opt); - } - } - } - - /** - * @return int - */ - public function getWidth() - { - return $this->width; - } - - /** - * @param int $width - */ - public function setWidth($width) - { - $this->width = $width; - } - - /** - * @return int - */ - public function getHeight() - { - return $this->height; - } - - /** - * @param int $height - */ - public function setHeight($height) - { - $this->height = $height; - } - - /** - * @param string $file - * @return Image - */ - public function setFile($file) - { - $this->file = $file; - return $this; - } - - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Pdf.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Pdf.php deleted file mode 100644 index b0fb33e61..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Pdf.php +++ /dev/null @@ -1,118 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements; - - -use MongoDB\BSON\ObjectId; - -class Pdf extends Base -{ - - private $file = ""; - - private $siteToRender = 1; - - private $width = 0; - - private $height = 0; - - public function renderPdf($pdf) - { - /** @var \PSC\Shop\MediaBundle\Document\Media $media */ - $media = $this->getMongoDb() - ->getRepository('PSC\Shop\MediaBundle\Document\Media') - ->findOneBy(['_id' => new ObjectId($this->getFile())]); - - $indoc = $pdf->open_pdi_document("/data/www/new/web" . $media->getUrl(), ""); - - $page = $pdf->open_pdi_page($indoc, $this->getSiteToRender(), ""); - if ($page == 0) { - print("Error: " . $pdf->get_errmsg()); - die(); - } - - $optlist = "boxsize {" . $this->getWidth()*$this->getScale() . " " . $this->getHeight()*$this->getScale() . "} fitmethod meet"; - - $pdf->fit_pdi_page($page, $this->getX()*$this->getScale(), - ($this->getSite()->getHeight()-$this->getY())*$this->getScale(), $optlist); - - $pdf->close_pdi_page($page); - - $pdf->close_pdi_document($indoc); - - } - - /** - * @return string - */ - public function getFile() - { - return $this->file; - } - - /** - * @param string $file - */ - public function setFile($file) - { - $this->file = $file; - } - - /** - * @return int - */ - public function getWidth() - { - return $this->width; - } - - /** - * @param int $width - */ - public function setWidth($width) - { - $this->width = $width; - } - - /** - * @return int - */ - public function getHeight() - { - return $this->height; - } - - /** - * @param int $height - */ - public function setHeight($height) - { - $this->height = $height; - } - - /** - * @return int - */ - public function getSiteToRender() - { - return $this->siteToRender; - } - - /** - * @param int $siteToRender - */ - public function setSiteToRender($siteToRender) - { - $this->siteToRender = $siteToRender; - } - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Text.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Text.php deleted file mode 100644 index bb5a64ea2..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Text.php +++ /dev/null @@ -1,304 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements; - - -use MongoDB\BSON\ObjectId; - -class Text extends Base -{ - - private $text = ""; - - private $fontSize = 14; - - private $color = "black"; - - private $colorMode = "hex"; - - private $rotate = 0; - - private $font = ""; - - private $showBorder = false; - - private $width = 0; - - private $height = 0; - - private $fitMethod = "auto"; - - private $vAlign = "top"; - - private $hAlign = "left"; - - private $leading = "100%"; - /** - * @return string - */ - public function getText() - { - if ($this->hasOption($this->getId())) { - return $this->getOption($this->getId()); - } else { - return $this->text; - } - } - - /** - * @param string $text - */ - public function setText($text) - { - $this->text = $text; - } - - public function renderPdf($pdf) - { - if($this->getFont()) { - - /** @var \PSC\Shop\MediaBundle\Document\Media $media */ - $media = $this->getMongoDb() - ->getRepository('PSC\Shop\MediaBundle\Document\Media') - ->findOneBy(['_id' => new ObjectId($this->getFont())]); - - $pdf->set_option("FontOutline={" . $this->getFont() . "=" . "/data/www/new/web" . $media->getUrl()."}"); - $font = $pdf->load_font($this->getFont(), "unicode", "embedding"); - }else{ - $font = $pdf->load_font("Arial", "unicode", "embedding"); - if ($font == 0) { - echo("Error: " . $pdf->get_errmsg()); - exit(1); - } - - } - - $pdf->setfont($font, $this->getFontSize() * $this->getScale()); - - $optList = ""; - if (strtolower($this->getColorMode()) == "cmyk") { - $color = explode(" ", $this->getColor()); - $optList .= "fillcolor={cmyk " . $color[0]/100 . " " . $color[1]/100 . " " . $color[2]/100 . " " . $color[3]/100 . "} "; - }elseif(strtolower($this->getColorMode()) == "rgb") { - $optList .= "fillcolor={rgb " . $this->getColor() . "} "; - }else { - $optList .= "fillcolor=" . $this->getColor() . " "; - } - - if($this->rotate != 0) { - $optList .= "rotate=". $this->rotate . " "; - } - - if($this->getWidth() != 0 && $this->getHeight() != 0) { - $optList .= " boxsize={".($this->getWidth()*$this->getScale())." ".($this->getHeight()*$this->getScale())."} position={".$this->getHAlign()." ".$this->getVAlign()."} fitmethod=" . $this->getFitMethod(); - - if($this->isShowBorder()) { - $optList .= " showborder"; - } - } - - $pdf->fit_textline($this->getText(), $this->getX()*$this->getScale(), ($this->getY()+$this->getHeight())*$this->getScale(), $optList); - } - - /** - * @return int - */ - public function getFontSize() - { - return $this->fontSize; - } - - /** - * @param int $fontSize - */ - public function setFontSize($fontSize) - { - $this->fontSize = $fontSize; - } - - /** - * @return string - */ - public function getColorMode() - { - return $this->colorMode; - } - - /** - * @param string $colorMode - */ - public function setColorMode($colorMode) - { - $this->colorMode = $colorMode; - } - - /** - * @return string - */ - public function getColor() - { - return $this->color; - } - - /** - * @param string $color - */ - public function setColor($color) - { - $this->color = $color; - } - - /** - * @return int - */ - public function getRotate() - { - return $this->rotate; - } - - /** - * @param int $rotate - */ - public function setRotate($rotate) - { - $this->rotate = $rotate; - } - - /** - * @return string - */ - public function getFont() - { - return $this->font; - } - - /** - * @param string $font - */ - public function setFont($font) - { - $this->font = $font; - } - - /** - * @return bool - */ - public function isShowBorder() - { - return $this->showBorder; - } - - /** - * @param bool $showBorder - */ - public function setShowBorder($showBorder) - { - $this->showBorder = $showBorder; - } - - /** - * @return int - */ - public function getWidth() - { - return $this->width; - } - - /** - * @param int $width - */ - public function setWidth($width) - { - $this->width = $width; - } - - /** - * @return int - */ - public function getHeight() - { - return $this->height; - } - - /** - * @param int $height - */ - public function setHeight($height) - { - $this->height = $height; - } - - /** - * @return string - */ - public function getFitMethod() - { - return $this->fitMethod; - } - - /** - * @param string $fitMethod - */ - public function setFitMethod($fitMethod) - { - $this->fitMethod = $fitMethod; - } - - /** - * @return string - */ - public function getHAlign() - { - return $this->hAlign; - } - - /** - * @param string $hAlign - */ - public function setHAlign($hAlign) - { - $this->hAlign = $hAlign; - } - - /** - * @return string - */ - public function getVAlign() - { - return $this->vAlign; - } - - /** - * @param string $vAlign - */ - public function setVAlign($vAlign) - { - $this->vAlign = $vAlign; - } - - /** - * @return string - */ - public function getLeading() - { - return $this->leading; - } - - /** - * @param string $leading - */ - public function setLeading($leading) - { - $this->leading = $leading; - } - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/TextFlow.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/TextFlow.php deleted file mode 100644 index 74d0cb6d3..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/TextFlow.php +++ /dev/null @@ -1,65 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements; - -use MongoDB\BSON\ObjectId; - -class TextFlow extends Text -{ - - - - public function renderPdf($pdf) - { - if($this->getFont()) { - - /** @var \PSC\Shop\MediaBundle\Document\Media $media */ - $media = $this->getMongoDb() - ->getRepository('PSC\Shop\MediaBundle\Document\Media') - ->findOneBy(['_id' => new ObjectId($this->getFont())]); - - $pdf->set_option("FontOutline={" . $this->getFont() . "=" . "/data/www/new/web" . $media->getUrl()."}"); - }else{ - $this->setFont("Helvetica"); - } - - $optList = ""; - if (strtolower($this->getColorMode()) == "cmyk") { - $color = explode(" ", $this->getColor()); - $optList .= "fillcolor={cmyk " . $color[0]/100 . " " . $color[1]/100 . " " . $color[2]/100 . " " . $color[3]/100 . "} "; - }elseif(strtolower($this->getColorMode()) == "rgb") { - $optList .= "fillcolor={rgb " . $this->getColor() . "} "; - }else { - $optList .= "fillcolor=" . $this->getColor() . " "; - } - - if($this->getRotate() != 0) { - $optList .= "rotate=". $this->getRotate() . " "; - } - - $optList .= "leading=". $this->getLeading() . " "; - - $optList .= " alignment=".$this->getHAlign()." encoding=unicode embedding fontname=" . $this->getFont() . " fontsize=" . ($this->getFontSize() * $this->getScale()); - - $tf = 0; - $tf = $pdf->add_textflow($tf, $this->getText(), $optList); - - - $optList = " verticalalign=".$this->getVAlign()." fitmethod=" . $this->getFitMethod(); - if($this->isShowBorder()) { - $optList .= " showborder"; - } - - $pdf->fit_textflow($tf, $this->getX()*$this->getScale(), ($this->getY())*$this->getScale(), ($this->getWidth()+$this->getX())*$this->getScale(), ($this->getY()+$this->getHeight())*$this->getScale(), $optList); - } - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Site.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Site.php deleted file mode 100644 index 71d941318..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Site.php +++ /dev/null @@ -1,180 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf; - - -use Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Base; - -class Site { - - private $id; - - private $label = ""; - - private $width = 0; - - private $height = 0; - - private $trimLeft = 0; - private $trimRight = 0; - private $trimTop = 0; - private $trimBottom = 0; - - /** @var Base[] */ - private $elements = []; - - /** - * @return mixed - */ - public function getId() - { - return $this->id; - } - - /** - * @param mixed $id - */ - public function setId($id) - { - $this->id = $id; - } - - /** - * @return string - */ - public function getLabel() - { - return $this->label; - } - - /** - * @param string $label - */ - public function setLabel($label) - { - $this->label = $label; - } - - /** - * @return int - */ - public function getWidth() - { - return $this->width; - } - - /** - * @param int $width - */ - public function setWidth($width) - { - $this->width = $width; - } - - /** - * @return int - */ - public function getHeight() - { - return $this->height; - } - - /** - * @param int $height - */ - public function setHeight($height) - { - $this->height = $height; - } - - /** - * @return int - */ - public function getTrimLeft() - { - return $this->trimLeft; - } - - /** - * @param int $trimLeft - */ - public function setTrimLeft($trimLeft) - { - $this->trimLeft = $trimLeft; - } - - /** - * @return int - */ - public function getTrimRight() - { - return $this->trimRight; - } - - /** - * @param int $trimRight - */ - public function setTrimRight($trimRight) - { - $this->trimRight = $trimRight; - } - - /** - * @return int - */ - public function getTrimTop() - { - return $this->trimTop; - } - - /** - * @param int $trimTop - */ - public function setTrimTop($trimTop) - { - $this->trimTop = $trimTop; - } - - /** - * @return int - */ - public function getTrimBottom() - { - return $this->trimBottom; - } - - /** - * @param int $trimBottom - */ - public function setTrimBottom($trimBottom) - { - $this->trimBottom = $trimBottom; - } - - /** - * @return Base[] - */ - public function getElements() - { - return $this->elements; - } - - /** - * @param Base[] $elements - */ - public function setElements($elements) - { - $this->elements = $elements; - } - - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Column.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Column.php deleted file mode 100644 index 84094dc54..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Column.php +++ /dev/null @@ -1,42 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps; - -use Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Base; - -class Column { - - /** @var Base[] */ - private $options; - - /** - * @return Base[] - */ - public function getOptions() - { - return $this->options; - } - - /** - * @param Base[] $options - */ - public function setOptions($options) - { - $this->options = $options; - } - - public function addOption($option) - { - $this->options[] = $option; - } - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Base.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Base.php deleted file mode 100644 index d8bab7a54..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Base.php +++ /dev/null @@ -1,114 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options; - -use PSC\Shop\MediaBundle\Service\MediaManager; -use Symfony\Component\Form\FormBuilder; - -abstract class Base { - - private $id; - - private $column = 1; - - private $label = ""; - - private $required = false; - - protected $inForm = false; - - public function renderForm(FormBuilder $builder, MediaManager $mediaManager) - { - - } - - /** - * @return mixed - */ - public function getId() - { - return $this->id; - } - - /** - * @param mixed $id - */ - public function setId($id) - { - $this->id = $id; - } - - /** - * @return int - */ - public function getColumn() - { - return $this->column; - } - - /** - * @param int $column - */ - public function setColumn($column) - { - $this->column = $column; - } - - /** - * @return string - */ - public function getLabel() - { - return $this->label; - } - - /** - * @param string $label - */ - public function setLabel($label) - { - $this->label = $label; - } - - /** - * @return bool - */ - public function isInForm() - { - return $this->inForm; - } - - /** - * @param bool $inForm - */ - public function setInForm($inForm) - { - $this->inForm = $inForm; - } - - /** - * @return bool - */ - public function isRequired() - { - return $this->required; - } - - /** - * @param bool $required - */ - public function setRequired($required) - { - $this->required = $required; - } - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Image.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Image.php deleted file mode 100644 index 168bd9144..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Image.php +++ /dev/null @@ -1,73 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options; - -use PSC\Shop\MediaBundle\Service\MediaManager; -use Symfony\Component\Form\Extension\Core\Type\FileType; -use Symfony\Component\Form\Extension\Core\Type\HiddenType; -use Symfony\Component\Form\FormBuilder; - -class Image extends Base { - - private $cropBox = false; - - private $cropBoxAspectRatio = 0; - - protected $inForm = true; - - public function renderForm(FormBuilder $builder, MediaManager $mediaManager) - { - $builder->add($this->getId(), FileType::class, [ - 'label' => $this->getLabel(), - 'required' => false - ]); - $builder->add($this->getId() . '_original', HiddenType::class, [ - ]); - if($this->cropBox) { - $builder->add($this->getId() . '_crop', HiddenType::class, [ - ]); - } - } - - /** - * @return bool - */ - public function isCropBox() - { - return $this->cropBox; - } - - /** - * @param bool $cropBox - */ - public function setCropBox($cropBox) - { - $this->cropBox = $cropBox; - } - - /** - * @return int - */ - public function getCropBoxAspectRatio() - { - return $this->cropBoxAspectRatio; - } - - /** - * @param int $cropBoxAspectRatio - */ - public function setCropBoxAspectRatio($cropBoxAspectRatio) - { - $this->cropBoxAspectRatio = $cropBoxAspectRatio; - } - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Preview.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Preview.php deleted file mode 100644 index 086371d20..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Preview.php +++ /dev/null @@ -1,35 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options; - -class Preview extends Base { - - private $site = 1; - - /** - * @return int - */ - public function getSite() - { - return $this->site; - } - - /** - * @param int $site - */ - public function setSite($site) - { - $this->site = $site; - } - - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Select/Media.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Select/Media.php deleted file mode 100644 index ff831c49c..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Select/Media.php +++ /dev/null @@ -1,73 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Select; - -use Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Base; -use PSC\Shop\MediaBundle\Service\MediaManager; -use Symfony\Component\Form\Extension\Core\Type\ChoiceType; -use Symfony\Component\Form\FormBuilder; - -class Media extends Base { - - protected $inForm = true; - - protected $options = []; - - protected $choiceAttr = []; - - /** @var MediaManager */ - protected $mediaManager; - - public function renderForm(FormBuilder $builder, MediaManager $mediaManager) - { - - $this->mediaManager = $mediaManager; - - $this->buildChoiceAttr(); - - $builder->add($this->getId(), ChoiceType::class, [ - 'label' => $this->getLabel(), - 'required' => false, - 'choices' => $this->options, - 'choice_attr' => $this->choiceAttr - ]); - } - - public function addOption($id, $label) - { - $this->options[$label] = (string)$id; - } - - /** - * @return array - */ - public function getOptions() - { - return $this->options; - } - - /** - * @param array $options - */ - public function setOptions($options) - { - $this->options = $options; - } - - private function buildChoiceAttr() - { - foreach($this->options as $name => $key) { - $media = $this->mediaManager->getMedia($key); - $this->choiceAttr[$name] = ['data-img-src' => $this->mediaManager->retrieveThumbnailPath($media)]; - } - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Select/Simple.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Select/Simple.php deleted file mode 100644 index 6bee878f5..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Select/Simple.php +++ /dev/null @@ -1,54 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Select; - -use Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Base; -use PSC\Shop\MediaBundle\Service\MediaManager; -use Symfony\Component\Form\Extension\Core\Type\ChoiceType; -use Symfony\Component\Form\FormBuilder; - -class Simple extends Base { - - protected $inForm = true; - - protected $options = []; - - public function renderForm(FormBuilder $builder, MediaManager $mediaManager) - { - $builder->add($this->getId(), ChoiceType::class, [ - 'label' => $this->getLabel(), - 'required' => false, - 'choices' => $this->options - ]); - } - - public function addOption($id, $label) - { - $this->options[$label] = $id; - } - - /** - * @return array - */ - public function getOptions() - { - return $this->options; - } - - /** - * @param array $options - */ - public function setOptions($options) - { - $this->options = $options; - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Text.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Text.php deleted file mode 100644 index 8c2ffa0eb..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Text.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options; - -use PSC\Shop\MediaBundle\Service\MediaManager; -use Symfony\Component\Form\Extension\Core\Type\TextType; -use Symfony\Component\Form\FormBuilder; - -class Text extends Base { - - private $text = ""; - - protected $inForm = true; - /** - * @return string - */ - public function getText() - { - return $this->text; - } - - /** - * @param string $text - */ - public function setText($text) - { - $this->text = $text; - } - - public function renderForm(FormBuilder $builder, MediaManager $mediaManager) - { - - $builder->add($this->getId(), TextType::class, [ - 'label' => $this->getLabel(), - 'data' => $this->getText(), - 'required' => $this->isRequired() - ]); - } - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Textarea.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Textarea.php deleted file mode 100644 index 4b142ba1f..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Textarea.php +++ /dev/null @@ -1,54 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options; - -use PSC\Shop\MediaBundle\Service\MediaManager; -use Symfony\Component\Form\Extension\Core\Type\TextareaType; -use Symfony\Component\Form\Extension\Core\Type\TextType; -use Symfony\Component\Form\FormBuilder; - -class Textarea extends Base { - - private $text = ""; - - protected $inForm = true; - - /** - * @return string - */ - public function getText() - { - return $this->text; - } - - /** - * @param string $text - */ - public function setText($text) - { - $this->text = $text; - } - - public function renderForm(FormBuilder $builder, MediaManager $mediaManager) - { - - $builder->add($this->getId(), TextareaType::class, [ - 'label' => $this->getLabel(), - 'data' => $this->getText(), - 'attr' => [ - 'rows' => 6 - ], - 'required' => $this->isRequired() - ]); - } - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Step.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Step.php deleted file mode 100644 index 6e0c95504..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Step.php +++ /dev/null @@ -1,169 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps; - -use Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Base; - -class Step { - - private $id; - - private $name; - - private $headline; - - private $description; - - private $first = false; - - private $last = false; - - /** @var Column[] */ - private $columns = []; - - /** - * @return mixed - */ - public function getName() - { - return $this->name; - } - - /** - * @param mixed $name - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * @return mixed - */ - public function getHeadline() - { - return $this->headline; - } - - /** - * @param mixed $headline - */ - public function setHeadline($headline) - { - $this->headline = $headline; - } - - /** - * @return mixed - */ - public function getDescription() - { - return $this->description; - } - - /** - * @param mixed $description - */ - public function setDescription($description) - { - $this->description = $description; - } - - /** - * @return mixed - */ - public function getId() - { - return $this->id; - } - - /** - * @param mixed $id - */ - public function setId($id) - { - $this->id = $id; - } - - /** - * @return Column[] - */ - public function getColumns() - { - return $this->columns; - } - - /** - * @param Column[] $columns - */ - public function setColumns($columns) - { - $this->columns = $columns; - } - - public function getColumn($pos) - { - if(!isset($this->columns[$pos])) { - $this->columns[$pos] = new Column(); - } - - return $this->columns[$pos]; - } - - public function getOption($id) - { - foreach($this->columns as $columns) { - foreach($columns->getOptions() as $option) { - if($option->getId() == $id) return $option; - } - } - - } - - public function getColumnWidth() - { - return 12/count($this->columns); - } - - /** - * @return bool - */ - public function isLast() - { - return $this->last; - } - - /** - * @param bool $last - */ - public function setLast($last) - { - $this->last = $last; - } - - /** - * @return bool - */ - public function isFirst() - { - return $this->first; - } - - /** - * @param bool $first - */ - public function setFirst($first) - { - $this->first = $first; - } - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Config/Config.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Config/Config.php deleted file mode 100644 index ae64fb4ad..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Config/Config.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Config; - -use Plugin\Custom\PSC\LaufkartenLayouter\Model\Config\Pdf; -use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Base; -use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Preview; -use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Text; -use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Textarea; - -class Config { - - - /** - * @param \SimpleXMLElement $xml - * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Config - */ - public function parse($xml) - { - $config = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Config(); - - $config->setPdf(new Pdf()); - if($xml->unit) { - $config->getPdf()->setUnit((string)$xml->unit); - } - if($xml->pdfPreviewButton) { - $config->setPdfPreviewButton(boolval(intval($xml->pdfPreviewButton))); - } - if($xml->pdfPrintButton) { - $config->setPdfPrintButton(boolval(intval($xml->pdfPrintButton))); - } - if($xml->pdfx4) { - $config->getPdf()->setPdfx4(boolval(intval($xml->pdfx4))); - $config->getPdf()->setIccProfile((string)$xml->iccProfile); - } - return $config; - } - - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Base.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Base.php deleted file mode 100644 index 223d07902..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Base.php +++ /dev/null @@ -1,40 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options; - -abstract class Base { - - - /** - * @param \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Base $element - * @param \SimpleXMLElement $xml - * @return mixed - */ - public function parseBase($element, $xml) - { - if(!isset($xml['id'])) { - $element->setId(md5(rand())); - }else{ - $element->setId((string)$xml['id']); - } - - if(isset($xml['column'])) { - $element->setColumn(intval($xml['column'])); - } - if(isset($xml['label'])) { - $element->setLabel((string)$xml['label']); - } - - return $element; - } - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Image.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Image.php deleted file mode 100644 index 2beceeb7d..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Image.php +++ /dev/null @@ -1,35 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options; - -class Image extends Base { - - - /** - * @param \SimpleXMLElement $xml - * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Image - */ - public function parse($xml) - { - $image = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Image(); - - parent::parseBase($image, $xml); - - if(isset($xml['cropBox'])) { - $image->setCropBox(boolval($xml['cropBox'])); - } - if(isset($xml['cropBoxAspectRatio'])) { - $image->setCropBoxAspectRatio(floatval($xml['cropBoxAspectRatio'])); - } - return $image; - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Preview.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Preview.php deleted file mode 100644 index f61de384c..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Preview.php +++ /dev/null @@ -1,32 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options; - -class Preview extends Base { - - /** - * @param \SimpleXMLElement $xml - * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Preview - */ - public function parse($xml) - { - $preview = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Preview(); - - parent::parseBase($preview, $xml); - - if(isset($xml['site'])) { - $preview->setSite(intval($xml['site'])); - } - - return $preview; - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Select/Media.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Select/Media.php deleted file mode 100644 index d44e6cec2..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Select/Media.php +++ /dev/null @@ -1,35 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Select; - -use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Base; - -class Media extends Base { - - - /** - * @param \SimpleXMLElement $xml - * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Select\Media - */ - public function parse($xml) - { - $select = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Select\Media(); - - parent::parseBase($select, $xml); - - foreach($xml->option as $option) { - $select->addOption((string)$option['id'], (string)$option); - } - - return $select; - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Select/Simple.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Select/Simple.php deleted file mode 100644 index 178b3518c..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Select/Simple.php +++ /dev/null @@ -1,35 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Select; - -use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Base; - -class Simple extends Base { - - - /** - * @param \SimpleXMLElement $xml - * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Select\Simple - */ - public function parse($xml) - { - $select = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Select\Simple(); - - parent::parseBase($select, $xml); - - foreach($xml->option as $option) { - $select->addOption((string)$option['id'], (string)$option); - } - - return $select; - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Text.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Text.php deleted file mode 100644 index 852c14877..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Text.php +++ /dev/null @@ -1,33 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options; - -class Text extends Base { - - - /** - * @param \SimpleXMLElement $xml - * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Text - */ - public function parse($xml) - { - $text = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Text(); - - parent::parseBase($text, $xml); - - $text->setText((string)$xml); - if(isset($xml['required'])) { - $text->setRequired(boolval($xml['required'])); - } - return $text; - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Textarea.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Textarea.php deleted file mode 100644 index bb51533ba..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Textarea.php +++ /dev/null @@ -1,32 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options; - -class Textarea extends Base { - - /** - * @param \SimpleXMLElement $xml - * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Textarea - */ - public function parse($xml) - { - $text = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Textarea(); - - parent::parseBase($text, $xml); - - $text->setText((string)$xml); - if(isset($xml['required'])) { - $text->setRequired(boolval($xml['required'])); - } - return $text; - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Step.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Step.php deleted file mode 100644 index e827f0cf9..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Step.php +++ /dev/null @@ -1,71 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form; - -use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Base; -use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Preview; -use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Text; -use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Image; -use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Textarea; - -class Step { - - - /** - * @param \SimpleXMLElement $xml - * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Step - */ - public function parse($xml) - { - $step = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Step(); - $step->setId(intval($xml['id'])); - - if(isset($xml['label'])) { - $step->setName((string)$xml['label']); - } - if(isset($xml->headline)) { - $step->setHeadline((string)$xml->headline); - } - if(isset($xml->description)) { - $step->setDescription((string)$xml->description); - } - - if($xml->elements->count()) { - foreach($xml->elements->children() as $typeXml => $optionXml) { - - $parser = new Text(); - if($typeXml == "textarea") { - $parser = new Textarea(); - } - if($typeXml == "preview") { - $parser = new Preview(); - } - if($typeXml == "image") { - $parser = new Image(); - } - if($typeXml == "select") { - $parser = new \Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Select\Simple(); - } - if($typeXml == "mediaSelect") { - $parser = new \Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Select\Media(); - } - $option = $parser->parse($optionXml); - - $step->getColumn($option->getColumn())->addOption($option); - } - } - - return $step; - } - - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Parser.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Parser.php deleted file mode 100644 index b0a931d7d..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Parser.php +++ /dev/null @@ -1,100 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser; - -use Plugin\Custom\PSC\LaufkartenLayouter\Model\Config; -use Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Site; -use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Step; - -class Parser -{ - - /** @var \SimpleXMLElement */ - private $xml; - - public function loadXml($xml) - { - $this->xml = simplexml_load_string($xml); - } - - /** - * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Config - */ - public function parseConfig() - { - $configParser = new \Plugin\Custom\PSC\LaufkartenLayouter\Parser\Config\Config(); - - $config = $configParser->parse($this->xml->general); - - return $config; - } - - /** - * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Step[] - */ - public function parseStep() - { - - $steps = []; - - $count = $this->xml->steps->children()->count(); - - if($count) { - $stepParser = new Step(); - - $i = 0; - - foreach($this->xml->steps->children() as $stepXml) { - $step = $stepParser->parse($stepXml); - - if($i == 0) { - $step->setFirst(true); - } - if($i == $count-1) { - $step->setLast(true); - } - - $steps[] = $step; - $i++; - } - } - - return $steps; - - } - - /** - * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Site[] - */ - public function parseSites() - { - - $sites = []; - - $count = $this->xml->sites->children()->count(); - - if($count) { - $siteParser = new \Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Site(); - - - foreach($this->xml->sites->children() as $siteXml) { - $site = $siteParser->parse($siteXml); - - $sites[] = $site; - } - } - - return $sites; - - } - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Base.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Base.php deleted file mode 100644 index a507d6024..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Base.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements; - -abstract class Base { - - - /** - * @param \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Base $element - * @param \SimpleXMLElement $xml - * @return mixed - */ - public function parseBase($element, $xml) - { - if(!isset($xml['id'])) { - $element->setId(md5(rand())); - }else{ - $element->setId((string)$xml['id']); - } - - if(isset($xml['x'])) { - $element->setX(intval($xml['x'])); - } - if(isset($xml['y'])) { - $element->setY(intval($xml['y'])); - } - if(isset($xml['preview'])) { - $element->setPreview(boolval(intval($xml['preview']))); - } - if(isset($xml['print'])) { - $element->setPrint(boolval(intval($xml['print']))); - } - - return $element; - } - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Image.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Image.php deleted file mode 100644 index e8469cc1d..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Image.php +++ /dev/null @@ -1,37 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements; - -class Image extends Base { - - - /** - * @param \SimpleXMLElement $xml - * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Image - */ - public function parse($xml) - { - $image = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Image(); - - parent::parseBase($image, $xml); - - $image->setFile((string)$xml); - $image->setWidth(intval($xml['width'])); - $image->setHeight(intval($xml['height'])); - - if(isset($xml['border'])) { - $image->setBorder($xml['border']); - } - - return $image; - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Media.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Media.php deleted file mode 100644 index 738c0ce11..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Media.php +++ /dev/null @@ -1,37 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements; - -class Media extends Base { - - - /** - * @param \SimpleXMLElement $xml - * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Media - */ - public function parse($xml) - { - $image = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Media(); - - parent::parseBase($image, $xml); - - $image->setFile((string)$xml); - $image->setWidth(intval($xml['width'])); - $image->setHeight(intval($xml['height'])); - - if(isset($xml['border'])) { - $image->setBorder($xml['border']); - } - - return $image; - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Pdf.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Pdf.php deleted file mode 100644 index 9de34a1a1..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Pdf.php +++ /dev/null @@ -1,35 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements; - -class Pdf extends Base { - - - /** - * @param \SimpleXMLElement $xml - * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Pdf - */ - public function parse($xml) - { - $pdf = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Pdf(); - - parent::parseBase($pdf, $xml); - - $pdf->setFile((string)$xml); - $pdf->setWidth(intval($xml['width'])); - $pdf->setHeight(intval($xml['height'])); - $pdf->setSiteToRender(intval($xml['site'])); - - - return $pdf; - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Text.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Text.php deleted file mode 100644 index 7e6e6d96b..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Text.php +++ /dev/null @@ -1,67 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements; - -class Text extends Base { - - - /** - * @param \SimpleXMLElement $xml - * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Text - */ - public function parse($xml) - { - $text = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Text(); - - parent::parseBase($text, $xml); - - $text->setText((string)$xml); - if(isset($xml['fontSize'])) { - $text->setFontSize(intval($xml['fontSize'])); - } - - if(isset($xml['color'])) { - $text->setColor($xml['color']); - } - - if(isset($xml['colorMode'])) { - $text->setColorMode($xml['colorMode']); - } - - if(isset($xml['rotate'])) { - $text->setRotate(intval($xml['rotate'])); - } - if(isset($xml['font'])) { - $text->setFont((string)$xml['font']); - } - if(isset($xml['showBorder'])) { - $text->setShowBorder(boolval($xml['showBorder'])); - } - if(isset($xml['width'])) { - $text->setWidth(intval($xml['width'])); - } - if(isset($xml['height'])) { - $text->setHeight(intval($xml['height'])); - } - if(isset($xml['vAlign'])) { - $text->setVAlign((string)$xml['vAlign']); - } - if(isset($xml['hAlign'])) { - $text->setHAlign((string)$xml['hAlign']); - } - if(isset($xml['fitmethod'])) { - $text->setFitMethod((string)$xml['fitmethod']); - } - - return $text; - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/TextFlow.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/TextFlow.php deleted file mode 100644 index 107f86b11..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/TextFlow.php +++ /dev/null @@ -1,71 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements; - -class TextFlow extends Base { - - - /** - * @param \SimpleXMLElement $xml - * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\TextFlow - */ - public function parse($xml) - { - $text = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\TextFlow(); - - parent::parseBase($text, $xml); - - $text->setText((string)$xml); - if(isset($xml['fontSize'])) { - $text->setFontSize(intval($xml['fontSize'])); - } - - if(isset($xml['color'])) { - $text->setColor($xml['color']); - } - - if(isset($xml['colorMode'])) { - $text->setColorMode($xml['colorMode']); - } - - if(isset($xml['rotate'])) { - $text->setRotate(intval($xml['rotate'])); - } - if(isset($xml['font'])) { - $text->setFont((string)$xml['font']); - } - if(isset($xml['showBorder'])) { - $text->setShowBorder(boolval($xml['showBorder'])); - } - if(isset($xml['width'])) { - $text->setWidth(intval($xml['width'])); - } - if(isset($xml['height'])) { - $text->setHeight(intval($xml['height'])); - } - if(isset($xml['vAlign'])) { - $text->setVAlign((string)$xml['vAlign']); - } - if(isset($xml['hAlign'])) { - $text->setHAlign((string)$xml['hAlign']); - } - if(isset($xml['fitmethod'])) { - $text->setFitMethod((string)$xml['fitmethod']); - } - if(isset($xml['leading'])) { - $text->setLeading((string)$xml['leading']); - } - - - return $text; - } -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Site.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Site.php deleted file mode 100644 index 75bbce5bb..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Site.php +++ /dev/null @@ -1,78 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf; - -use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements\Image; -use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements\Media; -use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements\Motiv; -use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements\Pdf; -use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements\Text; -use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements\TextFlow; - -class Site { - - - /** - * @param \SimpleXMLElement $xml - * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Site - */ - public function parse($xml) - { - $site = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Site(); - $site->setId(intval($xml['id'])); - $site->setWidth(intval($xml['width'])); - $site->setHeight(intval($xml['height'])); - - if(isset($xml['trimLeft'])) { - $site->setTrimLeft(intval($xml['trimLeft'])); - } - if(isset($xml['trimRight'])) { - $site->setTrimRight(intval($xml['trimRight'])); - } - if(isset($xml['trimTop'])) { - $site->setTrimTop(intval($xml['trimTop'])); - } - if(isset($xml['trimBottom'])) { - $site->setTrimBottom(intval($xml['trimBottom'])); - } - - if(isset($xml['label'])) { - $site->setLabel((string)$xml['label']); - } - - if(isset($xml->elements) && $xml->elements->children()->count()) { - $elements = []; - foreach($xml->elements->children() as $type => $xmlElement) { - $parser = new Text(); - if(strtolower($type) == "pdf") { - $parser= new Pdf(); - } - if(strtolower($type) == "image") { - $parser= new Image(); - } - if(strtolower($type) == "media") { - $parser= new Media(); - } - if(strtolower($type) == "textflow") { - $parser= new TextFlow(); - } - $elements[] = $parser->parse($xmlElement); - - } - $site->setElements($elements); - } - - return $site; - } - - -} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Renderer/Pdf.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Renderer/Pdf.php deleted file mode 100644 index 4d5cb289f..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Renderer/Pdf.php +++ /dev/null @@ -1,239 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Renderer; - -use Doctrine\ODM\MongoDB\DocumentManager; -use MongoDB\BSON\ObjectId; -use Plugin\Custom\PSC\LaufkartenLayouter\Model\Config; -use Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Site; -use PSC\Shop\MediaBundle\Document\Media; - -class Pdf -{ - /** @var Site */ - private $site; - - /** @var Config */ - private $config; - - private $pdflibLic; - - private $options; - - function __construct(DocumentManager $mongoDb, $pdflib_lic) - { - $this->mongoDb = $mongoDb; - $this->pdflibLic = $pdflib_lic; - } - - public function setSite($site) - { - $this->site = $site; - } - - public function renderStep($filename) - { - $p = new \PDFlib(); - $p->set_option('errorpolicy=return'); - $p->set_option('stringformat=utf8'); - $p->set_parameter('license', $this->pdflibLic); - if ($p->begin_document($filename, '') == 0) { - die('Error: ' . $p->get_errmsg()); - } - - $p->set_option('topdown=true'); - $p->set_option('usercoordinates=true'); - - $scale = 1; - if (strtolower($this->config->getPdf()->getUnit()) == 'mm') { - $scale = 2.83465; - } elseif (strtolower($this->config->getPdf()->getUnit()) == 'cm') { - $scale = 28.3465; - } - - $p->begin_page_ext( - 0, - 0, - 'width=' . - (($this->site->getWidth() + $this->site->getTrimLeft() + $this->site->getTrimRight()) * $scale) . - ' height=' . - (($this->site->getHeight() + $this->site->getTrimTop() + $this->site->getTrimBottom()) * $scale) . - ' trimbox={' . - ($this->site->getTrimLeft() * $scale) . - ' ' . - ($this->site->getTrimTop() * $scale) . - ' ' . - (($this->site->getWidth() + $this->site->getTrimLeft()) * $scale) . - ' ' . - (($this->site->getHeight() + $this->site->getTrimTop()) * $scale) . - '}', - ); - - foreach ($this->site->getElements() as $element) { - $element->setScale($scale); - $element->setOptions($this->options); - $element->setMongoDb($this->mongoDb); - $element->setSite($this->site); - $element->renderPdf($p); - } - - $p->end_page_ext(''); - - $p->end_document(''); - } - - public function renderPreviewPdf($sites, $filename) - { - $p = new \PDFlib(); - $p->set_option('errorpolicy=return'); - $p->set_option('stringformat=utf8'); - $p->set_parameter('license', $this->pdflibLic); - if ($p->begin_document($filename, '') == 0) { - die('Error: ' . $p->get_errmsg()); - } - - $p->set_option('topdown=true'); - $p->set_option('usercoordinates=true'); - - $scale = 1; - if (strtolower($this->config->getPdf()->getUnit()) == 'mm') { - $scale = 2.83465; - } elseif (strtolower($this->config->getPdf()->getUnit()) == 'cm') { - $scale = 28.3465; - } - - foreach ($sites as $site) { - $p->begin_page_ext( - 0, - 0, - 'width=' . - (($site->getWidth() + $site->getTrimLeft() + $site->getTrimRight()) * $scale) . - ' height=' . - (($site->getHeight() + $site->getTrimTop() + $site->getTrimBottom()) * $scale) . - ' trimbox={' . - ($site->getTrimLeft() * $scale) . - ' ' . - ($site->getTrimTop() * $scale) . - ' ' . - (($site->getWidth() + $site->getTrimLeft()) * $scale) . - ' ' . - (($site->getHeight() + $site->getTrimTop()) * $scale) . - '}', - ); - - foreach ($site->getElements() as $element) { - if (!$element->isPreview()) - continue; - $element->setScale($scale); - $element->setOptions($this->options); - $element->setMongoDb($this->mongoDb); - $element->setSite($site); - $element->renderPdf($p); - } - - $p->end_page_ext(''); - } - - $p->end_document(''); - } - - public function renderPrintPdf($sites, $filename) - { - $p = new \PDFlib(); - $p->set_option('errorpolicy=return'); - $p->set_option('stringformat=utf8'); - $p->set_parameter('license', $this->pdflibLic); - $p->set_info('Creator', 'PSC'); - $p->set_info('Title', 'PDFX4'); - - if ($this->config->getPdf()->isPdfx4()) { - if ($p->begin_document($filename, 'pdfx=PDF/X-4') == 0) { - die('Error: ' . $p->get_errmsg()); - } - - /** @var Media $media */ - $media = $this->mongoDb - ->getRepository('PSC\Shop\MediaBundle\Document\Media') - ->findOneBy(['_id' => new ObjectId($this->config->getPdf()->getIccProfile())]); - - if ($p->load_iccprofile('/data/www/new/web' . $media->getUrl(), 'usage=outputintent') == 0) { - print 'Error: ' . $p->get_errmsg() . "\n"; - print "See www.pdflib.com for output intent ICC profiles.\n"; - $p->delete(); - return 2; - } - } else { - if ($p->begin_document($filename, '') == 0) { - die('Error: ' . $p->get_errmsg()); - } - } - - $p->set_option('topdown=true'); - $p->set_option('usercoordinates=true'); - - $scale = 1; - if (strtolower($this->config->getPdf()->getUnit()) == 'mm') { - $scale = 2.83465; - } elseif (strtolower($this->config->getPdf()->getUnit()) == 'cm') { - $scale = 28.3465; - } - - foreach ($sites as $site) { - $p->begin_page_ext( - 0, - 0, - 'width=' . - (($site->getWidth() + $site->getTrimLeft() + $site->getTrimRight()) * $scale) . - ' height=' . - (($site->getHeight() + $site->getTrimTop() + $site->getTrimBottom()) * $scale) . - ' trimbox={' . - ($site->getTrimLeft() * $scale) . - ' ' . - ($site->getTrimTop() * $scale) . - ' ' . - (($site->getWidth() + $site->getTrimLeft()) * $scale) . - ' ' . - (($site->getHeight() + $site->getTrimTop()) * $scale) . - '}', - ); - - foreach ($site->getElements() as $element) { - if (!$element->isPrint()) - continue; - $element->setScale($scale); - $element->setOptions($this->options); - $element->setMongoDb($this->mongoDb); - $element->setSite($site); - $element->renderPdf($p); - } - - $p->end_page_ext(''); - } - - $p->end_document(''); - } - - /** - * @param Config $config - */ - public function setConfig($config) - { - $this->config = $config; - } - - public function setOptions(array $options) - { - $this->options = $options; - } -} - diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/config/routing.yml b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/config/routing.yml index 62e50a3f3..078d28e99 100644 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/config/routing.yml +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/config/routing.yml @@ -1,12 +1,7 @@ psc_shop_plugin_custom_laufkartenlayouter_frontend: resource: "@PluginCustomPSCLaufkartenLayouter/Controller" type: attribute - prefix: /plugin/laufkartenlayouter/api - -psc_shop_plugin_custom_laufkartenlayouter_backend: - resource: "@PluginCustomPSCLaufkartenLayouter/Controller/Backend" - type: attribute - prefix: /backend/plugin/laufkartenlayouter + prefix: /plugin/custom/psc/laufkartenlayouter/frontend diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/config/services.yml b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/config/services.yml index 06e165636..b637c2200 100644 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/config/services.yml +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/config/services.yml @@ -6,24 +6,4 @@ services: Plugin\Custom\PSC\LaufkartenLayouter\: resource: '../../*/*' - Plugin\Custom\PSC\LaufkartenLayouter\Form\Group\LaufkartenLayouter: - tags: - - { name: psc.backend.custom.groups } - psc.plugin.system.psc.theme.laufkartenlayouter.group.LaufkartenLayouterEditor: - class: Plugin\Custom\PSC\LaufkartenLayouter\Form\Group\LaufkartenLayouterEditor - tags: - - { name: psc.backend.custom.groups, themeType: "bootstrap3" } - - Plugin\Custom\PSC\LaufkartenLayouter\Form\Field\BackendFields: - tags: - - { name: psc.backend.custom.fields } - - Plugin\Custom\PSC\LaufkartenLayouter\Form\FormDesigner: - tags: - - { name: form.type } - - psc.plugin.system.psc.theme.laufkartenlayouter.field.enable_checkbox: - class: Plugin\Custom\PSC\LaufkartenLayouter\Form\Field\EnableEditor - tags: - - { name: psc.backend.custom.fields, themeType: "bootstrap3" } diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/backend/xml/edit.html.twig b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/backend/xml/edit.html.twig deleted file mode 100644 index 79f78b65a..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/backend/xml/edit.html.twig +++ /dev/null @@ -1,60 +0,0 @@ -{% extends 'backend_base.html.twig' %} - -{% block body %} -
-
-
-

- - Step Layouter > - XML Bearbeiten - Anzeigen -

-
- -
-
- -
-
-
-
{{ product.title }}
-
-
- - {{ form_start(form, { 'attr': {'class': 'smart-form'}}) }} - {{ form_errors(form) }} - -
-
-
- -
- {{ form_widget(form.uuid) }} - - - UUID des Produktes -
-
-
-
-
-
- {{ form_widget(form.xml) }} -
-
-
-
-
- {{ form_widget(form.save, {attr: {class: 'btn btn-primary btn-sm'}}) }} -
-
- {{ form_end(form) }} -
-
-
- {{ summernote_mediabundle_init() }} - -{% endblock %} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/designer/start.html.twig b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/designer/start.html.twig index f5729529e..0464d1a7b 100644 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/designer/start.html.twig +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/designer/start.html.twig @@ -1,455 +1,783 @@ + - Online Designer + Laufkarten Designer - - - - - - - - - - - - -{{ header|raw }} -{#% include '/data/www/old/application/design/vorlagen/' ~ layout ~ '/laufkarten_layouter/header.html.twig' %#} - -{{ form_start(form) }} - -
-
-
{% if not step.first %}{% endif %}
-

{{ step.headline }}

-
- {% if config.pdfPreviewButton %}PDF Vorschau{% endif %} - {% if config.pdfPrintButton %}PDF Print{% endif %} - {% if not step.last %}{% endif %} - {% if step.last %}{% endif %} + +
+

Laufkarten Designer

+ + +
+
+
1
+
PDF Upload
+
+
+
+
2
+
Vorschau & Text
+
+
+
+
3
+
Fertigstellen
+
+
+ + +
+

Schritt 1: PDF Upload

+
+ + + +
PDF-Dateien hier ablegen
+

oder klicken zum Auswählen

+ +
+
+ +
+ +
+
+ + + + + +
-
-
-
- {% for col in step.columns %} -
- {% for option in col.options %} - {% if option.inForm %} - {% if option is instanceof("\\Plugin\\System\\PSC\\LaufkartenLayouter\\Model\\Steps\\Options\\Image") %} -
-
-
- {{ form_label(attribute(form, option.id)) }} -
- {{ form_widget(attribute(form, option.id)) }} -
- {{ form_errors(attribute(form, option.id)) }} -
-
-
-
-
- -
-
- -
-
-
-
-
- {% else %} -
-
-
- {{ form_label(attribute(form, option.id)) }} -
- {{ form_widget(attribute(form, option.id)) }} -
- {{ form_errors(attribute(form, option.id)) }} -
-
-
- {% endif %} - - {% else %} - {% if option is instanceof("\\Plugin\\System\\PSC\\LaufkartenLayouter\\Model\\Steps\\Options\\Preview") %} -
- - {% endif %} - {% endif %} - {% endfor %} + + -
-{{ form_end(form) }} - + + - -{{ footer|raw }} + uploadZone.addEventListener('dragleave', () => { + uploadZone.classList.remove('border-blue-500', 'bg-gray-100'); + }); + + uploadZone.addEventListener('drop', (e) => { + e.preventDefault(); + uploadZone.classList.remove('border-blue-500', 'bg-gray-100'); + handleFiles(e.dataTransfer.files); + }); + + pdfInput.addEventListener('change', (e) => { + handleFiles(e.target.files); + }); + + function handleFiles(files) { + uploadedFiles = Array.from(files).filter(file => file.type === 'application/pdf'); + displayUploadedFiles(); + document.getElementById('nextToStep2').disabled = uploadedFiles.length === 0; + } + + function displayUploadedFiles() { + const list = document.getElementById('uploadedFilesList'); + list.innerHTML = '
Hochgeladene Dateien:
'; + const ul = document.createElement('ul'); + ul.className = 'space-y-2'; + uploadedFiles.forEach((file, index) => { + const li = document.createElement('li'); + li.className = 'flex justify-between items-center p-3 bg-white rounded-lg shadow'; + li.innerHTML = ` + ${file.name} + ${(file.size / 1024).toFixed(2)} KB + `; + ul.appendChild(li); + }); + list.appendChild(ul); + } + + // Modal handling + document.getElementById('closePreviewModal').addEventListener('click', () => { + document.getElementById('previewModal').classList.add('hidden'); + }); + + // Open preview for specific PDF + async function openPreviewForPDF(fileIndex) { + // First load the PDF info + loadPDFInfo(fileIndex); + // Then open the modal + await openPreviewModal(); + } + + async function openPreviewModal() { + const modal = document.getElementById('previewModal'); + modal.classList.remove('hidden'); + + const pdf = pdfData[currentFileIndex]; + const file = pdf.file; + const fileReader = new FileReader(); + + return new Promise((resolve) => { + fileReader.onload = async function() { + const typedArray = new Uint8Array(this.result); + modalPdfDoc = await pdfjsLib.getDocument(typedArray).promise; + document.getElementById('modalTotalPages').textContent = modalPdfDoc.numPages; + document.getElementById('modalCurrentPage').textContent = '1'; + await renderModalPage(1); + resolve(); + }; + + fileReader.readAsArrayBuffer(file); + }); + } + + async function renderModalPage(pageNum) { + const page = await modalPdfDoc.getPage(pageNum); + const canvas = document.getElementById('modalCanvas'); + const context = canvas.getContext('2d'); + const viewport = page.getViewport({ scale: 2.0 }); + + canvas.height = viewport.height; + canvas.width = viewport.width; + + const renderTask = page.render({ + canvasContext: context, + viewport: viewport + }); + + await renderTask.promise; + + document.getElementById('modalCurrentPage').textContent = pageNum; + console.log('Page rendered, canvas size:', canvas.width, 'x', canvas.height); + } + + document.getElementById('modalPrevPage').addEventListener('click', () => { + const current = parseInt(document.getElementById('modalCurrentPage').textContent); + if (current > 1) { + renderModalPage(current - 1); + } + }); + + document.getElementById('modalNextPage').addEventListener('click', () => { + const current = parseInt(document.getElementById('modalCurrentPage').textContent); + const total = parseInt(document.getElementById('modalTotalPages').textContent); + if (current < total) { + renderModalPage(current + 1); + } + }); + + // OCR functionality + async function processOCR(fileIndex) { + const progressDiv = document.getElementById('ocr-progress'); + + // Load the PDF if not already loaded + if (currentFileIndex !== fileIndex) { + loadPDFInfo(fileIndex); + } + + // Open modal and wait for render + await openPreviewModal(); + // Additional small delay to ensure rendering is complete + await new Promise(resolve => setTimeout(resolve, 100)); + + progressDiv.classList.remove('hidden'); + + try { + const canvas = document.getElementById('modalCanvas'); + console.log('Canvas before OCR:', canvas.width, 'x', canvas.height); + console.log('Canvas has content:', canvas.toDataURL().length > 5000); + + // Create a temporary canvas for the OCR area + const tempCanvas = document.createElement('canvas'); + tempCanvas.width = 150; + tempCanvas.height = 50; + const tempCtx = tempCanvas.getContext('2d'); + + // Fill with white background first (for debugging) + tempCtx.fillStyle = 'white'; + tempCtx.fillRect(0, 0, 150, 50); + + // Copy only the specified area from the main canvas + tempCtx.drawImage(canvas, 20, 200, 150, 50, 0, 0, 150, 50); + + // Display in debug canvas + const debugCanvas = document.getElementById('debugCanvas'); + debugCanvas.width = tempCanvas.width; + debugCanvas.height = tempCanvas.height; + const debugCtx = debugCanvas.getContext('2d'); + debugCtx.drawImage(tempCanvas, 0, 0); + document.getElementById('debugCanvasSize').textContent = `${tempCanvas.width}x${tempCanvas.height}px`; + + // Save OCR preview for table + ocrPreviews[fileIndex] = tempCanvas.toDataURL(); + + console.log('Temp canvas data length:', tempCanvas.toDataURL().length); + + const result = await Tesseract.recognize( + tempCanvas, + 'deu', + { + logger: m => { + if (m.status === 'recognizing text') { + console.log(`Fortschritt: ${(m.progress * 100).toFixed(0)}%`); + } + } + } + ); + + // Extract only numbers from the recognized text + console.log('OCR Result:', result); + console.log('Erkannter Text:', result.data.text); + const numberMatch = result.data.text.match(/\d+/); + const extractedNumber = numberMatch ? numberMatch[0] : ''; + + // Update the PDF data + pdfData[fileIndex].ocrNumber = extractedNumber; + pdfData[fileIndex].processed = true; + + // Update the input field + document.getElementById(`ocr-input-${fileIndex}`).value = extractedNumber; + + // Update the table + updatePDFTable(); + + // Close modal + document.getElementById('previewModal').classList.add('hidden'); + } catch (error) { + alert('Fehler beim Erkennen des Textes: ' + error.message); + } finally { + progressDiv.classList.add('hidden'); + } + } + + // Auto-process all PDFs + async function autoProcessAll() { + document.getElementById('autoProcessAll').disabled = true; + + for (let i = 0; i < pdfData.length; i++) { + if (!pdfData[i].processed) { + await processOCR(i); + await new Promise(resolve => setTimeout(resolve, 500)); // Small delay between PDFs + } + } + + document.getElementById('autoProcessAll').disabled = false; + alert('Alle PDFs wurden verarbeitet!'); + } + + // Step navigation buttons + document.getElementById('nextToStep2').addEventListener('click', () => goToStep(2)); + document.getElementById('backToStep1').addEventListener('click', () => goToStep(1)); + document.getElementById('nextToStep3').addEventListener('click', () => goToStep(3)); + document.getElementById('backToStep2').addEventListener('click', () => goToStep(2)); + document.getElementById('autoProcessAll').addEventListener('click', () => autoProcessAll()); + + document.getElementById('finishBtn').addEventListener('click', () => { + // Collect all OCR numbers and checkbox states from input fields + pdfData.forEach((pdf, index) => { + const input = document.getElementById(`ocr-input-${index}`); + const checkbox = document.getElementById(`red-checkbox-${index}`); + if (input) { + pdf.ocrNumber = input.value; + } + if (checkbox) { + pdf.inRed = checkbox.checked; + } + }); + + // Here you can send data to the backend + console.log('Final data:', pdfData); + alert('Verarbeitung abgeschlossen!'); + // window.location.reload(); + }); + + function generateFinalSummary() { + const summary = document.getElementById('finalSummary'); + const processedCount = pdfData.filter(p => p.processed).length; + const totalPageCount = pdfData.reduce((sum, p) => sum + p.numPages, 0); + const duplexCount = pdfData.filter(p => p.isDuplex).length; + + let tableHtml = ` +
+
Zusammenfassung
+
+
+

Anzahl PDFs:

+

${pdfData.length}

+
+
+

Gesamtseiten:

+

${totalPageCount}

+
+
+

Verarbeitet:

+

${processedCount}

+
+
+

2-Seitig:

+

${duplexCount}

+
+
+
+
+
+ + + + + + + + + + + + + `; + + pdfData.forEach((pdf, index) => { + const numberColor = pdf.inRed ? 'text-red-600' : 'text-blue-600'; + tableHtml += ` + + + + + + + + + `; + }); + + tableHtml += ` + +
#DateinameSeiten2-SeitigOCR NummerIn Rot
${index + 1}${pdf.fileName}${pdf.numPages}${pdf.isDuplex ? 'Ja' : 'Nein'}${pdf.ocrNumber || '-'}${pdf.inRed ? '✓' : '-'}
+
+
+ `; + + summary.innerHTML = tableHtml; + } + - \ No newline at end of file + diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/form/field/backend.html.twig b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/form/field/backend.html.twig deleted file mode 100644 index 45aad8abc..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/form/field/backend.html.twig +++ /dev/null @@ -1,30 +0,0 @@ -
-
Step Layouter
-
-
-
-
- {{ form_label(form.laufkartenlayouter.laufkartenlayouter) }} -
-
- {{ form_widget(form.laufkartenlayouter.laufkartenlayouter) }} -
-
-
-
-
-
- {{ form_label(form.laufkartenlayouter.laufkartenlayouter2InitalStatus) }} -
- {{ form_widget(form.laufkartenlayouter.laufkartenlayouter2InitalStatus) }} -
-
-
-
-
- -
-
-
diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/form/field/enable_editor.html.twig b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/form/field/enable_editor.html.twig deleted file mode 100644 index ee8672a3b..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/form/field/enable_editor.html.twig +++ /dev/null @@ -1,16 +0,0 @@ -
-
-
- -
- {{ form_widget(form.laufkartenlayoutereditor.header, {attr: {'class': 'form-control'}}) }} -
-
-
- -
- {{ form_widget(form.laufkartenlayoutereditor.footer, {attr: {'class': 'form-control'}}) }} -
-
-
-
\ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/form/product_settings.html.twig b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/form/product_settings.html.twig new file mode 100644 index 000000000..51c163a2e --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/form/product_settings.html.twig @@ -0,0 +1,17 @@ +
+
Laufkarten Layouter
+
+
+
+
+ {{ form_label(form.laufkartenlayouter.active) }} +
+
+ {{ form_widget(form.laufkartenlayouter.active) }} +
+
+
+
+
+
+
diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Service/Layouter.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Service/Layouter.php deleted file mode 100644 index ee51803de..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Service/Layouter.php +++ /dev/null @@ -1,70 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Service; - -use Plugin\Custom\PSC\LaufkartenLayouter\Model\Config; -use Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Site; -use Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Step; -use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Parser; - -class Layouter -{ - /** @var Step[] */ - private $steps = []; - - /** @var Site[] */ - private $sites = []; - - /** @var Config */ - private $config; - - public function setXml($xml) - { - $parser = new Parser(); - $parser->loadXml($xml); - - $this->steps = $parser->parseStep(); - $this->sites = $parser->parseSites(); - $this->config = $parser->parseConfig(); - } - - public function getStep($stepNum = 0) - { - foreach ($this->steps as $step) { - if ($stepNum == $step->getId()) - return $step; - } - } - - public function getSite($site = 1) - { - return $this->sites[$site - 1]; - } - - /** - * @return Config - */ - public function getConfig() - { - return $this->config; - } - - /** - * @return Site[] - */ - public function getSites() - { - return $this->sites; - } -} - diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Session/FormLayouter.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Session/FormLayouter.php deleted file mode 100644 index aba67bdc8..000000000 --- a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Session/FormLayouter.php +++ /dev/null @@ -1,119 +0,0 @@ - - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ -namespace Plugin\Custom\PSC\LaufkartenLayouter\Session; - -class LaufkartenLayouter implements \Serializable -{ - protected $options = []; - - protected $actualStep = 0; - - /** - * String representation of object - * @link http://php.net/manual/en/serializable.serialize.php - * @return string the string representation of the object or null - * @since 5.1.0 - */ - #[\Override] - public function serialize() - { - return serialize([ - $this->options, - $this->actualStep, - ]); - } - - /** - * Constructs the object - * @link http://php.net/manual/en/serializable.unserialize.php - * @param string $serialized

- * The string representation of the object. - *

- * @return void - * @since 5.1.0 - */ - #[\Override] - public function unserialize($serialized) - { - $data = unserialize($serialized); - list( - $this->options, - $this->actualStep, - ) = $data; - } - - /** - * @param $articleUUID - * @return array - */ - public function getOptions($articleUUID) - { - if (!isset($this->options[$articleUUID])) { - return []; - } - return $this->options[$articleUUID]; - } - - /** - * @param array $options - */ - public function setOptions($articleUUID, $options) - { - $this->options[$articleUUID] = $options; - } - - /** - * @return int - */ - public function getActualStep() - { - return $this->actualStep; - } - - /** - * @param int $actualStep - */ - public function setActualStep($actualStep) - { - $this->actualStep = $actualStep; - } - - public function hasOption($articleUUID, $option) - { - if (!isset($this->options[$articleUUID])) { - return false; - } - - return isset($this->options[$articleUUID][$option]); - } - - public function getOption($articleUUID, $option) - { - return $this->options[$articleUUID][$option]; - } - - public function __serialize(): array - { - return [ - $this->options, - $this->actualStep, - ]; - } - - public function __unserialize(array $data): void - { - $this->options = $data[0]; - $this->actualStep = $data[1]; - } -} - diff --git a/src/new/var/plugins/Custom/PSC/Printess/Form/BackendFields.php b/src/new/var/plugins/Custom/PSC/Printess/Form/BackendFields.php deleted file mode 100755 index 9ae22a737..000000000 --- a/src/new/var/plugins/Custom/PSC/Printess/Form/BackendFields.php +++ /dev/null @@ -1,191 +0,0 @@ -statusService = $statusService; - $this->shopService = $shopService; - $this->entityManager = $entityManager; - } - - public function getTemplate() - { - return '@PluginCustomPSCPrintess/form/field/backend.html.twig'; - } - - public function getModule() - { - return Field::Product; - } - - /** - * @param array $data - */ - public function formPreSubmit(FormEvent $event) - { - } - - public function buildForm(FormBuilderInterface $builder, array $options) - { - $results = $this->entityManager - ->getRepository(Account::class) - ->createQueryBuilder('a') - ->join('a.shops', 's') - ->where('s.uid = :shop') - ->setParameter('shop', $this->shopService->getSelectedShop()->getId()) - ->getQuery() - ->execute(); - - $accounts = []; - /** @var Account $result */ - foreach ($results as $result) { - $accounts[$result->getTitle()] = $result->getId(); - } - - /** @var Product $product */ - $product = $options['product']; - - $builder - ->add('uploadCollectingOrders', CheckboxType::class, ['required' => false, 'label' => 'Aktivieren']) - ->add('collectingOrdersChangePicture', CheckboxType::class, [ - 'required' => false, - 'label' => 'Bild tauschen aktivieren', - ]) - ->add('collectingOrdersCopy', CheckboxType::class, ['required' => false, 'label' => 'Mitarbeiter kopieren']) - ->add('collectingOrdersNewContact', CheckboxType::class, [ - 'required' => false, - 'label' => 'Neuen Mitarbeiter anlegen', - ]) - ->add('collectingOrdersInviteContact', CheckboxType::class, [ - 'required' => false, - 'label' => 'Mitarbeiter einladen', - ]) - ->add('collectingOrdersIntegrated', CheckboxType::class, [ - 'required' => false, - 'label' => 'nicht als Popup', - ]) - ->add('collectingOrdersAccountFilter', ChoiceType::class, [ - 'choices' => [ - 'Alle nicht gesperrten' => 1, - 'Gleich der angemeldeten Firma' => 2, - 'Filter nach gewählter Firma' => 3, - 'Filter nach gewählter Firma + alle Personen aller Firmen die meiner Firma zugordnet sind' => 4, - 'Gleich der angemeldeten Firma + alle Personen aller Firmen die meiner Firma zugordnet sind' => 5, - ], - 'label' => 'Firmenfilter', - ]) - ->add('uploadCollectingOrdersInitalStatus', ChoiceType::class, [ - 'label' => 'Initalstatus', - 'choices' => $this->statusService->getPositionStatusAsArray(), - 'translation_domain' => 'posstatus', - ]) - ->add('collectingOrdersAccount', ChoiceType::class, [ - 'multiple' => false, - 'expanded' => false, - 'required' => false, - 'label' => 'Gewählte Firma', - 'choices' => $accounts, - ]); - - if ($product) { - $builder->get('uploadCollectingOrders')->setData($product->isUploadCollectingOrders()); - $builder->get('collectingOrdersChangePicture')->setData($product->isCollectingOrdersChangePicture()); - $builder->get('collectingOrdersCopy')->setData($product->isCollectingOrdersCopy()); - $builder->get('collectingOrdersNewContact')->setData($product->isCollectingOrdersNewContact()); - $builder->get('collectingOrdersInviteContact')->setData($product->isCollectingOrdersInviteContact()); - $builder->get('collectingOrdersAccountFilter')->setData($product->getCollectingOrdersAccountFilter()); - $builder - ->get('uploadCollectingOrdersInitalStatus') - ->setData($product->getUploadCollectingOrdersInitalStatus()); - $builder->get('collectingOrdersAccount')->setData($product->getCollectingOrdersAccount()); - } - - return $builder; - } - - public function getGroup() - { - return 'Printess'; - } - - public function formPostSetData(FormEvent $event) - { - // TODO: Implement formPostSetData() method. - } - - public function formPostSubmit(FormEvent $event) - { - - } - - public function formPreSetData(FormEvent $event) - { - // TODO: Implement formPreSetData() method. - } - - public function formSubmit(FormEvent $event) - { - /** @var Product $product */ - $product = $event->getData(); - $product->setUploadCollectingOrders( - $event->getForm()->get('PrintessBulkorder')->get('uploadCollectingOrders')->getData(), - ); - $product->setCollectingOrdersChangePicture( - $event->getForm()->get('PrintessBulkorder')->get('collectingOrdersChangePicture')->getData(), - ); - $product->setCollectingOrdersCopy( - $event->getForm()->get('PrintessBulkorder')->get('collectingOrdersCopy')->getData(), - ); - $product->setCollectingOrdersNewContact( - $event->getForm()->get('PrintessBulkorder')->get('collectingOrdersNewContact')->getData(), - ); - $product->setCollectingOrdersInviteContact( - $event->getForm()->get('PrintessBulkorder')->get('collectingOrdersInviteContact')->getData(), - ); - $product->setCollectingOrdersAccountFilter( - $event->getForm()->get('PrintessBulkorder')->get('collectingOrdersAccountFilter')->getData(), - ); - $product->setUploadCollectingOrdersInitalStatus( - $event->getForm()->get('PrintessBulkorder')->get('uploadCollectingOrdersInitalStatus')->getData(), - ); - $product->setCollectingOrdersAccount( - $event->getForm()->get('PrintessBulkorder')->get('collectingOrdersAccount')->getData(), - ); - - } -} - diff --git a/src/old/application/design/vorlagen/bootstrap4_api/articletemplates/scripts/6.phtml b/src/old/application/design/vorlagen/bootstrap4_api/articletemplates/scripts/6.phtml index 2bc0fe3e7..1e18984bb 100755 --- a/src/old/application/design/vorlagen/bootstrap4_api/articletemplates/scripts/6.phtml +++ b/src/old/application/design/vorlagen/bootstrap4_api/articletemplates/scripts/6.phtml @@ -18,22 +18,21 @@ $this->headScript()->prependFile('/' . $this->designPath . '/assets/uploaderwcro $this->headScript()->prependFile('/scripts/SmartWizard/js/jquery.smartWizard-2.0.js'); - $this->headScript()->prependFile('/scripts/ckeditor/ckeditor.js'); $url = $_SERVER['HTTP_HOST']; $url .= $_SERVER['REQUEST_URI']; -$teile = explode("/", $url); -if ($teile[5] == "") { - $backlink = '/overview/' . $_COOKIE["categorie"]; +$teile = explode('/', $url); +if ($teile[5] == '') { + $backlink = '/overview/' . $_COOKIE['categorie']; } else { - $backlink = ""; + $backlink = ''; } ?>