Fixes
This commit is contained in:
parent
e320761ff5
commit
0c00d36236
@ -474,7 +474,7 @@ namespace Symfony\Component\DependencyInjection\Loader\Configurator;
|
||||
* datetime?: array{
|
||||
* default_format?: scalar|null, // Default: "Y-m-d\\TH:i:sP"
|
||||
* default_deserialization_formats?: list<scalar|null>,
|
||||
* default_timezone?: scalar|null, // Default: "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<scalar|null>,
|
||||
* default_timezone?: scalar|null, // Default: "Europe/Berlin"
|
||||
* default_timezone?: scalar|null, // Default: "UTC"
|
||||
* cdata?: scalar|null, // Default: true
|
||||
* },
|
||||
* array_collection?: array{
|
||||
|
||||
@ -2,5 +2,4 @@ parameters:
|
||||
level: 7
|
||||
paths:
|
||||
- src
|
||||
- var/plugins
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -1,22 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
|
||||
namespace 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');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,24 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
|
||||
namespace 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;');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,31 +1,20 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
|
||||
namespace 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');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,21 +1,10 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
|
||||
namespace PSC\System\UpdateBundle\Migrations;
|
||||
|
||||
class Version201810242020 extends Base
|
||||
{
|
||||
public function migrateDatabase()
|
||||
public function migrateDatabase(): void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,25 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
|
||||
namespace 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');
|
||||
}
|
||||
}
|
||||
|
||||
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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)");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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`),
|
||||
|
||||
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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)");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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");
|
||||
}
|
||||
}
|
||||
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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`),
|
||||
|
||||
@ -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;');
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;');
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;');
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<int, Base>
|
||||
*/
|
||||
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<int, Base>
|
||||
*/
|
||||
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) {
|
||||
|
||||
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Controller\Backend;
|
||||
|
||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Form\XML\EditType;
|
||||
use PSC\Shop\EntityBundle\Document\Shop;
|
||||
use PSC\Shop\EntityBundle\Entity\Account;
|
||||
use PSC\Shop\EntityBundle\Entity\Product;
|
||||
use PSC\Shop\EntityBundle\Entity\Stockbooking;
|
||||
use PSC\Shop\ProductBundle\Form\Backend\ProductType;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Security\Core\SecurityContext;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Bridge\Twig\Attribute\Template;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class XmlController extends AbstractController
|
||||
{
|
||||
|
||||
#[Template()]
|
||||
#[Route(path: '/xml/edit/{uuid}', name: 'psc_plugin_laufkartenlayouter_backend_xml_edit')]
|
||||
public function editAction(Request $request, \PSC\System\SettingsBundle\Service\Shop $shopService, DocumentManager $documentManager, EntityManagerInterface $entityManager, $uuid)
|
||||
{
|
||||
$selectedShop = $shopService->getSelectedShop();
|
||||
|
||||
/** @var Product $product */
|
||||
$product = $entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Product')->findOneBy(array('uuid' => $uuid, 'shop' => $selectedShop));
|
||||
|
||||
/** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */
|
||||
$productDoc = $documentManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Document\Product')
|
||||
->findOneBy(array('uid' => (string)$product->getUid()));
|
||||
|
||||
$data = ['uuid' => $product->getUUid(), 'xml' => $productDoc->getPluginSettingModule('laufkartenlayouter', 'xml')];
|
||||
|
||||
$form = $this->createForm(EditType::class, $data);
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$data = $form->getData();
|
||||
dump($data);
|
||||
$productDoc->setPluginSettingModule('laufkartenlayouter', 'xml', $data['xml']);
|
||||
$documentManager->persist($productDoc);
|
||||
$documentManager->flush();
|
||||
}
|
||||
return array(
|
||||
'form' => $form->createView(),
|
||||
'product' => $product
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Controller;
|
||||
|
||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Form\FormDesigner;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Service\Layouter;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Session\LaufkartenLayouter;
|
||||
use PSC\Shop\EntityBundle\Entity\Layoutdesigndata;
|
||||
use PSC\Shop\EntityBundle\Entity\Product;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Twig\Environment;
|
||||
use Twig\Loader\FilesystemLoader;
|
||||
|
||||
#[Route('/designer')]
|
||||
class DesignerController extends AbstractController
|
||||
{
|
||||
#[Route('/load/{productId}/{layouterId}', name: 'psc_plugin_laufkartenlayouter_load')]
|
||||
public function loadAction(Request $request, EntityManagerInterface $entityManager, $productId, $layouterId = '')
|
||||
{
|
||||
$session = new LaufkartenLayouter();
|
||||
if ($request->getSession()->has('laufkartenlayouter')) {
|
||||
$session = $request->getSession()->get('laufkartenlayouter');
|
||||
}
|
||||
|
||||
if ($layouterId != '') {
|
||||
/** @var Layoutdesigndata $layoutDesignData */
|
||||
$layoutDesignData = $entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')
|
||||
->findOneBy(['uuid' => $layouterId]);
|
||||
|
||||
$session->setOptions($productId, $layoutDesignData->getDesign());
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('psc_plugin_laufkartenlayouter_start', [
|
||||
'productId' => $productId,
|
||||
'layouterId' => $layouterId,
|
||||
]);
|
||||
}
|
||||
|
||||
#[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]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Controller;
|
||||
|
||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||
use MongoDB\BSON\ObjectId;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
#[Route('/image')]
|
||||
class ImageController extends AbstractController
|
||||
{
|
||||
|
||||
#[Route('/info/{id}', name: 'psc_plugin_laufkartenlayouter_image_info')]
|
||||
public function infoAction(Request $request, DocumentManager $documentManager, $id)
|
||||
{
|
||||
/** @var \Plugin\Custom\PSC\LaufkartenLayouter\Document\Image $image */
|
||||
$image = $documentManager
|
||||
->getRepository('Plugin\Custom\PSC\LaufkartenLayouter\Document\Image')
|
||||
->findOneBy(['_id' => new ObjectId($id)]);
|
||||
|
||||
return new JsonResponse([
|
||||
'title' => $image,
|
||||
'rotate' => $image->getRotate(),
|
||||
'cropBox' => [
|
||||
'width' => $image->getCropWidth(),
|
||||
'height' => $image->getCropHeight(),
|
||||
'x' => $image->getCropX(),
|
||||
'y' => $image->getCropY()
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/original/{id}/{width}/{height}', name: 'psc_plugin_laufkartenlayouter_image_original')]
|
||||
public function imageAction(Request $request, DocumentManager $documentManager, $id, $width = 400, $height = 400)
|
||||
{
|
||||
|
||||
$width = round($width);
|
||||
$height = round($height);
|
||||
|
||||
/** @var \Plugin\Custom\PSC\LaufkartenLayouter\Document\Image $image */
|
||||
$image = $documentManager
|
||||
->getRepository('Plugin\Custom\PSC\LaufkartenLayouter\Document\Image')
|
||||
->findOneBy(['_id' => new ObjectId($id)]);
|
||||
|
||||
$outfilename = "temp/".md5($id);
|
||||
|
||||
$im = new \imagick("/data/www/new/web/market/motive/" . $image->getFileName());
|
||||
if($im->getImageWidth() < $width) {
|
||||
$width = $im->getImageWidth();
|
||||
}
|
||||
$im->setResolution(300,300);
|
||||
$im->thumbnailimage($width, $height, true);
|
||||
$im->writeimage($outfilename.".png");
|
||||
|
||||
$response = new Response();
|
||||
|
||||
$response->headers->set('Cache-Control', 'private');
|
||||
$response->headers->set('Content-type', mime_content_type($outfilename.".png"));
|
||||
$response->headers->set('Content-Disposition', 'attachment; filename="' . basename($outfilename.".png") . '"');
|
||||
|
||||
$response->sendHeaders();
|
||||
|
||||
$response->setContent(readfile($outfilename.".png"));
|
||||
|
||||
unlink($outfilename);
|
||||
|
||||
return $response;
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Controller;
|
||||
|
||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Renderer\Pdf;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Service\Layouter;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Session\LaufkartenLayouter;
|
||||
use PSC\Shop\EntityBundle\Entity\Product;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
#[Route('/pdf')]
|
||||
class PdfController extends AbstractController
|
||||
{
|
||||
|
||||
#[Route('/pdf/preview/{productId}', name: 'psc_plugin_laufkartenlayouter_pdf_preview')]
|
||||
public function previewAction(Request $request, EntityManagerInterface $entityManager, DocumentManager $documentManager, Layouter $formLayouter, Pdf $renderer, $productId)
|
||||
{
|
||||
|
||||
/** @var Product $product */
|
||||
$product = $entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Product')
|
||||
->findOneBy(array('uuid' => $productId));
|
||||
|
||||
/** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */
|
||||
$productDoc = $documentManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Document\Product')
|
||||
->findOneBy(array('uid' => (string)$product->getUid()));
|
||||
|
||||
$session = new LaufkartenLayouter();
|
||||
if($request->getSession()->has('laufkartenlayouter')) {
|
||||
$session = $request->getSession()->get('laufkartenlayouter');
|
||||
}
|
||||
|
||||
$formLayouter->setXml($productDoc->getPluginSetting('laufkartenlayouter', 'xml'));
|
||||
|
||||
$config = $formLayouter->getConfig();
|
||||
|
||||
$outfilename = "temp/".uniqid().".pdf";
|
||||
|
||||
$session = new LaufkartenLayouter();
|
||||
if($request->getSession()->has('laufkartenlayouter')) {
|
||||
$session = $request->getSession()->get('laufkartenlayouter');
|
||||
}
|
||||
|
||||
$renderer->setConfig($config);
|
||||
$renderer->setOptions($session->getOptions($productId));
|
||||
$renderer->renderPreviewPdf($formLayouter->getSites(), $outfilename);
|
||||
|
||||
$response = new Response();
|
||||
|
||||
$response->headers->set('Cache-Control', 'private');
|
||||
$response->headers->set('Content-type', mime_content_type($outfilename));
|
||||
$response->headers->set('Content-Disposition', 'attachment; filename="' . basename($outfilename) . '"');
|
||||
$response->headers->set('Content-length', filesize($outfilename));
|
||||
|
||||
$response->sendHeaders();
|
||||
|
||||
$response->setContent(readfile($outfilename));
|
||||
|
||||
unlink($outfilename);
|
||||
|
||||
return $response;
|
||||
|
||||
}
|
||||
|
||||
#[Route('/pdf/print/{productId}', name: 'psc_plugin_laufkartenlayouter_pdf_print')]
|
||||
public function printAction(Request $request, EntityManagerInterface $entityManager, DocumentManager $documentManager, Layouter $formLayouter, Pdf $renderer, $productId)
|
||||
{
|
||||
|
||||
/** @var Product $product */
|
||||
$product = $entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Product')
|
||||
->findOneBy(array('uuid' => $productId));
|
||||
|
||||
/** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */
|
||||
$productDoc = $documentManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Document\Product')
|
||||
->findOneBy(array('uid' => (string)$product->getUid()));
|
||||
|
||||
$session = new LaufkartenLayouter();
|
||||
if($request->getSession()->has('laufkartenlayouter')) {
|
||||
$session = $request->getSession()->get('laufkartenlayouter');
|
||||
}
|
||||
|
||||
$formLayouter->setXml($productDoc->getPluginSetting('laufkartenlayouter', 'xml'));
|
||||
|
||||
$config = $formLayouter->getConfig();
|
||||
|
||||
$outfilename = "temp/".uniqid().".pdf";
|
||||
|
||||
$session = new LaufkartenLayouter();
|
||||
if($request->getSession()->has('laufkartenlayouter')) {
|
||||
$session = $request->getSession()->get('laufkartenlayouter');
|
||||
}
|
||||
|
||||
$renderer->setConfig($config);
|
||||
$renderer->setOptions($session->getOptions($productId));
|
||||
$renderer->renderPrintPdf($formLayouter->getSites(), $outfilename);
|
||||
|
||||
$response = new Response();
|
||||
|
||||
$response->headers->set('Cache-Control', 'private');
|
||||
$response->headers->set('Content-type', mime_content_type($outfilename));
|
||||
$response->headers->set('Content-Disposition', 'attachment; filename="' . basename($outfilename) . '"');
|
||||
|
||||
$response->sendHeaders();
|
||||
|
||||
$response->setContent(readfile($outfilename));
|
||||
|
||||
unlink($outfilename);
|
||||
|
||||
return $response;
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,144 @@
|
||||
<?php
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Controller;
|
||||
|
||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Renderer\Pdf;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Service\Layouter;
|
||||
use PSC\Shop\EntityBundle\Entity\Layoutdesigndata;
|
||||
use PSC\Shop\EntityBundle\Entity\Product;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
#[Route('/preview')]
|
||||
class PreviewController extends AbstractController
|
||||
{
|
||||
|
||||
#[Route('/image/{productId}/{site}/{width}/{height}', name: 'psc_plugin_laufkartenlayouter_preview_image')]
|
||||
public function imageAction(Request $request, EntityManagerInterface $entityManager, DocumentManager $documentManager, Layouter $formLayouter, Pdf $renderer, $productId, $site = 1, $width = 400, $height = 900)
|
||||
{
|
||||
|
||||
$width = round($width);
|
||||
$height = round($height);
|
||||
|
||||
/** @var Product $product */
|
||||
$product = $entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Product')
|
||||
->findOneBy(array('uuid' => $productId));
|
||||
|
||||
/** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */
|
||||
$productDoc = $documentManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Document\Product')
|
||||
->findOneBy(array('uid' => (string)$product->getUid()));
|
||||
|
||||
$session = new LaufkartenLayouter();
|
||||
if($request->getSession()->has('laufkartenlayouter')) {
|
||||
$session = $request->getSession()->get('laufkartenlayouter');
|
||||
}
|
||||
|
||||
$formLayouter->setXml($productDoc->getPluginSetting('laufkartenlayouter', 'xml'));
|
||||
|
||||
$actSite = $formLayouter->getSite($site);
|
||||
$config = $formLayouter->getConfig();
|
||||
|
||||
$outfilename = "temp/".uniqid().".pdf";
|
||||
|
||||
$session = new LaufkartenLayouter();
|
||||
if($request->getSession()->has('laufkartenlayouter')) {
|
||||
$session = $request->getSession()->get('laufkartenlayouter');
|
||||
}
|
||||
|
||||
$renderer->setSite($actSite);
|
||||
$renderer->setConfig($config);
|
||||
$renderer->setOptions($session->getOptions($productId));
|
||||
$renderer->renderStep($outfilename);
|
||||
|
||||
$im = new \imagick();
|
||||
|
||||
$im->setCompressionQuality(89);
|
||||
|
||||
$im->setResolution(300,300);
|
||||
$im->readImage($outfilename."[0]");
|
||||
$im->thumbnailimage($width, $height, true);
|
||||
$im->mergeImageLayers(\imagick::LAYERMETHOD_FLATTEN);
|
||||
// $im->setImageAlphaChannel(\imagick::ALPHACHANNEL_REMOVE);
|
||||
$im->writeimage($outfilename.".jpeg");
|
||||
|
||||
unlink($outfilename);
|
||||
|
||||
|
||||
$response = new Response();
|
||||
|
||||
$response->headers->set('Cache-Control', 'private');
|
||||
$response->headers->set('Content-type', mime_content_type($outfilename.".jpeg"));
|
||||
$response->headers->set('Content-Disposition', 'attachment; filename="' . basename($outfilename.".jpeg") . '"');
|
||||
|
||||
$response->sendHeaders();
|
||||
|
||||
$response->setContent(readfile($outfilename.".jpeg"));
|
||||
|
||||
unlink($outfilename.".jpeg");
|
||||
|
||||
return $response;
|
||||
|
||||
}
|
||||
|
||||
#[Route('/layouter/{layouterId}/{site}/{width}/{height}', name: 'psc_plugin_laufkartenlayouter_preview_layouter')]
|
||||
public function layouterAction(Request $request, EntityManagerInterface $entityManager, DocumentManager $documentManager, Layouter $formLayouter, Pdf $renderer, $layouterId, $site = 1, $width = 400, $height = 900)
|
||||
{
|
||||
$width = round($width);
|
||||
$height = round($height);
|
||||
|
||||
/** @var Layoutdesigndata $layoutDesignData */
|
||||
$layoutDesignData = $entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')->findOneBy(array('uuid' => $layouterId));
|
||||
|
||||
|
||||
/** @var Product $product */
|
||||
$product = $documentManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Product')
|
||||
->findOneBy(array('uuid' => $layoutDesignData->getArticleUuid()));
|
||||
|
||||
/** @var \PSC\Shop\EntityBundle\Document\Product $productDoc */
|
||||
$productDoc = $documentManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Document\Product')
|
||||
->findOneBy(array('uid' => (string)$product->getUid()));
|
||||
|
||||
$formLayouter->setXml($productDoc->getPluginSetting('laufkartenlayouter', 'xml'));
|
||||
|
||||
$actSite = $formLayouter->getSite($site);
|
||||
$config = $formLayouter->getConfig();
|
||||
|
||||
$outfilename = "temp/".uniqid().".pdf";
|
||||
|
||||
$renderer->setSite($actSite);
|
||||
$renderer->setConfig($config);
|
||||
$renderer->setOptions($layoutDesignData->getDesign());
|
||||
$renderer->renderStep($outfilename);
|
||||
|
||||
$im = new \imagick($outfilename."[0]");
|
||||
if($im->getImageWidth() < $width) {
|
||||
$width = $im->getImageWidth();
|
||||
}
|
||||
$im->setResolution(300,300);
|
||||
$im->thumbnailimage($width, $height, true);
|
||||
$im->writeimage($outfilename.".png");
|
||||
|
||||
unlink($outfilename);
|
||||
|
||||
|
||||
$response = new Response();
|
||||
|
||||
$response->headers->set('Cache-Control', 'private');
|
||||
$response->headers->set('Content-type', mime_content_type($outfilename.".png"));
|
||||
$response->headers->set('Content-Disposition', 'attachment; filename="' . basename($outfilename.".png") . '"');
|
||||
|
||||
$response->sendHeaders();
|
||||
|
||||
$response->setContent(readfile($outfilename.".png"));
|
||||
|
||||
unlink($outfilename.".png");
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Controller;
|
||||
|
||||
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Session\LaufkartenLayouter;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
#[Route('/store')]
|
||||
class StoreController extends AbstractController
|
||||
{
|
||||
|
||||
#[Route('/save', name: 'psc_plugin_laufkartenlayouter_store_save')]
|
||||
public function saveAction(Request $request, EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
||||
$uuid = $request->get("layouter");
|
||||
$articleUuid = $request->get("article");
|
||||
|
||||
$layoutDesignData = new Layoutdesigndata();
|
||||
$layoutDesignData->setUuid($uuid);
|
||||
$layoutDesignData->setArticleUuid($articleUuid);
|
||||
$session = new LaufkartenLayouter();
|
||||
if($request->getSession()->has('laufkartenlayouter')) {
|
||||
$session = $request->getSession()->get('laufkartenlayouter');
|
||||
}
|
||||
$layoutDesignData->setDesign($session->getOptions($articleUuid));
|
||||
|
||||
$entityManager->persist($layoutDesignData);
|
||||
$entityManager->flush();
|
||||
|
||||
$json = new JsonResponse();
|
||||
$json->setContent(json_encode(array('success' => true)));
|
||||
|
||||
return $json;
|
||||
}
|
||||
|
||||
#[Route('/update', name: 'psc_plugin_laufkartenlayouter_store_update')]
|
||||
public function updateAction(Request $request, EntityManagerInterface $entityManager)
|
||||
{
|
||||
|
||||
$uuid = $request->get("layouter");
|
||||
$articleUuid = $request->get("article");
|
||||
|
||||
$layoutDesignData = $entityManager
|
||||
->getRepository('PSC\Shop\EntityBundle\Entity\Layoutdesigndata')->findOneBy(array('uuid' => $uuid));
|
||||
|
||||
|
||||
$session = new LaufkartenLayouter();
|
||||
if($request->getSession()->has('laufkartenlayouter')) {
|
||||
$session = $request->getSession()->get('laufkartenlayouter');
|
||||
}
|
||||
|
||||
$layoutDesignData->setDesign($session->getOptions($articleUuid));
|
||||
|
||||
$entityManager->persist($layoutDesignData);
|
||||
$entityManager->flush();
|
||||
|
||||
$json = new JsonResponse();
|
||||
$json->setContent(json_encode(array('success' => true)));
|
||||
|
||||
return $json;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,102 @@
|
||||
<?php
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Controller;
|
||||
|
||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||
use Gaufrette\Filesystem;
|
||||
use Gaufrette\FilesystemMapInterface;
|
||||
use Knp\Bundle\GaufretteBundle\FilesystemMap;
|
||||
use MongoDB\BSON\ObjectId;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Document\Image;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
#[Route('/upload')]
|
||||
class UploadController extends AbstractController
|
||||
{
|
||||
#[Route('/single', name: 'psc_plugin_laufkartenlayouter_upload_single')]
|
||||
public function singleAction(Request $request, DocumentManager $documentManager, FilesystemMap $filesystemMap)
|
||||
{
|
||||
if ($request->files->has("file")) {
|
||||
$file = $request->files->get("file");
|
||||
|
||||
if($file instanceof UploadedFile) {
|
||||
|
||||
|
||||
$filename = sprintf('%s/%s/%s/%s.%s', date('Y'), date('m'), date('d'), uniqid(), $file->getClientOriginalExtension());
|
||||
|
||||
/** @var Filesystem $fileContainer */
|
||||
$fileContainer = $filesystemMap->get('steplayouter_motiv');
|
||||
|
||||
if(
|
||||
$file->getMimeType() == "image/png" ||
|
||||
$file->getMimeType() == "image/jpg" ||
|
||||
$file->getMimeType() == "image/jpeg"
|
||||
){
|
||||
$filename = sprintf('%s/%s/%s/%s.%s', date('Y'), date('m'), date('d'), uniqid(), "jpg");
|
||||
|
||||
$filenameTemp = sprintf('/tmp/%s.%s', uniqid(), "jpg");
|
||||
exec("convert ".$file->getPathname()." -colorspace cmyk -auto-orient ".$filenameTemp);
|
||||
|
||||
$fileContainer->write($filename, file_get_contents($filenameTemp));
|
||||
|
||||
unlink($filenameTemp);
|
||||
|
||||
}else{
|
||||
$fileContainer->write($filename, file_get_contents($file->getPathname()));
|
||||
}
|
||||
|
||||
|
||||
$image = new Image();
|
||||
$image->setSessionId($request->getSession()->getId());
|
||||
$image->setFileName($fileContainer->get($filename)->getKey());
|
||||
$image->setCropWidth(100);
|
||||
$image->setCropHeight(100);
|
||||
|
||||
$documentManager->persist($image);
|
||||
$documentManager->flush();
|
||||
|
||||
return new JsonResponse(['success' => true, 'id' => $image->getId()]);
|
||||
}
|
||||
}
|
||||
|
||||
return new JsonResponse(['success' => false]);
|
||||
}
|
||||
|
||||
#[Route('/cropbox/{id}', name: 'psc_plugin_laufkartenlayouter_upload_crop')]
|
||||
public function cropAction(Request $request, DocumentManager $documentManager, $id)
|
||||
{
|
||||
/** @var \Plugin\Custom\PSC\LaufkartenLayouter\Document\Image $image */
|
||||
$image = $documentManager
|
||||
->getRepository('Plugin\Custom\PSC\LaufkartenLayouter\Document\Image')
|
||||
->findOneBy(['_id' => new ObjectId($id)]);
|
||||
|
||||
$image->setCrop(true);
|
||||
$image->setCropX($request->get('x'));
|
||||
$image->setCropY($request->get('y'));
|
||||
$image->setCropWidth($request->get('width'));
|
||||
$image->setCropHeight($request->get('height'));
|
||||
|
||||
$documentManager->persist($image);
|
||||
$documentManager->flush();
|
||||
|
||||
return new JsonResponse(['success' => true]);
|
||||
}
|
||||
|
||||
#[Route('/rotate/{id}', name: 'psc_plugin_laufkartenlayouter_upload_rotate')]
|
||||
public function rotateAction(Request $request, DocumentManager $documentManager, $id)
|
||||
{
|
||||
/** @var \Plugin\Custom\PSC\LaufkartenLayouter\Document\Image $image */
|
||||
$image = $documentManager
|
||||
->getRepository('Plugin\Custom\PSC\LaufkartenLayouter\Document\Image')
|
||||
->findOneBy(['_id' => new ObjectId($id)]);
|
||||
|
||||
|
||||
exec("convert /data/www/new/web/market/motive/" . $image->getFileName()." -rotate ".($request->get('rotate'))." /data/www/new/web/market/motive/" . $image->getFileName());
|
||||
|
||||
|
||||
return new JsonResponse(['success' => true]);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,197 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Document;
|
||||
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Field;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Id;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Document;
|
||||
use Doctrine\ODM\MongoDB\Mapping\Annotations\Hash;
|
||||
|
||||
#[Document(repositoryClass: 'Plugin\Custom\PSC\LaufkartenLayouter\Document\Repository\ImageRepository', collection: 'plugin_system_psc_laufkartenlayouter_image')]
|
||||
class Image
|
||||
{
|
||||
#[Id]
|
||||
protected $id;
|
||||
|
||||
#[Field(type: 'string')]
|
||||
protected $sessionId;
|
||||
|
||||
#[Field(type: 'string')]
|
||||
protected $fileName;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
#[Field(type: 'bool')]
|
||||
protected $crop = false;
|
||||
|
||||
#[Field(type: 'int')]
|
||||
protected $cropX = 0;
|
||||
|
||||
#[Field(type: 'int')]
|
||||
protected $cropY = 0;
|
||||
|
||||
#[Field(type: 'int')]
|
||||
protected $cropWidth = 0;
|
||||
|
||||
#[Field(type: 'int')]
|
||||
protected $cropHeight = 0;
|
||||
|
||||
#[Field(type: 'int')]
|
||||
protected $rotate = 0;
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSessionId()
|
||||
{
|
||||
return $this->sessionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $sessionId
|
||||
*/
|
||||
public function setSessionId($sessionId)
|
||||
{
|
||||
$this->sessionId = $sessionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getFileName()
|
||||
{
|
||||
return $this->fileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $fileName
|
||||
*/
|
||||
public function setFileName($fileName)
|
||||
{
|
||||
$this->fileName = $fileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isCrop()
|
||||
{
|
||||
return $this->crop;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $crop
|
||||
*/
|
||||
public function setCrop($crop)
|
||||
{
|
||||
$this->crop = $crop;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCropX()
|
||||
{
|
||||
return $this->cropX;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $cropX
|
||||
*/
|
||||
public function setCropX($cropX)
|
||||
{
|
||||
$this->cropX = $cropX;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCropY()
|
||||
{
|
||||
return $this->cropY;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $cropY
|
||||
*/
|
||||
public function setCropY($cropY)
|
||||
{
|
||||
$this->cropY = $cropY;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCropWidth()
|
||||
{
|
||||
return $this->cropWidth;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $cropWidth
|
||||
*/
|
||||
public function setCropWidth($cropWidth)
|
||||
{
|
||||
$this->cropWidth = $cropWidth;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCropHeight()
|
||||
{
|
||||
return $this->cropHeight;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $cropHeight
|
||||
*/
|
||||
public function setCropHeight($cropHeight)
|
||||
{
|
||||
$this->cropHeight = $cropHeight;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getRotate()
|
||||
{
|
||||
return $this->rotate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $rotate
|
||||
*/
|
||||
public function setRotate($rotate)
|
||||
{
|
||||
$this->rotate = $rotate;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Document\Repository;
|
||||
|
||||
use Doctrine\ODM\MongoDB\Repository\DocumentRepository;
|
||||
|
||||
class ImageRepository extends DocumentRepository
|
||||
{
|
||||
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Form\Field;
|
||||
|
||||
use PSC\System\PluginBundle\Form\Interfaces\Field;
|
||||
use PSC\System\SettingsBundle\Service\Status;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormEvent;
|
||||
|
||||
class BackendFields extends \PSC\System\PluginBundle\Form\Field implements Field
|
||||
{
|
||||
|
||||
protected $tab = 'uploads';
|
||||
|
||||
private $statusService;
|
||||
|
||||
public function __construct(Status $statusService)
|
||||
{
|
||||
$this->statusService = $statusService;
|
||||
}
|
||||
|
||||
public function getTemplate()
|
||||
{
|
||||
return '@PluginCustomPSCLaufkartenLayouter/form/field/backend.html.twig';
|
||||
}
|
||||
|
||||
public function getModule()
|
||||
{
|
||||
return Field::Product;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*/
|
||||
public function formPreSubmit(FormEvent $event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
|
||||
$builder->add('laufkartenlayouter', CheckboxType::class, array(
|
||||
'label' => 'Step Layouter aktivieren',
|
||||
'required' => false
|
||||
)) ->add("laufkartenlayouter2InitalStatus", ChoiceType::class, array(
|
||||
'label' => 'Initalstatus',
|
||||
'choices' => $this->statusService->getPositionStatusAsArray(),
|
||||
'translation_domain' => 'posstatus'
|
||||
));
|
||||
|
||||
|
||||
return $builder;
|
||||
}
|
||||
|
||||
public function getGroup()
|
||||
{
|
||||
return "laufkartenlayouter";
|
||||
}
|
||||
|
||||
public function formPostSetData(FormEvent $event)
|
||||
{
|
||||
// TODO: Implement formPostSetData() method.
|
||||
}
|
||||
|
||||
public function formPostSubmit(FormEvent $event)
|
||||
{
|
||||
// TODO: Implement formPostSubmit() method.
|
||||
}
|
||||
|
||||
public function formPreSetData(FormEvent $event)
|
||||
{
|
||||
// TODO: Implement formPreSetData() method.
|
||||
}
|
||||
|
||||
public function formSubmit(FormEvent $event)
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Form\Field;
|
||||
|
||||
use DirectoryIterator;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Form\Group\LaufkartenLayouterEditor;
|
||||
use PSC\System\PluginBundle\Form\Interfaces\Field;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormEvent;
|
||||
|
||||
class EnableEditor implements Field
|
||||
{
|
||||
|
||||
public function getTemplate()
|
||||
{
|
||||
return '@PluginCustomPSCLaufkartenLayouter/form/field/enable_editor.html.twig';
|
||||
}
|
||||
|
||||
public function getModule()
|
||||
{
|
||||
return Field::Theme;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*/
|
||||
public function formPreSubmit(FormEvent $event)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$txtheader = "";
|
||||
$txtfooter = "";
|
||||
$this->options = $options;
|
||||
|
||||
/** @var Shop $shopEntity */
|
||||
$shopEntity = $this->options['shopEntity'];
|
||||
$tempLayouts = [];
|
||||
if ($shopEntity->isCustomTemplates() == 1) {
|
||||
foreach (new DirectoryIterator('/data/www/old/application/design/vorlagen') as $file) {
|
||||
if ($file == '.' || $file == '..' || $file == 'config' || $file == '.svn' || $file == 'datapacks' || $file == '.DS_Store') {
|
||||
continue;
|
||||
}
|
||||
$tempLayouts[$file->getFileName()] = $file->getFileName();
|
||||
}
|
||||
} else {
|
||||
if (file_exists('/data/www/old/application/design/clients/' . $shopEntity->getUID())) {
|
||||
foreach (new DirectoryIterator('/data/www/old/application/design/clients/' . $shopEntity->getUID()) as $file) {
|
||||
if ($file == '.' || $file == '..' || $file == 'config' || $file == '.svn' || $file == 'datapacks' || $file == '.DS_Store') {
|
||||
continue;
|
||||
}
|
||||
$tempLayouts[$file->getFileName()] = $file->getFileName();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isset($_POST["settings"]["bootstrap3Images"]["layout"])) {
|
||||
header('location: /apps/backend/theme/settings');
|
||||
//die();
|
||||
} else {
|
||||
if (!file_exists("/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/laufkarten_layouter")) {
|
||||
mkdir("/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/laufkarten_layouter", 0777);
|
||||
}
|
||||
$filenameheader = "/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/laufkarten_layouter/header.html.twig";
|
||||
$filenamefooter = "/data/www/old/application/design/vorlagen/" . $shopEntity->getLayout() . "/laufkarten_layouter/footer.html.twig";
|
||||
if (!file_exists($filenameheader)) {
|
||||
touch($filenameheader);
|
||||
chmod($filenameheader, 0777);
|
||||
}
|
||||
if (!file_exists($filenamefooter)) {
|
||||
touch($filenamefooter);
|
||||
chmod($filenamefooter, 0777);
|
||||
}
|
||||
|
||||
$handleheader = fopen($filenameheader, 'r');
|
||||
if(filesize($filenameheader)>0) {
|
||||
$txtheader = fread($handleheader, filesize($filenameheader));
|
||||
fclose($handleheader);
|
||||
}
|
||||
$handlefooter = fopen($filenamefooter, 'r');
|
||||
if(filesize($filenamefooter)) {
|
||||
$txtfooter = fread($handlefooter, filesize($filenamefooter));
|
||||
fclose($handlefooter);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$builder->add('header', TextareaType::class, array(
|
||||
'label' => 'Header',
|
||||
'data' => $txtheader,
|
||||
'required' => false,
|
||||
'attr' => array('rows' => 50)
|
||||
))
|
||||
->add('footer', TextareaType::class, array(
|
||||
'label' => 'Footer',
|
||||
'data' => $txtfooter,
|
||||
'required' => false,
|
||||
'attr' => array('rows' => 50)
|
||||
));
|
||||
;
|
||||
|
||||
return $builder;
|
||||
}
|
||||
|
||||
public function getGroup()
|
||||
{
|
||||
return LaufkartenLayouterEditor::GROUP_ID;
|
||||
}
|
||||
|
||||
public function formPostSetData(FormEvent $event)
|
||||
{
|
||||
// TODO: Implement formPostSetData() method.
|
||||
}
|
||||
|
||||
public function formPostSubmit(FormEvent $event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function formPreSetData(FormEvent $event)
|
||||
{
|
||||
// TODO: Implement formPreSetData() method.
|
||||
}
|
||||
|
||||
public function formSubmit(FormEvent $event)
|
||||
{
|
||||
$filename = "/data/www/old/application/design/vorlagen/" . $_POST["settings"]["bootstrap3General"]["layout"] . "/laufkarten_layouter/header.html.twig";
|
||||
$handle = fopen($filename, 'w');
|
||||
fputs($handle, $event->getForm()->get('laufkartenlayoutereditor')->get('header')->getData());
|
||||
fclose($handle);
|
||||
|
||||
$filename = "/data/www/old/application/design/vorlagen/" . $_POST["settings"]["bootstrap3General"]["layout"] . "/laufkarten_layouter/footer.html.twig";
|
||||
$handle = fopen($filename, 'w');
|
||||
fputs($handle, $event->getForm()->get('laufkartenlayoutereditor')->get('footer')->getData());
|
||||
fclose($handle);
|
||||
// TODO: Implement formPostSubmit() method.
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Form;
|
||||
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Step;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Session\LaufkartenLayouter;
|
||||
use PSC\Shop\MediaBundle\Service\MediaManager;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||
use Symfony\Component\Form\Form;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class FormDesigner extends AbstractType
|
||||
{
|
||||
/**
|
||||
* @var MediaManager
|
||||
*/
|
||||
private $mediaManager;
|
||||
|
||||
public function __construct(MediaManager $mediaManager)
|
||||
{
|
||||
$this->mediaManager = $mediaManager;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
|
||||
/** @var LaufkartenLayouter $session */
|
||||
$session = $options['session'];
|
||||
|
||||
$productId = $options['productId'];
|
||||
|
||||
/** @var Step $step */
|
||||
$step = $options['step'];
|
||||
|
||||
foreach($step->getColumns() as $column) {
|
||||
foreach($column->getOptions() as $option) {
|
||||
if($option->isInForm()) {
|
||||
$option->renderForm($builder, $this->mediaManager);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach($builder->all() as $opt) {
|
||||
if($session->hasOption($productId, $opt->getName())) {
|
||||
$opt->setData($session->getOption($productId, $opt->getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'designer';
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'step' => null,
|
||||
'session' => null,
|
||||
'productId' => null,
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Form\Group;
|
||||
|
||||
use PSC\Shop\EntityBundle\Entity\Cms;
|
||||
use PSC\System\PluginBundle\Form\Group;
|
||||
use PSC\System\PluginBundle\Form\Interfaces\Field;
|
||||
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
||||
use Symfony\Component\Form\Form;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
|
||||
class LaufkartenLayouter extends Group
|
||||
{
|
||||
const GROUP_ID = 'laufkartenlayouter';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->title = 'Step Layouter';
|
||||
}
|
||||
|
||||
public function getModule()
|
||||
{
|
||||
return Field::Product;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return self::GROUP_ID;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Form\Group;
|
||||
|
||||
use PSC\Shop\EntityBundle\Entity\Cms;
|
||||
use PSC\System\PluginBundle\Form\Group;
|
||||
use PSC\System\PluginBundle\Form\Interfaces\Field;
|
||||
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
||||
use Symfony\Component\Form\Form;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
|
||||
class LaufkartenLayouterEditor extends Group
|
||||
{
|
||||
const GROUP_ID = 'laufkartenlayoutereditor';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->title = 'Step Layouter';
|
||||
}
|
||||
|
||||
public function getModule()
|
||||
{
|
||||
return Field::Theme;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return self::GROUP_ID;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Form\XML;
|
||||
|
||||
use PSC\Libraries\AceEditorBundle\Form\Extension\AceEditorType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class EditType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('uuid', TextType::class, array('disabled' => true))
|
||||
->add('xml', AceEditorType::class, array(
|
||||
'wrapper_attr' => array(), // aceeditor wrapper html attributes.
|
||||
'width' => '100%',
|
||||
'height' => '500',
|
||||
'font_size' => 14,
|
||||
'mode' => 'ace/mode/xml', // every single default mode must have ace/mode/* prefix
|
||||
'theme' => 'ace/theme/monokai', // every single default theme must have ace/theme/* prefix
|
||||
'tab_size' => null,
|
||||
'read_only' => null,
|
||||
'use_soft_tabs' => null,
|
||||
'use_wrap_mode' => null,
|
||||
'show_print_margin' => null,
|
||||
'required' => false,
|
||||
'highlight_active_line' => null
|
||||
))
|
||||
->add('save', SubmitType::class, array('label' => 'Speichern'));
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'product';
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Model;
|
||||
|
||||
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Model\Config\Pdf;
|
||||
|
||||
class Config {
|
||||
|
||||
/** @var Pdf */
|
||||
private $pdf;
|
||||
|
||||
private $pdfPreviewButton = false;
|
||||
|
||||
private $pdfPrintButton = false;
|
||||
|
||||
/**
|
||||
* @return Pdf
|
||||
*/
|
||||
public function getPdf()
|
||||
{
|
||||
return $this->pdf;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Pdf $pdf
|
||||
*/
|
||||
public function setPdf($pdf)
|
||||
{
|
||||
$this->pdf = $pdf;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isPdfPreviewButton()
|
||||
{
|
||||
return $this->pdfPreviewButton;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $pdfPreviewButton
|
||||
*/
|
||||
public function setPdfPreviewButton($pdfPreviewButton)
|
||||
{
|
||||
$this->pdfPreviewButton = $pdfPreviewButton;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isPdfPrintButton()
|
||||
{
|
||||
return $this->pdfPrintButton;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $pdfPrintButton
|
||||
*/
|
||||
public function setPdfPrintButton($pdfPrintButton)
|
||||
{
|
||||
$this->pdfPrintButton = $pdfPrintButton;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Config;
|
||||
|
||||
|
||||
class Pdf {
|
||||
|
||||
private $unit = "pt";
|
||||
|
||||
private $pdfx4 = false;
|
||||
|
||||
private $iccProfile = "";
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUnit()
|
||||
{
|
||||
return $this->unit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $unit
|
||||
*/
|
||||
public function setUnit($unit)
|
||||
{
|
||||
$this->unit = $unit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getIccProfile()
|
||||
{
|
||||
return $this->iccProfile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $iccProfile
|
||||
*/
|
||||
public function setIccProfile($iccProfile)
|
||||
{
|
||||
$this->iccProfile = $iccProfile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isPdfx4()
|
||||
{
|
||||
return $this->pdfx4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $pdfx4
|
||||
*/
|
||||
public function setPdfx4($pdfx4)
|
||||
{
|
||||
$this->pdfx4 = $pdfx4;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,214 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements;
|
||||
|
||||
|
||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Site;
|
||||
|
||||
abstract class Base {
|
||||
|
||||
private $id = "";
|
||||
|
||||
private $x = 0;
|
||||
|
||||
private $y = 0;
|
||||
|
||||
private $preview = true;
|
||||
|
||||
private $print = true;
|
||||
|
||||
/** @var string? */
|
||||
private $border = null;
|
||||
|
||||
/** @var DocumentManager */
|
||||
private $mongoDb;
|
||||
|
||||
/** @var float */
|
||||
private $scale = 1;
|
||||
|
||||
private $options = [];
|
||||
|
||||
/** @var Site */
|
||||
private $site;
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $id
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getX()
|
||||
{
|
||||
return $this->x;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $x
|
||||
*/
|
||||
public function setX($x)
|
||||
{
|
||||
$this->x = $x;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getY()
|
||||
{
|
||||
return $this->y;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $y
|
||||
*/
|
||||
public function setY($y)
|
||||
{
|
||||
$this->y = $y;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \PDFlib $pdf
|
||||
*/
|
||||
abstract function renderPdf($pdf);
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isPrint()
|
||||
{
|
||||
return $this->print;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $print
|
||||
*/
|
||||
public function setPrint($print)
|
||||
{
|
||||
$this->print = $print;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isPreview()
|
||||
{
|
||||
return $this->preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $preview
|
||||
*/
|
||||
public function setPreview($preview)
|
||||
{
|
||||
$this->preview = $preview;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getScale()
|
||||
{
|
||||
return $this->scale;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $scale
|
||||
*/
|
||||
public function setScale($scale)
|
||||
{
|
||||
$this->scale = $scale;
|
||||
}
|
||||
|
||||
public function setOptions($options)
|
||||
{
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getOption($key)
|
||||
{
|
||||
return $this->options[$key];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasOption($key)
|
||||
{
|
||||
return isset($this->options[$key]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DocumentManager
|
||||
*/
|
||||
public function getMongoDb()
|
||||
{
|
||||
return $this->mongoDb;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DocumentManager $mongoDb
|
||||
*/
|
||||
public function setMongoDb($mongoDb)
|
||||
{
|
||||
$this->mongoDb = $mongoDb;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Site
|
||||
*/
|
||||
public function getSite()
|
||||
{
|
||||
return $this->site;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Site $site
|
||||
*/
|
||||
public function setSite($site)
|
||||
{
|
||||
$this->site = $site;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBorder()
|
||||
{
|
||||
return $this->border;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $border
|
||||
*/
|
||||
public function setBorder($border)
|
||||
{
|
||||
$this->border = $border;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements;
|
||||
|
||||
use MongoDB\BSON\ObjectId;
|
||||
use Monolog\Handler\Mongo;
|
||||
|
||||
class Image extends Base
|
||||
{
|
||||
|
||||
private $file = "";
|
||||
|
||||
private $width = 0;
|
||||
|
||||
private $height = 0;
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFile()
|
||||
{
|
||||
if($this->hasOption($this->getId().'_original')) {
|
||||
return $this->getOption($this->getId().'_original');
|
||||
}
|
||||
return $this->getId();
|
||||
}
|
||||
|
||||
|
||||
public function renderPdf($pdf)
|
||||
{
|
||||
if($this->getFile() != "") {
|
||||
$id = new ObjectId($this->getFile());
|
||||
|
||||
$render = true;
|
||||
/** @var \Plugin\Custom\PSC\LaufkartenLayouter\Document\Image $imageObj */
|
||||
$imageObj = $this->getMongoDb()
|
||||
->getRepository('Plugin\Custom\PSC\LaufkartenLayouter\Document\Image')
|
||||
->findOneBy(['_id' => new ObjectId($this->getFile())]);
|
||||
# Load the image
|
||||
$image = $pdf->load_image("auto", "/data/www/new/web/market/motive/" . $imageObj->getFileName(), "");
|
||||
if ($image == 0) {
|
||||
echo("Error: " . $pdf->get_errmsg());
|
||||
exit(1);
|
||||
}
|
||||
$opt = "position={top left} boxsize={" . $this->getWidth()*$this->getScale() . " " . $this->getHeight()*$this->getScale() .
|
||||
"} fitmethod=meet";
|
||||
|
||||
|
||||
// $opt = $opt . " matchbox={clipping={1% 1% 50% 50%}}";
|
||||
if($imageObj->isCrop()) {
|
||||
$opt = $opt . " matchbox={name=" . $this->getId() . " clipping={" .
|
||||
($imageObj->getCropX()) . "% " . (100-$imageObj->getCropHeight()-$imageObj->getCropY()) . "% " . ($imageObj->getCropWidth()+$imageObj->getCropX()) . "% " . (100-$imageObj->getCropY()) . "%}}";
|
||||
|
||||
if($imageObj->getCropWidth() == 0 || $imageObj->getCropHeight() == 0) {
|
||||
$render = false;
|
||||
}
|
||||
}else{
|
||||
$opt = $opt . " matchbox={name=" . $this->getId() . "}";
|
||||
}
|
||||
if($imageObj->getRotate() != 0) {
|
||||
//$opt .= " rotate=". $imageObj->getRotate() . "";
|
||||
}
|
||||
|
||||
if($render) {
|
||||
$pdf->fit_image($image, $this->getX() * $this->getScale(),
|
||||
($this->getHeight() + $this->getY()) * $this->getScale(), $opt);
|
||||
}
|
||||
|
||||
if($this->getBorder() != null) {
|
||||
$path = (int)$pdf->info_matchbox($this->getId(), 1, "boundingbox");
|
||||
$pdf->draw_path($path, 0, 0, $this->getBorder());
|
||||
$pdf->delete_path($path);
|
||||
}
|
||||
|
||||
$pdf->close_image($image);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getWidth()
|
||||
{
|
||||
return $this->width;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $width
|
||||
*/
|
||||
public function setWidth($width)
|
||||
{
|
||||
$this->width = $width;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getHeight()
|
||||
{
|
||||
return $this->height;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $height
|
||||
*/
|
||||
public function setHeight($height)
|
||||
{
|
||||
$this->height = $height;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $file
|
||||
* @return Image
|
||||
*/
|
||||
public function setFile($file)
|
||||
{
|
||||
$this->file = $file;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements;
|
||||
|
||||
use MongoDB\BSON\ObjectId;
|
||||
use Monolog\Handler\Mongo;
|
||||
|
||||
class Media extends Base
|
||||
{
|
||||
|
||||
private $file = "";
|
||||
|
||||
private $width = 0;
|
||||
|
||||
private $height = 0;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFile()
|
||||
{
|
||||
if ($this->hasOption($this->getId())) {
|
||||
return $this->getOption($this->getId());
|
||||
} else {
|
||||
return $this->file;
|
||||
}
|
||||
}
|
||||
|
||||
public function renderPdf($pdf)
|
||||
{
|
||||
|
||||
if( false && $this->getFile() != "") {
|
||||
$id = new ObjectId($this->getFile());
|
||||
|
||||
$render = true;
|
||||
/** @var \PSC\Shop\MediaBundle\Document\Media $imageObj */
|
||||
$imageObj = $this->getMongoDb()
|
||||
->getRepository('PSC\Shop\MediaBundle\Document\Media')
|
||||
->findOneBy(['_id' => new ObjectId($this->getFile())]);
|
||||
# Load the image
|
||||
$image = $pdf->load_image("auto", "/data/www/new/web/" . $imageObj->getUrl(), "");
|
||||
if ($image == 0) {
|
||||
echo("Error: " . $pdf->get_errmsg());
|
||||
exit(1);
|
||||
}
|
||||
$opt = "position={top left} boxsize={" . $this->getWidth()*$this->getScale() . " " . $this->getHeight()*$this->getScale() .
|
||||
"} fitmethod=meet";
|
||||
|
||||
|
||||
if($render) {
|
||||
$pdf->fit_image($image, $this->getX() * $this->getScale(),
|
||||
($this->getHeight() + $this->getY()) * $this->getScale(), $opt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getWidth()
|
||||
{
|
||||
return $this->width;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $width
|
||||
*/
|
||||
public function setWidth($width)
|
||||
{
|
||||
$this->width = $width;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getHeight()
|
||||
{
|
||||
return $this->height;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $height
|
||||
*/
|
||||
public function setHeight($height)
|
||||
{
|
||||
$this->height = $height;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $file
|
||||
* @return Image
|
||||
*/
|
||||
public function setFile($file)
|
||||
{
|
||||
$this->file = $file;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements;
|
||||
|
||||
|
||||
use MongoDB\BSON\ObjectId;
|
||||
|
||||
class Pdf extends Base
|
||||
{
|
||||
|
||||
private $file = "";
|
||||
|
||||
private $siteToRender = 1;
|
||||
|
||||
private $width = 0;
|
||||
|
||||
private $height = 0;
|
||||
|
||||
public function renderPdf($pdf)
|
||||
{
|
||||
/** @var \PSC\Shop\MediaBundle\Document\Media $media */
|
||||
$media = $this->getMongoDb()
|
||||
->getRepository('PSC\Shop\MediaBundle\Document\Media')
|
||||
->findOneBy(['_id' => new ObjectId($this->getFile())]);
|
||||
|
||||
$indoc = $pdf->open_pdi_document("/data/www/new/web" . $media->getUrl(), "");
|
||||
|
||||
$page = $pdf->open_pdi_page($indoc, $this->getSiteToRender(), "");
|
||||
if ($page == 0) {
|
||||
print("Error: " . $pdf->get_errmsg());
|
||||
die();
|
||||
}
|
||||
|
||||
$optlist = "boxsize {" . $this->getWidth()*$this->getScale() . " " . $this->getHeight()*$this->getScale() . "} fitmethod meet";
|
||||
|
||||
$pdf->fit_pdi_page($page, $this->getX()*$this->getScale(),
|
||||
($this->getSite()->getHeight()-$this->getY())*$this->getScale(), $optlist);
|
||||
|
||||
$pdf->close_pdi_page($page);
|
||||
|
||||
$pdf->close_pdi_document($indoc);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFile()
|
||||
{
|
||||
return $this->file;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $file
|
||||
*/
|
||||
public function setFile($file)
|
||||
{
|
||||
$this->file = $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getWidth()
|
||||
{
|
||||
return $this->width;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $width
|
||||
*/
|
||||
public function setWidth($width)
|
||||
{
|
||||
$this->width = $width;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getHeight()
|
||||
{
|
||||
return $this->height;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $height
|
||||
*/
|
||||
public function setHeight($height)
|
||||
{
|
||||
$this->height = $height;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getSiteToRender()
|
||||
{
|
||||
return $this->siteToRender;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $siteToRender
|
||||
*/
|
||||
public function setSiteToRender($siteToRender)
|
||||
{
|
||||
$this->siteToRender = $siteToRender;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,304 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements;
|
||||
|
||||
|
||||
use MongoDB\BSON\ObjectId;
|
||||
|
||||
class Text extends Base
|
||||
{
|
||||
|
||||
private $text = "";
|
||||
|
||||
private $fontSize = 14;
|
||||
|
||||
private $color = "black";
|
||||
|
||||
private $colorMode = "hex";
|
||||
|
||||
private $rotate = 0;
|
||||
|
||||
private $font = "";
|
||||
|
||||
private $showBorder = false;
|
||||
|
||||
private $width = 0;
|
||||
|
||||
private $height = 0;
|
||||
|
||||
private $fitMethod = "auto";
|
||||
|
||||
private $vAlign = "top";
|
||||
|
||||
private $hAlign = "left";
|
||||
|
||||
private $leading = "100%";
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
if ($this->hasOption($this->getId())) {
|
||||
return $this->getOption($this->getId());
|
||||
} else {
|
||||
return $this->text;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $text
|
||||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
$this->text = $text;
|
||||
}
|
||||
|
||||
public function renderPdf($pdf)
|
||||
{
|
||||
if($this->getFont()) {
|
||||
|
||||
/** @var \PSC\Shop\MediaBundle\Document\Media $media */
|
||||
$media = $this->getMongoDb()
|
||||
->getRepository('PSC\Shop\MediaBundle\Document\Media')
|
||||
->findOneBy(['_id' => new ObjectId($this->getFont())]);
|
||||
|
||||
$pdf->set_option("FontOutline={" . $this->getFont() . "=" . "/data/www/new/web" . $media->getUrl()."}");
|
||||
$font = $pdf->load_font($this->getFont(), "unicode", "embedding");
|
||||
}else{
|
||||
$font = $pdf->load_font("Arial", "unicode", "embedding");
|
||||
if ($font == 0) {
|
||||
echo("Error: " . $pdf->get_errmsg());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$pdf->setfont($font, $this->getFontSize() * $this->getScale());
|
||||
|
||||
$optList = "";
|
||||
if (strtolower($this->getColorMode()) == "cmyk") {
|
||||
$color = explode(" ", $this->getColor());
|
||||
$optList .= "fillcolor={cmyk " . $color[0]/100 . " " . $color[1]/100 . " " . $color[2]/100 . " " . $color[3]/100 . "} ";
|
||||
}elseif(strtolower($this->getColorMode()) == "rgb") {
|
||||
$optList .= "fillcolor={rgb " . $this->getColor() . "} ";
|
||||
}else {
|
||||
$optList .= "fillcolor=" . $this->getColor() . " ";
|
||||
}
|
||||
|
||||
if($this->rotate != 0) {
|
||||
$optList .= "rotate=". $this->rotate . " ";
|
||||
}
|
||||
|
||||
if($this->getWidth() != 0 && $this->getHeight() != 0) {
|
||||
$optList .= " boxsize={".($this->getWidth()*$this->getScale())." ".($this->getHeight()*$this->getScale())."} position={".$this->getHAlign()." ".$this->getVAlign()."} fitmethod=" . $this->getFitMethod();
|
||||
|
||||
if($this->isShowBorder()) {
|
||||
$optList .= " showborder";
|
||||
}
|
||||
}
|
||||
|
||||
$pdf->fit_textline($this->getText(), $this->getX()*$this->getScale(), ($this->getY()+$this->getHeight())*$this->getScale(), $optList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getFontSize()
|
||||
{
|
||||
return $this->fontSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $fontSize
|
||||
*/
|
||||
public function setFontSize($fontSize)
|
||||
{
|
||||
$this->fontSize = $fontSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getColorMode()
|
||||
{
|
||||
return $this->colorMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $colorMode
|
||||
*/
|
||||
public function setColorMode($colorMode)
|
||||
{
|
||||
$this->colorMode = $colorMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getColor()
|
||||
{
|
||||
return $this->color;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $color
|
||||
*/
|
||||
public function setColor($color)
|
||||
{
|
||||
$this->color = $color;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getRotate()
|
||||
{
|
||||
return $this->rotate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $rotate
|
||||
*/
|
||||
public function setRotate($rotate)
|
||||
{
|
||||
$this->rotate = $rotate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFont()
|
||||
{
|
||||
return $this->font;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $font
|
||||
*/
|
||||
public function setFont($font)
|
||||
{
|
||||
$this->font = $font;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isShowBorder()
|
||||
{
|
||||
return $this->showBorder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $showBorder
|
||||
*/
|
||||
public function setShowBorder($showBorder)
|
||||
{
|
||||
$this->showBorder = $showBorder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getWidth()
|
||||
{
|
||||
return $this->width;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $width
|
||||
*/
|
||||
public function setWidth($width)
|
||||
{
|
||||
$this->width = $width;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getHeight()
|
||||
{
|
||||
return $this->height;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $height
|
||||
*/
|
||||
public function setHeight($height)
|
||||
{
|
||||
$this->height = $height;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFitMethod()
|
||||
{
|
||||
return $this->fitMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fitMethod
|
||||
*/
|
||||
public function setFitMethod($fitMethod)
|
||||
{
|
||||
$this->fitMethod = $fitMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getHAlign()
|
||||
{
|
||||
return $this->hAlign;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $hAlign
|
||||
*/
|
||||
public function setHAlign($hAlign)
|
||||
{
|
||||
$this->hAlign = $hAlign;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getVAlign()
|
||||
{
|
||||
return $this->vAlign;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $vAlign
|
||||
*/
|
||||
public function setVAlign($vAlign)
|
||||
{
|
||||
$this->vAlign = $vAlign;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLeading()
|
||||
{
|
||||
return $this->leading;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $leading
|
||||
*/
|
||||
public function setLeading($leading)
|
||||
{
|
||||
$this->leading = $leading;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements;
|
||||
|
||||
use MongoDB\BSON\ObjectId;
|
||||
|
||||
class TextFlow extends Text
|
||||
{
|
||||
|
||||
|
||||
|
||||
public function renderPdf($pdf)
|
||||
{
|
||||
if($this->getFont()) {
|
||||
|
||||
/** @var \PSC\Shop\MediaBundle\Document\Media $media */
|
||||
$media = $this->getMongoDb()
|
||||
->getRepository('PSC\Shop\MediaBundle\Document\Media')
|
||||
->findOneBy(['_id' => new ObjectId($this->getFont())]);
|
||||
|
||||
$pdf->set_option("FontOutline={" . $this->getFont() . "=" . "/data/www/new/web" . $media->getUrl()."}");
|
||||
}else{
|
||||
$this->setFont("Helvetica");
|
||||
}
|
||||
|
||||
$optList = "";
|
||||
if (strtolower($this->getColorMode()) == "cmyk") {
|
||||
$color = explode(" ", $this->getColor());
|
||||
$optList .= "fillcolor={cmyk " . $color[0]/100 . " " . $color[1]/100 . " " . $color[2]/100 . " " . $color[3]/100 . "} ";
|
||||
}elseif(strtolower($this->getColorMode()) == "rgb") {
|
||||
$optList .= "fillcolor={rgb " . $this->getColor() . "} ";
|
||||
}else {
|
||||
$optList .= "fillcolor=" . $this->getColor() . " ";
|
||||
}
|
||||
|
||||
if($this->getRotate() != 0) {
|
||||
$optList .= "rotate=". $this->getRotate() . " ";
|
||||
}
|
||||
|
||||
$optList .= "leading=". $this->getLeading() . " ";
|
||||
|
||||
$optList .= " alignment=".$this->getHAlign()." encoding=unicode embedding fontname=" . $this->getFont() . " fontsize=" . ($this->getFontSize() * $this->getScale());
|
||||
|
||||
$tf = 0;
|
||||
$tf = $pdf->add_textflow($tf, $this->getText(), $optList);
|
||||
|
||||
|
||||
$optList = " verticalalign=".$this->getVAlign()." fitmethod=" . $this->getFitMethod();
|
||||
if($this->isShowBorder()) {
|
||||
$optList .= " showborder";
|
||||
}
|
||||
|
||||
$pdf->fit_textflow($tf, $this->getX()*$this->getScale(), ($this->getY())*$this->getScale(), ($this->getWidth()+$this->getX())*$this->getScale(), ($this->getY()+$this->getHeight())*$this->getScale(), $optList);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,180 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf;
|
||||
|
||||
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Base;
|
||||
|
||||
class Site {
|
||||
|
||||
private $id;
|
||||
|
||||
private $label = "";
|
||||
|
||||
private $width = 0;
|
||||
|
||||
private $height = 0;
|
||||
|
||||
private $trimLeft = 0;
|
||||
private $trimRight = 0;
|
||||
private $trimTop = 0;
|
||||
private $trimBottom = 0;
|
||||
|
||||
/** @var Base[] */
|
||||
private $elements = [];
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLabel()
|
||||
{
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $label
|
||||
*/
|
||||
public function setLabel($label)
|
||||
{
|
||||
$this->label = $label;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getWidth()
|
||||
{
|
||||
return $this->width;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $width
|
||||
*/
|
||||
public function setWidth($width)
|
||||
{
|
||||
$this->width = $width;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getHeight()
|
||||
{
|
||||
return $this->height;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $height
|
||||
*/
|
||||
public function setHeight($height)
|
||||
{
|
||||
$this->height = $height;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getTrimLeft()
|
||||
{
|
||||
return $this->trimLeft;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $trimLeft
|
||||
*/
|
||||
public function setTrimLeft($trimLeft)
|
||||
{
|
||||
$this->trimLeft = $trimLeft;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getTrimRight()
|
||||
{
|
||||
return $this->trimRight;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $trimRight
|
||||
*/
|
||||
public function setTrimRight($trimRight)
|
||||
{
|
||||
$this->trimRight = $trimRight;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getTrimTop()
|
||||
{
|
||||
return $this->trimTop;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $trimTop
|
||||
*/
|
||||
public function setTrimTop($trimTop)
|
||||
{
|
||||
$this->trimTop = $trimTop;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getTrimBottom()
|
||||
{
|
||||
return $this->trimBottom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $trimBottom
|
||||
*/
|
||||
public function setTrimBottom($trimBottom)
|
||||
{
|
||||
$this->trimBottom = $trimBottom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Base[]
|
||||
*/
|
||||
public function getElements()
|
||||
{
|
||||
return $this->elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Base[] $elements
|
||||
*/
|
||||
public function setElements($elements)
|
||||
{
|
||||
$this->elements = $elements;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps;
|
||||
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Base;
|
||||
|
||||
class Column {
|
||||
|
||||
/** @var Base[] */
|
||||
private $options;
|
||||
|
||||
/**
|
||||
* @return Base[]
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Base[] $options
|
||||
*/
|
||||
public function setOptions($options)
|
||||
{
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
public function addOption($option)
|
||||
{
|
||||
$this->options[] = $option;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options;
|
||||
|
||||
use PSC\Shop\MediaBundle\Service\MediaManager;
|
||||
use Symfony\Component\Form\FormBuilder;
|
||||
|
||||
abstract class Base {
|
||||
|
||||
private $id;
|
||||
|
||||
private $column = 1;
|
||||
|
||||
private $label = "";
|
||||
|
||||
private $required = false;
|
||||
|
||||
protected $inForm = false;
|
||||
|
||||
public function renderForm(FormBuilder $builder, MediaManager $mediaManager)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getColumn()
|
||||
{
|
||||
return $this->column;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $column
|
||||
*/
|
||||
public function setColumn($column)
|
||||
{
|
||||
$this->column = $column;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLabel()
|
||||
{
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $label
|
||||
*/
|
||||
public function setLabel($label)
|
||||
{
|
||||
$this->label = $label;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isInForm()
|
||||
{
|
||||
return $this->inForm;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $inForm
|
||||
*/
|
||||
public function setInForm($inForm)
|
||||
{
|
||||
$this->inForm = $inForm;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isRequired()
|
||||
{
|
||||
return $this->required;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $required
|
||||
*/
|
||||
public function setRequired($required)
|
||||
{
|
||||
$this->required = $required;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options;
|
||||
|
||||
use PSC\Shop\MediaBundle\Service\MediaManager;
|
||||
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||
use Symfony\Component\Form\FormBuilder;
|
||||
|
||||
class Image extends Base {
|
||||
|
||||
private $cropBox = false;
|
||||
|
||||
private $cropBoxAspectRatio = 0;
|
||||
|
||||
protected $inForm = true;
|
||||
|
||||
public function renderForm(FormBuilder $builder, MediaManager $mediaManager)
|
||||
{
|
||||
$builder->add($this->getId(), FileType::class, [
|
||||
'label' => $this->getLabel(),
|
||||
'required' => false
|
||||
]);
|
||||
$builder->add($this->getId() . '_original', HiddenType::class, [
|
||||
]);
|
||||
if($this->cropBox) {
|
||||
$builder->add($this->getId() . '_crop', HiddenType::class, [
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isCropBox()
|
||||
{
|
||||
return $this->cropBox;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $cropBox
|
||||
*/
|
||||
public function setCropBox($cropBox)
|
||||
{
|
||||
$this->cropBox = $cropBox;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getCropBoxAspectRatio()
|
||||
{
|
||||
return $this->cropBoxAspectRatio;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $cropBoxAspectRatio
|
||||
*/
|
||||
public function setCropBoxAspectRatio($cropBoxAspectRatio)
|
||||
{
|
||||
$this->cropBoxAspectRatio = $cropBoxAspectRatio;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options;
|
||||
|
||||
class Preview extends Base {
|
||||
|
||||
private $site = 1;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getSite()
|
||||
{
|
||||
return $this->site;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $site
|
||||
*/
|
||||
public function setSite($site)
|
||||
{
|
||||
$this->site = $site;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Select;
|
||||
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Base;
|
||||
use PSC\Shop\MediaBundle\Service\MediaManager;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilder;
|
||||
|
||||
class Media extends Base {
|
||||
|
||||
protected $inForm = true;
|
||||
|
||||
protected $options = [];
|
||||
|
||||
protected $choiceAttr = [];
|
||||
|
||||
/** @var MediaManager */
|
||||
protected $mediaManager;
|
||||
|
||||
public function renderForm(FormBuilder $builder, MediaManager $mediaManager)
|
||||
{
|
||||
|
||||
$this->mediaManager = $mediaManager;
|
||||
|
||||
$this->buildChoiceAttr();
|
||||
|
||||
$builder->add($this->getId(), ChoiceType::class, [
|
||||
'label' => $this->getLabel(),
|
||||
'required' => false,
|
||||
'choices' => $this->options,
|
||||
'choice_attr' => $this->choiceAttr
|
||||
]);
|
||||
}
|
||||
|
||||
public function addOption($id, $label)
|
||||
{
|
||||
$this->options[$label] = (string)$id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $options
|
||||
*/
|
||||
public function setOptions($options)
|
||||
{
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
private function buildChoiceAttr()
|
||||
{
|
||||
foreach($this->options as $name => $key) {
|
||||
$media = $this->mediaManager->getMedia($key);
|
||||
$this->choiceAttr[$name] = ['data-img-src' => $this->mediaManager->retrieveThumbnailPath($media)];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Select;
|
||||
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Base;
|
||||
use PSC\Shop\MediaBundle\Service\MediaManager;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilder;
|
||||
|
||||
class Simple extends Base {
|
||||
|
||||
protected $inForm = true;
|
||||
|
||||
protected $options = [];
|
||||
|
||||
public function renderForm(FormBuilder $builder, MediaManager $mediaManager)
|
||||
{
|
||||
$builder->add($this->getId(), ChoiceType::class, [
|
||||
'label' => $this->getLabel(),
|
||||
'required' => false,
|
||||
'choices' => $this->options
|
||||
]);
|
||||
}
|
||||
|
||||
public function addOption($id, $label)
|
||||
{
|
||||
$this->options[$label] = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $options
|
||||
*/
|
||||
public function setOptions($options)
|
||||
{
|
||||
$this->options = $options;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options;
|
||||
|
||||
use PSC\Shop\MediaBundle\Service\MediaManager;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilder;
|
||||
|
||||
class Text extends Base {
|
||||
|
||||
private $text = "";
|
||||
|
||||
protected $inForm = true;
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $text
|
||||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
$this->text = $text;
|
||||
}
|
||||
|
||||
public function renderForm(FormBuilder $builder, MediaManager $mediaManager)
|
||||
{
|
||||
|
||||
$builder->add($this->getId(), TextType::class, [
|
||||
'label' => $this->getLabel(),
|
||||
'data' => $this->getText(),
|
||||
'required' => $this->isRequired()
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options;
|
||||
|
||||
use PSC\Shop\MediaBundle\Service\MediaManager;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilder;
|
||||
|
||||
class Textarea extends Base {
|
||||
|
||||
private $text = "";
|
||||
|
||||
protected $inForm = true;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getText()
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $text
|
||||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
$this->text = $text;
|
||||
}
|
||||
|
||||
public function renderForm(FormBuilder $builder, MediaManager $mediaManager)
|
||||
{
|
||||
|
||||
$builder->add($this->getId(), TextareaType::class, [
|
||||
'label' => $this->getLabel(),
|
||||
'data' => $this->getText(),
|
||||
'attr' => [
|
||||
'rows' => 6
|
||||
],
|
||||
'required' => $this->isRequired()
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,169 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps;
|
||||
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Base;
|
||||
|
||||
class Step {
|
||||
|
||||
private $id;
|
||||
|
||||
private $name;
|
||||
|
||||
private $headline;
|
||||
|
||||
private $description;
|
||||
|
||||
private $first = false;
|
||||
|
||||
private $last = false;
|
||||
|
||||
/** @var Column[] */
|
||||
private $columns = [];
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $name
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getHeadline()
|
||||
{
|
||||
return $this->headline;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $headline
|
||||
*/
|
||||
public function setHeadline($headline)
|
||||
{
|
||||
$this->headline = $headline;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $description
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $id
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Column[]
|
||||
*/
|
||||
public function getColumns()
|
||||
{
|
||||
return $this->columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Column[] $columns
|
||||
*/
|
||||
public function setColumns($columns)
|
||||
{
|
||||
$this->columns = $columns;
|
||||
}
|
||||
|
||||
public function getColumn($pos)
|
||||
{
|
||||
if(!isset($this->columns[$pos])) {
|
||||
$this->columns[$pos] = new Column();
|
||||
}
|
||||
|
||||
return $this->columns[$pos];
|
||||
}
|
||||
|
||||
public function getOption($id)
|
||||
{
|
||||
foreach($this->columns as $columns) {
|
||||
foreach($columns->getOptions() as $option) {
|
||||
if($option->getId() == $id) return $option;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getColumnWidth()
|
||||
{
|
||||
return 12/count($this->columns);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isLast()
|
||||
{
|
||||
return $this->last;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $last
|
||||
*/
|
||||
public function setLast($last)
|
||||
{
|
||||
$this->last = $last;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isFirst()
|
||||
{
|
||||
return $this->first;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $first
|
||||
*/
|
||||
public function setFirst($first)
|
||||
{
|
||||
$this->first = $first;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Config;
|
||||
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Model\Config\Pdf;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Base;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Preview;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Text;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Textarea;
|
||||
|
||||
class Config {
|
||||
|
||||
|
||||
/**
|
||||
* @param \SimpleXMLElement $xml
|
||||
* @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Config
|
||||
*/
|
||||
public function parse($xml)
|
||||
{
|
||||
$config = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Config();
|
||||
|
||||
$config->setPdf(new Pdf());
|
||||
if($xml->unit) {
|
||||
$config->getPdf()->setUnit((string)$xml->unit);
|
||||
}
|
||||
if($xml->pdfPreviewButton) {
|
||||
$config->setPdfPreviewButton(boolval(intval($xml->pdfPreviewButton)));
|
||||
}
|
||||
if($xml->pdfPrintButton) {
|
||||
$config->setPdfPrintButton(boolval(intval($xml->pdfPrintButton)));
|
||||
}
|
||||
if($xml->pdfx4) {
|
||||
$config->getPdf()->setPdfx4(boolval(intval($xml->pdfx4)));
|
||||
$config->getPdf()->setIccProfile((string)$xml->iccProfile);
|
||||
}
|
||||
return $config;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options;
|
||||
|
||||
abstract class Base {
|
||||
|
||||
|
||||
/**
|
||||
* @param \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Base $element
|
||||
* @param \SimpleXMLElement $xml
|
||||
* @return mixed
|
||||
*/
|
||||
public function parseBase($element, $xml)
|
||||
{
|
||||
if(!isset($xml['id'])) {
|
||||
$element->setId(md5(rand()));
|
||||
}else{
|
||||
$element->setId((string)$xml['id']);
|
||||
}
|
||||
|
||||
if(isset($xml['column'])) {
|
||||
$element->setColumn(intval($xml['column']));
|
||||
}
|
||||
if(isset($xml['label'])) {
|
||||
$element->setLabel((string)$xml['label']);
|
||||
}
|
||||
|
||||
return $element;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options;
|
||||
|
||||
class Image extends Base {
|
||||
|
||||
|
||||
/**
|
||||
* @param \SimpleXMLElement $xml
|
||||
* @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Image
|
||||
*/
|
||||
public function parse($xml)
|
||||
{
|
||||
$image = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Image();
|
||||
|
||||
parent::parseBase($image, $xml);
|
||||
|
||||
if(isset($xml['cropBox'])) {
|
||||
$image->setCropBox(boolval($xml['cropBox']));
|
||||
}
|
||||
if(isset($xml['cropBoxAspectRatio'])) {
|
||||
$image->setCropBoxAspectRatio(floatval($xml['cropBoxAspectRatio']));
|
||||
}
|
||||
return $image;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options;
|
||||
|
||||
class Preview extends Base {
|
||||
|
||||
/**
|
||||
* @param \SimpleXMLElement $xml
|
||||
* @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Preview
|
||||
*/
|
||||
public function parse($xml)
|
||||
{
|
||||
$preview = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Preview();
|
||||
|
||||
parent::parseBase($preview, $xml);
|
||||
|
||||
if(isset($xml['site'])) {
|
||||
$preview->setSite(intval($xml['site']));
|
||||
}
|
||||
|
||||
return $preview;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Select;
|
||||
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Base;
|
||||
|
||||
class Media extends Base {
|
||||
|
||||
|
||||
/**
|
||||
* @param \SimpleXMLElement $xml
|
||||
* @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Select\Media
|
||||
*/
|
||||
public function parse($xml)
|
||||
{
|
||||
$select = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Select\Media();
|
||||
|
||||
parent::parseBase($select, $xml);
|
||||
|
||||
foreach($xml->option as $option) {
|
||||
$select->addOption((string)$option['id'], (string)$option);
|
||||
}
|
||||
|
||||
return $select;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Select;
|
||||
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Base;
|
||||
|
||||
class Simple extends Base {
|
||||
|
||||
|
||||
/**
|
||||
* @param \SimpleXMLElement $xml
|
||||
* @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Select\Simple
|
||||
*/
|
||||
public function parse($xml)
|
||||
{
|
||||
$select = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Select\Simple();
|
||||
|
||||
parent::parseBase($select, $xml);
|
||||
|
||||
foreach($xml->option as $option) {
|
||||
$select->addOption((string)$option['id'], (string)$option);
|
||||
}
|
||||
|
||||
return $select;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options;
|
||||
|
||||
class Text extends Base {
|
||||
|
||||
|
||||
/**
|
||||
* @param \SimpleXMLElement $xml
|
||||
* @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Text
|
||||
*/
|
||||
public function parse($xml)
|
||||
{
|
||||
$text = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Text();
|
||||
|
||||
parent::parseBase($text, $xml);
|
||||
|
||||
$text->setText((string)$xml);
|
||||
if(isset($xml['required'])) {
|
||||
$text->setRequired(boolval($xml['required']));
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options;
|
||||
|
||||
class Textarea extends Base {
|
||||
|
||||
/**
|
||||
* @param \SimpleXMLElement $xml
|
||||
* @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Textarea
|
||||
*/
|
||||
public function parse($xml)
|
||||
{
|
||||
$text = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Options\Textarea();
|
||||
|
||||
parent::parseBase($text, $xml);
|
||||
|
||||
$text->setText((string)$xml);
|
||||
if(isset($xml['required'])) {
|
||||
$text->setRequired(boolval($xml['required']));
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form;
|
||||
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Base;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Preview;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Text;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Image;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Textarea;
|
||||
|
||||
class Step {
|
||||
|
||||
|
||||
/**
|
||||
* @param \SimpleXMLElement $xml
|
||||
* @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Step
|
||||
*/
|
||||
public function parse($xml)
|
||||
{
|
||||
$step = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Step();
|
||||
$step->setId(intval($xml['id']));
|
||||
|
||||
if(isset($xml['label'])) {
|
||||
$step->setName((string)$xml['label']);
|
||||
}
|
||||
if(isset($xml->headline)) {
|
||||
$step->setHeadline((string)$xml->headline);
|
||||
}
|
||||
if(isset($xml->description)) {
|
||||
$step->setDescription((string)$xml->description);
|
||||
}
|
||||
|
||||
if($xml->elements->count()) {
|
||||
foreach($xml->elements->children() as $typeXml => $optionXml) {
|
||||
|
||||
$parser = new Text();
|
||||
if($typeXml == "textarea") {
|
||||
$parser = new Textarea();
|
||||
}
|
||||
if($typeXml == "preview") {
|
||||
$parser = new Preview();
|
||||
}
|
||||
if($typeXml == "image") {
|
||||
$parser = new Image();
|
||||
}
|
||||
if($typeXml == "select") {
|
||||
$parser = new \Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Select\Simple();
|
||||
}
|
||||
if($typeXml == "mediaSelect") {
|
||||
$parser = new \Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Options\Select\Media();
|
||||
}
|
||||
$option = $parser->parse($optionXml);
|
||||
|
||||
$step->getColumn($option->getColumn())->addOption($option);
|
||||
}
|
||||
}
|
||||
|
||||
return $step;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser;
|
||||
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Model\Config;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Site;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Form\Step;
|
||||
|
||||
class Parser
|
||||
{
|
||||
|
||||
/** @var \SimpleXMLElement */
|
||||
private $xml;
|
||||
|
||||
public function loadXml($xml)
|
||||
{
|
||||
$this->xml = simplexml_load_string($xml);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Config
|
||||
*/
|
||||
public function parseConfig()
|
||||
{
|
||||
$configParser = new \Plugin\Custom\PSC\LaufkartenLayouter\Parser\Config\Config();
|
||||
|
||||
$config = $configParser->parse($this->xml->general);
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Steps\Step[]
|
||||
*/
|
||||
public function parseStep()
|
||||
{
|
||||
|
||||
$steps = [];
|
||||
|
||||
$count = $this->xml->steps->children()->count();
|
||||
|
||||
if($count) {
|
||||
$stepParser = new Step();
|
||||
|
||||
$i = 0;
|
||||
|
||||
foreach($this->xml->steps->children() as $stepXml) {
|
||||
$step = $stepParser->parse($stepXml);
|
||||
|
||||
if($i == 0) {
|
||||
$step->setFirst(true);
|
||||
}
|
||||
if($i == $count-1) {
|
||||
$step->setLast(true);
|
||||
}
|
||||
|
||||
$steps[] = $step;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
return $steps;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Site[]
|
||||
*/
|
||||
public function parseSites()
|
||||
{
|
||||
|
||||
$sites = [];
|
||||
|
||||
$count = $this->xml->sites->children()->count();
|
||||
|
||||
if($count) {
|
||||
$siteParser = new \Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Site();
|
||||
|
||||
|
||||
foreach($this->xml->sites->children() as $siteXml) {
|
||||
$site = $siteParser->parse($siteXml);
|
||||
|
||||
$sites[] = $site;
|
||||
}
|
||||
}
|
||||
|
||||
return $sites;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements;
|
||||
|
||||
abstract class Base {
|
||||
|
||||
|
||||
/**
|
||||
* @param \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Base $element
|
||||
* @param \SimpleXMLElement $xml
|
||||
* @return mixed
|
||||
*/
|
||||
public function parseBase($element, $xml)
|
||||
{
|
||||
if(!isset($xml['id'])) {
|
||||
$element->setId(md5(rand()));
|
||||
}else{
|
||||
$element->setId((string)$xml['id']);
|
||||
}
|
||||
|
||||
if(isset($xml['x'])) {
|
||||
$element->setX(intval($xml['x']));
|
||||
}
|
||||
if(isset($xml['y'])) {
|
||||
$element->setY(intval($xml['y']));
|
||||
}
|
||||
if(isset($xml['preview'])) {
|
||||
$element->setPreview(boolval(intval($xml['preview'])));
|
||||
}
|
||||
if(isset($xml['print'])) {
|
||||
$element->setPrint(boolval(intval($xml['print'])));
|
||||
}
|
||||
|
||||
return $element;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements;
|
||||
|
||||
class Image extends Base {
|
||||
|
||||
|
||||
/**
|
||||
* @param \SimpleXMLElement $xml
|
||||
* @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Image
|
||||
*/
|
||||
public function parse($xml)
|
||||
{
|
||||
$image = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Image();
|
||||
|
||||
parent::parseBase($image, $xml);
|
||||
|
||||
$image->setFile((string)$xml);
|
||||
$image->setWidth(intval($xml['width']));
|
||||
$image->setHeight(intval($xml['height']));
|
||||
|
||||
if(isset($xml['border'])) {
|
||||
$image->setBorder($xml['border']);
|
||||
}
|
||||
|
||||
return $image;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements;
|
||||
|
||||
class Media extends Base {
|
||||
|
||||
|
||||
/**
|
||||
* @param \SimpleXMLElement $xml
|
||||
* @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Media
|
||||
*/
|
||||
public function parse($xml)
|
||||
{
|
||||
$image = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Media();
|
||||
|
||||
parent::parseBase($image, $xml);
|
||||
|
||||
$image->setFile((string)$xml);
|
||||
$image->setWidth(intval($xml['width']));
|
||||
$image->setHeight(intval($xml['height']));
|
||||
|
||||
if(isset($xml['border'])) {
|
||||
$image->setBorder($xml['border']);
|
||||
}
|
||||
|
||||
return $image;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements;
|
||||
|
||||
class Pdf extends Base {
|
||||
|
||||
|
||||
/**
|
||||
* @param \SimpleXMLElement $xml
|
||||
* @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Pdf
|
||||
*/
|
||||
public function parse($xml)
|
||||
{
|
||||
$pdf = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Pdf();
|
||||
|
||||
parent::parseBase($pdf, $xml);
|
||||
|
||||
$pdf->setFile((string)$xml);
|
||||
$pdf->setWidth(intval($xml['width']));
|
||||
$pdf->setHeight(intval($xml['height']));
|
||||
$pdf->setSiteToRender(intval($xml['site']));
|
||||
|
||||
|
||||
return $pdf;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements;
|
||||
|
||||
class Text extends Base {
|
||||
|
||||
|
||||
/**
|
||||
* @param \SimpleXMLElement $xml
|
||||
* @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Text
|
||||
*/
|
||||
public function parse($xml)
|
||||
{
|
||||
$text = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\Text();
|
||||
|
||||
parent::parseBase($text, $xml);
|
||||
|
||||
$text->setText((string)$xml);
|
||||
if(isset($xml['fontSize'])) {
|
||||
$text->setFontSize(intval($xml['fontSize']));
|
||||
}
|
||||
|
||||
if(isset($xml['color'])) {
|
||||
$text->setColor($xml['color']);
|
||||
}
|
||||
|
||||
if(isset($xml['colorMode'])) {
|
||||
$text->setColorMode($xml['colorMode']);
|
||||
}
|
||||
|
||||
if(isset($xml['rotate'])) {
|
||||
$text->setRotate(intval($xml['rotate']));
|
||||
}
|
||||
if(isset($xml['font'])) {
|
||||
$text->setFont((string)$xml['font']);
|
||||
}
|
||||
if(isset($xml['showBorder'])) {
|
||||
$text->setShowBorder(boolval($xml['showBorder']));
|
||||
}
|
||||
if(isset($xml['width'])) {
|
||||
$text->setWidth(intval($xml['width']));
|
||||
}
|
||||
if(isset($xml['height'])) {
|
||||
$text->setHeight(intval($xml['height']));
|
||||
}
|
||||
if(isset($xml['vAlign'])) {
|
||||
$text->setVAlign((string)$xml['vAlign']);
|
||||
}
|
||||
if(isset($xml['hAlign'])) {
|
||||
$text->setHAlign((string)$xml['hAlign']);
|
||||
}
|
||||
if(isset($xml['fitmethod'])) {
|
||||
$text->setFitMethod((string)$xml['fitmethod']);
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements;
|
||||
|
||||
class TextFlow extends Base {
|
||||
|
||||
|
||||
/**
|
||||
* @param \SimpleXMLElement $xml
|
||||
* @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\TextFlow
|
||||
*/
|
||||
public function parse($xml)
|
||||
{
|
||||
$text = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Elements\TextFlow();
|
||||
|
||||
parent::parseBase($text, $xml);
|
||||
|
||||
$text->setText((string)$xml);
|
||||
if(isset($xml['fontSize'])) {
|
||||
$text->setFontSize(intval($xml['fontSize']));
|
||||
}
|
||||
|
||||
if(isset($xml['color'])) {
|
||||
$text->setColor($xml['color']);
|
||||
}
|
||||
|
||||
if(isset($xml['colorMode'])) {
|
||||
$text->setColorMode($xml['colorMode']);
|
||||
}
|
||||
|
||||
if(isset($xml['rotate'])) {
|
||||
$text->setRotate(intval($xml['rotate']));
|
||||
}
|
||||
if(isset($xml['font'])) {
|
||||
$text->setFont((string)$xml['font']);
|
||||
}
|
||||
if(isset($xml['showBorder'])) {
|
||||
$text->setShowBorder(boolval($xml['showBorder']));
|
||||
}
|
||||
if(isset($xml['width'])) {
|
||||
$text->setWidth(intval($xml['width']));
|
||||
}
|
||||
if(isset($xml['height'])) {
|
||||
$text->setHeight(intval($xml['height']));
|
||||
}
|
||||
if(isset($xml['vAlign'])) {
|
||||
$text->setVAlign((string)$xml['vAlign']);
|
||||
}
|
||||
if(isset($xml['hAlign'])) {
|
||||
$text->setHAlign((string)$xml['hAlign']);
|
||||
}
|
||||
if(isset($xml['fitmethod'])) {
|
||||
$text->setFitMethod((string)$xml['fitmethod']);
|
||||
}
|
||||
if(isset($xml['leading'])) {
|
||||
$text->setLeading((string)$xml['leading']);
|
||||
}
|
||||
|
||||
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf;
|
||||
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements\Image;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements\Media;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements\Motiv;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements\Pdf;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements\Text;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Parser\Pdf\Elements\TextFlow;
|
||||
|
||||
class Site {
|
||||
|
||||
|
||||
/**
|
||||
* @param \SimpleXMLElement $xml
|
||||
* @return \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Site
|
||||
*/
|
||||
public function parse($xml)
|
||||
{
|
||||
$site = new \Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Site();
|
||||
$site->setId(intval($xml['id']));
|
||||
$site->setWidth(intval($xml['width']));
|
||||
$site->setHeight(intval($xml['height']));
|
||||
|
||||
if(isset($xml['trimLeft'])) {
|
||||
$site->setTrimLeft(intval($xml['trimLeft']));
|
||||
}
|
||||
if(isset($xml['trimRight'])) {
|
||||
$site->setTrimRight(intval($xml['trimRight']));
|
||||
}
|
||||
if(isset($xml['trimTop'])) {
|
||||
$site->setTrimTop(intval($xml['trimTop']));
|
||||
}
|
||||
if(isset($xml['trimBottom'])) {
|
||||
$site->setTrimBottom(intval($xml['trimBottom']));
|
||||
}
|
||||
|
||||
if(isset($xml['label'])) {
|
||||
$site->setLabel((string)$xml['label']);
|
||||
}
|
||||
|
||||
if(isset($xml->elements) && $xml->elements->children()->count()) {
|
||||
$elements = [];
|
||||
foreach($xml->elements->children() as $type => $xmlElement) {
|
||||
$parser = new Text();
|
||||
if(strtolower($type) == "pdf") {
|
||||
$parser= new Pdf();
|
||||
}
|
||||
if(strtolower($type) == "image") {
|
||||
$parser= new Image();
|
||||
}
|
||||
if(strtolower($type) == "media") {
|
||||
$parser= new Media();
|
||||
}
|
||||
if(strtolower($type) == "textflow") {
|
||||
$parser= new TextFlow();
|
||||
}
|
||||
$elements[] = $parser->parse($xmlElement);
|
||||
|
||||
}
|
||||
$site->setElements($elements);
|
||||
}
|
||||
|
||||
return $site;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
26
src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Plugin.php
Normal file
26
src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Plugin.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter;
|
||||
|
||||
use PSC\System\PluginBundle\Plugin\Base;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
class Plugin extends Base implements \PSC\System\PluginBundle\Interfaces\Plugin
|
||||
{
|
||||
protected $name = 'LaufkartenLayouter';
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return Plugin::Frontend;
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return 'LaufkartenLayouter';
|
||||
}
|
||||
|
||||
public function getVersion()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,239 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PrintshopCreator Suite
|
||||
*
|
||||
* PHP Version 5.3
|
||||
*
|
||||
* @author Thomas Peterson <info@thomas-peterson.de>
|
||||
* @copyright 2012-2013 PrintshopCreator GmbH
|
||||
* @license Private
|
||||
* @link http://www.printshopcreator.de
|
||||
*/
|
||||
namespace Plugin\Custom\PSC\LaufkartenLayouter\Renderer;
|
||||
|
||||
use Doctrine\ODM\MongoDB\DocumentManager;
|
||||
use MongoDB\BSON\ObjectId;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Model\Config;
|
||||
use Plugin\Custom\PSC\LaufkartenLayouter\Model\Pdf\Site;
|
||||
use PSC\Shop\MediaBundle\Document\Media;
|
||||
|
||||
class Pdf
|
||||
{
|
||||
/** @var Site */
|
||||
private $site;
|
||||
|
||||
/** @var Config */
|
||||
private $config;
|
||||
|
||||
private $pdflibLic;
|
||||
|
||||
private $options;
|
||||
|
||||
function __construct(DocumentManager $mongoDb, $pdflib_lic)
|
||||
{
|
||||
$this->mongoDb = $mongoDb;
|
||||
$this->pdflibLic = $pdflib_lic;
|
||||
}
|
||||
|
||||
public function setSite($site)
|
||||
{
|
||||
$this->site = $site;
|
||||
}
|
||||
|
||||
public function renderStep($filename)
|
||||
{
|
||||
$p = new \PDFlib();
|
||||
$p->set_option('errorpolicy=return');
|
||||
$p->set_option('stringformat=utf8');
|
||||
$p->set_parameter('license', $this->pdflibLic);
|
||||
if ($p->begin_document($filename, '') == 0) {
|
||||
die('Error: ' . $p->get_errmsg());
|
||||
}
|
||||
|
||||
$p->set_option('topdown=true');
|
||||
$p->set_option('usercoordinates=true');
|
||||
|
||||
$scale = 1;
|
||||
if (strtolower($this->config->getPdf()->getUnit()) == 'mm') {
|
||||
$scale = 2.83465;
|
||||
} elseif (strtolower($this->config->getPdf()->getUnit()) == 'cm') {
|
||||
$scale = 28.3465;
|
||||
}
|
||||
|
||||
$p->begin_page_ext(
|
||||
0,
|
||||
0,
|
||||
'width=' .
|
||||
(($this->site->getWidth() + $this->site->getTrimLeft() + $this->site->getTrimRight()) * $scale) .
|
||||
' height=' .
|
||||
(($this->site->getHeight() + $this->site->getTrimTop() + $this->site->getTrimBottom()) * $scale) .
|
||||
' trimbox={' .
|
||||
($this->site->getTrimLeft() * $scale) .
|
||||
' ' .
|
||||
($this->site->getTrimTop() * $scale) .
|
||||
' ' .
|
||||
(($this->site->getWidth() + $this->site->getTrimLeft()) * $scale) .
|
||||
' ' .
|
||||
(($this->site->getHeight() + $this->site->getTrimTop()) * $scale) .
|
||||
'}',
|
||||
);
|
||||
|
||||
foreach ($this->site->getElements() as $element) {
|
||||
$element->setScale($scale);
|
||||
$element->setOptions($this->options);
|
||||
$element->setMongoDb($this->mongoDb);
|
||||
$element->setSite($this->site);
|
||||
$element->renderPdf($p);
|
||||
}
|
||||
|
||||
$p->end_page_ext('');
|
||||
|
||||
$p->end_document('');
|
||||
}
|
||||
|
||||
public function renderPreviewPdf($sites, $filename)
|
||||
{
|
||||
$p = new \PDFlib();
|
||||
$p->set_option('errorpolicy=return');
|
||||
$p->set_option('stringformat=utf8');
|
||||
$p->set_parameter('license', $this->pdflibLic);
|
||||
if ($p->begin_document($filename, '') == 0) {
|
||||
die('Error: ' . $p->get_errmsg());
|
||||
}
|
||||
|
||||
$p->set_option('topdown=true');
|
||||
$p->set_option('usercoordinates=true');
|
||||
|
||||
$scale = 1;
|
||||
if (strtolower($this->config->getPdf()->getUnit()) == 'mm') {
|
||||
$scale = 2.83465;
|
||||
} elseif (strtolower($this->config->getPdf()->getUnit()) == 'cm') {
|
||||
$scale = 28.3465;
|
||||
}
|
||||
|
||||
foreach ($sites as $site) {
|
||||
$p->begin_page_ext(
|
||||
0,
|
||||
0,
|
||||
'width=' .
|
||||
(($site->getWidth() + $site->getTrimLeft() + $site->getTrimRight()) * $scale) .
|
||||
' height=' .
|
||||
(($site->getHeight() + $site->getTrimTop() + $site->getTrimBottom()) * $scale) .
|
||||
' trimbox={' .
|
||||
($site->getTrimLeft() * $scale) .
|
||||
' ' .
|
||||
($site->getTrimTop() * $scale) .
|
||||
' ' .
|
||||
(($site->getWidth() + $site->getTrimLeft()) * $scale) .
|
||||
' ' .
|
||||
(($site->getHeight() + $site->getTrimTop()) * $scale) .
|
||||
'}',
|
||||
);
|
||||
|
||||
foreach ($site->getElements() as $element) {
|
||||
if (!$element->isPreview())
|
||||
continue;
|
||||
$element->setScale($scale);
|
||||
$element->setOptions($this->options);
|
||||
$element->setMongoDb($this->mongoDb);
|
||||
$element->setSite($site);
|
||||
$element->renderPdf($p);
|
||||
}
|
||||
|
||||
$p->end_page_ext('');
|
||||
}
|
||||
|
||||
$p->end_document('');
|
||||
}
|
||||
|
||||
public function renderPrintPdf($sites, $filename)
|
||||
{
|
||||
$p = new \PDFlib();
|
||||
$p->set_option('errorpolicy=return');
|
||||
$p->set_option('stringformat=utf8');
|
||||
$p->set_parameter('license', $this->pdflibLic);
|
||||
$p->set_info('Creator', 'PSC');
|
||||
$p->set_info('Title', 'PDFX4');
|
||||
|
||||
if ($this->config->getPdf()->isPdfx4()) {
|
||||
if ($p->begin_document($filename, 'pdfx=PDF/X-4') == 0) {
|
||||
die('Error: ' . $p->get_errmsg());
|
||||
}
|
||||
|
||||
/** @var Media $media */
|
||||
$media = $this->mongoDb
|
||||
->getRepository('PSC\Shop\MediaBundle\Document\Media')
|
||||
->findOneBy(['_id' => new ObjectId($this->config->getPdf()->getIccProfile())]);
|
||||
|
||||
if ($p->load_iccprofile('/data/www/new/web' . $media->getUrl(), 'usage=outputintent') == 0) {
|
||||
print 'Error: ' . $p->get_errmsg() . "\n";
|
||||
print "See www.pdflib.com for output intent ICC profiles.\n";
|
||||
$p->delete();
|
||||
return 2;
|
||||
}
|
||||
} else {
|
||||
if ($p->begin_document($filename, '') == 0) {
|
||||
die('Error: ' . $p->get_errmsg());
|
||||
}
|
||||
}
|
||||
|
||||
$p->set_option('topdown=true');
|
||||
$p->set_option('usercoordinates=true');
|
||||
|
||||
$scale = 1;
|
||||
if (strtolower($this->config->getPdf()->getUnit()) == 'mm') {
|
||||
$scale = 2.83465;
|
||||
} elseif (strtolower($this->config->getPdf()->getUnit()) == 'cm') {
|
||||
$scale = 28.3465;
|
||||
}
|
||||
|
||||
foreach ($sites as $site) {
|
||||
$p->begin_page_ext(
|
||||
0,
|
||||
0,
|
||||
'width=' .
|
||||
(($site->getWidth() + $site->getTrimLeft() + $site->getTrimRight()) * $scale) .
|
||||
' height=' .
|
||||
(($site->getHeight() + $site->getTrimTop() + $site->getTrimBottom()) * $scale) .
|
||||
' trimbox={' .
|
||||
($site->getTrimLeft() * $scale) .
|
||||
' ' .
|
||||
($site->getTrimTop() * $scale) .
|
||||
' ' .
|
||||
(($site->getWidth() + $site->getTrimLeft()) * $scale) .
|
||||
' ' .
|
||||
(($site->getHeight() + $site->getTrimTop()) * $scale) .
|
||||
'}',
|
||||
);
|
||||
|
||||
foreach ($site->getElements() as $element) {
|
||||
if (!$element->isPrint())
|
||||
continue;
|
||||
$element->setScale($scale);
|
||||
$element->setOptions($this->options);
|
||||
$element->setMongoDb($this->mongoDb);
|
||||
$element->setSite($site);
|
||||
$element->renderPdf($p);
|
||||
}
|
||||
|
||||
$p->end_page_ext('');
|
||||
}
|
||||
|
||||
$p->end_document('');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Config $config
|
||||
*/
|
||||
public function setConfig($config)
|
||||
{
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
public function setOptions(array $options)
|
||||
{
|
||||
$this->options = $options;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
|
||||
@ -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" }
|
||||
@ -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; }
|
||||
1
src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/public/js/image-picker.min.js
vendored
Normal file
1
src/new/var/plugins/Custom/PSC/LaufkartenLayouter/Resources/public/js/image-picker.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,60 @@
|
||||
{% extends 'backend_base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
<div class="header">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-8 col-md-8 col-lg-8">
|
||||
<h3>
|
||||
<i class="fa-fw fa fa-tags"></i>
|
||||
Step Layouter <span>>
|
||||
XML Bearbeiten </span>
|
||||
<a target="_blank" href="/article/show/uuid/{{ product.uuid }}">Anzeigen</a>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4 text-end">
|
||||
<a href="{{ path("backend_production_product_edit", {uuid: product.uuid}) }}" class="btn btn-default btn-sm"><i class="fa fa-lg fa-fw fa-arrow-left"></i> Zurück</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="body">
|
||||
<div class="panel">
|
||||
<div class="header">
|
||||
<h5>{{ product.title }}</h5>
|
||||
</div>
|
||||
<div class="body">
|
||||
|
||||
{{ form_start(form, { 'attr': {'class': 'smart-form'}}) }}
|
||||
{{ form_errors(form) }}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group row">
|
||||
<label class="col-md-2 form-control-label">{{ form_label(form.uuid) }}</label>
|
||||
<div class="col-md-10 state-disabled">
|
||||
{{ form_widget(form.uuid) }}
|
||||
<b class="tooltip tooltip-top-left">
|
||||
<i class="fa fa-warning txt-color-teal"></i>
|
||||
UUID des Produktes</b>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{{ form_widget(form.xml) }}
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="form-group row">
|
||||
<div class="col-md-offset-1 col-md-11">
|
||||
{{ form_widget(form.save, {attr: {class: 'btn btn-primary btn-sm'}}) }}
|
||||
</div>
|
||||
</div>
|
||||
{{ form_end(form) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ summernote_mediabundle_init() }}
|
||||
|
||||
{% endblock %}
|
||||
@ -0,0 +1,455 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Online Designer</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="//stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"/>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
|
||||
<script src="//stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
||||
<link rel="stylesheet" href="//use.fontawesome.com/releases/v5.8.2/css/all.css" integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous"/>
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/cropperjs/2.0.0-alpha/cropper.min.css" integrity="sha256-P3GPrL4qSoDfvjwrQee9CApBwzlUXpOE4MNyFTrQiKU=" crossorigin="anonymous" />
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/cropperjs/2.0.0-alpha/cropper.min.js" integrity="sha256-3u0hqeyvmSo3mQEnK2ESrO8ULud8RguKtlZGf2nNoyw=" crossorigin="anonymous"></script>
|
||||
<link rel="stylesheet" href="{{ asset('bundles/pluginsystempsclaufkartenlayouter/css/image-picker.css') }}"/>
|
||||
<script src="{{ asset('bundles/pluginsystempsclaufkartenlayouter/js/image-picker.min.js') }}"></script>
|
||||
|
||||
<style type="text/css">
|
||||
.bd-example-modal-lg .modal-dialog{
|
||||
display: table;
|
||||
position: relative;
|
||||
margin: 0 auto;
|
||||
top: calc(50% - 24px);
|
||||
}
|
||||
|
||||
.bd-example-modal-lg .modal-dialog .modal-content{
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body style="padding-top: 5px">
|
||||
{{ header|raw }}
|
||||
{#% include '/data/www/old/application/design/vorlagen/' ~ layout ~ '/laufkarten_layouter/header.html.twig' %#}
|
||||
<script>
|
||||
var previews = [];
|
||||
var options = [];
|
||||
var images = [];
|
||||
var crop = [];
|
||||
var mediaSelect = [];
|
||||
</script>
|
||||
{{ form_start(form) }}
|
||||
<input type="hidden" value="{{ step.id }}" name="actStep"/>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-3">{% if not step.first %}<button type="submit" name="prev" class="btn btn-sm btn-info">Zurück</button>{% endif %}</div>
|
||||
<div class="col-md-6 text-center"><h2>{{ step.headline }}</h2></div>
|
||||
<div class="col-md-3 text-end">
|
||||
{% if config.pdfPreviewButton %}<a href="{{ path("psc_plugin_laufkartenlayouter_pdf_preview", {productId: product.uuid}) }}" target="_blank" class="btn btn-sm btn-info">PDF Vorschau</a>{% endif %}
|
||||
{% if config.pdfPrintButton %}<a href="{{ path("psc_plugin_laufkartenlayouter_pdf_print", {productId: product.uuid}) }}" class="btn btn-sm btn-info">PDF Print</a>{% endif %}
|
||||
{% if not step.last %}<button type="submit" name="next" class="btn btn-sm btn-success">Weiter</button>{% endif %}
|
||||
{% if step.last %}<button type="button" id="finish" name="finish" class="btn btn-sm btn-success">Speichern und weiter</button>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
{% for col in step.columns %}
|
||||
<div class="col-md-{{ step.columnWidth }}">
|
||||
{% for option in col.options %}
|
||||
{% if option.inForm %}
|
||||
{% if option is instanceof("\\Plugin\\System\\PSC\\LaufkartenLayouter\\Model\\Steps\\Options\\Image") %}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group row">
|
||||
{{ form_label(attribute(form, option.id)) }}
|
||||
<div class="col-md-8">
|
||||
{{ form_widget(attribute(form, option.id)) }}
|
||||
</div>
|
||||
{{ form_errors(attribute(form, option.id)) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8 offset-4">
|
||||
<div class="progress progress_{{ option.id }}" style="display:none">
|
||||
<div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row cropper_tools_{{ option.id }}" style="display:none; margin-bottom: 5px">
|
||||
<div class="col-8 offset-4">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary" data-method="setDragMode" data-option="move" title="Move" onclick="moveMode('{{ option.id }}')">
|
||||
<span class="fa fa-arrows-alt"></span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" data-method="setDragMode" data-option="crop" title="Crop" onclick="cropMode('{{ option.id }}')">
|
||||
<span class="fa fa-crop-alt"></span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary" data-method="rotate" data-option="-45" title="Rotate Left" onclick="rotate('{{ option.id }}', -90)">
|
||||
<span class="fa fa-undo-alt"></span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" data-method="rotate" data-option="45" title="Rotate Right" onclick="rotate('{{ option.id }}', 90)">
|
||||
<span class="fa fa-redo-alt"></span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-primary" data-method="rotate" data-option="45" title="Remove" onclick="remove('{{ option.id }}', 90)">
|
||||
<span class="fa fa-trash"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8 offset-4">
|
||||
<div id="image_holder_{{ option.id }}"></div>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group row">
|
||||
{{ form_label(attribute(form, option.id)) }}
|
||||
<div class="col-md-8">
|
||||
{{ form_widget(attribute(form, option.id)) }}
|
||||
</div>
|
||||
{{ form_errors(attribute(form, option.id)) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<script>
|
||||
{% if option is instanceof("\\Plugin\\System\\PSC\\LaufkartenLayouter\\Model\\Steps\\Options\\Image") %}
|
||||
options.push("{{ option.id }}_original");
|
||||
images.push("{{ option.id }}");
|
||||
{% if option.cropBox %}
|
||||
options.push("{{ option.id }}_crop");
|
||||
crop.push({ id: '{{ option.id }}', aspectRatio: {{ step.getOption(option.id).cropBoxAspectRatio }} });
|
||||
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if option is instanceof("\\Plugin\\System\\PSC\\LaufkartenLayouter\\Model\\Steps\\Options\\Select\\Media") %}
|
||||
mediaSelect.push("{{ option.id }}");
|
||||
{% endif %}
|
||||
|
||||
options.push("{{ option.id }}");
|
||||
{% endif %}
|
||||
</script>
|
||||
{% else %}
|
||||
{% if option is instanceof("\\Plugin\\System\\PSC\\LaufkartenLayouter\\Model\\Steps\\Options\\Preview") %}
|
||||
<div class="preview" id="{{ option.id }}" data-site="{{ option.site }}"><img/></div>
|
||||
<script>
|
||||
previews.push("{{ option.id }}");
|
||||
</script>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{{ form_end(form) }}
|
||||
<script>
|
||||
var croppers = [];
|
||||
|
||||
function delay(fn, ms) {
|
||||
let timer = 0
|
||||
return function(...args) {
|
||||
clearTimeout(timer)
|
||||
timer = setTimeout(fn.bind(this, ...args), ms || 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function loadOnlyPdfPreviews() {
|
||||
$('.loadingWindow').modal('show');
|
||||
var o = new Object();
|
||||
$(options).each(function(index, item) {
|
||||
var element = $('#form_designer_' + item);
|
||||
o[item] = element.val();
|
||||
});
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: '/apps/api/laufkartenlayouter/designer/update/{{ product.uuid }}',
|
||||
type: 'POST',
|
||||
data: JSON.stringify(o),
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
dataType: 'json',
|
||||
async: false,
|
||||
success: function(msg) {
|
||||
|
||||
$(previews).each(function(index, item) {
|
||||
var element = $('#' + item);
|
||||
var img = $('#' + item + " img");
|
||||
img.unbind();
|
||||
img.on("load", function() {
|
||||
$('.loadingWindow').modal('hide');
|
||||
}).attr("src", '/apps/api/laufkartenlayouter/preview/image/{{ product.uuid }}/' + element.data("site") + '/' + element.width() +'?ts=' + Math.random());
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadPreviews(cropper = false) {
|
||||
$('.loadingWindow').modal('show');
|
||||
var o = new Object();
|
||||
$(options).each(function(index, item) {
|
||||
var element = $('#form_designer_' + item);
|
||||
o[item] = element.val();
|
||||
});
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: '/apps/api/laufkartenlayouter/designer/update/{{ product.uuid }}',
|
||||
type: 'POST',
|
||||
data: JSON.stringify(o),
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
dataType: 'json',
|
||||
async: false,
|
||||
success: function(msg) {
|
||||
|
||||
$(previews).each(function(index, item) {
|
||||
var element = $('#' + item);
|
||||
var img = $('#' + item + " img");
|
||||
|
||||
img.unbind();
|
||||
img.on("load", function() {
|
||||
$('.loadingWindow').modal('hide');
|
||||
}).attr("src", '/apps/api/laufkartenlayouter/preview/image/{{ product.uuid }}/' + element.data("site") + '/' + element.width() +'?ts=' + Math.random());
|
||||
});
|
||||
|
||||
$(images).each(function(index, item) {
|
||||
var element = $('#image_holder_' + item);
|
||||
if($('#form_designer_' + item + '_original').val() != "") {
|
||||
$(element).html('<img id="image_' + item + '" src="/apps/api/laufkartenlayouter/image/original/' + $('#form_designer_' + item + '_original').val() + '/' + element.width() + '?ts=' + Math.random() + '" />');
|
||||
if(cropper) {
|
||||
loadCropper();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function loadCropper() {
|
||||
$(crop).each(function(index, item) {
|
||||
if($('#form_designer_' + item.id + '_original').val() != "") {
|
||||
$.getJSON('/apps/api/laufkartenlayouter/image/info/' + $('#form_designer_' + item.id + '_original').val(), {}, function(result) {
|
||||
$('#form_designer_' + item.id + '_original').val();
|
||||
|
||||
var image = document.querySelector('#image_' + item.id);
|
||||
image.addEventListener('ready', function () {
|
||||
imageData = cropper.getImageData();
|
||||
cropper.setData({
|
||||
x: imageData.width/100*result.cropBox.x,
|
||||
y: imageData.height/100*result.cropBox.y,
|
||||
width: imageData.width/100*result.cropBox.width,
|
||||
height: imageData.height/100*result.cropBox.height
|
||||
});
|
||||
croppers[item.id] = cropper;
|
||||
});
|
||||
|
||||
var cropper = new Cropper(image, {
|
||||
movable: true,
|
||||
zoomable: true,
|
||||
rotatable: true,
|
||||
scalable: false,
|
||||
aspectRatio: item.aspectRatio
|
||||
});
|
||||
|
||||
$('.cropper_tools_' + item.id).show();
|
||||
|
||||
image.addEventListener('cropend', (event) => {
|
||||
|
||||
cropData = cropper.getData();
|
||||
imageData = cropper.getImageData();
|
||||
canvasData = cropper.getImageData();
|
||||
|
||||
ratio = canvasData.width / canvasData.naturalWidth;
|
||||
|
||||
x = Math.round(100 / ((imageData.width / cropData.x))*ratio);
|
||||
|
||||
y = Math.round(100 / (imageData.height / cropData.y)*ratio);
|
||||
width = Math.round(100 / (imageData.width / cropData.width)*ratio);
|
||||
height = Math.round(100 / (imageData.height / cropData.height)*ratio);
|
||||
|
||||
var data = new FormData();
|
||||
|
||||
data.append('x', x);
|
||||
data.append('y', y);
|
||||
data.append('width', width);
|
||||
data.append('height', height);
|
||||
|
||||
option = $(this).attr("id");
|
||||
|
||||
$.ajax({
|
||||
url: "/apps/api/laufkartenlayouter/upload/cropbox/" + $('#form_designer_' + item.id + '_original').val(),
|
||||
type: "POST",
|
||||
data: data,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
loadOnlyPdfPreviews();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function moveMode(id) {
|
||||
croppers[id].setDragMode("move");
|
||||
}
|
||||
|
||||
function cropMode(id) {
|
||||
croppers[id].setDragMode("crop");
|
||||
}
|
||||
|
||||
function remove(id) {
|
||||
$('#form_designer_' + id + '_original').val("");
|
||||
$('.cropper_tools_' + id).hide();
|
||||
$('#image_holder_' + id).html("");
|
||||
loadOnlyPdfPreviews();
|
||||
}
|
||||
|
||||
function rotate(id, value) {
|
||||
croppers[id].rotate(value);
|
||||
cropData = croppers[id].getData();
|
||||
|
||||
var data = new FormData();
|
||||
data.append('rotate', value);
|
||||
|
||||
$.ajax({
|
||||
url: "/apps/api/laufkartenlayouter/upload/rotate/" + $('#form_designer_' + id + '_original').val(),
|
||||
type: "POST",
|
||||
data: data,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
loadOnlyPdfPreviews();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(function() {
|
||||
loadPreviews();
|
||||
|
||||
var firstStart = {{ firstStart }};
|
||||
|
||||
$(options).each(function(index, item) {
|
||||
$("#form_designer_" + item).change(delay(function() {
|
||||
loadOnlyPdfPreviews();
|
||||
}, 2000));
|
||||
});
|
||||
|
||||
$(mediaSelect).each(function(index, item) {
|
||||
$("#form_designer_" + item).imagepicker();
|
||||
});
|
||||
|
||||
$(window).resize(delay(function() {
|
||||
loadOnlyPdfPreviews();
|
||||
}, 2000));
|
||||
|
||||
$('#finish').click(function() {
|
||||
|
||||
if(firstStart == 1) {
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '/apps/api/laufkartenlayouter/store/update',
|
||||
data: {
|
||||
layouter: '{{ layouterId }}',
|
||||
article: '{{ product.uuid }}'
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (result_save) {
|
||||
window.parent.document.location.href = "/article/show/uuid/{{ product.uuid }}/{{ layouterId }}";
|
||||
}
|
||||
});
|
||||
}else {
|
||||
var data = $.param({uuid: '{{ product.uuid }}', modus: 10});
|
||||
return $.ajax({
|
||||
method: 'POST',
|
||||
url: '/service/steplayouter/savenewlayouter/format/json',
|
||||
data: data,
|
||||
dataType: "json",
|
||||
success: function (result) {
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '/apps/api/laufkartenlayouter/store/save',
|
||||
data: {
|
||||
layouter: result.layouter,
|
||||
article: result.article
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (result_save) {
|
||||
window.parent.document.location.href = "/article/show/uuid/{{ product.uuid }}/" + result.layouter;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('input[type="file"]').change(function() {
|
||||
var data = new FormData();
|
||||
|
||||
data.append('parameter', 'wert');
|
||||
data.append('file', this.files[0]);
|
||||
|
||||
option = $(this).attr("id");
|
||||
|
||||
$('.progress_' + option).show();
|
||||
|
||||
$.ajax({
|
||||
url: "/apps/api/laufkartenlayouter/upload/single",
|
||||
type: "POST",
|
||||
data: data,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
dataType: "json",
|
||||
xhr: function(){
|
||||
var xhr = $.ajaxSettings.xhr() ;
|
||||
xhr.upload.onprogress = function(evt){ prozent = (evt.loaded/evt.total*100); $('.progress_' + option + ' > div').width = prozent; } ;
|
||||
xhr.upload.onload = function(){ } ;
|
||||
return xhr ;
|
||||
},
|
||||
success: function(response) {
|
||||
$('#' + option).val("");
|
||||
|
||||
$('#' + option + '_original').val(response.id);
|
||||
|
||||
loadPreviews(true);
|
||||
$('.progress_' + option).hide();
|
||||
},
|
||||
error: function() { console.log("General error occured", "e"); },
|
||||
complete: function() {
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
loadCropper();
|
||||
})
|
||||
</script>
|
||||
<div class="loadingWindow modal bd-example-modal-lg" data-backdrop="static" data-keyboard="false" tabindex="-1">
|
||||
<div class="modal-dialog modal-sm">
|
||||
<div class="modal-content" style="width: 48px">
|
||||
<span class="fa fa-spinner fa-spin fa-3x"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ footer|raw }}
|
||||
</body>
|
||||
</html>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user