Backup
This commit is contained in:
parent
fbd0cbf43e
commit
3f14580904
@ -178,7 +178,11 @@ class Preview extends AbstractController
|
||||
}
|
||||
|
||||
if ($element->getType() == ElementType::Image && $formData[$element->getId()]['value'] instanceof Media) {
|
||||
$formData[$element->getId()]['value'] = $formData[$element->getId()]['value']->getVariant($element->getImage()->aspectRatio);
|
||||
if ($element->getImage()->aspectRatio == null) {
|
||||
$formData[$element->getId()]['value'] = $formData[$element->getId()]['value'];
|
||||
} else {
|
||||
$formData[$element->getId()]['value'] = $formData[$element->getId()]['value']->getVariant($element->getImage()->aspectRatio);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -165,8 +165,12 @@ class Save extends AbstractController
|
||||
if ($elm = $data->getElement($element, $contact)) {
|
||||
if ($element->getType() == ElementType::Image && $elm['value'] != '') {
|
||||
$media = $this->mediaManager->getModelByUuid($elm['value']);
|
||||
$elmMedia = $media->getVariant($element->getImage()->aspectRatio);
|
||||
$formData[$element->getId()] = ['value' => $elmMedia, 'enable' => (bool) $elm['enable']];
|
||||
if ($element->getImage()->aspectRatio == null) {
|
||||
$formData[$element->getId()] = ['value' => $media, 'enable' => (bool) $elm['enable']];
|
||||
} else {
|
||||
$elmMedia = $media->getVariant($element->getImage()->aspectRatio);
|
||||
$formData[$element->getId()] = ['value' => $elmMedia, 'enable' => (bool) $elm['enable']];
|
||||
}
|
||||
} else {
|
||||
$formData[$element->getId()] = ['value' => $elm['value'], 'enable' => (bool) $elm['enable']];
|
||||
}
|
||||
|
||||
@ -6,7 +6,6 @@ use Doctrine\ODM\MongoDB\DocumentManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Lexik\Bundle\JWTAuthenticationBundle\Services\JWTTokenManagerInterface;
|
||||
use OpenApi\Attributes\Response;
|
||||
use PSC\Shop\MediaBundle\Service\MediaManager;
|
||||
use Plugin\Custom\PSC\CollectLayouter\Dto\Preview\Input;
|
||||
use Plugin\Custom\PSC\CollectLayouter\Helper\MPDF;
|
||||
use Plugin\Custom\PSC\CollectLayouter\Model\Element;
|
||||
@ -16,6 +15,7 @@ use Plugin\Custom\PSC\CollectLayouter\Model\Setting;
|
||||
use PSC\Shop\ContactBundle\Repository\ContactRepository;
|
||||
use PSC\Shop\ContactBundle\Transformer\Model\Contact;
|
||||
use PSC\Shop\EntityBundle\Entity\Product;
|
||||
use PSC\Shop\MediaBundle\Service\MediaManager;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
@ -27,31 +27,35 @@ use Symfony\Component\Serializer\SerializerInterface;
|
||||
class DesignerController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
readonly private Contact $contactTransformer,
|
||||
readonly private MPDF $mpdf,
|
||||
readonly private EntityManagerInterface $entityManager,
|
||||
readonly private DocumentManager $documentManager,
|
||||
readonly private SerializerInterface $serializer,
|
||||
readonly private RequestStack $requestStack,
|
||||
readonly private MediaManager $mediaManager
|
||||
private readonly Contact $contactTransformer,
|
||||
private readonly MPDF $mpdf,
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly DocumentManager $documentManager,
|
||||
private readonly SerializerInterface $serializer,
|
||||
private readonly RequestStack $requestStack,
|
||||
private readonly MediaManager $mediaManager,
|
||||
) {}
|
||||
|
||||
#[Template]
|
||||
#[Route('/start/{productUuid}/{contactUuid}', name: 'plugin_custom_psc_collectlayouter_start', defaults: [
|
||||
'contactUuid' => '',
|
||||
])]
|
||||
public function start(
|
||||
ContactRepository $contactRepository,
|
||||
\PSC\Shop\ContactBundle\Transformer\Model\Contact $contactTransformer,
|
||||
JWTTokenManagerInterface $JWTTokenManager,
|
||||
string $productUuid,
|
||||
string $contactUuid = '',
|
||||
) {
|
||||
}
|
||||
|
||||
#[Template()]
|
||||
#[Route('/start/{productUuid}/{contactUuid}', name: 'plugin_custom_psc_collectlayouter_start', defaults: ['contactUuid' => ''])]
|
||||
public function start(ContactRepository $contactRepository, \PSC\Shop\ContactBundle\Transformer\Model\Contact $contactTransformer, JWTTokenManagerInterface $JWTTokenManager, string $productUuid, string $contactUuid = "")
|
||||
{
|
||||
|
||||
/** @var \Plugin\Custom\PSC\Pitchprint\Controller\Frontend\Product $product */
|
||||
$product = $this->entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Product')
|
||||
->findOneBy(array('uuid' => $productUuid));
|
||||
|
||||
->findOneBy(['uuid' => $productUuid]);
|
||||
|
||||
/** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */
|
||||
$productDoc = $this->documentManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Document\Product')
|
||||
->findOneBy(array('uid' => (string)$product->getUid()));
|
||||
->findOneBy(['uid' => (string) $product->getUid()]);
|
||||
|
||||
$token = null;
|
||||
if ($contactUuid) {
|
||||
@ -59,36 +63,52 @@ class DesignerController extends AbstractController
|
||||
$token = $JWTTokenManager->create($user);
|
||||
}
|
||||
/** @var Setting $settings */
|
||||
$settings = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config') ?? '{}', Setting::class, 'json');
|
||||
$settings = $this->serializer->deserialize(
|
||||
$productDoc->getPluginSettingModule('collectlayouter', 'config') ?? '{}',
|
||||
Setting::class,
|
||||
'json',
|
||||
);
|
||||
return [
|
||||
'product' => $product,
|
||||
'productDoc' => $productDoc,
|
||||
'contactUuid' => $contactUuid,
|
||||
'settings' => $settings,
|
||||
'jwt' => $token ?: ''
|
||||
'jwt' => $token ?: '',
|
||||
];
|
||||
}
|
||||
|
||||
#[Template()]
|
||||
#[Route('/startcollect/{productUuid}/{mode}/{contactUuid}', name: 'plugin_custom_psc_collectlayouter_collect', defaults: ['contactUuid' => '', 'mode' => 1])]
|
||||
public function collect(ContactRepository $contactRepository, \PSC\Shop\ContactBundle\Transformer\Model\Contact $contactTransformer, JWTTokenManagerInterface $JWTTokenManager, string $productUuid, string $contactUuid = "", int $mode = 1)
|
||||
{
|
||||
|
||||
#[Template]
|
||||
#[Route(
|
||||
'/startcollect/{productUuid}/{mode}/{contactUuid}',
|
||||
name: 'plugin_custom_psc_collectlayouter_collect',
|
||||
defaults: ['contactUuid' => '', 'mode' => 1],
|
||||
)]
|
||||
public function collect(
|
||||
ContactRepository $contactRepository,
|
||||
\PSC\Shop\ContactBundle\Transformer\Model\Contact $contactTransformer,
|
||||
JWTTokenManagerInterface $JWTTokenManager,
|
||||
string $productUuid,
|
||||
string $contactUuid = '',
|
||||
int $mode = 1,
|
||||
) {
|
||||
/** @var \Plugin\Custom\PSC\Pitchprint\Controller\Frontend\Product $product */
|
||||
$product = $this->entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Product')
|
||||
->findOneBy(array('uuid' => $productUuid));
|
||||
|
||||
->findOneBy(['uuid' => $productUuid]);
|
||||
|
||||
/** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */
|
||||
$productDoc = $this->documentManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Document\Product')
|
||||
->findOneBy(array('uid' => (string)$product->getUid()));
|
||||
->findOneBy(['uid' => (string) $product->getUid()]);
|
||||
|
||||
$token = $JWTTokenManager->create($this->getUser());
|
||||
|
||||
/** @var Setting $settings */
|
||||
$settings = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config') ?? '{}', Setting::class, 'json');
|
||||
$settings = $this->serializer->deserialize(
|
||||
$productDoc->getPluginSettingModule('collectlayouter', 'config') ?? '{}',
|
||||
Setting::class,
|
||||
'json',
|
||||
);
|
||||
return [
|
||||
'product' => $product,
|
||||
'productDoc' => $productDoc,
|
||||
@ -96,31 +116,40 @@ class DesignerController extends AbstractController
|
||||
'settings' => $settings,
|
||||
'jwt' => $token ?: '',
|
||||
'layouterUuid' => Uuid::uuid4(),
|
||||
'mode' => $mode
|
||||
'mode' => $mode,
|
||||
];
|
||||
}
|
||||
|
||||
#[Template()]
|
||||
#[Route('/loadcollect/{productId}/{layouterId}', name: 'plugin_custom_psc_collectlayouter_loadcollect', defaults: ['contactUuid' => ''])]
|
||||
public function loadCollect(ContactRepository $contactRepository, \PSC\Shop\ContactBundle\Transformer\Model\Contact $contactTransformer, JWTTokenManagerInterface $JWTTokenManager, string $productId, string $layouterId)
|
||||
{
|
||||
|
||||
#[Template]
|
||||
#[Route('/loadcollect/{productId}/{layouterId}', name: 'plugin_custom_psc_collectlayouter_loadcollect', defaults: [
|
||||
'contactUuid' => '',
|
||||
])]
|
||||
public function loadCollect(
|
||||
ContactRepository $contactRepository,
|
||||
\PSC\Shop\ContactBundle\Transformer\Model\Contact $contactTransformer,
|
||||
JWTTokenManagerInterface $JWTTokenManager,
|
||||
string $productId,
|
||||
string $layouterId,
|
||||
) {
|
||||
/** @var \Plugin\Custom\PSC\Pitchprint\Controller\Frontend\Product $product */
|
||||
$product = $this->entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Product')
|
||||
->findOneBy(array('uuid' => $productId));
|
||||
|
||||
->findOneBy(['uuid' => $productId]);
|
||||
|
||||
/** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */
|
||||
$productDoc = $this->documentManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Document\Product')
|
||||
->findOneBy(array('uid' => (string)$product->getUid()));
|
||||
|
||||
->findOneBy(['uid' => (string) $product->getUid()]);
|
||||
|
||||
/** @var Setting $settings */
|
||||
$settings = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config') ?? '{}', Setting::class, 'json');
|
||||
$settings = $this->serializer->deserialize(
|
||||
$productDoc->getPluginSettingModule('collectlayouter', 'config') ?? '{}',
|
||||
Setting::class,
|
||||
'json',
|
||||
);
|
||||
$layoutDesignData = $this->entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')->findOneBy(array('uuid' => $layouterId));
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')
|
||||
->findOneBy(['uuid' => $layouterId]);
|
||||
|
||||
$token = $JWTTokenManager->create($this->getUser());
|
||||
|
||||
@ -131,31 +160,41 @@ class DesignerController extends AbstractController
|
||||
'settings' => $settings,
|
||||
'jwt' => $token ?: '',
|
||||
'layouterId' => $layouterId,
|
||||
'data' => $layoutDesignData->getDesign()['data']
|
||||
'data' => $layoutDesignData->getDesign()['data'],
|
||||
];
|
||||
}
|
||||
|
||||
#[Template()]
|
||||
#[Route('/load/{productId}/{layouterId}/{contactUuid}', name: 'plugin_custom_psc_collectlayouter_load', defaults: ['contactUuid' => ''])]
|
||||
public function load(ContactRepository $contactRepository, \PSC\Shop\ContactBundle\Transformer\Model\Contact $contactTransformer, JWTTokenManagerInterface $JWTTokenManager, string $productId, string $layouterId, string $contactUuid = "")
|
||||
{
|
||||
|
||||
#[Template]
|
||||
#[Route('/load/{productId}/{layouterId}/{contactUuid}', name: 'plugin_custom_psc_collectlayouter_load', defaults: [
|
||||
'contactUuid' => '',
|
||||
])]
|
||||
public function load(
|
||||
ContactRepository $contactRepository,
|
||||
\PSC\Shop\ContactBundle\Transformer\Model\Contact $contactTransformer,
|
||||
JWTTokenManagerInterface $JWTTokenManager,
|
||||
string $productId,
|
||||
string $layouterId,
|
||||
string $contactUuid = '',
|
||||
) {
|
||||
/** @var \Plugin\Custom\PSC\Pitchprint\Controller\Frontend\Product $product */
|
||||
$product = $this->entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Product')
|
||||
->findOneBy(array('uuid' => $productId));
|
||||
|
||||
->findOneBy(['uuid' => $productId]);
|
||||
|
||||
/** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */
|
||||
$productDoc = $this->documentManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Document\Product')
|
||||
->findOneBy(array('uid' => (string)$product->getUid()));
|
||||
|
||||
->findOneBy(['uid' => (string) $product->getUid()]);
|
||||
|
||||
/** @var Setting $settings */
|
||||
$settings = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config') ?? '{}', Setting::class, 'json');
|
||||
$settings = $this->serializer->deserialize(
|
||||
$productDoc->getPluginSettingModule('collectlayouter', 'config') ?? '{}',
|
||||
Setting::class,
|
||||
'json',
|
||||
);
|
||||
$layoutDesignData = $this->entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')->findOneBy(array('uuid' => $layouterId));
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')
|
||||
->findOneBy(['uuid' => $layouterId]);
|
||||
|
||||
$token = null;
|
||||
if ($contactUuid) {
|
||||
@ -170,7 +209,7 @@ class DesignerController extends AbstractController
|
||||
'settings' => $settings,
|
||||
'jwt' => $token ?: '',
|
||||
'layouterId' => $layouterId,
|
||||
'data' => $layoutDesignData->getDesign()['data']
|
||||
'data' => $layoutDesignData->getDesign()['data'],
|
||||
];
|
||||
}
|
||||
|
||||
@ -178,32 +217,50 @@ class DesignerController extends AbstractController
|
||||
public function preview(string $uuid, string $contact, int $type = 1): Response
|
||||
{
|
||||
$product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $uuid]);
|
||||
$contactEntity = $this->entityManager->getRepository(\PSC\Shop\EntityBundle\Entity\Contact::class)->findOneBy(['uuid' => $contact]);
|
||||
|
||||
$productDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)->findOneBy(['uid' => $product->getUID()]);
|
||||
$setting = $this->serializer->deserialize($productDoc->getPluginSettingModule('collectlayouter', 'config') ?? '{}', Setting::class, 'json');
|
||||
$contactEntity = $this->entityManager
|
||||
->getRepository(\PSC\Shop\EntityBundle\Entity\Contact::class)
|
||||
->findOneBy(['uuid' => $contact]);
|
||||
|
||||
$productDoc = $this->documentManager
|
||||
->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)
|
||||
->findOneBy(['uid' => $product->getUID()]);
|
||||
$setting = $this->serializer->deserialize(
|
||||
$productDoc->getPluginSettingModule('collectlayouter', 'config') ?? '{}',
|
||||
Setting::class,
|
||||
'json',
|
||||
);
|
||||
|
||||
$contact = new \PSC\Shop\ContactBundle\Model\Contact();
|
||||
$this->contactTransformer->fromDb($contact, $contactEntity);
|
||||
|
||||
$this->mpdf->setSetting($setting);
|
||||
$data = $this->serializer->deserialize($this->requestStack->getSession()->get('collectLayouterData', '{}'), Input::class, 'json');
|
||||
$data = $this->serializer->deserialize(
|
||||
$this->requestStack->getSession()->get('collectLayouterData', '{}'),
|
||||
Input::class,
|
||||
'json',
|
||||
);
|
||||
$formData = [];
|
||||
|
||||
/** @var Element $element */
|
||||
foreach ($setting->getCustomerForm() as $element) {
|
||||
$value = match($element->getBinding()) {
|
||||
$value = match ($element->getBinding()) {
|
||||
ElementBinding::none => $element->getDefaultForTypePreview(),
|
||||
ElementBinding::StreetHouseNumber => ['street' => $contact->getLayouterData()->getStreet() ?? $element->getDefault1(), 'houseNumber' => $contact->getLayouterData()->getHouseNumber() ?? $element->getDefault2()],
|
||||
ElementBinding::ZipCity => ['zip' => $contact->getLayouterData()->getZip() ?? $element->getDefault1(), 'city' => $contact->getLayouterData()->getCity() ?? $element->getDefault2()],
|
||||
ElementBinding::StreetHouseNumber => [
|
||||
'street' => $contact->getLayouterData()->getStreet() ?? $element->getDefault1(),
|
||||
'houseNumber' => $contact->getLayouterData()->getHouseNumber() ?? $element->getDefault2(),
|
||||
],
|
||||
ElementBinding::ZipCity => [
|
||||
'zip' => $contact->getLayouterData()->getZip() ?? $element->getDefault1(),
|
||||
'city' => $contact->getLayouterData()->getCity() ?? $element->getDefault2(),
|
||||
],
|
||||
ElementBinding::Firstname => $contact->getLayouterData()->getFirstname() ?? $element->getDefault1(),
|
||||
ElementBinding::Lastname => $contact->getLayouterData()->getLastname() ?? $element->getDefault1(),
|
||||
ElementBinding::Mobile => [
|
||||
'areacode' => $contact->getLayouterData()->getMobileAreaCode() ?? $element->getDefault1(),
|
||||
'appendix' => $contact->getLayouterData()->getMobileAppendix() ?? $element->getDefault2(),
|
||||
'number' => $contact->getLayouterData()->getMobile() ?? $element->getDefault3(),
|
||||
'prefix' => $contact->getLayouterData()->getMobilePrefix() ?? $element->getDefault4()],
|
||||
'prefix' => $contact->getLayouterData()->getMobilePrefix() ?? $element->getDefault4(),
|
||||
],
|
||||
ElementBinding::UsernameLogin => $contact->getEmail() ?? $element->getDefault1(),
|
||||
ElementBinding::Company => $contact->getLayouterData()->getCompany() ?? $element->getDefault1(),
|
||||
ElementBinding::Company2 => $contact->getLayouterData()->getCompany2() ?? $element->getDefault1(),
|
||||
@ -215,12 +272,14 @@ class DesignerController extends AbstractController
|
||||
'areacode' => $contact->getLayouterData()->getPhoneAreaCode() ?? $element->getDefault1(),
|
||||
'appendix' => $contact->getLayouterData()->getPhoneAppendix() ?? $element->getDefault2(),
|
||||
'number' => $contact->getLayouterData()->getPhone() ?? $element->getDefault3(),
|
||||
'prefix' => $contact->getLayouterData()->getPhonePrefix() ?? $element->getDefault4()],
|
||||
'prefix' => $contact->getLayouterData()->getPhonePrefix() ?? $element->getDefault4(),
|
||||
],
|
||||
ElementBinding::Fax => [
|
||||
'areacode' => $contact->getLayouterData()->getFaxAreaCode() ?? $element->getDefault1(),
|
||||
'appendix' => $contact->getLayouterData()->getFaxPrefix() ?? $element->getDefault2(),
|
||||
'number' => $contact->getLayouterData()->getFax() ?? $element->getDefault3(),
|
||||
'prefix' => $contact->getLayouterData()->getFaxAppendix() ?? $element->getDefault4()],
|
||||
'prefix' => $contact->getLayouterData()->getFaxAppendix() ?? $element->getDefault4(),
|
||||
],
|
||||
ElementBinding::Abteilung => $contact->getLayouterData()->getAbteilung() ?? $element->getDefault1(),
|
||||
ElementBinding::Custom1 => $contact->getCustom1() ?? $element->getDefault1(),
|
||||
ElementBinding::Custom2 => $contact->getCustom2() ?? $element->getDefault1(),
|
||||
@ -247,8 +306,12 @@ class DesignerController extends AbstractController
|
||||
ElementBinding::Custom23 => $contact->getCustom23() ?? $element->getDefault1(),
|
||||
ElementBinding::Custom24 => $contact->getCustom24() ?? $element->getDefault1(),
|
||||
ElementBinding::LayouterMail => $contact->getLayouterData()->getEmail() ?? $element->getDefault1(),
|
||||
ElementBinding::LayouterCountryName => $contact->getLayouterData()->getCountryName() ?? $element->getDefault1(),
|
||||
ElementBinding::LayouterCountryCode => $contact->getLayouterData()->getCountryCode() ?? $element->getDefault1(),
|
||||
ElementBinding::LayouterCountryName => $contact
|
||||
->getLayouterData()
|
||||
->getCountryName() ?? $element->getDefault1(),
|
||||
ElementBinding::LayouterCountryCode => $contact
|
||||
->getLayouterData()
|
||||
->getCountryCode() ?? $element->getDefault1(),
|
||||
ElementBinding::Birthday => $contact->getLayouterData()->getBirthday() ?? $element->getDefault1(),
|
||||
ElementBinding::Homepages => $contact->getLayouterData()->getHomepage() ?? $element->getDefault1(),
|
||||
ElementBinding::Salutation => $contact->getLayouterData()->getSalutation() ?? $element->getDefault1(),
|
||||
@ -261,17 +324,23 @@ class DesignerController extends AbstractController
|
||||
};
|
||||
|
||||
if ($elm = $data->getElement($element, $contact)) {
|
||||
if ($element->getType() == ElementType::Image && $elm['value'] != "") {
|
||||
if ($element->getType() == ElementType::Image && $elm['value'] != '') {
|
||||
$media = $this->mediaManager->getModelByUuid($elm['value']);
|
||||
$elmMedia = $media->getVariant($element->getImage()->aspectRatio);
|
||||
$formData[$element->getId()] = ['value' => $elmMedia, 'enable' => (bool)$elm['enable']];
|
||||
if ($element->getImage()->aspectRatio == null) {
|
||||
$formData[$element->getId()] = ['value' => $media, 'enable' => (bool) $elm['enable']];
|
||||
} else {
|
||||
$elmMedia = $media->getVariant($element->getImage()->aspectRatio);
|
||||
$formData[$element->getId()] = ['value' => $elmMedia, 'enable' => (bool) $elm['enable']];
|
||||
}
|
||||
} else {
|
||||
$formData[$element->getId()] = ['value' => $elm['value'], 'enable' => $elm['enable']];
|
||||
}
|
||||
} else {
|
||||
$formData[$element->getId()] = ['value' => $value, 'enable' => $element->getOptional() ? $element->getOptionalDefault() : true];
|
||||
$formData[$element->getId()] = [
|
||||
'value' => $value,
|
||||
'enable' => $element->getOptional() ? $element->getOptionalDefault() : true,
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$this->mpdf->setData($formData);
|
||||
@ -279,7 +348,6 @@ class DesignerController extends AbstractController
|
||||
$outfilename = $this->mpdf->getPdfFile();
|
||||
$response = new \Symfony\Component\HttpFoundation\Response();
|
||||
|
||||
|
||||
$filename = '';
|
||||
if (isset($formData['firstname'])) {
|
||||
$filename = $formData['firstname']['value'] . '_';
|
||||
|
||||
@ -5,15 +5,14 @@ namespace Plugin\System\PSC\Bootstrap4\Form\Field;
|
||||
use DirectoryIterator;
|
||||
use PSC\Shop\EntityBundle\Entity\Shop;
|
||||
use PSC\System\PluginBundle\Form\Interfaces\Field;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormEvent;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
class Formulare extends AbstractController implements Field
|
||||
{
|
||||
|
||||
private $options;
|
||||
|
||||
public function getTemplate()
|
||||
@ -31,13 +30,11 @@ class Formulare extends AbstractController implements Field
|
||||
*/
|
||||
public function formPreSubmit(FormEvent $event)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$txt = "";
|
||||
$txt = '';
|
||||
$this->options = $options;
|
||||
|
||||
/** @var Shop $shopEntity */
|
||||
@ -45,89 +42,118 @@ class Formulare extends AbstractController 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"]["bootstrap4Images"]["layout"])) {
|
||||
header('location: /apps/backend/theme/settings');
|
||||
//die();
|
||||
} else {
|
||||
//copy("/data/www/old/public/styles/vorlagen/" . $shopEntity->getLayout() . "/bootstrap/css/style.css","/data/www/old/public/styles/vorlagen/" . $shopEntity->getLayout() . "/bootstrap/css/style_bakup.css");
|
||||
$filenamelogin = "/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/config/user/login.ini";
|
||||
$handlelogin = fopen($filenamelogin, 'r');
|
||||
$txtlogin = fread($handlelogin, filesize($filenamelogin));
|
||||
fclose($handlelogin);
|
||||
|
||||
$filenameregister = "/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/config/user/registercontact.ini";
|
||||
$handleregister = fopen($filenameregister, 'r');
|
||||
$txtregister = fread($handleregister, filesize($filenameregister));
|
||||
fclose($handleregister);
|
||||
if (isset($_POST['settings']['bootstrap4Images']['layout'])) {
|
||||
header('location: /apps/backend/theme/settings');
|
||||
|
||||
$filenamepass = "/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/config/user/resetpassword.ini";
|
||||
$handlepass = fopen($filenamepass, 'r');
|
||||
$txtpass = fread($handlepass, filesize($filenamepass));
|
||||
fclose($handlepass);
|
||||
//die();
|
||||
} else {
|
||||
$filenamelogin =
|
||||
'/data/www/old/application/design/vorlagen/' . $shopEntity->getLayout() . '/config/user/login.ini';
|
||||
if (file_exists($filenamelogin)) {
|
||||
$handlelogin = fopen($filenamelogin, 'r');
|
||||
$txtlogin = fread($handlelogin, filesize($filenamelogin));
|
||||
fclose($handlelogin);
|
||||
} else {
|
||||
$txtlogin = '';
|
||||
}
|
||||
|
||||
$filenameaddress = "/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/config/user/updatecontact.ini";
|
||||
$handleaddress = fopen($filenameaddress, 'r');
|
||||
$txtaddress = fread($handleaddress, filesize($filenameaddress));
|
||||
fclose($handleaddress);
|
||||
$filenameregister =
|
||||
'/data/www/old/application/design/vorlagen/' .
|
||||
$shopEntity->getLayout() .
|
||||
'/config/user/registercontact.ini';
|
||||
$handleregister = fopen($filenameregister, 'r');
|
||||
$txtregister = fread($handleregister, filesize($filenameregister));
|
||||
fclose($handleregister);
|
||||
|
||||
$filenameaddaddress = "/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/config/user/address.ini";
|
||||
$handleaddaddress = fopen($filenameaddaddress, 'r');
|
||||
$txtaddaddress = fread($handleaddaddress, filesize($filenameaddaddress));
|
||||
fclose($handleaddaddress);
|
||||
}
|
||||
$filenamepass =
|
||||
'/data/www/old/application/design/vorlagen/' .
|
||||
$shopEntity->getLayout() .
|
||||
'/config/user/resetpassword.ini';
|
||||
$handlepass = fopen($filenamepass, 'r');
|
||||
$txtpass = fread($handlepass, filesize($filenamepass));
|
||||
fclose($handlepass);
|
||||
|
||||
$filenameaddress =
|
||||
'/data/www/old/application/design/vorlagen/' .
|
||||
$shopEntity->getLayout() .
|
||||
'/config/user/updatecontact.ini';
|
||||
$handleaddress = fopen($filenameaddress, 'r');
|
||||
$txtaddress = fread($handleaddress, filesize($filenameaddress));
|
||||
fclose($handleaddress);
|
||||
|
||||
$filenameaddaddress =
|
||||
'/data/www/old/application/design/vorlagen/' . $shopEntity->getLayout() . '/config/user/address.ini';
|
||||
$handleaddaddress = fopen($filenameaddaddress, 'r');
|
||||
$txtaddaddress = fread($handleaddaddress, filesize($filenameaddaddress));
|
||||
fclose($handleaddaddress);
|
||||
}
|
||||
|
||||
$builder
|
||||
->add('formularelogin', TextareaType::class, array(
|
||||
'label' => 'login ini',
|
||||
'data' => $txtlogin,
|
||||
'required' => false,
|
||||
'attr' => array('rows' => 50, 'onclick' => "onchangeformulare('formularelogin');")
|
||||
))
|
||||
->add('formulareloginedit', HiddenType::class, array('required' => false, 'data' => 0))
|
||||
->add('formulareregister', TextareaType::class, array(
|
||||
'label' => 'registercontact ini',
|
||||
'data' => $txtregister,
|
||||
'required' => false,
|
||||
'attr' => array('rows' => 50, 'onclick' => "onchangeformulare('formulareregister');")
|
||||
))
|
||||
->add('formulareregisteredit', HiddenType::class, array('required' => false, 'data' => 0))
|
||||
->add('formularepass', TextareaType::class, array(
|
||||
'label' => 'resetpassword ini',
|
||||
'data' => $txtpass,
|
||||
'required' => false,
|
||||
'attr' => array('rows' => 50, 'onclick' => "onchangeformulare('formularepass');")
|
||||
))
|
||||
->add('formularepassedit', HiddenType::class, array('required' => false, 'data' => 0))
|
||||
->add('formulareaddress', TextareaType::class, array(
|
||||
'label' => 'updatecontact ini',
|
||||
'data' => $txtaddress,
|
||||
'required' => false,
|
||||
'attr' => array('rows' => 50, 'onclick' => "onchangeformulare('formulareaddress');")
|
||||
))
|
||||
->add('formulareaddressedit', HiddenType::class, array('required' => false, 'data' => 0))
|
||||
->add('formulareaddaddress', TextareaType::class, array(
|
||||
'label' => 'Address ini',
|
||||
'data' => $txtaddaddress,
|
||||
'required' => false,
|
||||
'attr' => array('rows' => 50, 'onclick' => "onchangeformulare('formulareaddaddress');")
|
||||
))
|
||||
->add('formulareaddaddressedit', HiddenType::class, array('required' => false, 'data' => 0))
|
||||
;
|
||||
->add('formularelogin', TextareaType::class, [
|
||||
'label' => 'login ini',
|
||||
'data' => $txtlogin,
|
||||
'required' => false,
|
||||
'attr' => ['rows' => 50, 'onclick' => "onchangeformulare('formularelogin');"],
|
||||
])
|
||||
->add('formulareloginedit', HiddenType::class, ['required' => false, 'data' => 0])
|
||||
->add('formulareregister', TextareaType::class, [
|
||||
'label' => 'registercontact ini',
|
||||
'data' => $txtregister,
|
||||
'required' => false,
|
||||
'attr' => ['rows' => 50, 'onclick' => "onchangeformulare('formulareregister');"],
|
||||
])
|
||||
->add('formulareregisteredit', HiddenType::class, ['required' => false, 'data' => 0])
|
||||
->add('formularepass', TextareaType::class, [
|
||||
'label' => 'resetpassword ini',
|
||||
'data' => $txtpass,
|
||||
'required' => false,
|
||||
'attr' => ['rows' => 50, 'onclick' => "onchangeformulare('formularepass');"],
|
||||
])
|
||||
->add('formularepassedit', HiddenType::class, ['required' => false, 'data' => 0])
|
||||
->add('formulareaddress', TextareaType::class, [
|
||||
'label' => 'updatecontact ini',
|
||||
'data' => $txtaddress,
|
||||
'required' => false,
|
||||
'attr' => ['rows' => 50, 'onclick' => "onchangeformulare('formulareaddress');"],
|
||||
])
|
||||
->add('formulareaddressedit', HiddenType::class, ['required' => false, 'data' => 0])
|
||||
->add('formulareaddaddress', TextareaType::class, [
|
||||
'label' => 'Address ini',
|
||||
'data' => $txtaddaddress,
|
||||
'required' => false,
|
||||
'attr' => ['rows' => 50, 'onclick' => "onchangeformulare('formulareaddaddress');"],
|
||||
])
|
||||
->add('formulareaddaddressedit', HiddenType::class, ['required' => false, 'data' => 0]);
|
||||
|
||||
return $builder;
|
||||
}
|
||||
@ -142,7 +168,11 @@ if(isset($_POST["settings"]["bootstrap4Images"]["layout"])) {
|
||||
/** @var Shop $shopEntity */
|
||||
$shopEntity = $this->options['shopEntity'];
|
||||
$layoutSettings = json_decode($shopEntity->getLayoutSettings(), true);
|
||||
$event->getForm()->get('bootstrap4General')->get('displayArticleCount')->setData($shopEntity->getDisplayArticleCount());
|
||||
$event
|
||||
->getForm()
|
||||
->get('bootstrap4General')
|
||||
->get('displayArticleCount')
|
||||
->setData($shopEntity->getDisplayArticleCount());
|
||||
$event->getForm()->get('bootstrap4General')->get('basketField1')->setData($shopEntity->getBasketfield1());
|
||||
$event->getForm()->get('bootstrap4General')->get('basketField2')->setData($shopEntity->getBasketfield2());
|
||||
$event->getForm()->get('bootstrap4General')->get('basketPosField1')->setData($shopEntity->getBasketposfield1());
|
||||
@ -151,51 +181,88 @@ if(isset($_POST["settings"]["bootstrap4Images"]["layout"])) {
|
||||
$event->getForm()->get('bootstrap4General')->get('displayDelivery')->setData($shopEntity->getDisplayDelivery());
|
||||
$event->getForm()->get('bootstrap4General')->get('layout')->setData($shopEntity->getLayout());
|
||||
$event->getForm()->get('bootstrap4General')->get('customTemplates')->setData($shopEntity->isCustomTemplates());
|
||||
$event->getForm()->get('bootstrap4General')->get('googleanalyticscode')->setData($shopEntity->getGoogleanalyticscode());
|
||||
$event
|
||||
->getForm()
|
||||
->get('bootstrap4General')
|
||||
->get('googleanalyticscode')
|
||||
->setData($shopEntity->getGoogleanalyticscode());
|
||||
$event->getForm()->get('bootstrap4General')->get('defaultFunc')->setData($shopEntity->getDefaultFunc());
|
||||
$event->getForm()->get('bootstrap4General')->get('defaultParam')->setData($shopEntity->getDefaultParam());
|
||||
$event->getForm()->get('bootstrap4General')->get('templateDisplayProductsCrossselling')->setData($shopEntity->isTemplateDisplayProductsCrossselling());
|
||||
$event->getForm()->get('bootstrap4General')->get('templateDisplayUserApproval')->setData($shopEntity->isTemplateDisplayUserApproval());
|
||||
|
||||
$event
|
||||
->getForm()
|
||||
->get('bootstrap4General')
|
||||
->get('templateDisplayProductsCrossselling')
|
||||
->setData($shopEntity->isTemplateDisplayProductsCrossselling());
|
||||
$event
|
||||
->getForm()
|
||||
->get('bootstrap4General')
|
||||
->get('templateDisplayUserApproval')
|
||||
->setData($shopEntity->isTemplateDisplayUserApproval());
|
||||
}
|
||||
|
||||
public function formPostSubmit(FormEvent $event)
|
||||
{
|
||||
/** @var Shop $shopEntity */
|
||||
$shopEntity = $this->options['shopEntity'];
|
||||
if($event->getForm()->get('bootstrap4Style')->get('write')->getData() == "1") {
|
||||
if($event->getForm()->get('bootstrap4Formulare')->get('formulareloginedit')->getData() == "1") {
|
||||
$filenamelogin = "/data/www/old/application/design/vorlagen/" . $_POST["settings"]["bootstrap4General"]["layout"] . "/config/user/login.ini";
|
||||
$handlelogin = fopen($filenamelogin, 'w');
|
||||
fputs($handlelogin, $event->getForm()->get('bootstrap4Formulare')->get('formularelogin')->getData());
|
||||
fclose($handlelogin);
|
||||
if ($event->getForm()->get('bootstrap4Style')->get('write')->getData() == '1') {
|
||||
if ($event->getForm()->get('bootstrap4Formulare')->get('formulareloginedit')->getData() == '1') {
|
||||
$filenamelogin =
|
||||
'/data/www/old/application/design/vorlagen/' .
|
||||
$_POST['settings']['bootstrap4General']['layout'] .
|
||||
'/config/user/login.ini';
|
||||
$handlelogin = fopen($filenamelogin, 'w');
|
||||
\fwrite($handlelogin, $event->getForm()->get('bootstrap4Formulare')->get('formularelogin')->getData());
|
||||
fclose($handlelogin);
|
||||
}
|
||||
if($event->getForm()->get('bootstrap4Formulare')->get('formulareregisteredit')->getData() == "1") {
|
||||
$filenameregister = "/data/www/old/application/design/vorlagen/" . $_POST["settings"]["bootstrap4General"]["layout"] . "/config/user/registercontact.ini";
|
||||
$handleregister = fopen($filenameregister, 'w');
|
||||
fputs($handleregister, $event->getForm()->get('bootstrap4Formulare')->get('formulareregister')->getData());
|
||||
fclose($handleregister);
|
||||
if ($event->getForm()->get('bootstrap4Formulare')->get('formulareregisteredit')->getData() == '1') {
|
||||
$filenameregister =
|
||||
'/data/www/old/application/design/vorlagen/' .
|
||||
$_POST['settings']['bootstrap4General']['layout'] .
|
||||
'/config/user/registercontact.ini';
|
||||
$handleregister = fopen($filenameregister, 'w');
|
||||
\fwrite(
|
||||
$handleregister,
|
||||
$event->getForm()->get('bootstrap4Formulare')->get('formulareregister')->getData(),
|
||||
);
|
||||
fclose($handleregister);
|
||||
}
|
||||
if($event->getForm()->get('bootstrap4Formulare')->get('formularepassedit')->getData() == "1") {
|
||||
$filenamepass = "/data/www/old/application/design/vorlagen/" . $_POST["settings"]["bootstrap4General"]["layout"] . "/config/user/resetpassword.ini";
|
||||
$handlepass = fopen($filenamepass, 'w');
|
||||
fputs($handlepass, $event->getForm()->get('bootstrap4Formulare')->get('formularepass')->getData());
|
||||
fclose($handlepass);
|
||||
if ($event->getForm()->get('bootstrap4Formulare')->get('formularepassedit')->getData() == '1') {
|
||||
$filenamepass =
|
||||
'/data/www/old/application/design/vorlagen/' .
|
||||
$_POST['settings']['bootstrap4General']['layout'] .
|
||||
'/config/user/resetpassword.ini';
|
||||
$handlepass = fopen($filenamepass, 'w');
|
||||
\fwrite($handlepass, $event->getForm()->get('bootstrap4Formulare')->get('formularepass')->getData());
|
||||
fclose($handlepass);
|
||||
}
|
||||
if($event->getForm()->get('bootstrap4Formulare')->get('formulareaddressedit')->getData() == "1") {
|
||||
$filenameaddress = "/data/www/old/application/design/vorlagen/" . $_POST["settings"]["bootstrap4General"]["layout"] . "/config/user/updatecontact.ini";
|
||||
$handleaddress = fopen($filenameaddress, 'w');
|
||||
fputs($handleaddress, $event->getForm()->get('bootstrap4Formulare')->get('formulareaddress')->getData());
|
||||
fclose($handleaddress);
|
||||
if ($event->getForm()->get('bootstrap4Formulare')->get('formulareaddressedit')->getData() == '1') {
|
||||
$filenameaddress =
|
||||
'/data/www/old/application/design/vorlagen/' .
|
||||
$_POST['settings']['bootstrap4General']['layout'] .
|
||||
'/config/user/updatecontact.ini';
|
||||
$handleaddress = fopen($filenameaddress, 'w');
|
||||
\fwrite(
|
||||
$handleaddress,
|
||||
$event->getForm()->get('bootstrap4Formulare')->get('formulareaddress')->getData(),
|
||||
);
|
||||
fclose($handleaddress);
|
||||
}
|
||||
if($event->getForm()->get('bootstrap4Formulare')->get('formulareaddaddressedit')->getData() == "1") {
|
||||
$filenameaddaddress = "/data/www/old/application/design/vorlagen/" . $_POST["settings"]["bootstrap4General"]["layout"] . "/config/user/address.ini";
|
||||
$handleaddaddress = fopen($filenameaddaddress, 'w');
|
||||
fputs($handleaddaddress, $event->getForm()->get('bootstrap4Formulare')->get('formulareaddaddress')->getData());
|
||||
fclose($handleaddaddress);
|
||||
if ($event->getForm()->get('bootstrap4Formulare')->get('formulareaddaddressedit')->getData() == '1') {
|
||||
$filenameaddaddress =
|
||||
'/data/www/old/application/design/vorlagen/' .
|
||||
$_POST['settings']['bootstrap4General']['layout'] .
|
||||
'/config/user/address.ini';
|
||||
$handleaddaddress = fopen($filenameaddaddress, 'w');
|
||||
\fwrite(
|
||||
$handleaddaddress,
|
||||
$event->getForm()->get('bootstrap4Formulare')->get('formulareaddaddress')->getData(),
|
||||
);
|
||||
fclose($handleaddaddress);
|
||||
}
|
||||
}
|
||||
$shopEntity->setDisplayArticleCount($event->getForm()->get('bootstrap4General')->get('displayArticleCount')->getData());
|
||||
$shopEntity->setDisplayArticleCount(
|
||||
$event->getForm()->get('bootstrap4General')->get('displayArticleCount')->getData(),
|
||||
);
|
||||
$shopEntity->setBasketfield1($event->getForm()->get('bootstrap4General')->get('basketField1')->getData());
|
||||
$shopEntity->setBasketfield2($event->getForm()->get('bootstrap4General')->get('basketField2')->getData());
|
||||
$shopEntity->setBasketposfield1($event->getForm()->get('bootstrap4General')->get('basketPosField1')->getData());
|
||||
@ -204,15 +271,21 @@ if(isset($_POST["settings"]["bootstrap4Images"]["layout"])) {
|
||||
$shopEntity->setDisplayDelivery($event->getForm()->get('bootstrap4General')->get('displayDelivery')->getData());
|
||||
$shopEntity->setCustomTemplates($event->getForm()->get('bootstrap4General')->get('customTemplates')->getData());
|
||||
$shopEntity->setLayout($event->getForm()->get('bootstrap4General')->get('layout')->getData());
|
||||
$shopEntity->setGoogleanalyticscode($event->getForm()->get('bootstrap4General')->get('googleanalyticscode')->getData());
|
||||
$shopEntity->setGoogleanalyticscode(
|
||||
$event->getForm()->get('bootstrap4General')->get('googleanalyticscode')->getData(),
|
||||
);
|
||||
$shopEntity->setDefaultFunc($event->getForm()->get('bootstrap4General')->get('defaultFunc')->getData());
|
||||
$shopEntity->setDefaultParam($event->getForm()->get('bootstrap4General')->get('defaultParam')->getData());
|
||||
$shopEntity->setTemplateDisplayProductsCrossselling($event->getForm()->get('bootstrap4General')->get('templateDisplayProductsCrossselling')->getData());
|
||||
$shopEntity->setTemplateDisplayUserApproval($event->getForm()->get('bootstrap4General')->get('templateDisplayUserApproval')->getData());
|
||||
$shopEntity->setTemplateDisplayProductsCrossselling(
|
||||
$event->getForm()->get('bootstrap4General')->get('templateDisplayProductsCrossselling')->getData(),
|
||||
);
|
||||
$shopEntity->setTemplateDisplayUserApproval(
|
||||
$event->getForm()->get('bootstrap4General')->get('templateDisplayUserApproval')->getData(),
|
||||
);
|
||||
}
|
||||
|
||||
public function formPreSetData(FormEvent $event)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,15 +5,14 @@ namespace Plugin\System\PSC\Bootstrap4\Form\Field;
|
||||
use DirectoryIterator;
|
||||
use PSC\Shop\EntityBundle\Entity\Shop;
|
||||
use PSC\System\PluginBundle\Form\Interfaces\Field;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormEvent;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
|
||||
class Images extends AbstractController implements Field
|
||||
{
|
||||
|
||||
private $options;
|
||||
|
||||
public function getTemplate()
|
||||
@ -31,13 +30,11 @@ class Images extends AbstractController implements Field
|
||||
*/
|
||||
public function formPreSubmit(FormEvent $event)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$txt = "";
|
||||
$txt = '';
|
||||
$this->options = $options;
|
||||
|
||||
/** @var Shop $shopEntity */
|
||||
@ -45,41 +42,54 @@ class Images extends AbstractController 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"]["bootstrap4Images"]["layout"])) {
|
||||
header('location: /apps/backend/theme/settings');
|
||||
//die();
|
||||
} else {
|
||||
//copy("/data/www/old/public/styles/vorlagen/" . $shopEntity->getLayout() . "/bootstrap/css/style.css","/data/www/old/public/styles/vorlagen/" . $shopEntity->getLayout() . "/bootstrap/css/style_bakup.css");
|
||||
$filename = "/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/config/images.ini";
|
||||
$handle = fopen($filename, 'r');
|
||||
$txt = fread($handle, filesize($filename));
|
||||
fclose($handle);
|
||||
}
|
||||
if (isset($_POST['settings']['bootstrap4Images']['layout'])) {
|
||||
header('location: /apps/backend/theme/settings');
|
||||
} else {
|
||||
$filename = '/data/www/old/application/design/vorlagen/' . $shopEntity->getLayout() . '/config/images.ini';
|
||||
$txt = '';
|
||||
if (file_exists($filename)) {
|
||||
$handle = fopen($filename, 'r');
|
||||
$txt = fread($handle, filesize($filename));
|
||||
fclose($handle);
|
||||
}
|
||||
}
|
||||
|
||||
$builder
|
||||
->add('imagesini', TextareaType::class, array(
|
||||
$builder->add('imagesini', TextareaType::class, [
|
||||
'label' => 'Images ini',
|
||||
'data' => $txt,
|
||||
'required' => false,
|
||||
'attr' => array('rows' => 50, 'onclick' => "onchangeimages('imagesini');")
|
||||
))
|
||||
->add('imagesiniedit', HiddenType::class, array('required' => false, 'data' => 0))
|
||||
;
|
||||
'attr' => ['rows' => 50, 'onclick' => "onchangeimages('imagesini');"],
|
||||
])->add('imagesiniedit', HiddenType::class, ['required' => false, 'data' => 0]);
|
||||
|
||||
return $builder;
|
||||
}
|
||||
@ -94,7 +104,11 @@ if(isset($_POST["settings"]["bootstrap4Images"]["layout"])) {
|
||||
/** @var Shop $shopEntity */
|
||||
$shopEntity = $this->options['shopEntity'];
|
||||
$layoutSettings = json_decode($shopEntity->getLayoutSettings(), true);
|
||||
$event->getForm()->get('bootstrap4General')->get('displayArticleCount')->setData($shopEntity->getDisplayArticleCount());
|
||||
$event
|
||||
->getForm()
|
||||
->get('bootstrap4General')
|
||||
->get('displayArticleCount')
|
||||
->setData($shopEntity->getDisplayArticleCount());
|
||||
$event->getForm()->get('bootstrap4General')->get('basketField1')->setData($shopEntity->getBasketfield1());
|
||||
$event->getForm()->get('bootstrap4General')->get('basketField2')->setData($shopEntity->getBasketfield2());
|
||||
$event->getForm()->get('bootstrap4General')->get('basketPosField1')->setData($shopEntity->getBasketposfield1());
|
||||
@ -103,27 +117,43 @@ if(isset($_POST["settings"]["bootstrap4Images"]["layout"])) {
|
||||
$event->getForm()->get('bootstrap4General')->get('displayDelivery')->setData($shopEntity->getDisplayDelivery());
|
||||
$event->getForm()->get('bootstrap4General')->get('layout')->setData($shopEntity->getLayout());
|
||||
$event->getForm()->get('bootstrap4General')->get('customTemplates')->setData($shopEntity->isCustomTemplates());
|
||||
$event->getForm()->get('bootstrap4General')->get('googleanalyticscode')->setData($shopEntity->getGoogleanalyticscode());
|
||||
$event
|
||||
->getForm()
|
||||
->get('bootstrap4General')
|
||||
->get('googleanalyticscode')
|
||||
->setData($shopEntity->getGoogleanalyticscode());
|
||||
$event->getForm()->get('bootstrap4General')->get('defaultFunc')->setData($shopEntity->getDefaultFunc());
|
||||
$event->getForm()->get('bootstrap4General')->get('defaultParam')->setData($shopEntity->getDefaultParam());
|
||||
$event->getForm()->get('bootstrap4General')->get('templateDisplayProductsCrossselling')->setData($shopEntity->isTemplateDisplayProductsCrossselling());
|
||||
$event->getForm()->get('bootstrap4General')->get('templateDisplayUserApproval')->setData($shopEntity->isTemplateDisplayUserApproval());
|
||||
|
||||
$event
|
||||
->getForm()
|
||||
->get('bootstrap4General')
|
||||
->get('templateDisplayProductsCrossselling')
|
||||
->setData($shopEntity->isTemplateDisplayProductsCrossselling());
|
||||
$event
|
||||
->getForm()
|
||||
->get('bootstrap4General')
|
||||
->get('templateDisplayUserApproval')
|
||||
->setData($shopEntity->isTemplateDisplayUserApproval());
|
||||
}
|
||||
|
||||
public function formPostSubmit(FormEvent $event)
|
||||
{
|
||||
/** @var Shop $shopEntity */
|
||||
$shopEntity = $this->options['shopEntity'];
|
||||
if($event->getForm()->get('bootstrap4Style')->get('write')->getData() == "1") {
|
||||
if($event->getForm()->get('bootstrap4Images')->get('imagesiniedit')->getData() == "1") {
|
||||
$filename = "/data/www/old/application/design/vorlagen/" . $_POST["settings"]["bootstrap4General"]["layout"] . "/config/images.ini";
|
||||
$handle = fopen($filename, 'w');
|
||||
fputs($handle, $event->getForm()->get('bootstrap4Images')->get('imagesini')->getData());
|
||||
fclose($handle);
|
||||
if ($event->getForm()->get('bootstrap4Style')->get('write')->getData() == '1') {
|
||||
if ($event->getForm()->get('bootstrap4Images')->get('imagesiniedit')->getData() == '1') {
|
||||
$filename =
|
||||
'/data/www/old/application/design/vorlagen/' .
|
||||
$_POST['settings']['bootstrap4General']['layout'] .
|
||||
'/config/images.ini';
|
||||
$handle = fopen($filename, 'w');
|
||||
\fwrite($handle, $event->getForm()->get('bootstrap4Images')->get('imagesini')->getData());
|
||||
fclose($handle);
|
||||
}
|
||||
}
|
||||
$shopEntity->setDisplayArticleCount($event->getForm()->get('bootstrap4General')->get('displayArticleCount')->getData());
|
||||
$shopEntity->setDisplayArticleCount(
|
||||
$event->getForm()->get('bootstrap4General')->get('displayArticleCount')->getData(),
|
||||
);
|
||||
$shopEntity->setBasketfield1($event->getForm()->get('bootstrap4General')->get('basketField1')->getData());
|
||||
$shopEntity->setBasketfield2($event->getForm()->get('bootstrap4General')->get('basketField2')->getData());
|
||||
$shopEntity->setBasketposfield1($event->getForm()->get('bootstrap4General')->get('basketPosField1')->getData());
|
||||
@ -132,15 +162,21 @@ if(isset($_POST["settings"]["bootstrap4Images"]["layout"])) {
|
||||
$shopEntity->setDisplayDelivery($event->getForm()->get('bootstrap4General')->get('displayDelivery')->getData());
|
||||
$shopEntity->setCustomTemplates($event->getForm()->get('bootstrap4General')->get('customTemplates')->getData());
|
||||
$shopEntity->setLayout($event->getForm()->get('bootstrap4General')->get('layout')->getData());
|
||||
$shopEntity->setGoogleanalyticscode($event->getForm()->get('bootstrap4General')->get('googleanalyticscode')->getData());
|
||||
$shopEntity->setGoogleanalyticscode(
|
||||
$event->getForm()->get('bootstrap4General')->get('googleanalyticscode')->getData(),
|
||||
);
|
||||
$shopEntity->setDefaultFunc($event->getForm()->get('bootstrap4General')->get('defaultFunc')->getData());
|
||||
$shopEntity->setDefaultParam($event->getForm()->get('bootstrap4General')->get('defaultParam')->getData());
|
||||
$shopEntity->setTemplateDisplayProductsCrossselling($event->getForm()->get('bootstrap4General')->get('templateDisplayProductsCrossselling')->getData());
|
||||
$shopEntity->setTemplateDisplayUserApproval($event->getForm()->get('bootstrap4General')->get('templateDisplayUserApproval')->getData());
|
||||
$shopEntity->setTemplateDisplayProductsCrossselling(
|
||||
$event->getForm()->get('bootstrap4General')->get('templateDisplayProductsCrossselling')->getData(),
|
||||
);
|
||||
$shopEntity->setTemplateDisplayUserApproval(
|
||||
$event->getForm()->get('bootstrap4General')->get('templateDisplayUserApproval')->getData(),
|
||||
);
|
||||
}
|
||||
|
||||
public function formPreSetData(FormEvent $event)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2682,8 +2682,7 @@ class BasketController extends TP_Controller_Action
|
||||
));
|
||||
|
||||
if (
|
||||
count($creditSystemArticleGroupId) == 0 && count($creditSystemArticleId) == 0 ||
|
||||
in_array($article->id, $creditSystemArticleId) ||
|
||||
in_array($article->id, $creditSystemArticleId) ||
|
||||
count(array_intersect($articleGroups, $creditSystemArticleGroupId)) > 0
|
||||
) {
|
||||
$this->view->errorGutscheincode = false;
|
||||
@ -2880,7 +2879,7 @@ class BasketController extends TP_Controller_Action
|
||||
if ($versand > 0 || $versandpos > 0) {
|
||||
$versand = $versand + $versandpos;
|
||||
}
|
||||
if ($creditSystemRest > 0 && $creditSystemShipping) {
|
||||
if (false && $creditSystemRest > 0 && $creditSystemShipping) {
|
||||
$mwert =
|
||||
$mwert + round(($versand / 100) * ((float) str_replace('%', '', $shippingtype['mwert'])), 2);
|
||||
if (
|
||||
@ -3028,7 +3027,7 @@ class BasketController extends TP_Controller_Action
|
||||
$versand = $versand + $versandpos;
|
||||
}
|
||||
|
||||
if ($creditSystemRest > 0 && $creditSystemShipping) {
|
||||
if (false && $creditSystemRest > 0 && $creditSystemShipping) {
|
||||
$mwert =
|
||||
$mwert + round(($versand / 100) * ((float) str_replace('%', '', $shippingtype['mwert'])), 2);
|
||||
if (
|
||||
@ -3239,7 +3238,7 @@ class BasketController extends TP_Controller_Action
|
||||
$this->view->paymentwert = $paymenttype['wert'];
|
||||
}
|
||||
}
|
||||
if ($creditSystemRest > 0 && $creditSystemPayment) {
|
||||
if (false && $creditSystemRest > 0 && $creditSystemPayment) {
|
||||
$mwert = $mwert + round(($this->view->paymentwert / 100) * $paymenttype['mwert'], 2);
|
||||
if ($creditSystemRest > round(($this->view->paymentwert / 100) * $paymenttype['mwert'], 2)) {
|
||||
$basket->setGutscheinAbzug(
|
||||
@ -3294,15 +3293,18 @@ class BasketController extends TP_Controller_Action
|
||||
$this->view->articles = $temp;
|
||||
|
||||
$this->_helper->layout->setLayout('default');
|
||||
$summenUeberAlleSteuersaetze = $mwertalle;
|
||||
$tmpMwertAlle = [];
|
||||
foreach ($mwertalle as $key => $wert) {
|
||||
$tmpMwertAlle[$key] = round(($wert / 100) * ((float) $key), 2);
|
||||
}
|
||||
$mwertalle = $tmpMwertAlle;
|
||||
|
||||
foreach ($basket->getGutscheinAbzugMwSt() as $key => $value) {
|
||||
$mwertalle[$key] = $mwertalle[$key] - $value;
|
||||
var_dump($summenUeberAlleSteuersaetze);
|
||||
$voucherMwert = [];
|
||||
foreach ($summenUeberAlleSteuersaetzer as $key => $value) {
|
||||
}
|
||||
|
||||
$this->view->productbruttogutschein = 0;
|
||||
if (count($this->view->articles) == 0) {
|
||||
$this->view->netto = 0;
|
||||
@ -3337,6 +3339,7 @@ class BasketController extends TP_Controller_Action
|
||||
$this->view->paymentwertbrutto,
|
||||
$this->view->versandbrutto,
|
||||
$mwertalle,
|
||||
$voucherMwert,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user