Fixes
This commit is contained in:
parent
0c00d36236
commit
e044a424fa
@ -6,6 +6,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||||||
use Nelmio\ApiDocBundle\Annotation\Model;
|
use Nelmio\ApiDocBundle\Annotation\Model;
|
||||||
use Nelmio\ApiDocBundle\Annotation\Security;
|
use Nelmio\ApiDocBundle\Annotation\Security;
|
||||||
use OpenApi\Annotations as OA;
|
use OpenApi\Annotations as OA;
|
||||||
|
use OpenApi\Attributes\Tag;
|
||||||
use PSC\Component\ApiBundle\Dto\Error\NotFound;
|
use PSC\Component\ApiBundle\Dto\Error\NotFound;
|
||||||
use PSC\Shop\BasketBundle\Dto\Legacy\Input;
|
use PSC\Shop\BasketBundle\Dto\Legacy\Input;
|
||||||
use PSC\Shop\BasketBundle\Dto\Legacy\Output;
|
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\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
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\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;
|
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
|
||||||
|
|
||||||
class Add extends AbstractController
|
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
|
* change temp basketitem
|
||||||
@ -44,6 +47,7 @@ class Add extends AbstractController
|
|||||||
* )
|
* )
|
||||||
* @OA\Tag(name="Basket")
|
* @OA\Tag(name="Basket")
|
||||||
*/
|
*/
|
||||||
|
#[Tag('Basket')]
|
||||||
#[Route(path: '/legacy/add', methods: ['POST'])]
|
#[Route(path: '/legacy/add', methods: ['POST'])]
|
||||||
public function add(#[MapRequestPayload] Input $data): JsonResponse
|
public function add(#[MapRequestPayload] Input $data): JsonResponse
|
||||||
{
|
{
|
||||||
@ -59,26 +63,25 @@ class Add extends AbstractController
|
|||||||
$this->eventDispatcher->dispatch($event, PSCAdd::NAME);
|
$this->eventDispatcher->dispatch($event, PSCAdd::NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$articles = $_SESSION['Basket']['Articles'];
|
$articles = $_SESSION['Basket']['Articles'];
|
||||||
/**
|
/**
|
||||||
* @var \TP_Basket_Item $basketItem
|
* @var \TP_Basket_Item $basketItem
|
||||||
*/
|
*/
|
||||||
$basketItem = clone($_SESSION['Basket']['TempProduct'][$data->productUUId]);
|
$basketItem = clone $_SESSION['Basket']['TempProduct'][$data->productUUId];
|
||||||
$basketItem->setDeliveryDate((string)$data->deliveryDate);
|
$basketItem->setDeliveryDate((string) $data->deliveryDate);
|
||||||
$basketItem->setDeliveryInfo((string)$data->deliveryInfo);
|
$basketItem->setDeliveryInfo((string) $data->deliveryInfo);
|
||||||
if ((string)$data->ref != "") {
|
if (((string) $data->ref) != '') {
|
||||||
$basketItem->setRef($data->ref);
|
$basketItem->setRef($data->ref);
|
||||||
}
|
}
|
||||||
if ((string)$data->basketField1 != "") {
|
if (((string) $data->basketField1) != '') {
|
||||||
$basketItem->setRef($data->basketField1);
|
$basketItem->setRef($data->basketField1);
|
||||||
}
|
}
|
||||||
if ((string)$data->basketField2 != "") {
|
if (((string) $data->basketField2) != '') {
|
||||||
$basketItem->setKst($data->basketField2);
|
$basketItem->setKst($data->basketField2);
|
||||||
}
|
}
|
||||||
$basketItem->setXmlProduct((string)$data->xmlProduct);
|
$basketItem->setXmlProduct((string) $data->xmlProduct);
|
||||||
if ((string)$data->layouterUuid != "") {
|
if (((string) $data->layouterUuid) != '') {
|
||||||
$basketItem->setLayouterId((string)$data->layouterUuid);
|
$basketItem->setLayouterId((string) $data->layouterUuid);
|
||||||
}
|
}
|
||||||
$itemId = $articles->addItem($basketItem);
|
$itemId = $articles->addItem($basketItem);
|
||||||
if ($data->clearTempItem) {
|
if ($data->clearTempItem) {
|
||||||
@ -91,6 +94,6 @@ class Add extends AbstractController
|
|||||||
return $this->json(new Output());
|
return $this->json(new Output());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->json(new NotFound("order not found"));
|
return $this->json(new NotFound('order not found'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,67 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -4,50 +4,21 @@ namespace Plugin\Custom\PSC\LaufkartenLayouter\Controller;
|
|||||||
|
|
||||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
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 PSC\Shop\EntityBundle\Entity\Product;
|
||||||
|
use Symfony\Bridge\Twig\Attribute\Template;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
use Twig\Environment;
|
|
||||||
use Twig\Loader\FilesystemLoader;
|
|
||||||
|
|
||||||
#[Route('/designer')]
|
#[Route('/designer')]
|
||||||
class DesignerController extends AbstractController
|
class DesignerController extends AbstractController
|
||||||
{
|
{
|
||||||
#[Route('/load/{productId}/{layouterId}', name: 'psc_plugin_laufkartenlayouter_load')]
|
#[Template('@PluginCustomPSCLaufkartenLayouter/designer/start.html.twig')]
|
||||||
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,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[Route('/start/{productId}/{layouterId}', name: 'psc_plugin_laufkartenlayouter_start')]
|
#[Route('/start/{productId}/{layouterId}', name: 'psc_plugin_laufkartenlayouter_start')]
|
||||||
public function startAction(
|
public function startAction(
|
||||||
Request $request,
|
Request $request,
|
||||||
EntityManagerInterface $entityManager,
|
EntityManagerInterface $entityManager,
|
||||||
DocumentManager $documentManager,
|
DocumentManager $documentManager,
|
||||||
Layouter $formLayouter,
|
|
||||||
$productId,
|
$productId,
|
||||||
$layouterId = '',
|
$layouterId = '',
|
||||||
) {
|
) {
|
||||||
@ -65,68 +36,6 @@ class DesignerController extends AbstractController
|
|||||||
->getRepository('PSC\Shop\EntityBundle\Document\Product')
|
->getRepository('PSC\Shop\EntityBundle\Document\Product')
|
||||||
->findOneBy(['uid' => (string) $product->getUid()]);
|
->findOneBy(['uid' => (string) $product->getUid()]);
|
||||||
|
|
||||||
$session = new LaufkartenLayouter();
|
return [];
|
||||||
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]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,73 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Controller;
|
|
||||||
|
|
||||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
|
||||||
use MongoDB\BSON\ObjectId;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
|
||||||
|
|
||||||
#[Route('/image')]
|
|
||||||
class ImageController extends AbstractController
|
|
||||||
{
|
|
||||||
|
|
||||||
#[Route('/info/{id}', name: 'psc_plugin_laufkartenlayouter_image_info')]
|
|
||||||
public function infoAction(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)]);
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,118 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Controller;
|
|
||||||
|
|
||||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use Plugin\Custom\PSC\LaufkartenLayouter\Renderer\Pdf;
|
|
||||||
use Plugin\Custom\PSC\LaufkartenLayouter\Service\Layouter;
|
|
||||||
use Plugin\Custom\PSC\LaufkartenLayouter\Session\LaufkartenLayouter;
|
|
||||||
use PSC\Shop\EntityBundle\Entity\Product;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
|
|
||||||
#[Route('/pdf')]
|
|
||||||
class PdfController extends AbstractController
|
|
||||||
{
|
|
||||||
|
|
||||||
#[Route('/pdf/preview/{productId}', name: 'psc_plugin_laufkartenlayouter_pdf_preview')]
|
|
||||||
public function previewAction(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->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;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,144 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Controller;
|
|
||||||
|
|
||||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use Plugin\Custom\PSC\LaufkartenLayouter\Renderer\Pdf;
|
|
||||||
use Plugin\Custom\PSC\LaufkartenLayouter\Service\Layouter;
|
|
||||||
use PSC\Shop\EntityBundle\Entity\Layoutdesigndata;
|
|
||||||
use PSC\Shop\EntityBundle\Entity\Product;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
|
|
||||||
#[Route('/preview')]
|
|
||||||
class PreviewController extends AbstractController
|
|
||||||
{
|
|
||||||
|
|
||||||
#[Route('/image/{productId}/{site}/{width}/{height}', name: 'psc_plugin_laufkartenlayouter_preview_image')]
|
|
||||||
public function imageAction(Request $request, EntityManagerInterface $entityManager, DocumentManager $documentManager, Layouter $formLayouter, Pdf $renderer, $productId, $site = 1, $width = 400, $height = 900)
|
|
||||||
{
|
|
||||||
|
|
||||||
$width = round($width);
|
|
||||||
$height = round($height);
|
|
||||||
|
|
||||||
/** @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'));
|
|
||||||
|
|
||||||
$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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,67 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Controller;
|
|
||||||
|
|
||||||
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use Plugin\Custom\PSC\LaufkartenLayouter\Session\LaufkartenLayouter;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
|
||||||
|
|
||||||
#[Route('/store')]
|
|
||||||
class StoreController extends AbstractController
|
|
||||||
{
|
|
||||||
|
|
||||||
#[Route('/save', name: 'psc_plugin_laufkartenlayouter_store_save')]
|
|
||||||
public function saveAction(Request $request, EntityManagerInterface $entityManager)
|
|
||||||
{
|
|
||||||
|
|
||||||
$uuid = $request->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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,102 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Controller;
|
|
||||||
|
|
||||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
|
||||||
use Gaufrette\Filesystem;
|
|
||||||
use Gaufrette\FilesystemMapInterface;
|
|
||||||
use Knp\Bundle\GaufretteBundle\FilesystemMap;
|
|
||||||
use MongoDB\BSON\ObjectId;
|
|
||||||
use Plugin\Custom\PSC\LaufkartenLayouter\Document\Image;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
|
||||||
|
|
||||||
#[Route('/upload')]
|
|
||||||
class UploadController extends AbstractController
|
|
||||||
{
|
|
||||||
#[Route('/single', name: 'psc_plugin_laufkartenlayouter_upload_single')]
|
|
||||||
public function singleAction(Request $request, DocumentManager $documentManager, FilesystemMap $filesystemMap)
|
|
||||||
{
|
|
||||||
if ($request->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]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,197 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,81 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Form\Field;
|
|
||||||
|
|
||||||
use PSC\System\PluginBundle\Form\Interfaces\Field;
|
|
||||||
use PSC\System\SettingsBundle\Service\Status;
|
|
||||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Component\Form\FormEvent;
|
|
||||||
|
|
||||||
class BackendFields extends \PSC\System\PluginBundle\Form\Field implements Field
|
|
||||||
{
|
|
||||||
|
|
||||||
protected $tab = 'uploads';
|
|
||||||
|
|
||||||
private $statusService;
|
|
||||||
|
|
||||||
public function __construct(Status $statusService)
|
|
||||||
{
|
|
||||||
$this->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)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,143 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Form\Field;
|
|
||||||
|
|
||||||
use DirectoryIterator;
|
|
||||||
use Plugin\Custom\PSC\LaufkartenLayouter\Form\Group\LaufkartenLayouterEditor;
|
|
||||||
use PSC\System\PluginBundle\Form\Interfaces\Field;
|
|
||||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Component\Form\FormEvent;
|
|
||||||
|
|
||||||
class EnableEditor implements Field
|
|
||||||
{
|
|
||||||
|
|
||||||
public function getTemplate()
|
|
||||||
{
|
|
||||||
return '@PluginCustomPSCLaufkartenLayouter/form/field/enable_editor.html.twig';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getModule()
|
|
||||||
{
|
|
||||||
return Field::Theme;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array $data
|
|
||||||
*/
|
|
||||||
public function formPreSubmit(FormEvent $event)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
||||||
{
|
|
||||||
$txtheader = "";
|
|
||||||
$txtfooter = "";
|
|
||||||
$this->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.
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,67 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Form;
|
|
||||||
|
|
||||||
use Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Step;
|
|
||||||
use Plugin\Custom\PSC\LaufkartenLayouter\Session\LaufkartenLayouter;
|
|
||||||
use PSC\Shop\MediaBundle\Service\MediaManager;
|
|
||||||
use Symfony\Component\Form\AbstractType;
|
|
||||||
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
|
||||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
|
||||||
use Symfony\Component\Form\Form;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
||||||
|
|
||||||
class FormDesigner extends AbstractType
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var MediaManager
|
|
||||||
*/
|
|
||||||
private $mediaManager;
|
|
||||||
|
|
||||||
public function __construct(MediaManager $mediaManager)
|
|
||||||
{
|
|
||||||
$this->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,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Form\Group;
|
|
||||||
|
|
||||||
use PSC\Shop\EntityBundle\Entity\Cms;
|
|
||||||
use PSC\System\PluginBundle\Form\Group;
|
|
||||||
use PSC\System\PluginBundle\Form\Interfaces\Field;
|
|
||||||
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
|
||||||
use Symfony\Component\Form\Form;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
|
||||||
|
|
||||||
class LaufkartenLayouter extends Group
|
|
||||||
{
|
|
||||||
const GROUP_ID = 'laufkartenlayouter';
|
|
||||||
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->title = 'Step Layouter';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getModule()
|
|
||||||
{
|
|
||||||
return Field::Product;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getId()
|
|
||||||
{
|
|
||||||
return self::GROUP_ID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Form\Group;
|
|
||||||
|
|
||||||
use PSC\Shop\EntityBundle\Entity\Cms;
|
|
||||||
use PSC\System\PluginBundle\Form\Group;
|
|
||||||
use PSC\System\PluginBundle\Form\Interfaces\Field;
|
|
||||||
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
|
||||||
use Symfony\Component\Form\Form;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
|
||||||
|
|
||||||
class LaufkartenLayouterEditor extends Group
|
|
||||||
{
|
|
||||||
const GROUP_ID = 'laufkartenlayoutereditor';
|
|
||||||
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->title = 'Step Layouter';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getModule()
|
|
||||||
{
|
|
||||||
return Field::Theme;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getId()
|
|
||||||
{
|
|
||||||
return self::GROUP_ID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Plugin\Custom\PSC\LaufkartenLayouter\Form;
|
||||||
|
|
||||||
|
use PSC\System\PluginBundle\Form\Interfaces\Field;
|
||||||
|
use PSC\System\SettingsBundle\Service\Status;
|
||||||
|
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\Form\FormEvent;
|
||||||
|
|
||||||
|
#[AutoconfigureTag('psc.backend.custom.fields')]
|
||||||
|
class ProductSettings extends \PSC\System\PluginBundle\Form\Field implements Field
|
||||||
|
{
|
||||||
|
protected $tab = 'uploads';
|
||||||
|
|
||||||
|
public function __construct() {}
|
||||||
|
|
||||||
|
public function getTemplate(): string
|
||||||
|
{
|
||||||
|
return '@PluginCustomPSCLaufkartenLayouter/form/product_settings.html.twig';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getModule(): int
|
||||||
|
{
|
||||||
|
return Field::Product;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildForm(FormBuilderInterface $builder, array $options): FormBuilderInterface
|
||||||
|
{
|
||||||
|
$builder->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)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,54 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,75 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,71 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,214 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,132 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,109 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,118 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,304 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,65 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,180 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,42 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,114 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,73 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,73 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,54 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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()
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,54 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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()
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,169 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,40 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,71 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,100 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,46 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,37 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,37 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,67 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,71 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,78 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,239 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,12 +1,7 @@
|
|||||||
psc_shop_plugin_custom_laufkartenlayouter_frontend:
|
psc_shop_plugin_custom_laufkartenlayouter_frontend:
|
||||||
resource: "@PluginCustomPSCLaufkartenLayouter/Controller"
|
resource: "@PluginCustomPSCLaufkartenLayouter/Controller"
|
||||||
type: attribute
|
type: attribute
|
||||||
prefix: /plugin/laufkartenlayouter/api
|
prefix: /plugin/custom/psc/laufkartenlayouter/frontend
|
||||||
|
|
||||||
psc_shop_plugin_custom_laufkartenlayouter_backend:
|
|
||||||
resource: "@PluginCustomPSCLaufkartenLayouter/Controller/Backend"
|
|
||||||
type: attribute
|
|
||||||
prefix: /backend/plugin/laufkartenlayouter
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,24 +6,4 @@ services:
|
|||||||
Plugin\Custom\PSC\LaufkartenLayouter\:
|
Plugin\Custom\PSC\LaufkartenLayouter\:
|
||||||
resource: '../../*/*'
|
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" }
|
|
||||||
|
|||||||
@ -1,60 +0,0 @@
|
|||||||
{% extends 'backend_base.html.twig' %}
|
|
||||||
|
|
||||||
{% block body %}
|
|
||||||
<div class="header">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-xs-12 col-sm-8 col-md-8 col-lg-8">
|
|
||||||
<h3>
|
|
||||||
<i class="fa-fw fa fa-tags"></i>
|
|
||||||
Step Layouter <span>>
|
|
||||||
XML Bearbeiten </span>
|
|
||||||
<a target="_blank" href="/article/show/uuid/{{ product.uuid }}">Anzeigen</a>
|
|
||||||
</h3>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4 text-end">
|
|
||||||
<a href="{{ path("backend_production_product_edit", {uuid: product.uuid}) }}" class="btn btn-default btn-sm"><i class="fa fa-lg fa-fw fa-arrow-left"></i> Zurück</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="body">
|
|
||||||
<div class="panel">
|
|
||||||
<div class="header">
|
|
||||||
<h5>{{ product.title }}</h5>
|
|
||||||
</div>
|
|
||||||
<div class="body">
|
|
||||||
|
|
||||||
{{ form_start(form, { 'attr': {'class': 'smart-form'}}) }}
|
|
||||||
{{ form_errors(form) }}
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<div class="form-group row">
|
|
||||||
<label class="col-md-2 form-control-label">{{ form_label(form.uuid) }}</label>
|
|
||||||
<div class="col-md-10 state-disabled">
|
|
||||||
{{ form_widget(form.uuid) }}
|
|
||||||
<b class="tooltip tooltip-top-left">
|
|
||||||
<i class="fa fa-warning txt-color-teal"></i>
|
|
||||||
UUID des Produktes</b>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
{{ form_widget(form.xml) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<br/>
|
|
||||||
<div class="form-group row">
|
|
||||||
<div class="col-md-offset-1 col-md-11">
|
|
||||||
{{ form_widget(form.save, {attr: {class: 'btn btn-primary btn-sm'}}) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{ form_end(form) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{ summernote_mediabundle_init() }}
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -1,30 +0,0 @@
|
|||||||
<div class="panel panel-default steplayouter">
|
|
||||||
<div class="header"><h5>Step Layouter</h5></div>
|
|
||||||
<div class="body">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-5">
|
|
||||||
<div class="form-group row">
|
|
||||||
{{ form_label(form.laufkartenlayouter.laufkartenlayouter) }}
|
|
||||||
<div class="col-md-8">
|
|
||||||
<div class="checkbox">
|
|
||||||
{{ form_widget(form.laufkartenlayouter.laufkartenlayouter) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-7">
|
|
||||||
<div class="form-group row">
|
|
||||||
{{ form_label(form.laufkartenlayouter.laufkartenlayouter2InitalStatus) }}
|
|
||||||
<div class="col-md-8">
|
|
||||||
{{ form_widget(form.laufkartenlayouter.laufkartenlayouter2InitalStatus) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4">
|
|
||||||
<a href="{{ path("psc_plugin_laufkartenlayouter_backend_xml_edit", {uuid: product.uuid}) }}" class="btn btn-primary btn-sm">XML bearbeiten</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<div class="form-group row">
|
|
||||||
<label class="col-md-3 form-control-label">{{ form_label(form.laufkartenlayoutereditor.header) }}</label>
|
|
||||||
<div class="col-md-9">
|
|
||||||
{{ form_widget(form.laufkartenlayoutereditor.header, {attr: {'class': 'form-control'}}) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group row">
|
|
||||||
<label class="col-md-3 form-control-label">{{ form_label(form.laufkartenlayoutereditor.footer) }}</label>
|
|
||||||
<div class="col-md-9">
|
|
||||||
{{ form_widget(form.laufkartenlayoutereditor.footer, {attr: {'class': 'form-control'}}) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="header"><h5>Laufkarten Layouter</h5></div>
|
||||||
|
<div class="body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-5">
|
||||||
|
<div class="form-group row">
|
||||||
|
{{ form_label(form.laufkartenlayouter.active) }}
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="checkbox">
|
||||||
|
{{ form_widget(form.laufkartenlayouter.active) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@ -1,70 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,119 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PrintshopCreator Suite
|
|
||||||
*
|
|
||||||
* PHP Version 5.3
|
|
||||||
*
|
|
||||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
|
||||||
* @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 <p>
|
|
||||||
* The string representation of the object.
|
|
||||||
* </p>
|
|
||||||
* @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];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,191 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Plugin\Custom\PSC\Printess\Form;
|
|
||||||
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use Doctrine\ORM\EntityRepository;
|
|
||||||
use Plugin\System\PSC\FormLayouter\Form\Group\FormLayouter;
|
|
||||||
use Plugin\System\PSC\HPLayouter\Form\Group\HPLayouter;
|
|
||||||
use PSC\Shop\EntityBundle\Entity\Account;
|
|
||||||
use PSC\Shop\EntityBundle\Entity\Cms;
|
|
||||||
use PSC\Shop\EntityBundle\Entity\Product;
|
|
||||||
use PSC\System\PluginBundle\Form\Interfaces\Field;
|
|
||||||
use PSC\System\SettingsBundle\Service\Shop;
|
|
||||||
use PSC\System\SettingsBundle\Service\Status;
|
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
|
||||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
|
||||||
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
|
||||||
use Symfony\Component\Form\Form;
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
|
||||||
use Symfony\Component\Form\FormEvent;
|
|
||||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
|
||||||
|
|
||||||
class BackendFields extends \PSC\System\PluginBundle\Form\Field implements Field
|
|
||||||
{
|
|
||||||
protected $tab = 'uploads';
|
|
||||||
|
|
||||||
private $statusService;
|
|
||||||
/**
|
|
||||||
* @var Shop
|
|
||||||
*/
|
|
||||||
private Shop $shopService;
|
|
||||||
/**
|
|
||||||
* @var EntityManagerInterface
|
|
||||||
*/
|
|
||||||
private EntityManagerInterface $entityManager;
|
|
||||||
|
|
||||||
public function __construct(Status $statusService, Shop $shopService, EntityManagerInterface $entityManager)
|
|
||||||
{
|
|
||||||
$this->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(),
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user