856 lines
33 KiB
PHP
Raw Normal View History

2016-04-14 16:14:31 +02:00
<?php
/**
* Description of AdminPrivatesSales
*
* @company Antadis
*/
class AdminRelancecommandeController extends ModuleAdminController {
protected $position_identifier = 'id_relancecommande';
public function __construct() {
$this->bootstrap = true;
$this->table = 'privatesales';
$this->className = 'Relan';
$this->identifier = 'id_relancecommande';
$this->lang = true;
$this->deleted = false;
$this->colorOnBackground = false;
$this->context = Context::getContext();
$this->explicitSelect = true;
$this->_defaultOrderBy = 'id_relancecommande';
parent::__construct();
$position = false ;
$this->fields_list = array(
'id_privatesales' => array(
'title' => $this->l('ID'),
'align' => 'center',
'width' => 25,
'filter_key' => 'a!id_privatesales'
),
'title' => array(
'title' => $this->l('Name')
),
'id_category' => array(
'title' => $this->l('Category parent'),
'callback' => "getCategoryName"
),
'date_start' => array(
'title' => $this->l('Date Start'),
'width' => 130,
'align' => 'right',
'type' => 'datetime',
'filter_key' => 'a!date_start'
),
'date_end' => array(
'title' => $this->l('Date End'),
'width' => 130,
'align' => 'right',
'type' => 'datetime',
'filter_key' => 'a!date_end'
),
'date_shipping' => array(
'title' => $this->l('Date Shipping'),
'width' => 130,
'align' => 'right',
'type' => 'date',
'filter_key' => 'a!date_shipping'
),
'univers' => array(
'title' => $this->l('Univers'),
'active' => 'status',
'filter_key' => 'a!univers',
'align' => 'text-center',
'type' => 'bool',
'class' => 'fixed-width-sm',
'orderby' => false
),
'active' => array(
'title' => $this->l('Enabled'),
'active' => 'status',
'filter_key' => 'a!active',
'align' => 'text-center',
'type' => 'bool',
'class' => 'fixed-width-sm',
'orderby' => false
),
'archived' => array(
'title' => $this->l('Archived'),
'active' => 'archived',
'filter_key' => 'a!archived',
'align' => 'text-center',
'type' => 'bool',
'class' => 'fixed-width-sm',
'orderby' => false
),
'flash' => array(
'title' => $this->l('Sale Flash'),
'active' => 'flash',
'filter_key' => 'a!flash',
'align' => 'text-center',
'type' => 'bool',
'class' => 'fixed-width-sm',
'orderby' => false
),
'news' => array(
'title' => $this->l('Sale News'),
'active' => 'news',
'filter_key' => 'a!news',
'align' => 'text-center',
'type' => 'bool',
'class' => 'fixed-width-sm',
'orderby' => false
)
);
if($position){
$this->fields_list['position'] = array(
'title' => $this->l('Position'),
'filter_key' => 'a!position',
'position' => 'position',
'align' => 'center'
);
}
$this->actions = array('edit','delete');
if(Shop::isFeatureActive())
{
Context::getContext()->controller->multishop_context = Shop::CONTEXT_ALL;
}
$this->bulk_actions = array(
'delete' => array(
'text' => $this->l('Delete selected'),
'icon' => 'icon-trash',
'confirm' => $this->l('Delete selected items?')
)
);
$this->specificConfirmDelete = false;
}
public function initPageHeaderToolbar()
{
parent::initPageHeaderToolbar();
if ($this->display != 'edit' && $this->display != 'add')
{
$this->page_header_toolbar_btn['new_sales'] = array(
'href' => self::$currentIndex.'&addprivatesales&token='.$this->token,
'desc' => $this->l('Add new sales', null, null, false),
'icon' => 'process-icon-new'
);
$this->page_header_toolbar_btn['all'] = array(
'href' => $this->context->link->getAdminLink('AdminPrivateSales', true),
'desc' => $this->l('All Sales', null, null, false)
);
$this->page_header_toolbar_btn['current'] = array(
'href' => $this->context->link->getAdminLink('AdminPrivateSales', true).'&listby=current',
'desc' => $this->l('Current Sales', null, null, false)
);
$this->page_header_toolbar_btn['future'] = array(
'href' => $this->context->link->getAdminLink('AdminPrivateSales', true).'&listby=future',
'desc' => $this->l('Future Sales', null, null, false)
);
$this->page_header_toolbar_btn['past'] = array(
'href' => $this->context->link->getAdminLink('AdminPrivateSales', true).'&listby=past',
'desc' => $this->l('Past Sales', null, null, false)
);
$this->page_header_toolbar_btn['archived'] = array(
'href' => $this->context->link->getAdminLink('AdminPrivateSales', true).'&listby=archived',
'desc' => $this->l('Archived Sales', null, null, false)
);
}
}
public function setMedia(){
parent::setMedia();
}
public function initToolbar(){
parent::initToolbar();
$this->toolbar_btn['all'] = array(
'href' => $this->context->link->getAdminLink('AdminPrivateSales', true),
'desc' => $this->l('All Sales')
);
$this->toolbar_btn['current'] = array(
'href' => $this->context->link->getAdminLink('AdminPrivateSales', true).'&listby=current',
'desc' => $this->l('Current Sales')
);
$this->toolbar_btn['future'] = array(
'href' => $this->context->link->getAdminLink('AdminPrivateSales', true).'&listby=future',
'desc' => $this->l('Future Sales')
);
$this->toolbar_btn['past'] = array(
'href' => $this->context->link->getAdminLink('AdminPrivateSales', true).'&listby=past',
'desc' => $this->l('Past Sales')
);
$this->toolbar_btn['archived'] = array(
'href' => $this->context->link->getAdminLink('AdminPrivateSales', true).'&listby=archived',
'desc' => $this->l('Archived Sales')
);
$this->context->smarty->assign('toolbar_scroll', 1);
$this->context->smarty->assign('show_toolbar', 1);
$this->context->smarty->assign('toolbar_btn', $this->toolbar_btn);
}
/**
*
*/
public function renderForm(){
if (!($obj = $this->loadObject(true)))
return;
$context = Context::getContext();
$id_shop = Context::getContext()->shop->id;
$categories = array();
$busy_categories = array();
foreach(Db::getInstance()->executeS('
SELECT `id_category`
FROM `'._DB_PREFIX_.'privatesales`
'.(Validate::isLoadedObject($this->object)? 'WHERE `id_privatesales` != '.(int) $this->object->id: '').'
') as $c) {
$busy_categories[] = $c['id_category'];
}
foreach(Category::getChildren((int) Configuration::get('PRIVATESALES_ROOT'), (int) $this->context->cookie->id_lang, FALSE) as $c) {
if(!in_array($c['id_category'], $busy_categories)){
$c['id'] = $c['id_category'] ;
$categories[] = $c;
}
}
if (Tools::isSubmit('id_privatesales')){
$id_privatesales = (int)Tools::getValue('id_privatesales');
$urlcurrent = __PS_BASE_URI__.'modules/privatesales/img/'.$id_privatesales.'/current/'.$id_privatesales ;
$urlfuture = __PS_BASE_URI__.'modules/privatesales/img/'.$id_privatesales.'/future/'.$id_privatesales ;
$urlpast = __PS_BASE_URI__.'modules/privatesales/img/'.$id_privatesales.'/past/'.$id_privatesales ;
$urltrailer = __PS_BASE_URI__.'modules/privatesales/img/'.$id_privatesales.'/trailer/'.$id_privatesales ;
$urlnewsletter = __PS_BASE_URI__.'modules/privatesales/img/'.$id_privatesales.'/newsletter/'.$id_privatesales ;
$urllogo = __PS_BASE_URI__.'modules/privatesales/img/'.$id_privatesales.'/logo/'.$id_privatesales ;
$urlflashsale = __PS_BASE_URI__.'modules/privatesales/img/'.$id_privatesales.'/flashsale/'.$id_privatesales ;
$urlhotspot = __PS_BASE_URI__.'modules/privatesales/img/'.$id_privatesales.'/hotspot/'.$id_privatesales ;
}else{
$urlcurrent = "noimg" ;
$urlfuture = "noimg" ;
$urlpast = "noimg" ;
$urltrailer = "noimg" ;
$urlnewsletter = "noimg" ;
$urllogo = "noimg" ;
$urlflashsale = "noimg" ;
$urlhotspot = "noimg" ;
}
$groups = Group::getGroups($this->default_form_language, true);
$brands = array();
$sale_brands = ($this->display == 'add'? array(): $this->object->getBrands());
foreach(Manufacturer::getManufacturers() as $m) {
$m['selected'] = (bool) in_array($m['id_manufacturer'], $sale_brands);
$brands[] = $m;
}
$salescategory = array();
$sale_privatesales = ($this->display == 'add'? array(): $this->object->getSalesCategory());
foreach(SaleCategory::getCategoryTab((int) $this->context->cookie->id_lang, FALSE) as $m) {
$m['selected'] = (bool) in_array($m['id_privatesales_category'], $sale_privatesales);
$salescategory[] = $m;
}
$this->fields_form = array(
'multilang' => true,
'tinymce' => true,
'legend' => array(
'title' => $this->l('Sale'),
),
'submit' => array(
'name' => 'submitSale',
'title' => $this->l('Save'),
),
'input' => array(
array(
'type' => 'text',
'label' => $this->l('Name'),
'name' => 'title',
'lang' => true,
'required' => true,
'form_group_class' => 'fieldhide input_info',
'size' => 255
),
array(
'type' => 'text',
'label' => $this->l('Subtitle'),
'name' => 'subtitle',
'lang' => true,
'form_group_class' => 'fieldhide input_info',
'size' => 255
),
array(
'type' => 'datetime',
'label' => $this->l('Date Start'),
'name' => 'date_start',
'form_group_class' => 'fieldhide input_dates',
'required' => true,
'size' => 33,
),
array(
'type' => 'datetime',
'label' => $this->l('Date End'),
'name' => 'date_end',
'form_group_class' => 'fieldhide input_dates',
'required' => true,
'size' => 33,
),
array(
'type' => 'datetime',
'label' => $this->l('Date Start Hotspot'),
'name' => 'date_start_hotspot',
'form_group_class' => 'fieldhide input_dates',
'size' => 33,
),
array(
'type' => 'datetime',
'label' => $this->l('Date End Hotspot'),
'name' => 'date_end_hotspot',
'form_group_class' => 'fieldhide input_dates',
'size' => 33,
),
array(
'type' => 'date',
'label' => $this->l('Date Shipping'),
'name' => 'date_shipping',
'form_group_class' => 'fieldhide input_dates',
'required' => true,
'size' => 33,
),
array(
'type' => 'textarea',
'label' => $this->l('Description'),
'name' => 'description',
'form_group_class' => 'fieldhide input_info',
'lang' => true,
'cols' => 60,
'rows' => 60
),
array(
'type' => 'text',
'label' => $this->l('Percent'),
'name' => 'percent',
'form_group_class' => 'fieldhide input_info',
'size' => 255
),
array(
'type' => 'file',
'label' => $this->l('Select an image for logo'),
'name' => 'imagelogo',
'form_group_class' => 'fieldhide input_img',
'url' => $urllogo
),
array(
'type' => 'file',
'label' => $this->l('Select an image for current'),
'name' => 'imagecurrent',
'form_group_class' => 'fieldhide input_img',
'url' => $urlcurrent
),
array(
'type' => 'switch',
'label' => $this->l('Sale Flash'),
'name' => 'flash',
'required' => false,
'class' => 't',
'form_group_class' => 'fieldhide input_info',
'is_bool' => true,
'values' => array(
array(
'id' => 'flash_on',
'value' => 1
),
array(
'id' => 'flash_off',
'value' => 0
)
),
),
array(
'type' => 'switch',
'label' => $this->l('Sale News'),
'name' => 'news',
'required' => false,
'class' => 't',
'form_group_class' => 'fieldhide input_info',
'is_bool' => true,
'values' => array(
array(
'id' => 'news_on',
'value' => 1
),
array(
'id' => 'news_off',
'value' => 0
)
),
),
array(
'type' => 'switch',
'label' => $this->l('Univers'),
'name' => 'univers',
'required' => false,
'class' => 't',
'form_group_class' => 'fieldhide input_info',
'is_bool' => true,
'values' => array(
array(
'id' => 'univers_on',
'value' => 1
),
array(
'id' => 'univers_off',
'value' => 0
)
),
),
array(
'type' => 'switch',
'label' => $this->l('Enabled'),
'name' => 'active',
'required' => false,
'class' => 't',
'form_group_class' => 'fieldhide input_info',
'is_bool' => true,
'values' => array(
array(
'id' => 'active_on',
'value' => 1
),
array(
'id' => 'active_off',
'value' => 0
)
),
),
array(
'type' => 'switch',
'label' => $this->l('Archived'),
'name' => 'archived',
'required' => false,
'class' => 't',
'form_group_class' => 'fieldhide input_info',
'is_bool' => true,
'values' => array(
array(
'id' => 'archived_on',
'value' => 1
),
array(
'id' => 'archived_off',
'value' => 0
)
),
),
array(
'type' => 'select',
'label' => $this->l('Category'),
'name' => 'id_category',
'required' => true,
'form_group_class' => 'fieldhide input_association',
'options' => array(
'query' => $categories,
'id' => 'id',
'name' => 'name'
)
),
array(
'type' => 'group',
'label' => $this->l('Group access'),
'name' => 'groupBox',
'form_group_class' => 'fieldhide input_association',
'values' => $groups,
'col' => '6',
),
array(
'type' => 'brand',
'label' => $this->l('Brand'),
'name' => 'brandBox',
'form_group_class' => 'fieldhide input_association',
'values' => $brands,
'col' => '6',
),
array(
'type' => 'salescategory',
'label' => $this->l('Sales Category'),
'name' => 'categoryBox',
'form_group_class' => 'fieldhide input_association',
'values' => $salescategory,
'col' => '6',
),
array(
'type' => 'shop',
'label' => $this->l('Shop'),
'form_group_class' => 'fieldhide input_association',
'name' => 'checkBoxShopSale'
)
)
);
if(Configuration::get('PRIVATESALES_FUTURESALES')){
$this->fields_form['input'][] = array(
'type' => 'file',
'label' => $this->l('Select an image for future'),
'name' => 'imagefuture',
'form_group_class' => 'fieldhide input_img',
'url' => $urlfuture
);
}
if(Configuration::get('PRIVATESALES_PASTSALES')){
$this->fields_form['input'][] =
array(
'type' => 'file',
'label' => $this->l('Select an image for past'),
'name' => 'imagepast',
'form_group_class' => 'fieldhide input_img',
'url' => $urlpast
);
}
if(Configuration::get('PRIVATESALES_HOTSPOT')){
$this->fields_form['input'][] =
array(
'type' => 'file',
'label' => $this->l('Select an image for hotspot'),
'name' => 'imagehotspot',
'form_group_class' => 'fieldhide input_img',
'url' => $urlhotspot
);
}
if(Configuration::get('PRIVATESALES_FLASH')){
$this->fields_form['input'][] =
array(
'type' => 'file',
'label' => $this->l('Select an image for flashsale'),
'name' => 'imageflashsale',
'form_group_class' => 'fieldhide input_img',
'url' => $urlflashsale
);
}
$this->fields_form['input'][] = array(
'type' => 'file',
'label' => $this->l('Select an image for trailer'),
'name' => 'imagetrailer',
'form_group_class' => 'fieldhide input_img',
'url' => $urltrailer
);
$this->fields_form['input'][] = array(
'type' => 'file',
'label' => $this->l('Select an image for newsletter'),
'name' => 'imagenewsletter',
'form_group_class' => 'fieldhide input_newsletter',
'url' => $urlnewsletter
);
$this->fields_form['input'][] = array(
'type' => 'textarea',
'label' => $this->l('Description sur la newsletter'),
'name' => 'description_newsletter',
'form_group_class' => 'fieldhide input_newsletter',
'lang' => true,
'cols' => 60,
'rows' => 60
);
// Added values of object Group
if (!Validate::isUnsignedId($obj->id))
$privatesales_groups = array();
else
$privatesales_groups = $obj->getGroups();
$privatesales_groups_ids = array();
if (is_array($privatesales_groups))
foreach ($privatesales_groups as $privatesales_group)
$privatesales_groups_ids[] = $privatesales_group;
foreach ($groups as $group)
$this->fields_value['groupBox_'.$group['id_group']] =
Tools::getValue('groupBox_'.$group['id_group'], in_array($group['id_group'], $privatesales_groups_ids));
return parent::renderForm();
}
public function init() {
parent::init();
if(Tools::isSubmit('archivedprivatesales') && Tools::getValue('id_privatesales')){
$object = new SaleCore((int)Tools::getValue('id_privatesales'));
if( $object->archived == 0){
$object->archived = 1;
}else{
$object->archived = 0;
}
$object->update();
}
if(Tools::isSubmit('flashprivatesales') && Tools::getValue('id_privatesales')){
$object = new SaleCore((int)Tools::getValue('id_privatesales'));
if( $object->flash == 0){
$object->flash = 1;
}else{
$object->flash = 0;
}
$object->update();
}
if(Tools::isSubmit('newsprivatesales') && Tools::getValue('id_privatesales')){
$object = new SaleCore((int)Tools::getValue('id_privatesales'));
if( $object->news == 0){
$object->news = 1;
}else{
$object->news = 0;
}
$object->update();
}
if(Tools::isSubmit('duplicateprivatesales') && Tools::getValue('id_privatesales')){
$this->processDuplicate();
}
}
/**
*
*/
public static function getCategoryName($id,$obj) {
$context = Context::getContext();
$category = new Category($id,$context->language->id,$context->shop->id);
return $category->name;
}
protected function copyFromPost(&$object, $table){
parent::copyFromPost($object, $table);
if(Shop::isFeatureActive())
{
// Build id_shop_list with checkBoxShopSale
$object->id_shop_list = array();
foreach (Tools::getValue('checkBoxShopSale') as $id_shop => $value)
$object->id_shop_list[] = $id_shop;
}
}
public function processSave()
{
$save = parent::processSave();
if(Validate::isLoadedObject($this->object)){
$languages = Language::getLanguages(false);
foreach ($languages as $language) {
if(Validate::isLoadedObject($this->object)){
$tabimgs = array(
"current",
"hotspot",
"future",
"past",
"trailer",
"newsletter",
"logo",
"flashsale",
);
foreach($tabimgs as $tabimg){
$namePost = 'image'.$tabimg.'_'.$language['id_lang'];
if(isset($_FILES[$namePost]) && !empty($_FILES[$namePost]['tmp_name']) ){
$fileTemp = $_FILES[$namePost]['tmp_name'];
$fileParts = pathinfo($_FILES[$namePost]['name']);
if($fileParts['extension'] == 'jpg' || $fileParts['extension'] == 'png'){
if(!is_dir(_PS_MODULE_DIR_.'privatesales/img/'. $this->object->id)) {
mkdir(_PS_MODULE_DIR_.'privatesales/img/'. $this->object->id, 0775);
}
if(!is_dir(_PS_MODULE_DIR_.'privatesales/img/'. $this->object->id . '/'.$tabimg)) {
mkdir(_PS_MODULE_DIR_.'privatesales/img/'. $this->object->id. '/'.$tabimg, 0775);
}
$res = move_uploaded_file($fileTemp, _PS_MODULE_DIR_.'privatesales/img/'. $this->object->id . '/'.$tabimg.'/'. $this->object->id . '_'.$language['id_lang'].'.jpg');
if(!$res)
$this->errors[] = sprintf(Tools::displayError('An error occured during upload of file %s'), $this->object->id . '.jpg');
else
$this->confirmations[] = sprintf($this->l('File %s has been uploaded'), $this->object->id . '.jpg');
} else
$this->errors[] = sprintf(Tools::displayError('File %s have not good extension, only .jpg or .png'), $this->object->id . '.jpg');
}
}
}
}
Db::getInstance()->execute('
DELETE FROM `'._DB_PREFIX_.'privatesales_group`
WHERE `id_privatesales` = '.(int) $this->object->id.'
');
foreach(Tools::getValue('groupBox', array()) as $group) {
Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'privatesales_group`
VALUES (
'.(int) $this->object->id.',
'.(int) $group.'
)
');
}
Db::getInstance()->execute('
DELETE FROM `'._DB_PREFIX_.'privatesales_brand`
WHERE `id_privatesales` = '.(int) $this->object->id.'
');
foreach(Tools::getValue('brandBox', array()) as $brand) {
Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'privatesales_brand`
VALUES (
'.(int) $this->object->id.',
'.(int) $brand.'
)
');
}
Db::getInstance()->execute('
DELETE FROM `'._DB_PREFIX_.'privatesales_category_sales`
WHERE `id_privatesales` = '.(int) $this->object->id.'
');
foreach(Tools::getValue('categoryBox', array()) as $category) {
Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'privatesales_category_sales`
VALUES (
'.(int) $category.',
'.(int) $this->object->id.'
)
');
}
}
return $save;
}
/**
* Overrides parent for custom redirect link
*/
public function processPosition()
{
if (!Validate::isLoadedObject($object = $this->loadObject()))
{
$this->errors[] = Tools::displayError('An error occurred while updating the status for an object.').
' <b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
}
elseif (!$object->updatePosition((int)Tools::getValue('way'), (int)Tools::getValue('position')))
$this->errors[] = Tools::displayError('Failed to update the position.');
else
{
$privatesales = new SaleCore((int)Tools::getValue('id_privatesales'));
$this->redirect_after = self::$currentIndex.'&listby=current&'.$this->table.'Orderby=position&'.$this->table.'Orderway=asc&action=Customization&conf=5'.(($id_privatesales = (Tools::getIsset('id_privatesales') ? (int)Tools::getValue('id_privatesales') : '')) ? ('&id_privatesales='.$id_privatesales) : '').'&token='.Tools::getAdminTokenLite('AdminPrivateSales');
}
}
public function processDuplicate()
{
echo "ok";
if (Validate::isLoadedObject($privatesales = new SaleCore((int)Tools::getValue('id_privatesales'))))
{
$id_privatesales_old = $privatesales->id;
unset($privatesales->id);
unset($privatesales->id_privatesales);
$privatesales->active = 0;
$privatesales->add();
}
}
public function ajaxProcessUpdatePositions()
{
$way = (int)(Tools::getValue('way'));
$id_privatesales = (int)(Tools::getValue('id'));
$positions = Tools::getValue('privatesales');
if (is_array($positions))
foreach ($positions as $position => $value)
{
$pos = explode('_', $value);
if (isset($pos[2]) && (int)$pos[2] === $id_privatesales)
{
if ($privatesales = new SaleCore((int)$pos[2]))
if (isset($position) && $privatesales->updatePosition($way, $position+1))
{
echo 'ok position '.(int)$position.' for privatesales '.(int)$pos[2]."\r\n";
}
else
echo '{"hasError" : true, "errors" : "Can not update privatesales '.(int)$id_privatesales.' to position '.(int)$position.' "}';
else
echo '{"hasError" : true, "errors" : "This privatesales ('.(int)$id_privatesales.') can t be loaded"}';
break;
}
}
}
/*** HACK TRADUCTION ***/
public static $l_cache;
protected function l($string, $class = 'AdminTab', $addslashes = FALSE, $htmlentities = TRUE)
{
// need to be called in order to populate $classInModule
$str = self::findTranslation('privatesales', $string, 'AdminPrivateSales');
$str = $htmlentities ? htmlentities($str, ENT_QUOTES, 'utf-8') : $str;
return str_replace('"', '&quot;', ($addslashes ? addslashes($str) : stripslashes($str)));
}
/**
* findTranslation (initially in Module class), to make translations works
*
* @param string $name module name
* @param string $string string to translate
* @param string $source current class
* @return string translated string
*/
public static function findTranslation($name, $string, $source)
{
static $_MODULES;
if (!is_array($_MODULES))
{
// note: $_COOKIE[iso_code] is set in createCustomToken();
$file = _PS_MODULE_DIR_.'privatesales/translations/'.Configuration::get('PS_LOCALE_LANGUAGE').'.php';
if (file_exists($file) && include($file))
$_MODULES = !empty($_MODULES)?array_merge($_MODULES, $_MODULE):$_MODULE;
}
$cache_key = $name.'|'.$string.'|'.$source;
if (!isset(self::$l_cache[$cache_key]))
{
if (!is_array($_MODULES))
return $string;
// set array key to lowercase for 1.3 compatibility
$_MODULES = array_change_key_case($_MODULES);
if (defined('_THEME_NAME_'))
$currentKey = '<{'.strtolower($name).'}'.strtolower(_THEME_NAME_).'>'.strtolower($source).'_'.md5($string);
else
$currentKey = '<{'.strtolower($name).'}default>'.strtolower($source).'_'.md5($string);
// note : we should use a variable to define the default theme (instead of "prestashop")
$defaultKey = '<{'.strtolower($name).'}prestashop>'.strtolower($source).'_'.md5($string);
$currentKey = $defaultKey;
if (isset($_MODULES[$currentKey]))
$ret = stripslashes($_MODULES[$currentKey]);
elseif (isset($_MODULES[strtolower($currentKey)]))
$ret = stripslashes($_MODULES[strtolower($currentKey)]);
elseif (isset($_MODULES[$defaultKey]))
$ret = stripslashes($_MODULES[$defaultKey]);
elseif (isset($_MODULES[strtolower($defaultKey)]))
$ret = stripslashes($_MODULES[strtolower($defaultKey)]);
else
$ret = stripslashes($string);
self::$l_cache[$cache_key] = $ret;
}
return self::$l_cache[$cache_key];
}
}