//now use displayError() in modules

This commit is contained in:
Vincent Augagneur
2013-10-02 14:39:41 +02:00
parent 1cb7f27a21
commit dec213aecf
6 changed files with 93 additions and 27 deletions
@@ -655,4 +655,85 @@ class ReferralProgram extends Module
}
return false;
}
public function renderForm()
{
$fields_form_1 = array(
'form' => array(
'legend' => array(
'title' => $this->l('Settings'),
'icon' => 'icon-cogs'
),
'input' => array(
array(
'type' => 'text',
'name' => '',
'class' => 'fixed-width-md',
'label' => $this->l('Minimum number of orders a sponsored friend must place to get their voucher:'),
),
),
'submit' => array(
'title' => $this->l('Delete catalog'),
'class' => 'btn btn-primary',
'name' => 'submitTruncateCatalog',
'id' => 'submitTruncateCatalog',
)
),
);
$fields_form_2 = array(
'form' => array(
'legend' => array(
'title' => $this->l('Orders and customers'),
'icon' => 'icon-cogs'
),
'description' => $this->l('I understand that all the orders and customers will be removed without possible rollback: customers, carts, orders, connections, guests, messages, stats...'),
'submit' => array(
'title' => $this->l('Delete orders & customers'),
'class' => 'btn btn-primary',
'name' => 'submitTruncateSales',
'id' => 'submitTruncateSales',
)
),
);
$fields_form_3 = array(
'form' => array(
'legend' => array(
'title' => $this->l('Functional integrity constraints'),
'icon' => 'icon-cogs'
),
'submit' => array(
'title' => $this->l('Check & fix'),
'class' => 'btn btn-primary',
'name' => 'submitCheckAndFix',
)
),
);
$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->id = (int)Tools::getValue('id_carrier');
$helper->identifier = $this->identifier;
$helper->submit_action = 'btnSubmit';
$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_1, $fields_form_2, $fields_form_3));
}
public function getConfigFieldsValues()
{
return array('value' => '');
}
}