Merge branch 'master' into modules
Conflicts: core/lib/Thelia/Core/Template/Assets/AsseticAssetManager.php core/lib/Thelia/Core/Template/Smarty/SmartyParser.php
This commit is contained in:
@@ -68,12 +68,14 @@ class RegisterRouterPass implements CompilerPassInterface
|
||||
|
||||
foreach ($modules as $module) {
|
||||
$moduleBaseDir = $module->getBaseDir();
|
||||
if (file_exists(THELIA_MODULE_DIR . "/" . $moduleBaseDir . "/Config/routing.xml")) {
|
||||
$routingConfigFilePath = $module->getAbsoluteBaseDir() . DS . "Config" . DS . "routing.xml";
|
||||
|
||||
if (file_exists($routingConfigFilePath)) {
|
||||
$definition = new Definition(
|
||||
$container->getParameter("router.class"),
|
||||
array(
|
||||
new Reference("router.module.xmlLoader"),
|
||||
$moduleBaseDir . "/Config/routing.xml",
|
||||
$routingConfigFilePath,
|
||||
array(
|
||||
"cache_dir" => $container->getParameter("kernel.cache_dir"),
|
||||
"debug" => $container->getParameter("kernel.debug"),
|
||||
|
||||
@@ -22,13 +22,18 @@
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event\Message;
|
||||
|
||||
use Thelia\Core\Event\Message\MessageCreateEvent;
|
||||
|
||||
class MessageUpdateEvent extends MessageCreateEvent
|
||||
{
|
||||
protected $message_id;
|
||||
|
||||
protected $html_layout_file_name;
|
||||
protected $html_template_file_name;
|
||||
|
||||
protected $text_layout_file_name;
|
||||
protected $text_template_file_name;
|
||||
|
||||
protected $text_message;
|
||||
protected $html_message;
|
||||
protected $subject;
|
||||
@@ -85,4 +90,52 @@ class MessageUpdateEvent extends MessageCreateEvent
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
public function getHtmlLayoutFileName()
|
||||
{
|
||||
return $this->html_layout_file_name;
|
||||
}
|
||||
|
||||
public function setHtmlLayoutFileName($html_layout_file_name)
|
||||
{
|
||||
$this->html_layout_file_name = $html_layout_file_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getHtmlTemplateFileName()
|
||||
{
|
||||
return $this->html_template_file_name;
|
||||
}
|
||||
|
||||
public function setHtmlTemplateFileName($html_template_file_name)
|
||||
{
|
||||
$this->html_template_file_name = $html_template_file_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTextLayoutFileName()
|
||||
{
|
||||
return $this->text_layout_file_name;
|
||||
}
|
||||
|
||||
public function setTextLayoutFileName($text_layout_file_name)
|
||||
{
|
||||
$this->text_layout_file_name = $text_layout_file_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTextTemplateFileName()
|
||||
{
|
||||
return $this->text_template_file_name;
|
||||
}
|
||||
|
||||
public function setTextTemplateFileName($text_template_file_name)
|
||||
{
|
||||
$this->text_template_file_name = $text_template_file_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -100,5 +100,7 @@ final class AdminResources
|
||||
|
||||
const SYSTEM_LOG = "admin.configuration.system-log";
|
||||
|
||||
const STORE = "admin.configuration.store";
|
||||
|
||||
const TRANSLATIONS = "admin.configuration.translations";
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ class Content extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
Argument::createBooleanTypeArgument('current_folder'),
|
||||
Argument::createIntTypeArgument('depth', 1),
|
||||
Argument::createBooleanOrBothTypeArgument('visible', 1),
|
||||
Argument::createAnyTypeArgument('title'),
|
||||
new Argument(
|
||||
'order',
|
||||
new TypeCollection(
|
||||
@@ -148,6 +149,11 @@ class Content extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
|
||||
if ($visible !== BooleanOrBothType::ANY) $search->filterByVisible($visible ? 1 : 0);
|
||||
|
||||
$title = $this->getTitle();
|
||||
|
||||
if (!is_null($title)) {
|
||||
$search->where("CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`TITLE` ELSE `default_locale_i18n`.`TITLE` END ".Criteria::LIKE." ?", "%".$title."%", \PDO::PARAM_STR);
|
||||
}
|
||||
|
||||
$orders = $this->getOrder();
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ class Folder extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
Argument::createBooleanTypeArgument('current'),
|
||||
Argument::createBooleanTypeArgument('not_empty', 0),
|
||||
Argument::createBooleanOrBothTypeArgument('visible', 1),
|
||||
Argument::createAnyTypeArgument('title'),
|
||||
new Argument(
|
||||
'order',
|
||||
new TypeCollection(
|
||||
@@ -115,6 +116,12 @@ class Folder extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
}
|
||||
}
|
||||
|
||||
$title = $this->getTitle();
|
||||
|
||||
if (!is_null($title)) {
|
||||
$search->where("CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`TITLE` ELSE `default_locale_i18n`.`TITLE` END ".Criteria::LIKE." ?", "%".$title."%", \PDO::PARAM_STR);
|
||||
}
|
||||
|
||||
$visible = $this->getVisible();
|
||||
|
||||
if ($visible !== BooleanOrBothType::ANY) $search->filterByVisible($visible ? 1 : 0);
|
||||
|
||||
@@ -165,7 +165,7 @@ class Module extends BaseI18nLoop implements PropelSearchLoopInterface
|
||||
|
||||
/* if not ; test if it uses admin inclusion : module_configuration.html */
|
||||
if(false === $hasConfigurationInterface) {
|
||||
if(file_exists( sprintf("%s/%s/AdminIncludes/%s.html", THELIA_MODULE_DIR, $module->getBaseDir(), "module_configuration"))) {
|
||||
if(file_exists( sprintf("%s/AdminIncludes/%s.html", $module->getAbsoluteBaseDir(), "module_configuration"))) {
|
||||
$hasConfigurationInterface = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,6 +174,7 @@ class ProductSaleElements extends BaseLoop implements PropelSearchLoopInterface
|
||||
->set("IS_NEW" , $PSEValue->getNewness() === 1 ? 1 : 0)
|
||||
->set("IS_DEFAULT" , $PSEValue->getIsDefault() === 1 ? 1 : 0)
|
||||
->set("WEIGHT" , $PSEValue->getWeight())
|
||||
->set("REF" , $PSEValue->getRef())
|
||||
->set("EAN_CODE" , $PSEValue->getEanCode())
|
||||
->set("PRICE" , $price)
|
||||
->set("PRICE_TAX" , $taxedPrice - $price)
|
||||
|
||||
@@ -93,7 +93,7 @@ class Template extends BaseLoop implements ArraySearchLoopInterface
|
||||
$loopResultRow
|
||||
->set("NAME" , $template->getName())
|
||||
->set("RELATIVE_PATH" , $template->getPath())
|
||||
->set("ABSOLUTE_PATH" , THELIA_TEMPLATE_DIR . $template->getPath())
|
||||
->set("ABSOLUTE_PATH" , $template->getAbsolutePath())
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
|
||||
@@ -54,7 +54,7 @@ class Module extends AbstractSmartyPlugin
|
||||
continue;
|
||||
}
|
||||
|
||||
$file = sprintf("%s/%s/AdminIncludes/%s.html", THELIA_MODULE_DIR, $module->getBaseDir(), $location);
|
||||
$file = sprintf("%s/AdminIncludes/%s.html", $module->getAbsoluteBaseDir(), $location);
|
||||
|
||||
if (file_exists($file)) {
|
||||
$content .= file_get_contents($file);
|
||||
|
||||
@@ -28,10 +28,12 @@ class TemplateDefinition
|
||||
const FRONT_OFFICE = 1;
|
||||
const BACK_OFFICE = 2;
|
||||
const PDF = 3;
|
||||
const EMAIL = 4;
|
||||
|
||||
const FRONT_OFFICE_SUBDIR = 'frontOffice/';
|
||||
const BACK_OFFICE_SUBDIR = 'backOffice/';
|
||||
const PDF_SUBDIR = 'pdf/';
|
||||
const EMAIL_SUBDIR = 'email/';
|
||||
|
||||
/**
|
||||
* @var the template directory name (e.g. 'default')
|
||||
@@ -64,6 +66,9 @@ class TemplateDefinition
|
||||
case TemplateDefinition::PDF:
|
||||
$this->path = self::PDF_SUBDIR . $name;
|
||||
break;
|
||||
case TemplateDefinition::EMAIL:
|
||||
$this->path = self::EMAIL_SUBDIR . $name;
|
||||
break;
|
||||
default:
|
||||
$this->path = $name;
|
||||
break;
|
||||
@@ -85,11 +90,28 @@ class TemplateDefinition
|
||||
return $this->getPath() . DS . 'I18n';
|
||||
}
|
||||
|
||||
public function getAbsoluteI18nPath() {
|
||||
return THELIA_TEMPLATE_DIR . $this->getI18nPath();
|
||||
}
|
||||
|
||||
public function getPath()
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
public function getAbsolutePath() {
|
||||
return THELIA_TEMPLATE_DIR . $this->getPath();
|
||||
}
|
||||
|
||||
public function getConfigPath()
|
||||
{
|
||||
return $this->getPath() . DS . 'configs';
|
||||
}
|
||||
|
||||
public function getAbsoluteConfigPath() {
|
||||
return THELIA_TEMPLATE_DIR . $this->getConfigPath();
|
||||
}
|
||||
|
||||
public function setPath($path)
|
||||
{
|
||||
$this->path = $path;
|
||||
@@ -106,5 +128,4 @@ class TemplateDefinition
|
||||
$this->type = $type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,16 @@ class TemplateHelper
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TemplateDefinition
|
||||
*/
|
||||
public function getActiveMailTemplate() {
|
||||
return new TemplateDefinition(
|
||||
ConfigQuery::read('active-mail-template', 'default'),
|
||||
TemplateDefinition::EMAIL
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TemplateDefinition
|
||||
*/
|
||||
|
||||
@@ -145,15 +145,15 @@ class Thelia extends Kernel
|
||||
|
||||
$code = ucfirst($module->getCode());
|
||||
|
||||
$loader = new XmlFileLoader($container, new FileLocator(THELIA_MODULE_DIR . "/" . $code . "/Config"));
|
||||
$loader = new XmlFileLoader($container, new FileLocator($module->getAbsoluteConfigPath()));
|
||||
$loader->load("config.xml");
|
||||
|
||||
if (is_dir($dir = THELIA_MODULE_DIR . "/" . $code . "/I18n")) {
|
||||
if (is_dir($dir = $module->getAbsoluteI18nPath())) {
|
||||
$translationDirs[] = $dir;
|
||||
}
|
||||
|
||||
/* is there a front-office template directory ? */
|
||||
$frontOfficeModuleTemplateDirectory = sprintf("%s%s%stemplates%s%s", THELIA_MODULE_DIR, $code, DS, DS, TemplateDefinition::FRONT_OFFICE_SUBDIR);
|
||||
$frontOfficeModuleTemplateDirectory = sprintf("%s%stemplates%s%s", $module->getAbsoluteBaseDir(), DS, DS, TemplateDefinition::FRONT_OFFICE_SUBDIR);
|
||||
if (is_dir($frontOfficeModuleTemplateDirectory)) {
|
||||
try {
|
||||
$moduleFrontOfficeTemplateBrowser = new \DirectoryIterator($frontOfficeModuleTemplateDirectory);
|
||||
@@ -178,7 +178,7 @@ class Thelia extends Kernel
|
||||
}
|
||||
|
||||
/* is there a back-office template directory ? */
|
||||
$backOfficeModuleTemplateDirectory = sprintf("%s%s%stemplates%s%s", THELIA_MODULE_DIR, $code, DS, DS, TemplateDefinition::BACK_OFFICE_SUBDIR);
|
||||
$backOfficeModuleTemplateDirectory = sprintf("%s%stemplates%s%s", $module->getAbsoluteBaseDir(), DS, DS, TemplateDefinition::BACK_OFFICE_SUBDIR);
|
||||
if (is_dir($backOfficeModuleTemplateDirectory)) {
|
||||
try {
|
||||
$moduleBackOfficeTemplateBrowser = new \DirectoryIterator($backOfficeModuleTemplateDirectory);
|
||||
@@ -210,18 +210,20 @@ class Thelia extends Kernel
|
||||
//core translation
|
||||
$translationDirs[] = THELIA_ROOT . "core/lib/Thelia/Config/I18n";
|
||||
|
||||
$th = TemplateHelper::getInstance();
|
||||
|
||||
// admin template
|
||||
if (is_dir($dir = THELIA_TEMPLATE_DIR . TemplateHelper::getInstance()->getActiveAdminTemplate()->getI18nPath())) {
|
||||
if (is_dir($dir = $th->getActiveAdminTemplate()->getAbsoluteI18nPath())) {
|
||||
$translationDirs[] = $dir;
|
||||
}
|
||||
|
||||
// front template
|
||||
if (is_dir($dir = THELIA_TEMPLATE_DIR . TemplateHelper::getInstance()->getActiveFrontTemplate()->getI18nPath())) {
|
||||
if (is_dir($dir = $th->getActiveFrontTemplate()->getAbsoluteI18nPath())) {
|
||||
$translationDirs[] = $dir;
|
||||
}
|
||||
|
||||
// PDF template
|
||||
if (is_dir($dir = THELIA_TEMPLATE_DIR . TemplateHelper::getInstance()->getActivePdfTemplate()->getI18nPath())) {
|
||||
if (is_dir($dir = $th->getActivePdfTemplate()->getAbsoluteI18nPath())) {
|
||||
$translationDirs[] = $dir;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user