diff --git a/modules/blockcustomerprivacy/blockcustomerprivacy.php b/modules/blockcustomerprivacy/blockcustomerprivacy.php index dbf6650d0..5834c7522 100644 --- a/modules/blockcustomerprivacy/blockcustomerprivacy.php +++ b/modules/blockcustomerprivacy/blockcustomerprivacy.php @@ -74,86 +74,10 @@ class Blockcustomerprivacy extends Module } Configuration::updateValue('CUSTPRIV_MESSAGE', $message_trads, true); $this->_clearCache('blockcustomerprivacy.tpl'); - $output = '
'.$this->l('Configuration updated').'
'; - } + $output .= $this->displayConfirmation($this->l('Configuration updated')); + } - $content = ''; - if (version_compare(_PS_VERSION_, '1.4.0.0') >= 0) - $content .= ' - - - - '; - else - { - $content .= ' - - '; - } - - $values = Configuration::getInt('CUSTPRIV_MESSAGE'); - $content .= $output; - $content .= ' -
'.$this->displayName.' -
- -
'; - foreach ($languages as $language) - $content .= ' -
- -
'; - $content .= $this->displayFlags($languages, $id_lang_default, 'ccont', 'ccont', true).' -
-
-

- '.$this->l('The customer data privacy message will be displayed in the account creation form.').'
- '.$this->l('Tip: If the customer privacy message is too long to be written directly in the form, you can add a link to one of your pages. This can easily be created via the "CMS" page under the "Preferences" menu.').' -

-
-
 
-
- -
-
-
'; - - return $content; + return $output.$this->renderForm(); } public function checkConfig() @@ -193,4 +117,59 @@ class Blockcustomerprivacy extends Module return $this->display(__FILE__, 'blockcustomerprivacy.tpl', $this->getCacheId()); } -} + + public function renderForm() + { + $fields_form = array( + 'form' => array( + 'legend' => array( + 'title' => $this->l('Settings'), + 'icon' => 'icon-cogs' + ), + 'input' => array( + array( + 'type' => 'textarea', + 'lang' => true, + 'autoload_rte' => true, + 'label' => $this->l('Customer data privacy message :'), + 'name' => 'custpriv_message', + 'desc' => $this->l('The customer data privacy message will be displayed in the account creation form.').'
'.$this->l(' +Tip: If the customer privacy message is too long to be written directly in the form, you can add a link to one of your pages. This can easily be created via the "CMS" page under the "Preferences" menu.') + ), + ), + 'submit' => array( + 'title' => $this->l('Save'), + 'class' => 'btn btn-primary') + ), + ); + + $helper = new HelperForm(); + $helper->show_toolbar = false; + $helper->table = $this->table; + $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT')); + $helper->default_form_language = $lang->id; + $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0; + $this->fields_form = array(); + + $helper->identifier = $this->identifier; + $helper->submit_action = 'submitCustPrivMess'; + $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name; + $helper->token = Tools::getAdminTokenLite('AdminModules'); + $helper->tpl_vars = array( + 'fields_value' => $this->getConfigFieldsValues(), + 'languages' => $this->context->controller->getLanguages(), + 'id_language' => $this->context->language->id + ); + + return $helper->generateForm(array($fields_form)); + } + + public function getConfigFieldsValues() + { + $return = array(); + foreach (Language::getLanguages(false) as $lang) + $return['custpriv_message'][(int)$lang['id_lang']] = Tools::getValue('custpriv_message_'.(int)$lang['id_lang'], Configuration::get('CUSTPRIV_MESSAGE', (int)$lang['id_lang'])); + + return $return; + } +} \ No newline at end of file