From 0c00d36236ab4fb8164abf9240376c8bf493cfd8 Mon Sep 17 00:00:00 2001 From: Thomas Peterson Date: Fri, 12 Dec 2025 10:51:44 +0100 Subject: [PATCH] Fixes --- src/new/config/reference.php | 4 +- src/new/phpstan.neon | 1 - .../System/UpdateBundle/Migrations/Base.php | 56 +-- .../Migrations/Version201810051543.php | 15 +- .../Migrations/Version201810061259.php | 21 +- .../Migrations/Version201810152153.php | 33 +- .../Migrations/Version201810242020.php | 13 +- .../Migrations/Version201811271538.php | 21 +- .../Migrations/Version201903022247.php | 16 +- .../Migrations/Version201903121042.php | 14 +- .../Migrations/Version201904281101.php | 60 +-- .../Migrations/Version20190506144710.php | 4 +- .../Migrations/Version20190612162510.php | 8 +- .../Migrations/Version20190708211200.php | 6 +- .../Migrations/Version201909031633.php | 14 +- .../Migrations/Version202002151056.php | 6 +- .../Migrations/Version202008071031.php | 6 +- .../Migrations/Version202010142145.php | 4 +- .../Migrations/Version202011021352.php | 4 +- .../Migrations/Version202011131532.php | 12 +- .../Migrations/Version202012152132.php | 4 +- .../Migrations/Version202101041346.php | 4 +- .../Migrations/Version202206051128.php | 8 +- .../Migrations/Version202210151952.php | 4 +- .../Migrations/Version202303021407.php | 4 +- .../Migrations/Version202304111643.php | 4 +- .../Migrations/Version202306261451.php | 10 +- .../Migrations/Version202310011140.php | 6 +- .../Migrations/Version202401151137.php | 6 +- .../Migrations/Version202404031556.php | 6 +- .../Migrations/Version202404220850.php | 4 +- .../Migrations/Version202411271406.php | 4 +- .../Migrations/Version20250303120812.php | 12 +- .../Migrations/Version20250303120815.php | 32 +- .../Migrations/Version20250304145512.php | 2 +- .../Migrations/Version20250313154423.php | 6 +- .../Migrations/Version20250613181223.php | 42 +- .../Migrations/Version20250702215721.php | 2 +- .../Migrations/Version20251124132556.php | 2 +- .../Migrations/Version20251202130922.php | 4 +- .../Migrations/Version20252402130922.php | 2 +- .../System/UpdateBundle/Service/Migration.php | 44 +- .../Controller/Backend/XmlController.php | 67 +++ .../Controller/DesignerController.php | 132 +++++ .../Controller/ImageController.php | 73 +++ .../Controller/PdfController.php | 118 +++++ .../Controller/PreviewController.php | 144 ++++++ .../Controller/StoreController.php | 67 +++ .../Controller/UploadController.php | 102 ++++ .../PSC/LaufkartenLayouter/Document/Image.php | 197 ++++++++ .../Document/Repository/ImageRepository.php | 19 + .../Form/Field/BackendFields.php | 81 ++++ .../Form/Field/EnableEditor.php | 143 ++++++ .../LaufkartenLayouter/Form/FormDesigner.php | 67 +++ .../Form/Group/FormLayouter.php | 31 ++ .../Form/Group/FormLayouterEditor.php | 31 ++ .../LaufkartenLayouter/Form/XML/EditType.php | 54 +++ .../PSC/LaufkartenLayouter/Model/Config.php | 75 +++ .../LaufkartenLayouter/Model/Config/Pdf.php | 71 +++ .../Model/Pdf/Elements/Base.php | 214 ++++++++ .../Model/Pdf/Elements/Image.php | 132 +++++ .../Model/Pdf/Elements/Media.php | 109 +++++ .../Model/Pdf/Elements/Pdf.php | 118 +++++ .../Model/Pdf/Elements/Text.php | 304 ++++++++++++ .../Model/Pdf/Elements/TextFlow.php | 65 +++ .../PSC/LaufkartenLayouter/Model/Pdf/Site.php | 180 +++++++ .../LaufkartenLayouter/Model/Steps/Column.php | 42 ++ .../Model/Steps/Options/Base.php | 114 +++++ .../Model/Steps/Options/Image.php | 73 +++ .../Model/Steps/Options/Preview.php | 35 ++ .../Model/Steps/Options/Select/Media.php | 73 +++ .../Model/Steps/Options/Select/Simple.php | 54 +++ .../Model/Steps/Options/Text.php | 49 ++ .../Model/Steps/Options/Textarea.php | 54 +++ .../LaufkartenLayouter/Model/Steps/Step.php | 169 +++++++ .../Parser/Config/Config.php | 49 ++ .../Parser/Form/Options/Base.php | 40 ++ .../Parser/Form/Options/Image.php | 35 ++ .../Parser/Form/Options/Preview.php | 32 ++ .../Parser/Form/Options/Select/Media.php | 35 ++ .../Parser/Form/Options/Select/Simple.php | 35 ++ .../Parser/Form/Options/Text.php | 33 ++ .../Parser/Form/Options/Textarea.php | 32 ++ .../LaufkartenLayouter/Parser/Form/Step.php | 71 +++ .../PSC/LaufkartenLayouter/Parser/Parser.php | 100 ++++ .../Parser/Pdf/Elements/Base.php | 46 ++ .../Parser/Pdf/Elements/Image.php | 37 ++ .../Parser/Pdf/Elements/Media.php | 37 ++ .../Parser/Pdf/Elements/Pdf.php | 35 ++ .../Parser/Pdf/Elements/Text.php | 67 +++ .../Parser/Pdf/Elements/TextFlow.php | 71 +++ .../LaufkartenLayouter/Parser/Pdf/Site.php | 78 +++ .../Custom/PSC/LaufkartenLayouter/Plugin.php | 26 + .../PSC/LaufkartenLayouter/Renderer/Pdf.php | 239 +++++++++ .../Resources/config/routing.yml | 12 + .../Resources/config/services.yml | 29 ++ .../Resources/public/css/image-picker.css | 36 ++ .../Resources/public/js/image-picker.min.js | 1 + .../views/backend/xml/edit.html.twig | 60 +++ .../Resources/views/designer/start.html.twig | 455 ++++++++++++++++++ .../views/form/field/backend.html.twig | 30 ++ .../views/form/field/enable_editor.html.twig | 16 + .../LaufkartenLayouter/Service/Layouter.php | 70 +++ .../Session/FormLayouter.php | 119 +++++ 104 files changed, 5417 insertions(+), 296 deletions(-) create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/Backend/XmlController.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/DesignerController.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/ImageController.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/PdfController.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/PreviewController.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/StoreController.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/UploadController.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Document/Image.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Document/Repository/ImageRepository.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Field/BackendFields.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Field/EnableEditor.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/FormDesigner.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Group/FormLayouter.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Group/FormLayouterEditor.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/XML/EditType.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Config.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Config/Pdf.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Base.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Image.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Media.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Pdf.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Text.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/TextFlow.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Site.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Column.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Base.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Image.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Preview.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Select/Media.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Select/Simple.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Text.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Textarea.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Step.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Config/Config.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Base.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Image.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Preview.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Select/Media.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Select/Simple.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Text.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Textarea.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Step.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Parser.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Base.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Image.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Media.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Pdf.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Text.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/TextFlow.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Site.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Plugin.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Renderer/Pdf.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/config/routing.yml create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/config/services.yml create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/public/css/image-picker.css create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/public/js/image-picker.min.js create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/backend/xml/edit.html.twig create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/designer/start.html.twig create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/form/field/backend.html.twig create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/form/field/enable_editor.html.twig create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Service/Layouter.php create mode 100644 src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Session/FormLayouter.php diff --git a/src/new/config/reference.php b/src/new/config/reference.php index 577739b43..1875f986e 100644 --- a/src/new/config/reference.php +++ b/src/new/config/reference.php @@ -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, - * default_timezone?: scalar|null, // Default: "Europe/Berlin" + * default_timezone?: scalar|null, // Default: "UTC" * 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, - * default_timezone?: scalar|null, // Default: "Europe/Berlin" + * default_timezone?: scalar|null, // Default: "UTC" * cdata?: scalar|null, // Default: true * }, * array_collection?: array{ diff --git a/src/new/phpstan.neon b/src/new/phpstan.neon index 1ea2b7344..97f8c7016 100644 --- a/src/new/phpstan.neon +++ b/src/new/phpstan.neon @@ -2,5 +2,4 @@ parameters: level: 7 paths: - src - - var/plugins diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Base.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Base.php index 3dd21b96f..ac9171d75 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Base.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Base.php @@ -16,6 +16,7 @@ namespace PSC\System\UpdateBundle\Migrations; use Doctrine\Bundle\DoctrineBundle\Registry; use Doctrine\Bundle\MongoDBBundle\ManagerRegistry; use Doctrine\ORM\EntityManager; +use Doctrine\ORM\EntityManagerInterface; use PSC\System\PluginBundle\Document\Plugin; use PSC\System\UpdateBundle\Document\Migration; use Symfony\Component\Finder\Finder; @@ -23,48 +24,38 @@ use Symfony\Component\Finder\SplFileInfo; abstract class Base { - protected $mustRun = true; - protected $entityManager; - protected $doctrineMongo; - protected $kernelRootDir; -/** - * Base constructor. - * @param $entityManager - * @param $doctrineMongo - */ - public function __construct(EntityManager $entityManager, ManagerRegistry $doctrineMongo, $kernelRootDir) - { + protected bool $mustRun = true; + protected EntityManagerInterface $entityManager; + protected ManagerRegistry $doctrineMongo; + protected string $kernelRootDir; + + public function __construct( + EntityManagerInterface $entityManager, + ManagerRegistry $doctrineMongo, + string $kernelRootDir, + ) { $this->entityManager = $entityManager; $this->doctrineMongo = $doctrineMongo; $this->kernelRootDir = $kernelRootDir; } - - /** - * @return bool - */ - public function isMustRun() + public function isMustRun(): bool { return $this->mustRun; } - - /** - * @param bool $mustRun - */ - public function setMustRun($mustRun) + public function setMustRun(bool $mustRun): void { $this->mustRun = $mustRun; } - public function getName() + public function getName(): string { return get_class($this); } - public function execute() + public function execute(): void { - $this->migrateDatabase(); $this->installDefaultPlugins(); $migration = new Migration(); @@ -74,22 +65,21 @@ abstract class Base $this->doctrineMongo->getManager()->flush(); } - abstract public function migrateDatabase(); - private function installDefaultPlugins() + abstract public function migrateDatabase(): void; + + private function installDefaultPlugins(): void { $finder = new Finder(); - $files = $finder - ->directories()->depth('== 2') - ->in($this->kernelRootDir . '/var/plugins/'); - /** @var \PSC\System\PluginBundle\Interfaces\Plugin $plugin */ + $files = $finder->directories()->depth('== 2')->in($this->kernelRootDir . '/var/plugins/'); $plugin = new \Plugin\System\PSC\Bootstrap4\Plugin(); - $plugObj = $this->doctrineMongo->getManager() + $plugObj = $this->doctrineMongo + ->getManager() ->getRepository('PSC\System\PluginBundle\Document\Plugin') ->findOneBy(['pluginId' => $plugin->getIdentifier()]); - /** @var SplFileInfo $file */ + /** @var SplFileInfo $file */ foreach ($files as $file) { $name = str_replace('/', '\\', '/Plugin/' . $file->getRelativePathname() . '/Plugin'); -/** @var \PSC\System\PluginBundle\Interfaces\Plugin $plugin */ + /** @var \PSC\System\PluginBundle\Interfaces\Plugin $plugin */ $plugin = new $name(); if (!$plugObj) { $plugObj = new Plugin(); diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version201810051543.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version201810051543.php index aa978fec0..fea324061 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version201810051543.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version201810051543.php @@ -1,22 +1,11 @@ - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ - namespace PSC\System\UpdateBundle\Migrations; class Version201810051543 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE contact_address ADD pos INT NULL"); + $this->entityManager->getConnection()->executeQuery('ALTER TABLE contact_address ADD pos INT NULL'); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version201810061259.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version201810061259.php index 12999c3c7..34fd2f6db 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version201810061259.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version201810061259.php @@ -1,24 +1,15 @@ - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ - namespace PSC\System\UpdateBundle\Migrations; class Version201810061259 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE contact_address MODIFY install_id int(8) null"); - $this->entityManager->getConnection()->exec("ALTER TABLE `contact_address` MODIFY `firstname` varchar(100) null; + $this->entityManager->getConnection()->executeQuery('ALTER TABLE contact_address MODIFY install_id int(8) null'); + $this->entityManager + ->getConnection() + ->executeQuery('ALTER TABLE `contact_address` MODIFY `firstname` varchar(100) null; ALTER TABLE `contact_address` MODIFY `lastname` varchar(100) null; ALTER TABLE `contact_address` MODIFY `street` varchar(255) null; ALTER TABLE `contact_address` MODIFY `house_number` varchar(20) null; @@ -28,6 +19,6 @@ class Version201810061259 extends Base ALTER TABLE `contact_address` MODIFY `mobil_phone` varchar(100) null; ALTER TABLE `contact_address` MODIFY `email` varchar(255) null; ALTER TABLE `contact_address` MODIFY `company` varchar(100) null; - ALTER TABLE `contact_address` MODIFY `country` varchar(100) null;"); + ALTER TABLE `contact_address` MODIFY `country` varchar(100) null;'); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version201810152153.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version201810152153.php index 729d17e0d..582d4e5a1 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version201810152153.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version201810152153.php @@ -1,31 +1,20 @@ - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ - namespace PSC\System\UpdateBundle\Migrations; class Version201810152153 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE cms ADD enable INT(1) NULL"); - $this->entityManager->getConnection()->exec("ALTER TABLE cms MODIFY meta_keywords text null"); - $this->entityManager->getConnection()->exec("ALTER TABLE cms MODIFY meta_description text null"); - $this->entityManager->getConnection()->exec("ALTER TABLE cms MODIFY meta_author varchar(255) null"); - $this->entityManager->getConnection()->exec("ALTER TABLE cms MODIFY meta_custom_title varchar(255) null"); - $this->entityManager->getConnection()->exec("ALTER TABLE cms MODIFY meta_og_title varchar(255) null"); - $this->entityManager->getConnection()->exec("ALTER TABLE cms MODIFY meta_og_type varchar(255) null"); - $this->entityManager->getConnection()->exec("ALTER TABLE cms MODIFY meta_og_url varchar(255) null"); - $this->entityManager->getConnection()->exec("ALTER TABLE cms MODIFY meta_og_image varchar(255) null"); - $this->entityManager->getConnection()->exec("ALTER TABLE cms MODIFY meta_og_description text null"); + $this->entityManager->getConnection()->executeQuery('ALTER TABLE cms ADD enable INT(1) NULL'); + $this->entityManager->getConnection()->executeQuery('ALTER TABLE cms MODIFY meta_keywords text null'); + $this->entityManager->getConnection()->executeQuery('ALTER TABLE cms MODIFY meta_description text null'); + $this->entityManager->getConnection()->executeQuery('ALTER TABLE cms MODIFY meta_author varchar(255) null'); + $this->entityManager->getConnection()->executeQuery('ALTER TABLE cms MODIFY meta_custom_title varchar(255) null'); + $this->entityManager->getConnection()->executeQuery('ALTER TABLE cms MODIFY meta_og_title varchar(255) null'); + $this->entityManager->getConnection()->executeQuery('ALTER TABLE cms MODIFY meta_og_type varchar(255) null'); + $this->entityManager->getConnection()->executeQuery('ALTER TABLE cms MODIFY meta_og_url varchar(255) null'); + $this->entityManager->getConnection()->executeQuery('ALTER TABLE cms MODIFY meta_og_image varchar(255) null'); + $this->entityManager->getConnection()->executeQuery('ALTER TABLE cms MODIFY meta_og_description text null'); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version201810242020.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version201810242020.php index 796dc1f20..0e91215d8 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version201810242020.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version201810242020.php @@ -1,21 +1,10 @@ - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ - namespace PSC\System\UpdateBundle\Migrations; class Version201810242020 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version201811271538.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version201811271538.php index 1be753344..4823d5cbb 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version201811271538.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version201811271538.php @@ -1,25 +1,14 @@ - * @copyright 2012-2013 PrintshopCreator GmbH - * @license Private - * @link http://www.printshopcreator.de - */ - namespace PSC\System\UpdateBundle\Migrations; class Version201811271538 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE cms MODIFY sor varchar(10) null"); - $this->entityManager->getConnection()->exec("ALTER TABLE cms MODIFY url varchar(255) null"); - $this->entityManager->getConnection()->exec("ALTER TABLE cms MODIFY parent int(8) null"); - $this->entityManager->getConnection()->exec("ALTER TABLE cms MODIFY pos varchar(100) null"); + $this->entityManager->getConnection()->executeQuery('ALTER TABLE cms MODIFY sor varchar(10) null'); + $this->entityManager->getConnection()->executeQuery('ALTER TABLE cms MODIFY url varchar(255) null'); + $this->entityManager->getConnection()->executeQuery('ALTER TABLE cms MODIFY parent int(8) null'); + $this->entityManager->getConnection()->executeQuery('ALTER TABLE cms MODIFY pos varchar(100) null'); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version201903022247.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version201903022247.php index e8e1ddb5b..b599ecb6d 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version201903022247.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version201903022247.php @@ -15,14 +15,14 @@ namespace PSC\System\UpdateBundle\Migrations; class Version201903022247 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE article MODIFY custom_1_title varchar(255) null"); - $this->entityManager->getConnection()->exec("ALTER TABLE article MODIFY vorlage_file varchar(255) null"); - $this->entityManager->getConnection()->exec("ALTER TABLE article MODIFY confirmaccount_id int(8) null"); - $this->entityManager->getConnection()->exec("ALTER TABLE credit_system MODIFY pre_code varchar(255) null"); - $this->entityManager->getConnection()->exec("ALTER TABLE credit_system MODIFY articlegroup_id varchar(255) null"); - $this->entityManager->getConnection()->exec("ALTER TABLE credit_system MODIFY product_id varchar(255) null"); - $this->entityManager->getConnection()->exec("ALTER TABLE credit_system_detail MODIFY contact_id int(8) null"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE article MODIFY custom_1_title varchar(255) null"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE article MODIFY vorlage_file varchar(255) null"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE article MODIFY confirmaccount_id int(8) null"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE credit_system MODIFY pre_code varchar(255) null"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE credit_system MODIFY articlegroup_id varchar(255) null"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE credit_system MODIFY product_id varchar(255) null"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE credit_system_detail MODIFY contact_id int(8) null"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version201903121042.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version201903121042.php index 1934deb77..281e68f1d 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version201903121042.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version201903121042.php @@ -15,13 +15,13 @@ namespace PSC\System\UpdateBundle\Migrations; class Version201903121042 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE article MODIFY preis float null"); - $this->entityManager->getConnection()->exec("ALTER TABLE article MODIFY upload_article_status int(4) null"); - $this->entityManager->getConnection()->exec("ALTER TABLE article MODIFY upload_post_status int(4) null"); - $this->entityManager->getConnection()->exec("ALTER TABLE article MODIFY upload_email_status int(4) null"); - $this->entityManager->getConnection()->exec("ALTER TABLE article MODIFY upload_center_status int(4) null"); - $this->entityManager->getConnection()->exec("ALTER TABLE orderspos ADD INDEX (uuid)"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE article MODIFY preis float null"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE article MODIFY upload_article_status int(4) null"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE article MODIFY upload_post_status int(4) null"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE article MODIFY upload_email_status int(4) null"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE article MODIFY upload_center_status int(4) null"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE orderspos ADD INDEX (uuid)"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version201904281101.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version201904281101.php index c937eeaaa..3b2ef840f 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version201904281101.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version201904281101.php @@ -15,36 +15,36 @@ namespace PSC\System\UpdateBundle\Migrations; class Version201904281101 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN pdname"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN pdoptions"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN pdremoteoptions"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN pdkeycode"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN pdurl1"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN pdurl2"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN pdurl3"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN pdurl4"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN pdurl5"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN pdcompanydestrict"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN pdcompanyname"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN pdcompanystreet"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN pdcompanycity"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN pdcompanytel"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN pdcompanyfax"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN pdcompanyemail"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN pdcompanyweb"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN pdcompanyid"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN ftp_username"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN ftp_password"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN ftp_uid"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN ftp_gid"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN ftp_dir"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN ftp_quotafiles"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN ftp_quotasize"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN ftp_ulbandwidth"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop DROP COLUMN ftp_dlbandwidth"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop MODIFY parameter LONGTEXT"); - $this->entityManager->getConnection()->exec("ALTER TABLE shop MODIFY formel LONGTEXT"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN pdname"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN pdoptions"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN pdremoteoptions"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN pdkeycode"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN pdurl1"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN pdurl2"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN pdurl3"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN pdurl4"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN pdurl5"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN pdcompanydestrict"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN pdcompanyname"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN pdcompanystreet"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN pdcompanycity"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN pdcompanytel"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN pdcompanyfax"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN pdcompanyemail"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN pdcompanyweb"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN pdcompanyid"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN ftp_username"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN ftp_password"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN ftp_uid"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN ftp_gid"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN ftp_dir"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN ftp_quotafiles"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN ftp_quotasize"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN ftp_ulbandwidth"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop DROP COLUMN ftp_dlbandwidth"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop MODIFY parameter LONGTEXT"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shop MODIFY formel LONGTEXT"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20190506144710.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20190506144710.php index 5965eae3c..0e8476fb0 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20190506144710.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20190506144710.php @@ -15,8 +15,8 @@ namespace PSC\System\UpdateBundle\Migrations; class Version20190506144710 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE contact ADD virtual INT(1) NULL DEFAULT 0"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE contact ADD virtual INT(1) NULL DEFAULT 0"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20190612162510.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20190612162510.php index 44d6fdab8..ac03ae2a3 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20190612162510.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20190612162510.php @@ -15,16 +15,16 @@ namespace PSC\System\UpdateBundle\Migrations; class Version20190612162510 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE article_group ADD private INT(1) NULL DEFAULT 0"); - $this->entityManager->getConnection()->exec("CREATE TABLE `contact_productgroup` ( + $this->entityManager->getConnection()->executeQuery("ALTER TABLE article_group ADD private INT(1) NULL DEFAULT 0"); + $this->entityManager->getConnection()->executeQuery("CREATE TABLE `contact_productgroup` ( `contact_id` bigint(20) NOT NULL DEFAULT '0', `productgroup_id` bigint(20) NOT NULL DEFAULT '0', PRIMARY KEY (`contact_id`,`productgroup_id`), KEY `productgroup_id` (`productgroup_id`) )"); - $this->entityManager->getConnection()->exec("CREATE TABLE `account_productgroup` ( + $this->entityManager->getConnection()->executeQuery("CREATE TABLE `account_productgroup` ( `account_id` bigint(20) NOT NULL DEFAULT '0', `productgroup_id` bigint(20) NOT NULL DEFAULT '0', PRIMARY KEY (`account_id`,`productgroup_id`), diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20190708211200.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20190708211200.php index 1112e0d7e..460ab87b4 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20190708211200.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20190708211200.php @@ -15,9 +15,9 @@ namespace PSC\System\UpdateBundle\Migrations; class Version20190708211200 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE shippingtype ADD price_from INT(8) NULL DEFAULT 0"); - $this->entityManager->getConnection()->exec("ALTER TABLE shippingtype ADD price_to INT(8) NULL DEFAULT 0"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shippingtype ADD price_from INT(8) NULL DEFAULT 0"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shippingtype ADD price_to INT(8) NULL DEFAULT 0"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version201909031633.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version201909031633.php index 931f8ea78..80c741c67 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version201909031633.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version201909031633.php @@ -17,19 +17,15 @@ use PSC\Shop\EntityBundle\Document\Country; class Version201909031633 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - - $countrys = $this->doctrineMongo - ->getRepository('PSC\Shop\EntityBundle\Document\Country') - ->findAll(); + $countrys = $this->doctrineMongo->getRepository('PSC\Shop\EntityBundle\Document\Country')->findAll(); if (count($countrys) == 0) { - $shops = $this->entityManager - ->getRepository('PSC\Shop\EntityBundle\Entity\Shop')->findAll(); + $shops = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Shop')->findAll(); foreach ($shops as $shop) { $country = new Country(); - $country->setShop($shop->getUid()); - $country->setCode("DE"); + $country->setShop((string) $shop->getUid()); + $country->setCode('DE'); $country->setWithTaxWithUstNr(true); $country->setWithTaxWithoutUstNr(true); $this->doctrineMongo->getManager()->persist($country); diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202002151056.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202002151056.php index 5a7a1e335..80ad3542c 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202002151056.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202002151056.php @@ -15,9 +15,9 @@ namespace PSC\System\UpdateBundle\Migrations; class Version202002151056 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE orders MODIFY info text null;"); - $this->entityManager->getConnection()->exec("ALTER TABLE orders MODIFY delivery_address int(8) null;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE orders MODIFY info text null;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE orders MODIFY delivery_address int(8) null;"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202008071031.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202008071031.php index 865907bda..81ef5f5a3 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202008071031.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202008071031.php @@ -15,9 +15,9 @@ namespace PSC\System\UpdateBundle\Migrations; class Version202008071031 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE article ROW_FORMAT=DYNAMIC;"); - $this->entityManager->getConnection()->exec("ALTER TABLE article MODIFY pos BIGINT;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE article ROW_FORMAT=DYNAMIC;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE article MODIFY pos BIGINT;"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202010142145.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202010142145.php index 333b612c4..83abd75f5 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202010142145.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202010142145.php @@ -15,8 +15,8 @@ namespace PSC\System\UpdateBundle\Migrations; class Version202010142145 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE orders ADD type INT(1) DEFAULT 1"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE orders ADD type INT(1) DEFAULT 1"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202011021352.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202011021352.php index ba83d49a8..8a0fe5324 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202011021352.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202011021352.php @@ -15,8 +15,8 @@ namespace PSC\System\UpdateBundle\Migrations; class Version202011021352 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE orderspos ADD INDEX (article_id)"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE orderspos ADD INDEX (article_id)"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202011131532.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202011131532.php index e588d3223..e3da67539 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202011131532.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202011131532.php @@ -15,12 +15,12 @@ namespace PSC\System\UpdateBundle\Migrations; class Version202011131532 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE article MODIFY custom_1_text text null;"); - $this->entityManager->getConnection()->exec("ALTER TABLE article MODIFY vorlage_info text null;"); - $this->entityManager->getConnection()->exec("ALTER TABLE article MODIFY confirm int(1) null;"); - $this->entityManager->getConnection()->exec("ALTER TABLE article MODIFY confirmone int(1) null;"); - $this->entityManager->getConnection()->exec("ALTER TABLE article MODIFY confirmaccount_id int(8) null;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE article MODIFY custom_1_text text null;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE article MODIFY vorlage_info text null;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE article MODIFY confirm int(1) null;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE article MODIFY confirmone int(1) null;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE article MODIFY confirmaccount_id int(8) null;"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202012152132.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202012152132.php index 95d651df2..8317d2541 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202012152132.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202012152132.php @@ -15,8 +15,8 @@ namespace PSC\System\UpdateBundle\Migrations; class Version202012152132 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE credit_system ADD mode INT(1) NULL DEFAULT 1"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE credit_system ADD mode INT(1) NULL DEFAULT 1"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202101041346.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202101041346.php index 982e9dddb..8746ccb98 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202101041346.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202101041346.php @@ -15,8 +15,8 @@ namespace PSC\System\UpdateBundle\Migrations; class Version202101041346 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE paymenttype ADD mwert INT(2) NULL DEFAULT 19"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE paymenttype ADD mwert INT(2) NULL DEFAULT 19"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202206051128.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202206051128.php index 7d764c508..2db55cda0 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202206051128.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202206051128.php @@ -15,10 +15,10 @@ namespace PSC\System\UpdateBundle\Migrations; class Version202206051128 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE paymenttype MODIFY mwert DOUBLE NULL"); - $this->entityManager->getConnection()->exec("ALTER TABLE article MODIFY mwert DOUBLE NULL"); - $this->entityManager->getConnection()->exec("ALTER TABLE shippingtype MODIFY mwert DOUBLE NULL"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE paymenttype MODIFY mwert DOUBLE NULL"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE article MODIFY mwert DOUBLE NULL"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE shippingtype MODIFY mwert DOUBLE NULL"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202210151952.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202210151952.php index 5af96281b..556ae995e 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202210151952.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202210151952.php @@ -15,9 +15,9 @@ namespace PSC\System\UpdateBundle\Migrations; class Version202210151952 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec(" + $this->entityManager->getConnection()->executeQuery(" alter table layouter_session modify xmlconfig mediumtext null; alter table layouter_session diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202303021407.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202303021407.php index df2e97e6b..c3e2975e5 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202303021407.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202303021407.php @@ -4,8 +4,8 @@ namespace PSC\System\UpdateBundle\Migrations; class Version202303021407 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("alter table shippingtype add mode tinyint default 1 null;"); + $this->entityManager->getConnection()->executeQuery("alter table shippingtype add mode tinyint default 1 null;"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202304111643.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202304111643.php index c517b42cf..4e634ad4d 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202304111643.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202304111643.php @@ -4,8 +4,8 @@ namespace PSC\System\UpdateBundle\Migrations; class Version202304111643 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("create index layouter_mode_render_print on orderspos (layouter_mode, render_print);"); + $this->entityManager->getConnection()->executeQuery("create index layouter_mode_render_print on orderspos (layouter_mode, render_print);"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202306261451.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202306261451.php index ccdd9d375..d474e9bda 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202306261451.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202306261451.php @@ -15,11 +15,11 @@ namespace PSC\System\UpdateBundle\Migrations; class Version202306261451 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("alter table article modify pos BIGINT null;"); - $this->entityManager->getConnection()->exec("create index article_id_a6_org_article_index on article (id, a6_org_article);"); - $this->entityManager->getConnection()->exec("create index orderspos_article_id_orders_id_index on orderspos (article_id, orders_id);"); - $this->entityManager->getConnection()->exec("alter table orders add constraint orders_pk unique (id);"); + $this->entityManager->getConnection()->executeQuery("alter table article modify pos BIGINT null;"); + $this->entityManager->getConnection()->executeQuery("create index article_id_a6_org_article_index on article (id, a6_org_article);"); + $this->entityManager->getConnection()->executeQuery("create index orderspos_article_id_orders_id_index on orderspos (article_id, orders_id);"); + $this->entityManager->getConnection()->executeQuery("alter table orders add constraint orders_pk unique (id);"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202310011140.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202310011140.php index 45c8a1bea..227ce5d5a 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202310011140.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202310011140.php @@ -4,9 +4,9 @@ namespace PSC\System\UpdateBundle\Migrations; class Version202310011140 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE paymenttype ADD price_from INT(8) NULL DEFAULT 0"); - $this->entityManager->getConnection()->exec("ALTER TABLE paymenttype ADD price_to INT(8) NULL DEFAULT 0"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE paymenttype ADD price_from INT(8) NULL DEFAULT 0"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE paymenttype ADD price_to INT(8) NULL DEFAULT 0"); } } \ No newline at end of file diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202401151137.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202401151137.php index cee4b9f69..ac87dec0d 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202401151137.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202401151137.php @@ -17,9 +17,9 @@ use PSC\System\UpdateBundle\Migrations\Base; class Version202401151137 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE credit_system ADD payment INT(1) NULL DEFAULT 1"); - $this->entityManager->getConnection()->exec("ALTER TABLE credit_system ADD shipping INT(1) NULL DEFAULT 1"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE credit_system ADD payment INT(1) NULL DEFAULT 1"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE credit_system ADD shipping INT(1) NULL DEFAULT 1"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202404031556.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202404031556.php index 1b1068655..501c5b05f 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202404031556.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202404031556.php @@ -15,9 +15,9 @@ namespace PSC\System\UpdateBundle\Migrations; class Version202404031556 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE credit_system ADD zeroShipping INT(1) DEFAULT 0"); - $this->entityManager->getConnection()->exec("ALTER TABLE credit_system ADD zeroPayment INT(1) DEFAULT 0"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE credit_system ADD zeroShipping INT(1) DEFAULT 0"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE credit_system ADD zeroPayment INT(1) DEFAULT 0"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202404220850.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202404220850.php index e43bd345e..17acae781 100755 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202404220850.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202404220850.php @@ -6,7 +6,7 @@ class Version202404220850 extends Base { public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("alter table contact modify self_destrict varchar(255) null;"); - $this->entityManager->getConnection()->exec("alter table contact modify destrict varchar(255) null;"); + $this->entityManager->getConnection()->executeQuery("alter table contact modify self_destrict varchar(255) null;"); + $this->entityManager->getConnection()->executeQuery("alter table contact modify destrict varchar(255) null;"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202411271406.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202411271406.php index 4278983e6..0b68e30d3 100644 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version202411271406.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version202411271406.php @@ -6,7 +6,7 @@ class Version202411271406 extends Base { public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE orderspos ADD INDEX created_date (createdd);"); - $this->entityManager->getConnection()->exec("ALTER TABLE papierdb ADD INDEX art_nr (art_nr);"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE orderspos ADD INDEX created_date (createdd);"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE papierdb ADD INDEX art_nr (art_nr);"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250303120812.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250303120812.php index a79c0019d..ebd3625bc 100644 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250303120812.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250303120812.php @@ -15,12 +15,12 @@ namespace PSC\System\UpdateBundle\Migrations; class Version20250303120812 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE article MODIFY upload_article int(1) null default 0"); - $this->entityManager->getConnection()->exec("ALTER TABLE article MODIFY upload_post int(1) null default 0"); - $this->entityManager->getConnection()->exec("ALTER TABLE article MODIFY upload_email int(1) null default 0"); - $this->entityManager->getConnection()->exec("ALTER TABLE article MODIFY upload_center int(1) null default 0"); - $this->entityManager->getConnection()->exec("ALTER TABLE article MODIFY upload_weblayouter int(1) null default 0"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE article MODIFY upload_article int(1) null default 0"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE article MODIFY upload_post int(1) null default 0"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE article MODIFY upload_email int(1) null default 0"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE article MODIFY upload_center int(1) null default 0"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE article MODIFY upload_weblayouter int(1) null default 0"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250303120815.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250303120815.php index 8f7860a99..cc6796e72 100644 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250303120815.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250303120815.php @@ -15,22 +15,22 @@ namespace PSC\System\UpdateBundle\Migrations; class Version20250303120815 extends Base { - public function migrateDatabase() + public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE orders MODIFY preis float default 0;"); - $this->entityManager->getConnection()->exec("ALTER TABLE orders MODIFY enable tinyint(1) default 1;"); - $this->entityManager->getConnection()->exec("ALTER TABLE orders MODIFY delivery_same int(1) default 0;"); - $this->entityManager->getConnection()->exec("ALTER TABLE orders MODIFY sender_same int(1) default 0;"); - $this->entityManager->getConnection()->exec("ALTER TABLE orders MODIFY invoice_same int(1) default 0;"); - $this->entityManager->getConnection()->exec("ALTER TABLE orders MODIFY zahlkosten float default 0;"); - $this->entityManager->getConnection()->exec("ALTER TABLE orders MODIFY versandkosten float default 0;"); - $this->entityManager->getConnection()->exec("ALTER TABLE orders MODIFY gutscheinabzugtyp int(1) default 0;"); - $this->entityManager->getConnection()->exec("ALTER TABLE orders MODIFY use_account_as_invoice int(1) default 0;"); - $this->entityManager->getConnection()->exec("ALTER TABLE orders MODIFY mwertalle mediumtext default null;"); - $this->entityManager->getConnection()->exec("ALTER TABLE orders MODIFY version int(5) default 1;"); - $this->entityManager->getConnection()->exec("ALTER TABLE orderspos MODIFY resale_price float default 0;"); - $this->entityManager->getConnection()->exec("ALTER TABLE orderspos MODIFY status int(3) default 10;"); - $this->entityManager->getConnection()->exec("ALTER TABLE orderspos MODIFY layouter_mode int(1) default 0;"); - $this->entityManager->getConnection()->exec("ALTER TABLE orderspos MODIFY render_print int(1) default 0;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE orders MODIFY preis float default 0;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE orders MODIFY enable tinyint(1) default 1;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE orders MODIFY delivery_same int(1) default 0;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE orders MODIFY sender_same int(1) default 0;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE orders MODIFY invoice_same int(1) default 0;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE orders MODIFY zahlkosten float default 0;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE orders MODIFY versandkosten float default 0;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE orders MODIFY gutscheinabzugtyp int(1) default 0;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE orders MODIFY use_account_as_invoice int(1) default 0;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE orders MODIFY mwertalle mediumtext default null;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE orders MODIFY version int(5) default 1;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE orderspos MODIFY resale_price float default 0;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE orderspos MODIFY status int(3) default 10;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE orderspos MODIFY layouter_mode int(1) default 0;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE orderspos MODIFY render_print int(1) default 0;"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250304145512.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250304145512.php index 0aaf1364e..50506af2a 100644 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250304145512.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250304145512.php @@ -6,6 +6,6 @@ class Version20250304145512 extends Base { public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE credit_system ADD min_basket_value float null default 0;"); + $this->entityManager->getConnection()->executeQuery("ALTER TABLE credit_system ADD min_basket_value float null default 0;"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250313154423.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250313154423.php index c92ae5eb5..bf22340f4 100644 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250313154423.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250313154423.php @@ -6,8 +6,8 @@ class Version20250313154423 extends Base { public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec('ALTER TABLE news ADD from_date datetime NULL DEFAULT null'); - $this->entityManager->getConnection()->exec('ALTER TABLE news ADD to_date datetime NULL DEFAULT null'); - $this->entityManager->getConnection()->exec('ALTER TABLE news ADD media json NULL DEFAULT null'); + $this->entityManager->getConnection()->executeQuery('ALTER TABLE news ADD from_date datetime NULL DEFAULT null'); + $this->entityManager->getConnection()->executeQuery('ALTER TABLE news ADD to_date datetime NULL DEFAULT null'); + $this->entityManager->getConnection()->executeQuery('ALTER TABLE news ADD media json NULL DEFAULT null'); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250613181223.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250613181223.php index 290d949fd..972d96c16 100644 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250613181223.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250613181223.php @@ -6,26 +6,26 @@ class Version20250613181223 extends Base { public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("alter table article modify column a6_xmlpagesfile varchar(255) default null;"); - $this->entityManager->getConnection()->exec("alter table article modify column a6_xmlpagetemplatesfile varchar(255) default null;"); - $this->entityManager->getConnection()->exec("alter table article modify column a6_xmlpageobjectsfile varchar(255) default null;"); - $this->entityManager->getConnection()->exec("alter table article modify column layouterid varchar(255) default null;"); - $this->entityManager->getConnection()->exec("alter table article modify column resale int(1) default null;"); - $this->entityManager->getConnection()->exec("alter table article modify column a6_resale_price float(20,2) default 0;"); - $this->entityManager->getConnection()->exec("alter table article modify column render_new_preview_image int(1) default null;"); - $this->entityManager->getConnection()->exec("alter table article modify column render_new_preview_pdf int(1) default null;"); - $this->entityManager->getConnection()->exec("alter table article modify column render_new_preview_gallery int(1) default null;"); - $this->entityManager->getConnection()->exec("alter table article modify column visits int(8) default 0;"); - $this->entityManager->getConnection()->exec("alter table article modify column a6_xmlextendpreviewxslfofile varchar(255) default null;"); - $this->entityManager->getConnection()->exec("alter table article modify column rate int(8) default 0;"); - $this->entityManager->getConnection()->exec("alter table article modify column rate_count int(8) default 0;"); - $this->entityManager->getConnection()->exec("alter table article modify column template_admin int(1) default null;"); - $this->entityManager->getConnection()->exec("alter table article modify column template_system_operator int(1) default null;"); - $this->entityManager->getConnection()->exec("alter table article modify column lager_file_file varchar(255) default null;"); - $this->entityManager->getConnection()->exec("alter table article modify column lager_file_preview varchar(255) default null;"); - $this->entityManager->getConnection()->exec("alter table article modify column upload_weblayouter_status int(4) default null;"); - $this->entityManager->getConnection()->exec("alter table article modify column resale_design int(1) default null;"); - $this->entityManager->getConnection()->exec("alter table article modify column motive_calc mediumtext default null;"); - $this->entityManager->getConnection()->exec("alter table article modify column motive_price float default null;"); + $this->entityManager->getConnection()->executeQuery("alter table article modify column a6_xmlpagesfile varchar(255) default null;"); + $this->entityManager->getConnection()->executeQuery("alter table article modify column a6_xmlpagetemplatesfile varchar(255) default null;"); + $this->entityManager->getConnection()->executeQuery("alter table article modify column a6_xmlpageobjectsfile varchar(255) default null;"); + $this->entityManager->getConnection()->executeQuery("alter table article modify column layouterid varchar(255) default null;"); + $this->entityManager->getConnection()->executeQuery("alter table article modify column resale int(1) default null;"); + $this->entityManager->getConnection()->executeQuery("alter table article modify column a6_resale_price float(20,2) default 0;"); + $this->entityManager->getConnection()->executeQuery("alter table article modify column render_new_preview_image int(1) default null;"); + $this->entityManager->getConnection()->executeQuery("alter table article modify column render_new_preview_pdf int(1) default null;"); + $this->entityManager->getConnection()->executeQuery("alter table article modify column render_new_preview_gallery int(1) default null;"); + $this->entityManager->getConnection()->executeQuery("alter table article modify column visits int(8) default 0;"); + $this->entityManager->getConnection()->executeQuery("alter table article modify column a6_xmlextendpreviewxslfofile varchar(255) default null;"); + $this->entityManager->getConnection()->executeQuery("alter table article modify column rate int(8) default 0;"); + $this->entityManager->getConnection()->executeQuery("alter table article modify column rate_count int(8) default 0;"); + $this->entityManager->getConnection()->executeQuery("alter table article modify column template_admin int(1) default null;"); + $this->entityManager->getConnection()->executeQuery("alter table article modify column template_system_operator int(1) default null;"); + $this->entityManager->getConnection()->executeQuery("alter table article modify column lager_file_file varchar(255) default null;"); + $this->entityManager->getConnection()->executeQuery("alter table article modify column lager_file_preview varchar(255) default null;"); + $this->entityManager->getConnection()->executeQuery("alter table article modify column upload_weblayouter_status int(4) default null;"); + $this->entityManager->getConnection()->executeQuery("alter table article modify column resale_design int(1) default null;"); + $this->entityManager->getConnection()->executeQuery("alter table article modify column motive_calc mediumtext default null;"); + $this->entityManager->getConnection()->executeQuery("alter table article modify column motive_price float default null;"); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250702215721.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250702215721.php index 90e35d387..e614fd5f8 100644 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250702215721.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20250702215721.php @@ -6,7 +6,7 @@ class Version20250702215721 extends Base { public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("CREATE TABLE `account_cms` ( + $this->entityManager->getConnection()->executeQuery("CREATE TABLE `account_cms` ( `account_id` bigint(20) NOT NULL DEFAULT 0, `cms_id` bigint(20) NOT NULL DEFAULT 0, PRIMARY KEY (`account_id`,`cms_id`), diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20251124132556.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20251124132556.php index 0d174806e..24c4210d8 100644 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20251124132556.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20251124132556.php @@ -6,6 +6,6 @@ class Version20251124132556 extends Base { public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec('ALTER TABLE papierdb MODIFY laufrichtung varchar(60) null;'); + $this->entityManager->getConnection()->executeQuery('ALTER TABLE papierdb MODIFY laufrichtung varchar(60) null;'); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20251202130922.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20251202130922.php index d10a5cc52..aa8b85909 100644 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20251202130922.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20251202130922.php @@ -6,7 +6,7 @@ class Version20251202130922 extends Base { public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("update cms set sor = 1 where sor = '';"); - $this->entityManager->getConnection()->exec('ALTER TABLE cms MODIFY sor int(4) null;'); + $this->entityManager->getConnection()->executeQuery("update cms set sor = 1 where sor = '';"); + $this->entityManager->getConnection()->executeQuery('ALTER TABLE cms MODIFY sor int(4) null;'); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20252402130922.php b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20252402130922.php index c36312f6d..7b2f5271f 100644 --- a/src/new/src/PSC/System/UpdateBundle/Migrations/Version20252402130922.php +++ b/src/new/src/PSC/System/UpdateBundle/Migrations/Version20252402130922.php @@ -6,6 +6,6 @@ class Version20252402130922 extends Base { public function migrateDatabase(): void { - $this->entityManager->getConnection()->exec("ALTER TABLE article ADD sub_title varchar(100) null;"); + $this->entityManager->getConnection()->executeQuery('ALTER TABLE article ADD sub_title varchar(100) null;'); } } diff --git a/src/new/src/PSC/System/UpdateBundle/Service/Migration.php b/src/new/src/PSC/System/UpdateBundle/Service/Migration.php index 604afe9e0..509d1d5ef 100755 --- a/src/new/src/PSC/System/UpdateBundle/Service/Migration.php +++ b/src/new/src/PSC/System/UpdateBundle/Service/Migration.php @@ -10,30 +10,31 @@ use Symfony\Component\Finder\Finder; use Symfony\Component\Finder\SplFileInfo; use Symfony\Component\HttpKernel\KernelInterface; -/** - * Migration Service - * - * @author Thomas Peterson - */ class Migration { - protected $entityManager; - protected $doctrineMongo; - protected $kernel; + protected EntityManagerInterface $entityManager; + protected ManagerRegistry $doctrineMongo; + protected KernelInterface $kernel; - public function __construct(EntityManagerInterface $entityManager, ManagerRegistry $doctrine_mongodb, KernelInterface $kernel) - { + public function __construct( + EntityManagerInterface $entityManager, + ManagerRegistry $doctrine_mongodb, + KernelInterface $kernel, + ) { $this->entityManager = $entityManager; $this->doctrineMongo = $doctrine_mongodb; $this->kernel = $kernel; } - public function listMigrations() + /** + * @return array + */ + public function listMigrations(): array { return $this->buildMigrationArray(); } - public function executeMigrations() + public function executeMigrations(): void { $migrations = $this->buildMigrationArray(); @@ -45,10 +46,9 @@ class Migration } } - public function checkIfMigrationMustRun() + public function checkIfMigrationMustRun(): bool { - - if($this->kernel->getEnvironment() == 'test') { + if ($this->kernel->getEnvironment() == 'test') { return false; } @@ -60,22 +60,28 @@ class Migration return true; } } + + return false; } - private function buildMigrationArray() + /** + * @return array + */ + private function buildMigrationArray(): array { - $migrations = array(); + $migrations = []; $fIt = new Finder(); /** @var SplFileInfo $file */ - foreach ($fIt->in(__DIR__ . '/../Migrations')->files()->name("Version*.php") as $file) { + foreach ($fIt->in(__DIR__ . '/../Migrations')->files()->name('Version*.php') as $file) { $mg = 'PSC\System\UpdateBundle\Migrations\\' . $file->getBasename('.php'); /** @var Base $migration */ $migration = new $mg($this->entityManager, $this->doctrineMongo, $this->kernel->getProjectDir()); - $update = $this->doctrineMongo->getRepository('PSC\System\UpdateBundle\Document\Migration') + $update = $this->doctrineMongo + ->getRepository('PSC\System\UpdateBundle\Document\Migration') ->findOneBy(['version' => $mg]); if ($update) { diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/Backend/XmlController.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/Backend/XmlController.php new file mode 100644 index 000000000..990ec8d41 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/Backend/XmlController.php @@ -0,0 +1,67 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Controller\Backend; + +use Doctrine\ODM\MongoDB\DocumentManager; +use Doctrine\ORM\EntityManagerInterface; +use Plugin\Custom\PSC\LaufkartenLayouter\Form\XML\EditType; +use PSC\Shop\EntityBundle\Document\Shop; +use PSC\Shop\EntityBundle\Entity\Account; +use PSC\Shop\EntityBundle\Entity\Product; +use PSC\Shop\EntityBundle\Entity\Stockbooking; +use PSC\Shop\ProductBundle\Form\Backend\ProductType; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpFoundation\File\UploadedFile; +use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\Security\Core\SecurityContext; +use Symfony\Component\Routing\Annotation\Route; +use Symfony\Bridge\Twig\Attribute\Template; +use Symfony\Component\Security\Http\Attribute\IsGranted; +use Symfony\Component\HttpFoundation\Request; + +class XmlController extends AbstractController +{ + + #[Template()] + #[Route(path: '/xml/edit/{uuid}', name: 'psc_plugin_laufkartenlayouter_backend_xml_edit')] + public function editAction(Request $request, \PSC\System\SettingsBundle\Service\Shop $shopService, DocumentManager $documentManager, EntityManagerInterface $entityManager, $uuid) + { + $selectedShop = $shopService->getSelectedShop(); + + /** @var Product $product */ + $product = $entityManager + ->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findOneBy(array('uuid' => $uuid, 'shop' => $selectedShop)); + + /** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */ + $productDoc = $documentManager + ->getRepository('PSC\Shop\EntityBundle\Document\Product') + ->findOneBy(array('uid' => (string)$product->getUid())); + + $data = ['uuid' => $product->getUUid(), 'xml' => $productDoc->getPluginSettingModule('laufkartenlayouter', 'xml')]; + + $form = $this->createForm(EditType::class, $data); + + $form->handleRequest($request); + + if ($form->isSubmitted() && $form->isValid()) { + $data = $form->getData(); + dump($data); + $productDoc->setPluginSettingModule('laufkartenlayouter', 'xml', $data['xml']); + $documentManager->persist($productDoc); + $documentManager->flush(); + } + return array( + 'form' => $form->createView(), + 'product' => $product + ); + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/DesignerController.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/DesignerController.php new file mode 100644 index 000000000..0ec0ff059 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/DesignerController.php @@ -0,0 +1,132 @@ +getSession()->has('laufkartenlayouter')) { + $session = $request->getSession()->get('laufkartenlayouter'); + } + + if ($layouterId != '') { + /** @var Layoutdesigndata $layoutDesignData */ + $layoutDesignData = $entityManager + ->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata') + ->findOneBy(['uuid' => $layouterId]); + + $session->setOptions($productId, $layoutDesignData->getDesign()); + } + + return $this->redirectToRoute('psc_plugin_laufkartenlayouter_start', [ + 'productId' => $productId, + 'layouterId' => $layouterId, + ]); + } + + #[Route('/start/{productId}/{layouterId}', name: 'psc_plugin_laufkartenlayouter_start')] + public function startAction( + Request $request, + EntityManagerInterface $entityManager, + DocumentManager $documentManager, + Layouter $formLayouter, + $productId, + $layouterId = '', + ) { + /** @var Product $product */ + $product = $entityManager + ->getRepository('PSC\Shop\EntityBundle\Entity\Product') + ->findOneBy(['uuid' => $productId]); + + /** @var \PSC\Shop\EntityBundle\Entity\Shop $shop */ + $shop = $product->getShop(); + + //\var_dump($shop->getLayout()); + /** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */ + $productDoc = $documentManager + ->getRepository('PSC\Shop\EntityBundle\Document\Product') + ->findOneBy(['uid' => (string) $product->getUid()]); + + $session = new LaufkartenLayouter(); + if ($request->getSession()->has('laufkartenlayouter')) { + $session = $request->getSession()->get('laufkartenlayouter'); + } + + $formLayouter->setXml($productDoc->getPluginSetting('laufkartenlayouter', 'xml')); + + if ($request->get('prev', false) !== false) { + $actStep = $formLayouter->getStep($request->get('actStep', 1) - 1); + } elseif ($request->get('next', false) !== false) { + $actStep = $formLayouter->getStep($request->get('actStep', 1) + 1); + } else { + $actStep = $formLayouter->getStep($request->get('actStep', 1)); + } + $config = $formLayouter->getConfig(); + + $data = []; + + $form = $this->createForm(FormDesigner::class, $data, [ + 'step' => $actStep, + 'session' => $session, + 'productId' => $productId, + ]); + + $request->getSession()->set('laufkartenlayouter', $session); + + $loader = new FilesystemLoader('/data/www/old/application/design/vorlagen/' . + $shop->getLayout() . + '/laufkarten_layouter/'); + $twig = new Environment($loader); + //\var_dump($twig); + + $header = $twig->render('header.html.twig'); + $footer = $twig->render('footer.html.twig'); + return [ + 'step' => $actStep, + 'form' => $form->createView(), + 'product' => $product, + 'firstStart' => $layouterId != '' ? 1 : 0, + 'layouterId' => $layouterId, + 'config' => $config, + 'layout' => $shop->getLayout(), + 'header' => $header, + 'footer' => $footer, + ]; + } + + #[Route('/update/{productId}', name: 'psc_plugin_laufkartenlayouter_update')] + public function updateAction(Request $request, $productId) + { + $data = json_decode($request->getContent(), true); + + $session = new LaufkartenLayouter(); + if ($request->getSession()->has('laufkartenlayouter')) { + $session = $request->getSession()->get('laufkartenlayouter'); + } + + $session->setOptions($productId, array_merge($session->getOptions($productId), $data)); + + $request->getSession()->set('laufkartenlayouter', $session); + + return new JsonResponse(['success' => true]); + } +} + diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/ImageController.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/ImageController.php new file mode 100644 index 000000000..f5bbf8566 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/ImageController.php @@ -0,0 +1,73 @@ +getRepository('Plugin\Custom\PSC\LaufkartenLayouter\Document\Image') + ->findOneBy(['_id' => new ObjectId($id)]); + + return new JsonResponse([ + 'title' => $image, + 'rotate' => $image->getRotate(), + 'cropBox' => [ + 'width' => $image->getCropWidth(), + 'height' => $image->getCropHeight(), + 'x' => $image->getCropX(), + 'y' => $image->getCropY() + ] + ]); + } + + #[Route('/original/{id}/{width}/{height}', name: 'psc_plugin_laufkartenlayouter_image_original')] + public function imageAction(Request $request, DocumentManager $documentManager, $id, $width = 400, $height = 400) + { + + $width = round($width); + $height = round($height); + + /** @var \Plugin\Custom\PSC\LaufkartenLayouter\Document\Image $image */ + $image = $documentManager + ->getRepository('Plugin\Custom\PSC\LaufkartenLayouter\Document\Image') + ->findOneBy(['_id' => new ObjectId($id)]); + + $outfilename = "temp/".md5($id); + + $im = new \imagick("/data/www/new/web/market/motive/" . $image->getFileName()); + if($im->getImageWidth() < $width) { + $width = $im->getImageWidth(); + } + $im->setResolution(300,300); + $im->thumbnailimage($width, $height, true); + $im->writeimage($outfilename.".png"); + + $response = new Response(); + + $response->headers->set('Cache-Control', 'private'); + $response->headers->set('Content-type', mime_content_type($outfilename.".png")); + $response->headers->set('Content-Disposition', 'attachment; filename="' . basename($outfilename.".png") . '"'); + + $response->sendHeaders(); + + $response->setContent(readfile($outfilename.".png")); + + unlink($outfilename); + + return $response; + + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/PdfController.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/PdfController.php new file mode 100644 index 000000000..941796d1b --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/PdfController.php @@ -0,0 +1,118 @@ +getRepository('PSC\Shop\EntityBundle\Entity\Product') + ->findOneBy(array('uuid' => $productId)); + + /** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */ + $productDoc = $documentManager + ->getRepository('PSC\Shop\EntityBundle\Document\Product') + ->findOneBy(array('uid' => (string)$product->getUid())); + + $session = new LaufkartenLayouter(); + if($request->getSession()->has('laufkartenlayouter')) { + $session = $request->getSession()->get('laufkartenlayouter'); + } + + $formLayouter->setXml($productDoc->getPluginSetting('laufkartenlayouter', 'xml')); + + $config = $formLayouter->getConfig(); + + $outfilename = "temp/".uniqid().".pdf"; + + $session = new LaufkartenLayouter(); + if($request->getSession()->has('laufkartenlayouter')) { + $session = $request->getSession()->get('laufkartenlayouter'); + } + + $renderer->setConfig($config); + $renderer->setOptions($session->getOptions($productId)); + $renderer->renderPreviewPdf($formLayouter->getSites(), $outfilename); + + $response = new Response(); + + $response->headers->set('Cache-Control', 'private'); + $response->headers->set('Content-type', mime_content_type($outfilename)); + $response->headers->set('Content-Disposition', 'attachment; filename="' . basename($outfilename) . '"'); + $response->headers->set('Content-length', filesize($outfilename)); + + $response->sendHeaders(); + + $response->setContent(readfile($outfilename)); + + unlink($outfilename); + + return $response; + + } + + #[Route('/pdf/print/{productId}', name: 'psc_plugin_laufkartenlayouter_pdf_print')] + public function printAction(Request $request, EntityManagerInterface $entityManager, DocumentManager $documentManager, Layouter $formLayouter, Pdf $renderer, $productId) + { + + /** @var Product $product */ + $product = $entityManager + ->getRepository('PSC\Shop\EntityBundle\Entity\Product') + ->findOneBy(array('uuid' => $productId)); + + /** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */ + $productDoc = $documentManager + ->getRepository('PSC\Shop\EntityBundle\Document\Product') + ->findOneBy(array('uid' => (string)$product->getUid())); + + $session = new LaufkartenLayouter(); + if($request->getSession()->has('laufkartenlayouter')) { + $session = $request->getSession()->get('laufkartenlayouter'); + } + + $formLayouter->setXml($productDoc->getPluginSetting('laufkartenlayouter', 'xml')); + + $config = $formLayouter->getConfig(); + + $outfilename = "temp/".uniqid().".pdf"; + + $session = new LaufkartenLayouter(); + if($request->getSession()->has('laufkartenlayouter')) { + $session = $request->getSession()->get('laufkartenlayouter'); + } + + $renderer->setConfig($config); + $renderer->setOptions($session->getOptions($productId)); + $renderer->renderPrintPdf($formLayouter->getSites(), $outfilename); + + $response = new Response(); + + $response->headers->set('Cache-Control', 'private'); + $response->headers->set('Content-type', mime_content_type($outfilename)); + $response->headers->set('Content-Disposition', 'attachment; filename="' . basename($outfilename) . '"'); + + $response->sendHeaders(); + + $response->setContent(readfile($outfilename)); + + unlink($outfilename); + + return $response; + + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/PreviewController.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/PreviewController.php new file mode 100644 index 000000000..64954a03e --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/PreviewController.php @@ -0,0 +1,144 @@ +getRepository('PSC\Shop\EntityBundle\Entity\Product') + ->findOneBy(array('uuid' => $productId)); + + /** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */ + $productDoc = $documentManager + ->getRepository('PSC\Shop\EntityBundle\Document\Product') + ->findOneBy(array('uid' => (string)$product->getUid())); + + $session = new LaufkartenLayouter(); + if($request->getSession()->has('laufkartenlayouter')) { + $session = $request->getSession()->get('laufkartenlayouter'); + } + + $formLayouter->setXml($productDoc->getPluginSetting('laufkartenlayouter', 'xml')); + + $actSite = $formLayouter->getSite($site); + $config = $formLayouter->getConfig(); + + $outfilename = "temp/".uniqid().".pdf"; + + $session = new LaufkartenLayouter(); + if($request->getSession()->has('laufkartenlayouter')) { + $session = $request->getSession()->get('laufkartenlayouter'); + } + + $renderer->setSite($actSite); + $renderer->setConfig($config); + $renderer->setOptions($session->getOptions($productId)); + $renderer->renderStep($outfilename); + + $im = new \imagick(); + + $im->setCompressionQuality(89); + + $im->setResolution(300,300); + $im->readImage($outfilename."[0]"); + $im->thumbnailimage($width, $height, true); + $im->mergeImageLayers(\imagick::LAYERMETHOD_FLATTEN); + // $im->setImageAlphaChannel(\imagick::ALPHACHANNEL_REMOVE); + $im->writeimage($outfilename.".jpeg"); + + unlink($outfilename); + + + $response = new Response(); + + $response->headers->set('Cache-Control', 'private'); + $response->headers->set('Content-type', mime_content_type($outfilename.".jpeg")); + $response->headers->set('Content-Disposition', 'attachment; filename="' . basename($outfilename.".jpeg") . '"'); + + $response->sendHeaders(); + + $response->setContent(readfile($outfilename.".jpeg")); + + unlink($outfilename.".jpeg"); + + return $response; + + } + + #[Route('/layouter/{layouterId}/{site}/{width}/{height}', name: 'psc_plugin_laufkartenlayouter_preview_layouter')] + public function layouterAction(Request $request, EntityManagerInterface $entityManager, DocumentManager $documentManager, Layouter $formLayouter, Pdf $renderer, $layouterId, $site = 1, $width = 400, $height = 900) + { + $width = round($width); + $height = round($height); + + /** @var Layoutdesigndata $layoutDesignData */ + $layoutDesignData = $entityManager + ->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')->findOneBy(array('uuid' => $layouterId)); + + + /** @var Product $product */ + $product = $documentManager + ->getRepository('PSC\Shop\EntityBundle\Entity\Product') + ->findOneBy(array('uuid' => $layoutDesignData->getArticleUuid())); + + /** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */ + $productDoc = $documentManager + ->getRepository('PSC\Shop\EntityBundle\Document\Product') + ->findOneBy(array('uid' => (string)$product->getUid())); + + $formLayouter->setXml($productDoc->getPluginSetting('laufkartenlayouter', 'xml')); + + $actSite = $formLayouter->getSite($site); + $config = $formLayouter->getConfig(); + + $outfilename = "temp/".uniqid().".pdf"; + + $renderer->setSite($actSite); + $renderer->setConfig($config); + $renderer->setOptions($layoutDesignData->getDesign()); + $renderer->renderStep($outfilename); + + $im = new \imagick($outfilename."[0]"); + if($im->getImageWidth() < $width) { + $width = $im->getImageWidth(); + } + $im->setResolution(300,300); + $im->thumbnailimage($width, $height, true); + $im->writeimage($outfilename.".png"); + + unlink($outfilename); + + + $response = new Response(); + + $response->headers->set('Cache-Control', 'private'); + $response->headers->set('Content-type', mime_content_type($outfilename.".png")); + $response->headers->set('Content-Disposition', 'attachment; filename="' . basename($outfilename.".png") . '"'); + + $response->sendHeaders(); + + $response->setContent(readfile($outfilename.".png")); + + unlink($outfilename.".png"); + return $response; + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/StoreController.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/StoreController.php new file mode 100644 index 000000000..0c4883d32 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/StoreController.php @@ -0,0 +1,67 @@ +get("layouter"); + $articleUuid = $request->get("article"); + + $layoutDesignData = new Layoutdesigndata(); + $layoutDesignData->setUuid($uuid); + $layoutDesignData->setArticleUuid($articleUuid); + $session = new LaufkartenLayouter(); + if($request->getSession()->has('laufkartenlayouter')) { + $session = $request->getSession()->get('laufkartenlayouter'); + } + $layoutDesignData->setDesign($session->getOptions($articleUuid)); + + $entityManager->persist($layoutDesignData); + $entityManager->flush(); + + $json = new JsonResponse(); + $json->setContent(json_encode(array('success' => true))); + + return $json; + } + + #[Route('/update', name: 'psc_plugin_laufkartenlayouter_store_update')] + public function updateAction(Request $request, EntityManagerInterface $entityManager) + { + + $uuid = $request->get("layouter"); + $articleUuid = $request->get("article"); + + $layoutDesignData = $entityManager + ->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')->findOneBy(array('uuid' => $uuid)); + + + $session = new LaufkartenLayouter(); + if($request->getSession()->has('laufkartenlayouter')) { + $session = $request->getSession()->get('laufkartenlayouter'); + } + + $layoutDesignData->setDesign($session->getOptions($articleUuid)); + + $entityManager->persist($layoutDesignData); + $entityManager->flush(); + + $json = new JsonResponse(); + $json->setContent(json_encode(array('success' => true))); + + return $json; + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/UploadController.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/UploadController.php new file mode 100644 index 000000000..c1105197f --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Controller/UploadController.php @@ -0,0 +1,102 @@ +files->has("file")) { + $file = $request->files->get("file"); + + if($file instanceof UploadedFile) { + + + $filename = sprintf('%s/%s/%s/%s.%s', date('Y'), date('m'), date('d'), uniqid(), $file->getClientOriginalExtension()); + + /** @var Filesystem $fileContainer */ + $fileContainer = $filesystemMap->get('steplayouter_motiv'); + + if( + $file->getMimeType() == "image/png" || + $file->getMimeType() == "image/jpg" || + $file->getMimeType() == "image/jpeg" + ){ + $filename = sprintf('%s/%s/%s/%s.%s', date('Y'), date('m'), date('d'), uniqid(), "jpg"); + + $filenameTemp = sprintf('/tmp/%s.%s', uniqid(), "jpg"); + exec("convert ".$file->getPathname()." -colorspace cmyk -auto-orient ".$filenameTemp); + + $fileContainer->write($filename, file_get_contents($filenameTemp)); + + unlink($filenameTemp); + + }else{ + $fileContainer->write($filename, file_get_contents($file->getPathname())); + } + + + $image = new Image(); + $image->setSessionId($request->getSession()->getId()); + $image->setFileName($fileContainer->get($filename)->getKey()); + $image->setCropWidth(100); + $image->setCropHeight(100); + + $documentManager->persist($image); + $documentManager->flush(); + + return new JsonResponse(['success' => true, 'id' => $image->getId()]); + } + } + + return new JsonResponse(['success' => false]); + } + + #[Route('/cropbox/{id}', name: 'psc_plugin_laufkartenlayouter_upload_crop')] + public function cropAction(Request $request, DocumentManager $documentManager, $id) + { + /** @var \Plugin\Custom\PSC\LaufkartenLayouter\Document\Image $image */ + $image = $documentManager + ->getRepository('Plugin\Custom\PSC\LaufkartenLayouter\Document\Image') + ->findOneBy(['_id' => new ObjectId($id)]); + + $image->setCrop(true); + $image->setCropX($request->get('x')); + $image->setCropY($request->get('y')); + $image->setCropWidth($request->get('width')); + $image->setCropHeight($request->get('height')); + + $documentManager->persist($image); + $documentManager->flush(); + + return new JsonResponse(['success' => true]); + } + + #[Route('/rotate/{id}', name: 'psc_plugin_laufkartenlayouter_upload_rotate')] + public function rotateAction(Request $request, DocumentManager $documentManager, $id) + { + /** @var \Plugin\Custom\PSC\LaufkartenLayouter\Document\Image $image */ + $image = $documentManager + ->getRepository('Plugin\Custom\PSC\LaufkartenLayouter\Document\Image') + ->findOneBy(['_id' => new ObjectId($id)]); + + + exec("convert /data/www/new/web/market/motive/" . $image->getFileName()." -rotate ".($request->get('rotate'))." /data/www/new/web/market/motive/" . $image->getFileName()); + + + return new JsonResponse(['success' => true]); + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Document/Image.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Document/Image.php new file mode 100644 index 000000000..ad19d0b80 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Document/Image.php @@ -0,0 +1,197 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Document; + +use Doctrine\ODM\MongoDB\Mapping\Annotations\Field; +use Doctrine\ODM\MongoDB\Mapping\Annotations\Id; +use Doctrine\ODM\MongoDB\Mapping\Annotations\Document; +use Doctrine\ODM\MongoDB\Mapping\Annotations\Hash; + +#[Document(repositoryClass: 'Plugin\Custom\PSC\LaufkartenLayouter\Document\Repository\ImageRepository', collection: 'plugin_system_psc_laufkartenlayouter_image')] +class Image +{ + #[Id] + protected $id; + + #[Field(type: 'string')] + protected $sessionId; + + #[Field(type: 'string')] + protected $fileName; + + /** + * @var boolean + */ + #[Field(type: 'bool')] + protected $crop = false; + + #[Field(type: 'int')] + protected $cropX = 0; + + #[Field(type: 'int')] + protected $cropY = 0; + + #[Field(type: 'int')] + protected $cropWidth = 0; + + #[Field(type: 'int')] + protected $cropHeight = 0; + + #[Field(type: 'int')] + protected $rotate = 0; + + /** + * @return mixed + */ + public function getId() + { + return $this->id; + } + + /** + * @param mixed $id + */ + public function setId($id) + { + $this->id = $id; + } + + /** + * @return mixed + */ + public function getSessionId() + { + return $this->sessionId; + } + + /** + * @param mixed $sessionId + */ + public function setSessionId($sessionId) + { + $this->sessionId = $sessionId; + } + + /** + * @return mixed + */ + public function getFileName() + { + return $this->fileName; + } + + /** + * @param mixed $fileName + */ + public function setFileName($fileName) + { + $this->fileName = $fileName; + } + + /** + * @return bool + */ + public function isCrop() + { + return $this->crop; + } + + /** + * @param mixed $crop + */ + public function setCrop($crop) + { + $this->crop = $crop; + } + + /** + * @return mixed + */ + public function getCropX() + { + return $this->cropX; + } + + /** + * @param mixed $cropX + */ + public function setCropX($cropX) + { + $this->cropX = $cropX; + } + + /** + * @return mixed + */ + public function getCropY() + { + return $this->cropY; + } + + /** + * @param mixed $cropY + */ + public function setCropY($cropY) + { + $this->cropY = $cropY; + } + + /** + * @return mixed + */ + public function getCropWidth() + { + return $this->cropWidth; + } + + /** + * @param mixed $cropWidth + */ + public function setCropWidth($cropWidth) + { + $this->cropWidth = $cropWidth; + } + + /** + * @return mixed + */ + public function getCropHeight() + { + return $this->cropHeight; + } + + /** + * @param mixed $cropHeight + */ + public function setCropHeight($cropHeight) + { + $this->cropHeight = $cropHeight; + } + + /** + * @return mixed + */ + public function getRotate() + { + return $this->rotate; + } + + /** + * @param mixed $rotate + */ + public function setRotate($rotate) + { + $this->rotate = $rotate; + } + + +} diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Document/Repository/ImageRepository.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Document/Repository/ImageRepository.php new file mode 100644 index 000000000..8ba200407 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Document/Repository/ImageRepository.php @@ -0,0 +1,19 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Document\Repository; + +use Doctrine\ODM\MongoDB\Repository\DocumentRepository; + +class ImageRepository extends DocumentRepository +{ + +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Field/BackendFields.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Field/BackendFields.php new file mode 100644 index 000000000..771c91853 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Field/BackendFields.php @@ -0,0 +1,81 @@ +statusService = $statusService; + } + + public function getTemplate() + { + return '@PluginCustomPSCLaufkartenLayouter/form/field/backend.html.twig'; + } + + public function getModule() + { + return Field::Product; + } + + /** + * @param array $data + */ + public function formPreSubmit(FormEvent $event) + { + + } + + public function buildForm(FormBuilderInterface $builder, array $options) + { + + $builder->add('laufkartenlayouter', CheckboxType::class, array( + 'label' => 'Step Layouter aktivieren', + 'required' => false + )) ->add("laufkartenlayouter2InitalStatus", ChoiceType::class, array( + 'label' => 'Initalstatus', + 'choices' => $this->statusService->getPositionStatusAsArray(), + 'translation_domain' => 'posstatus' + )); + + + return $builder; + } + + public function getGroup() + { + return "laufkartenlayouter"; + } + + public function formPostSetData(FormEvent $event) + { + // TODO: Implement formPostSetData() method. + } + + public function formPostSubmit(FormEvent $event) + { + // TODO: Implement formPostSubmit() method. + } + + public function formPreSetData(FormEvent $event) + { + // TODO: Implement formPreSetData() method. + } + + public function formSubmit(FormEvent $event) + { + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Field/EnableEditor.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Field/EnableEditor.php new file mode 100644 index 000000000..2ba0b36d7 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Field/EnableEditor.php @@ -0,0 +1,143 @@ +options = $options; + + /** @var Shop $shopEntity */ + $shopEntity = $this->options['shopEntity']; + $tempLayouts = []; + if ($shopEntity->isCustomTemplates() == 1) { + foreach (new DirectoryIterator('/data/www/old/application/design/vorlagen') as $file) { + if ($file == '.' || $file == '..' || $file == 'config' || $file == '.svn' || $file == 'datapacks' || $file == '.DS_Store') { + continue; + } + $tempLayouts[$file->getFileName()] = $file->getFileName(); + } + } else { + if (file_exists('/data/www/old/application/design/clients/' . $shopEntity->getUID())) { + foreach (new DirectoryIterator('/data/www/old/application/design/clients/' . $shopEntity->getUID()) as $file) { + if ($file == '.' || $file == '..' || $file == 'config' || $file == '.svn' || $file == 'datapacks' || $file == '.DS_Store') { + continue; + } + $tempLayouts[$file->getFileName()] = $file->getFileName(); + } + } + } + if(isset($_POST["settings"]["bootstrap3Images"]["layout"])) { + header('location: /apps/backend/theme/settings'); + //die(); + } else { + if (!file_exists("/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/laufkarten_layouter")) { + mkdir("/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/laufkarten_layouter", 0777); + } + $filenameheader = "/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/laufkarten_layouter/header.html.twig"; + $filenamefooter = "/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/laufkarten_layouter/footer.html.twig"; + if (!file_exists($filenameheader)) { + touch($filenameheader); + chmod($filenameheader, 0777); + } + if (!file_exists($filenamefooter)) { + touch($filenamefooter); + chmod($filenamefooter, 0777); + } + + $handleheader = fopen($filenameheader, 'r'); + if(filesize($filenameheader)>0) { + $txtheader = fread($handleheader, filesize($filenameheader)); + fclose($handleheader); + } + $handlefooter = fopen($filenamefooter, 'r'); + if(filesize($filenamefooter)) { + $txtfooter = fread($handlefooter, filesize($filenamefooter)); + fclose($handlefooter); + } + + } + + + $builder->add('header', TextareaType::class, array( + 'label' => 'Header', + 'data' => $txtheader, + 'required' => false, + 'attr' => array('rows' => 50) + )) + ->add('footer', TextareaType::class, array( + 'label' => 'Footer', + 'data' => $txtfooter, + 'required' => false, + 'attr' => array('rows' => 50) + )); + ; + + return $builder; + } + + public function getGroup() + { + return LaufkartenLayouterEditor::GROUP_ID; + } + + public function formPostSetData(FormEvent $event) + { + // TODO: Implement formPostSetData() method. + } + + public function formPostSubmit(FormEvent $event) + { + + } + + public function formPreSetData(FormEvent $event) + { + // TODO: Implement formPreSetData() method. + } + + public function formSubmit(FormEvent $event) + { + $filename = "/data/www/old/application/design/vorlagen/" . $_POST["settings"]["bootstrap3General"]["layout"] . "/laufkarten_layouter/header.html.twig"; + $handle = fopen($filename, 'w'); + fputs($handle, $event->getForm()->get('laufkartenlayoutereditor')->get('header')->getData()); + fclose($handle); + + $filename = "/data/www/old/application/design/vorlagen/" . $_POST["settings"]["bootstrap3General"]["layout"] . "/laufkarten_layouter/footer.html.twig"; + $handle = fopen($filename, 'w'); + fputs($handle, $event->getForm()->get('laufkartenlayoutereditor')->get('footer')->getData()); + fclose($handle); + // TODO: Implement formPostSubmit() method. + + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/FormDesigner.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/FormDesigner.php new file mode 100644 index 000000000..5e62e3f86 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/FormDesigner.php @@ -0,0 +1,67 @@ +mediaManager = $mediaManager; + } + + public function buildForm(FormBuilderInterface $builder, array $options) + { + + /** @var LaufkartenLayouter $session */ + $session = $options['session']; + + $productId = $options['productId']; + + /** @var Step $step */ + $step = $options['step']; + + foreach($step->getColumns() as $column) { + foreach($column->getOptions() as $option) { + if($option->isInForm()) { + $option->renderForm($builder, $this->mediaManager); + } + } + } + + foreach($builder->all() as $opt) { + if($session->hasOption($productId, $opt->getName())) { + $opt->setData($session->getOption($productId, $opt->getName())); + } + } + } + + public function getName() + { + return 'designer'; + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults(array( + 'step' => null, + 'session' => null, + 'productId' => null, + )); + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Group/FormLayouter.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Group/FormLayouter.php new file mode 100644 index 000000000..14833e79d --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Group/FormLayouter.php @@ -0,0 +1,31 @@ +title = 'Step Layouter'; + } + + public function getModule() + { + return Field::Product; + } + + public function getId() + { + return self::GROUP_ID; + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Group/FormLayouterEditor.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Group/FormLayouterEditor.php new file mode 100644 index 000000000..cc5a1cb4b --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/Group/FormLayouterEditor.php @@ -0,0 +1,31 @@ +title = 'Step Layouter'; + } + + public function getModule() + { + return Field::Theme; + } + + public function getId() + { + return self::GROUP_ID; + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/XML/EditType.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/XML/EditType.php new file mode 100644 index 000000000..40c789310 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Form/XML/EditType.php @@ -0,0 +1,54 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Form\XML; + +use PSC\Libraries\AceEditorBundle\Form\Extension\AceEditorType; +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; +use Symfony\Component\Form\Extension\Core\Type\TextType; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; + +class EditType extends AbstractType +{ + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder + ->add('uuid', TextType::class, array('disabled' => true)) + ->add('xml', AceEditorType::class, array( + 'wrapper_attr' => array(), // aceeditor wrapper html attributes. + 'width' => '100%', + 'height' => '500', + 'font_size' => 14, + 'mode' => 'ace/mode/xml', // every single default mode must have ace/mode/* prefix + 'theme' => 'ace/theme/monokai', // every single default theme must have ace/theme/* prefix + 'tab_size' => null, + 'read_only' => null, + 'use_soft_tabs' => null, + 'use_wrap_mode' => null, + 'show_print_margin' => null, + 'required' => false, + 'highlight_active_line' => null + )) + ->add('save', SubmitType::class, array('label' => 'Speichern')); + } + + public function getName() + { + return 'product'; + } + + public function configureOptions(OptionsResolver $resolver) + { + + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Config.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Config.php new file mode 100644 index 000000000..3d53eb410 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Config.php @@ -0,0 +1,75 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Model; + + +use Plugin\Custom\PSC\LaufkartenLayouter\Model\Config\Pdf; + +class Config { + + /** @var Pdf */ + private $pdf; + + private $pdfPreviewButton = false; + + private $pdfPrintButton = false; + + /** + * @return Pdf + */ + public function getPdf() + { + return $this->pdf; + } + + /** + * @param Pdf $pdf + */ + public function setPdf($pdf) + { + $this->pdf = $pdf; + } + + /** + * @return bool + */ + public function isPdfPreviewButton() + { + return $this->pdfPreviewButton; + } + + /** + * @param bool $pdfPreviewButton + */ + public function setPdfPreviewButton($pdfPreviewButton) + { + $this->pdfPreviewButton = $pdfPreviewButton; + } + + /** + * @return bool + */ + public function isPdfPrintButton() + { + return $this->pdfPrintButton; + } + + /** + * @param bool $pdfPrintButton + */ + public function setPdfPrintButton($pdfPrintButton) + { + $this->pdfPrintButton = $pdfPrintButton; + } + + +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Config/Pdf.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Config/Pdf.php new file mode 100644 index 000000000..6a791e0ce --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Config/Pdf.php @@ -0,0 +1,71 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Config; + + +class Pdf { + + private $unit = "pt"; + + private $pdfx4 = false; + + private $iccProfile = ""; + + /** + * @return string + */ + public function getUnit() + { + return $this->unit; + } + + /** + * @param string $unit + */ + public function setUnit($unit) + { + $this->unit = $unit; + } + + /** + * @return string + */ + public function getIccProfile() + { + return $this->iccProfile; + } + + /** + * @param string $iccProfile + */ + public function setIccProfile($iccProfile) + { + $this->iccProfile = $iccProfile; + } + + /** + * @return bool + */ + public function isPdfx4() + { + return $this->pdfx4; + } + + /** + * @param bool $pdfx4 + */ + public function setPdfx4($pdfx4) + { + $this->pdfx4 = $pdfx4; + } + +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Base.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Base.php new file mode 100644 index 000000000..9b3b4c348 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Base.php @@ -0,0 +1,214 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements; + + +use Doctrine\ODM\MongoDB\DocumentManager; +use Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Site; + +abstract class Base { + + private $id = ""; + + private $x = 0; + + private $y = 0; + + private $preview = true; + + private $print = true; + + /** @var string? */ + private $border = null; + + /** @var DocumentManager */ + private $mongoDb; + + /** @var float */ + private $scale = 1; + + private $options = []; + + /** @var Site */ + private $site; + /** + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * @param string $id + */ + public function setId($id) + { + $this->id = $id; + } + + /** + * @return int + */ + public function getX() + { + return $this->x; + } + + /** + * @param int $x + */ + public function setX($x) + { + $this->x = $x; + } + + /** + * @return int + */ + public function getY() + { + return $this->y; + } + + /** + * @param int $y + */ + public function setY($y) + { + $this->y = $y; + } + + /** + * @param \PDFlib $pdf + */ + abstract function renderPdf($pdf); + + /** + * @return bool + */ + public function isPrint() + { + return $this->print; + } + + /** + * @param bool $print + */ + public function setPrint($print) + { + $this->print = $print; + } + + /** + * @return bool + */ + public function isPreview() + { + return $this->preview; + } + + /** + * @param bool $preview + */ + public function setPreview($preview) + { + $this->preview = $preview; + } + + /** + * @return float + */ + public function getScale() + { + return $this->scale; + } + + /** + * @param float $scale + */ + public function setScale($scale) + { + $this->scale = $scale; + } + + public function setOptions($options) + { + $this->options = $options; + } + + /** + * @return mixed + */ + public function getOption($key) + { + return $this->options[$key]; + } + + /** + * @param $key + * @return boolean + */ + public function hasOption($key) + { + return isset($this->options[$key]); + } + + /** + * @return DocumentManager + */ + public function getMongoDb() + { + return $this->mongoDb; + } + + /** + * @param DocumentManager $mongoDb + */ + public function setMongoDb($mongoDb) + { + $this->mongoDb = $mongoDb; + } + + /** + * @return Site + */ + public function getSite() + { + return $this->site; + } + + /** + * @param Site $site + */ + public function setSite($site) + { + $this->site = $site; + } + + /** + * @return string + */ + public function getBorder() + { + return $this->border; + } + + /** + * @param string $border + */ + public function setBorder($border) + { + $this->border = $border; + } + +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Image.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Image.php new file mode 100644 index 000000000..9d74ea795 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Image.php @@ -0,0 +1,132 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements; + +use MongoDB\BSON\ObjectId; +use Monolog\Handler\Mongo; + +class Image extends Base +{ + + private $file = ""; + + private $width = 0; + + private $height = 0; + + + /** + * @return string + */ + public function getFile() + { + if($this->hasOption($this->getId().'_original')) { + return $this->getOption($this->getId().'_original'); + } + return $this->getId(); + } + + + public function renderPdf($pdf) + { + if($this->getFile() != "") { + $id = new ObjectId($this->getFile()); + + $render = true; + /** @var \Plugin\Custom\PSC\LaufkartenLayouter\Document\Image $imageObj */ + $imageObj = $this->getMongoDb() + ->getRepository('Plugin\Custom\PSC\LaufkartenLayouter\Document\Image') + ->findOneBy(['_id' => new ObjectId($this->getFile())]); + # Load the image + $image = $pdf->load_image("auto", "/data/www/new/web/market/motive/" . $imageObj->getFileName(), ""); + if ($image == 0) { + echo("Error: " . $pdf->get_errmsg()); + exit(1); + } + $opt = "position={top left} boxsize={" . $this->getWidth()*$this->getScale() . " " . $this->getHeight()*$this->getScale() . + "} fitmethod=meet"; + + +// $opt = $opt . " matchbox={clipping={1% 1% 50% 50%}}"; + if($imageObj->isCrop()) { + $opt = $opt . " matchbox={name=" . $this->getId() . " clipping={" . + ($imageObj->getCropX()) . "% " . (100-$imageObj->getCropHeight()-$imageObj->getCropY()) . "% " . ($imageObj->getCropWidth()+$imageObj->getCropX()) . "% " . (100-$imageObj->getCropY()) . "%}}"; + + if($imageObj->getCropWidth() == 0 || $imageObj->getCropHeight() == 0) { + $render = false; + } + }else{ + $opt = $opt . " matchbox={name=" . $this->getId() . "}"; + } + if($imageObj->getRotate() != 0) { + //$opt .= " rotate=". $imageObj->getRotate() . ""; + } + + if($render) { + $pdf->fit_image($image, $this->getX() * $this->getScale(), + ($this->getHeight() + $this->getY()) * $this->getScale(), $opt); + } + + if($this->getBorder() != null) { + $path = (int)$pdf->info_matchbox($this->getId(), 1, "boundingbox"); + $pdf->draw_path($path, 0, 0, $this->getBorder()); + $pdf->delete_path($path); + } + + $pdf->close_image($image); + } + } + + /** + * @return int + */ + public function getWidth() + { + return $this->width; + } + + /** + * @param int $width + */ + public function setWidth($width) + { + $this->width = $width; + } + + /** + * @return int + */ + public function getHeight() + { + return $this->height; + } + + /** + * @param int $height + */ + public function setHeight($height) + { + $this->height = $height; + } + + /** + * @param string $file + * @return Image + */ + public function setFile($file) + { + $this->file = $file; + return $this; + } + + +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Media.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Media.php new file mode 100644 index 000000000..fd62be874 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Media.php @@ -0,0 +1,109 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements; + +use MongoDB\BSON\ObjectId; +use Monolog\Handler\Mongo; + +class Media extends Base +{ + + private $file = ""; + + private $width = 0; + + private $height = 0; + + /** + * @return string + */ + public function getFile() + { + if ($this->hasOption($this->getId())) { + return $this->getOption($this->getId()); + } else { + return $this->file; + } + } + + public function renderPdf($pdf) + { + + if( false && $this->getFile() != "") { + $id = new ObjectId($this->getFile()); + + $render = true; + /** @var \PSC\Shop\MediaBundle\Document\Media $imageObj */ + $imageObj = $this->getMongoDb() + ->getRepository('PSC\Shop\MediaBundle\Document\Media') + ->findOneBy(['_id' => new ObjectId($this->getFile())]); + # Load the image + $image = $pdf->load_image("auto", "/data/www/new/web/" . $imageObj->getUrl(), ""); + if ($image == 0) { + echo("Error: " . $pdf->get_errmsg()); + exit(1); + } + $opt = "position={top left} boxsize={" . $this->getWidth()*$this->getScale() . " " . $this->getHeight()*$this->getScale() . + "} fitmethod=meet"; + + + if($render) { + $pdf->fit_image($image, $this->getX() * $this->getScale(), + ($this->getHeight() + $this->getY()) * $this->getScale(), $opt); + } + } + } + + /** + * @return int + */ + public function getWidth() + { + return $this->width; + } + + /** + * @param int $width + */ + public function setWidth($width) + { + $this->width = $width; + } + + /** + * @return int + */ + public function getHeight() + { + return $this->height; + } + + /** + * @param int $height + */ + public function setHeight($height) + { + $this->height = $height; + } + + /** + * @param string $file + * @return Image + */ + public function setFile($file) + { + $this->file = $file; + return $this; + } + + +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Pdf.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Pdf.php new file mode 100644 index 000000000..b0fb33e61 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Pdf.php @@ -0,0 +1,118 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements; + + +use MongoDB\BSON\ObjectId; + +class Pdf extends Base +{ + + private $file = ""; + + private $siteToRender = 1; + + private $width = 0; + + private $height = 0; + + public function renderPdf($pdf) + { + /** @var \PSC\Shop\MediaBundle\Document\Media $media */ + $media = $this->getMongoDb() + ->getRepository('PSC\Shop\MediaBundle\Document\Media') + ->findOneBy(['_id' => new ObjectId($this->getFile())]); + + $indoc = $pdf->open_pdi_document("/data/www/new/web" . $media->getUrl(), ""); + + $page = $pdf->open_pdi_page($indoc, $this->getSiteToRender(), ""); + if ($page == 0) { + print("Error: " . $pdf->get_errmsg()); + die(); + } + + $optlist = "boxsize {" . $this->getWidth()*$this->getScale() . " " . $this->getHeight()*$this->getScale() . "} fitmethod meet"; + + $pdf->fit_pdi_page($page, $this->getX()*$this->getScale(), + ($this->getSite()->getHeight()-$this->getY())*$this->getScale(), $optlist); + + $pdf->close_pdi_page($page); + + $pdf->close_pdi_document($indoc); + + } + + /** + * @return string + */ + public function getFile() + { + return $this->file; + } + + /** + * @param string $file + */ + public function setFile($file) + { + $this->file = $file; + } + + /** + * @return int + */ + public function getWidth() + { + return $this->width; + } + + /** + * @param int $width + */ + public function setWidth($width) + { + $this->width = $width; + } + + /** + * @return int + */ + public function getHeight() + { + return $this->height; + } + + /** + * @param int $height + */ + public function setHeight($height) + { + $this->height = $height; + } + + /** + * @return int + */ + public function getSiteToRender() + { + return $this->siteToRender; + } + + /** + * @param int $siteToRender + */ + public function setSiteToRender($siteToRender) + { + $this->siteToRender = $siteToRender; + } + +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Text.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Text.php new file mode 100644 index 000000000..bb5a64ea2 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/Text.php @@ -0,0 +1,304 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements; + + +use MongoDB\BSON\ObjectId; + +class Text extends Base +{ + + private $text = ""; + + private $fontSize = 14; + + private $color = "black"; + + private $colorMode = "hex"; + + private $rotate = 0; + + private $font = ""; + + private $showBorder = false; + + private $width = 0; + + private $height = 0; + + private $fitMethod = "auto"; + + private $vAlign = "top"; + + private $hAlign = "left"; + + private $leading = "100%"; + /** + * @return string + */ + public function getText() + { + if ($this->hasOption($this->getId())) { + return $this->getOption($this->getId()); + } else { + return $this->text; + } + } + + /** + * @param string $text + */ + public function setText($text) + { + $this->text = $text; + } + + public function renderPdf($pdf) + { + if($this->getFont()) { + + /** @var \PSC\Shop\MediaBundle\Document\Media $media */ + $media = $this->getMongoDb() + ->getRepository('PSC\Shop\MediaBundle\Document\Media') + ->findOneBy(['_id' => new ObjectId($this->getFont())]); + + $pdf->set_option("FontOutline={" . $this->getFont() . "=" . "/data/www/new/web" . $media->getUrl()."}"); + $font = $pdf->load_font($this->getFont(), "unicode", "embedding"); + }else{ + $font = $pdf->load_font("Arial", "unicode", "embedding"); + if ($font == 0) { + echo("Error: " . $pdf->get_errmsg()); + exit(1); + } + + } + + $pdf->setfont($font, $this->getFontSize() * $this->getScale()); + + $optList = ""; + if (strtolower($this->getColorMode()) == "cmyk") { + $color = explode(" ", $this->getColor()); + $optList .= "fillcolor={cmyk " . $color[0]/100 . " " . $color[1]/100 . " " . $color[2]/100 . " " . $color[3]/100 . "} "; + }elseif(strtolower($this->getColorMode()) == "rgb") { + $optList .= "fillcolor={rgb " . $this->getColor() . "} "; + }else { + $optList .= "fillcolor=" . $this->getColor() . " "; + } + + if($this->rotate != 0) { + $optList .= "rotate=". $this->rotate . " "; + } + + if($this->getWidth() != 0 && $this->getHeight() != 0) { + $optList .= " boxsize={".($this->getWidth()*$this->getScale())." ".($this->getHeight()*$this->getScale())."} position={".$this->getHAlign()." ".$this->getVAlign()."} fitmethod=" . $this->getFitMethod(); + + if($this->isShowBorder()) { + $optList .= " showborder"; + } + } + + $pdf->fit_textline($this->getText(), $this->getX()*$this->getScale(), ($this->getY()+$this->getHeight())*$this->getScale(), $optList); + } + + /** + * @return int + */ + public function getFontSize() + { + return $this->fontSize; + } + + /** + * @param int $fontSize + */ + public function setFontSize($fontSize) + { + $this->fontSize = $fontSize; + } + + /** + * @return string + */ + public function getColorMode() + { + return $this->colorMode; + } + + /** + * @param string $colorMode + */ + public function setColorMode($colorMode) + { + $this->colorMode = $colorMode; + } + + /** + * @return string + */ + public function getColor() + { + return $this->color; + } + + /** + * @param string $color + */ + public function setColor($color) + { + $this->color = $color; + } + + /** + * @return int + */ + public function getRotate() + { + return $this->rotate; + } + + /** + * @param int $rotate + */ + public function setRotate($rotate) + { + $this->rotate = $rotate; + } + + /** + * @return string + */ + public function getFont() + { + return $this->font; + } + + /** + * @param string $font + */ + public function setFont($font) + { + $this->font = $font; + } + + /** + * @return bool + */ + public function isShowBorder() + { + return $this->showBorder; + } + + /** + * @param bool $showBorder + */ + public function setShowBorder($showBorder) + { + $this->showBorder = $showBorder; + } + + /** + * @return int + */ + public function getWidth() + { + return $this->width; + } + + /** + * @param int $width + */ + public function setWidth($width) + { + $this->width = $width; + } + + /** + * @return int + */ + public function getHeight() + { + return $this->height; + } + + /** + * @param int $height + */ + public function setHeight($height) + { + $this->height = $height; + } + + /** + * @return string + */ + public function getFitMethod() + { + return $this->fitMethod; + } + + /** + * @param string $fitMethod + */ + public function setFitMethod($fitMethod) + { + $this->fitMethod = $fitMethod; + } + + /** + * @return string + */ + public function getHAlign() + { + return $this->hAlign; + } + + /** + * @param string $hAlign + */ + public function setHAlign($hAlign) + { + $this->hAlign = $hAlign; + } + + /** + * @return string + */ + public function getVAlign() + { + return $this->vAlign; + } + + /** + * @param string $vAlign + */ + public function setVAlign($vAlign) + { + $this->vAlign = $vAlign; + } + + /** + * @return string + */ + public function getLeading() + { + return $this->leading; + } + + /** + * @param string $leading + */ + public function setLeading($leading) + { + $this->leading = $leading; + } + +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/TextFlow.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/TextFlow.php new file mode 100644 index 000000000..74d0cb6d3 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Elements/TextFlow.php @@ -0,0 +1,65 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements; + +use MongoDB\BSON\ObjectId; + +class TextFlow extends Text +{ + + + + public function renderPdf($pdf) + { + if($this->getFont()) { + + /** @var \PSC\Shop\MediaBundle\Document\Media $media */ + $media = $this->getMongoDb() + ->getRepository('PSC\Shop\MediaBundle\Document\Media') + ->findOneBy(['_id' => new ObjectId($this->getFont())]); + + $pdf->set_option("FontOutline={" . $this->getFont() . "=" . "/data/www/new/web" . $media->getUrl()."}"); + }else{ + $this->setFont("Helvetica"); + } + + $optList = ""; + if (strtolower($this->getColorMode()) == "cmyk") { + $color = explode(" ", $this->getColor()); + $optList .= "fillcolor={cmyk " . $color[0]/100 . " " . $color[1]/100 . " " . $color[2]/100 . " " . $color[3]/100 . "} "; + }elseif(strtolower($this->getColorMode()) == "rgb") { + $optList .= "fillcolor={rgb " . $this->getColor() . "} "; + }else { + $optList .= "fillcolor=" . $this->getColor() . " "; + } + + if($this->getRotate() != 0) { + $optList .= "rotate=". $this->getRotate() . " "; + } + + $optList .= "leading=". $this->getLeading() . " "; + + $optList .= " alignment=".$this->getHAlign()." encoding=unicode embedding fontname=" . $this->getFont() . " fontsize=" . ($this->getFontSize() * $this->getScale()); + + $tf = 0; + $tf = $pdf->add_textflow($tf, $this->getText(), $optList); + + + $optList = " verticalalign=".$this->getVAlign()." fitmethod=" . $this->getFitMethod(); + if($this->isShowBorder()) { + $optList .= " showborder"; + } + + $pdf->fit_textflow($tf, $this->getX()*$this->getScale(), ($this->getY())*$this->getScale(), ($this->getWidth()+$this->getX())*$this->getScale(), ($this->getY()+$this->getHeight())*$this->getScale(), $optList); + } + +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Site.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Site.php new file mode 100644 index 000000000..71d941318 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Pdf/Site.php @@ -0,0 +1,180 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf; + + +use Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Base; + +class Site { + + private $id; + + private $label = ""; + + private $width = 0; + + private $height = 0; + + private $trimLeft = 0; + private $trimRight = 0; + private $trimTop = 0; + private $trimBottom = 0; + + /** @var Base[] */ + private $elements = []; + + /** + * @return mixed + */ + public function getId() + { + return $this->id; + } + + /** + * @param mixed $id + */ + public function setId($id) + { + $this->id = $id; + } + + /** + * @return string + */ + public function getLabel() + { + return $this->label; + } + + /** + * @param string $label + */ + public function setLabel($label) + { + $this->label = $label; + } + + /** + * @return int + */ + public function getWidth() + { + return $this->width; + } + + /** + * @param int $width + */ + public function setWidth($width) + { + $this->width = $width; + } + + /** + * @return int + */ + public function getHeight() + { + return $this->height; + } + + /** + * @param int $height + */ + public function setHeight($height) + { + $this->height = $height; + } + + /** + * @return int + */ + public function getTrimLeft() + { + return $this->trimLeft; + } + + /** + * @param int $trimLeft + */ + public function setTrimLeft($trimLeft) + { + $this->trimLeft = $trimLeft; + } + + /** + * @return int + */ + public function getTrimRight() + { + return $this->trimRight; + } + + /** + * @param int $trimRight + */ + public function setTrimRight($trimRight) + { + $this->trimRight = $trimRight; + } + + /** + * @return int + */ + public function getTrimTop() + { + return $this->trimTop; + } + + /** + * @param int $trimTop + */ + public function setTrimTop($trimTop) + { + $this->trimTop = $trimTop; + } + + /** + * @return int + */ + public function getTrimBottom() + { + return $this->trimBottom; + } + + /** + * @param int $trimBottom + */ + public function setTrimBottom($trimBottom) + { + $this->trimBottom = $trimBottom; + } + + /** + * @return Base[] + */ + public function getElements() + { + return $this->elements; + } + + /** + * @param Base[] $elements + */ + public function setElements($elements) + { + $this->elements = $elements; + } + + +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Column.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Column.php new file mode 100644 index 000000000..84094dc54 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Column.php @@ -0,0 +1,42 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps; + +use Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Base; + +class Column { + + /** @var Base[] */ + private $options; + + /** + * @return Base[] + */ + public function getOptions() + { + return $this->options; + } + + /** + * @param Base[] $options + */ + public function setOptions($options) + { + $this->options = $options; + } + + public function addOption($option) + { + $this->options[] = $option; + } + +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Base.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Base.php new file mode 100644 index 000000000..d8bab7a54 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Base.php @@ -0,0 +1,114 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options; + +use PSC\Shop\MediaBundle\Service\MediaManager; +use Symfony\Component\Form\FormBuilder; + +abstract class Base { + + private $id; + + private $column = 1; + + private $label = ""; + + private $required = false; + + protected $inForm = false; + + public function renderForm(FormBuilder $builder, MediaManager $mediaManager) + { + + } + + /** + * @return mixed + */ + public function getId() + { + return $this->id; + } + + /** + * @param mixed $id + */ + public function setId($id) + { + $this->id = $id; + } + + /** + * @return int + */ + public function getColumn() + { + return $this->column; + } + + /** + * @param int $column + */ + public function setColumn($column) + { + $this->column = $column; + } + + /** + * @return string + */ + public function getLabel() + { + return $this->label; + } + + /** + * @param string $label + */ + public function setLabel($label) + { + $this->label = $label; + } + + /** + * @return bool + */ + public function isInForm() + { + return $this->inForm; + } + + /** + * @param bool $inForm + */ + public function setInForm($inForm) + { + $this->inForm = $inForm; + } + + /** + * @return bool + */ + public function isRequired() + { + return $this->required; + } + + /** + * @param bool $required + */ + public function setRequired($required) + { + $this->required = $required; + } + +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Image.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Image.php new file mode 100644 index 000000000..168bd9144 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Image.php @@ -0,0 +1,73 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options; + +use PSC\Shop\MediaBundle\Service\MediaManager; +use Symfony\Component\Form\Extension\Core\Type\FileType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; +use Symfony\Component\Form\FormBuilder; + +class Image extends Base { + + private $cropBox = false; + + private $cropBoxAspectRatio = 0; + + protected $inForm = true; + + public function renderForm(FormBuilder $builder, MediaManager $mediaManager) + { + $builder->add($this->getId(), FileType::class, [ + 'label' => $this->getLabel(), + 'required' => false + ]); + $builder->add($this->getId() . '_original', HiddenType::class, [ + ]); + if($this->cropBox) { + $builder->add($this->getId() . '_crop', HiddenType::class, [ + ]); + } + } + + /** + * @return bool + */ + public function isCropBox() + { + return $this->cropBox; + } + + /** + * @param bool $cropBox + */ + public function setCropBox($cropBox) + { + $this->cropBox = $cropBox; + } + + /** + * @return int + */ + public function getCropBoxAspectRatio() + { + return $this->cropBoxAspectRatio; + } + + /** + * @param int $cropBoxAspectRatio + */ + public function setCropBoxAspectRatio($cropBoxAspectRatio) + { + $this->cropBoxAspectRatio = $cropBoxAspectRatio; + } + +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Preview.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Preview.php new file mode 100644 index 000000000..086371d20 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Preview.php @@ -0,0 +1,35 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options; + +class Preview extends Base { + + private $site = 1; + + /** + * @return int + */ + public function getSite() + { + return $this->site; + } + + /** + * @param int $site + */ + public function setSite($site) + { + $this->site = $site; + } + + +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Select/Media.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Select/Media.php new file mode 100644 index 000000000..ff831c49c --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Select/Media.php @@ -0,0 +1,73 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Select; + +use Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Base; +use PSC\Shop\MediaBundle\Service\MediaManager; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\FormBuilder; + +class Media extends Base { + + protected $inForm = true; + + protected $options = []; + + protected $choiceAttr = []; + + /** @var MediaManager */ + protected $mediaManager; + + public function renderForm(FormBuilder $builder, MediaManager $mediaManager) + { + + $this->mediaManager = $mediaManager; + + $this->buildChoiceAttr(); + + $builder->add($this->getId(), ChoiceType::class, [ + 'label' => $this->getLabel(), + 'required' => false, + 'choices' => $this->options, + 'choice_attr' => $this->choiceAttr + ]); + } + + public function addOption($id, $label) + { + $this->options[$label] = (string)$id; + } + + /** + * @return array + */ + public function getOptions() + { + return $this->options; + } + + /** + * @param array $options + */ + public function setOptions($options) + { + $this->options = $options; + } + + private function buildChoiceAttr() + { + foreach($this->options as $name => $key) { + $media = $this->mediaManager->getMedia($key); + $this->choiceAttr[$name] = ['data-img-src' => $this->mediaManager->retrieveThumbnailPath($media)]; + } + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Select/Simple.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Select/Simple.php new file mode 100644 index 000000000..6bee878f5 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Select/Simple.php @@ -0,0 +1,54 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Select; + +use Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Base; +use PSC\Shop\MediaBundle\Service\MediaManager; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\FormBuilder; + +class Simple extends Base { + + protected $inForm = true; + + protected $options = []; + + public function renderForm(FormBuilder $builder, MediaManager $mediaManager) + { + $builder->add($this->getId(), ChoiceType::class, [ + 'label' => $this->getLabel(), + 'required' => false, + 'choices' => $this->options + ]); + } + + public function addOption($id, $label) + { + $this->options[$label] = $id; + } + + /** + * @return array + */ + public function getOptions() + { + return $this->options; + } + + /** + * @param array $options + */ + public function setOptions($options) + { + $this->options = $options; + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Text.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Text.php new file mode 100644 index 000000000..8c2ffa0eb --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Text.php @@ -0,0 +1,49 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options; + +use PSC\Shop\MediaBundle\Service\MediaManager; +use Symfony\Component\Form\Extension\Core\Type\TextType; +use Symfony\Component\Form\FormBuilder; + +class Text extends Base { + + private $text = ""; + + protected $inForm = true; + /** + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * @param string $text + */ + public function setText($text) + { + $this->text = $text; + } + + public function renderForm(FormBuilder $builder, MediaManager $mediaManager) + { + + $builder->add($this->getId(), TextType::class, [ + 'label' => $this->getLabel(), + 'data' => $this->getText(), + 'required' => $this->isRequired() + ]); + } + +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Textarea.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Textarea.php new file mode 100644 index 000000000..4b142ba1f --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Options/Textarea.php @@ -0,0 +1,54 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options; + +use PSC\Shop\MediaBundle\Service\MediaManager; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; +use Symfony\Component\Form\Extension\Core\Type\TextType; +use Symfony\Component\Form\FormBuilder; + +class Textarea extends Base { + + private $text = ""; + + protected $inForm = true; + + /** + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * @param string $text + */ + public function setText($text) + { + $this->text = $text; + } + + public function renderForm(FormBuilder $builder, MediaManager $mediaManager) + { + + $builder->add($this->getId(), TextareaType::class, [ + 'label' => $this->getLabel(), + 'data' => $this->getText(), + 'attr' => [ + 'rows' => 6 + ], + 'required' => $this->isRequired() + ]); + } + +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Step.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Step.php new file mode 100644 index 000000000..6e0c95504 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Model/Steps/Step.php @@ -0,0 +1,169 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps; + +use Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Base; + +class Step { + + private $id; + + private $name; + + private $headline; + + private $description; + + private $first = false; + + private $last = false; + + /** @var Column[] */ + private $columns = []; + + /** + * @return mixed + */ + public function getName() + { + return $this->name; + } + + /** + * @param mixed $name + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * @return mixed + */ + public function getHeadline() + { + return $this->headline; + } + + /** + * @param mixed $headline + */ + public function setHeadline($headline) + { + $this->headline = $headline; + } + + /** + * @return mixed + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param mixed $description + */ + public function setDescription($description) + { + $this->description = $description; + } + + /** + * @return mixed + */ + public function getId() + { + return $this->id; + } + + /** + * @param mixed $id + */ + public function setId($id) + { + $this->id = $id; + } + + /** + * @return Column[] + */ + public function getColumns() + { + return $this->columns; + } + + /** + * @param Column[] $columns + */ + public function setColumns($columns) + { + $this->columns = $columns; + } + + public function getColumn($pos) + { + if(!isset($this->columns[$pos])) { + $this->columns[$pos] = new Column(); + } + + return $this->columns[$pos]; + } + + public function getOption($id) + { + foreach($this->columns as $columns) { + foreach($columns->getOptions() as $option) { + if($option->getId() == $id) return $option; + } + } + + } + + public function getColumnWidth() + { + return 12/count($this->columns); + } + + /** + * @return bool + */ + public function isLast() + { + return $this->last; + } + + /** + * @param bool $last + */ + public function setLast($last) + { + $this->last = $last; + } + + /** + * @return bool + */ + public function isFirst() + { + return $this->first; + } + + /** + * @param bool $first + */ + public function setFirst($first) + { + $this->first = $first; + } + +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Config/Config.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Config/Config.php new file mode 100644 index 000000000..ae64fb4ad --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Config/Config.php @@ -0,0 +1,49 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Config; + +use Plugin\Custom\PSC\LaufkartenLayouter\Model\Config\Pdf; +use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Base; +use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Preview; +use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Text; +use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Textarea; + +class Config { + + + /** + * @param \SimpleXMLElement $xml + * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Config + */ + public function parse($xml) + { + $config = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Config(); + + $config->setPdf(new Pdf()); + if($xml->unit) { + $config->getPdf()->setUnit((string)$xml->unit); + } + if($xml->pdfPreviewButton) { + $config->setPdfPreviewButton(boolval(intval($xml->pdfPreviewButton))); + } + if($xml->pdfPrintButton) { + $config->setPdfPrintButton(boolval(intval($xml->pdfPrintButton))); + } + if($xml->pdfx4) { + $config->getPdf()->setPdfx4(boolval(intval($xml->pdfx4))); + $config->getPdf()->setIccProfile((string)$xml->iccProfile); + } + return $config; + } + + +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Base.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Base.php new file mode 100644 index 000000000..223d07902 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Base.php @@ -0,0 +1,40 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options; + +abstract class Base { + + + /** + * @param \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Base $element + * @param \SimpleXMLElement $xml + * @return mixed + */ + public function parseBase($element, $xml) + { + if(!isset($xml['id'])) { + $element->setId(md5(rand())); + }else{ + $element->setId((string)$xml['id']); + } + + if(isset($xml['column'])) { + $element->setColumn(intval($xml['column'])); + } + if(isset($xml['label'])) { + $element->setLabel((string)$xml['label']); + } + + return $element; + } + +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Image.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Image.php new file mode 100644 index 000000000..2beceeb7d --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Image.php @@ -0,0 +1,35 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options; + +class Image extends Base { + + + /** + * @param \SimpleXMLElement $xml + * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Image + */ + public function parse($xml) + { + $image = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Image(); + + parent::parseBase($image, $xml); + + if(isset($xml['cropBox'])) { + $image->setCropBox(boolval($xml['cropBox'])); + } + if(isset($xml['cropBoxAspectRatio'])) { + $image->setCropBoxAspectRatio(floatval($xml['cropBoxAspectRatio'])); + } + return $image; + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Preview.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Preview.php new file mode 100644 index 000000000..f61de384c --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Preview.php @@ -0,0 +1,32 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options; + +class Preview extends Base { + + /** + * @param \SimpleXMLElement $xml + * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Preview + */ + public function parse($xml) + { + $preview = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Preview(); + + parent::parseBase($preview, $xml); + + if(isset($xml['site'])) { + $preview->setSite(intval($xml['site'])); + } + + return $preview; + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Select/Media.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Select/Media.php new file mode 100644 index 000000000..d44e6cec2 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Select/Media.php @@ -0,0 +1,35 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Select; + +use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Base; + +class Media extends Base { + + + /** + * @param \SimpleXMLElement $xml + * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Select\Media + */ + public function parse($xml) + { + $select = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Select\Media(); + + parent::parseBase($select, $xml); + + foreach($xml->option as $option) { + $select->addOption((string)$option['id'], (string)$option); + } + + return $select; + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Select/Simple.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Select/Simple.php new file mode 100644 index 000000000..178b3518c --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Select/Simple.php @@ -0,0 +1,35 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Select; + +use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Base; + +class Simple extends Base { + + + /** + * @param \SimpleXMLElement $xml + * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Select\Simple + */ + public function parse($xml) + { + $select = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Select\Simple(); + + parent::parseBase($select, $xml); + + foreach($xml->option as $option) { + $select->addOption((string)$option['id'], (string)$option); + } + + return $select; + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Text.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Text.php new file mode 100644 index 000000000..852c14877 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Text.php @@ -0,0 +1,33 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options; + +class Text extends Base { + + + /** + * @param \SimpleXMLElement $xml + * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Text + */ + public function parse($xml) + { + $text = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Text(); + + parent::parseBase($text, $xml); + + $text->setText((string)$xml); + if(isset($xml['required'])) { + $text->setRequired(boolval($xml['required'])); + } + return $text; + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Textarea.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Textarea.php new file mode 100644 index 000000000..bb51533ba --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Options/Textarea.php @@ -0,0 +1,32 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options; + +class Textarea extends Base { + + /** + * @param \SimpleXMLElement $xml + * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Textarea + */ + public function parse($xml) + { + $text = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Textarea(); + + parent::parseBase($text, $xml); + + $text->setText((string)$xml); + if(isset($xml['required'])) { + $text->setRequired(boolval($xml['required'])); + } + return $text; + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Step.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Step.php new file mode 100644 index 000000000..e827f0cf9 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Form/Step.php @@ -0,0 +1,71 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form; + +use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Base; +use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Preview; +use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Text; +use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Image; +use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Textarea; + +class Step { + + + /** + * @param \SimpleXMLElement $xml + * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Step + */ + public function parse($xml) + { + $step = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Step(); + $step->setId(intval($xml['id'])); + + if(isset($xml['label'])) { + $step->setName((string)$xml['label']); + } + if(isset($xml->headline)) { + $step->setHeadline((string)$xml->headline); + } + if(isset($xml->description)) { + $step->setDescription((string)$xml->description); + } + + if($xml->elements->count()) { + foreach($xml->elements->children() as $typeXml => $optionXml) { + + $parser = new Text(); + if($typeXml == "textarea") { + $parser = new Textarea(); + } + if($typeXml == "preview") { + $parser = new Preview(); + } + if($typeXml == "image") { + $parser = new Image(); + } + if($typeXml == "select") { + $parser = new \Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Select\Simple(); + } + if($typeXml == "mediaSelect") { + $parser = new \Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Select\Media(); + } + $option = $parser->parse($optionXml); + + $step->getColumn($option->getColumn())->addOption($option); + } + } + + return $step; + } + + +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Parser.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Parser.php new file mode 100644 index 000000000..b0a931d7d --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Parser.php @@ -0,0 +1,100 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser; + +use Plugin\Custom\PSC\LaufkartenLayouter\Model\Config; +use Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Site; +use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Step; + +class Parser +{ + + /** @var \SimpleXMLElement */ + private $xml; + + public function loadXml($xml) + { + $this->xml = simplexml_load_string($xml); + } + + /** + * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Config + */ + public function parseConfig() + { + $configParser = new \Plugin\Custom\PSC\LaufkartenLayouter\Parser\Config\Config(); + + $config = $configParser->parse($this->xml->general); + + return $config; + } + + /** + * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Step[] + */ + public function parseStep() + { + + $steps = []; + + $count = $this->xml->steps->children()->count(); + + if($count) { + $stepParser = new Step(); + + $i = 0; + + foreach($this->xml->steps->children() as $stepXml) { + $step = $stepParser->parse($stepXml); + + if($i == 0) { + $step->setFirst(true); + } + if($i == $count-1) { + $step->setLast(true); + } + + $steps[] = $step; + $i++; + } + } + + return $steps; + + } + + /** + * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Site[] + */ + public function parseSites() + { + + $sites = []; + + $count = $this->xml->sites->children()->count(); + + if($count) { + $siteParser = new \Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Site(); + + + foreach($this->xml->sites->children() as $siteXml) { + $site = $siteParser->parse($siteXml); + + $sites[] = $site; + } + } + + return $sites; + + } + +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Base.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Base.php new file mode 100644 index 000000000..a507d6024 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Base.php @@ -0,0 +1,46 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements; + +abstract class Base { + + + /** + * @param \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Base $element + * @param \SimpleXMLElement $xml + * @return mixed + */ + public function parseBase($element, $xml) + { + if(!isset($xml['id'])) { + $element->setId(md5(rand())); + }else{ + $element->setId((string)$xml['id']); + } + + if(isset($xml['x'])) { + $element->setX(intval($xml['x'])); + } + if(isset($xml['y'])) { + $element->setY(intval($xml['y'])); + } + if(isset($xml['preview'])) { + $element->setPreview(boolval(intval($xml['preview']))); + } + if(isset($xml['print'])) { + $element->setPrint(boolval(intval($xml['print']))); + } + + return $element; + } + +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Image.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Image.php new file mode 100644 index 000000000..e8469cc1d --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Image.php @@ -0,0 +1,37 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements; + +class Image extends Base { + + + /** + * @param \SimpleXMLElement $xml + * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Image + */ + public function parse($xml) + { + $image = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Image(); + + parent::parseBase($image, $xml); + + $image->setFile((string)$xml); + $image->setWidth(intval($xml['width'])); + $image->setHeight(intval($xml['height'])); + + if(isset($xml['border'])) { + $image->setBorder($xml['border']); + } + + return $image; + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Media.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Media.php new file mode 100644 index 000000000..738c0ce11 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Media.php @@ -0,0 +1,37 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements; + +class Media extends Base { + + + /** + * @param \SimpleXMLElement $xml + * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Media + */ + public function parse($xml) + { + $image = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Media(); + + parent::parseBase($image, $xml); + + $image->setFile((string)$xml); + $image->setWidth(intval($xml['width'])); + $image->setHeight(intval($xml['height'])); + + if(isset($xml['border'])) { + $image->setBorder($xml['border']); + } + + return $image; + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Pdf.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Pdf.php new file mode 100644 index 000000000..9de34a1a1 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Pdf.php @@ -0,0 +1,35 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements; + +class Pdf extends Base { + + + /** + * @param \SimpleXMLElement $xml + * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Pdf + */ + public function parse($xml) + { + $pdf = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Pdf(); + + parent::parseBase($pdf, $xml); + + $pdf->setFile((string)$xml); + $pdf->setWidth(intval($xml['width'])); + $pdf->setHeight(intval($xml['height'])); + $pdf->setSiteToRender(intval($xml['site'])); + + + return $pdf; + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Text.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Text.php new file mode 100644 index 000000000..7e6e6d96b --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/Text.php @@ -0,0 +1,67 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements; + +class Text extends Base { + + + /** + * @param \SimpleXMLElement $xml + * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Text + */ + public function parse($xml) + { + $text = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Text(); + + parent::parseBase($text, $xml); + + $text->setText((string)$xml); + if(isset($xml['fontSize'])) { + $text->setFontSize(intval($xml['fontSize'])); + } + + if(isset($xml['color'])) { + $text->setColor($xml['color']); + } + + if(isset($xml['colorMode'])) { + $text->setColorMode($xml['colorMode']); + } + + if(isset($xml['rotate'])) { + $text->setRotate(intval($xml['rotate'])); + } + if(isset($xml['font'])) { + $text->setFont((string)$xml['font']); + } + if(isset($xml['showBorder'])) { + $text->setShowBorder(boolval($xml['showBorder'])); + } + if(isset($xml['width'])) { + $text->setWidth(intval($xml['width'])); + } + if(isset($xml['height'])) { + $text->setHeight(intval($xml['height'])); + } + if(isset($xml['vAlign'])) { + $text->setVAlign((string)$xml['vAlign']); + } + if(isset($xml['hAlign'])) { + $text->setHAlign((string)$xml['hAlign']); + } + if(isset($xml['fitmethod'])) { + $text->setFitMethod((string)$xml['fitmethod']); + } + + return $text; + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/TextFlow.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/TextFlow.php new file mode 100644 index 000000000..107f86b11 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Elements/TextFlow.php @@ -0,0 +1,71 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements; + +class TextFlow extends Base { + + + /** + * @param \SimpleXMLElement $xml + * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\TextFlow + */ + public function parse($xml) + { + $text = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\TextFlow(); + + parent::parseBase($text, $xml); + + $text->setText((string)$xml); + if(isset($xml['fontSize'])) { + $text->setFontSize(intval($xml['fontSize'])); + } + + if(isset($xml['color'])) { + $text->setColor($xml['color']); + } + + if(isset($xml['colorMode'])) { + $text->setColorMode($xml['colorMode']); + } + + if(isset($xml['rotate'])) { + $text->setRotate(intval($xml['rotate'])); + } + if(isset($xml['font'])) { + $text->setFont((string)$xml['font']); + } + if(isset($xml['showBorder'])) { + $text->setShowBorder(boolval($xml['showBorder'])); + } + if(isset($xml['width'])) { + $text->setWidth(intval($xml['width'])); + } + if(isset($xml['height'])) { + $text->setHeight(intval($xml['height'])); + } + if(isset($xml['vAlign'])) { + $text->setVAlign((string)$xml['vAlign']); + } + if(isset($xml['hAlign'])) { + $text->setHAlign((string)$xml['hAlign']); + } + if(isset($xml['fitmethod'])) { + $text->setFitMethod((string)$xml['fitmethod']); + } + if(isset($xml['leading'])) { + $text->setLeading((string)$xml['leading']); + } + + + return $text; + } +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Site.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Site.php new file mode 100644 index 000000000..75bbce5bb --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Parser/Pdf/Site.php @@ -0,0 +1,78 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf; + +use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements\Image; +use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements\Media; +use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements\Motiv; +use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements\Pdf; +use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements\Text; +use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements\TextFlow; + +class Site { + + + /** + * @param \SimpleXMLElement $xml + * @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Site + */ + public function parse($xml) + { + $site = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Site(); + $site->setId(intval($xml['id'])); + $site->setWidth(intval($xml['width'])); + $site->setHeight(intval($xml['height'])); + + if(isset($xml['trimLeft'])) { + $site->setTrimLeft(intval($xml['trimLeft'])); + } + if(isset($xml['trimRight'])) { + $site->setTrimRight(intval($xml['trimRight'])); + } + if(isset($xml['trimTop'])) { + $site->setTrimTop(intval($xml['trimTop'])); + } + if(isset($xml['trimBottom'])) { + $site->setTrimBottom(intval($xml['trimBottom'])); + } + + if(isset($xml['label'])) { + $site->setLabel((string)$xml['label']); + } + + if(isset($xml->elements) && $xml->elements->children()->count()) { + $elements = []; + foreach($xml->elements->children() as $type => $xmlElement) { + $parser = new Text(); + if(strtolower($type) == "pdf") { + $parser= new Pdf(); + } + if(strtolower($type) == "image") { + $parser= new Image(); + } + if(strtolower($type) == "media") { + $parser= new Media(); + } + if(strtolower($type) == "textflow") { + $parser= new TextFlow(); + } + $elements[] = $parser->parse($xmlElement); + + } + $site->setElements($elements); + } + + return $site; + } + + +} \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Plugin.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Plugin.php new file mode 100644 index 000000000..f8be67825 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Plugin.php @@ -0,0 +1,26 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Renderer; + +use Doctrine\ODM\MongoDB\DocumentManager; +use MongoDB\BSON\ObjectId; +use Plugin\Custom\PSC\LaufkartenLayouter\Model\Config; +use Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Site; +use PSC\Shop\MediaBundle\Document\Media; + +class Pdf +{ + /** @var Site */ + private $site; + + /** @var Config */ + private $config; + + private $pdflibLic; + + private $options; + + function __construct(DocumentManager $mongoDb, $pdflib_lic) + { + $this->mongoDb = $mongoDb; + $this->pdflibLic = $pdflib_lic; + } + + public function setSite($site) + { + $this->site = $site; + } + + public function renderStep($filename) + { + $p = new \PDFlib(); + $p->set_option('errorpolicy=return'); + $p->set_option('stringformat=utf8'); + $p->set_parameter('license', $this->pdflibLic); + if ($p->begin_document($filename, '') == 0) { + die('Error: ' . $p->get_errmsg()); + } + + $p->set_option('topdown=true'); + $p->set_option('usercoordinates=true'); + + $scale = 1; + if (strtolower($this->config->getPdf()->getUnit()) == 'mm') { + $scale = 2.83465; + } elseif (strtolower($this->config->getPdf()->getUnit()) == 'cm') { + $scale = 28.3465; + } + + $p->begin_page_ext( + 0, + 0, + 'width=' . + (($this->site->getWidth() + $this->site->getTrimLeft() + $this->site->getTrimRight()) * $scale) . + ' height=' . + (($this->site->getHeight() + $this->site->getTrimTop() + $this->site->getTrimBottom()) * $scale) . + ' trimbox={' . + ($this->site->getTrimLeft() * $scale) . + ' ' . + ($this->site->getTrimTop() * $scale) . + ' ' . + (($this->site->getWidth() + $this->site->getTrimLeft()) * $scale) . + ' ' . + (($this->site->getHeight() + $this->site->getTrimTop()) * $scale) . + '}', + ); + + foreach ($this->site->getElements() as $element) { + $element->setScale($scale); + $element->setOptions($this->options); + $element->setMongoDb($this->mongoDb); + $element->setSite($this->site); + $element->renderPdf($p); + } + + $p->end_page_ext(''); + + $p->end_document(''); + } + + public function renderPreviewPdf($sites, $filename) + { + $p = new \PDFlib(); + $p->set_option('errorpolicy=return'); + $p->set_option('stringformat=utf8'); + $p->set_parameter('license', $this->pdflibLic); + if ($p->begin_document($filename, '') == 0) { + die('Error: ' . $p->get_errmsg()); + } + + $p->set_option('topdown=true'); + $p->set_option('usercoordinates=true'); + + $scale = 1; + if (strtolower($this->config->getPdf()->getUnit()) == 'mm') { + $scale = 2.83465; + } elseif (strtolower($this->config->getPdf()->getUnit()) == 'cm') { + $scale = 28.3465; + } + + foreach ($sites as $site) { + $p->begin_page_ext( + 0, + 0, + 'width=' . + (($site->getWidth() + $site->getTrimLeft() + $site->getTrimRight()) * $scale) . + ' height=' . + (($site->getHeight() + $site->getTrimTop() + $site->getTrimBottom()) * $scale) . + ' trimbox={' . + ($site->getTrimLeft() * $scale) . + ' ' . + ($site->getTrimTop() * $scale) . + ' ' . + (($site->getWidth() + $site->getTrimLeft()) * $scale) . + ' ' . + (($site->getHeight() + $site->getTrimTop()) * $scale) . + '}', + ); + + foreach ($site->getElements() as $element) { + if (!$element->isPreview()) + continue; + $element->setScale($scale); + $element->setOptions($this->options); + $element->setMongoDb($this->mongoDb); + $element->setSite($site); + $element->renderPdf($p); + } + + $p->end_page_ext(''); + } + + $p->end_document(''); + } + + public function renderPrintPdf($sites, $filename) + { + $p = new \PDFlib(); + $p->set_option('errorpolicy=return'); + $p->set_option('stringformat=utf8'); + $p->set_parameter('license', $this->pdflibLic); + $p->set_info('Creator', 'PSC'); + $p->set_info('Title', 'PDFX4'); + + if ($this->config->getPdf()->isPdfx4()) { + if ($p->begin_document($filename, 'pdfx=PDF/X-4') == 0) { + die('Error: ' . $p->get_errmsg()); + } + + /** @var Media $media */ + $media = $this->mongoDb + ->getRepository('PSC\Shop\MediaBundle\Document\Media') + ->findOneBy(['_id' => new ObjectId($this->config->getPdf()->getIccProfile())]); + + if ($p->load_iccprofile('/data/www/new/web' . $media->getUrl(), 'usage=outputintent') == 0) { + print 'Error: ' . $p->get_errmsg() . "\n"; + print "See www.pdflib.com for output intent ICC profiles.\n"; + $p->delete(); + return 2; + } + } else { + if ($p->begin_document($filename, '') == 0) { + die('Error: ' . $p->get_errmsg()); + } + } + + $p->set_option('topdown=true'); + $p->set_option('usercoordinates=true'); + + $scale = 1; + if (strtolower($this->config->getPdf()->getUnit()) == 'mm') { + $scale = 2.83465; + } elseif (strtolower($this->config->getPdf()->getUnit()) == 'cm') { + $scale = 28.3465; + } + + foreach ($sites as $site) { + $p->begin_page_ext( + 0, + 0, + 'width=' . + (($site->getWidth() + $site->getTrimLeft() + $site->getTrimRight()) * $scale) . + ' height=' . + (($site->getHeight() + $site->getTrimTop() + $site->getTrimBottom()) * $scale) . + ' trimbox={' . + ($site->getTrimLeft() * $scale) . + ' ' . + ($site->getTrimTop() * $scale) . + ' ' . + (($site->getWidth() + $site->getTrimLeft()) * $scale) . + ' ' . + (($site->getHeight() + $site->getTrimTop()) * $scale) . + '}', + ); + + foreach ($site->getElements() as $element) { + if (!$element->isPrint()) + continue; + $element->setScale($scale); + $element->setOptions($this->options); + $element->setMongoDb($this->mongoDb); + $element->setSite($site); + $element->renderPdf($p); + } + + $p->end_page_ext(''); + } + + $p->end_document(''); + } + + /** + * @param Config $config + */ + public function setConfig($config) + { + $this->config = $config; + } + + public function setOptions(array $options) + { + $this->options = $options; + } +} + diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/config/routing.yml b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/config/routing.yml new file mode 100644 index 000000000..62e50a3f3 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/config/routing.yml @@ -0,0 +1,12 @@ +psc_shop_plugin_custom_laufkartenlayouter_frontend: + resource: "@PluginCustomPSCLaufkartenLayouter/Controller" + type: attribute + prefix: /plugin/laufkartenlayouter/api + +psc_shop_plugin_custom_laufkartenlayouter_backend: + resource: "@PluginCustomPSCLaufkartenLayouter/Controller/Backend" + type: attribute + prefix: /backend/plugin/laufkartenlayouter + + + diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/config/services.yml b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/config/services.yml new file mode 100644 index 000000000..06e165636 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/config/services.yml @@ -0,0 +1,29 @@ +services: + _defaults: + autowire: true + autoconfigure: true + + Plugin\Custom\PSC\LaufkartenLayouter\: + resource: '../../*/*' + + Plugin\Custom\PSC\LaufkartenLayouter\Form\Group\LaufkartenLayouter: + tags: + - { name: psc.backend.custom.groups } + + psc.plugin.system.psc.theme.laufkartenlayouter.group.LaufkartenLayouterEditor: + class: Plugin\Custom\PSC\LaufkartenLayouter\Form\Group\LaufkartenLayouterEditor + tags: + - { name: psc.backend.custom.groups, themeType: "bootstrap3" } + + Plugin\Custom\PSC\LaufkartenLayouter\Form\Field\BackendFields: + tags: + - { name: psc.backend.custom.fields } + + Plugin\Custom\PSC\LaufkartenLayouter\Form\FormDesigner: + tags: + - { name: form.type } + + psc.plugin.system.psc.theme.laufkartenlayouter.field.enable_checkbox: + class: Plugin\Custom\PSC\LaufkartenLayouter\Form\Field\EnableEditor + tags: + - { name: psc.backend.custom.fields, themeType: "bootstrap3" } diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/public/css/image-picker.css b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/public/css/image-picker.css new file mode 100644 index 000000000..be33422ed --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/public/css/image-picker.css @@ -0,0 +1,36 @@ +/* line 6, source/sass/image-picker.scss */ +ul.thumbnails.image_picker_selector { + overflow: auto; + list-style-image: none; + list-style-position: outside; + list-style-type: none; + padding: 0px; + margin: 0px; } + /* line 15, source/sass/image-picker.scss */ + ul.thumbnails.image_picker_selector ul { + overflow: auto; + list-style-image: none; + list-style-position: outside; + list-style-type: none; + padding: 0px; + margin: 0px; } + /* line 25, source/sass/image-picker.scss */ + ul.thumbnails.image_picker_selector li.group_title { + float: none; } + /* line 30, source/sass/image-picker.scss */ + ul.thumbnails.image_picker_selector li { + margin: 0px 12px 12px 0px; + float: left; } + /* line 35, source/sass/image-picker.scss */ + ul.thumbnails.image_picker_selector li .thumbnail { + padding: 6px; + border: 1px solid #DDD; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; } + /* line 42, source/sass/image-picker.scss */ + ul.thumbnails.image_picker_selector li .thumbnail img { + -webkit-user-drag: none; } + /* line 48, source/sass/image-picker.scss */ + ul.thumbnails.image_picker_selector li .thumbnail.selected { + background: #08C; } diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/public/js/image-picker.min.js b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/public/js/image-picker.min.js new file mode 100644 index 000000000..b2087f74a --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/public/js/image-picker.min.js @@ -0,0 +1 @@ +"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function defineProperties(target,props){for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:{};return this.each(function(){var select;if((select=jQuery(this)).data("picker")&&select.data("picker").destroy(),select.data("picker",new ImagePicker(this,sanitized_options(opts))),null!=opts.initialized)return opts.initialized.call(select.data("picker"))})}}),sanitized_options=function(opts){var default_options;return default_options={hide_select:!0,show_label:!1,initialized:void 0,changed:void 0,clicked:void 0,selected:void 0,limit:void 0,limit_reached:void 0,font_awesome:!1},jQuery.extend(default_options,opts)},both_array_are_equal=function(a,b){var i,j,len,x;if(!a||!b||a.length!==b.length)return!1;for(a=a.slice(0),b=b.slice(0),a.sort(),b.sort(),i=j=0,len=a.length;j1&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,ImagePicker),this.sync_picker_with_select=this.sync_picker_with_select.bind(this),this.opts=opts1,this.select=jQuery(select_element),this.multiple="multiple"===this.select.attr("multiple"),null!=this.select.data("limit")&&(this.opts.limit=parseInt(this.select.data("limit"))),this.build_and_append_picker()}return _createClass(ImagePicker,[{key:"destroy",value:function(){var j,len,ref;for(j=0,len=(ref=this.picker_options).length;j"),this.picker_options=[],this.recursively_parse_option_groups(this.select,this.picker),this.picker}},{key:"recursively_parse_option_groups",value:function(scoped_dom,target_container){var container,j,k,len,len1,option,option_group,ref,ref1,results;for(j=0,len=(ref=scoped_dom.children("optgroup")).length;j")).append(jQuery("
  • "+option_group.attr("label")+"
  • ")),target_container.append(jQuery("
  • ").append(container)),this.recursively_parse_option_groups(option_group,container);for(ref1=function(){var l,len1,ref1,results1;for(results1=[],l=0,len1=(ref1=scoped_dom.children("option")).length;l0}},{key:"selected_values",value:function(){return this.multiple?this.select.val()||[]:[this.select.val()]}},{key:"toggle",value:function(imagepicker_option,original_event){var new_values,old_values,selected_value;if(old_values=this.selected_values(),selected_value=imagepicker_option.value().toString(),this.multiple?indexOf.call(this.selected_values(),selected_value)>=0?((new_values=this.selected_values()).splice(jQuery.inArray(selected_value,old_values),1),this.select.val([]),this.select.val(new_values)):null!=this.opts.limit&&this.selected_values().length>=this.opts.limit?null!=this.opts.limit_reached&&this.opts.limit_reached.call(this.select):this.select.val(this.selected_values().concat(selected_value)):this.has_implicit_blanks()&&imagepicker_option.is_selected()?this.select.val(""):this.select.val(selected_value),!both_array_are_equal(old_values,this.selected_values())&&(this.select.change(),null!=this.opts.changed))return this.opts.changed.call(this.select,old_values,this.selected_values(),original_event)}}]),ImagePicker}(),ImagePickerOption=function(){function ImagePickerOption(option_element,picker){var opts1=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};_classCallCheck(this,ImagePickerOption),this.clicked=this.clicked.bind(this),this.picker=picker,this.opts=opts1,this.option=jQuery(option_element),this.create_node()}return _createClass(ImagePickerOption,[{key:"destroy",value:function(){return this.node.find(".thumbnail").off("click",this.clicked)}},{key:"has_image",value:function(){return null!=this.option.data("img-src")}},{key:"is_blank",value:function(){return!(null!=this.value()&&""!==this.value())}},{key:"is_selected",value:function(){var select_value;return select_value=this.picker.select.val(),this.picker.multiple?jQuery.inArray(this.value(),select_value)>=0:this.value()===select_value}},{key:"mark_as_selected",value:function(){return this.node.find(".thumbnail").addClass("selected")}},{key:"unmark_as_selected",value:function(){return this.node.find(".thumbnail").removeClass("selected")}},{key:"value",value:function(){return this.option.val()}},{key:"label",value:function(){return this.option.data("img-label")?this.option.data("img-label"):this.option.text()}},{key:"clicked",value:function(event){if(this.picker.toggle(this,event),null!=this.opts.clicked&&this.opts.clicked.call(this.picker.select,this,event),null!=this.opts.selected&&this.is_selected())return this.opts.selected.call(this.picker.select,this,event)}},{key:"create_node",value:function(){var image,imgAlt,imgClass,thumbnail;return this.node=jQuery("
  • "),this.option.data("font_awesome")?(image=jQuery("")).attr("class","fa-fw "+this.option.data("img-src")):(image=jQuery("")).attr("src",this.option.data("img-src")),thumbnail=jQuery("
    "),(imgClass=this.option.data("img-class"))&&(this.node.addClass(imgClass),image.addClass(imgClass),thumbnail.addClass(imgClass)),(imgAlt=this.option.data("img-alt"))&&image.attr("alt",imgAlt),thumbnail.on("click",this.clicked),thumbnail.append(image),this.opts.show_label&&thumbnail.append(jQuery("

    ").html(this.label())),this.node.append(thumbnail),this.node}}]),ImagePickerOption}()}).call(void 0); \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/backend/xml/edit.html.twig b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/backend/xml/edit.html.twig new file mode 100644 index 000000000..79f78b65a --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/backend/xml/edit.html.twig @@ -0,0 +1,60 @@ +{% extends 'backend_base.html.twig' %} + +{% block body %} +

    +
    +
    +

    + + Step Layouter > + XML Bearbeiten + Anzeigen +

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

    {{ step.headline }}

    +
    + {% if config.pdfPreviewButton %}PDF Vorschau{% endif %} + {% if config.pdfPrintButton %}PDF Print{% endif %} + {% if not step.last %}{% endif %} + {% if step.last %}{% endif %} +
    +
    +
    +
    +
    + {% for col in step.columns %} +
    + {% for option in col.options %} + {% if option.inForm %} + {% if option is instanceof("\\Plugin\\System\\PSC\\LaufkartenLayouter\\Model\\Steps\\Options\\Image") %} +
    +
    +
    + {{ form_label(attribute(form, option.id)) }} +
    + {{ form_widget(attribute(form, option.id)) }} +
    + {{ form_errors(attribute(form, option.id)) }} +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    + {% else %} +
    +
    +
    + {{ form_label(attribute(form, option.id)) }} +
    + {{ form_widget(attribute(form, option.id)) }} +
    + {{ form_errors(attribute(form, option.id)) }} +
    +
    +
    + {% endif %} + + {% else %} + {% if option is instanceof("\\Plugin\\System\\PSC\\LaufkartenLayouter\\Model\\Steps\\Options\\Preview") %} +
    + + {% endif %} + {% endif %} + {% endfor %} +
    + {% endfor %} +
    +
    +{{ form_end(form) }} + + +{{ footer|raw }} + + \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/form/field/backend.html.twig b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/form/field/backend.html.twig new file mode 100644 index 000000000..45aad8abc --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/form/field/backend.html.twig @@ -0,0 +1,30 @@ +
    +
    Step Layouter
    +
    +
    +
    +
    + {{ form_label(form.laufkartenlayouter.laufkartenlayouter) }} +
    +
    + {{ form_widget(form.laufkartenlayouter.laufkartenlayouter) }} +
    +
    +
    +
    +
    +
    + {{ form_label(form.laufkartenlayouter.laufkartenlayouter2InitalStatus) }} +
    + {{ form_widget(form.laufkartenlayouter.laufkartenlayouter2InitalStatus) }} +
    +
    +
    +
    +
    + +
    +
    +
    diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/form/field/enable_editor.html.twig b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/form/field/enable_editor.html.twig new file mode 100644 index 000000000..ee8672a3b --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/views/form/field/enable_editor.html.twig @@ -0,0 +1,16 @@ +
    +
    +
    + +
    + {{ form_widget(form.laufkartenlayoutereditor.header, {attr: {'class': 'form-control'}}) }} +
    +
    +
    + +
    + {{ form_widget(form.laufkartenlayoutereditor.footer, {attr: {'class': 'form-control'}}) }} +
    +
    +
    +
    \ No newline at end of file diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Service/Layouter.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Service/Layouter.php new file mode 100644 index 000000000..ee51803de --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Service/Layouter.php @@ -0,0 +1,70 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Service; + +use Plugin\Custom\PSC\LaufkartenLayouter\Model\Config; +use Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Site; +use Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Step; +use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Parser; + +class Layouter +{ + /** @var Step[] */ + private $steps = []; + + /** @var Site[] */ + private $sites = []; + + /** @var Config */ + private $config; + + public function setXml($xml) + { + $parser = new Parser(); + $parser->loadXml($xml); + + $this->steps = $parser->parseStep(); + $this->sites = $parser->parseSites(); + $this->config = $parser->parseConfig(); + } + + public function getStep($stepNum = 0) + { + foreach ($this->steps as $step) { + if ($stepNum == $step->getId()) + return $step; + } + } + + public function getSite($site = 1) + { + return $this->sites[$site - 1]; + } + + /** + * @return Config + */ + public function getConfig() + { + return $this->config; + } + + /** + * @return Site[] + */ + public function getSites() + { + return $this->sites; + } +} + diff --git a/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Session/FormLayouter.php b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Session/FormLayouter.php new file mode 100644 index 000000000..aba67bdc8 --- /dev/null +++ b/src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Session/FormLayouter.php @@ -0,0 +1,119 @@ + + * @copyright 2012-2013 PrintshopCreator GmbH + * @license Private + * @link http://www.printshopcreator.de + */ +namespace Plugin\Custom\PSC\LaufkartenLayouter\Session; + +class LaufkartenLayouter implements \Serializable +{ + protected $options = []; + + protected $actualStep = 0; + + /** + * String representation of object + * @link http://php.net/manual/en/serializable.serialize.php + * @return string the string representation of the object or null + * @since 5.1.0 + */ + #[\Override] + public function serialize() + { + return serialize([ + $this->options, + $this->actualStep, + ]); + } + + /** + * Constructs the object + * @link http://php.net/manual/en/serializable.unserialize.php + * @param string $serialized

    + * The string representation of the object. + *

    + * @return void + * @since 5.1.0 + */ + #[\Override] + public function unserialize($serialized) + { + $data = unserialize($serialized); + list( + $this->options, + $this->actualStep, + ) = $data; + } + + /** + * @param $articleUUID + * @return array + */ + public function getOptions($articleUUID) + { + if (!isset($this->options[$articleUUID])) { + return []; + } + return $this->options[$articleUUID]; + } + + /** + * @param array $options + */ + public function setOptions($articleUUID, $options) + { + $this->options[$articleUUID] = $options; + } + + /** + * @return int + */ + public function getActualStep() + { + return $this->actualStep; + } + + /** + * @param int $actualStep + */ + public function setActualStep($actualStep) + { + $this->actualStep = $actualStep; + } + + public function hasOption($articleUUID, $option) + { + if (!isset($this->options[$articleUUID])) { + return false; + } + + return isset($this->options[$articleUUID][$option]); + } + + public function getOption($articleUUID, $option) + { + return $this->options[$articleUUID][$option]; + } + + public function __serialize(): array + { + return [ + $this->options, + $this->actualStep, + ]; + } + + public function __unserialize(array $data): void + { + $this->options = $data[0]; + $this->actualStep = $data[1]; + } +} +