Completed the backoffice variable management
This commit is contained in:
@@ -29,6 +29,12 @@ class ConfigChangeEvent extends ConfigCreateEvent
|
||||
{
|
||||
protected $config_id;
|
||||
|
||||
protected $hidden;
|
||||
protected $secured;
|
||||
protected $description;
|
||||
protected $chapo;
|
||||
protected $postscriptum;
|
||||
|
||||
public function __construct($config_id)
|
||||
{
|
||||
$this->setConfigId($config_id);
|
||||
@@ -45,4 +51,64 @@ class ConfigChangeEvent extends ConfigCreateEvent
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
public function getHidden()
|
||||
{
|
||||
return $this->hidden;
|
||||
}
|
||||
|
||||
public function setHidden($hidden)
|
||||
{
|
||||
$this->hidden = $hidden;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSecured()
|
||||
{
|
||||
return $this->secured;
|
||||
}
|
||||
|
||||
public function setSecured($secured)
|
||||
{
|
||||
$this->secured = $secured;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getChapo()
|
||||
{
|
||||
return $this->chapo;
|
||||
}
|
||||
|
||||
public function setChapo($chapo)
|
||||
{
|
||||
$this->chapo = $chapo;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPostscriptum()
|
||||
{
|
||||
return $this->postscriptum;
|
||||
}
|
||||
|
||||
public function setPostscriptum($postscriptum)
|
||||
{
|
||||
$this->postscriptum = $postscriptum;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -24,26 +24,22 @@
|
||||
namespace Thelia\Core\Event;
|
||||
use Thelia\Model\Config;
|
||||
|
||||
class ConfigCreateEvent extends ActionEvent
|
||||
class ConfigCreateEvent extends ConfigEvent
|
||||
{
|
||||
protected $name;
|
||||
protected $event_name;
|
||||
protected $value;
|
||||
protected $hidden;
|
||||
protected $secured;
|
||||
protected $locale;
|
||||
protected $title;
|
||||
protected $description;
|
||||
protected $chapo;
|
||||
protected $postscriptum;
|
||||
|
||||
public function getName()
|
||||
// Use event_name to prevent conflict with Event::name property.
|
||||
public function getEventName()
|
||||
{
|
||||
return $this->name;
|
||||
return $this->event_name;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
public function setEventName($event_name)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->event_name = $event_name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -60,30 +56,6 @@ class ConfigCreateEvent extends ActionEvent
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getHidden()
|
||||
{
|
||||
return $this->hidden;
|
||||
}
|
||||
|
||||
public function setHidden($hidden)
|
||||
{
|
||||
$this->hidden = $hidden;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSecured()
|
||||
{
|
||||
return $this->secured;
|
||||
}
|
||||
|
||||
public function setSecured($secured)
|
||||
{
|
||||
$this->secured = $secured;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLocale()
|
||||
{
|
||||
return $this->locale;
|
||||
@@ -107,40 +79,4 @@ class ConfigCreateEvent extends ActionEvent
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getChapo()
|
||||
{
|
||||
return $this->chapo;
|
||||
}
|
||||
|
||||
public function setChapo($chapo)
|
||||
{
|
||||
$this->chapo = $chapo;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPostscriptum()
|
||||
{
|
||||
return $this->postscriptum;
|
||||
}
|
||||
|
||||
public function setPostscriptum($postscriptum)
|
||||
{
|
||||
$this->postscriptum = $postscriptum;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,24 +25,10 @@ namespace Thelia\Core\Event;
|
||||
|
||||
use Thelia\Model\Config;
|
||||
|
||||
class ConfigDeleteEvent extends ActionEvent
|
||||
class ConfigDeleteEvent extends ConfigEvent
|
||||
{
|
||||
protected $config_id;
|
||||
|
||||
public function __construct($config_id)
|
||||
{
|
||||
$this->setConfigId($config_id);
|
||||
}
|
||||
|
||||
public function getConfigId()
|
||||
{
|
||||
return $this->config_id;
|
||||
}
|
||||
|
||||
public function setConfigId($config_id)
|
||||
{
|
||||
$this->config_id = $config_id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,13 +22,26 @@
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\Event;
|
||||
|
||||
use Thelia\Model\Config;
|
||||
|
||||
class ConfigEvent extends ActionEvent
|
||||
{
|
||||
public function __construct(Config $config)
|
||||
protected $config;
|
||||
|
||||
public function __construct(Config $config = null)
|
||||
{
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
public function getConfig()
|
||||
{
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
public function setConfig($config)
|
||||
{
|
||||
$this->config = $config;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ use Thelia\Exception\InvalidCartException;
|
||||
use Thelia\Model\CartQuery;
|
||||
use Thelia\Model\Cart;
|
||||
use Thelia\Tools\URL;
|
||||
use Thelia\Model\Lang;
|
||||
|
||||
class Session extends BaseSession
|
||||
{
|
||||
@@ -39,9 +40,35 @@ class Session extends BaseSession
|
||||
return $this->get("locale", "en_US");
|
||||
}
|
||||
|
||||
public function setLocale($locale)
|
||||
{
|
||||
$this->set("locale", $locale);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLang()
|
||||
{
|
||||
return substr($this->getLocale(), 0, 2);
|
||||
return $this->get("lang", substr($this->getLocale(), 0, 2));
|
||||
}
|
||||
|
||||
public function setLang($lang)
|
||||
{
|
||||
$this->set("lang", $lang);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAdminEditionLangId()
|
||||
{
|
||||
return $this->get('admin.edition_language', Lang::getDefaultLanguage()->getId());
|
||||
}
|
||||
|
||||
public function setAdminEditionLangId($langId)
|
||||
{
|
||||
$this->set('admin.edition_language', $langId);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
// -- Customer user --------------------------------------------------------
|
||||
@@ -49,6 +76,7 @@ class Session extends BaseSession
|
||||
public function setCustomerUser(UserInterface $user)
|
||||
{
|
||||
$this->set('customer_user', $user);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCustomerUser()
|
||||
@@ -66,6 +94,7 @@ class Session extends BaseSession
|
||||
public function setAdminUser(UserInterface $user)
|
||||
{
|
||||
$this->set('admin_user', $user);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAdminUser()
|
||||
@@ -83,6 +112,7 @@ class Session extends BaseSession
|
||||
public function setReturnToUrl($url)
|
||||
{
|
||||
$this->set('return_to_url', $url);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,6 +171,6 @@ class Session extends BaseSession
|
||||
public function setCart($cart_id)
|
||||
{
|
||||
$this->set("cart_id", $cart_id);
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ class Attribute extends BaseI18nLoop
|
||||
$lang = $this->getLang();
|
||||
|
||||
/* manage translations */
|
||||
$this->configureI18nProcessing($search);
|
||||
$locale = $this->configureI18nProcessing($search);
|
||||
|
||||
$id = $this->getId();
|
||||
|
||||
@@ -156,6 +156,7 @@ class Attribute extends BaseI18nLoop
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow->set("ID", $attribute->getId())
|
||||
->set("IS_TRANSLATED",$attribute->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE",$locale)
|
||||
->set("TITLE",$attribute->getVirtualColumn('i18n_TITLE'))
|
||||
->set("CHAPO", $attribute->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("DESCRIPTION", $attribute->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
|
||||
@@ -77,7 +77,7 @@ class AttributeAvailability extends BaseI18nLoop
|
||||
$search = AttributeAvQuery::create();
|
||||
|
||||
/* manage translations */
|
||||
$this->configureI18nProcessing($search);
|
||||
$locale = $this->configureI18nProcessing($search);
|
||||
|
||||
$id = $this->getId();
|
||||
|
||||
@@ -125,6 +125,7 @@ class AttributeAvailability extends BaseI18nLoop
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$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'))
|
||||
|
||||
@@ -77,7 +77,7 @@ class AttributeCombination extends BaseI18nLoop
|
||||
$search = AttributeCombinationQuery::create();
|
||||
|
||||
/* manage attribute translations */
|
||||
$this->configureI18nProcessing(
|
||||
$locale = $this->configureI18nProcessing(
|
||||
$search,
|
||||
array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'),
|
||||
AttributeTableMap::TABLE_NAME,
|
||||
@@ -85,7 +85,7 @@ class AttributeCombination extends BaseI18nLoop
|
||||
);
|
||||
|
||||
/* manage attributeAv translations */
|
||||
$this->configureI18nProcessing(
|
||||
$locale = $this->configureI18nProcessing(
|
||||
$search,
|
||||
array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'),
|
||||
AttributeAvTableMap::TABLE_NAME,
|
||||
@@ -117,6 +117,7 @@ class AttributeCombination extends BaseI18nLoop
|
||||
$loopResultRow = new LoopResultRow();
|
||||
|
||||
$loopResultRow
|
||||
->set("LOCALE",$locale)
|
||||
->set("ATTRIBUTE_TITLE", $attributeCombination->getVirtualColumn(AttributeTableMap::TABLE_NAME . '_i18n_TITLE'))
|
||||
->set("ATTRIBUTE_CHAPO", $attributeCombination->getVirtualColumn(AttributeTableMap::TABLE_NAME . '_i18n_CHAPO'))
|
||||
->set("ATTRIBUTE_DESCRIPTION", $attributeCombination->getVirtualColumn(AttributeTableMap::TABLE_NAME . '_i18n_DESCRIPTION'))
|
||||
|
||||
@@ -178,6 +178,7 @@ class Category extends BaseI18nLoop
|
||||
$loopResultRow
|
||||
->set("ID", $category->getId())
|
||||
->set("IS_TRANSLATED",$category->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE",$locale)
|
||||
->set("TITLE", $category->getVirtualColumn('i18n_TITLE'))
|
||||
->set("CHAPO", $category->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("DESCRIPTION", $category->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
|
||||
@@ -101,6 +101,7 @@ class CategoryPath extends BaseI18nLoop
|
||||
->set("TITLE",$category->getVirtualColumn('i18n_TITLE'))
|
||||
->set("URL", $category->getUrl($locale))
|
||||
->set("ID", $category->getId())
|
||||
->set("LOCALE",$locale)
|
||||
;
|
||||
|
||||
$results[] = $loopResultRow;
|
||||
|
||||
@@ -72,10 +72,11 @@ class Config extends BaseI18nLoop
|
||||
{
|
||||
$id = $this->getId();
|
||||
$name = $this->getVariable();
|
||||
$secured = $this->getSecured();
|
||||
|
||||
$search = ConfigQuery::create();
|
||||
|
||||
$this->configureI18nProcessing($search);
|
||||
$locale = $this->configureI18nProcessing($search);
|
||||
|
||||
if (! is_null($id))
|
||||
$search->filterById($id);
|
||||
@@ -90,8 +91,8 @@ class Config extends BaseI18nLoop
|
||||
if ($this->getHidden() != BooleanOrBothType::ANY)
|
||||
$search->filterByHidden($this->getHidden() ? 1 : 0);
|
||||
|
||||
if ($this->getSecured() != BooleanOrBothType::ANY)
|
||||
$search->filterBySecured($this->getSecured() ? 1 : 0);
|
||||
if (! is_null($secured) && $secured != BooleanOrBothType::ANY)
|
||||
$search->filterBySecured($secured ? 1 : 0);
|
||||
|
||||
$search->orderByName(Criteria::ASC);
|
||||
|
||||
@@ -108,6 +109,7 @@ class Config extends BaseI18nLoop
|
||||
->set("NAME" , $result->getName())
|
||||
->set("VALUE" , $result->getValue())
|
||||
->set("IS_TRANSLATED", $result->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE",$locale)
|
||||
->set("TITLE" , $result->getVirtualColumn('i18n_TITLE'))
|
||||
->set("CHAPO" , $result->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("DESCRIPTION" , $result->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
|
||||
@@ -214,6 +214,7 @@ class Content extends BaseI18nLoop
|
||||
|
||||
$loopResultRow->set("ID", $content->getId())
|
||||
->set("IS_TRANSLATED",$content->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE",$locale)
|
||||
->set("TITLE",$content->getVirtualColumn('i18n_TITLE'))
|
||||
->set("CHAPO", $content->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("DESCRIPTION", $content->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
|
||||
@@ -68,7 +68,7 @@ class Country extends BaseI18nLoop
|
||||
$search = CountryQuery::create();
|
||||
|
||||
/* manage translations */
|
||||
$this->configureI18nProcessing($search);
|
||||
$locale = $this->configureI18nProcessing($search);
|
||||
|
||||
$id = $this->getId();
|
||||
|
||||
@@ -107,6 +107,7 @@ class Country extends BaseI18nLoop
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow->set("ID", $country->getId())
|
||||
->set("IS_TRANSLATED",$country->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE",$locale)
|
||||
->set("TITLE",$country->getVirtualColumn('i18n_TITLE'))
|
||||
->set("CHAPO", $country->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("DESCRIPTION", $country->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
|
||||
@@ -67,7 +67,7 @@ class Currency extends BaseI18nLoop
|
||||
$search = CurrencyQuery::create();
|
||||
|
||||
/* manage translations */
|
||||
$this->configureI18nProcessing($search, array('NAME'));
|
||||
$locale = $this->configureI18nProcessing($search, array('NAME'));
|
||||
|
||||
$id = $this->getId();
|
||||
|
||||
@@ -98,6 +98,7 @@ class Currency extends BaseI18nLoop
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow->set("ID", $currency->getId())
|
||||
->set("IS_TRANSLATED",$currency->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE",$locale)
|
||||
->set("NAME",$currency->getVirtualColumn('i18n_NAME'))
|
||||
->set("ISOCODE", $currency->getCode())
|
||||
->set("SYMBOL", $currency->getSymbol())
|
||||
|
||||
@@ -82,7 +82,7 @@ class Feature extends BaseI18nLoop
|
||||
$search = FeatureQuery::create();
|
||||
|
||||
/* manage translations */
|
||||
$this->configureI18nProcessing($search);
|
||||
$locale = $this->configureI18nProcessing($search);
|
||||
|
||||
$id = $this->getId();
|
||||
|
||||
@@ -148,6 +148,7 @@ class Feature extends BaseI18nLoop
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow->set("ID", $feature->getId())
|
||||
->set("IS_TRANSLATED",$feature->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE",$locale)
|
||||
->set("TITLE",$feature->getVirtualColumn('i18n_TITLE'))
|
||||
->set("CHAPO", $feature->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("DESCRIPTION", $feature->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
|
||||
@@ -75,7 +75,7 @@ class FeatureAvailability extends BaseI18nLoop
|
||||
$search = FeatureAvQuery::create();
|
||||
|
||||
/* manage translations */
|
||||
$this->configureI18nProcessing($search);
|
||||
$locale = $this->configureI18nProcessing($search);
|
||||
|
||||
$id = $this->getId();
|
||||
|
||||
@@ -123,6 +123,7 @@ class FeatureAvailability extends BaseI18nLoop
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow->set("ID", $featureAv->getId())
|
||||
->set("IS_TRANSLATED",$featureAv->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE",$locale)
|
||||
->set("TITLE",$featureAv->getVirtualColumn('i18n_TITLE'))
|
||||
->set("CHAPO", $featureAv->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("DESCRIPTION", $featureAv->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
|
||||
@@ -82,7 +82,7 @@ class FeatureValue extends BaseI18nLoop
|
||||
$search = FeatureProductQuery::create();
|
||||
|
||||
/* manage featureAv translations */
|
||||
$this->configureI18nProcessing(
|
||||
$locale = $this->configureI18nProcessing(
|
||||
$search,
|
||||
array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'),
|
||||
FeatureAvTableMap::TABLE_NAME,
|
||||
@@ -141,7 +141,9 @@ class FeatureValue extends BaseI18nLoop
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow->set("ID", $featureValue->getId());
|
||||
|
||||
$loopResultRow->set("PERSONAL_VALUE", $featureValue->getByDefault())
|
||||
$loopResultRow
|
||||
->set("LOCALE",$locale)
|
||||
->set("PERSONAL_VALUE", $featureValue->getByDefault())
|
||||
->set("TITLE",$featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_TITLE'))
|
||||
->set("CHAPO", $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_CHAPO'))
|
||||
->set("DESCRIPTION", $featureValue->getVirtualColumn(FeatureAvTableMap::TABLE_NAME . '_i18n_DESCRIPTION'))
|
||||
|
||||
@@ -156,6 +156,7 @@ class Folder extends BaseI18nLoop
|
||||
$loopResultRow
|
||||
->set("ID", $folder->getId())
|
||||
->set("IS_TRANSLATED",$folder->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE",$locale)
|
||||
->set("TITLE",$folder->getVirtualColumn('i18n_TITLE'))
|
||||
->set("CHAPO", $folder->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("DESCRIPTION", $folder->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
|
||||
@@ -164,7 +164,7 @@ class Image extends BaseI18nLoop
|
||||
$search = $this->getSearchQuery($object_type, $object_id);
|
||||
|
||||
/* manage translations */
|
||||
$this->configureI18nProcessing($search);
|
||||
$locale = $this->configureI18nProcessing($search);
|
||||
|
||||
$id = $this->getId();
|
||||
|
||||
@@ -186,7 +186,7 @@ class Image extends BaseI18nLoop
|
||||
$background_color = $this->getBackgroundColor();
|
||||
$quality = $this->getQuality();
|
||||
$effects = $this->getEffects();
|
||||
$effects = $this->getEffects();
|
||||
|
||||
if (! is_null($effects)) {
|
||||
$effects = explode(',', $effects);
|
||||
}
|
||||
@@ -245,14 +245,15 @@ class Image extends BaseI18nLoop
|
||||
|
||||
$loopResultRow
|
||||
->set("ID", $result->getId())
|
||||
->set("LOCALE",$locale)
|
||||
->set("IMAGE_URL", $event->getFileUrl())
|
||||
->set("ORIGINAL_IMAGE_URL", $event->getOriginalFileUrl())
|
||||
->set("IMAGE_PATH", $event->getCacheFilepath())
|
||||
->set("ORIGINAL_IMAGE_PATH", $source_filepath)
|
||||
->set("TITLE", $result->getTitle())
|
||||
->set("CHAPO", $result->getChapo())
|
||||
->set("DESCRIPTION", $result->getDescription())
|
||||
->set("POSTSCRIPTUM", $result->getPostscriptum())
|
||||
->set("TITLE",$folder->getVirtualColumn('i18n_TITLE'))
|
||||
->set("CHAPO", $folder->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("DESCRIPTION", $folder->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
->set("POSTSCRIPTUM", $folder->getVirtualColumn('i18n_POSTSCRIPTUM'))
|
||||
->set("POSITION", $result->getPosition())
|
||||
->set("OBJECT_TYPE", $object_type)
|
||||
->set("OBJECT_ID", $object_id)
|
||||
|
||||
@@ -509,6 +509,7 @@ class Product extends BaseI18nLoop
|
||||
$loopResultRow->set("ID", $product->getId())
|
||||
->set("REF",$product->getRef())
|
||||
->set("IS_TRANSLATED",$product->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE",$locale)
|
||||
->set("TITLE",$product->getVirtualColumn('i18n_TITLE'))
|
||||
->set("CHAPO", $product->getVirtualColumn('i18n_CHAPO'))
|
||||
->set("DESCRIPTION", $product->getVirtualColumn('i18n_DESCRIPTION'))
|
||||
|
||||
@@ -65,7 +65,7 @@ class Title extends BaseI18nLoop
|
||||
$search = CustomerTitleQuery::create();
|
||||
|
||||
/* manage translations */
|
||||
$this->configureI18nProcessing($search, array('SHORT', 'LONG'));
|
||||
$locale = $this->configureI18nProcessing($search, array('SHORT', 'LONG'));
|
||||
|
||||
$id = $this->getId();
|
||||
|
||||
@@ -84,6 +84,7 @@ class Title extends BaseI18nLoop
|
||||
$loopResultRow = new LoopResultRow();
|
||||
$loopResultRow->set("ID", $title->getId())
|
||||
->set("IS_TRANSLATED",$title->getVirtualColumn('IS_TRANSLATED'))
|
||||
->set("LOCALE",$locale)
|
||||
->set("DEFAULT", $title->getByDefault())
|
||||
->set("SHORT", $title->getVirtualColumn('i18n_SHORT'))
|
||||
->set("LONG", $title->getVirtualColumn('i18n_LONG'));
|
||||
|
||||
@@ -49,13 +49,18 @@ class ParserContext implements \IteratorAggregate
|
||||
/**
|
||||
* @param BaseForm $form the errored form
|
||||
*/
|
||||
public function setErrorForm(BaseForm $form)
|
||||
public function addForm(BaseForm $form)
|
||||
{
|
||||
$this->set('error_form', $form);
|
||||
$this->set($form->getName(), $form);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getForm($name)
|
||||
{
|
||||
return $this->get($name, null);
|
||||
}
|
||||
|
||||
public function setGeneralError($error)
|
||||
{
|
||||
$this->set('general_error', $error);
|
||||
@@ -63,16 +68,6 @@ class ParserContext implements \IteratorAggregate
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getErrorForm()
|
||||
{
|
||||
return $this->get('error_form', null);
|
||||
}
|
||||
|
||||
public function clearErrorForm()
|
||||
{
|
||||
return $this->remove('error_form');
|
||||
}
|
||||
|
||||
// -- Internal table manipulation ------------------------------------------
|
||||
|
||||
public function set($name, $value)
|
||||
|
||||
@@ -82,6 +82,7 @@ class Form extends AbstractSmartyPlugin
|
||||
|
||||
public function generateForm($params, $content, \Smarty_Internal_Template $template, &$repeat)
|
||||
{
|
||||
|
||||
if ($repeat) {
|
||||
|
||||
$name = $this->getParam($params, 'name');
|
||||
@@ -93,15 +94,11 @@ class Form extends AbstractSmartyPlugin
|
||||
$instance = $this->createInstance($name);
|
||||
|
||||
// Check if parser context contains our form
|
||||
$errorForm = $this->parserContext->getErrorForm();
|
||||
$form = $this->parserContext->getForm($instance->getName());
|
||||
|
||||
if (null != $errorForm && $errorForm->getName() == $instance->getName()) {
|
||||
|
||||
// Re-use the errored form
|
||||
$instance = $errorForm;
|
||||
|
||||
// Don't do that, as we may want to use this form firther in the template code
|
||||
//$this->parserContext->clearErrorForm();
|
||||
if (null != $form) {
|
||||
// Re-use the form
|
||||
$instance = $form;
|
||||
}
|
||||
|
||||
$instance->createView();
|
||||
@@ -110,7 +107,8 @@ class Form extends AbstractSmartyPlugin
|
||||
|
||||
$template->assign("form_error", $instance->hasError() ? true : false);
|
||||
$template->assign("form_error_message", $instance->getErrorMessage());
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,13 +311,13 @@ class TheliaLoop extends AbstractSmartyPlugin
|
||||
$type = strtolower($smartyParams['type']);
|
||||
|
||||
if (! isset($this->loopDefinition[$type])) {
|
||||
throw new ElementNotFoundException(sprintf("%s loop does not exists", $type));
|
||||
throw new ElementNotFoundException(sprintf("'%s' loop type does not exists", $type));
|
||||
}
|
||||
|
||||
$class = new \ReflectionClass($this->loopDefinition[$type]);
|
||||
|
||||
if ($class->isSubclassOf("Thelia\Core\Template\Element\BaseLoop") === false) {
|
||||
throw new InvalidElementException(sprintf("%s Loop class have to extends Thelia\Core\Template\Element\BaseLoop",
|
||||
throw new InvalidElementException(sprintf("'%s' Loop class should extends Thelia\Core\Template\Element\BaseLoop",
|
||||
$type));
|
||||
}
|
||||
|
||||
|
||||
@@ -212,14 +212,14 @@ class SmartyParser extends Smarty implements ParserInterface
|
||||
$templateDir = realpath(THELIA_TEMPLATE_DIR . rtrim($this->template, "/") . "/");
|
||||
|
||||
if (strpos($pathFileName, $templateDir) !== 0) {
|
||||
throw new ResourceNotFoundException(sprintf("%s view does not exists", $file));
|
||||
throw new ResourceNotFoundException(sprintf("'%s' view does not exists", $file));
|
||||
}
|
||||
|
||||
if (!file_exists($fileName)) {
|
||||
$fileName .= ".html";
|
||||
|
||||
if (!file_exists($fileName)) {
|
||||
throw new ResourceNotFoundException(sprintf("%s file not found in %s template", $file, $this->template));
|
||||
throw new ResourceNotFoundException(sprintf("'%s' file not found in %s template", $file, $this->template));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -125,8 +125,10 @@ class TheliaHttpKernel extends HttpKernel
|
||||
$lang = $this->detectLang($request);
|
||||
|
||||
if ($lang) {
|
||||
$request->getSession()->set("lang", $lang->getCode());
|
||||
$request->getSession()->set("locale", $lang->getLocale());
|
||||
$request->getSession()
|
||||
->setLang($lang->getCode())
|
||||
->setLocale($lang->getLocale())
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +166,7 @@ class TheliaHttpKernel extends HttpKernel
|
||||
}
|
||||
|
||||
//check if lang is not defined. If not we have to search the good one.
|
||||
if (null === $request->getSession()->get("lang")) {
|
||||
if (null === $request->getSession()->getLang()) {
|
||||
|
||||
if (Model\ConfigQuery::read("one_domain_foreach_lang", false) == 1) {
|
||||
//find lang with domain
|
||||
@@ -173,9 +175,7 @@ class TheliaHttpKernel extends HttpKernel
|
||||
|
||||
//find default lang
|
||||
return Model\LangQuery::create()->findOneByByDefault(1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function initSession(Request $request)
|
||||
|
||||
Reference in New Issue
Block a user