72 lines
2.7 KiB
PHP
72 lines
2.7 KiB
PHP
<?php
|
|
|
|
class AntadisConfiguratorGetContentController
|
|
{
|
|
public function __construct($module, $file, $path)
|
|
{
|
|
$this->file = $file;
|
|
$this->module = $module;
|
|
$this->context = Context::getContext();
|
|
$this->_path = $path;
|
|
}
|
|
|
|
public function processConfiguration()
|
|
{
|
|
if (Tools::isSubmit('antadisconfigurator_form'))
|
|
{
|
|
$enable_events = Tools::getValue('enable_events');
|
|
Configuration::updateValue('ANTADISCONFIGURATOR_EVENTS', $enable_events);
|
|
$this->context->smarty->assign('confirmation', 'ok');
|
|
}
|
|
}
|
|
|
|
public function renderForm()
|
|
{
|
|
$fields_form = array(
|
|
'form' => array(
|
|
'legend' => array(
|
|
'title' => $this->module->l('Configurator options'),
|
|
'icon' => 'icon-envelope'
|
|
),
|
|
'input' => array(
|
|
array(
|
|
'type' => 'switch',
|
|
'label' => $this->module->l('Price change on form event:'),
|
|
'name' => 'enable_events',
|
|
'desc' => $this->module->l('For better performance disable event when options have no price impact'),
|
|
'values' => array(
|
|
array('id' => 'enable_pricechange_1', 'value' => 1, 'label' => $this->module->l('Enabled')),
|
|
array('id' => 'enable_pricechange_0', 'value' => 0, 'label' => $this->module->l('Disabled'))
|
|
),
|
|
),
|
|
),
|
|
'submit' => array('title' => $this->module->l('Save'))
|
|
)
|
|
);
|
|
|
|
$helper = new HelperForm();
|
|
$helper->table = 'mymodcomments';
|
|
$helper->default_form_language = (int)Configuration::get('PS_LANG_DEFAULT');
|
|
$helper->allow_employee_form_lang = (int)Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG');
|
|
$helper->submit_action = 'antadisconfigurator_form';
|
|
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->module->name.'&tab_module='.$this->module->tab.'&module_name='.$this->module->name;
|
|
$helper->token = Tools::getAdminTokenLite('AdminModules');
|
|
$helper->tpl_vars = array(
|
|
'fields_value' => array(
|
|
'enable_events' => Tools::getValue('enable_events', Configuration::get('ANTADISCONFIGURATOR_EVENTS')),
|
|
),
|
|
'languages' => $this->context->controller->getLanguages()
|
|
);
|
|
|
|
return $helper->generateForm(array($fields_form));
|
|
}
|
|
|
|
public function run()
|
|
{
|
|
$this->processConfiguration();
|
|
$html_confirmation_message = $this->module->display($this->file, 'getContent.tpl');
|
|
$html_form = $this->renderForm();
|
|
return $html_confirmation_message.$html_form;
|
|
}
|
|
}
|