backup
This commit is contained in:
parent
7e7628bbd3
commit
1ff03906c2
@ -64,10 +64,10 @@ server {
|
||||
try_files $uri @sfFront;
|
||||
}
|
||||
|
||||
# location /w2p/ {
|
||||
# proxy_pass http://tp:8080/w2p/;
|
||||
# proxy_temp_path /tmp/proxy;
|
||||
#}
|
||||
location /w2p/ {
|
||||
proxy_pass http://tp:8080/w2p/;
|
||||
proxy_temp_path /tmp/proxy;
|
||||
}
|
||||
|
||||
location @sfFront { # Symfony
|
||||
if ($request_method = 'OPTIONS') {
|
||||
|
||||
@ -474,7 +474,7 @@ namespace Symfony\Component\DependencyInjection\Loader\Configurator;
|
||||
* datetime?: array{
|
||||
* default_format?: scalar|null, // Default: "Y-m-d\\TH:i:sP"
|
||||
* default_deserialization_formats?: list<scalar|null>,
|
||||
* default_timezone?: scalar|null, // Default: "UTC"
|
||||
* default_timezone?: scalar|null, // Default: "Europe/Berlin"
|
||||
* cdata?: scalar|null, // Default: true
|
||||
* },
|
||||
* array_collection?: array{
|
||||
@ -574,7 +574,7 @@ namespace Symfony\Component\DependencyInjection\Loader\Configurator;
|
||||
* datetime?: array{
|
||||
* default_format?: scalar|null, // Default: "Y-m-d\\TH:i:sP"
|
||||
* default_deserialization_formats?: list<scalar|null>,
|
||||
* default_timezone?: scalar|null, // Default: "UTC"
|
||||
* default_timezone?: scalar|null, // Default: "Europe/Berlin"
|
||||
* cdata?: scalar|null, // Default: true
|
||||
* },
|
||||
* array_collection?: array{
|
||||
@ -2457,7 +2457,7 @@ namespace Symfony\Component\DependencyInjection\Loader\Configurator;
|
||||
* length?: scalar|null, // Default: 5
|
||||
* width?: scalar|null, // Default: 130
|
||||
* height?: scalar|null, // Default: 50
|
||||
* font?: scalar|null, // Default: "/application/src/new/vendor/gregwar/captcha-bundle/DependencyInjection/../Generator/Font/captcha.ttf"
|
||||
* font?: scalar|null, // Default: "/data/www/new/vendor/gregwar/captcha-bundle/DependencyInjection/../Generator/Font/captcha.ttf"
|
||||
* keep_value?: scalar|null, // Default: false
|
||||
* charset?: scalar|null, // Default: "abcdefhjkmnprstuvwxyz23456789"
|
||||
* as_file?: scalar|null, // Default: false
|
||||
|
||||
@ -8,6 +8,7 @@ use LogicException;
|
||||
use Port\Csv\CsvWriter;
|
||||
use Port\Reader\ArrayReader;
|
||||
use PSC\Backend\ToolsBundle\Export\Writer\ExcelWriter;
|
||||
use PSC\Backend\ToolsBundle\Interfaces\ConfigurableElementInterface;
|
||||
use PSC\Backend\ToolsBundle\Interfaces\ExporterInterface;
|
||||
use PSC\Backend\ToolsBundle\Service\ExporterRegistry;
|
||||
use PSC\Shop\EntityBundle\Entity\Contact;
|
||||
@ -22,15 +23,19 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
|
||||
use Symfony\Component\Validator\Constraints\Date;
|
||||
use Symfony\Component\Validator\Constraints\DateTime;
|
||||
|
||||
class ContactExporter implements ExporterInterface
|
||||
class ContactExporter implements ExporterInterface, ConfigurableElementInterface
|
||||
{
|
||||
private $_formFactory = null;
|
||||
private $_entityManager = null;
|
||||
private $_shopService = null;
|
||||
/** @var Form */
|
||||
private $_form = null;
|
||||
public function __construct(FormFactoryInterface $formFactory, EntityManagerInterface $entityManager, Shop $shopService)
|
||||
{
|
||||
|
||||
public function __construct(
|
||||
FormFactoryInterface $formFactory,
|
||||
EntityManagerInterface $entityManager,
|
||||
Shop $shopService,
|
||||
) {
|
||||
$this->_formFactory = $formFactory;
|
||||
$this->_entityManager = $entityManager;
|
||||
$this->_shopService = $shopService;
|
||||
@ -51,6 +56,11 @@ class ContactExporter implements ExporterInterface
|
||||
|
||||
public function getForm(FormBuilderInterface $builder, $form_options)
|
||||
{
|
||||
$builder->add('fotos', CheckboxType::class, ['required' => false, 'label' => 'Fotos mit exportieren?']);
|
||||
$builder->add('fotosFolder', TextType::class, [
|
||||
'required' => false,
|
||||
'label' => 'Pfad für die Fotos z.B.: /data/www/old/data/packages/fotos/{{ media.uuid }}.{{media.extension}}',
|
||||
]);
|
||||
}
|
||||
|
||||
public function getGroup()
|
||||
@ -68,9 +78,12 @@ class ContactExporter implements ExporterInterface
|
||||
*/
|
||||
public function export()
|
||||
{
|
||||
$rows = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->getContactsByShop($this->_shopService->getSelectedShop());
|
||||
$temp = array();
|
||||
$temp[] = array(
|
||||
$formData = $this->_form->getData();
|
||||
$rows = $this->_entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Contact')
|
||||
->getContactsByShop($this->_shopService->getSelectedShop());
|
||||
$temp = [];
|
||||
$temp[] = [
|
||||
'id' => 'id',
|
||||
'uid' => 'uid',
|
||||
'account_id' => 'account_id',
|
||||
@ -108,19 +121,21 @@ class ContactExporter implements ExporterInterface
|
||||
'alternativAppendix' => 'alternativAppendix',
|
||||
'alternativ' => 'alternativ',
|
||||
'alternativType' => 'alternativType',
|
||||
'birthday' => 'birthday'
|
||||
);
|
||||
'birthday' => 'birthday',
|
||||
'image1' => 'image1',
|
||||
'image2' => 'image2',
|
||||
];
|
||||
foreach ($rows as $row) {
|
||||
/** @var Contact $contact */
|
||||
$contact = $row->getContact();
|
||||
$temp[] = array(
|
||||
$temp[] = [
|
||||
'id' => $contact->getId(),
|
||||
'uid' => $contact->getId(),
|
||||
'account_id' => ($contact->getAccount() ? (string)$contact->getAccount()->getId() : 0),
|
||||
'account_title' => ($contact->getAccount() ? (string)$contact->getAccount()->getTitle() : 0),
|
||||
'enable' => (int)$contact->isEnable(),
|
||||
'locked' => (int)$contact->isLocked(),
|
||||
'virtual' => (int)$contact->isVirtual(),
|
||||
'account_id' => $contact->getAccount() ? ((string) $contact->getAccount()->getId()) : 0,
|
||||
'account_title' => $contact->getAccount() ? ((string) $contact->getAccount()->getTitle()) : 0,
|
||||
'enable' => (int) $contact->isEnable(),
|
||||
'locked' => (int) $contact->isLocked(),
|
||||
'virtual' => (int) $contact->isVirtual(),
|
||||
'username' => $contact->getUsername(),
|
||||
'firstname' => $contact->getFirstname(),
|
||||
'lastname' => $contact->getLastname(),
|
||||
@ -151,15 +166,22 @@ class ContactExporter implements ExporterInterface
|
||||
'alternativAppendix' => $contact->getAlternativAppendix(),
|
||||
'alternativ' => $contact->getAlternativ(),
|
||||
'alternativType' => $contact->getAlternativType(),
|
||||
'birthday' => $contact->getBirthday()
|
||||
);
|
||||
'birthday' => $contact->getBirthday(),
|
||||
'image1' => $contact->getImage1() ?? '',
|
||||
'image2' => $contact->getImage2() ?? '',
|
||||
];
|
||||
if ($formData['fotos'] && $contact->getImage1() != '') {
|
||||
$this->mediaManager->copyMediaToFolder($contact->getImage1(), $formData['fotosFolder']);
|
||||
}
|
||||
if ($formData['fotos'] && $contact->getImage2() != '') {
|
||||
$this->mediaManager->copyMediaToFolder($contact->getImage2(), $formData['fotosFolder']);
|
||||
}
|
||||
}
|
||||
|
||||
$reader = new ArrayReader($temp);
|
||||
$writer = new CsvWriter();
|
||||
$writer->setStream(fopen('php://output', 'w'));
|
||||
$response = new StreamedResponse(function () use ($reader, $writer) {
|
||||
|
||||
foreach ($reader as $row) {
|
||||
$writer->writeItem($row);
|
||||
}
|
||||
|
||||
@ -4,19 +4,25 @@ namespace PSC\Backend\ToolsBundle\Exporter\Excel;
|
||||
|
||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use MongoDB\BSON\ObjectId;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
use PSC\Backend\ToolsBundle\Interfaces\ConfigurableElementInterface;
|
||||
use PSC\Backend\ToolsBundle\Interfaces\ExporterInterface;
|
||||
use PSC\Backend\ToolsBundle\Service\ExporterRegistry;
|
||||
use PSC\Shop\EntityBundle\Document\Contact as PSCContact;
|
||||
use PSC\Shop\EntityBundle\Entity\Contact;
|
||||
use PSC\Shop\MediaBundle\Document\Media;
|
||||
use PSC\Shop\MediaBundle\Service\MediaManager;
|
||||
use PSC\System\SettingsBundle\Service\Shop;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\Form;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormFactoryInterface;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
|
||||
class ContactExporter implements ExporterInterface
|
||||
class ContactExporter implements ExporterInterface, ConfigurableElementInterface
|
||||
{
|
||||
/** @var Form */
|
||||
private $_form = null;
|
||||
@ -25,6 +31,7 @@ class ContactExporter implements ExporterInterface
|
||||
private FormFactoryInterface $formFactory,
|
||||
private EntityManagerInterface $entityManager,
|
||||
private DocumentManager $mongoManager,
|
||||
private MediaManager $mediaManager,
|
||||
private Shop $shopService,
|
||||
) {}
|
||||
|
||||
@ -43,6 +50,11 @@ class ContactExporter implements ExporterInterface
|
||||
|
||||
public function getForm(FormBuilderInterface $builder, $form_options)
|
||||
{
|
||||
$builder->add('fotos', CheckboxType::class, ['required' => false, 'label' => 'Fotos mit exportieren?']);
|
||||
$builder->add('fotosFolder', TextType::class, [
|
||||
'required' => false,
|
||||
'label' => 'Pfad für die Fotos z.B.: /data/www/old/data/packages/fotos/{{ media.uuid }}.{{media.extension}}',
|
||||
]);
|
||||
}
|
||||
|
||||
public function getGroup()
|
||||
@ -60,6 +72,7 @@ class ContactExporter implements ExporterInterface
|
||||
*/
|
||||
public function export()
|
||||
{
|
||||
$formData = $this->_form->getData();
|
||||
$rows = $this->entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Contact')
|
||||
->getContactsByShop($this->shopService->getSelectedShop());
|
||||
@ -128,6 +141,8 @@ class ContactExporter implements ExporterInterface
|
||||
'custom22' => $shop->getCustomerFieldName22(),
|
||||
'custom23' => $shop->getCustomerFieldName23(),
|
||||
'custom24' => $shop->getCustomerFieldName24(),
|
||||
'image1' => 'image1',
|
||||
'image2' => 'image2',
|
||||
];
|
||||
foreach ($rows as $row) {
|
||||
/** @var Contact $contact */
|
||||
@ -200,9 +215,17 @@ class ContactExporter implements ExporterInterface
|
||||
'custom22' => $contactDoc ? $contactDoc->getCustom22() : '',
|
||||
'custom23' => $contactDoc ? $contactDoc->getCustom23() : '',
|
||||
'custom24' => $contactDoc ? $contactDoc->getCustom24() : '',
|
||||
'image1' => $contact->getImage1() ?? '',
|
||||
'image2' => $contact->getImage2() ?? '',
|
||||
];
|
||||
}
|
||||
|
||||
if ($formData['fotos'] && $contact->getImage1() != '') {
|
||||
$this->mediaManager->copyMediaToFolder($contact->getImage1(), $formData['fotosFolder']);
|
||||
}
|
||||
if ($formData['fotos'] && $contact->getImage2() != '') {
|
||||
$this->mediaManager->copyMediaToFolder($contact->getImage2(), $formData['fotosFolder']);
|
||||
}
|
||||
}
|
||||
$spreadsheet = new Spreadsheet();
|
||||
|
||||
$spreadsheet->getActiveSheet()->fromArray(
|
||||
|
||||
@ -2,15 +2,15 @@
|
||||
|
||||
namespace PSC\Backend\ToolsBundle\Exporter\Excel;
|
||||
|
||||
require_once(__DIR__ . '/../../../../Shop/EntityBundle/Lagacy/TP_Basket_Item.php');
|
||||
require_once __DIR__ . '/../../../../Shop/EntityBundle/Lagacy/TP_Basket_Item.php';
|
||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
use PSC\Backend\ToolsBundle\Interfaces\ConfigurableElementInterface;
|
||||
use PSC\Backend\ToolsBundle\Interfaces\ExporterInterface;
|
||||
use PSC\Backend\ToolsBundle\Service\ExporterRegistry;
|
||||
use PSC\Backend\ToolsBundle\Interfaces\ConfigurableElementInterface;
|
||||
use PSC\Library\Calc\Engine;
|
||||
use PSC\Library\Calc\PaperContainer;
|
||||
use PSC\Shop\EntityBundle\Document\Position;
|
||||
@ -25,24 +25,31 @@ use Symfony\Component\Form\Form;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormFactoryInterface;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
|
||||
class PositionExporter implements ExporterInterface, ConfigurableElementInterface
|
||||
{
|
||||
private $_formFactory = null;
|
||||
private $_entityManager = null;
|
||||
private $_securityContext = null;
|
||||
private $_shopService = null;
|
||||
/** @var Form */
|
||||
/** @var Form */
|
||||
private $_form = null;
|
||||
/**
|
||||
/**
|
||||
* @var PaperDB
|
||||
*/
|
||||
private PaperDB $_paperDbService;
|
||||
/**
|
||||
/**
|
||||
* @var DocumentManager
|
||||
*/
|
||||
private DocumentManager $_mongoDb;
|
||||
function __construct(FormFactoryInterface $formFactory, EntityManagerInterface $entityManager, Shop $shopService, PaperDB $paperDbService, DocumentManager $mongodb)
|
||||
{
|
||||
|
||||
function __construct(
|
||||
FormFactoryInterface $formFactory,
|
||||
EntityManagerInterface $entityManager,
|
||||
Shop $shopService,
|
||||
PaperDB $paperDbService,
|
||||
DocumentManager $mongodb,
|
||||
) {
|
||||
$this->_formFactory = $formFactory;
|
||||
$this->_entityManager = $entityManager;
|
||||
$this->_shopService = $shopService;
|
||||
@ -68,8 +75,8 @@ class PositionExporter implements ExporterInterface, ConfigurableElementInterfac
|
||||
$builder->add('product', EntityType::class, array(
|
||||
'class' => Product::class,
|
||||
'query_builder' => function (EntityRepository $er) {
|
||||
|
||||
return $er->createQueryBuilder('g')
|
||||
return $er
|
||||
->createQueryBuilder('g')
|
||||
->andWhere('g.shop = :shop and g.originalProduct = 0')
|
||||
->setParameter('shop', $this->_shopService->getSelectedShop()->getUid())
|
||||
->orderBy('g.title', 'ASC');
|
||||
@ -77,11 +84,15 @@ class PositionExporter implements ExporterInterface, ConfigurableElementInterfac
|
||||
'choice_label' => 'title',
|
||||
'required' => false,
|
||||
'placeholder' => 'Alle',
|
||||
'label' => 'Vorgänger'
|
||||
'label' => 'Vorgänger',
|
||||
));
|
||||
$builder->add('from', DateType::class, array('label' => 'Von', 'attr' => array('class' => 'form-element')));
|
||||
$builder->add('to', DateType::class, array('label' => 'Bis', 'attr' => array('class' => 'form-element')));
|
||||
$builder->add('calc_options', TextType::class, array(
|
||||
'label' => 'Kalkulationsoptionen (auflage,papier)',
|
||||
'required' => false,
|
||||
'attr' => array('class' => 'form-element'),
|
||||
));
|
||||
$builder->add("from", DateType::class, array('label' => 'Von', 'attr' => array('class' => 'form-element')));
|
||||
$builder->add("to", DateType::class, array('label' => 'Bis', 'attr' => array('class' => 'form-element')));
|
||||
$builder->add("calc_options", TextType::class, array('label' => 'Kalkulationsoptionen (auflage,papier)', 'required' => false, 'attr' => array('class' => 'form-element')));
|
||||
}
|
||||
|
||||
public function getGroup()
|
||||
@ -102,15 +113,17 @@ class PositionExporter implements ExporterInterface, ConfigurableElementInterfac
|
||||
$formData = $this->_form->getData();
|
||||
$orderRepository = $this->_entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Orderpos');
|
||||
if ($formData['product'] === null) {
|
||||
$qb = $orderRepository->createQueryBuilder('o')
|
||||
->where("o.createdDate >= :from and o.createdDate <= :to and o.shop = :shop")
|
||||
$qb = $orderRepository
|
||||
->createQueryBuilder('o')
|
||||
->where('o.createdDate >= :from and o.createdDate <= :to and o.shop = :shop')
|
||||
->setParameter('from', $formData['from'])
|
||||
->setParameter('to', $formData['to'])
|
||||
->setParameter('shop', $this->_shopService->getSelectedShop()->getId())
|
||||
->getQuery();
|
||||
} else {
|
||||
$qb = $orderRepository->createQueryBuilder('o')
|
||||
->where("o.createdDate >= :from and o.createdDate <= :to and o.shop = :shop AND o.product = :product")
|
||||
$qb = $orderRepository
|
||||
->createQueryBuilder('o')
|
||||
->where('o.createdDate >= :from and o.createdDate <= :to and o.shop = :shop AND o.product = :product')
|
||||
->setParameter('from', $formData['from'])
|
||||
->setParameter('to', $formData['to'])
|
||||
->setParameter('shop', $this->_shopService->getSelectedShop()->getId())
|
||||
@ -119,7 +132,7 @@ class PositionExporter implements ExporterInterface, ConfigurableElementInterfac
|
||||
}
|
||||
|
||||
$rows = $qb->getResult();
|
||||
$calcOptions = explode(",", $formData['calc_options']);
|
||||
$calcOptions = explode(',', $formData['calc_options']);
|
||||
$data[] = array();
|
||||
$temp = array(
|
||||
'order' => 'order',
|
||||
@ -144,7 +157,7 @@ class PositionExporter implements ExporterInterface, ConfigurableElementInterfac
|
||||
'productId' => 'articleId',
|
||||
'productTitle' => 'articleName',
|
||||
'weight' => 'weight',
|
||||
'articleName' => 'articleName'
|
||||
'articleName' => 'articleName',
|
||||
);
|
||||
foreach ($calcOptions as $key) {
|
||||
$temp[$key] = $key;
|
||||
@ -152,26 +165,32 @@ class PositionExporter implements ExporterInterface, ConfigurableElementInterfac
|
||||
|
||||
$data[] = $temp;
|
||||
$paperContainer = new PaperContainer();
|
||||
$paperContainer->parse(simplexml_load_string($this->_shopService->getSelectedShop()->getInstall()->getPaperContainer()));
|
||||
$paperContainer->parse(simplexml_load_string(
|
||||
$this->_shopService
|
||||
->getSelectedShop()
|
||||
->getInstall()
|
||||
->getPaperContainer(),
|
||||
));
|
||||
$engine = new Engine();
|
||||
$engine->setPaperRepository($this->_paperDbService);
|
||||
$engine->setPaperContainer($paperContainer);
|
||||
if ($this->_shopService->getSelectedShop()->getInstall()->getCalcTemplates()) {
|
||||
$engine->setTemplates('<root>' . $this->_shopService->getSelectedShop()->getInstall()->getCalcTemplates() . '</root>');
|
||||
$engine->setTemplates('<root>' . $this->_shopService
|
||||
->getSelectedShop()
|
||||
->getInstall()
|
||||
->getCalcTemplates() . '</root>');
|
||||
}
|
||||
|
||||
/** @var Orderpos $row */
|
||||
foreach ($rows as $row) {
|
||||
/** @var Position $objDoc */
|
||||
$objDoc = $this->_mongoDb
|
||||
->getRepository(Position::class)
|
||||
->findOneBy(['uid' => (string)$row->getId()]);
|
||||
/** @var Position $objDoc */
|
||||
$objDoc = $this->_mongoDb->getRepository(Position::class)->findOneBy(['uid' => (string) $row->getId()]);
|
||||
$temp = array(
|
||||
'order' => (string)$row->getOrder()->getAlias(),
|
||||
'pos' => (string)$row->getPos(),
|
||||
'created' => (string)$row->getOrder()->getCreated()->format('d.m.Y H:i:s'),
|
||||
'brutto' => (string)$row->getOrder()->getBrutto(),
|
||||
'contact' => (string)$row->getOrder()->getContact()->getEmail(),
|
||||
'order' => (string) $row->getOrder()->getAlias(),
|
||||
'pos' => (string) $row->getPos(),
|
||||
'created' => (string) $row->getOrder()->getCreated()->format('d.m.Y H:i:s'),
|
||||
'brutto' => (string) $row->getOrder()->getBrutto(),
|
||||
'contact' => (string) $row->getOrder()->getContact()->getEmail(),
|
||||
'invoice_company' => $row->getOrder()->getInvoiceAddress()->getCompany(),
|
||||
'invoice_firstname' => $row->getOrder()->getInvoiceAddress()->getFirstname(),
|
||||
'invoice_lastname' => $row->getOrder()->getInvoiceAddress()->getLastname(),
|
||||
@ -186,11 +205,11 @@ class PositionExporter implements ExporterInterface, ConfigurableElementInterfac
|
||||
'delivery_house_number' => $row->getOrder()->getDeliveryAddress()->getHouseNumber(),
|
||||
'delivery_zip' => $row->getOrder()->getDeliveryAddress()->getZip(),
|
||||
'delivery_city' => $row->getOrder()->getDeliveryAddress()->getCity(),
|
||||
'productId' => (string)$row->getProduct()->getId(),
|
||||
'productTitle' => (string)$row->getProduct()->getTitle(),
|
||||
'weight' => (string)$row->getWeight(),
|
||||
'productId' => (string) $row->getProduct()->getId(),
|
||||
'productTitle' => (string) $row->getProduct()->getTitle(),
|
||||
'weight' => (string) $row->getWeight(),
|
||||
);
|
||||
$objPosition = unserialize(($row->getData()));
|
||||
$objPosition = unserialize($row->getData());
|
||||
if ($row->hasCalcXml()) {
|
||||
$engine->loadString($row->getCalcXml());
|
||||
$engine->setVariables($objPosition->getOptions());
|
||||
@ -207,16 +226,16 @@ class PositionExporter implements ExporterInterface, ConfigurableElementInterfac
|
||||
$articleCalc = new \PSC\Library\Calc\Article($objPosition->getOptions()['kalk_artikel']);
|
||||
$temp['articleName'] = $objPosition->getOptions()['kalk_artikel'];
|
||||
} else {
|
||||
$articleCalc = new \PSC\Library\Calc\Article("test");
|
||||
$articleCalc = new \PSC\Library\Calc\Article('test');
|
||||
$temp['articleName'] = '';
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($calcOptions as $key) {
|
||||
if ($articleCalc->getOptionById($key)) {
|
||||
$temp[$key] = (string)$articleCalc->getOptionById($key)->getValue();
|
||||
$temp[$key] = (string) $articleCalc->getOptionById($key)->getValue();
|
||||
} else {
|
||||
$temp[$key] = "";
|
||||
$temp[$key] = '';
|
||||
}
|
||||
}
|
||||
|
||||
@ -225,13 +244,12 @@ class PositionExporter implements ExporterInterface, ConfigurableElementInterfac
|
||||
|
||||
$spreadsheet = new Spreadsheet();
|
||||
|
||||
$spreadsheet->getActiveSheet()
|
||||
->fromArray(
|
||||
$data, // The data to set
|
||||
NULL, // Array values with this value will not be set
|
||||
'A1' // Top left coordinate of the worksheet range where
|
||||
// we want to set these values (default is A1)
|
||||
);
|
||||
$spreadsheet->getActiveSheet()->fromArray(
|
||||
$data, // The data to set
|
||||
null, // Array values with this value will not be set
|
||||
'A1', // Top left coordinate of the worksheet range where
|
||||
// we want to set these values (default is A1)
|
||||
);
|
||||
|
||||
$writer = new Xlsx($spreadsheet);
|
||||
$writer->save('/tmp/test.xlsx');
|
||||
|
||||
@ -87,6 +87,16 @@ class Media
|
||||
return $this->variants;
|
||||
}
|
||||
|
||||
public function getCompletePath(): string
|
||||
{
|
||||
return '/data/www/new/web' . $this->url;
|
||||
}
|
||||
|
||||
public function getExtension(): string
|
||||
{
|
||||
return pathinfo($this->url, PATHINFO_EXTENSION);
|
||||
}
|
||||
|
||||
public function getVariant(string $settings): Media|Variant
|
||||
{
|
||||
foreach ($this->variants as $variant) {
|
||||
|
||||
@ -4,21 +4,34 @@ namespace PSC\Shop\MediaBundle\Service;
|
||||
|
||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
|
||||
use PSC\Shop\MediaBundle\Document\Media;
|
||||
use MongoDB\BSON\ObjectId;
|
||||
use PSC\Shop\EntityBundle\Entity\Contact;
|
||||
use PSC\Shop\MediaBundle\Document\Media;
|
||||
use PSC\Shop\MediaBundle\Model\Media as AliasedMedia;
|
||||
use PSC\Shop\MediaBundle\Transformer\Media as PSCMedia;
|
||||
use PSC\System\SettingsBundle\Document\LogEntry;
|
||||
use PSC\System\SettingsBundle\Service\Log;
|
||||
use PSC\System\SettingsBundle\Service\Shop;
|
||||
use Symfony\Component\Filesystem\Exception\IOExceptionInterface;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
|
||||
class MediaManager
|
||||
readonly class MediaManager
|
||||
{
|
||||
public function __construct(private readonly DocumentManager $mongoDb, private readonly CacheManager $cacheManager, private readonly PSCMedia $mediaTransformer)
|
||||
{
|
||||
}
|
||||
public function __construct(
|
||||
private DocumentManager $mongoDb,
|
||||
private CacheManager $cacheManager,
|
||||
private PSCMedia $mediaTransformer,
|
||||
private \Twig\Environment $template,
|
||||
private Filesystem $filesystem,
|
||||
private Shop $shopService,
|
||||
private Log $logService,
|
||||
) {}
|
||||
|
||||
public function getMedia($id)
|
||||
public function getMedia($id): null|Media
|
||||
{
|
||||
/** @var Media $media */
|
||||
$media = $this->mongoDb->getRepository('PSC\Shop\MediaBundle\Document\Media')
|
||||
$media = $this->mongoDb
|
||||
->getRepository('PSC\Shop\MediaBundle\Document\Media')
|
||||
->findOneBy(['_id' => new ObjectId($id)]);
|
||||
|
||||
return $media;
|
||||
@ -39,4 +52,31 @@ class MediaManager
|
||||
|
||||
return $resolvedPath;
|
||||
}
|
||||
|
||||
public function copyMediaToFolder(string $mediaId, string $folder): void
|
||||
{
|
||||
$media = $this->getModelByUuid($mediaId);
|
||||
$folder = $this->template->createTemplate($folder);
|
||||
|
||||
if ($media) {
|
||||
$target = $folder->render(['media' => $media]);
|
||||
try {
|
||||
$this->filesystem->mkdir(\dirname($target));
|
||||
$this->filesystem->copy($media->getCompletePath(), $target, true);
|
||||
} catch (IOExceptionInterface $e) {
|
||||
$this->logService->createLogEntry(
|
||||
$this->shopService->getSelectedShop(),
|
||||
new Contact(),
|
||||
LogEntry::INFO,
|
||||
self::class,
|
||||
$media->getUUId(),
|
||||
'copy error',
|
||||
[
|
||||
'from' => $media->getCompletePath(),
|
||||
'to' => $target,
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,15 +5,15 @@ namespace Plugin\Custom\PSC\FormBuilder\Controller\Backend;
|
||||
use Gesdinet\JWTRefreshTokenBundle\Generator\RefreshTokenGeneratorInterface;
|
||||
use Gesdinet\JWTRefreshTokenBundle\Model\RefreshTokenManagerInterface;
|
||||
use Lexik\Bundle\JWTAuthenticationBundle\Services\JWTTokenManagerInterface;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
use Symfony\Bridge\Twig\Attribute\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
#[Route('/product')]
|
||||
class ProductController extends AbstractController
|
||||
{
|
||||
#[Template('@PluginCustomPSCFormBuilderControllerBackend/product/edit.html.twig')]
|
||||
#[Template('@PluginCustomPSCFormBuilder/backend/product/edit.html.twig')]
|
||||
#[IsGranted('ROLE_USER')]
|
||||
#[Route(path: '/edit', name: 'psc_plugin_formbuilder_edit')]
|
||||
public function edit(
|
||||
|
||||
@ -1,15 +1,6 @@
|
||||
<?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\System\PSC\FormLayouter\Controller\Backend;
|
||||
|
||||
namespace Plugin\Custom\PSC\FormLayouter\Controller\Backend;
|
||||
|
||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@ -19,32 +10,37 @@ 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\Bridge\Twig\Attribute\Template;
|
||||
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;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\SecurityContext;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
|
||||
class XmlController extends AbstractController
|
||||
{
|
||||
|
||||
#[Template()]
|
||||
#[Template]
|
||||
#[Route(path: '/xml/edit/{uuid}', name: 'psc_plugin_formlayouter_backend_xml_edit')]
|
||||
public function editAction(Request $request, \PSC\System\SettingsBundle\Service\Shop $shopService, DocumentManager $documentManager, EntityManagerInterface $entityManager, $uuid)
|
||||
{
|
||||
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));
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Product')
|
||||
->findOneBy(['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()));
|
||||
->findOneBy(['uid' => (string) $product->getUid()]);
|
||||
|
||||
$data = ['uuid' => $product->getUUid(), 'xml' => $productDoc->getPluginSettingModule('formlayouter', 'xml')];
|
||||
|
||||
@ -54,14 +50,14 @@ class XmlController extends AbstractController
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$data = $form->getData();
|
||||
dump($data);
|
||||
$productDoc->setPluginSettingModule('formlayouter', 'xml', $data['xml']);
|
||||
$documentManager->persist($productDoc);
|
||||
$documentManager->flush();
|
||||
}
|
||||
return array(
|
||||
return [
|
||||
'form' => $form->createView(),
|
||||
'product' => $product
|
||||
);
|
||||
'product' => $product,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
namespace Plugin\System\PSC\FormLayouter\Controller;
|
||||
|
||||
namespace Plugin\Custom\PSC\FormLayouter\Controller;
|
||||
|
||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||
use MongoDB\BSON\ObjectId;
|
||||
@ -12,7 +13,6 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
#[Route('/image')]
|
||||
class ImageController extends AbstractController
|
||||
{
|
||||
|
||||
#[Route('/info/{id}', name: 'psc_plugin_formlayouter_image_info')]
|
||||
public function infoAction(Request $request, DocumentManager $documentManager, $id)
|
||||
{
|
||||
@ -28,15 +28,14 @@ class ImageController extends AbstractController
|
||||
'width' => $image->getCropWidth(),
|
||||
'height' => $image->getCropHeight(),
|
||||
'x' => $image->getCropX(),
|
||||
'y' => $image->getCropY()
|
||||
]
|
||||
'y' => $image->getCropY(),
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/original/{id}/{width}/{height}', name: 'psc_plugin_formlayouter_image_original')]
|
||||
public function imageAction(Request $request, DocumentManager $documentManager, $id, $width = 400, $height = 400)
|
||||
{
|
||||
|
||||
$width = round($width);
|
||||
$height = round($height);
|
||||
|
||||
@ -45,29 +44,32 @@ class ImageController extends AbstractController
|
||||
->getRepository('Plugin\System\PSC\FormLayouter\Document\Image')
|
||||
->findOneBy(['_id' => new ObjectId($id)]);
|
||||
|
||||
$outfilename = "temp/".md5($id);
|
||||
$outfilename = 'temp/' . md5($id);
|
||||
|
||||
$im = new \imagick("/data/www/new/web/market/motive/" . $image->getFileName());
|
||||
if($im->getImageWidth() < $width) {
|
||||
$im = new \imagick('/data/www/new/web/market/motive/' . $image->getFileName());
|
||||
if ($im->getImageWidth() < $width) {
|
||||
$width = $im->getImageWidth();
|
||||
}
|
||||
$im->setResolution(300,300);
|
||||
$im->setResolution(300, 300);
|
||||
$im->thumbnailimage($width, $height, true);
|
||||
$im->writeimage($outfilename.".png");
|
||||
$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->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"));
|
||||
$response->setContent(readfile($outfilename . '.png'));
|
||||
|
||||
unlink($outfilename);
|
||||
|
||||
return $response;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
namespace Plugin\System\PSC\FormLayouter\Controller;
|
||||
|
||||
namespace Plugin\Custom\PSC\FormLayouter\Controller;
|
||||
|
||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@ -14,23 +15,27 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
#[Route('/pdf')]
|
||||
class PdfController extends AbstractController
|
||||
{
|
||||
|
||||
#[Route('/pdf/preview/{productId}', name: 'psc_plugin_formlayouter_pdf_preview')]
|
||||
public function previewAction(Request $request, EntityManagerInterface $entityManager, DocumentManager $documentManager, Layouter $formLayouter, Pdf $renderer, $productId)
|
||||
{
|
||||
|
||||
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));
|
||||
->findOneBy(['uuid' => $productId]);
|
||||
|
||||
/** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */
|
||||
$productDoc = $documentManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Document\Product')
|
||||
->findOneBy(array('uid' => (string)$product->getUid()));
|
||||
->findOneBy(['uid' => (string) $product->getUid()]);
|
||||
|
||||
$session = new FormLayouter();
|
||||
if($request->getSession()->has('formlayouter')) {
|
||||
if ($request->getSession()->has('formlayouter')) {
|
||||
$session = $request->getSession()->get('formlayouter');
|
||||
}
|
||||
|
||||
@ -38,10 +43,10 @@ class PdfController extends AbstractController
|
||||
|
||||
$config = $formLayouter->getConfig();
|
||||
|
||||
$outfilename = "temp/".uniqid().".pdf";
|
||||
$outfilename = 'temp/' . uniqid() . '.pdf';
|
||||
|
||||
$session = new FormLayouter();
|
||||
if($request->getSession()->has('formlayouter')) {
|
||||
if ($request->getSession()->has('formlayouter')) {
|
||||
$session = $request->getSession()->get('formlayouter');
|
||||
}
|
||||
|
||||
@ -63,25 +68,29 @@ class PdfController extends AbstractController
|
||||
unlink($outfilename);
|
||||
|
||||
return $response;
|
||||
|
||||
}
|
||||
|
||||
#[Route('/pdf/print/{productId}', name: 'psc_plugin_formlayouter_pdf_print')]
|
||||
public function printAction(Request $request, EntityManagerInterface $entityManager, DocumentManager $documentManager, Layouter $formLayouter, Pdf $renderer, $productId)
|
||||
{
|
||||
|
||||
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));
|
||||
->findOneBy(['uuid' => $productId]);
|
||||
|
||||
/** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */
|
||||
$productDoc = $documentManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Document\Product')
|
||||
->findOneBy(array('uid' => (string)$product->getUid()));
|
||||
->findOneBy(['uid' => (string) $product->getUid()]);
|
||||
|
||||
$session = new FormLayouter();
|
||||
if($request->getSession()->has('formlayouter')) {
|
||||
if ($request->getSession()->has('formlayouter')) {
|
||||
$session = $request->getSession()->get('formlayouter');
|
||||
}
|
||||
|
||||
@ -89,10 +98,10 @@ class PdfController extends AbstractController
|
||||
|
||||
$config = $formLayouter->getConfig();
|
||||
|
||||
$outfilename = "temp/".uniqid().".pdf";
|
||||
$outfilename = 'temp/' . uniqid() . '.pdf';
|
||||
|
||||
$session = new FormLayouter();
|
||||
if($request->getSession()->has('formlayouter')) {
|
||||
if ($request->getSession()->has('formlayouter')) {
|
||||
$session = $request->getSession()->get('formlayouter');
|
||||
}
|
||||
|
||||
@ -113,6 +122,6 @@ class PdfController extends AbstractController
|
||||
unlink($outfilename);
|
||||
|
||||
return $response;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
namespace Plugin\System\PSC\FormLayouter\Controller;
|
||||
|
||||
namespace Plugin\Custom\PSC\FormLayouter\Controller;
|
||||
|
||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@ -14,26 +15,33 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
#[Route('/preview')]
|
||||
class PreviewController extends AbstractController
|
||||
{
|
||||
|
||||
#[Route('/image/{productId}/{site}/{width}/{height}', name: 'psc_plugin_formlayouter_preview_image')]
|
||||
public function imageAction(Request $request, EntityManagerInterface $entityManager, DocumentManager $documentManager, Layouter $formLayouter, Pdf $renderer, $productId, $site = 1, $width = 400, $height = 900)
|
||||
{
|
||||
|
||||
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));
|
||||
->findOneBy(['uuid' => $productId]);
|
||||
|
||||
/** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */
|
||||
$productDoc = $documentManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Document\Product')
|
||||
->findOneBy(array('uid' => (string)$product->getUid()));
|
||||
->findOneBy(['uid' => (string) $product->getUid()]);
|
||||
|
||||
$session = new FormLayouter();
|
||||
if($request->getSession()->has('formlayouter')) {
|
||||
if ($request->getSession()->has('formlayouter')) {
|
||||
$session = $request->getSession()->get('formlayouter');
|
||||
}
|
||||
|
||||
@ -42,10 +50,10 @@ class PreviewController extends AbstractController
|
||||
$actSite = $formLayouter->getSite($site);
|
||||
$config = $formLayouter->getConfig();
|
||||
|
||||
$outfilename = "temp/".uniqid().".pdf";
|
||||
$outfilename = 'temp/' . uniqid() . '.pdf';
|
||||
|
||||
$session = new FormLayouter();
|
||||
if($request->getSession()->has('formlayouter')) {
|
||||
if ($request->getSession()->has('formlayouter')) {
|
||||
$session = $request->getSession()->get('formlayouter');
|
||||
}
|
||||
|
||||
@ -58,87 +66,100 @@ class PreviewController extends AbstractController
|
||||
|
||||
$im->setCompressionQuality(89);
|
||||
|
||||
$im->setResolution(300,300);
|
||||
$im->readImage($outfilename."[0]");
|
||||
$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");
|
||||
// $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->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"));
|
||||
$response->setContent(readfile($outfilename . '.jpeg'));
|
||||
|
||||
unlink($outfilename.".jpeg");
|
||||
unlink($outfilename . '.jpeg');
|
||||
|
||||
return $response;
|
||||
|
||||
}
|
||||
|
||||
#[Route('/layouter/{layouterId}/{site}/{width}/{height}', name: 'psc_plugin_formlayouter_preview_layouter')]
|
||||
public function layouterAction(Request $request, EntityManagerInterface $entityManager, DocumentManager $documentManager, Layouter $formLayouter, Pdf $renderer, $layouterId, $site = 1, $width = 400, $height = 900)
|
||||
{
|
||||
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));
|
||||
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')
|
||||
->findOneBy(['uuid' => $layouterId]);
|
||||
|
||||
/** @var Product $product */
|
||||
$product = $documentManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Product')
|
||||
->findOneBy(array('uuid' => $layoutDesignData->getArticleUuid()));
|
||||
->findOneBy(['uuid' => $layoutDesignData->getArticleUuid()]);
|
||||
|
||||
/** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */
|
||||
$productDoc = $documentManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Document\Product')
|
||||
->findOneBy(array('uid' => (string)$product->getUid()));
|
||||
->findOneBy(['uid' => (string) $product->getUid()]);
|
||||
|
||||
$formLayouter->setXml($productDoc->getPluginSetting('formlayouter', 'xml'));
|
||||
|
||||
$actSite = $formLayouter->getSite($site);
|
||||
$config = $formLayouter->getConfig();
|
||||
|
||||
$outfilename = "temp/".uniqid().".pdf";
|
||||
$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) {
|
||||
$im = new \imagick($outfilename . '[0]');
|
||||
if ($im->getImageWidth() < $width) {
|
||||
$width = $im->getImageWidth();
|
||||
}
|
||||
$im->setResolution(300,300);
|
||||
$im->setResolution(300, 300);
|
||||
$im->thumbnailimage($width, $height, true);
|
||||
$im->writeimage($outfilename.".png");
|
||||
$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->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"));
|
||||
$response->setContent(readfile($outfilename . '.png'));
|
||||
|
||||
unlink($outfilename.".png");
|
||||
unlink($outfilename . '.png');
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
namespace Plugin\System\PSC\FormLayouter\Controller;
|
||||
|
||||
namespace Plugin\Custom\PSC\FormLayouter\Controller;
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Plugin\System\PSC\FormLayouter\Session\FormLayouter;
|
||||
@ -12,19 +12,17 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
#[Route('/store')]
|
||||
class StoreController extends AbstractController
|
||||
{
|
||||
|
||||
#[Route('/save', name: 'psc_plugin_formlayouter_store_save')]
|
||||
public function saveAction(Request $request, EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
||||
$uuid = $request->get("layouter");
|
||||
$articleUuid = $request->get("article");
|
||||
$uuid = $request->get('layouter');
|
||||
$articleUuid = $request->get('article');
|
||||
|
||||
$layoutDesignData = new Layoutdesigndata();
|
||||
$layoutDesignData->setUuid($uuid);
|
||||
$layoutDesignData->setArticleUuid($articleUuid);
|
||||
$session = new FormLayouter();
|
||||
if($request->getSession()->has('formlayouter')) {
|
||||
if ($request->getSession()->has('formlayouter')) {
|
||||
$session = $request->getSession()->get('formlayouter');
|
||||
}
|
||||
$layoutDesignData->setDesign($session->getOptions($articleUuid));
|
||||
@ -33,7 +31,7 @@ class StoreController extends AbstractController
|
||||
$entityManager->flush();
|
||||
|
||||
$json = new JsonResponse();
|
||||
$json->setContent(json_encode(array('success' => true)));
|
||||
$json->setContent(json_encode(['success' => true]));
|
||||
|
||||
return $json;
|
||||
}
|
||||
@ -41,16 +39,15 @@ class StoreController extends AbstractController
|
||||
#[Route('/update', name: 'psc_plugin_formlayouter_store_update')]
|
||||
public function updateAction(Request $request, EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
||||
$uuid = $request->get("layouter");
|
||||
$articleUuid = $request->get("article");
|
||||
$uuid = $request->get('layouter');
|
||||
$articleUuid = $request->get('article');
|
||||
|
||||
$layoutDesignData = $entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')->findOneBy(array('uuid' => $uuid));
|
||||
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')
|
||||
->findOneBy(['uuid' => $uuid]);
|
||||
|
||||
$session = new FormLayouter();
|
||||
if($request->getSession()->has('formlayouter')) {
|
||||
if ($request->getSession()->has('formlayouter')) {
|
||||
$session = $request->getSession()->get('formlayouter');
|
||||
}
|
||||
|
||||
@ -60,8 +57,9 @@ class StoreController extends AbstractController
|
||||
$entityManager->flush();
|
||||
|
||||
$json = new JsonResponse();
|
||||
$json->setContent(json_encode(array('success' => true)));
|
||||
$json->setContent(json_encode(['success' => true]));
|
||||
|
||||
return $json;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
namespace Plugin\System\PSC\FormLayouter\Controller;
|
||||
|
||||
namespace Plugin\Custom\PSC\FormLayouter\Controller;
|
||||
|
||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||
use Gaufrette\Filesystem;
|
||||
@ -19,36 +20,39 @@ class UploadController extends AbstractController
|
||||
#[Route('/single', name: 'psc_plugin_formlayouter_upload_single')]
|
||||
public function singleAction(Request $request, DocumentManager $documentManager, FilesystemMap $filesystemMap)
|
||||
{
|
||||
if ($request->files->has("file")) {
|
||||
$file = $request->files->get("file");
|
||||
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());
|
||||
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");
|
||||
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);
|
||||
$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{
|
||||
} else {
|
||||
$fileContainer->write($filename, file_get_contents($file->getPathname()));
|
||||
}
|
||||
|
||||
|
||||
$image = new Image();
|
||||
$image->setSessionId($request->getSession()->getId());
|
||||
$image->setFileName($fileContainer->get($filename)->getKey());
|
||||
@ -93,10 +97,16 @@ class UploadController extends AbstractController
|
||||
->getRepository('Plugin\System\PSC\FormLayouter\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());
|
||||
|
||||
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,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Plugin\System\PSC\FormLayouter\Form\Field;
|
||||
namespace Plugin\Custom\PSC\FormLayouter\Form\Field;
|
||||
|
||||
use PSC\System\PluginBundle\Form\Interfaces\Field;
|
||||
use PSC\System\SettingsBundle\Service\Status;
|
||||
@ -9,9 +9,8 @@ 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
|
||||
class BackendFields extends \PSC\System\PluginBundle\Form\Field implements Field
|
||||
{
|
||||
|
||||
protected $tab = 'uploads';
|
||||
|
||||
private $statusService;
|
||||
@ -23,7 +22,7 @@ class BackendFields extends \PSC\System\PluginBundle\Form\Field implements Fiel
|
||||
|
||||
public function getTemplate()
|
||||
{
|
||||
return '@PluginSystemPSCFormLayouter/form/field/backend.html.twig';
|
||||
return '@PluginCustomPSCFormLayouter/form/field/backend.html.twig';
|
||||
}
|
||||
|
||||
public function getModule()
|
||||
@ -36,28 +35,25 @@ class BackendFields extends \PSC\System\PluginBundle\Form\Field implements Fiel
|
||||
*/
|
||||
public function formPreSubmit(FormEvent $event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
|
||||
$builder->add('formlayouter', CheckboxType::class, array(
|
||||
$builder->add('formlayouter', CheckboxType::class, [
|
||||
'label' => 'Step Layouter aktivieren',
|
||||
'required' => false
|
||||
)) ->add("formlayouter2InitalStatus", ChoiceType::class, array(
|
||||
'required' => false,
|
||||
])->add('formlayouter2InitalStatus', ChoiceType::class, [
|
||||
'label' => 'Initalstatus',
|
||||
'choices' => $this->statusService->getPositionStatusAsArray(),
|
||||
'translation_domain' => 'posstatus'
|
||||
));
|
||||
|
||||
'translation_domain' => 'posstatus',
|
||||
]);
|
||||
|
||||
return $builder;
|
||||
}
|
||||
|
||||
public function getGroup()
|
||||
{
|
||||
return "formlayouter";
|
||||
return 'formlayouter';
|
||||
}
|
||||
|
||||
public function formPostSetData(FormEvent $event)
|
||||
@ -78,4 +74,5 @@ class BackendFields extends \PSC\System\PluginBundle\Form\Field implements Fiel
|
||||
public function formSubmit(FormEvent $event)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Plugin\System\PSC\FormLayouter\Form\Field;
|
||||
namespace Plugin\Custom\PSC\FormLayouter\Form\Field;
|
||||
|
||||
use DirectoryIterator;
|
||||
use Plugin\System\PSC\FormLayouter\Form\Group\FormLayouterEditor;
|
||||
@ -11,10 +11,9 @@ use Symfony\Component\Form\FormEvent;
|
||||
|
||||
class EnableEditor implements Field
|
||||
{
|
||||
|
||||
public function getTemplate()
|
||||
{
|
||||
return '@PluginSystemPSCFormLayouter/form/field/enable_editor.html.twig';
|
||||
return '@PluginCustomPSCFormLayouter/form/field/enable_editor.html.twig';
|
||||
}
|
||||
|
||||
public function getModule()
|
||||
@ -27,14 +26,12 @@ class EnableEditor implements Field
|
||||
*/
|
||||
public function formPreSubmit(FormEvent $event)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$txtheader = "";
|
||||
$txtfooter = "";
|
||||
$txtheader = '';
|
||||
$txtfooter = '';
|
||||
$this->options = $options;
|
||||
|
||||
/** @var Shop $shopEntity */
|
||||
@ -42,66 +39,89 @@ class EnableEditor implements Field
|
||||
$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') {
|
||||
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') {
|
||||
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();
|
||||
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() . "/step_layouter")) {
|
||||
mkdir("/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/step_layouter", 0777);
|
||||
if (
|
||||
!file_exists('/data/www/old/application/design/vorlagen/' . $shopEntity->getLayout() . '/step_layouter')
|
||||
) {
|
||||
mkdir(
|
||||
'/data/www/old/application/design/vorlagen/' . $shopEntity->getLayout() . '/step_layouter',
|
||||
0o777,
|
||||
);
|
||||
}
|
||||
$filenameheader = "/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/step_layouter/header.html.twig";
|
||||
$filenamefooter = "/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/step_layouter/footer.html.twig";
|
||||
$filenameheader =
|
||||
'/data/www/old/application/design/vorlagen/' .
|
||||
$shopEntity->getLayout() .
|
||||
'/step_layouter/header.html.twig';
|
||||
$filenamefooter =
|
||||
'/data/www/old/application/design/vorlagen/' .
|
||||
$shopEntity->getLayout() .
|
||||
'/step_layouter/footer.html.twig';
|
||||
if (!file_exists($filenameheader)) {
|
||||
touch($filenameheader);
|
||||
chmod($filenameheader, 0777);
|
||||
chmod($filenameheader, 0o777);
|
||||
}
|
||||
if (!file_exists($filenamefooter)) {
|
||||
touch($filenamefooter);
|
||||
chmod($filenamefooter, 0777);
|
||||
chmod($filenamefooter, 0o777);
|
||||
}
|
||||
|
||||
$handleheader = fopen($filenameheader, 'r');
|
||||
if(filesize($filenameheader)>0) {
|
||||
if (filesize($filenameheader) > 0) {
|
||||
$txtheader = fread($handleheader, filesize($filenameheader));
|
||||
fclose($handleheader);
|
||||
}
|
||||
$handlefooter = fopen($filenamefooter, 'r');
|
||||
if(filesize($filenamefooter)) {
|
||||
if (filesize($filenamefooter)) {
|
||||
$txtfooter = fread($handlefooter, filesize($filenamefooter));
|
||||
fclose($handlefooter);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$builder->add('header', TextareaType::class, array(
|
||||
$builder->add('header', TextareaType::class, [
|
||||
'label' => 'Header',
|
||||
'data' => $txtheader,
|
||||
'required' => false,
|
||||
'attr' => array('rows' => 50)
|
||||
))
|
||||
->add('footer', TextareaType::class, array(
|
||||
'attr' => ['rows' => 50],
|
||||
])->add('footer', TextareaType::class, [
|
||||
'label' => 'Footer',
|
||||
'data' => $txtfooter,
|
||||
'required' => false,
|
||||
'attr' => array('rows' => 50)
|
||||
));
|
||||
;
|
||||
'attr' => ['rows' => 50],
|
||||
]);
|
||||
|
||||
return $builder;
|
||||
}
|
||||
@ -118,7 +138,6 @@ class EnableEditor implements Field
|
||||
|
||||
public function formPostSubmit(FormEvent $event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function formPreSetData(FormEvent $event)
|
||||
@ -128,16 +147,23 @@ class EnableEditor implements Field
|
||||
|
||||
public function formSubmit(FormEvent $event)
|
||||
{
|
||||
$filename = "/data/www/old/application/design/vorlagen/" . $_POST["settings"]["bootstrap3General"]["layout"] . "/step_layouter/header.html.twig";
|
||||
$handle = fopen($filename, 'w');
|
||||
fputs($handle, $event->getForm()->get('formlayoutereditor')->get('header')->getData());
|
||||
fclose($handle);
|
||||
$filename =
|
||||
'/data/www/old/application/design/vorlagen/' .
|
||||
$_POST['settings']['bootstrap3General']['layout'] .
|
||||
'/step_layouter/header.html.twig';
|
||||
$handle = fopen($filename, 'w');
|
||||
\fwrite($handle, $event->getForm()->get('formlayoutereditor')->get('header')->getData());
|
||||
fclose($handle);
|
||||
|
||||
$filename =
|
||||
'/data/www/old/application/design/vorlagen/' .
|
||||
$_POST['settings']['bootstrap3General']['layout'] .
|
||||
'/step_layouter/footer.html.twig';
|
||||
$handle = fopen($filename, 'w');
|
||||
\fwrite($handle, $event->getForm()->get('formlayoutereditor')->get('footer')->getData());
|
||||
fclose($handle);
|
||||
|
||||
$filename = "/data/www/old/application/design/vorlagen/" . $_POST["settings"]["bootstrap3General"]["layout"] . "/step_layouter/footer.html.twig";
|
||||
$handle = fopen($filename, 'w');
|
||||
fputs($handle, $event->getForm()->get('formlayoutereditor')->get('footer')->getData());
|
||||
fclose($handle);
|
||||
// TODO: Implement formPostSubmit() method.
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Plugin\System\PSC\FormLayouter\Form;
|
||||
namespace Plugin\Custom\PSC\FormLayouter\Form;
|
||||
|
||||
use Plugin\System\PSC\FormLayouter\Model\Steps\Step;
|
||||
use Plugin\System\PSC\FormLayouter\Session\FormLayouter;
|
||||
@ -27,7 +27,6 @@ class FormDesigner extends AbstractType
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
|
||||
/** @var FormLayouter $session */
|
||||
$session = $options['session'];
|
||||
|
||||
@ -36,16 +35,16 @@ class FormDesigner extends AbstractType
|
||||
/** @var Step $step */
|
||||
$step = $options['step'];
|
||||
|
||||
foreach($step->getColumns() as $column) {
|
||||
foreach($column->getOptions() as $option) {
|
||||
if($option->isInForm()) {
|
||||
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())) {
|
||||
foreach ($builder->all() as $opt) {
|
||||
if ($session->hasOption($productId, $opt->getName())) {
|
||||
$opt->setData($session->getOption($productId, $opt->getName()));
|
||||
}
|
||||
}
|
||||
@ -58,10 +57,11 @@ class FormDesigner extends AbstractType
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
$resolver->setDefaults([
|
||||
'step' => null,
|
||||
'session' => null,
|
||||
'productId' => null,
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Plugin\System\PSC\FormLayouter\Form\Group;
|
||||
namespace Plugin\Custom\PSC\FormLayouter\Form\Group;
|
||||
|
||||
use PSC\Shop\EntityBundle\Entity\Cms;
|
||||
use PSC\System\PluginBundle\Form\Group;
|
||||
@ -28,4 +28,5 @@ class FormLayouter extends Group
|
||||
{
|
||||
return self::GROUP_ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Plugin\System\PSC\FormLayouter\Form\Group;
|
||||
namespace Plugin\Custom\PSC\FormLayouter\Form\Group;
|
||||
|
||||
use PSC\Shop\EntityBundle\Entity\Cms;
|
||||
use PSC\System\PluginBundle\Form\Group;
|
||||
@ -28,4 +28,5 @@ class FormLayouterEditor extends Group
|
||||
{
|
||||
return self::GROUP_ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,15 +1,6 @@
|
||||
<?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\System\PSC\FormLayouter\Form\XML;
|
||||
|
||||
namespace Plugin\Custom\PSC\FormLayouter\Form\XML;
|
||||
|
||||
use PSC\Libraries\AceEditorBundle\Form\Extension\AceEditorType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
@ -22,24 +13,21 @@ 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'));
|
||||
$builder->add('uuid', TextType::class, ['disabled' => true])->add('xml', AceEditorType::class, [
|
||||
'wrapper_attr' => [], // 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, ['label' => 'Speichern']);
|
||||
}
|
||||
|
||||
public function getName()
|
||||
@ -49,6 +37,6 @@ class EditType extends AbstractType
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
psc_shop_plugin_custom_formlayouter_frontend:
|
||||
resource: "@PluginCutomPSCFormLayouter/Controller"
|
||||
resource: "@PluginCustomPSCFormLayouter/Controller"
|
||||
type: attribute
|
||||
prefix: /plugin/formlayouter/api
|
||||
|
||||
|
||||
BIN
src/old/data/packages/fotos/6940161ecd71d39a5904f877.pdf
Normal file
BIN
src/old/data/packages/fotos/6940161ecd71d39a5904f877.pdf
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user