Merge branch 'master' into frontend
This commit is contained in:
@@ -11,12 +11,10 @@ define('THELIA_CONF_DIR' , THELIA_LOCAL_DIR . 'config/');
|
||||
define('THELIA_MODULE_DIR' , THELIA_LOCAL_DIR . 'modules/');
|
||||
define('THELIA_WEB_DIR' , THELIA_ROOT . 'web/');
|
||||
define('THELIA_TEMPLATE_DIR' , THELIA_ROOT . 'templates/');
|
||||
define('DS', DIRECTORY_SEPARATOR);
|
||||
define('DS' , DIRECTORY_SEPARATOR);
|
||||
|
||||
$loader = require __DIR__ . "/vendor/autoload.php";
|
||||
|
||||
|
||||
|
||||
if (!file_exists(THELIA_ROOT . '/local/config/database.yml') && !defined('THELIA_INSTALL_MODE')) {
|
||||
$request = \Thelia\Core\HttpFoundation\Request::createFromGlobals();
|
||||
header('location: '.$request->getSchemeAndHttpHost() . '/install');
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace Thelia\Action;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Core\Event\Administrator\AdministratorEvent;
|
||||
use Thelia\Core\Event\Administrator\AdministratorUpdatePasswordEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\Admin as AdminModel;
|
||||
use Thelia\Model\AdminQuery;
|
||||
@@ -92,15 +93,23 @@ class Administrator extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function updatePassword(AdministratorUpdatePasswordEvent $event)
|
||||
{
|
||||
$admin = $event->getAdmin();
|
||||
$admin->setPassword($event->getPassword())
|
||||
->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return array(
|
||||
TheliaEvents::ADMINISTRATOR_CREATE => array("create", 128),
|
||||
TheliaEvents::ADMINISTRATOR_UPDATE => array("update", 128),
|
||||
TheliaEvents::ADMINISTRATOR_DELETE => array("delete", 128),
|
||||
TheliaEvents::ADMINISTRATOR_CREATE => array('create', 128),
|
||||
TheliaEvents::ADMINISTRATOR_UPDATE => array('update', 128),
|
||||
TheliaEvents::ADMINISTRATOR_DELETE => array('delete', 128),
|
||||
TheliaEvents::ADMINISTRATOR_UPDATEPASSWORD => array('updatePassword', 128)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ class Attribute extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
// Add atribute to all product templates if required
|
||||
if ($event->getAddToAllTemplates() != 0) {
|
||||
// TODO: add to all product template
|
||||
$this->doAddToAllTemplates($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,8 +52,10 @@ class BaseAction
|
||||
/**
|
||||
* Changes object position, selecting absolute ou relative change.
|
||||
*
|
||||
* @param $query the query to retrieve the object to move
|
||||
* @param ModelCriteria $query
|
||||
* @param UpdatePositionEvent $event
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function genericUpdatePosition(ModelCriteria $query, UpdatePositionEvent $event)
|
||||
{
|
||||
@@ -71,18 +73,4 @@ class BaseAction
|
||||
return $object->movePositionDown();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to append a message to the admin log.
|
||||
*
|
||||
* @param string $message
|
||||
*/
|
||||
public function adminLogAppend($message)
|
||||
{
|
||||
AdminLog::append(
|
||||
$message,
|
||||
$this->container->get('request'),
|
||||
$this->container->get('thelia.securityContext')->getAdminUser()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,18 +143,6 @@ class Document extends BaseCachedFile implements EventSubscriberInterface
|
||||
*/
|
||||
public function saveDocument(DocumentCreateOrUpdateEvent $event)
|
||||
{
|
||||
$this->adminLogAppend(
|
||||
$this->container->get('thelia.translator')->trans(
|
||||
'Saving documents for %parentName% parent id %parentId% (%parentType%)',
|
||||
array(
|
||||
'%parentName%' => $event->getParentName(),
|
||||
'%parentId%' => $event->getParentId(),
|
||||
'%parentType%' => $event->getDocumentType()
|
||||
),
|
||||
'document'
|
||||
)
|
||||
);
|
||||
|
||||
$fileManager = new FileManager($this->container);
|
||||
$model = $event->getModelDocument();
|
||||
|
||||
@@ -187,18 +175,6 @@ class Document extends BaseCachedFile implements EventSubscriberInterface
|
||||
*/
|
||||
public function updateDocument(DocumentCreateOrUpdateEvent $event)
|
||||
{
|
||||
$this->adminLogAppend(
|
||||
$this->container->get('thelia.translator')->trans(
|
||||
'Updating documents for %parentName% parent id %parentId% (%parentType%)',
|
||||
array(
|
||||
'%parentName%' => $event->getParentName(),
|
||||
'%parentId%' => $event->getParentId(),
|
||||
'%parentType%' => $event->getDocumentType()
|
||||
),
|
||||
'image'
|
||||
)
|
||||
);
|
||||
|
||||
if (null !== $event->getUploadedFile()) {
|
||||
$event->getModelDocument()->setTitle($event->getUploadedFile()->getClientOriginalName());
|
||||
}
|
||||
@@ -231,33 +207,7 @@ class Document extends BaseCachedFile implements EventSubscriberInterface
|
||||
{
|
||||
$fileManager = new FileManager($this->container);
|
||||
|
||||
try {
|
||||
$fileManager->deleteFile($event->getDocumentToDelete(), $event->getDocumentType(), FileManager::FILE_TYPE_DOCUMENTS);
|
||||
|
||||
$this->adminLogAppend(
|
||||
$this->container->get('thelia.translator')->trans(
|
||||
'Deleting document for %id% with parent id %parentId%',
|
||||
array(
|
||||
'%id%' => $event->getDocumentToDelete()->getId(),
|
||||
'%parentId%' => $event->getDocumentToDelete()->getParentId(),
|
||||
),
|
||||
'document'
|
||||
)
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
$this->adminLogAppend(
|
||||
$this->container->get('thelia.translator')->trans(
|
||||
'Fail to delete document for %id% with parent id %parentId% (Exception : %e%)',
|
||||
array(
|
||||
'%id%' => $event->getDocumentToDelete()->getId(),
|
||||
'%parentId%' => $event->getDocumentToDelete()->getParentId(),
|
||||
'%e%' => $e->getMessage()
|
||||
),
|
||||
'document'
|
||||
)
|
||||
);
|
||||
throw $e;
|
||||
}
|
||||
$fileManager->deleteFile($event->getDocumentToDelete(), $event->getDocumentType(), FileManager::FILE_TYPE_DOCUMENTS);
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
|
||||
@@ -63,7 +63,7 @@ class Feature extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
// Add atribute to all product templates if required
|
||||
if ($event->getAddToAllTemplates() != 0) {
|
||||
// TODO: add to all product template
|
||||
$this->doAddToAllTemplates($feature);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
namespace Thelia\Action;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Thelia\Core\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
@@ -254,18 +254,6 @@ class Image extends BaseCachedFile implements EventSubscriberInterface
|
||||
*/
|
||||
public function saveImage(ImageCreateOrUpdateEvent $event)
|
||||
{
|
||||
$this->adminLogAppend(
|
||||
$this->container->get('thelia.translator')->trans(
|
||||
'Saving images for %parentName% parent id %parentId% (%parentType%)',
|
||||
array(
|
||||
'%parentName%' => $event->getParentName(),
|
||||
'%parentId%' => $event->getParentId(),
|
||||
'%parentType%' => $event->getImageType()
|
||||
),
|
||||
'image'
|
||||
)
|
||||
);
|
||||
|
||||
$fileManager = new FileManager($this->container);
|
||||
$model = $event->getModelImage();
|
||||
|
||||
@@ -297,18 +285,6 @@ class Image extends BaseCachedFile implements EventSubscriberInterface
|
||||
*/
|
||||
public function updateImage(ImageCreateOrUpdateEvent $event)
|
||||
{
|
||||
$this->adminLogAppend(
|
||||
$this->container->get('thelia.translator')->trans(
|
||||
'Updating images for %parentName% parent id %parentId% (%parentType%)',
|
||||
array(
|
||||
'%parentName%' => $event->getParentName(),
|
||||
'%parentId%' => $event->getParentId(),
|
||||
'%parentType%' => $event->getImageType()
|
||||
),
|
||||
'image'
|
||||
)
|
||||
);
|
||||
|
||||
$fileManager = new FileManager($this->container);
|
||||
// Copy and save file
|
||||
if ($event->getUploadedFile()) {
|
||||
@@ -337,33 +313,7 @@ class Image extends BaseCachedFile implements EventSubscriberInterface
|
||||
{
|
||||
$fileManager = new FileManager($this->container);
|
||||
|
||||
try {
|
||||
$fileManager->deleteFile($event->getImageToDelete(), $event->getImageType(), FileManager::FILE_TYPE_IMAGES);
|
||||
|
||||
$this->adminLogAppend(
|
||||
$this->container->get('thelia.translator')->trans(
|
||||
'Deleting image for %id% with parent id %parentId%',
|
||||
array(
|
||||
'%id%' => $event->getImageToDelete()->getId(),
|
||||
'%parentId%' => $event->getImageToDelete()->getParentId(),
|
||||
),
|
||||
'image'
|
||||
)
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
$this->adminLogAppend(
|
||||
$this->container->get('thelia.translator')->trans(
|
||||
'Fail to delete image for %id% with parent id %parentId% (Exception : %e%)',
|
||||
array(
|
||||
'%id%' => $event->getImageToDelete()->getId(),
|
||||
'%parentId%' => $event->getImageToDelete()->getParentId(),
|
||||
'%e%' => $e->getMessage()
|
||||
),
|
||||
'image'
|
||||
)
|
||||
);
|
||||
throw $e;
|
||||
}
|
||||
$fileManager->deleteFile($event->getImageToDelete(), $event->getImageType(), FileManager::FILE_TYPE_IMAGES);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
62
core/lib/Thelia/Action/MailingSystem.php
Normal file
62
core/lib/Thelia/Action/MailingSystem.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Action;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Core\Event\MailingSystem\MailingSystemEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
|
||||
class MailingSystem extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
/**
|
||||
* @param MailingSystemEvent $event
|
||||
*/
|
||||
public function update(MailingSystemEvent $event)
|
||||
{
|
||||
if($event->getEnabled()) {
|
||||
ConfigQuery::enableSmtp();
|
||||
} else {
|
||||
ConfigQuery::disableSmtp();
|
||||
}
|
||||
ConfigQuery::setSmtpHost($event->getHost());
|
||||
ConfigQuery::setSmtpPort($event->getPort());
|
||||
ConfigQuery::setSmtpEncryption($event->getEncryption());
|
||||
ConfigQuery::setSmtpUsername($event->getUsername());
|
||||
ConfigQuery::setSmtpPassword($event->getPassword());
|
||||
ConfigQuery::setSmtpAuthMode($event->getAuthMode());
|
||||
ConfigQuery::setSmtpTimeout($event->getTimeout());
|
||||
ConfigQuery::setSmtpSourceIp($event->getSourceIp());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return array(
|
||||
TheliaEvents::MAILING_SYSTEM_UPDATE => array("update", 128),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,8 @@ use Thelia\Model\AttributeAvQuery;
|
||||
use Thelia\Model\Currency;
|
||||
use Thelia\Model\Map\AttributeCombinationTableMap;
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Core\Event\Product\ProductCombinationGenerationEvent;
|
||||
use Propel\Runtime\Connection\ConnectionInterface;
|
||||
|
||||
class ProductSaleElement extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
@@ -65,7 +67,7 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
if ($salesElement == null) {
|
||||
// Create a new default product sale element
|
||||
$salesElement = $event->getProduct()->createDefaultProductSaleElement($con, 0, 0, $event->getCurrencyId(), true);
|
||||
$salesElement = $event->getProduct()->createDefaultProductSaleElement($con, 0, 0, 0, $event->getCurrencyId(), true);
|
||||
} else {
|
||||
// This (new) one is the default
|
||||
$salesElement->setIsDefault(true)->save($con);
|
||||
@@ -87,7 +89,7 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
|
||||
->setAttributeAvId($attributeAvId)
|
||||
->setAttribute($attributeAv->getAttribute())
|
||||
->setProductSaleElements($salesElement)
|
||||
->save();
|
||||
->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -206,8 +208,9 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
|
||||
|
||||
if ($product->countSaleElements() <= 0) {
|
||||
// If we just deleted the last PSE, create a default one
|
||||
$product->createDefaultProductSaleElement($con, 0, 0, $event->getCurrencyId(), true);
|
||||
} elseif ($pse->getIsDefault()) {
|
||||
$product->createProductSaleElement($con, 0, 0, 0, $event->getCurrencyId(), true);
|
||||
}
|
||||
elseif ($pse->getIsDefault()) {
|
||||
|
||||
// If we deleted the default PSE, make the last created one the default
|
||||
$pse = ProductSaleElementsQuery::create()
|
||||
@@ -230,6 +233,83 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate combinations. All existing combinations for the product are deleted.
|
||||
*
|
||||
* @param ProductCombinationGenerationEvent $event
|
||||
*/
|
||||
public function generateCombinations(ProductCombinationGenerationEvent $event) {
|
||||
|
||||
$con = Propel::getWriteConnection(ProductSaleElementsTableMap::DATABASE_NAME);
|
||||
|
||||
$con->beginTransaction();
|
||||
|
||||
try {
|
||||
|
||||
// Delete all product's productSaleElement
|
||||
ProductSaleElementsQuery::create()->filterByProductId($event->product->getId())->delete();
|
||||
|
||||
$isDefault = true;
|
||||
|
||||
// Create all combinations
|
||||
foreach($event->getCombinations() as $combinationAttributesAvIds) {
|
||||
|
||||
// Create the PSE
|
||||
$saleElement = $event->getProduct()->createProductSaleElement(
|
||||
$con,
|
||||
$event->getWeight(),
|
||||
$event->getPrice(),
|
||||
$event->getSalePrice(),
|
||||
$event->getCurrencyId(),
|
||||
$isDefault,
|
||||
$event->getOnsale(),
|
||||
$event->getIsnew(),
|
||||
$event->getQuantity(),
|
||||
$event->getEanCode(),
|
||||
$event->getReference()
|
||||
);
|
||||
|
||||
$isDefault = false;
|
||||
|
||||
$this->createCombination($con, $saleElement, $combinationAttributesAvIds);
|
||||
}
|
||||
|
||||
// Store all the stuff !
|
||||
$con->commit();
|
||||
}
|
||||
catch (\Exception $ex) {
|
||||
|
||||
$con->rollback();
|
||||
|
||||
throw $ex;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a combination for a given product sale element
|
||||
*
|
||||
* @param ConnectionInterface $con the Propel connection
|
||||
* @param ProductSaleElement $salesElement the product sale element
|
||||
* @param unknown $combinationAttributes an array oif attributes av IDs
|
||||
*/
|
||||
protected function createCombination(ConnectionInterface $con, ProductSaleElements $salesElement, $combinationAttributes)
|
||||
{
|
||||
foreach ($combinationAttributes as $attributeAvId) {
|
||||
|
||||
$attributeAv = AttributeAvQuery::create()->findPk($attributeAvId);
|
||||
|
||||
if ($attributeAv !== null) {
|
||||
$attributeCombination = new AttributeCombination();
|
||||
|
||||
$attributeCombination
|
||||
->setAttributeAvId($attributeAvId)
|
||||
->setAttribute($attributeAv->getAttribute())
|
||||
->setProductSaleElements($salesElement)
|
||||
->save($con);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -239,6 +319,8 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface
|
||||
TheliaEvents::PRODUCT_ADD_PRODUCT_SALE_ELEMENT => array("create", 128),
|
||||
TheliaEvents::PRODUCT_UPDATE_PRODUCT_SALE_ELEMENT => array("update", 128),
|
||||
TheliaEvents::PRODUCT_DELETE_PRODUCT_SALE_ELEMENT => array("delete", 128),
|
||||
TheliaEvents::PRODUCT_COMBINATION_GENERATION => array("generateCombinations", 128),
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
102
core/lib/Thelia/Command/AdminUpdatePasswordCommand.php
Normal file
102
core/lib/Thelia/Command/AdminUpdatePasswordCommand.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Command;
|
||||
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Thelia\Core\Event\Administrator\AdministratorUpdatePasswordEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\AdminQuery;
|
||||
use Thelia\Tools\Password;
|
||||
|
||||
|
||||
/**
|
||||
* command line for updating admin password
|
||||
*
|
||||
* php Thelia admin:updatePassword
|
||||
*
|
||||
* Class AdminUpdatePasswordCommand
|
||||
* @package Thelia\Command
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class AdminUpdatePasswordCommand extends ContainerAwareCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Configures the current command.
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('admin:updatePassword')
|
||||
->setDescription('change administrator password')
|
||||
->setHelp('The <info>admin:updatePassword</info> command allows you to change the password for a given administrator')
|
||||
->addArgument(
|
||||
'login',
|
||||
InputArgument::REQUIRED,
|
||||
'Login for administrator you want to change the password'
|
||||
)
|
||||
->addOption(
|
||||
'password',
|
||||
null,
|
||||
InputOption::VALUE_REQUIRED,
|
||||
'Desired password. If this option is omitted, a random password is generated and shown in this prompt after'
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$login = $input->getArgument('login');
|
||||
|
||||
|
||||
if (null === $admin = AdminQuery::create()->filterByLogin($login)->findOne()) {
|
||||
throw new \RuntimeException(sprintf('Admin with login %s does not exists', $login));
|
||||
}
|
||||
|
||||
|
||||
$password = $input->getOption('password') ?: Password::generateRandom();
|
||||
|
||||
$event = new AdministratorUpdatePasswordEvent($admin);
|
||||
$event->setPassword($password);
|
||||
|
||||
|
||||
$this->
|
||||
getContainer()
|
||||
->get('event_dispatcher')
|
||||
->dispatch(TheliaEvents::ADMINISTRATOR_UPDATEPASSWORD, $event);
|
||||
|
||||
$output->writeln(array(
|
||||
'',
|
||||
sprintf('<info>admin %s password updated</info>', $login),
|
||||
sprintf('<info>new password is : %s</info>', $password),
|
||||
''
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,13 +35,14 @@ abstract class BaseModuleGenerate extends ContainerAwareCommand
|
||||
protected $moduleDirectory;
|
||||
|
||||
protected $reservedKeyWords = array(
|
||||
"thelia"
|
||||
'thelia'
|
||||
);
|
||||
|
||||
protected $neededDirectories = array(
|
||||
"Config",
|
||||
"Model",
|
||||
"Loop"
|
||||
'Config',
|
||||
'Model',
|
||||
'Loop',
|
||||
'AdminIncludes'
|
||||
);
|
||||
|
||||
protected function verifyExistingModule()
|
||||
|
||||
@@ -38,9 +38,9 @@ class CreateAdminUser extends ContainerAwareCommand
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName("thelia:create-admin")
|
||||
->setDescription("Create a new adminsitration user")
|
||||
->setHelp("The <info>thelia:create-admin</info> command create a new administration user.")
|
||||
->setName("admin:create")
|
||||
->setDescription("Create a new administrator user")
|
||||
->setHelp("The <info>admin:create</info> command create a new administration user.")
|
||||
->addOption(
|
||||
'login_name',
|
||||
null,
|
||||
|
||||
26
core/lib/Thelia/Config/I18n/en_US.php
Normal file
26
core/lib/Thelia/Config/I18n/en_US.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
return array(
|
||||
|
||||
);
|
||||
26
core/lib/Thelia/Config/I18n/es_ES.php
Normal file
26
core/lib/Thelia/Config/I18n/es_ES.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
return array(
|
||||
|
||||
);
|
||||
26
core/lib/Thelia/Config/I18n/fr_FR.php
Normal file
26
core/lib/Thelia/Config/I18n/fr_FR.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
return array(
|
||||
|
||||
);
|
||||
26
core/lib/Thelia/Config/I18n/it_IT.php
Normal file
26
core/lib/Thelia/Config/I18n/it_IT.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
return array(
|
||||
|
||||
);
|
||||
@@ -166,6 +166,11 @@
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
|
||||
<service id="thelia.action.mailing_system" class="Thelia\Action\MailingSystem">
|
||||
<argument type="service" id="service_container"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
</service>
|
||||
|
||||
<service id="thelia.action.newsletter" class="Thelia\Action\Newsletter">
|
||||
<argument type="service" id="service_container"/>
|
||||
<tag name="kernel.event_subscriber"/>
|
||||
|
||||
21
core/lib/Thelia/Config/Resources/command.xml
Normal file
21
core/lib/Thelia/Config/Resources/command.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<config xmlns="http://thelia.net/schema/dic/config"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||
|
||||
<commands>
|
||||
<command class="Thelia\Command\ClearImageCache"/>
|
||||
<command class="Thelia\Command\CacheClear"/>
|
||||
<command class="Thelia\Command\Install"/>
|
||||
<command class="Thelia\Command\ModuleGenerateCommand"/>
|
||||
<command class="Thelia\Command\ModuleGenerateModelCommand"/>
|
||||
<command class="Thelia\Command\ModuleGenerateSqlCommand"/>
|
||||
<command class="Thelia\Command\ModuleActivateCommand"/>
|
||||
<command class="Thelia\Command\CreateAdminUser"/>
|
||||
<command class="Thelia\Command\ReloadDatabaseCommand"/>
|
||||
<command class="Thelia\Command\GenerateResources"/>
|
||||
<command class="Thelia\Command\AdminUpdatePasswordCommand"/>
|
||||
</commands>
|
||||
|
||||
</config>
|
||||
@@ -4,183 +4,6 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||
|
||||
<loops>
|
||||
<loop class="Thelia\Core\Template\Loop\Accessory" name="accessory"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Address" name="address"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Admin" name="admin"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Area" name="area"/>
|
||||
<loop class="Thelia\Core\Template\Loop\AssociatedContent" name="associated_content"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Attribute" name="attribute"/>
|
||||
<loop class="Thelia\Core\Template\Loop\AttributeAvailability" name="attribute_availability"/>
|
||||
<loop class="Thelia\Core\Template\Loop\AttributeCombination" name="attribute_combination"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Auth" name="auth"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Category" name="category"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Content" name="content"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Country" name="country"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Currency" name="currency"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Customer" name="customer"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Feature" name="feature"/>
|
||||
<loop class="Thelia\Core\Template\Loop\FeatureAvailability" name="feature-availability"/>
|
||||
<loop class="Thelia\Core\Template\Loop\FeatureValue" name="feature_value"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Folder" name="folder"/>
|
||||
<loop class="Thelia\Core\Template\Loop\FolderPath" name="folder-path"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Module" name="module"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Order" name="order"/>
|
||||
<loop class="Thelia\Core\Template\Loop\OrderAddress" name="order_address"/>
|
||||
<loop class="Thelia\Core\Template\Loop\OrderProduct" name="order_product"/>
|
||||
<loop class="Thelia\Core\Template\Loop\OrderProductAttributeCombination" name="order_product_attribute_combination"/>
|
||||
<loop class="Thelia\Core\Template\Loop\OrderStatus" name="order-status"/>
|
||||
<loop class="Thelia\Core\Template\Loop\CategoryPath" name="category-path"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Payment" name="payment"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Product" name="product"/>
|
||||
<loop class="Thelia\Core\Template\Loop\ProductSaleElements" name="product_sale_elements"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Profile" name="profile"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Resource" name="resource"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Feed" name="feed"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Title" name="title"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Lang" name="lang"/>
|
||||
<loop class="Thelia\Core\Template\Loop\CategoryTree" name="category-tree"/>
|
||||
<loop class="Thelia\Core\Template\Loop\FolderTree" name="folder-tree"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Cart" name="cart"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Image" name="image"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Document" name="document"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Config" name="config"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Coupon" name="coupon"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Message" name="message"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Delivery" name="delivery"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Template" name="template"/> <!-- This is product templates ;-) -->
|
||||
<loop class="Thelia\Core\Template\Loop\Tax" name="tax"/>
|
||||
<loop class="Thelia\Core\Template\Loop\TaxRule" name="tax-rule"/>
|
||||
<loop class="Thelia\Core\Template\Loop\TaxRuleCountry" name="tax-rule-country"/>
|
||||
</loops>
|
||||
|
||||
<forms>
|
||||
<!-- Forms for Frontend -->
|
||||
<form name="thelia.front.customer.login" class="Thelia\Form\CustomerLogin"/>
|
||||
<form name="thelia.front.customer.lostpassword" class="Thelia\Form\CustomerLostPasswordForm"/>
|
||||
<form name="thelia.front.customer.create" class="Thelia\Form\CustomerCreateForm"/>
|
||||
<form name="thelia.front.customer.profil.update" class="Thelia\Form\CustomerProfilUpdateForm"/>
|
||||
<form name="thelia.front.customer.password.update" class="Thelia\Form\CustomerPasswordUpdateForm"/>
|
||||
<form name="thelia.front.address.create" class="Thelia\Form\AddressCreateForm"/>
|
||||
<form name="thelia.front.address.update" class="Thelia\Form\AddressUpdateForm"/>
|
||||
<form name="thelia.front.contact" class="Thelia\Form\ContactForm"/>
|
||||
<form name="thelia.front.newsletter" class="Thelia\Form\NewsletterForm"/>
|
||||
|
||||
<!-- Forms for Admin -->
|
||||
<form name="thelia.install.step3" class="Thelia\Form\InstallStep3Form"/>
|
||||
|
||||
<form name="thelia.admin.login" class="Thelia\Form\AdminLogin"/>
|
||||
|
||||
<form name="thelia.admin.customer.create" class="Thelia\Form\CustomerCreateForm"/>
|
||||
<form name="thelia.admin.customer.update" class="Thelia\Form\CustomerUpdateForm"/>
|
||||
|
||||
<form name="thelia.admin.address.create" class="Thelia\Form\AddressCreateForm" />
|
||||
<form name="thelia.admin.address.update" class="Thelia\Form\AddressUpdateForm" />
|
||||
|
||||
<form name="thelia.admin.category.creation" class="Thelia\Form\CategoryCreationForm"/>
|
||||
<form name="thelia.admin.category.modification" class="Thelia\Form\CategoryModificationForm"/>
|
||||
<form name="thelia.admin.category.image.modification" class="Thelia\Form\CategoryImageModification"/>
|
||||
<form name="thelia.admin.category.document.modification" class="Thelia\Form\CategoryDocumentModification"/>
|
||||
|
||||
<form name="thelia.admin.product.creation" class="Thelia\Form\ProductCreationForm"/>
|
||||
<form name="thelia.admin.product.modification" class="Thelia\Form\ProductModificationForm"/>
|
||||
<form name="thelia.admin.product.details.modification" class="Thelia\Form\ProductDetailsModificationForm"/>
|
||||
<form name="thelia.admin.product.image.modification" class="Thelia\Form\ProductImageModification"/>
|
||||
<form name="thelia.admin.product.document.modification" class="Thelia\Form\ProductDocumentModification"/>
|
||||
|
||||
<form name="thelia.admin.product_sale_element.update" class="Thelia\Form\ProductSaleElementUpdateForm"/>
|
||||
<form name="thelia.admin.product_default_sale_element.update" class="Thelia\Form\ProductDefaultSaleElementUpdateForm"/>
|
||||
|
||||
<form name="thelia.admin.product.deletion" class="Thelia\Form\ProductModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.folder.creation" class="Thelia\Form\FolderCreationForm"/>
|
||||
<form name="thelia.admin.folder.modification" class="Thelia\Form\FolderModificationForm"/>
|
||||
<form name="thelia.admin.folder.image.modification" class="Thelia\Form\FolderImageModification"/>
|
||||
<form name="thelia.admin.folder.document.modification" class="Thelia\Form\FolderDocumentModification"/>
|
||||
|
||||
<form name="thelia.admin.content.creation" class="Thelia\Form\ContentCreationForm"/>
|
||||
<form name="thelia.admin.content.modification" class="Thelia\Form\ContentModificationForm"/>
|
||||
<form name="thelia.admin.content.image.modification" class="Thelia\Form\ContentImageModification"/>
|
||||
<form name="thelia.admin.content.document.modification" class="Thelia\Form\ContentDocumentModification"/>
|
||||
|
||||
<form name="thelia.cart.add" class="Thelia\Form\CartAdd"/>
|
||||
|
||||
<form name="thelia.order.delivery" class="Thelia\Form\OrderDelivery"/>
|
||||
<form name="thelia.order.payment" class="Thelia\Form\OrderPayment"/>
|
||||
<form name="thelia.order.update.address" class="Thelia\Form\OrderUpdateAddress"/>
|
||||
|
||||
<form name="thelia.order.coupon" class="Thelia\Form\CouponCode"/>
|
||||
|
||||
<form name="thelia.admin.config.creation" class="Thelia\Form\ConfigCreationForm"/>
|
||||
<form name="thelia.admin.config.modification" class="Thelia\Form\ConfigModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.message.creation" class="Thelia\Form\MessageCreationForm"/>
|
||||
<form name="thelia.admin.message.modification" class="Thelia\Form\MessageModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.currency.creation" class="Thelia\Form\CurrencyCreationForm"/>
|
||||
<form name="thelia.admin.currency.modification" class="Thelia\Form\CurrencyModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.coupon.creation" class="Thelia\Form\CouponCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.attribute.creation" class="Thelia\Form\AttributeCreationForm"/>
|
||||
<form name="thelia.admin.attribute.modification" class="Thelia\Form\AttributeModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.feature.creation" class="Thelia\Form\FeatureCreationForm"/>
|
||||
<form name="thelia.admin.feature.modification" class="Thelia\Form\FeatureModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.attributeav.creation" class="Thelia\Form\AttributeAvCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.featureav.creation" class="Thelia\Form\FeatureAvCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.taxrule.modification" class="Thelia\Form\TaxRuleModificationForm"/>
|
||||
<form name="thelia.admin.taxrule.taxlistupdate" class="Thelia\Form\TaxRuleTaxListUpdateForm"/>
|
||||
<form name="thelia.admin.taxrule.add" class="Thelia\Form\TaxRuleCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.tax.modification" class="Thelia\Form\TaxModificationForm"/>
|
||||
<form name="thelia.admin.tax.taxlistupdate" class="Thelia\Form\TaxTaxListUpdateForm"/>
|
||||
<form name="thelia.admin.tax.add" class="Thelia\Form\TaxCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.profile.add" class="Thelia\Form\ProfileCreationForm"/>
|
||||
<form name="thelia.admin.profile.modification" class="Thelia\Form\ProfileModificationForm"/>
|
||||
<form name="thelia.admin.profile.resource-access.modification" class="Thelia\Form\ProfileUpdateResourceAccessForm"/>
|
||||
<form name="thelia.admin.profile.module-access.modification" class="Thelia\Form\ProfileUpdateModuleAccessForm"/>
|
||||
|
||||
<form name="thelia.admin.administrator.add" class="Thelia\Form\AdministratorCreationForm"/>
|
||||
<form name="thelia.admin.administrator.update" class="Thelia\Form\AdministratorModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.template.creation" class="Thelia\Form\TemplateCreationForm"/>
|
||||
<form name="thelia.admin.template.modification" class="Thelia\Form\TemplateModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.country.creation" class="Thelia\Form\CountryCreationForm"/>
|
||||
<form name="thelia.admin.country.modification" class="Thelia\Form\CountryModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.area.create" class="Thelia\Form\Area\AreaCreateForm"/>
|
||||
<form name="thelia.admin.area.modification" class="Thelia\Form\Area\AreaModificationForm"/>
|
||||
<form name="thelia.admin.area.country" class="Thelia\Form\Area\AreaCountryForm"/>
|
||||
<form name="thelia.admin.area.postage" class="Thelia\Form\Area\AreaPostageForm"/>
|
||||
|
||||
<form name="thelia.shopping_zone_area" class="Thelia\Form\ShippingZone\ShippingZoneAddArea"/>
|
||||
<form name="thelia.shopping_zone_remove_area" class="Thelia\Form\ShippingZone\ShippingZoneRemoveArea"/>
|
||||
|
||||
<form name="thelia.lang.update" class="Thelia\Form\Lang\LangUpdateForm"/>
|
||||
<form name="thelia.lang.create" class="Thelia\Form\Lang\LangCreateForm"/>
|
||||
<form name="thelia.lang.defaultBehavior" class="Thelia\Form\Lang\LangDefaultBehaviorForm"/>
|
||||
<form name="thelia.lang.url" class="Thelia\Form\Lang\LangUrlForm"/>
|
||||
</forms>
|
||||
|
||||
|
||||
<commands>
|
||||
<command class="Thelia\Command\ClearImageCache"/>
|
||||
<command class="Thelia\Command\CacheClear"/>
|
||||
<command class="Thelia\Command\Install"/>
|
||||
<command class="Thelia\Command\ModuleGenerateCommand"/>
|
||||
<command class="Thelia\Command\ModuleGenerateModelCommand"/>
|
||||
<command class="Thelia\Command\ModuleGenerateSqlCommand"/>
|
||||
<command class="Thelia\Command\ModuleActivateCommand"/>
|
||||
<command class="Thelia\Command\CreateAdminUser"/>
|
||||
<command class="Thelia\Command\ReloadDatabaseCommand"/>
|
||||
<command class="Thelia\Command\GenerateResources"/>
|
||||
</commands>
|
||||
|
||||
<services>
|
||||
|
||||
@@ -206,7 +29,7 @@
|
||||
<!-- Translation and internationalisation -->
|
||||
|
||||
<service id="thelia.translator" class="Thelia\Core\Translation\Translator">
|
||||
<argument type="string" id="en_UK"></argument>
|
||||
<argument type="service" id="service_container"/>
|
||||
</service>
|
||||
|
||||
<!-- Security context for front and back office -->
|
||||
@@ -232,85 +55,6 @@
|
||||
<argument >%kernel.debug%</argument>
|
||||
</service>
|
||||
|
||||
|
||||
<!-- Smarty parser plugins -->
|
||||
|
||||
<service id="smarty.plugin.assetic" class="Thelia\Core\Template\Smarty\Plugins\Assetic" >
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
<argument>%kernel.environment%</argument>
|
||||
</service>
|
||||
|
||||
<service id="smarty.plugin.theliasyntax" class="Thelia\Core\Template\Smarty\Plugins\TheliaSyntax" >
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
</service>
|
||||
|
||||
<service id="smarty.plugin.format" class="Thelia\Core\Template\Smarty\Plugins\Format" scope="request">
|
||||
<argument type="service" id="request"/>
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
</service>
|
||||
|
||||
<service id="smarty.plugin.thelialoop" class="Thelia\Core\Template\Smarty\Plugins\TheliaLoop" scope="request">
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
<argument type="service" id="service_container" />
|
||||
<call method="setLoopList">
|
||||
<argument>%thelia.parser.loops%</argument>
|
||||
</call>
|
||||
</service>
|
||||
|
||||
<service id="smarty.plugin.type" class="Thelia\Core\Template\Smarty\Plugins\Type" scope="request">
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
</service>
|
||||
|
||||
<service id="smart.plugin.form" class="Thelia\Core\Template\Smarty\Plugins\Form" scope="request">
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
|
||||
<argument type="service" id="request"/>
|
||||
<argument type="service" id="thelia.parser.context"/>
|
||||
|
||||
<call method="setFormDefinition">
|
||||
<argument>%thelia.parser.forms%</argument>
|
||||
</call>
|
||||
</service>
|
||||
|
||||
<service id="smarty.plugin.translation" class="Thelia\Core\Template\Smarty\Plugins\Translation" >
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
<argument type="service" id="thelia.translator" />
|
||||
</service>
|
||||
|
||||
<service id="smarty.plugin.module" class="Thelia\Core\Template\Smarty\Plugins\Module" >
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
</service>
|
||||
|
||||
<service id="smarty.url.module" class="Thelia\Core\Template\Smarty\Plugins\UrlGenerator" scope="request">
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
<argument type="service" id="request"/>
|
||||
</service>
|
||||
|
||||
<service id="smarty.plugin.security" class="Thelia\Core\Template\Smarty\Plugins\Security" scope="request">
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
<argument type="service" id="request" />
|
||||
<argument type="service" id="thelia.securityContext" />
|
||||
</service>
|
||||
|
||||
<service id="smarty.plugin.dataAccess" class="Thelia\Core\Template\Smarty\Plugins\DataAccessFunctions" scope="request">
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
<argument type="service" id="request" />
|
||||
<argument type="service" id="thelia.securityContext" />
|
||||
<argument type="service" id="thelia.parser.context"/>
|
||||
<argument type="service" id="event_dispatcher"/>
|
||||
</service>
|
||||
|
||||
<service id="smarty.plugin.adminUtilities" class="Thelia\Core\Template\Smarty\Plugins\AdminUtilities" scope="request">
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
<argument type="service" id="thelia.securityContext" />
|
||||
</service>
|
||||
|
||||
<service id="smarty.plugin.flashMessage" class="Thelia\Core\Template\Smarty\Plugins\FlashMessage" scope="request">
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
<argument type="service" id="request" />
|
||||
</service>
|
||||
|
||||
|
||||
<service id="http_kernel" class="Thelia\Core\TheliaHttpKernel">
|
||||
<argument type="service" id="event_dispatcher" />
|
||||
<argument type="service" id="service_container" />
|
||||
@@ -323,45 +67,6 @@
|
||||
|
||||
<service id="kernel" synthetic="true" />
|
||||
|
||||
<!-- Coupon module -->
|
||||
<service id="thelia.adapter" class="Thelia\Coupon\BaseFacade">
|
||||
<argument type="service" id="service_container" />
|
||||
</service>
|
||||
<service id="thelia.coupon.manager" class="Thelia\Coupon\CouponManager">
|
||||
<argument type="service" id="service_container" />
|
||||
</service>
|
||||
<service id="thelia.coupon.factory" class="Thelia\Coupon\CouponFactory">
|
||||
<argument type="service" id="service_container" />
|
||||
</service>
|
||||
|
||||
<service id="thelia.coupon.type.remove_x_amount" class="Thelia\Coupon\Type\RemoveXAmountManager">
|
||||
<argument type="service" id="thelia.adapter" />
|
||||
<tag name="thelia.coupon.addCoupon"/>
|
||||
</service>
|
||||
<service id="thelia.coupon.type.remove_x_percent" class="Thelia\Coupon\Type\RemoveXPercentManager">
|
||||
<argument type="service" id="thelia.adapter" />
|
||||
<tag name="thelia.coupon.addCoupon"/>
|
||||
</service>
|
||||
|
||||
|
||||
<!-- Condition module -->
|
||||
<service id="thelia.condition.factory" class="Thelia\Condition\ConditionFactory">
|
||||
<argument type="service" id="service_container" />
|
||||
</service>
|
||||
<service id="thelia.condition.validator" class="Thelia\Condition\ConditionEvaluator">
|
||||
</service>
|
||||
<service id="thelia.condition.match_for_everyone" class="Thelia\Condition\Implementation\MatchForEveryoneManager">
|
||||
<argument type="service" id="thelia.adapter" />
|
||||
<tag name="thelia.coupon.addCondition"/>
|
||||
</service>
|
||||
<service id="thelia.condition.match_for_x_articles" class="Thelia\Condition\Implementation\MatchForXArticlesManager">
|
||||
<argument type="service" id="thelia.adapter" />
|
||||
<tag name="thelia.coupon.addCondition"/>
|
||||
</service>
|
||||
<service id="thelia.condition.match_for_total_amount" class="Thelia\Condition\Implementation\MatchForTotalAmountManager">
|
||||
<argument type="service" id="thelia.adapter" />
|
||||
<tag name="thelia.coupon.addCondition"/>
|
||||
</service>
|
||||
|
||||
<service id="mailer" class="Thelia\Mailer\MailerFactory">
|
||||
<argument type="service" id="event_dispatcher"/>
|
||||
|
||||
55
core/lib/Thelia/Config/Resources/coupon.xml
Normal file
55
core/lib/Thelia/Config/Resources/coupon.xml
Normal file
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<config xmlns="http://thelia.net/schema/dic/config"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||
|
||||
|
||||
<services>
|
||||
|
||||
|
||||
<!-- Coupon module -->
|
||||
<service id="thelia.adapter" class="Thelia\Coupon\BaseFacade">
|
||||
<argument type="service" id="service_container" />
|
||||
</service>
|
||||
<service id="thelia.coupon.manager" class="Thelia\Coupon\CouponManager">
|
||||
<argument type="service" id="service_container" />
|
||||
</service>
|
||||
<service id="thelia.coupon.factory" class="Thelia\Coupon\CouponFactory">
|
||||
<argument type="service" id="service_container" />
|
||||
</service>
|
||||
|
||||
<service id="thelia.coupon.type.remove_x_amount" class="Thelia\Coupon\Type\RemoveXAmountManager">
|
||||
<argument type="service" id="thelia.adapter" />
|
||||
<tag name="thelia.coupon.addCoupon"/>
|
||||
</service>
|
||||
<service id="thelia.coupon.type.remove_x_percent" class="Thelia\Coupon\Type\RemoveXPercentManager">
|
||||
<argument type="service" id="thelia.adapter" />
|
||||
<tag name="thelia.coupon.addCoupon"/>
|
||||
</service>
|
||||
|
||||
|
||||
<!-- Condition module -->
|
||||
<service id="thelia.condition.factory" class="Thelia\Condition\ConditionFactory">
|
||||
<argument type="service" id="service_container" />
|
||||
</service>
|
||||
<service id="thelia.condition.validator" class="Thelia\Condition\ConditionEvaluator">
|
||||
</service>
|
||||
<service id="thelia.condition.match_for_everyone" class="Thelia\Condition\Implementation\MatchForEveryoneManager">
|
||||
<argument type="service" id="thelia.adapter" />
|
||||
<tag name="thelia.coupon.addCondition"/>
|
||||
</service>
|
||||
<service id="thelia.condition.match_for_x_articles" class="Thelia\Condition\Implementation\MatchForXArticlesManager">
|
||||
<argument type="service" id="thelia.adapter" />
|
||||
<tag name="thelia.coupon.addCondition"/>
|
||||
</service>
|
||||
<service id="thelia.condition.match_for_total_amount" class="Thelia\Condition\Implementation\MatchForTotalAmountManager">
|
||||
<argument type="service" id="thelia.adapter" />
|
||||
<tag name="thelia.coupon.addCondition"/>
|
||||
</service>
|
||||
|
||||
|
||||
|
||||
</services>
|
||||
|
||||
</config>
|
||||
127
core/lib/Thelia/Config/Resources/form.xml
Normal file
127
core/lib/Thelia/Config/Resources/form.xml
Normal file
@@ -0,0 +1,127 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<config xmlns="http://thelia.net/schema/dic/config"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||
|
||||
<forms>
|
||||
<!-- Forms for Frontend -->
|
||||
<form name="thelia.front.customer.login" class="Thelia\Form\CustomerLogin"/>
|
||||
<form name="thelia.front.customer.lostpassword" class="Thelia\Form\CustomerLostPasswordForm"/>
|
||||
<form name="thelia.front.customer.create" class="Thelia\Form\CustomerCreateForm"/>
|
||||
<form name="thelia.front.customer.profil.update" class="Thelia\Form\CustomerProfilUpdateForm"/>
|
||||
<form name="thelia.front.customer.password.update" class="Thelia\Form\CustomerPasswordUpdateForm"/>
|
||||
<form name="thelia.front.address.create" class="Thelia\Form\AddressCreateForm"/>
|
||||
<form name="thelia.front.address.update" class="Thelia\Form\AddressUpdateForm"/>
|
||||
<form name="thelia.front.contact" class="Thelia\Form\ContactForm"/>
|
||||
<form name="thelia.front.newsletter" class="Thelia\Form\NewsletterForm"/>
|
||||
|
||||
<!-- Forms for Admin -->
|
||||
<form name="thelia.install.step3" class="Thelia\Form\InstallStep3Form"/>
|
||||
|
||||
<form name="thelia.admin.login" class="Thelia\Form\AdminLogin"/>
|
||||
|
||||
<form name="thelia.admin.customer.create" class="Thelia\Form\CustomerCreateForm"/>
|
||||
<form name="thelia.admin.customer.update" class="Thelia\Form\CustomerUpdateForm"/>
|
||||
|
||||
<form name="thelia.admin.address.create" class="Thelia\Form\AddressCreateForm" />
|
||||
<form name="thelia.admin.address.update" class="Thelia\Form\AddressUpdateForm" />
|
||||
|
||||
<form name="thelia.admin.category.creation" class="Thelia\Form\CategoryCreationForm"/>
|
||||
<form name="thelia.admin.category.modification" class="Thelia\Form\CategoryModificationForm"/>
|
||||
<form name="thelia.admin.category.image.modification" class="Thelia\Form\CategoryImageModification"/>
|
||||
<form name="thelia.admin.category.document.modification" class="Thelia\Form\CategoryDocumentModification"/>
|
||||
|
||||
<form name="thelia.admin.product.creation" class="Thelia\Form\ProductCreationForm"/>
|
||||
<form name="thelia.admin.product.modification" class="Thelia\Form\ProductModificationForm"/>
|
||||
<form name="thelia.admin.product.details.modification" class="Thelia\Form\ProductDetailsModificationForm"/>
|
||||
<form name="thelia.admin.product.image.modification" class="Thelia\Form\ProductImageModification"/>
|
||||
<form name="thelia.admin.product.document.modification" class="Thelia\Form\ProductDocumentModification"/>
|
||||
|
||||
<form name="thelia.admin.product_sale_element.update" class="Thelia\Form\ProductSaleElementUpdateForm"/>
|
||||
<form name="thelia.admin.product_default_sale_element.update" class="Thelia\Form\ProductDefaultSaleElementUpdateForm"/>
|
||||
<form name="thelia.admin.product_combination.build" class="Thelia\Form\ProductCombinationGenerationForm"/>
|
||||
|
||||
|
||||
<form name="thelia.admin.product.deletion" class="Thelia\Form\ProductModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.folder.creation" class="Thelia\Form\FolderCreationForm"/>
|
||||
<form name="thelia.admin.folder.modification" class="Thelia\Form\FolderModificationForm"/>
|
||||
<form name="thelia.admin.folder.image.modification" class="Thelia\Form\FolderImageModification"/>
|
||||
<form name="thelia.admin.folder.document.modification" class="Thelia\Form\FolderDocumentModification"/>
|
||||
|
||||
<form name="thelia.admin.content.creation" class="Thelia\Form\ContentCreationForm"/>
|
||||
<form name="thelia.admin.content.modification" class="Thelia\Form\ContentModificationForm"/>
|
||||
<form name="thelia.admin.content.image.modification" class="Thelia\Form\ContentImageModification"/>
|
||||
<form name="thelia.admin.content.document.modification" class="Thelia\Form\ContentDocumentModification"/>
|
||||
|
||||
<form name="thelia.cart.add" class="Thelia\Form\CartAdd"/>
|
||||
|
||||
<form name="thelia.order.delivery" class="Thelia\Form\OrderDelivery"/>
|
||||
<form name="thelia.order.payment" class="Thelia\Form\OrderPayment"/>
|
||||
<form name="thelia.order.update.address" class="Thelia\Form\OrderUpdateAddress"/>
|
||||
|
||||
<form name="thelia.order.coupon" class="Thelia\Form\CouponCode"/>
|
||||
|
||||
<form name="thelia.admin.config.creation" class="Thelia\Form\ConfigCreationForm"/>
|
||||
<form name="thelia.admin.config.modification" class="Thelia\Form\ConfigModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.message.creation" class="Thelia\Form\MessageCreationForm"/>
|
||||
<form name="thelia.admin.message.modification" class="Thelia\Form\MessageModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.currency.creation" class="Thelia\Form\CurrencyCreationForm"/>
|
||||
<form name="thelia.admin.currency.modification" class="Thelia\Form\CurrencyModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.coupon.creation" class="Thelia\Form\CouponCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.attribute.creation" class="Thelia\Form\AttributeCreationForm"/>
|
||||
<form name="thelia.admin.attribute.modification" class="Thelia\Form\AttributeModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.feature.creation" class="Thelia\Form\FeatureCreationForm"/>
|
||||
<form name="thelia.admin.feature.modification" class="Thelia\Form\FeatureModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.attributeav.creation" class="Thelia\Form\AttributeAvCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.featureav.creation" class="Thelia\Form\FeatureAvCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.taxrule.modification" class="Thelia\Form\TaxRuleModificationForm"/>
|
||||
<form name="thelia.admin.taxrule.taxlistupdate" class="Thelia\Form\TaxRuleTaxListUpdateForm"/>
|
||||
<form name="thelia.admin.taxrule.add" class="Thelia\Form\TaxRuleCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.tax.modification" class="Thelia\Form\TaxModificationForm"/>
|
||||
<form name="thelia.admin.tax.taxlistupdate" class="Thelia\Form\TaxTaxListUpdateForm"/>
|
||||
<form name="thelia.admin.tax.add" class="Thelia\Form\TaxCreationForm"/>
|
||||
|
||||
<form name="thelia.admin.profile.add" class="Thelia\Form\ProfileCreationForm"/>
|
||||
<form name="thelia.admin.profile.modification" class="Thelia\Form\ProfileModificationForm"/>
|
||||
<form name="thelia.admin.profile.resource-access.modification" class="Thelia\Form\ProfileUpdateResourceAccessForm"/>
|
||||
<form name="thelia.admin.profile.module-access.modification" class="Thelia\Form\ProfileUpdateModuleAccessForm"/>
|
||||
|
||||
<form name="thelia.admin.administrator.add" class="Thelia\Form\AdministratorCreationForm"/>
|
||||
<form name="thelia.admin.administrator.update" class="Thelia\Form\AdministratorModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.mailing-system.update" class="Thelia\Form\MailingSystemModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.template.creation" class="Thelia\Form\TemplateCreationForm"/>
|
||||
<form name="thelia.admin.template.modification" class="Thelia\Form\TemplateModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.country.creation" class="Thelia\Form\CountryCreationForm"/>
|
||||
<form name="thelia.admin.country.modification" class="Thelia\Form\CountryModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.area.create" class="Thelia\Form\Area\AreaCreateForm"/>
|
||||
<form name="thelia.admin.area.modification" class="Thelia\Form\Area\AreaModificationForm"/>
|
||||
<form name="thelia.admin.area.country" class="Thelia\Form\Area\AreaCountryForm"/>
|
||||
<form name="thelia.admin.area.postage" class="Thelia\Form\Area\AreaPostageForm"/>
|
||||
|
||||
<form name="thelia.shopping_zone_area" class="Thelia\Form\ShippingZone\ShippingZoneAddArea"/>
|
||||
<form name="thelia.shopping_zone_remove_area" class="Thelia\Form\ShippingZone\ShippingZoneRemoveArea"/>
|
||||
|
||||
<form name="thelia.lang.update" class="Thelia\Form\Lang\LangUpdateForm"/>
|
||||
<form name="thelia.lang.create" class="Thelia\Form\Lang\LangCreateForm"/>
|
||||
<form name="thelia.lang.defaultBehavior" class="Thelia\Form\Lang\LangDefaultBehaviorForm"/>
|
||||
<form name="thelia.lang.url" class="Thelia\Form\Lang\LangUrlForm"/>
|
||||
|
||||
<form name="thelia.system-logs.configuration" class="Thelia\Form\SystemLogConfigurationForm"/>
|
||||
</forms>
|
||||
|
||||
</config>
|
||||
59
core/lib/Thelia/Config/Resources/loop.xml
Normal file
59
core/lib/Thelia/Config/Resources/loop.xml
Normal file
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<config xmlns="http://thelia.net/schema/dic/config"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||
|
||||
<loops>
|
||||
<loop class="Thelia\Core\Template\Loop\Accessory" name="accessory"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Address" name="address"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Admin" name="admin"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Area" name="area"/>
|
||||
<loop class="Thelia\Core\Template\Loop\AssociatedContent" name="associated_content"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Attribute" name="attribute"/>
|
||||
<loop class="Thelia\Core\Template\Loop\AttributeAvailability" name="attribute_availability"/>
|
||||
<loop class="Thelia\Core\Template\Loop\AttributeCombination" name="attribute_combination"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Auth" name="auth"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Category" name="category"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Content" name="content"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Country" name="country"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Currency" name="currency"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Customer" name="customer"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Feature" name="feature"/>
|
||||
<loop class="Thelia\Core\Template\Loop\FeatureAvailability" name="feature-availability"/>
|
||||
<loop class="Thelia\Core\Template\Loop\FeatureValue" name="feature_value"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Folder" name="folder"/>
|
||||
<loop class="Thelia\Core\Template\Loop\FolderPath" name="folder-path"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Module" name="module"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Order" name="order"/>
|
||||
<loop class="Thelia\Core\Template\Loop\OrderAddress" name="order_address"/>
|
||||
<loop class="Thelia\Core\Template\Loop\OrderProduct" name="order_product"/>
|
||||
<loop class="Thelia\Core\Template\Loop\OrderProductAttributeCombination" name="order_product_attribute_combination"/>
|
||||
<loop class="Thelia\Core\Template\Loop\OrderStatus" name="order-status"/>
|
||||
<loop class="Thelia\Core\Template\Loop\CategoryPath" name="category-path"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Payment" name="payment"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Product" name="product"/>
|
||||
<loop class="Thelia\Core\Template\Loop\ProductSaleElements" name="product_sale_elements"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Profile" name="profile"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Resource" name="resource"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Feed" name="feed"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Title" name="title"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Lang" name="lang"/>
|
||||
<loop class="Thelia\Core\Template\Loop\CategoryTree" name="category-tree"/>
|
||||
<loop class="Thelia\Core\Template\Loop\FolderTree" name="folder-tree"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Cart" name="cart"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Image" name="image"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Document" name="document"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Config" name="config"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Coupon" name="coupon"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Message" name="message"/>
|
||||
<loop class="Thelia\Core\Template\Loop\Delivery" name="delivery"/>
|
||||
<loop class="Thelia\Core\Template\Loop\ProductTemplate" name="product-template"/> <!-- This is product templates ;-) -->
|
||||
<loop class="Thelia\Core\Template\Loop\Tax" name="tax"/>
|
||||
<loop class="Thelia\Core\Template\Loop\TaxRule" name="tax-rule"/>
|
||||
<loop class="Thelia\Core\Template\Loop\TaxRuleCountry" name="tax-rule-country"/>
|
||||
</loops>
|
||||
|
||||
|
||||
|
||||
</config>
|
||||
@@ -9,6 +9,18 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\AdminController::indexAction</default>
|
||||
</route>
|
||||
|
||||
<!-- home -->
|
||||
|
||||
<route id="admin.home.view" path="/admin/home">
|
||||
<default key="_controller">Thelia\Controller\Admin\HomeController::defaultAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.home.stats" path="/admin/home/stats">
|
||||
<default key="_controller">Thelia\Controller\Admin\HomeController::loadStatsAjaxAction</default>
|
||||
</route>
|
||||
|
||||
<!-- end home -->
|
||||
|
||||
<!-- Route to the administration login page -->
|
||||
<route id="admin.login" path="/admin/login">
|
||||
<default key="_controller">Thelia\Controller\Admin\SessionController::showLoginAction</default>
|
||||
@@ -114,6 +126,10 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\CustomerController::deleteAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.customer.create" path="/admin/customer/create">
|
||||
<default key="_controller">Thelia\Controller\Admin\CustomerController::createAction</default>
|
||||
</route>
|
||||
|
||||
<!-- end Customer rule management -->
|
||||
|
||||
<!-- address management -->
|
||||
@@ -368,6 +384,10 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\ProductController::updateProductSaleElementsAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.product.combination.build" path="/admin/product/combination/build">
|
||||
<default key="_controller">Thelia\Controller\Admin\ProductController::buildCombinationsAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.product.combination.defaut-price.update" path="/admin/product/default-price/update">
|
||||
<default key="_controller">Thelia\Controller\Admin\ProductController::updateProductDefaultSaleElementAction</default>
|
||||
</route>
|
||||
@@ -496,6 +516,16 @@
|
||||
<default key="_controller">Thelia\Controller\Admin\ConfigController::deleteAction</default>
|
||||
</route>
|
||||
|
||||
<!-- Routes to the SystemLog controller -->
|
||||
|
||||
<route id="admin.configuration.system-logs.default" path="/admin/configuration/system-logs">
|
||||
<default key="_controller">Thelia\Controller\Admin\SystemLogController::defaultAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.system-logs.save" path="/admin/configuration/system-logs/save">
|
||||
<default key="_controller">Thelia\Controller\Admin\SystemLogController::saveAction</default>
|
||||
</route>
|
||||
|
||||
<!-- Routes to the Messages controller -->
|
||||
|
||||
<route id="admin.configuration.messages.default" path="/admin/configuration/messages">
|
||||
@@ -812,6 +842,30 @@
|
||||
|
||||
<!-- end administrator management -->
|
||||
|
||||
<!-- mailing-system management -->
|
||||
|
||||
<route id="admin.configuration.mailing-system.view" path="/admin/configuration/mailingSystem">
|
||||
<default key="_controller">Thelia\Controller\Admin\MailingSystemController::defaultAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.mailing-system.save" path="/admin/configuration/mailingSystem/save">
|
||||
<default key="_controller">Thelia\Controller\Admin\MailingSystemController::updateAction</default>
|
||||
</route>
|
||||
|
||||
<!-- end mailing-system management -->
|
||||
|
||||
<!-- admin logs display -->
|
||||
|
||||
<route id="admin.configuration.admin-logs.view" path="/admin/configuration/adminLogs">
|
||||
<default key="_controller">Thelia\Controller\Admin\AdminLogsController::defaultAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.admin-logs.logger" path="/admin/configuration/adminLogs/logger">
|
||||
<default key="_controller">Thelia\Controller\Admin\AdminLogsController::loadLoggerAjaxAction</default>
|
||||
</route>
|
||||
|
||||
<!-- end admin logs display -->
|
||||
|
||||
<!-- feature and features value management -->
|
||||
|
||||
<route id="admin.configuration.features.default" path="/admin/configuration/features">
|
||||
|
||||
100
core/lib/Thelia/Config/Resources/smarty-plugin.xml
Normal file
100
core/lib/Thelia/Config/Resources/smarty-plugin.xml
Normal file
@@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<config xmlns="http://thelia.net/schema/dic/config"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<services>
|
||||
|
||||
<!-- URL maganement -->
|
||||
|
||||
|
||||
|
||||
<!-- Smarty parser plugins -->
|
||||
|
||||
<service id="smarty.plugin.assetic" class="Thelia\Core\Template\Smarty\Plugins\Assetic" >
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
<argument>%kernel.environment%</argument>
|
||||
</service>
|
||||
|
||||
<service id="smarty.plugin.theliasyntax" class="Thelia\Core\Template\Smarty\Plugins\TheliaSyntax" >
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
</service>
|
||||
|
||||
<service id="smarty.plugin.format" class="Thelia\Core\Template\Smarty\Plugins\Format" scope="request">
|
||||
<argument type="service" id="request"/>
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
</service>
|
||||
|
||||
<service id="smarty.plugin.thelialoop" class="Thelia\Core\Template\Smarty\Plugins\TheliaLoop" scope="request">
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
<argument type="service" id="service_container" />
|
||||
<call method="setLoopList">
|
||||
<argument>%thelia.parser.loops%</argument>
|
||||
</call>
|
||||
</service>
|
||||
|
||||
<service id="smarty.plugin.type" class="Thelia\Core\Template\Smarty\Plugins\Type" scope="request">
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
</service>
|
||||
|
||||
<service id="smart.plugin.form" class="Thelia\Core\Template\Smarty\Plugins\Form" scope="request">
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
|
||||
<argument type="service" id="request"/>
|
||||
<argument type="service" id="thelia.parser.context"/>
|
||||
|
||||
<call method="setFormDefinition">
|
||||
<argument>%thelia.parser.forms%</argument>
|
||||
</call>
|
||||
</service>
|
||||
|
||||
<service id="smarty.plugin.translation" class="Thelia\Core\Template\Smarty\Plugins\Translation" >
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
<argument type="service" id="thelia.translator" />
|
||||
</service>
|
||||
|
||||
<service id="smarty.plugin.module" class="Thelia\Core\Template\Smarty\Plugins\Module" >
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
</service>
|
||||
|
||||
<service id="smarty.url.module" class="Thelia\Core\Template\Smarty\Plugins\UrlGenerator" scope="request">
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
<argument type="service" id="request"/>
|
||||
</service>
|
||||
|
||||
<service id="smarty.plugin.security" class="Thelia\Core\Template\Smarty\Plugins\Security" scope="request">
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
<argument type="service" id="request" />
|
||||
<argument type="service" id="thelia.securityContext" />
|
||||
</service>
|
||||
|
||||
<service id="smarty.plugin.dataAccess" class="Thelia\Core\Template\Smarty\Plugins\DataAccessFunctions" scope="request">
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
<argument type="service" id="request" />
|
||||
<argument type="service" id="thelia.securityContext" />
|
||||
<argument type="service" id="thelia.parser.context"/>
|
||||
<argument type="service" id="event_dispatcher"/>
|
||||
</service>
|
||||
|
||||
<service id="smarty.plugin.adminUtilities" class="Thelia\Core\Template\Smarty\Plugins\AdminUtilities" scope="request">
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
<argument type="service" id="thelia.securityContext" />
|
||||
</service>
|
||||
|
||||
<service id="smarty.plugin.flashMessage" class="Thelia\Core\Template\Smarty\Plugins\FlashMessage" scope="request">
|
||||
<tag name="thelia.parser.register_plugin"/>
|
||||
<argument type="service" id="request" />
|
||||
</service>
|
||||
|
||||
|
||||
|
||||
</services>
|
||||
|
||||
</config>
|
||||
62
core/lib/Thelia/Config/Resources/translation.xml
Normal file
62
core/lib/Thelia/Config/Resources/translation.xml
Normal file
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<config xmlns="http://thelia.net/schema/dic/config"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
|
||||
|
||||
<parameters>
|
||||
<parameter key="translation.loader.php.class">Symfony\Component\Translation\Loader\PhpFileLoader</parameter>
|
||||
<parameter key="translation.loader.yml.class">Symfony\Component\Translation\Loader\YamlFileLoader</parameter>
|
||||
<parameter key="translation.loader.xliff.class">Symfony\Component\Translation\Loader\XliffFileLoader</parameter>
|
||||
<parameter key="translation.loader.po.class">Symfony\Component\Translation\Loader\PoFileLoader</parameter>
|
||||
<parameter key="translation.loader.mo.class">Symfony\Component\Translation\Loader\MoFileLoader</parameter>
|
||||
<parameter key="translation.loader.qt.class">Symfony\Component\Translation\Loader\QtFileLoader</parameter>
|
||||
<parameter key="translation.loader.csv.class">Symfony\Component\Translation\Loader\CsvFileLoader</parameter>
|
||||
<parameter key="translation.loader.res.class">Symfony\Component\Translation\Loader\IcuResFileLoader</parameter>
|
||||
<parameter key="translation.loader.dat.class">Symfony\Component\Translation\Loader\IcuDatFileLoader</parameter>
|
||||
<parameter key="translation.loader.ini.class">Symfony\Component\Translation\Loader\IniFileLoader</parameter>
|
||||
</parameters>
|
||||
|
||||
<services>
|
||||
<service id="translation.loader.php" class="%translation.loader.php.class%">
|
||||
<tag name="translation.loader" alias="php" />
|
||||
</service>
|
||||
|
||||
<service id="translation.loader.yml" class="%translation.loader.yml.class%">
|
||||
<tag name="translation.loader" alias="yml" legacy-alias="yaml" />
|
||||
</service>
|
||||
|
||||
<service id="translation.loader.xliff" class="%translation.loader.xliff.class%">
|
||||
<tag name="translation.loader" alias="xlf" legacy-alias="xliff" />
|
||||
</service>
|
||||
|
||||
<service id="translation.loader.po" class="%translation.loader.po.class%">
|
||||
<tag name="translation.loader" alias="po" />
|
||||
</service>
|
||||
|
||||
<service id="translation.loader.mo" class="%translation.loader.mo.class%">
|
||||
<tag name="translation.loader" alias="mo" />
|
||||
</service>
|
||||
|
||||
<service id="translation.loader.qt" class="%translation.loader.qt.class%">
|
||||
<tag name="translation.loader" alias="ts" />
|
||||
</service>
|
||||
|
||||
<service id="translation.loader.csv" class="%translation.loader.csv.class%">
|
||||
<tag name="translation.loader" alias="csv" />
|
||||
</service>
|
||||
|
||||
<service id="translation.loader.res" class="%translation.loader.res.class%">
|
||||
<tag name="translation.loader" alias="res" />
|
||||
</service>
|
||||
|
||||
<service id="translation.loader.dat" class="%translation.loader.res.class%">
|
||||
<tag name="translation.loader" alias="dat" />
|
||||
</service>
|
||||
|
||||
<service id="translation.loader.ini" class="%translation.loader.ini.class%">
|
||||
<tag name="translation.loader" alias="ini" />
|
||||
</service>
|
||||
</services>
|
||||
|
||||
</config>
|
||||
@@ -253,7 +253,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
/**
|
||||
* Render the object list, ensuring the sort order is set.
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
* @return Thelia\Core\HttpFoundation\Response the response
|
||||
*/
|
||||
protected function renderList()
|
||||
{
|
||||
@@ -263,7 +263,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
/**
|
||||
* The default action is displaying the list.
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
* @return Thelia\Core\HttpFoundation\Response the response
|
||||
*/
|
||||
public function defaultAction()
|
||||
{
|
||||
@@ -274,7 +274,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
/**
|
||||
* Create a new object
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
* @return Thelia\Core\HttpFoundation\Response the response
|
||||
*/
|
||||
public function createAction()
|
||||
{
|
||||
@@ -303,7 +303,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
|
||||
if (null !== $createdObject = $this->getObjectFromEvent($createEvent)) {
|
||||
// Log object creation
|
||||
$this->adminLogAppend(sprintf("%s %s (ID %s) created", ucfirst($this->objectName), $this->getObjectLabel($createdObject), $this->getObjectId($createdObject)));
|
||||
$this->adminLogAppend($this->resourceCode, AccessManager::CREATE, sprintf("%s %s (ID %s) created", ucfirst($this->objectName), $this->getObjectLabel($createdObject), $this->getObjectId($createdObject)));
|
||||
}
|
||||
|
||||
$response = $this->performAdditionalCreateAction($createEvent);
|
||||
@@ -335,7 +335,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
/**
|
||||
* Load a object for modification, and display the edit template.
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
* @return Thelia\Core\HttpFoundation\Response the response
|
||||
*/
|
||||
public function updateAction()
|
||||
{
|
||||
@@ -361,7 +361,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
/**
|
||||
* Save changes on a modified object, and either go back to the object list, or stay on the edition page.
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
* @return Thelia\Core\HttpFoundation\Response the response
|
||||
*/
|
||||
public function processUpdateAction()
|
||||
{
|
||||
@@ -391,7 +391,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
|
||||
// Log object modification
|
||||
if (null !== $changedObject = $this->getObjectFromEvent($changeEvent)) {
|
||||
$this->adminLogAppend(sprintf("%s %s (ID %s) modified", ucfirst($this->objectName), $this->getObjectLabel($changedObject), $this->getObjectId($changedObject)));
|
||||
$this->adminLogAppend($this->resourceCode, AccessManager::UPDATE, sprintf("%s %s (ID %s) modified", ucfirst($this->objectName), $this->getObjectLabel($changedObject), $this->getObjectId($changedObject)));
|
||||
}
|
||||
|
||||
$response = $this->performAdditionalUpdateAction($changeEvent);
|
||||
@@ -516,7 +516,7 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
/**
|
||||
* Delete an object
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
* @return Thelia\Core\HttpFoundation\Response the response
|
||||
*/
|
||||
public function deleteAction()
|
||||
{
|
||||
@@ -530,7 +530,8 @@ abstract class AbstractCrudController extends BaseAdminController
|
||||
|
||||
if (null !== $deletedObject = $this->getObjectFromEvent($deleteEvent)) {
|
||||
$this->adminLogAppend(
|
||||
sprintf("%s %s (ID %s) deleted", ucfirst($this->objectName), $this->getObjectLabel($deletedObject), $this->getObjectId($deletedObject)));
|
||||
$this->resourceCode, AccessManager::DELETE,
|
||||
sprintf("%s %s (ID %s) deleted", ucfirst($this->objectName), $this->getObjectLabel($deletedObject), $this->getObjectId($deletedObject)));
|
||||
}
|
||||
|
||||
$response = $this->performAdditionalDeleteAction($deleteEvent);
|
||||
|
||||
@@ -74,9 +74,9 @@ class AddressController extends AbstractCrudController
|
||||
|
||||
$this->dispatch(TheliaEvents::ADDRESS_DEFAULT, $addressEvent);
|
||||
|
||||
$this->adminLogAppend(sprintf("address %d for customer %d removal", $address_id, $address->getCustomerId()));
|
||||
$this->adminLogAppend($this->resourceCode, AccessManager::UPDATE, sprintf("address %d for customer %d set as default address", $address_id, $address->getCustomerId()));
|
||||
} catch (\Exception $e) {
|
||||
\Thelia\Log\Tlog::getInstance()->error(sprintf("error during address removal with message %s", $e->getMessage()));
|
||||
\Thelia\Log\Tlog::getInstance()->error(sprintf("error during address setting as default with message %s", $e->getMessage()));
|
||||
}
|
||||
|
||||
$this->redirectToRoute('admin.customer.update.view', array(), array('customer_id' => $address->getCustomerId()));
|
||||
|
||||
72
core/lib/Thelia/Controller/Admin/AdminLogsController.php
Normal file
72
core/lib/Thelia/Controller/Admin/AdminLogsController.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Model\AdminLogQuery;
|
||||
|
||||
class AdminLogsController extends BaseAdminController
|
||||
{
|
||||
const RESOURCE_CODE = "admin.admin-logs";
|
||||
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(self::RESOURCE_CODE, AccessManager::VIEW)) return $response;
|
||||
|
||||
// Render the edition template.
|
||||
return $this->render('admin-logs');
|
||||
}
|
||||
|
||||
public function loadLoggerAjaxAction()
|
||||
{
|
||||
$entries = array();
|
||||
|
||||
foreach( AdminLogQuery::getEntries(
|
||||
$this->getRequest()->request->get('admins', array()),
|
||||
$this->getRequest()->request->get('fromDate', null),
|
||||
$this->getRequest()->request->get('toDate', null),
|
||||
array_merge($this->getRequest()->request->get('resources', array()), $this->getRequest()->request->get('modules', array())),
|
||||
null
|
||||
) as $entry) {
|
||||
|
||||
$entries[] = array(
|
||||
"head" => sprintf(
|
||||
"[%s][%s][%s:%s]",
|
||||
date('Y-m-d H:i:s', $entry->getCreatedAt()->getTimestamp()),
|
||||
$entry->getAdminLogin(),
|
||||
$entry->getResource(),
|
||||
$entry->getAction()
|
||||
),
|
||||
"data" => $entry->getMessage(),
|
||||
);
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
'ajax/logger',
|
||||
array(
|
||||
'entries' => $entries,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -249,7 +249,7 @@ class AreaController extends AbstractCrudController
|
||||
|
||||
// Log object modification
|
||||
if (null !== $changedObject = $this->getObjectFromEvent($event)) {
|
||||
$this->adminLogAppend(sprintf("%s %s (ID %s) modified, new country added", ucfirst($this->objectName), $this->getObjectLabel($changedObject), $this->getObjectId($changedObject)));
|
||||
$this->adminLogAppend($this->resourceCode, AccessManager::UPDATE, sprintf("%s %s (ID %s) modified, new country added", ucfirst($this->objectName), $this->getObjectLabel($changedObject), $this->getObjectId($changedObject)));
|
||||
}
|
||||
|
||||
// Redirect to the success URL
|
||||
@@ -303,7 +303,7 @@ class AreaController extends AbstractCrudController
|
||||
|
||||
// Log object modification
|
||||
if (null !== $changedObject = $this->getObjectFromEvent($event)) {
|
||||
$this->adminLogAppend(sprintf("%s %s (ID %s) modified, country remove", ucfirst($this->objectName), $this->getObjectLabel($changedObject), $this->getObjectId($changedObject)));
|
||||
$this->adminLogAppend($this->resourceCode, AccessManager::UPDATE, sprintf("%s %s (ID %s) modified, country remove", ucfirst($this->objectName), $this->getObjectLabel($changedObject), $this->getObjectId($changedObject)));
|
||||
}
|
||||
|
||||
// Redirect to the success URL
|
||||
|
||||
@@ -157,23 +157,6 @@ class AttributeController extends AbstractCrudController
|
||||
'postscriptum' => $object->getPostscriptum()
|
||||
);
|
||||
|
||||
// Setup attributes values
|
||||
/*
|
||||
* FIXME : doesn't work. "We get a This form should not contain extra fields." error
|
||||
$attr_av_list = AttributeAvQuery::create()
|
||||
->joinWithI18n($this->getCurrentEditionLocale())
|
||||
->filterByAttributeId($object->getId())
|
||||
->find();
|
||||
|
||||
$attr_array = array();
|
||||
|
||||
foreach ($attr_av_list as $attr_av) {
|
||||
$attr_array[$attr_av->getId()] = $attr_av->getTitle();
|
||||
}
|
||||
|
||||
$data['attribute_values'] = $attr_array;
|
||||
*/
|
||||
|
||||
// Setup the object form
|
||||
return new AttributeModificationForm($this->getRequest(), "form", $data);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ use Symfony\Component\Routing\Exception\InvalidParameterException;
|
||||
use Symfony\Component\Routing\Exception\MissingMandatoryParametersException;
|
||||
use Symfony\Component\Routing\Exception\RouteNotFoundException;
|
||||
use Thelia\Controller\BaseController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Thelia\Core\HttpFoundation\Response;
|
||||
use Thelia\Core\Security\Exception\AuthorizationException;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
@@ -51,18 +51,20 @@ class BaseAdminController extends BaseController
|
||||
/**
|
||||
* Helper to append a message to the admin log.
|
||||
*
|
||||
* @param string $resource
|
||||
* @param string $action
|
||||
* @param string $message
|
||||
*/
|
||||
public function adminLogAppend($message)
|
||||
public function adminLogAppend($resource, $action, $message)
|
||||
{
|
||||
AdminLog::append($message, $this->getRequest(), $this->getSecurityContext()->getAdminUser());
|
||||
AdminLog::append($resource, $action, $message, $this->getRequest(), $this->getSecurityContext()->getAdminUser());
|
||||
}
|
||||
|
||||
/**
|
||||
* This method process the rendering of view called from an admin page
|
||||
*
|
||||
* @param unknown $template
|
||||
* @return Response the reponse which contains the rendered view
|
||||
* @return Response the response which contains the rendered view
|
||||
*/
|
||||
public function processTemplateAction($template)
|
||||
{
|
||||
@@ -83,7 +85,7 @@ class BaseAdminController extends BaseController
|
||||
/**
|
||||
* Return a 404 error
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return \Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
protected function pageNotFound()
|
||||
{
|
||||
@@ -95,7 +97,7 @@ class BaseAdminController extends BaseController
|
||||
*
|
||||
* @param mixed $message a message string, or an exception instance
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return \Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
protected function errorPage($message, $status = 500)
|
||||
{
|
||||
@@ -131,7 +133,7 @@ class BaseAdminController extends BaseController
|
||||
}
|
||||
|
||||
// Log the problem
|
||||
$this->adminLogAppend("User is not granted for resources %s with accesses %s", implode(", ", $resources), implode(", ", $accesses));
|
||||
$this->adminLogAppend(implode(",", $resources), implode(",", $accesses), "User is not granted for resources %s with accesses %s", implode(", ", $resources), implode(", ", $accesses));
|
||||
|
||||
// Generate the proper response
|
||||
$response = new Response();
|
||||
@@ -197,7 +199,7 @@ class BaseAdminController extends BaseController
|
||||
$parser = $this->container->get("thelia.parser");
|
||||
|
||||
// Define the template thant shoud be used
|
||||
$parser->setTemplate($template ?: ConfigQuery::read('base_admin_template', 'admin/default'));
|
||||
$parser->setTemplate($template ?: ConfigQuery::read('base-admin-template', 'admin/default'));
|
||||
|
||||
return $parser;
|
||||
}
|
||||
@@ -371,7 +373,7 @@ class BaseAdminController extends BaseController
|
||||
* @param $templateName the complete template name, with extension
|
||||
* @param array $args the template arguments
|
||||
* @param int $status http code status
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return \Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
protected function render($templateName, $args = array(), $status = 200)
|
||||
{
|
||||
@@ -385,7 +387,7 @@ class BaseAdminController extends BaseController
|
||||
* @param array $args the template arguments
|
||||
* @param null $templateDir
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return \Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
protected function renderRaw($templateName, $args = array(), $templateDir = null)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Thelia\Core\HttpFoundation\Response;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Category\CategoryDeleteEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
@@ -320,7 +320,7 @@ class CategoryController extends AbstractCrudController
|
||||
/**
|
||||
* Add category pictures
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return \Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
public function addRelatedPictureAction()
|
||||
{
|
||||
|
||||
@@ -181,7 +181,7 @@ class ConfigController extends AbstractCrudController
|
||||
/**
|
||||
* Change values modified directly from the variable list
|
||||
*
|
||||
* @return Symfony\Component\HttpFoundation\Response the response
|
||||
* @return Thelia\Core\HttpFoundation\Response the response
|
||||
*/
|
||||
public function changeValuesAction()
|
||||
{
|
||||
|
||||
@@ -64,7 +64,7 @@ class ContentController extends AbstractCrudController
|
||||
/**
|
||||
* controller adding content to additional folder
|
||||
*
|
||||
* @return mixed|\Symfony\Component\HttpFoundation\Response
|
||||
* @return mixed|\Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
public function addAdditionalFolderAction()
|
||||
{
|
||||
@@ -92,7 +92,7 @@ class ContentController extends AbstractCrudController
|
||||
/**
|
||||
* controller removing additional folder to a content
|
||||
*
|
||||
* @return mixed|\Symfony\Component\HttpFoundation\Response
|
||||
* @return mixed|\Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
public function removeAdditionalFolderAction()
|
||||
{
|
||||
|
||||
@@ -58,7 +58,7 @@ class CouponController extends BaseAdminController
|
||||
/**
|
||||
* Manage Coupons list display
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return \Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
public function browseAction()
|
||||
{
|
||||
@@ -90,7 +90,7 @@ class CouponController extends BaseAdminController
|
||||
*
|
||||
* @param int $couponId Coupon Id
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return \Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
public function readAction($couponId)
|
||||
{
|
||||
@@ -117,7 +117,7 @@ class CouponController extends BaseAdminController
|
||||
/**
|
||||
* Manage Coupons creation display
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return \Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
public function createAction()
|
||||
{
|
||||
@@ -165,7 +165,7 @@ class CouponController extends BaseAdminController
|
||||
*
|
||||
* @param int $couponId Coupon id
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return \Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
public function updateAction($couponId)
|
||||
{
|
||||
@@ -270,7 +270,7 @@ class CouponController extends BaseAdminController
|
||||
*
|
||||
* @param string $conditionId Condition service id
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return \Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
public function getConditionInputAction($conditionId)
|
||||
{
|
||||
@@ -300,7 +300,7 @@ class CouponController extends BaseAdminController
|
||||
*
|
||||
* @param int $couponId Coupon id
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return \Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
public function updateConditionsAction($couponId)
|
||||
{
|
||||
@@ -356,6 +356,7 @@ class CouponController extends BaseAdminController
|
||||
);
|
||||
|
||||
$this->adminLogAppend(
|
||||
AdminResources::COUPON, AccessManager::UPDATE,
|
||||
sprintf(
|
||||
'Coupon %s (ID %s) conditions updated',
|
||||
$couponEvent->getCouponModel()->getTitle(),
|
||||
@@ -468,6 +469,7 @@ class CouponController extends BaseAdminController
|
||||
);
|
||||
|
||||
$this->adminLogAppend(
|
||||
AdminResources::COUPON, AccessManager::UPDATE,
|
||||
sprintf(
|
||||
'Coupon %s (ID ) ' . $log,
|
||||
$couponEvent->getTitle(),
|
||||
|
||||
@@ -29,10 +29,12 @@ use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\Customer\CustomerEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Form\CustomerCreateForm;
|
||||
use Thelia\Form\CustomerUpdateForm;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Model\CustomerQuery;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Tools\Password;
|
||||
|
||||
/**
|
||||
* Class CustomerController
|
||||
@@ -59,7 +61,7 @@ class CustomerController extends BaseAdminController
|
||||
* update customer action
|
||||
*
|
||||
* @param $customer_id
|
||||
* @return mixed|\Symfony\Component\HttpFoundation\Response
|
||||
* @return mixed|\Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
public function updateAction($customer_id)
|
||||
{
|
||||
@@ -85,7 +87,7 @@ class CustomerController extends BaseAdminController
|
||||
|
||||
$customerUpdated = $event->getCustomer();
|
||||
|
||||
$this->adminLogAppend(sprintf("Customer with Ref %s (ID %d) modified", $customerUpdated->getRef() , $customerUpdated->getId()));
|
||||
$this->adminLogAppend(AdminResources::CUSTOMER, AccessManager::UPDATE, sprintf("Customer with Ref %s (ID %d) modified", $customerUpdated->getRef() , $customerUpdated->getId()));
|
||||
|
||||
if ($this->getRequest()->get("save_mode") == "close") {
|
||||
$this->redirectToRoute("admin.customers");
|
||||
@@ -102,7 +104,7 @@ class CustomerController extends BaseAdminController
|
||||
}
|
||||
|
||||
if ($message !== false) {
|
||||
\Thelia\Log\Tlog::getInstance()->error(sprintf("Error during customer login process : %s.", $message));
|
||||
\Thelia\Log\Tlog::getInstance()->error(sprintf("Error during customer update process : %s.", $message));
|
||||
|
||||
$customerUpdateForm->setErrorMessage($message);
|
||||
|
||||
@@ -117,6 +119,56 @@ class CustomerController extends BaseAdminController
|
||||
));
|
||||
}
|
||||
|
||||
public function createAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::CUSTOMER, AccessManager::CREATE)) return $response;
|
||||
|
||||
$message = null;
|
||||
|
||||
$customerCreateForm = new CustomerCreateForm($this->getRequest());
|
||||
|
||||
try {
|
||||
|
||||
$form = $this->validateForm($customerCreateForm);
|
||||
|
||||
$data = $form->getData();
|
||||
$data["password"] = Password::generateRandom();
|
||||
|
||||
$event = $this->createEventInstance($form->getData());
|
||||
|
||||
|
||||
|
||||
$this->dispatch(TheliaEvents::CUSTOMER_CREATEACCOUNT, $event);
|
||||
|
||||
$successUrl = $customerCreateForm->getSuccessUrl();
|
||||
|
||||
$successUrl = str_replace('_ID_', $event->getCustomer()->getId(), $successUrl);
|
||||
|
||||
$this->redirect($successUrl);
|
||||
|
||||
|
||||
}catch (FormValidationException $e) {
|
||||
$message = sprintf("Please check your input: %s", $e->getMessage());
|
||||
} catch (PropelException $e) {
|
||||
$message = $e->getMessage();
|
||||
} catch (\Exception $e) {
|
||||
$message = sprintf("Sorry, an error occured: %s", $e->getMessage()." ".$e->getFile());
|
||||
}
|
||||
|
||||
if ($message !== false) {
|
||||
\Thelia\Log\Tlog::getInstance()->error(sprintf("Error during customer creation process : %s.", $message));
|
||||
|
||||
$customerCreateForm->setErrorMessage($message);
|
||||
|
||||
$this->getParserContext()
|
||||
->addForm($customerCreateForm)
|
||||
->setGeneralError($message)
|
||||
;
|
||||
}
|
||||
|
||||
return $this->render("customers", array("display_customer" => 20));
|
||||
}
|
||||
|
||||
public function deleteAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::CUSTOMER, AccessManager::DELETE)) return $response;
|
||||
|
||||
@@ -157,23 +157,6 @@ class FeatureController extends AbstractCrudController
|
||||
'postscriptum' => $object->getPostscriptum()
|
||||
);
|
||||
|
||||
// Setup features values
|
||||
/*
|
||||
* FIXME : doesn't work. "We get a This form should not contain extra fields." error
|
||||
$attr_av_list = FeatureAvQuery::create()
|
||||
->joinWithI18n($this->getCurrentEditionLocale())
|
||||
->filterByFeatureId($object->getId())
|
||||
->find();
|
||||
|
||||
$attr_array = array();
|
||||
|
||||
foreach ($attr_av_list as $attr_av) {
|
||||
$attr_array[$attr_av->getId()] = $attr_av->getTitle();
|
||||
}
|
||||
|
||||
$data['feature_values'] = $attr_array;
|
||||
*/
|
||||
|
||||
// Setup the object form
|
||||
return new FeatureModificationForm($this->getRequest(), "form", $data);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Thelia\Controller\Admin;
|
||||
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Thelia\Core\HttpFoundation\Response;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Document\DocumentCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\Document\DocumentDeleteEvent;
|
||||
@@ -130,6 +130,20 @@ class FileController extends BaseAdminController
|
||||
$imageCreateOrUpdateEvent
|
||||
);
|
||||
|
||||
$this->adminLogAppend(
|
||||
AdminResources::retrieve($parentType),
|
||||
AccessManager::UPDATE,
|
||||
$this->container->get('thelia.translator')->trans(
|
||||
'Saving images for %parentName% parent id %parentId% (%parentType%)',
|
||||
array(
|
||||
'%parentName%' => $imageCreateOrUpdateEvent->getParentName(),
|
||||
'%parentId%' => $imageCreateOrUpdateEvent->getParentId(),
|
||||
'%parentType%' => $imageCreateOrUpdateEvent->getImageType()
|
||||
),
|
||||
'image'
|
||||
)
|
||||
);
|
||||
|
||||
return new ResponseRest(array('status' => true, 'message' => ''));
|
||||
}
|
||||
}
|
||||
@@ -194,6 +208,20 @@ class FileController extends BaseAdminController
|
||||
$documentCreateOrUpdateEvent
|
||||
);
|
||||
|
||||
$this->adminLogAppend(
|
||||
AdminResources::retrieve($parentType),
|
||||
AccessManager::UPDATE,
|
||||
$this->container->get('thelia.translator')->trans(
|
||||
'Saving documents for %parentName% parent id %parentId% (%parentType%)',
|
||||
array(
|
||||
'%parentName%' => $documentCreateOrUpdateEvent->getParentName(),
|
||||
'%parentId%' => $documentCreateOrUpdateEvent->getParentId(),
|
||||
'%parentType%' => $documentCreateOrUpdateEvent->getDocumentType()
|
||||
),
|
||||
'document'
|
||||
)
|
||||
);
|
||||
|
||||
return new ResponseRest(array('status' => true, 'message' => ''));
|
||||
}
|
||||
}
|
||||
@@ -368,7 +396,7 @@ class FileController extends BaseAdminController
|
||||
|
||||
$imageUpdated = $event->getModelImage();
|
||||
|
||||
$this->adminLogAppend(sprintf('Image with Ref %s (ID %d) modified', $imageUpdated->getTitle(), $imageUpdated->getId()));
|
||||
$this->adminLogAppend(AdminResources::retrieve($parentType), AccessManager::UPDATE, sprintf('Image with Ref %s (ID %d) modified', $imageUpdated->getTitle(), $imageUpdated->getId()));
|
||||
|
||||
if ($this->getRequest()->get('save_mode') == 'close') {
|
||||
$this->redirectToRoute('admin.images');
|
||||
@@ -445,7 +473,7 @@ class FileController extends BaseAdminController
|
||||
|
||||
$documentUpdated = $event->getModelDocument();
|
||||
|
||||
$this->adminLogAppend(sprintf('Document with Ref %s (ID %d) modified', $documentUpdated->getTitle(), $documentUpdated->getId()));
|
||||
$this->adminLogAppend(AdminResources::retrieve($parentType), AccessManager::UPDATE, sprintf('Document with Ref %s (ID %d) modified', $documentUpdated->getTitle(), $documentUpdated->getId()));
|
||||
|
||||
if ($this->getRequest()->get('save_mode') == 'close') {
|
||||
$this->redirectToRoute('admin.documents');
|
||||
@@ -509,10 +537,39 @@ class FileController extends BaseAdminController
|
||||
);
|
||||
|
||||
// Dispatch Event to the Action
|
||||
$this->dispatch(
|
||||
TheliaEvents::IMAGE_DELETE,
|
||||
$imageDeleteEvent
|
||||
);
|
||||
try {
|
||||
$this->dispatch(
|
||||
TheliaEvents::IMAGE_DELETE,
|
||||
$imageDeleteEvent
|
||||
);
|
||||
|
||||
$this->adminLogAppend(
|
||||
AdminResources::retrieve($parentType),
|
||||
AccessManager::UPDATE,
|
||||
$this->container->get('thelia.translator')->trans(
|
||||
'Deleting image for %id% with parent id %parentId%',
|
||||
array(
|
||||
'%id%' => $imageDeleteEvent->getImageToDelete()->getId(),
|
||||
'%parentId%' => $imageDeleteEvent->getImageToDelete()->getParentId(),
|
||||
),
|
||||
'image'
|
||||
)
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
$this->adminLogAppend(
|
||||
AdminResources::retrieve($parentType),
|
||||
AccessManager::UPDATE,
|
||||
$this->container->get('thelia.translator')->trans(
|
||||
'Fail to delete image for %id% with parent id %parentId% (Exception : %e%)',
|
||||
array(
|
||||
'%id%' => $imageDeleteEvent->getImageToDelete()->getId(),
|
||||
'%parentId%' => $imageDeleteEvent->getImageToDelete()->getParentId(),
|
||||
'%e%' => $e->getMessage()
|
||||
),
|
||||
'image'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$message = $this->getTranslator()
|
||||
->trans(
|
||||
@@ -552,10 +609,39 @@ class FileController extends BaseAdminController
|
||||
);
|
||||
|
||||
// Dispatch Event to the Action
|
||||
$this->dispatch(
|
||||
TheliaEvents::DOCUMENT_DELETE,
|
||||
$documentDeleteEvent
|
||||
);
|
||||
try {
|
||||
$this->dispatch(
|
||||
TheliaEvents::DOCUMENT_DELETE,
|
||||
$documentDeleteEvent
|
||||
);
|
||||
|
||||
$this->adminLogAppend(
|
||||
AdminResources::retrieve($parentType),
|
||||
AccessManager::UPDATE,
|
||||
$this->container->get('thelia.translator')->trans(
|
||||
'Deleting document for %id% with parent id %parentId%',
|
||||
array(
|
||||
'%id%' => $documentDeleteEvent->getDocumentToDelete()->getId(),
|
||||
'%parentId%' => $documentDeleteEvent->getDocumentToDelete()->getParentId(),
|
||||
),
|
||||
'document'
|
||||
)
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
$this->adminLogAppend(
|
||||
AdminResources::retrieve($parentType),
|
||||
AccessManager::UPDATE,
|
||||
$this->container->get('thelia.translator')->trans(
|
||||
'Fail to delete document for %id% with parent id %parentId% (Exception : %e%)',
|
||||
array(
|
||||
'%id%' => $documentDeleteEvent->getDocumentToDelete()->getId(),
|
||||
'%parentId%' => $documentDeleteEvent->getDocumentToDelete()->getParentId(),
|
||||
'%e%' => $e->getMessage()
|
||||
),
|
||||
'document'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$message = $this->getTranslator()
|
||||
->trans(
|
||||
|
||||
102
core/lib/Thelia/Controller/Admin/HomeController.php
Normal file
102
core/lib/Thelia/Controller/Admin/HomeController.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Model\CustomerQuery;
|
||||
use Thelia\Model\OrderQuery;
|
||||
|
||||
class HomeController extends BaseAdminController
|
||||
{
|
||||
const RESOURCE_CODE = "admin.home";
|
||||
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(self::RESOURCE_CODE, AccessManager::VIEW)) return $response;
|
||||
|
||||
// Render the edition template.
|
||||
return $this->render('home');
|
||||
}
|
||||
|
||||
public function loadStatsAjaxAction()
|
||||
{
|
||||
$data = new \stdClass();
|
||||
|
||||
$data->title = "Stats on " . $this->getRequest()->query->get('month', date('m')) . "/" . $this->getRequest()->query->get('year', date('Y'));
|
||||
|
||||
/* sales */
|
||||
$saleSeries = new \stdClass();
|
||||
$saleSeries->color = $this->getRequest()->query->get('sales_color', '#adadad');
|
||||
$saleSeries->data = OrderQuery::getSaleStats(
|
||||
$this->getRequest()->query->get('month', date('m')),
|
||||
$this->getRequest()->query->get('year', date('Y'))
|
||||
);
|
||||
|
||||
/* new customers */
|
||||
$newCustomerSeries = new \stdClass();
|
||||
$newCustomerSeries->color = $this->getRequest()->query->get('customers_color', '#f39922');
|
||||
$newCustomerSeries->data = CustomerQuery::getNewCustomersStats(
|
||||
$this->getRequest()->query->get('month', date('m')),
|
||||
$this->getRequest()->query->get('year', date('Y'))
|
||||
);
|
||||
|
||||
/* orders */
|
||||
$orderSeries = new \stdClass();
|
||||
$orderSeries->color = $this->getRequest()->query->get('orders_color', '#5cb85c');
|
||||
$orderSeries->data = OrderQuery::getOrdersStats(
|
||||
$this->getRequest()->query->get('month', date('m')),
|
||||
$this->getRequest()->query->get('year', date('Y'))
|
||||
);
|
||||
|
||||
/* first order */
|
||||
$firstOrderSeries = new \stdClass();
|
||||
$firstOrderSeries->color = $this->getRequest()->query->get('first_orders_color', '#5bc0de');
|
||||
$firstOrderSeries->data = OrderQuery::getFirstOrdersStats(
|
||||
$this->getRequest()->query->get('month', date('m')),
|
||||
$this->getRequest()->query->get('year', date('Y'))
|
||||
);
|
||||
|
||||
/* cancelled orders */
|
||||
$cancelledOrderSeries = new \stdClass();
|
||||
$cancelledOrderSeries->color = $this->getRequest()->query->get('cancelled_orders_color', '#d9534f');
|
||||
$cancelledOrderSeries->data = OrderQuery::getOrdersStats(
|
||||
$this->getRequest()->query->get('month', date('m')),
|
||||
$this->getRequest()->query->get('year', date('Y')),
|
||||
array(5)
|
||||
);
|
||||
|
||||
|
||||
$data->series = array(
|
||||
$saleSeries,
|
||||
$newCustomerSeries,
|
||||
$orderSeries,
|
||||
$firstOrderSeries,
|
||||
$cancelledOrderSeries,
|
||||
);
|
||||
|
||||
$json = json_encode($data);
|
||||
|
||||
return $this->jsonResponse($json);
|
||||
}
|
||||
}
|
||||
@@ -116,8 +116,8 @@ class LangController extends BaseAdminController
|
||||
}
|
||||
|
||||
$changedObject = $event->getLang();
|
||||
$this->adminLogAppend(sprintf("%s %s (ID %s) modified", 'Lang', $changedObject->getTitle(), $changedObject->getId()));
|
||||
$this->redirectToRoute('/admin/configuration/languages');
|
||||
$this->adminLogAppend(AdminResources::LANGUAGE, AccessManager::UPDATE, sprintf("%s %s (ID %s) modified", 'Lang', $changedObject->getTitle(), $changedObject->getId()));
|
||||
$this->redirectToRoute('admin.configuration.languages');
|
||||
} catch (\Exception $e) {
|
||||
$error_msg = $e->getMessage();
|
||||
}
|
||||
@@ -153,7 +153,7 @@ class LangController extends BaseAdminController
|
||||
}
|
||||
|
||||
$changedObject = $event->getLang();
|
||||
$this->adminLogAppend(sprintf("%s %s (ID %s) modified", 'Lang', $changedObject->getTitle(), $changedObject->getId()));
|
||||
$this->adminLogAppend(AdminResources::LANGUAGE, AccessManager::UPDATE, sprintf("%s %s (ID %s) modified", 'Lang', $changedObject->getTitle(), $changedObject->getId()));
|
||||
|
||||
} catch (\Exception $e) {
|
||||
\Thelia\Log\Tlog::getInstance()->error(sprintf("Error on changing default languages with message : %s", $e->getMessage()));
|
||||
@@ -189,7 +189,7 @@ class LangController extends BaseAdminController
|
||||
}
|
||||
|
||||
$createdObject = $createEvent->getLang();
|
||||
$this->adminLogAppend(sprintf("%s %s (ID %s) created", 'Lang', $createdObject->getTitle(), $createdObject->getId()));
|
||||
$this->adminLogAppend(AdminResources::LANGUAGE, AccessManager::CREATE, sprintf("%s %s (ID %s) created", 'Lang', $createdObject->getTitle(), $createdObject->getId()));
|
||||
|
||||
$this->redirectToRoute('admin.configuration.languages');
|
||||
|
||||
|
||||
@@ -23,20 +23,91 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\MailingSystem\MailingSystemEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Form\Exception\FormValidationException;
|
||||
use Thelia\Form\MailingSystemModificationForm;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
|
||||
/**
|
||||
* Class MailingSystemController
|
||||
* @package Thelia\Controller\Admin
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class MailingSystemController extends BaseAdminController
|
||||
{
|
||||
const RESOURCE_CODE = "admin.mailing-system";
|
||||
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::MAILING_SYSTEM, AccessManager::VIEW)) return $response;
|
||||
return $this->render("mailing-system");
|
||||
if (null !== $response = $this->checkAuth(self::RESOURCE_CODE, AccessManager::VIEW)) return $response;
|
||||
|
||||
// Hydrate the form abd pass it to the parser
|
||||
$data = array(
|
||||
'enabled' => ConfigQuery::isSmtpEnable() ? 1 : 0,
|
||||
'host' => ConfigQuery::getSmtpHost(),
|
||||
'port' => ConfigQuery::getSmtpPort(),
|
||||
'encryption' => ConfigQuery::getSmtpEncryption(),
|
||||
'username' => ConfigQuery::getSmtpUsername(),
|
||||
'password' => ConfigQuery::getSmtpPassword(),
|
||||
'authmode' => ConfigQuery::getSmtpAuthMode(),
|
||||
'timeout' => ConfigQuery::getSmtpTimeout(),
|
||||
'sourceip' => ConfigQuery::getSmtpSourceIp(),
|
||||
);
|
||||
|
||||
// Setup the object form
|
||||
$form = new MailingSystemModificationForm($this->getRequest(), "form", $data);
|
||||
|
||||
// Pass it to the parser
|
||||
$this->getParserContext()->addForm($form);
|
||||
|
||||
// Render the edition template.
|
||||
return $this->render('mailing-system');
|
||||
}
|
||||
|
||||
public function updateAction()
|
||||
{
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth(self::RESOURCE_CODE, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
// Create the form from the request
|
||||
$form = new MailingSystemModificationForm($this->getRequest());
|
||||
|
||||
try {
|
||||
|
||||
// Check the form against constraints violations
|
||||
$formData = $this->validateForm($form, "POST");
|
||||
|
||||
// Get the form field values
|
||||
$event = new MailingSystemEvent();
|
||||
$event->setEnabled($formData->get('enabled')->getData());
|
||||
$event->setHost($formData->get('host')->getData());
|
||||
$event->setPort($formData->get('port')->getData());
|
||||
$event->setEncryption($formData->get('encryption')->getData());
|
||||
$event->setUsername($formData->get('username')->getData());
|
||||
$event->setPassword($formData->get('password')->getData());
|
||||
$event->setAuthMode($formData->get('authmode')->getData());
|
||||
$event->setTimeout($formData->get('timeout')->getData());
|
||||
$event->setSourceIp($formData->get('sourceip')->getData());
|
||||
|
||||
$this->dispatch(TheliaEvents::MAILING_SYSTEM_UPDATE, $event);
|
||||
|
||||
// Redirect to the success URL
|
||||
$this->redirectToRoute("admin.configuration.mailing-system.view");
|
||||
} catch (FormValidationException $ex) {
|
||||
// Form cannot be validated
|
||||
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
||||
} catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$error_msg = $ex->getMessage();
|
||||
}
|
||||
|
||||
$this->setupFormErrorContext(
|
||||
$this->getTranslator()->trans("mailing system modification", array()),
|
||||
$error_msg,
|
||||
$form,
|
||||
$ex
|
||||
);
|
||||
|
||||
// At this point, the form has errors, and should be redisplayed.
|
||||
return $this->render('mailing-system');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Thelia\Core\HttpFoundation\Response;
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Event\Order\OrderAddressEvent;
|
||||
use Thelia\Core\Event\Order\OrderEvent;
|
||||
|
||||
@@ -64,6 +64,8 @@ use Thelia\Model\Country;
|
||||
use Thelia\Tools\NumberFormat;
|
||||
use Thelia\Model\Product;
|
||||
use Thelia\Model\CurrencyQuery;
|
||||
use Thelia\Form\ProductCombinationGenerationForm;
|
||||
use Thelia\Core\Event\Product\ProductCombinationGenerationEvent;
|
||||
|
||||
/**
|
||||
* Manages products
|
||||
@@ -931,7 +933,7 @@ class ProductController extends AbstractCrudController
|
||||
|
||||
// Log object modification
|
||||
if (null !== $changedObject = $event->getProductSaleElement()) {
|
||||
$this->adminLogAppend(sprintf("Product Sale Element (ID %s) for product reference %s modified", $changedObject->getId(), $event->getProduct()->getRef()));
|
||||
$this->adminLogAppend($this->resourceCode, AccessManager::UPDATE, sprintf("Product Sale Element (ID %s) for product reference %s modified", $changedObject->getId(), $event->getProduct()->getRef()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1025,6 +1027,108 @@ class ProductController extends AbstractCrudController
|
||||
);
|
||||
}
|
||||
|
||||
// Create combinations
|
||||
protected function combine($input, &$output, &$tmp) {
|
||||
$current = array_shift($input);
|
||||
|
||||
if (count($input) > 0) {
|
||||
foreach($current as $element) {
|
||||
$tmp[] = $element;
|
||||
$this->combine($input, $output, $tmp);
|
||||
array_pop($tmp);
|
||||
}
|
||||
} else {
|
||||
foreach($current as $element) {
|
||||
$tmp[] = $element;
|
||||
$output[] = $tmp;
|
||||
array_pop($tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build combinations from the combination output builder
|
||||
*/
|
||||
public function buildCombinationsAction() {
|
||||
|
||||
// Check current user authorization
|
||||
if (null !== $response = $this->checkAuth($this->resourceCode, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
$changeForm = new ProductCombinationGenerationForm($this->getRequest());
|
||||
|
||||
try {
|
||||
|
||||
// Check the form against constraints violations
|
||||
$form = $this->validateForm($changeForm, "POST");
|
||||
|
||||
// Get the form field values
|
||||
$data = $form->getData();
|
||||
|
||||
// Rework attributes_av array, to build an array which contains all combinations,
|
||||
// in the form combination[] = array of combination attributes av IDs
|
||||
//
|
||||
// First, create an array of attributes_av ID in the form $attributes_av_list[$attribute_id] = array of attributes_av ID
|
||||
// from the list of attribute_id:attributes_av ID from the form.
|
||||
$combinations = $attributes_av_list = array();
|
||||
|
||||
foreach($data['attribute_av'] as $item) {
|
||||
list($attribute_id, $attribute_av_id) = explode(':', $item);
|
||||
|
||||
if (! isset($attributes_av_list[$attribute_id]))
|
||||
$attributes_av_list[$attribute_id] = array();
|
||||
|
||||
|
||||
$attributes_av_list[$attribute_id][] = $attribute_av_id;
|
||||
}
|
||||
|
||||
// Next, recursively combine array
|
||||
$combinations = $tmp = array();
|
||||
|
||||
$this->combine($attributes_av_list, $combinations, $tmp);
|
||||
|
||||
// Create event
|
||||
$event = new ProductCombinationGenerationEvent(
|
||||
$this->getExistingObject(),
|
||||
$data['currency'],
|
||||
$combinations
|
||||
);
|
||||
|
||||
$event
|
||||
->setReference($data['reference'] == null ? '' : $data['reference'])
|
||||
->setPrice($data['price'] == null ? 0 : $data['price'])
|
||||
->setWeight($data['weight'] == null ? 0 : $data['weight'])
|
||||
->setQuantity($data['quantity'] == null ? 0 : $data['quantity'])
|
||||
->setSalePrice($data['sale_price'] == null ? 0 : $data['sale_price'])
|
||||
->setOnsale($data['onsale'] == null ? false : $data['onsale'])
|
||||
->setIsnew($data['isnew'] == null ? false : $data['isnew'])
|
||||
->setEanCode($data['ean_code'] == null ? '' : $data['ean_code'])
|
||||
;
|
||||
|
||||
$this->dispatch(TheliaEvents::PRODUCT_COMBINATION_GENERATION, $event);
|
||||
|
||||
// Log object modification
|
||||
$this->adminLogAppend(sprintf("Combination generation for product reference %s", $event->getProduct()->getRef()));
|
||||
|
||||
// Redirect to the success URL
|
||||
$this->redirect($changeForm->getSuccessUrl());
|
||||
|
||||
} catch (FormValidationException $ex) {
|
||||
// Form cannot be validated
|
||||
$error_msg = $this->createStandardFormValidationErrorMessage($ex);
|
||||
} catch (\Exception $ex) {
|
||||
// Any other error
|
||||
$error_msg = $ex->getMessage();
|
||||
}
|
||||
|
||||
$this->setupFormErrorContext(
|
||||
$this->getTranslator()->trans("Combination builder"), $error_msg, $changeForm, $ex);
|
||||
|
||||
// At this point, the form has errors, and should be redisplayed.
|
||||
return $this->renderEditionTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked through Ajax; this method calculates the taxed price from the unaxed price, and
|
||||
* vice versa.
|
||||
|
||||
@@ -330,7 +330,7 @@ class ProfileController extends AbstractCrudController
|
||||
|
||||
// Log object modification
|
||||
if (null !== $changedObject = $this->getObjectFromEvent($changeEvent)) {
|
||||
$this->adminLogAppend(sprintf("%s %s (ID %s) modified", ucfirst($this->objectName), $this->getObjectLabel($changedObject), $this->getObjectId($changedObject)));
|
||||
$this->adminLogAppend($this->resourceCode, AccessManager::UPDATE, sprintf("%s %s (ID %s) modified", ucfirst($this->objectName), $this->getObjectLabel($changedObject), $this->getObjectId($changedObject)));
|
||||
}
|
||||
|
||||
if ($response == null) {
|
||||
@@ -379,7 +379,7 @@ class ProfileController extends AbstractCrudController
|
||||
|
||||
// Log object modification
|
||||
if (null !== $changedObject = $this->getObjectFromEvent($changeEvent)) {
|
||||
$this->adminLogAppend(sprintf("%s %s (ID %s) modified", ucfirst($this->objectName), $this->getObjectLabel($changedObject), $this->getObjectId($changedObject)));
|
||||
$this->adminLogAppend($this->resourceCode, AccessManager::UPDATE, sprintf("%s %s (ID %s) modified", ucfirst($this->objectName), $this->getObjectLabel($changedObject), $this->getObjectId($changedObject)));
|
||||
}
|
||||
|
||||
if ($response == null) {
|
||||
|
||||
@@ -50,7 +50,7 @@ class SessionController extends BaseAdminController
|
||||
|
||||
$this->getSecurityContext()->setAdminUser($user);
|
||||
|
||||
$this->adminLogAppend("Successful token authentication");
|
||||
$this->adminLogAppend("admin", "LOGIN", "Successful token authentication");
|
||||
|
||||
// Update the cookie
|
||||
$cookie = $this->createAdminRememberMeCookie($user);
|
||||
@@ -58,7 +58,7 @@ class SessionController extends BaseAdminController
|
||||
// Render the home page
|
||||
return $this->render("home");
|
||||
} catch (TokenAuthenticationException $ex) {
|
||||
$this->adminLogAppend("Token based authentication failed.");
|
||||
$this->adminLogAppend("admin", "LOGIN", "Token based authentication failed.");
|
||||
|
||||
// Clear the cookie
|
||||
$this->clearRememberMeCookie();
|
||||
@@ -99,7 +99,7 @@ class SessionController extends BaseAdminController
|
||||
$this->getSecurityContext()->setAdminUser($user);
|
||||
|
||||
// Log authentication success
|
||||
AdminLog::append("Authentication successful", $request, $user);
|
||||
AdminLog::append("admin", "LOGIN", "Authentication successful", $request, $user);
|
||||
|
||||
/**
|
||||
* FIXME: we have tou find a way to send cookie
|
||||
@@ -122,13 +122,13 @@ class SessionController extends BaseAdminController
|
||||
} catch (AuthenticationException $ex) {
|
||||
|
||||
// Log authentication failure
|
||||
AdminLog::append(sprintf("Authentication failure for username '%s'", $authenticator->getUsername()), $request);
|
||||
AdminLog::append("admin", "LOGIN", sprintf("Authentication failure for username '%s'", $authenticator->getUsername()), $request);
|
||||
|
||||
$message = $this->getTranslator()->trans("Login failed. Please check your username and password.");
|
||||
} catch (\Exception $ex) {
|
||||
|
||||
// Log authentication failure
|
||||
AdminLog::append(sprintf("Undefined error: %s", $ex->getMessage()), $request);
|
||||
AdminLog::append("admin", "LOGIN", sprintf("Undefined error: %s", $ex->getMessage()), $request);
|
||||
|
||||
$message = $this->getTranslator()->trans(
|
||||
"Unable to process your request. Please try again (%err).",
|
||||
|
||||
@@ -55,7 +55,7 @@ class ShippingZoneController extends BaseAdminController
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed|\Symfony\Component\HttpFoundation\Response
|
||||
* @return mixed|\Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
public function addArea()
|
||||
{
|
||||
|
||||
182
core/lib/Thelia/Controller/Admin/SystemLogController.php
Normal file
182
core/lib/Thelia/Controller/Admin/SystemLogController.php
Normal file
@@ -0,0 +1,182 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Controller\Admin;
|
||||
|
||||
|
||||
use Thelia\Core\Security\Resource\AdminResources;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Form\SystemLogConfigurationForm;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
/**
|
||||
* Class LangController
|
||||
* @package Thelia\Controller\Admin
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class SystemLogController extends BaseAdminController
|
||||
{
|
||||
|
||||
protected function renderTemplate()
|
||||
{
|
||||
$destinations = array();
|
||||
|
||||
$destination_directories = Tlog::getInstance()->getDestinationsDirectories();
|
||||
|
||||
foreach($destination_directories as $dir) {
|
||||
$this->loadDefinedDestinations($dir, $destinations);
|
||||
}
|
||||
|
||||
$active_destinations = explode(";", ConfigQuery::read(Tlog::VAR_DESTINATIONS, Tlog::DEFAUT_DESTINATIONS));
|
||||
|
||||
return $this->render('system-logs',
|
||||
array(
|
||||
'ip_address' => $this->getRequest()->getClientIp(),
|
||||
'destinations' => $destinations,
|
||||
'active_destinations' => $active_destinations
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
protected function loadDefinedDestinations($directory, &$destinations) {
|
||||
|
||||
try {
|
||||
foreach (new \DirectoryIterator($directory) as $fileInfo) {
|
||||
|
||||
if ($fileInfo->isDot()) continue;
|
||||
|
||||
$matches = array();
|
||||
|
||||
if (preg_match("/([^\.]+)\.php/", $fileInfo->getFilename(), $matches)) {
|
||||
|
||||
$classname = $matches[1];
|
||||
|
||||
if (! isset($destinations[$classname])) {
|
||||
|
||||
$full_class_name = "Thelia\\Log\\Destination\\".$classname;
|
||||
|
||||
$destinations[$classname] = new $full_class_name();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (\UnexpectedValueException $ex) {
|
||||
// Directory does no exists -> Nothing to do
|
||||
}
|
||||
}
|
||||
|
||||
public function defaultAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::SYSTEM_LOG, AccessManager::VIEW)) return $response;
|
||||
|
||||
/*
|
||||
const VAR_LEVEL = "tlog_level";
|
||||
const VAR_DESTINATIONS = "tlog_destinations";
|
||||
const VAR_PREFIXE = "tlog_prefix";
|
||||
const VAR_FILES = "tlog_files";
|
||||
const VAR_IP = "tlog_ip";
|
||||
const VAR_SHOW_REDIRECT = "tlog_show_redirect";
|
||||
|
||||
const DEFAULT_LEVEL = self::DEBUG;
|
||||
const DEFAUT_DESTINATIONS = "Thelia\Log\Destination\TlogDestinationFile";
|
||||
const DEFAUT_PREFIXE = "#NUM: #NIVEAU [#FICHIER:#FONCTION()] {#LIGNE} #DATE #HEURE: ";
|
||||
const DEFAUT_FILES = "*";
|
||||
const DEFAUT_IP = "";
|
||||
const DEFAUT_SHOW_REDIRECT = 0;
|
||||
|
||||
*/
|
||||
|
||||
// Hydrate the general configuration form
|
||||
$systemLogForm = new SystemLogConfigurationForm($this->getRequest(), 'form', array(
|
||||
'level' => ConfigQuery::read(Tlog::VAR_LEVEL, Tlog::DEFAULT_LEVEL),
|
||||
'format' => ConfigQuery::read(Tlog::VAR_PREFIXE, Tlog::DEFAUT_PREFIXE),
|
||||
'show_redirections' => ConfigQuery::read(Tlog::VAR_SHOW_REDIRECT, Tlog::DEFAUT_SHOW_REDIRECT),
|
||||
'files' => ConfigQuery::read(Tlog::VAR_FILES, Tlog::DEFAUT_FILES),
|
||||
'ip_addresses' => ConfigQuery::read(Tlog::VAR_IP, Tlog::DEFAUT_IP),
|
||||
));
|
||||
|
||||
$this->getParserContext()->addForm($systemLogForm);
|
||||
|
||||
return $this->renderTemplate();
|
||||
}
|
||||
|
||||
public function saveAction()
|
||||
{
|
||||
if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, AccessManager::UPDATE)) return $response;
|
||||
|
||||
$error_msg = false;
|
||||
|
||||
$systemLogForm = new SystemLogConfigurationForm($this->getRequest());
|
||||
|
||||
try {
|
||||
$form = $this->validateForm($systemLogForm);
|
||||
|
||||
$data = $form->getData();
|
||||
|
||||
ConfigQuery::write(Tlog::VAR_LEVEL , $data['level']);
|
||||
ConfigQuery::write(Tlog::VAR_PREFIXE , $data['format']);
|
||||
ConfigQuery::write(Tlog::VAR_SHOW_REDIRECT , $data['show_redirections']);
|
||||
ConfigQuery::write(Tlog::VAR_FILES , $data['files']);
|
||||
ConfigQuery::write(Tlog::VAR_IP , $data['ip_addresses']);
|
||||
|
||||
// Save destination configuration
|
||||
$destinations = $this->getRequest()->get('destinations');
|
||||
$configs = $this->getRequest()->get('config');
|
||||
|
||||
$active_destinations = array();
|
||||
|
||||
foreach($destinations as $classname => $destination) {
|
||||
|
||||
if (isset($destination['active'])) {
|
||||
$active_destinations[] = $destination['classname'];
|
||||
}
|
||||
|
||||
if (isset($configs[$classname])) {
|
||||
|
||||
// Update destinations configuration
|
||||
foreach($configs[$classname] as $var => $value) {
|
||||
ConfigQuery::write($var, $value, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update active destinations list
|
||||
ConfigQuery::write(Tlog::VAR_DESTINATIONS, implode(';', $active_destinations));
|
||||
|
||||
$this->adminLogAppend(AdminResources::SYSTEM_LOG, AccessManager::UPDATE, "System log configuration changed");
|
||||
|
||||
$this->redirectToRoute('admin.configuration.system-logs.default');
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$error_msg = $ex->getMessage();
|
||||
}
|
||||
|
||||
$this->setupFormErrorContext(
|
||||
$this->getTranslator()->trans("System log configuration failed."),
|
||||
$error_msg,
|
||||
$systemLogForm,
|
||||
$ex
|
||||
);
|
||||
|
||||
return $this->renderTemplate();
|
||||
}
|
||||
}
|
||||
@@ -279,7 +279,7 @@ class TaxRuleController extends AbstractCrudController
|
||||
|
||||
// Log object modification
|
||||
if (null !== $changedObject = $this->getObjectFromEvent($changeEvent)) {
|
||||
$this->adminLogAppend(sprintf("%s %s (ID %s) modified", ucfirst($this->objectName), $this->getObjectLabel($changedObject), $this->getObjectId($changedObject)));
|
||||
$this->adminLogAppend($this->resourceCode, AccessManager::UPDATE, sprintf("%s %s (ID %s) modified", ucfirst($this->objectName), $this->getObjectLabel($changedObject), $this->getObjectId($changedObject)));
|
||||
}
|
||||
|
||||
if ($response == null) {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Thelia\Core\HttpFoundation\Response;
|
||||
use Symfony\Component\DependencyInjection\ContainerAware;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
@@ -58,7 +58,7 @@ class BaseController extends ContainerAware
|
||||
/**
|
||||
* Return an empty response (after an ajax request, for example)
|
||||
* @param int $status
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
* @return \Thelia\Core\HttpFoundation\Response
|
||||
*/
|
||||
protected function nullResponse($status = 200)
|
||||
{
|
||||
|
||||
@@ -31,6 +31,7 @@ use Thelia\Core\DependencyInjection\Compiler\RegisterListenersPass;
|
||||
use Thelia\Core\DependencyInjection\Compiler\RegisterParserPluginPass;
|
||||
use Thelia\Core\DependencyInjection\Compiler\RegisterRouterPass;
|
||||
use Thelia\Core\DependencyInjection\Compiler\RegisterCouponConditionPass;
|
||||
use Thelia\Core\DependencyInjection\Compiler\TranslatorPass;
|
||||
|
||||
/**
|
||||
* First Bundle use in Thelia
|
||||
@@ -59,10 +60,12 @@ class TheliaBundle extends Bundle
|
||||
$container->addScope(new Scope('request'));
|
||||
|
||||
$container
|
||||
->addCompilerPass(new TranslatorPass())
|
||||
->addCompilerPass(new RegisterListenersPass())
|
||||
->addCompilerPass(new RegisterParserPluginPass())
|
||||
->addCompilerPass(new RegisterRouterPass())
|
||||
->addCompilerPass(new RegisterCouponPass())
|
||||
->addCompilerPass(new RegisterCouponConditionPass());
|
||||
->addCompilerPass(new RegisterCouponConditionPass())
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace Thelia\Core\Controller;
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerResolver as BaseControllerResolver;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* ControllerResolver that supports "a:b:c", "service:method" and class::method" notations in routes definition
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\DependencyInjection\Compiler;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
|
||||
/**
|
||||
* Class TranslatorPass
|
||||
* @package Thelia\Core\DependencyInjection\Compiler
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class TranslatorPass implements CompilerPassInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* You can modify the container here before it is dumped to PHP code.
|
||||
*
|
||||
* @param ContainerBuilder $container
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasDefinition('thelia.translator')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$translator = $container->getDefinition('thelia.translator');
|
||||
|
||||
foreach($container->findTaggedServiceIds('translation.loader') as $id => $attributes) {
|
||||
$translator->addMethodCall('addLoader', array($attributes[0]['alias'], new Reference($id)));
|
||||
if (isset($attributes[0]['legacy-alias'])) {
|
||||
$translator->addMethodCall('addLoader', array($attributes[0]['legacy-alias'], new Reference($id)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event\Administrator;
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
use Thelia\Model\Admin;
|
||||
|
||||
|
||||
/**
|
||||
* Class AdministratorUpdatePasswordEvent
|
||||
* @package Thelia\Core\Event\Administrator
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class AdministratorUpdatePasswordEvent extends ActionEvent
|
||||
{
|
||||
|
||||
/**
|
||||
* @var \Thelia\Model\Admin
|
||||
*/
|
||||
protected $admin;
|
||||
|
||||
/**
|
||||
* @var string new administrator password
|
||||
*/
|
||||
protected $password;
|
||||
|
||||
public function __construct(Admin $admin)
|
||||
{
|
||||
$this->admin = $admin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $password
|
||||
*/
|
||||
public function setPassword($password)
|
||||
{
|
||||
$this->password = $password;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPassword()
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Thelia\Model\Admin $admin
|
||||
*/
|
||||
public function setAdmin(Admin $admin)
|
||||
{
|
||||
$this->admin = $admin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Thelia\Model\Admin
|
||||
*/
|
||||
public function getAdmin()
|
||||
{
|
||||
return $this->admin;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
183
core/lib/Thelia/Core/Event/MailingSystem/MailingSystemEvent.php
Normal file
183
core/lib/Thelia/Core/Event/MailingSystem/MailingSystemEvent.php
Normal file
@@ -0,0 +1,183 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event\MailingSystem;
|
||||
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
|
||||
class MailingSystemEvent extends ActionEvent
|
||||
{
|
||||
protected $enabled = null;
|
||||
protected $host = null;
|
||||
protected $port = null;
|
||||
protected $encryption = null;
|
||||
protected $username = null;
|
||||
protected $password = null;
|
||||
protected $authMode = null;
|
||||
protected $timeout = null;
|
||||
protected $sourceIp = null;
|
||||
|
||||
/**
|
||||
* @param null $authMode
|
||||
*/
|
||||
public function setAuthMode($authMode)
|
||||
{
|
||||
$this->authMode = $authMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function getAuthMode()
|
||||
{
|
||||
return $this->authMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $enabled
|
||||
*/
|
||||
public function setEnabled($enabled)
|
||||
{
|
||||
$this->enabled = $enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function getEnabled()
|
||||
{
|
||||
return $this->enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $encryption
|
||||
*/
|
||||
public function setEncryption($encryption)
|
||||
{
|
||||
$this->encryption = $encryption;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function getEncryption()
|
||||
{
|
||||
return $this->encryption;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $host
|
||||
*/
|
||||
public function setHost($host)
|
||||
{
|
||||
$this->host = $host;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function getHost()
|
||||
{
|
||||
return $this->host;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $password
|
||||
*/
|
||||
public function setPassword($password)
|
||||
{
|
||||
$this->password = $password;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function getPassword()
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $port
|
||||
*/
|
||||
public function setPort($port)
|
||||
{
|
||||
$this->port = $port;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function getPort()
|
||||
{
|
||||
return $this->port;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $sourceIp
|
||||
*/
|
||||
public function setSourceIp($sourceIp)
|
||||
{
|
||||
$this->sourceIp = $sourceIp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function getSourceIp()
|
||||
{
|
||||
return $this->sourceIp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $timeout
|
||||
*/
|
||||
public function setTimeout($timeout)
|
||||
{
|
||||
$this->timeout = $timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function getTimeout()
|
||||
{
|
||||
return $this->timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $username
|
||||
*/
|
||||
public function setUsername($username)
|
||||
{
|
||||
$this->username = $username;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function getUsername()
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event\Product;
|
||||
use Thelia\Model\Product;
|
||||
|
||||
class ProductCombinationGenerationEvent extends ProductEvent
|
||||
{
|
||||
protected $reference;
|
||||
protected $price;
|
||||
protected $currency_id;
|
||||
protected $weight;
|
||||
protected $quantity;
|
||||
protected $sale_price;
|
||||
protected $onsale;
|
||||
protected $isnew;
|
||||
protected $ean_code;
|
||||
protected $combinations;
|
||||
|
||||
public function __construct(Product $product, $currency_id, $combinations)
|
||||
{
|
||||
parent::__construct($product);
|
||||
|
||||
$this->setCombinations($combinations);
|
||||
$this->setCurrencyId($currency_id);
|
||||
}
|
||||
|
||||
public function getCurrencyId()
|
||||
{
|
||||
return $this->currency_id;
|
||||
}
|
||||
|
||||
public function setCurrencyId($currency_id)
|
||||
{
|
||||
$this->currency_id = $currency_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getReference()
|
||||
{
|
||||
return $this->reference;
|
||||
}
|
||||
|
||||
public function setReference($reference)
|
||||
{
|
||||
$this->reference = $reference;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPrice()
|
||||
{
|
||||
return $this->price;
|
||||
}
|
||||
|
||||
public function setPrice($price)
|
||||
{
|
||||
$this->price = $price;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getWeight()
|
||||
{
|
||||
return $this->weight;
|
||||
}
|
||||
|
||||
public function setWeight($weight)
|
||||
{
|
||||
$this->weight = $weight;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getQuantity()
|
||||
{
|
||||
return $this->quantity;
|
||||
}
|
||||
|
||||
public function setQuantity($quantity)
|
||||
{
|
||||
$this->quantity = $quantity;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSalePrice()
|
||||
{
|
||||
return $this->sale_price;
|
||||
}
|
||||
|
||||
public function setSalePrice($sale_price)
|
||||
{
|
||||
$this->sale_price = $sale_price;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getOnsale()
|
||||
{
|
||||
return $this->onsale;
|
||||
}
|
||||
|
||||
public function setOnsale($onsale)
|
||||
{
|
||||
$this->onsale = $onsale;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getIsnew()
|
||||
{
|
||||
return $this->isnew;
|
||||
}
|
||||
|
||||
public function setIsnew($isnew)
|
||||
{
|
||||
$this->isnew = $isnew;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEanCode()
|
||||
{
|
||||
return $this->ean_code;
|
||||
}
|
||||
|
||||
public function setEanCode($ean_code)
|
||||
{
|
||||
$this->ean_code = $ean_code;
|
||||
return $this;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCombinations()
|
||||
{
|
||||
return $this->combinations;
|
||||
}
|
||||
|
||||
public function setCombinations($combinations)
|
||||
{
|
||||
$this->combinations = $combinations;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -285,6 +285,8 @@ final class TheliaEvents
|
||||
const PRODUCT_DELETE_PRODUCT_SALE_ELEMENT = "action.deleteProductSaleElement";
|
||||
const PRODUCT_UPDATE_PRODUCT_SALE_ELEMENT = "action.updateProductSaleElement";
|
||||
|
||||
const PRODUCT_COMBINATION_GENERATION = "action.productCombineationGeneration";
|
||||
|
||||
const PRODUCT_SET_TEMPLATE = "action.productSetTemplate";
|
||||
|
||||
const PRODUCT_ADD_ACCESSORY = "action.productAddProductAccessory";
|
||||
@@ -565,6 +567,11 @@ final class TheliaEvents
|
||||
const ADMINISTRATOR_CREATE = "action.createAdministrator";
|
||||
const ADMINISTRATOR_UPDATE = "action.updateAdministrator";
|
||||
const ADMINISTRATOR_DELETE = "action.deleteAdministrator";
|
||||
const ADMINISTRATOR_UPDATEPASSWORD = 'action.generatePassword';
|
||||
|
||||
// -- Mailing System management ---------------------------------------------
|
||||
|
||||
const MAILING_SYSTEM_UPDATE = "action.updateMailingSystem";
|
||||
|
||||
// -- Tax Rules management ---------------------------------------------
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Thelia\Core\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Router;
|
||||
use Thelia\Core\Template\Exception\ResourceNotFoundException;
|
||||
use Thelia\Core\Template\ParserInterface;
|
||||
|
||||
48
core/lib/Thelia/Core/HttpFoundation/Response.php
Normal file
48
core/lib/Thelia/Core/HttpFoundation/Response.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Core\HttpFoundation;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response as BaseResponse;
|
||||
use Thelia\Log\Tlog;
|
||||
|
||||
/**
|
||||
* extends Thelia\Core\HttpFoundation\Response for adding some helpers
|
||||
*
|
||||
* Class Response
|
||||
* @package Thelia\Core\HttpFoundation
|
||||
* @author Franck Allimant <franck@cqfdev.fr>
|
||||
*/
|
||||
class Response extends BaseResponse
|
||||
{
|
||||
/**
|
||||
* Allow Tlog to write log stuff in the fina content.
|
||||
*
|
||||
* @see \Thelia\Core\HttpFoundation\Response::sendContent()
|
||||
*/
|
||||
public function sendContent() {
|
||||
|
||||
Tlog::getInstance()->write($this->content);
|
||||
|
||||
parent::sendContent();
|
||||
}
|
||||
}
|
||||
@@ -97,4 +97,6 @@ final class AdminResources
|
||||
const TAX = "admin.configuration.tax";
|
||||
|
||||
const TEMPLATE = "admin.configuration.template";
|
||||
|
||||
const SYSTEM_LOG = "admin.configuration.system-log";
|
||||
}
|
||||
|
||||
@@ -128,14 +128,17 @@ class AttributeAvailability extends BaseI18nLoop
|
||||
|
||||
foreach ($attributesAv as $attributeAv) {
|
||||
$loopResultRow = new LoopResultRow($loopResult, $attributeAv, $this->versionable, $this->timestampable, $this->countable);
|
||||
$loopResultRow->set("ID", $attributeAv->getId())
|
||||
->set("IS_TRANSLATED",$attributeAv->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE",$locale)
|
||||
->set("TITLE",$attributeAv->getVirtualColumn('i18n_TITLE'))
|
||||
->set("CHAPO", $attributeAv->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("DESCRIPTION", $attributeAv->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
->set("POSTSCRIPTUM", $attributeAv->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||
->set("POSITION", $attributeAv->getPosition());
|
||||
$loopResultRow
|
||||
->set("ID" , $attributeAv->getId())
|
||||
->set("ATTRIBUTE_ID" , $attributeAv->getAttributeId())
|
||||
->set("IS_TRANSLATED", $attributeAv->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE" , $locale)
|
||||
->set("TITLE" , $attributeAv->getVirtualColumn('i18n_TITLE'))
|
||||
->set("CHAPO" , $attributeAv->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("DESCRIPTION" , $attributeAv->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
->set("POSTSCRIPTUM" , $attributeAv->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||
->set("POSITION" , $attributeAv->getPosition())
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ use Thelia\Core\Template\Element\LoopResultRow;
|
||||
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Tools\DateTimeFormat;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -90,15 +91,15 @@ class Feed extends BaseLoop
|
||||
$author = $item->get_author();
|
||||
$description = $item->get_description();
|
||||
|
||||
$date = $item->get_date('d/m/Y');
|
||||
|
||||
$loopResultRow = new LoopResultRow($loopResult, null, $this->versionable, $this->timestampable, $this->countable);
|
||||
|
||||
$loopResultRow->set("URL", $item->get_permalink());
|
||||
$loopResultRow->set("TITLE", $item->get_title());
|
||||
$loopResultRow->set("AUTHOR", $item->get_author());
|
||||
$loopResultRow->set("DESCRIPTION", $item->get_description());
|
||||
$loopResultRow->set("DATE", $item->get_date('d/m/Y')); // FIXME - date format should be an intl parameter
|
||||
$loopResultRow
|
||||
->set("URL" , $item->get_permalink())
|
||||
->set("TITLE" , $item->get_title())
|
||||
->set("AUTHOR" , $item->get_author())
|
||||
->set("DESCRIPTION" , $item->get_description())
|
||||
->set("DATE" , $item->get_date('U')) // FIXME - date format should be an intl parameter
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
108
core/lib/Thelia/Core/Template/Loop/ProductTemplate.php
Normal file
108
core/lib/Thelia/Core/Template/Loop/ProductTemplate.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Template\Loop;
|
||||
|
||||
use Propel\Runtime\ActiveQuery\Criteria;
|
||||
use Thelia\Core\Template\Element\BaseI18nLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
|
||||
use Thelia\Model\Base\TemplateQuery;
|
||||
|
||||
/**
|
||||
*
|
||||
* Template loop
|
||||
*
|
||||
*
|
||||
* Class Template
|
||||
* @package Thelia\Core\Template\Loop
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*/
|
||||
class ProductTemplate extends BaseI18nLoop
|
||||
{
|
||||
public $timestampable = true;
|
||||
|
||||
/**
|
||||
* @return ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntListTypeArgument('id'),
|
||||
Argument::createIntListTypeArgument('exclude')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $pagination
|
||||
*
|
||||
* @return \Thelia\Core\Template\Element\LoopResult
|
||||
*/
|
||||
public function exec(&$pagination)
|
||||
{
|
||||
$search = TemplateQuery::create();
|
||||
|
||||
$backendContext = $this->getBackend_context();
|
||||
|
||||
$lang = $this->getLang();
|
||||
|
||||
/* manage translations */
|
||||
$locale = $this->configureI18nProcessing($search, $columns = array('NAME'));
|
||||
|
||||
$id = $this->getId();
|
||||
|
||||
if (null !== $id) {
|
||||
$search->filterById($id, Criteria::IN);
|
||||
}
|
||||
|
||||
$exclude = $this->getExclude();
|
||||
|
||||
if (null !== $exclude) {
|
||||
$search->filterById($exclude, Criteria::NOT_IN);
|
||||
}
|
||||
|
||||
/* perform search */
|
||||
$templates = $this->search($search, $pagination);
|
||||
|
||||
$loopResult = new LoopResult($templates);
|
||||
|
||||
foreach ($templates as $template) {
|
||||
$loopResultRow = new LoopResultRow($loopResult, $template, $this->versionable, $this->timestampable, $this->countable);
|
||||
|
||||
$loopResultRow
|
||||
->set("ID", $template->getId())
|
||||
->set("IS_TRANSLATED" , $template->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE" , $locale)
|
||||
->set("NAME" , $template->getVirtualColumn('i18n_NAME'))
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,8 @@ use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
|
||||
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
|
||||
use Thelia\Tools\URL;
|
||||
use Thelia\Core\Security\SecurityContext;
|
||||
use Thelia\Model\Config;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
|
||||
/**
|
||||
* This class implements variour admin template utilities
|
||||
@@ -42,6 +44,26 @@ class AdminUtilities extends AbstractSmartyPlugin
|
||||
$this->securityContext = $securityContext;
|
||||
}
|
||||
|
||||
protected function fetch_snippet($smarty, $templateName, $variablesArray) {
|
||||
|
||||
$data = '';
|
||||
|
||||
$snippet_path = sprintf('%s/%s/%s.html',
|
||||
THELIA_TEMPLATE_DIR,
|
||||
ConfigQuery::read('base-admin-template', 'admin/default'),
|
||||
$templateName
|
||||
);
|
||||
|
||||
if (false !== $snippet_content = file_get_contents($snippet_path)) {
|
||||
|
||||
$smarty->assign($variablesArray);
|
||||
|
||||
$data = $smarty->fetch(sprintf('string:%s', $snippet_content));
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function generatePositionChangeBlock($params, &$smarty)
|
||||
{
|
||||
// The required permissions
|
||||
@@ -70,15 +92,15 @@ class AdminUtilities extends AbstractSmartyPlugin
|
||||
*/
|
||||
|
||||
if ($permissions == null || $this->securityContext->isGranted("ADMIN", array($resource), array($access))) {
|
||||
return sprintf(
|
||||
'<a href="%s"><i class="glyphicon glyphicon-arrow-up"></i></a><span class="%s" data-id="%s">%s</span><a href="%s"><i class="glyphicon glyphicon-arrow-down"></i></a>',
|
||||
URL::getInstance()->absoluteUrl($path, array('mode' => 'up', $url_parameter => $id)),
|
||||
$in_place_edit_class,
|
||||
$id,
|
||||
$position,
|
||||
URL::getInstance()->absoluteUrl($path, array('mode' => 'down', $url_parameter => $id))
|
||||
);
|
||||
} else {
|
||||
|
||||
return $this->fetch_snippet($smarty, 'includes/admin-utilities-position-block', array(
|
||||
'admin_utilities_go_up_url' => URL::getInstance()->absoluteUrl($path, array('mode' => 'up', $url_parameter => $id)),
|
||||
'admin_utilities_in_place_edit_class' => $in_place_edit_class,
|
||||
'admin_utilities_object_id' => $id,
|
||||
'admin_utilities_current_position' => $position,
|
||||
'admin_utilities_go_down_url' => URL::getInstance()->absoluteUrl($path, array('mode' => 'down', $url_parameter => $id))
|
||||
));
|
||||
} else {
|
||||
return $position;
|
||||
}
|
||||
}
|
||||
@@ -111,21 +133,20 @@ class AdminUtilities extends AbstractSmartyPlugin
|
||||
$request_parameter_name = $this->getParam($params, 'request_parameter_name', 'order');
|
||||
|
||||
if ($current_order == $order) {
|
||||
$icon = 'up';
|
||||
$sort_direction = 'up';
|
||||
$order_change = $reverse_order;
|
||||
} elseif ($current_order == $reverse_order) {
|
||||
$icon = 'down';
|
||||
$sort_direction = 'down';
|
||||
$order_change = $order;
|
||||
} else {
|
||||
$order_change = $order;
|
||||
}
|
||||
|
||||
if (! empty($icon))
|
||||
$output = sprintf('<i class="glyphicon glyphicon-chevron-%s"></i> ', $icon);
|
||||
else
|
||||
$output = '';
|
||||
|
||||
return sprintf('%s<a href="%s">%s</a>', $output, URL::getInstance()->absoluteUrl($path, array($request_parameter_name => $order_change)), $label);
|
||||
return $this->fetch_snippet($smarty, 'includes/admin-utilities-sortable-column-header', array(
|
||||
'admin_utilities_sort_direction' => $sort_direction,
|
||||
'admin_utilities_sorting_url' => URL::getInstance()->absoluteUrl($path, array($request_parameter_name => $order_change)),
|
||||
'admin_utilities_header_text' => $label
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,7 +43,17 @@ class Assetic extends AbstractSmartyPlugin
|
||||
|
||||
public function blockJavascripts($params, $content, \Smarty_Internal_Template $template, &$repeat)
|
||||
{
|
||||
return $this->assetManager->processSmartyPluginCall('js', $params, $content, $template, $repeat);
|
||||
try {
|
||||
return $this->assetManager->processSmartyPluginCall('js', $params, $content, $template, $repeat);
|
||||
} catch(\Exception $e) {
|
||||
$catchException = $this->getNormalizedParam($params, array('catchException'));
|
||||
if($catchException == "true") {
|
||||
$repeat = false;
|
||||
return null;
|
||||
} else {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function blockImages($params, $content, \Smarty_Internal_Template $template, &$repeat)
|
||||
|
||||
@@ -238,13 +238,13 @@ class DataAccessFunctions extends AbstractSmartyPlugin
|
||||
|
||||
public function ConfigDataAccess($params, $smarty)
|
||||
{
|
||||
if (false === array_key_exists("key", $params)) {
|
||||
return null;
|
||||
}
|
||||
$key = $this->getParam($params, 'key', false);
|
||||
|
||||
$key = $params['key'];
|
||||
if ($key === false) return null;
|
||||
|
||||
return ConfigQuery::read($key);
|
||||
$default = $this->getParam($params, 'default', '');
|
||||
|
||||
return ConfigQuery::read($key, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -74,13 +74,18 @@ class FlashMessage extends AbstractSmartyPlugin
|
||||
public function getFlashMessage($params, $content, \Smarty_Internal_Template $template, &$repeat)
|
||||
{
|
||||
if ($repeat) {
|
||||
$key = $params['key'];
|
||||
$flashBag = $this->request->getSession()->get('flashMessage');
|
||||
$template->assign('value', $flashBag[$key]);
|
||||
|
||||
// Reset flash message (can be read once)
|
||||
unset($flashBag[$key]);
|
||||
$this->request->getSession()->set('flashMessage', $flashBag);
|
||||
if (false !== $key = $this->getParam($params, 'key', false)) {
|
||||
|
||||
$flashBag = $this->request->getSession()->get('flashMessage');
|
||||
|
||||
$template->assign('value', $flashBag[$key]);
|
||||
|
||||
// Reset flash message (can be read once)
|
||||
unset($flashBag[$key]);
|
||||
|
||||
$this->request->getSession()->set('flashMessage', $flashBag);
|
||||
}
|
||||
} else {
|
||||
return $content;
|
||||
}
|
||||
|
||||
@@ -199,30 +199,29 @@ class Form extends AbstractSmartyPlugin
|
||||
{
|
||||
if ($repeat) {
|
||||
|
||||
$formFieldView = $this->getFormFieldView($params);
|
||||
$formFieldConfig = $this->getFormFieldConfig($params);
|
||||
$formFieldView = $this->getFormFieldView($params);
|
||||
$formFieldConfig = $this->getFormFieldConfig($params);
|
||||
|
||||
$this->assignFormTypeValues($template, $formFieldConfig, $formFieldView);
|
||||
$this->assignFormTypeValues($template, $formFieldConfig, $formFieldView);
|
||||
|
||||
$value = $formFieldView->vars["value"];
|
||||
|
||||
// We have a collection
|
||||
if (0 < $value_count = count($formFieldView->children)) {
|
||||
$key = $this->getParam($params, 'value_key', null);
|
||||
|
||||
$key = $this->getParam($params, 'value_key', null);
|
||||
// We (may) have a collection
|
||||
if ($key !== null) {
|
||||
|
||||
if ($key !== null) {
|
||||
// If the field is not found, use an empty value
|
||||
$val = array_key_exists($key, $value) ? $value[$key] : '';
|
||||
// Force array
|
||||
if (! is_array($value)) $value = array();
|
||||
|
||||
$name = sprintf("%s[%s]", $formFieldView->vars["full_name"], $key);
|
||||
// If the field is not found, use an empty value
|
||||
$val = array_key_exists($key, $value) ? $value[$key] : '';
|
||||
|
||||
$val = $value[$key];
|
||||
$name = sprintf("%s[%s]", $formFieldView->vars["full_name"], $key);
|
||||
|
||||
$this->assignFieldValues($template, $name, $val, $formFieldView->vars, $value_count);
|
||||
} else {
|
||||
throw new \InvalidArgumentException(sprintf("Missing or empty parameter 'value_key' for field '%s'", $formFieldView->vars["name"]));
|
||||
}
|
||||
$val = $value[$key];
|
||||
|
||||
$this->assignFieldValues($template, $name, $val, $formFieldView->vars, count($formFieldView->children));
|
||||
} else {
|
||||
$this->assignFieldValues($template, $formFieldView->vars["full_name"], $formFieldView->vars["value"], $formFieldView->vars);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,17 @@ class Format extends AbstractSmartyPlugin
|
||||
$date = $this->getParam($params, "date", false);
|
||||
|
||||
if ($date === false) {
|
||||
return "";
|
||||
|
||||
// Check if we have a timestamp
|
||||
$timestamp = $this->getParam($params, "timestamp", false);
|
||||
|
||||
if ($timestamp === false) {
|
||||
// No timestamp => error
|
||||
throw new SmartyPluginException("Either date or timestamp is a mandatory parameter in format_date function");
|
||||
} else {
|
||||
$date = new \DateTime();
|
||||
$date->setTimestamp($timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
if (!($date instanceof \DateTime)) {
|
||||
@@ -87,7 +97,6 @@ class Format extends AbstractSmartyPlugin
|
||||
}
|
||||
|
||||
return $date->format($format);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace Thelia\Core\Template\Smarty\Plugins;
|
||||
|
||||
use Thelia\Core\Template\Smarty\SmartyPluginDescriptor;
|
||||
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
|
||||
use Thelia\Model\ModuleQuery;
|
||||
|
||||
class Module extends AbstractSmartyPlugin
|
||||
{
|
||||
@@ -32,12 +33,32 @@ class Module extends AbstractSmartyPlugin
|
||||
* Process theliaModule template inclusion function
|
||||
*
|
||||
* @param unknown $params
|
||||
* @param unknown $smarty
|
||||
* @param \Smarty_Internal_Template $template
|
||||
* @internal param \Thelia\Core\Template\Smarty\Plugins\unknown $smarty
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function theliaModule($params, &$smarty)
|
||||
public function theliaModule($params, \Smarty_Internal_Template $template)
|
||||
{
|
||||
// TODO
|
||||
$content = null;
|
||||
|
||||
if (false !== $location = $this->getParam($params, 'location', false)) {
|
||||
|
||||
$modules = ModuleQuery::getActivated();
|
||||
|
||||
foreach ($modules as $module) {
|
||||
|
||||
$file = sprintf("%s/%s/AdminIncludes/%s.html", THELIA_MODULE_DIR, ucfirst($module->getCode()), $location);
|
||||
|
||||
if (file_exists($file)) {
|
||||
$content .= file_get_contents($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($content))
|
||||
return $template->fetch(sprintf("string:%s", $content));
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ use \Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
use \Smarty;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Thelia\Core\HttpFoundation\Response;
|
||||
use Thelia\Core\Template\ParserInterface;
|
||||
|
||||
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
|
||||
@@ -70,8 +70,14 @@ class SmartyParser extends Smarty implements ParserInterface
|
||||
$this->error_reporting = E_ALL ^ E_NOTICE;
|
||||
|
||||
// Si on n'est pas en mode debug, activer le cache, avec une lifetime de 15mn, et en vérifiant que les templates sources n'ont pas été modifiés.
|
||||
$this->caching = Smarty::CACHING_OFF;
|
||||
$this->force_compile = true;
|
||||
|
||||
if($debug) {
|
||||
$this->setCaching(Smarty::CACHING_OFF);
|
||||
$this->setForceCompile(true);
|
||||
} else {
|
||||
$this->setForceCompile(false);
|
||||
}
|
||||
|
||||
|
||||
// The default HTTP status
|
||||
$this->status = 200;
|
||||
@@ -149,7 +155,7 @@ class SmartyParser extends Smarty implements ParserInterface
|
||||
*
|
||||
* set $content with the body of the response or the Response object directly
|
||||
*
|
||||
* @param string|Symfony\Component\HttpFoundation\Response $content
|
||||
* @param string|Thelia\Core\HttpFoundation\Response $content
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace Thelia\Core;
|
||||
use Propel\Runtime\Connection\ConnectionWrapper;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
@@ -46,6 +47,7 @@ use Thelia\Config\DatabaseConfiguration;
|
||||
use Thelia\Config\DefinePropel;
|
||||
use Thelia\Core\TheliaContainerBuilder;
|
||||
use Thelia\Core\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
|
||||
use Propel\Runtime\Propel;
|
||||
@@ -67,7 +69,7 @@ class Thelia extends Kernel
|
||||
|
||||
protected function initPropel()
|
||||
{
|
||||
if (file_exists(THELIA_ROOT . '/local/config/database.yml') === false) {
|
||||
if (file_exists(THELIA_CONF_DIR . 'database.yml') === false) {
|
||||
return ;
|
||||
}
|
||||
|
||||
@@ -94,7 +96,7 @@ class Thelia extends Kernel
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
if (file_exists(THELIA_ROOT . '/local/config/database.yml') === true) {
|
||||
if (file_exists(THELIA_CONF_DIR . 'database.yml') === true) {
|
||||
$this->getContainer()->get("event_dispatcher")->dispatch(TheliaEvents::BOOT);
|
||||
}
|
||||
|
||||
@@ -110,12 +112,19 @@ class Thelia extends Kernel
|
||||
{
|
||||
|
||||
$loader = new XmlFileLoader($container, new FileLocator(THELIA_ROOT . "/core/lib/Thelia/Config/Resources"));
|
||||
$loader->load("config.xml");
|
||||
$loader->load("routing.xml");
|
||||
$loader->load("action.xml");
|
||||
$finder = Finder::create()
|
||||
->name('*.xml')
|
||||
->depth(0)
|
||||
->in(THELIA_ROOT . "/core/lib/Thelia/Config/Resources");
|
||||
|
||||
foreach($finder as $file) {
|
||||
$loader->load($file->getBaseName());
|
||||
}
|
||||
|
||||
if (defined("THELIA_INSTALL_MODE") === false) {
|
||||
$modules = \Thelia\Model\ModuleQuery::getActivated();
|
||||
|
||||
$translator = $container->getDefinition('thelia.translator');
|
||||
$dirs = array();
|
||||
foreach ($modules as $module) {
|
||||
|
||||
try {
|
||||
@@ -131,10 +140,41 @@ class Thelia extends Kernel
|
||||
|
||||
$loader = new XmlFileLoader($container, new FileLocator(THELIA_MODULE_DIR . "/" . ucfirst($module->getCode()) . "/Config"));
|
||||
$loader->load("config.xml");
|
||||
|
||||
if (is_dir($dir = THELIA_MODULE_DIR . "/" . ucfirst($module->getCode()) . "/I18n")) {
|
||||
$dirs[] = $dir;
|
||||
}
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
// FIXME: process module configuration exception
|
||||
}
|
||||
}
|
||||
|
||||
//Load translation from templates
|
||||
//core translation
|
||||
$dirs[] = THELIA_ROOT . "/core/lib/Thelia/Config/I18n";
|
||||
|
||||
//admin template
|
||||
if(is_dir($dir = THELIA_TEMPLATE_DIR . '/admin/default/I18n')) {
|
||||
$dirs[] = $dir;
|
||||
}
|
||||
|
||||
//front template
|
||||
$template = ConfigQuery::getActiveTemplate();
|
||||
if(is_dir($dir = THELIA_TEMPLATE_DIR . $template . "/I18n")) {
|
||||
$dirs[] = $dir;
|
||||
}
|
||||
|
||||
if ($dirs) {
|
||||
$finder = Finder::create()
|
||||
->files()
|
||||
->depth(0)
|
||||
->in($dirs);
|
||||
|
||||
foreach ($finder as $file) {
|
||||
list($locale, $format) = explode('.', $file->getBaseName(), 2);
|
||||
$translator->addMethodCall('addResource', array($format, (string) $file, $locale));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,28 @@
|
||||
<?php
|
||||
namespace Thelia\Core\Translation;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\Translation\Translator as BaseTranslator;
|
||||
|
||||
class Translator extends BaseTranslator
|
||||
{
|
||||
/**
|
||||
* @var \Symfony\Component\DependencyInjection\ContainerInterface
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
protected static $instance = null;
|
||||
|
||||
public function __construct()
|
||||
/**
|
||||
* @param ContainerInterface $container
|
||||
*/
|
||||
public function __construct(ContainerInterface $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
// Allow singleton style calls once intanciated.
|
||||
// For this to work, the Translator service has to be instanciated very early. This is done manually
|
||||
// in TheliaHttpKernel, by calling $this->container->get('thelia.translator');
|
||||
parent::__construct(null);
|
||||
self::$instance = $this;
|
||||
}
|
||||
|
||||
@@ -28,6 +38,11 @@ class Translator extends BaseTranslator
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
public function getLocale()
|
||||
{
|
||||
return $this->container->get('request')->getSession()->getLang()->getLocale();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
|
||||
@@ -46,7 +46,7 @@ class CouponExpiredException extends \Exception
|
||||
public function __construct($couponCode)
|
||||
{
|
||||
$message = 'Expired Coupon ' . $couponCode . 'attempt';
|
||||
Tlog::getInstance()->addInfo($message);
|
||||
Tlog::getInstance()->addWarning($message);
|
||||
|
||||
parent::__construct($message);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ class AdministratorCreationForm extends BaseForm
|
||||
array($this, "verifyPasswordField")
|
||||
)))
|
||||
),
|
||||
"label" => "Password confirmation",
|
||||
"label" => Translator::getInstance()->trans('Password confirmation'),
|
||||
"label_attr" => array(
|
||||
"for" => "password_confirmation"
|
||||
),
|
||||
@@ -94,7 +94,7 @@ class AdministratorCreationForm extends BaseForm
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank(),
|
||||
),
|
||||
"label" => "Profile",
|
||||
"label" => Translator::getInstance()->trans('Profile'),
|
||||
"label_attr" => array(
|
||||
"for" => "profile"
|
||||
),
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace Thelia\Form;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
class ConfigCreationForm extends BaseForm
|
||||
{
|
||||
@@ -41,7 +42,7 @@ class ConfigCreationForm extends BaseForm
|
||||
$this->formBuilder
|
||||
->add("name", "text", array(
|
||||
"constraints" => $name_constraints,
|
||||
"label" => "Name *",
|
||||
"label" => Translator::getInstance()->trans('Name *'),
|
||||
"label_attr" => array(
|
||||
"for" => "name"
|
||||
)
|
||||
@@ -50,7 +51,7 @@ class ConfigCreationForm extends BaseForm
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank()
|
||||
),
|
||||
"label" => "Purpose *",
|
||||
"label" => Translator::getInstance()->trans('Purpose *'),
|
||||
"label_attr" => array(
|
||||
"for" => "purpose"
|
||||
)
|
||||
@@ -61,14 +62,14 @@ class ConfigCreationForm extends BaseForm
|
||||
)
|
||||
))
|
||||
->add("value", "text", array(
|
||||
"label" => "Value *",
|
||||
"label" => Translator::getInstance()->trans('Value *'),
|
||||
"label_attr" => array(
|
||||
"for" => "value"
|
||||
)
|
||||
))
|
||||
->add("hidden", "hidden", array())
|
||||
->add("secured", "hidden", array(
|
||||
"label" => "Prevent variable modification or deletion, except for super-admin"
|
||||
"label" => Translator::getInstance()->trans('Prevent variable modification or deletion, except for super-admin')
|
||||
))
|
||||
;
|
||||
}
|
||||
@@ -83,7 +84,7 @@ class ConfigCreationForm extends BaseForm
|
||||
$config = ConfigQuery::create()->findOneByName($value);
|
||||
|
||||
if ($config) {
|
||||
$context->addViolation(sprintf("A variable with name \"%s\" already exists.", $value));
|
||||
$context->addViolation(Translator::getInstance()->trans('A variable with name "%name" already exists.', array('%name' => $value)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace Thelia\Form;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Symfony\Component\Validator\Constraints\GreaterThan;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
class ConfigModificationForm extends BaseForm
|
||||
{
|
||||
@@ -43,20 +44,20 @@ class ConfigModificationForm extends BaseForm
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => "Name",
|
||||
"label" => Translator::getInstance()->trans('Name'),
|
||||
"label_attr" => array(
|
||||
"for" => "name"
|
||||
)
|
||||
))
|
||||
->add("value", "text", array(
|
||||
"label" => "Value",
|
||||
"label" => Translator::getInstance()->trans('Value'),
|
||||
"label_attr" => array(
|
||||
"for" => "value"
|
||||
)
|
||||
))
|
||||
->add("hidden", "hidden", array())
|
||||
->add("secured", "hidden", array(
|
||||
"label" => "Prevent variable modification or deletion, except for super-admin"
|
||||
"label" => Translator::getInstance()->trans('Prevent variable modification or deletion, except for super-admin')
|
||||
))
|
||||
;
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class ContentCreationForm extends BaseForm
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => "Content title *",
|
||||
"label" => Translator::getInstance()->trans('Content title *'),
|
||||
"label_attr" => array(
|
||||
"for" => "title"
|
||||
)
|
||||
|
||||
@@ -26,6 +26,7 @@ use Symfony\Component\Validator\Constraints;
|
||||
use Thelia\Model\CurrencyQuery;
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
class CurrencyCreationForm extends BaseForm
|
||||
{
|
||||
@@ -44,7 +45,7 @@ class CurrencyCreationForm extends BaseForm
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => "Name *",
|
||||
"label" => Translator::getInstance()->trans('Name *'),
|
||||
"label_attr" => array(
|
||||
"for" => "name"
|
||||
))
|
||||
@@ -58,7 +59,7 @@ class CurrencyCreationForm extends BaseForm
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => "Symbol *",
|
||||
"label" => Translator::getInstance()->trans('Symbol *'),
|
||||
"label_attr" => array(
|
||||
"for" => "symbol"
|
||||
))
|
||||
@@ -67,7 +68,7 @@ class CurrencyCreationForm extends BaseForm
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => "Rate from € *",
|
||||
"label" => Translator::getInstance()->trans('Rate from € *'),
|
||||
"label_attr" => array(
|
||||
"for" => "rate"
|
||||
))
|
||||
@@ -76,7 +77,7 @@ class CurrencyCreationForm extends BaseForm
|
||||
"constraints" => array(
|
||||
new NotBlank()
|
||||
),
|
||||
"label" => "ISO 4217 code *",
|
||||
"label" => Translator::getInstance()->trans('ISO 4217 code *'),
|
||||
"label_attr" => array(
|
||||
"for" => "iso_4217_code"
|
||||
))
|
||||
@@ -94,7 +95,7 @@ class CurrencyCreationForm extends BaseForm
|
||||
$currency = CurrencyQuery::create()->findOneByCode($value);
|
||||
|
||||
if ($currency) {
|
||||
$context->addViolation(sprintf("A currency with code \"%s\" already exists.", $value));
|
||||
$context->addViolation(Translator::getInstance()->trans('A currency with code "%name" already exists.', array('%name' => $value)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ class CustomerPasswordUpdateForm extends BaseForm
|
||||
array($this, "verifyPasswordField")
|
||||
)))
|
||||
),
|
||||
"label" => "Password confirmation",
|
||||
"label" => Translator::getInstance()->trans('Password confirmation'),
|
||||
"label_attr" => array(
|
||||
"for" => "password_confirmation"
|
||||
)
|
||||
|
||||
@@ -58,7 +58,7 @@ class CustomerProfilUpdateForm extends CustomerCreateForm
|
||||
|
||||
// Add Newsletter
|
||||
->add("newsletter", "checkbox", array(
|
||||
"label" => "I would like to receive the newsletter our the latest news.",
|
||||
"label" => Translator::getInstance()->trans('I would like to receive the newsletter or the latest news.'),
|
||||
"label_attr" => array(
|
||||
"for" => "newsletter"
|
||||
),
|
||||
|
||||
95
core/lib/Thelia/Form/MailingSystemModificationForm.php
Normal file
95
core/lib/Thelia/Form/MailingSystemModificationForm.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Form;
|
||||
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Thelia\Model\ProfileQuery;
|
||||
|
||||
/**
|
||||
* Class MailingSystemModificationForm
|
||||
* @package Thelia\Form
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*/
|
||||
class MailingSystemModificationForm extends BaseForm
|
||||
{
|
||||
protected function buildForm($change_mode = false)
|
||||
{
|
||||
$this->formBuilder
|
||||
->add("enabled", "choice", array(
|
||||
"choices" => array(1 => "Yes", 0 => "No"),
|
||||
"label" => Translator::getInstance()->trans("Enable remote SMTP use"),
|
||||
"label_attr" => array("for" => "enabled_field"),
|
||||
))
|
||||
->add("host", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Host"),
|
||||
"label_attr" => array("for" => "host_field"),
|
||||
))
|
||||
->add("port", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Port"),
|
||||
"label_attr" => array("for" => "port_field"),
|
||||
))
|
||||
->add("encryption", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Encryption"),
|
||||
"label_attr" => array("for" => "encryption_field"),
|
||||
))
|
||||
->add("username", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Username"),
|
||||
"label_attr" => array("for" => "username_field"),
|
||||
))
|
||||
->add("password", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Password"),
|
||||
"label_attr" => array("for" => "password_field"),
|
||||
))
|
||||
->add("authmode", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Auth mode"),
|
||||
"label_attr" => array("for" => "authmode_field"),
|
||||
))
|
||||
->add("timeout", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Timeout"),
|
||||
"label_attr" => array("for" => "timeout_field"),
|
||||
))
|
||||
->add("sourceip", "text", array(
|
||||
"label" => Translator::getInstance()->trans("Source IP"),
|
||||
"label_attr" => array("for" => "sourceip_field"),
|
||||
))
|
||||
;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return "thelia_mailing_system_modification";
|
||||
}
|
||||
|
||||
/*public function verifyCode($value, ExecutionContextInterface $context)
|
||||
{
|
||||
$profile = ProfileQuery::create()
|
||||
->findOneByCode($value);
|
||||
|
||||
if (null !== $profile) {
|
||||
$context->addViolation("Profile `code` already exists");
|
||||
}
|
||||
}*/
|
||||
}
|
||||
@@ -25,6 +25,7 @@ namespace Thelia\Form;
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
use Thelia\Model\MessageQuery;
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
class MessageCreationForm extends BaseForm
|
||||
{
|
||||
@@ -41,7 +42,7 @@ class MessageCreationForm extends BaseForm
|
||||
$this->formBuilder
|
||||
->add("name", "text", array(
|
||||
"constraints" => $name_constraints,
|
||||
"label" => "Name *",
|
||||
"label" => Translator::getInstance()->trans('Name *'),
|
||||
"label_attr" => array(
|
||||
"for" => "name"
|
||||
)
|
||||
@@ -50,7 +51,7 @@ class MessageCreationForm extends BaseForm
|
||||
"constraints" => array(
|
||||
new Constraints\NotBlank()
|
||||
),
|
||||
"label" => "Purpose *",
|
||||
"label" => Translator::getInstance()->trans('Purpose *'),
|
||||
"label_attr" => array(
|
||||
"for" => "purpose"
|
||||
)
|
||||
@@ -74,7 +75,7 @@ class MessageCreationForm extends BaseForm
|
||||
$message = MessageQuery::create()->findOneByName($value);
|
||||
|
||||
if ($message) {
|
||||
$context->addViolation(sprintf("A message with name \"%s\" already exists.", $value));
|
||||
$context->addViolation(Translator::getInstance()->trans('A message with name "%name" already exists.', array('%name' => $value)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace Thelia\Form;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Symfony\Component\Validator\Constraints\GreaterThan;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
class MessageModificationForm extends BaseForm
|
||||
{
|
||||
@@ -33,37 +34,37 @@ class MessageModificationForm extends BaseForm
|
||||
->add("id" , "hidden", array("constraints" => array(new GreaterThan(array('value' => 0)))))
|
||||
->add("name" , "text" , array(
|
||||
"constraints" => array(new NotBlank()),
|
||||
"label" => "Name *",
|
||||
"label" => Translator::getInstance()->trans('Name *'),
|
||||
"label_attr" => array(
|
||||
"for" => "name"
|
||||
)
|
||||
))
|
||||
->add("secured" , "text" , array(
|
||||
"label" => "Prevent mailing template modification or deletion, except for super-admin"
|
||||
"label" => Translator::getInstance()->trans('Prevent mailing template modification or deletion, except for super-admin')
|
||||
))
|
||||
->add("locale" , "text" , array())
|
||||
->add("title" , "text" , array(
|
||||
"constraints" => array(new NotBlank()),
|
||||
"label" => "Title *",
|
||||
"label" => Translator::getInstance()->trans('Title *'),
|
||||
"label_attr" => array(
|
||||
"for" => "title"
|
||||
)
|
||||
))
|
||||
->add("subject" , "text" , array(
|
||||
"constraints" => array(new NotBlank()),
|
||||
"label" => "Message subject *",
|
||||
"label" => Translator::getInstance()->trans('Message subject *'),
|
||||
"label_attr" => array(
|
||||
"for" => "subject"
|
||||
)
|
||||
))
|
||||
->add("html_message" , "text" , array(
|
||||
"label" => "HTML Message",
|
||||
"label" => Translator::getInstance()->trans('HTML Message'),
|
||||
"label_attr" => array(
|
||||
"for" => "html_message"
|
||||
)
|
||||
))
|
||||
->add("text_message" , "text" , array(
|
||||
"label" => "Text Message",
|
||||
"label" => Translator::getInstance()->trans('Text Message'),
|
||||
"label_attr" => array(
|
||||
"for" => "text_message"
|
||||
)
|
||||
|
||||
91
core/lib/Thelia/Form/ProductCombinationGenerationForm.php
Normal file
91
core/lib/Thelia/Form/ProductCombinationGenerationForm.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Form;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\GreaterThan;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Thelia\Model\Currency;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
class ProductCombinationGenerationForm extends BaseForm
|
||||
{
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add('product_id', 'integer', array(
|
||||
'label' => Translator::getInstance()->trans('Product ID'),
|
||||
'label_attr' => array('for' => 'combination_builder_id_field'),
|
||||
'constraints' => array(new GreaterThan(array('value' => 0)))
|
||||
))
|
||||
->add('currency', 'integer', array(
|
||||
'label' => Translator::getInstance()->trans('Price currency *'),
|
||||
'label_attr' => array('for' => 'combination_builder_currency_field'),
|
||||
'constraints' => array(new GreaterThan(array('value' => 0)))
|
||||
))
|
||||
->add('reference', 'text', array(
|
||||
'label' => Translator::getInstance()->trans('Reference'),
|
||||
'label_attr' => array('for' => 'combination_builder_reference_field')
|
||||
))
|
||||
->add('price', 'number', array(
|
||||
'label' => Translator::getInstance()->trans('Product price excluding taxes'),
|
||||
'label_attr' => array('for' => 'combination_builder_price_field')
|
||||
))
|
||||
->add('weight', 'number', array(
|
||||
'label' => Translator::getInstance()->trans('Weight'),
|
||||
'label_attr' => array('for' => 'combination_builder_weight_field')
|
||||
))
|
||||
->add('quantity', 'number', array(
|
||||
'label' => Translator::getInstance()->trans('Available quantity'),
|
||||
'label_attr' => array('for' => 'combination_builder_quantity_field')
|
||||
))
|
||||
->add('sale_price', 'number', array(
|
||||
'label' => Translator::getInstance()->trans('Sale price excluding taxes'),
|
||||
'label_attr' => array('for' => 'combination_builder_price_with_tax_field')
|
||||
))
|
||||
->add('onsale', 'integer', array(
|
||||
'label' => Translator::getInstance()->trans('This product is on sale'),
|
||||
'label_attr' => array('for' => 'combination_builder_onsale_field')
|
||||
))
|
||||
->add('isnew', 'integer', array(
|
||||
'label' => Translator::getInstance()->trans('Advertise this product as new'),
|
||||
'label_attr' => array('for' => 'combination_builder_isnew_field')
|
||||
))
|
||||
->add('ean_code', 'text', array(
|
||||
'label' => Translator::getInstance()->trans('EAN Code'),
|
||||
'label_attr' => array('for' => 'combination_builder_ean_code_field')
|
||||
))
|
||||
->add('attribute_av', 'collection', array(
|
||||
'type' => 'text',
|
||||
'label' => Translator::getInstance()->trans('Attribute ID:Attribute AV ID'),
|
||||
'label_attr' => array('for' => 'combination_builder_attribute_av_id'),
|
||||
'allow_add' => true,
|
||||
'allow_delete' => true,
|
||||
))
|
||||
;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'thelia_product_combination_generation_form';
|
||||
}
|
||||
}
|
||||
@@ -43,12 +43,12 @@ class ProductCreationForm extends BaseForm
|
||||
$this->formBuilder
|
||||
->add("ref", "text", array(
|
||||
"constraints" => $ref_constraints,
|
||||
"label" => "Product reference *",
|
||||
"label" => Translator::getInstance()->trans('Product reference *'),
|
||||
"label_attr" => array("for" => "ref")
|
||||
))
|
||||
->add("title", "text", array(
|
||||
"constraints" => array(new NotBlank()),
|
||||
"label" => "Product title *",
|
||||
"label" => Translator::getInstance()->trans('Product title *'),
|
||||
"label_attr" => array("for" => "title")
|
||||
))
|
||||
->add("default_category", "integer", array(
|
||||
|
||||
@@ -29,8 +29,6 @@ use Thelia\Core\Translation\Translator;
|
||||
|
||||
class ProductDefaultSaleElementUpdateForm extends ProductSaleElementUpdateForm
|
||||
{
|
||||
use StandardDescriptionFieldsTrait;
|
||||
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
@@ -77,7 +75,7 @@ class ProductDefaultSaleElementUpdateForm extends ProductSaleElementUpdateForm
|
||||
"label_attr" => array("for" => "quantity_field")
|
||||
))
|
||||
->add("sale_price", "number", array(
|
||||
"label" => Translator::getInstance()->trans("Sale price without taxes"),
|
||||
"label" => Translator::getInstance()->trans("Sale price excluding taxes"),
|
||||
"label_attr" => array("for" => "price_with_tax_field")
|
||||
))
|
||||
->add("sale_price_with_tax", "number", array(
|
||||
|
||||
@@ -29,8 +29,6 @@ use Thelia\Core\Translation\Translator;
|
||||
|
||||
class ProductSaleElementUpdateForm extends BaseForm
|
||||
{
|
||||
use StandardDescriptionFieldsTrait;
|
||||
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
@@ -112,7 +110,7 @@ class ProductSaleElementUpdateForm extends BaseForm
|
||||
)
|
||||
))
|
||||
->add('sale_price', 'collection', array(
|
||||
'label' => Translator::getInstance()->trans('Sale price without taxes'),
|
||||
'label' => Translator::getInstance()->trans('Sale price excluding taxes'),
|
||||
'label_attr' => array('for' => 'price_with_tax_field'),
|
||||
'allow_add' => true,
|
||||
'allow_delete' => true,
|
||||
|
||||
86
core/lib/Thelia/Form/SystemLogConfigurationForm.php
Normal file
86
core/lib/Thelia/Form/SystemLogConfigurationForm.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
namespace Thelia\Form;
|
||||
|
||||
use Symfony\Component\Validator\Constraints;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||
use Thelia\Log\Tlog;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
class SystemLogConfigurationForm extends BaseForm
|
||||
{
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add("level", "choice", array(
|
||||
'choices' => array(
|
||||
Tlog::MUET => Translator::getInstance()->trans("Disabled"),
|
||||
Tlog::DEBUG => Translator::getInstance()->trans("Debug"),
|
||||
Tlog::INFO => Translator::getInstance()->trans("Information"),
|
||||
Tlog::NOTICE => Translator::getInstance()->trans("Notices"),
|
||||
Tlog::WARNING => Translator::getInstance()->trans("Warnings"),
|
||||
Tlog::ERROR => Translator::getInstance()->trans("Errors"),
|
||||
Tlog::CRITICAL => Translator::getInstance()->trans("Critical"),
|
||||
Tlog::ALERT => Translator::getInstance()->trans("Alerts"),
|
||||
Tlog::EMERGENCY => Translator::getInstance()->trans("Emergency"),
|
||||
),
|
||||
|
||||
"label" => Translator::getInstance()->trans('Log level *'),
|
||||
"label_attr" => array(
|
||||
"for" => "level_field"
|
||||
)
|
||||
))
|
||||
->add("format", "text", array(
|
||||
"label" => Translator::getInstance()->trans('Log format *'),
|
||||
"label_attr" => array(
|
||||
"for" => "format_field"
|
||||
)
|
||||
))
|
||||
->add("show_redirections", "integer", array(
|
||||
"constraints" => array(new Constraints\NotBlank()),
|
||||
"label" => Translator::getInstance()->trans('Show redirections *'),
|
||||
"label_attr" => array(
|
||||
"for" => "show_redirections_field"
|
||||
)
|
||||
))
|
||||
->add("files", "text", array(
|
||||
"label" => Translator::getInstance()->trans('Activate logs only for these files'),
|
||||
"label_attr" => array(
|
||||
"for" => "files_field"
|
||||
)
|
||||
))
|
||||
->add("ip_addresses", "text", array(
|
||||
"label" => Translator::getInstance()->trans('Activate logs only for these IP Addresses'),
|
||||
"label_attr" => array(
|
||||
"for" => "files_field"
|
||||
)
|
||||
))
|
||||
;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return "thelia_system_log_configuration";
|
||||
}
|
||||
}
|
||||
@@ -31,9 +31,6 @@ abstract class AbstractTlogDestination
|
||||
//Tableau des lignes de logs stockés avant utilisation par ecrire()
|
||||
protected $_logs;
|
||||
|
||||
// Vaudra true si on est dans le back office.
|
||||
protected $flag_back_office = false;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->_configs = array();
|
||||
@@ -50,8 +47,8 @@ abstract class AbstractTlogDestination
|
||||
public function setConfig($name, $value)
|
||||
{
|
||||
foreach ($this->_configs as $config) {
|
||||
if ($config->name == $name) {
|
||||
$config->value = $value;
|
||||
if ($config->getName() == $name) {
|
||||
$config->setValue($value);
|
||||
// Appliquer les changements
|
||||
$this->configure();
|
||||
|
||||
@@ -63,15 +60,15 @@ abstract class AbstractTlogDestination
|
||||
}
|
||||
|
||||
//Récupère la valeur affectée à une configuration de la destination
|
||||
public function getConfig($name)
|
||||
public function getConfig($name, $default = false)
|
||||
{
|
||||
foreach ($this->_configs as $config) {
|
||||
if ($config->name == $name) {
|
||||
return $config->value;
|
||||
if ($config->getName() == $name) {
|
||||
return $config->getValue();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return $default;
|
||||
}
|
||||
|
||||
public function getConfigs()
|
||||
@@ -79,26 +76,19 @@ abstract class AbstractTlogDestination
|
||||
return $this->_configs;
|
||||
}
|
||||
|
||||
public function SetBackOfficeMode($bool)
|
||||
{
|
||||
$this->flag_back_office = $bool;
|
||||
}
|
||||
|
||||
//Ajoute une ligne de logs à la destination
|
||||
public function add($string)
|
||||
{
|
||||
$this->_logs[] = $string;
|
||||
}
|
||||
|
||||
protected function InsertAfterBody(&$res, $logdata)
|
||||
protected function insertAfterBody(&$res, $logdata)
|
||||
{
|
||||
$match = array();
|
||||
$match = array();
|
||||
|
||||
if (preg_match("/(<body[^>]*>)/i", $res, $match)) {
|
||||
$res = str_replace($match[0], $match[0] . "\n" . $logdata, $res);
|
||||
} else {
|
||||
$res = $logdata . $res;
|
||||
}
|
||||
if (preg_match("/(<body[^>]*>)/i", $res, $match)) {
|
||||
$res = str_replace($match[0], $match[0] . "\n" . $logdata, $res);
|
||||
}
|
||||
}
|
||||
|
||||
// Demande à la destination de se configurer pour être prête
|
||||
@@ -106,7 +96,7 @@ abstract class AbstractTlogDestination
|
||||
// que seul le paramètre de configuration indiqué a été modifié.
|
||||
protected function configure()
|
||||
{
|
||||
// Cette methode doit etre surchargée si nécessaire.
|
||||
// Cette methode doit etre surchargée si nécessaire.
|
||||
}
|
||||
|
||||
//Lance l'écriture de tous les logs par la destination
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace Thelia\Log\Destination;
|
||||
|
||||
use Thelia\Log\AbstractTlogDestination;
|
||||
use Thelia\Log\TlogDestinationConfig;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
class TlogDestinationFile extends AbstractTlogDestination
|
||||
{
|
||||
@@ -36,45 +37,65 @@ class TlogDestinationFile extends AbstractTlogDestination
|
||||
const VAR_MODE = "tlog_destinationfile_mode";
|
||||
const VALEUR_MODE_DEFAULT = "A";
|
||||
|
||||
const VAR_MAX_FILE_SIZE_KB = "tlog_destinationfile_max_file_size";
|
||||
const MAX_FILE_SIZE_KB_DEFAULT = 1024; // 1 Mb
|
||||
|
||||
protected $path_defaut = false;
|
||||
protected $fh = false;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->path_defaut = THELIA_ROOT . "log/" . self::TLOG_DEFAULT_NAME;
|
||||
parent::__construct();
|
||||
$this->path_defaut = THELIA_ROOT . "log" . DS . self::TLOG_DEFAULT_NAME;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function configure()
|
||||
{
|
||||
$file_path = $this->getConfig(self::VAR_PATH_FILE);
|
||||
$mode = strtolower($this->getConfig(self::VAR_MODE)) == 'a' ? 'a' : 'w';
|
||||
$mode = strtolower($this->getConfig(self::VAR_MODE, self::VALEUR_MODE_DEFAULT)) == 'a' ? 'a' : 'w';
|
||||
|
||||
if (! empty($file_path)) {
|
||||
if (! is_file($file_path)) {
|
||||
$dir = dirname($file_path);
|
||||
if (! is_dir($dir)) {
|
||||
mkdir($dir, 0777, true);
|
||||
}
|
||||
$dir = dirname($file_path);
|
||||
if (! is_dir($dir)) {
|
||||
mkdir($dir, 0777, true);
|
||||
}
|
||||
|
||||
touch($file_path);
|
||||
chmod($file_path, 0777);
|
||||
touch($file_path);
|
||||
chmod($file_path, 0666);
|
||||
}
|
||||
|
||||
if ($this->fh) @fclose($this->fh);
|
||||
|
||||
if (filesize($file_path) > 1024 * $this->getConfig(self::VAR_MAX_FILE_SIZE_KB, self::MAX_FILE_SIZE_KB_DEFAULT)) {
|
||||
|
||||
$idx = 1;
|
||||
|
||||
do {
|
||||
$file_path_bk = "$file_path.$idx";
|
||||
|
||||
$idx++;
|
||||
|
||||
} while (file_exists($file_path_bk));
|
||||
|
||||
rename($file_path, $file_path_bk);
|
||||
|
||||
touch($file_path);
|
||||
chmod($file_path, 0666);
|
||||
}
|
||||
|
||||
$this->fh = fopen($file_path, $mode);
|
||||
}
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return "Text File";
|
||||
return Translator::getInstance()->trans('Text File');
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return "Store logs into text file";
|
||||
return Translator::getInstance()->trans('Store logs into text file');
|
||||
}
|
||||
|
||||
public function getConfigs()
|
||||
@@ -82,17 +103,24 @@ class TlogDestinationFile extends AbstractTlogDestination
|
||||
return array(
|
||||
new TlogDestinationConfig(
|
||||
self::VAR_PATH_FILE,
|
||||
"Chemin du fichier",
|
||||
"Attention, vous devez indiquer un chemin absolu.<br />Le répertoire de base de votre Thelia est ".dirname(getcwd()),
|
||||
'Absolute file path',
|
||||
'You should enter an abolute file path. The base directory of your Thelia installation is '.THELIA_ROOT,
|
||||
$this->path_defaut,
|
||||
TlogDestinationConfig::TYPE_TEXTFIELD
|
||||
),
|
||||
new TlogDestinationConfig(
|
||||
self::VAR_MODE,
|
||||
"Mode d'ouverture (A ou E)",
|
||||
"Indiquez E pour ré-initialiser le fichier à chaque requête, A pour ne jamais réinitialiser le fichier. Pensez à le vider de temps en temps !",
|
||||
'File opening mode (A or E)',
|
||||
'Enter E to empty this file for each request, or A to always append logs. Consider resetting the file from time to time',
|
||||
self::VALEUR_MODE_DEFAULT,
|
||||
TlogDestinationConfig::TYPE_TEXTFIELD
|
||||
),
|
||||
new TlogDestinationConfig(
|
||||
self::VAR_MAX_FILE_SIZE_KB,
|
||||
'Maximum log file size, in Kb',
|
||||
'When this size if exeeded, a backup copy of the file is made, and a new log file is opened. As the file size check is performed only at the beginning of a request, the file size may be bigger thant this limit. Note: 1 Mb = 1024 Kb',
|
||||
self::MAX_FILE_SIZE_KB_DEFAULT,
|
||||
TlogDestinationConfig::TYPE_TEXTFIELD
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -110,4 +138,4 @@ class TlogDestinationFile extends AbstractTlogDestination
|
||||
|
||||
$this->fh = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@
|
||||
namespace Thelia\Log\Destination;
|
||||
|
||||
use Thelia\Log\AbstractTlogDestination;
|
||||
use Thelia\Log\TlogDestinationConfig;
|
||||
|
||||
class TlogDestinationHtml extends AbstractTlogDestination
|
||||
{
|
||||
@@ -46,12 +47,12 @@ class TlogDestinationHtml extends AbstractTlogDestination
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return "Affichage direct dans la page, en HTML";
|
||||
return "Direct HTML display";
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return "Permet d'afficher les logs directement dans la page resultat, avec une mise en forme HTML.";
|
||||
return "Display logs in HTML format, on top of generated pages.";
|
||||
}
|
||||
|
||||
public function getConfigs()
|
||||
@@ -59,8 +60,8 @@ class TlogDestinationHtml extends AbstractTlogDestination
|
||||
return array(
|
||||
new TlogDestinationConfig(
|
||||
self::VAR_STYLE,
|
||||
"Style d'affichage direct dans la page",
|
||||
"Vous pouvez aussi laisser ce champ vide, et créer un style \"tlog-trace\" dans votre feuille de style.",
|
||||
"CSS of each log line",
|
||||
"You may also leave this field empty, and define a \"tlog-trace\" style in your CSS.",
|
||||
self::VALEUR_STYLE_DEFAUT,
|
||||
TlogDestinationConfig::TYPE_TEXTAREA
|
||||
)
|
||||
@@ -71,6 +72,6 @@ class TlogDestinationHtml extends AbstractTlogDestination
|
||||
{
|
||||
$block = sprintf('<pre class="tlog-trace" style="%s">%s</pre>', $this->style, htmlspecialchars(implode("\n", $this->_logs)));
|
||||
|
||||
$this->InsertAfterBody($res, $block);
|
||||
$this->insertAfterBody($res, $block);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : thelia@openstudio.fr */
|
||||
/* web : http://www.openstudio.fr */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Log\Destination;
|
||||
|
||||
use Thelia\Log\AbstractTlogDestination;
|
||||
|
||||
class TlogDestinationJavascriptConsole extends AbstractTlogDestination {
|
||||
|
||||
public function getTitle() {
|
||||
return "Browser's Javascript console";
|
||||
}
|
||||
|
||||
public function getDescription() {
|
||||
return "The Thelia logs are displayed in your browser's Javascript console.";
|
||||
}
|
||||
|
||||
public function write(&$res) {
|
||||
|
||||
$content = '<script>try {'."\n";
|
||||
|
||||
foreach($this->_logs as $line) {
|
||||
$content .= "console.log('".str_replace("'", "\\'", str_replace(array("\r\n", "\r", "\n"), '\\n', $line))."');\n";
|
||||
}
|
||||
|
||||
$content .= '} catch(ex) { alert("Les logs Thelia ne peuvent être affichés dans la console javascript:" + ex); }</script>'."\n";
|
||||
|
||||
if (preg_match("|</body>|i", $res))
|
||||
$res = preg_replace("|</body>|i", "$content</html>", $res);
|
||||
}
|
||||
}
|
||||
@@ -29,12 +29,12 @@ class TlogDestinationNull extends AbstractTlogDestination
|
||||
{
|
||||
public function getTitle()
|
||||
{
|
||||
return "Trou noir";
|
||||
return "Black hole";
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return "Cette destination ne provoque aucune sortie";
|
||||
return "This destinations consumes the logs but don't display them";
|
||||
}
|
||||
|
||||
public function add($string)
|
||||
|
||||
111
core/lib/Thelia/Log/Destination/TlogDestinationPopup.php
Normal file
111
core/lib/Thelia/Log/Destination/TlogDestinationPopup.php
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : thelia@openstudio.fr */
|
||||
/* web : http://www.openstudio.fr */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Log\Destination;
|
||||
|
||||
use Thelia\Log\AbstractTlogDestination;
|
||||
use Thelia\Log\TlogDestinationConfig;
|
||||
|
||||
class TlogDestinationPopup extends AbstractTlogDestination {
|
||||
|
||||
// Nom des variables de configuration
|
||||
// ----------------------------------
|
||||
const VAR_POPUP_WIDTH = "tlog_destinationpopup_width";
|
||||
const VALEUR_POPUP_WIDTH_DEFAUT = "600";
|
||||
|
||||
const VAR_POPUP_HEIGHT = "tlog_destinationpopup_height";
|
||||
const VALEUR_POPUP_HEIGHT_DEFAUT = "600";
|
||||
|
||||
const VAR_POPUP_TPL = "tlog_destinationpopup_template";
|
||||
// Ce fichier doit se trouver dans le même répertoire que TlogDestinationPopup.class.php
|
||||
const VALEUR_POPUP_TPL_DEFAUT = "TlogDestinationPopup.tpl";
|
||||
|
||||
public function getTitle() {
|
||||
return "Javascript popup window";
|
||||
}
|
||||
|
||||
public function getDescription() {
|
||||
return "Display logs in a popup window, separate from the main window .";
|
||||
}
|
||||
|
||||
public function getConfigs() {
|
||||
return array(
|
||||
new TlogDestinationConfig(
|
||||
self::VAR_POPUP_TPL,
|
||||
"Popup windows template",
|
||||
"Put #LOGTEXT in the template text where you want to display logs..",
|
||||
file_get_contents(__DIR__.DS. self::VALEUR_POPUP_TPL_DEFAUT),
|
||||
TlogDestinationConfig::TYPE_TEXTAREA
|
||||
),
|
||||
new TlogDestinationConfig(
|
||||
self::VAR_POPUP_HEIGHT,
|
||||
"Height of the popup window",
|
||||
"In pixels",
|
||||
self::VALEUR_POPUP_HEIGHT_DEFAUT,
|
||||
TlogDestinationConfig::TYPE_TEXTFIELD
|
||||
),
|
||||
new TlogDestinationConfig(
|
||||
self::VAR_POPUP_WIDTH,
|
||||
"Width of the popup window",
|
||||
"In pixels",
|
||||
self::VALEUR_POPUP_WIDTH_DEFAUT,
|
||||
TlogDestinationConfig::TYPE_TEXTFIELD
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function write(&$res) {
|
||||
|
||||
$content = ""; $count = 1;
|
||||
|
||||
foreach($this->_logs as $line) {
|
||||
$content .= "<div class=\"".($count++ % 2 ? "paire" : "impaire")."\">".htmlspecialchars($line)."</div>";
|
||||
}
|
||||
|
||||
$tpl = $this->getConfig(self::VAR_POPUP_TPL);
|
||||
|
||||
$tpl = str_replace('#LOGTEXT', $content, $tpl);
|
||||
$tpl = str_replace(array("\r\n", "\r", "\n"), '\\n', $tpl);
|
||||
|
||||
$wop = sprintf('
|
||||
<script>
|
||||
_thelia_console = window.open("","thelia_console","width=%s,height=%s,resizable,scrollbars=yes");
|
||||
if (_thelia_console == null) {
|
||||
alert("The log popup window could not be opened. Please disable your popup blocker for this site.");
|
||||
}
|
||||
else {
|
||||
_thelia_console.document.write("%s");
|
||||
_thelia_console.document.close();
|
||||
}
|
||||
</script>',
|
||||
$this->getConfig(self::VAR_POPUP_WIDTH),
|
||||
$this->getConfig(self::VAR_POPUP_HEIGHT),
|
||||
str_replace('"', '\\"', $tpl)
|
||||
);
|
||||
|
||||
if (preg_match("|</body>|i", $res))
|
||||
$res = preg_replace("|</body>|i", "$wop\n</body>", $res);
|
||||
else
|
||||
$res .= $wop;
|
||||
}
|
||||
}
|
||||
52
core/lib/Thelia/Log/Destination/TlogDestinationPopup.tpl
Normal file
52
core/lib/Thelia/Log/Destination/TlogDestinationPopup.tpl
Normal file
@@ -0,0 +1,52 @@
|
||||
<!--
|
||||
Default template for TlogDestinationPopup. Insert #LOGTEXT where you want to
|
||||
write the log text in your template.
|
||||
-->
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||
<head>
|
||||
<title>Thelia logs</title>
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
body, h1, h2, td, th, p {
|
||||
font-family: "Courier New", courier, fixed;
|
||||
font-weight: normal;
|
||||
font-size: 0.9em;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
h1 {
|
||||
background-color: #868F99;
|
||||
border-bottom: 2px solid #127AED;
|
||||
color: #FFFFFF;
|
||||
font-family: Arial,Helvetica,sans-serif;
|
||||
font-weight: bold;
|
||||
line-height: 20px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
pre {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.paire {
|
||||
background-color: #EBEDEE;
|
||||
padding: 5px;
|
||||
border-bottom: 1px dotted #fff;
|
||||
}
|
||||
|
||||
.impaire {
|
||||
background-color: #D4DADD;
|
||||
padding: 5px;
|
||||
border-bottom: 1px dotted #fff;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Thelia Debug</h1>
|
||||
<pre>#LOGTEXT</pre>
|
||||
</body>
|
||||
</html>
|
||||
@@ -34,12 +34,12 @@ class TlogDestinationText extends AbstractTlogDestination
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return "Affichage direct dans la page, en texte brut";
|
||||
return "Direct text display";
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return "Permet d'afficher les logs directement dans la page resultat, au format texte brut.";
|
||||
return "Display logs in raw text format, on top of generated pages.";
|
||||
}
|
||||
|
||||
public function add($texte)
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace Thelia\Log;
|
||||
|
||||
use Thelia\Model\ConfigQuery;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -69,7 +70,7 @@ class Tlog Implements LoggerInterface
|
||||
// default values
|
||||
const DEFAULT_LEVEL = self::DEBUG;
|
||||
const DEFAUT_DESTINATIONS = "Thelia\Log\Destination\TlogDestinationFile";
|
||||
const DEFAUT_PREFIXE = "#NUM: #NIVEAU [#FICHIER:#FONCTION()] {#LIGNE} #DATE #HEURE: ";
|
||||
const DEFAUT_PREFIXE = "#INDEX: #LEVEL [#FILE:#FUNCTION()] {#LINE} #DATE #HOUR: ";
|
||||
const DEFAUT_FILES = "*";
|
||||
const DEFAUT_IP = "";
|
||||
const DEFAUT_SHOW_REDIRECT = 0;
|
||||
@@ -95,7 +96,7 @@ class Tlog Implements LoggerInterface
|
||||
|
||||
private $linecount = 0;
|
||||
|
||||
protected static $done = false;
|
||||
protected $done = false;
|
||||
|
||||
// directories where are the Destinations Files
|
||||
public $dir_destinations = array();
|
||||
@@ -132,8 +133,8 @@ class Tlog Implements LoggerInterface
|
||||
$this->setLevel(ConfigQuery::read(self::VAR_LEVEL, self::DEFAULT_LEVEL));
|
||||
|
||||
$this->dir_destinations = array(
|
||||
__DIR__.'/Destination'
|
||||
//, __DIR__.'/../client/tlog/destinations'
|
||||
__DIR__.DS.'Destination',
|
||||
THELIA_LOCAL_DIR.'tlog'.DS.'destinations'
|
||||
);
|
||||
|
||||
$this->setPrefix(ConfigQuery::read(self::VAR_PREFIXE, self::DEFAUT_PREFIXE));
|
||||
@@ -160,10 +161,20 @@ class Tlog Implements LoggerInterface
|
||||
$this->destinations = array();
|
||||
|
||||
$classes_destinations = explode(';', $destinations);
|
||||
|
||||
$this->loadDestinations($this->destinations, $classes_destinations);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the directories where destinations classes should be searched.
|
||||
*
|
||||
* @return array of directories
|
||||
*/
|
||||
public function getDestinationsDirectories() {
|
||||
return $this->dir_destinations;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* change the debug level. Use Tlog constant : \Thelia\Log\Tlog::DEBUG set level to Debug
|
||||
@@ -489,16 +500,6 @@ class Tlog Implements LoggerInterface
|
||||
$this->out($this->levels[$level], $message, $context);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Mode back office
|
||||
public static function SetBackOfficeMode($booleen)
|
||||
{
|
||||
foreach (Tlog::getInstance()->destinations as $dest) {
|
||||
$dest->SetBackOfficeMode($booleen);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* final end method. Write log for each destination handler
|
||||
@@ -508,7 +509,7 @@ class Tlog Implements LoggerInterface
|
||||
*/
|
||||
public function write(&$res)
|
||||
{
|
||||
self::$done = true;
|
||||
$this->done = true;
|
||||
|
||||
// Muet ? On ne fait rien
|
||||
if ($this->level == self::MUET) return;
|
||||
@@ -524,7 +525,7 @@ class Tlog Implements LoggerInterface
|
||||
public function writeOnExit()
|
||||
{
|
||||
// Si les infos de debug n'ont pas été ecrites, le faire maintenant
|
||||
if (self::$done === false) {
|
||||
if ($this->done === false) {
|
||||
|
||||
$res = "";
|
||||
|
||||
@@ -539,12 +540,12 @@ class Tlog Implements LoggerInterface
|
||||
if ($this->level != self::MUET && $this->show_redirect) {
|
||||
echo "
|
||||
<html>
|
||||
<head><title>Redirection...</title></head>
|
||||
<head><title>".Translator::getInstance()->trans('Redirecting ...')."</title></head>
|
||||
<body>
|
||||
<a href=\"$url\">Redirection vers $url</a>
|
||||
<a href=\"$url\">".Translator::getInstance()->trans('Redirecting to %url', array('%url' => $url))."</a>
|
||||
</body>
|
||||
</html>
|
||||
";
|
||||
";
|
||||
|
||||
return true;
|
||||
} else {
|
||||
@@ -670,7 +671,7 @@ class Tlog Implements LoggerInterface
|
||||
$line = $origine['line'];
|
||||
|
||||
$prefixe = str_replace(
|
||||
array("#NUM", "#NIVEAU", "#FICHIER", "#FONCTION", "#LIGNE", "#DATE", "#HEURE"),
|
||||
array("#INDEX", "#LEVEL", "#FILE", "#FUNCTION", "#LINE", "#DATE", "#HOUR"),
|
||||
array(1+$this->linecount, $level, $file, $function, $line, date("Y-m-d"), date("G:i:s")),
|
||||
$this->prefixe
|
||||
);
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Log;
|
||||
|
||||
use Thelia\Model\Config;
|
||||
use Thelia\Model\ConfigQuery;
|
||||
|
||||
@@ -32,12 +31,12 @@ class TlogDestinationConfig
|
||||
const TYPE_TEXTAREA = 1;
|
||||
const TYPE_TEXTFIELD = 2;
|
||||
|
||||
public $name;
|
||||
public $title;
|
||||
public $label;
|
||||
public $default;
|
||||
public $type;
|
||||
public $value;
|
||||
protected $name;
|
||||
protected $title;
|
||||
protected $label;
|
||||
protected $default;
|
||||
protected $type;
|
||||
protected $value;
|
||||
|
||||
public function __construct($name, $title, $label, $default, $type)
|
||||
{
|
||||
@@ -45,22 +44,67 @@ class TlogDestinationConfig
|
||||
$this->title = $title;
|
||||
$this->label = $label;
|
||||
$this->default = $default;
|
||||
$this->type = $type;
|
||||
|
||||
$this->load();
|
||||
$this->type= $type;
|
||||
$this->value = ConfigQuery::read($this->name, $this->default);
|
||||
}
|
||||
|
||||
public function load()
|
||||
public function getName()
|
||||
{
|
||||
if (null === $config = ConfigQuery::create()->findOneByName($this->name)) {
|
||||
$config = new Config();
|
||||
$config->setName($this->name);
|
||||
$config->setValue($this->default);
|
||||
$config->setHidden(1);
|
||||
$config->setSecured(1);
|
||||
$config->save();
|
||||
}
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
$this->value = $config->getValue();
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
public function getLabel()
|
||||
{
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
public function setLabel($label)
|
||||
{
|
||||
$this->label = $label;
|
||||
}
|
||||
|
||||
public function getDefault()
|
||||
{
|
||||
return $this->default;
|
||||
}
|
||||
|
||||
public function setDefault($default)
|
||||
{
|
||||
$this->default = $default;
|
||||
}
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class MailerFactory {
|
||||
if($transporterEvent->hasTransporter()) {
|
||||
$transporter = $transporterEvent->getTransporter();
|
||||
} else {
|
||||
if (ConfigQuery::read("smtp.enabled")) {
|
||||
if (ConfigQuery::isSmtpEnable()) {
|
||||
$transporter = $this->configureSmtp();
|
||||
} else {
|
||||
$transporter = \Swift_MailTransport::newInstance();
|
||||
@@ -65,14 +65,14 @@ class MailerFactory {
|
||||
private function configureSmtp()
|
||||
{
|
||||
$smtpTransporter = new \Swift_SmtpTransport();
|
||||
$smtpTransporter->setHost(Configquery::read('smtp.host', 'localhost'))
|
||||
->setPort(ConfigQuery::read('smtp.host'))
|
||||
->setEncryption(ConfigQuery::read('smtp.encryption'))
|
||||
->setUsername(ConfigQuery::read('smtp.username'))
|
||||
->setPassword(ConfigQuery::read('smtp.password'))
|
||||
->setAuthMode(ConfigQuery::read('smtp.authmode'))
|
||||
->setTimeout(ConfigQuery::read('smtp.timeout', 30))
|
||||
->setSourceIp(ConfigQuery::read('smtp.sourceip'))
|
||||
$smtpTransporter->setHost(Configquery::getSmtpHost())
|
||||
->setPort(ConfigQuery::getSmtpPort())
|
||||
->setEncryption(ConfigQuery::getSmtpEncryption())
|
||||
->setUsername(ConfigQuery::getSmtpUsername())
|
||||
->setPassword(ConfigQuery::getSmtpPassword())
|
||||
->setAuthMode(ConfigQuery::getSmtpAuthMode())
|
||||
->setTimeout(ConfigQuery::getSmtpTimeout())
|
||||
->setSourceIp(ConfigQuery::getSmtpSourceIp())
|
||||
;
|
||||
return $smtpTransporter;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user