131 lines
4.1 KiB
PHP
131 lines
4.1 KiB
PHP
<?php
|
|
|
|
require_once _PS_MODULE_DIR_ . '/configurator/classes/ConfiguratorGroup.php';
|
|
|
|
class AdminGroupsConfiguratorController extends ModuleAdminController {
|
|
|
|
protected $position_identifier = 'id_configurator_group';
|
|
|
|
public function __construct()
|
|
{
|
|
$this->table = 'configurator_group';
|
|
$this->className = 'ConfiguratorGroup';
|
|
$this->lang = false;
|
|
$this->_defaultOrderBy = 'id_configurator_group';
|
|
$this->_defaultOrderWay = 'ASC';
|
|
$this->bootstrap = true;
|
|
|
|
$this->context = Context::getContext();
|
|
|
|
parent::__construct();
|
|
|
|
$this->controller_displayName = $this->l('Grupy');
|
|
$this->toolbar_title = $this->l('Grupy');
|
|
|
|
$this->specificConfirmDelete = $this->l('Usunąć grupę?');
|
|
}
|
|
|
|
public function postProcess()
|
|
{
|
|
return parent::postProcess();
|
|
}
|
|
|
|
public function renderList()
|
|
{
|
|
$this->action_displayName = $this->l('Grupy');
|
|
|
|
$this->fields_list = array(
|
|
'id_configurator_group' => array(
|
|
'title' => $this->l('ID'),
|
|
'align' => 'center',
|
|
'class' => 'fixed-width-xs'
|
|
),
|
|
'name' => array(
|
|
'title' => $this->l('Name')
|
|
)
|
|
);
|
|
|
|
$this->addRowAction('edit');
|
|
$this->addRowAction('delete');
|
|
|
|
return parent::renderList();
|
|
}
|
|
|
|
public function renderForm()
|
|
{
|
|
$this->action_displayName = $this->l('Grupy');
|
|
|
|
$this->fields_form[0]['form'] = array(
|
|
'legend' => array(
|
|
'title' => $this->l('Grupy')
|
|
),
|
|
'input' => array(
|
|
array
|
|
(
|
|
'type' => 'text',
|
|
'label' => $this->l('Nazwa'),
|
|
'name' => 'name',
|
|
'lang' => false,
|
|
'required' => true
|
|
)
|
|
),
|
|
'submit' => array(
|
|
'title' => $this->l('Zapisz'),
|
|
'name' => 'submitConfiguratorGroup',
|
|
'class' => 'btn btn-default'
|
|
)
|
|
);
|
|
|
|
$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
|
|
|
|
$helper = new HelperForm();
|
|
$helper->default_form_language = $lang->id;
|
|
$helper->show_toolbar = true;
|
|
$helper->table = $this->table;
|
|
$helper->token = Tools::getAdminTokenLite('AdminGroupsConfiguratorController');
|
|
$helper->module = $this->module;
|
|
|
|
$helper->fields_value = $this->getConfiguration();
|
|
|
|
unset($this->toolbar_btn['back'], $this->toolbar_btn['new']);
|
|
|
|
return $helper->generateForm(array($this->fields_form[0]));
|
|
}
|
|
|
|
public function getConfiguration()
|
|
{
|
|
$group = $this->loadObject(true);
|
|
|
|
$fields = array(
|
|
'name' => '',
|
|
);
|
|
|
|
if (Validate::isLoadedObject($group))
|
|
{
|
|
$fields = array(
|
|
'name' => $group->name,
|
|
);
|
|
}
|
|
|
|
return $fields;
|
|
}
|
|
|
|
// Temporary bypass functions
|
|
public function listHelperAction() {}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function display()
|
|
{
|
|
if (file_exists(_PS_ROOT_DIR_ . '/' . $this->admin_webpath . '/themes/' . $this->bo_theme . '/public/theme.css')) {
|
|
$this->addCSS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/public/theme.css', 'all', 0);
|
|
} elseif (file_exists(_PS_ROOT_DIR_ . '/' . $this->admin_webpath . '/themes/new-theme/public/theme.css')) {
|
|
$this->addCSS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/new-theme/public/theme.css', 'all', 1);
|
|
} elseif (isset($this->bo_css) && file_exists(_PS_ROOT_DIR_ . '/' . $this->admin_webpath . '/themes/' . $this->bo_theme . '/css/' . $this->bo_css)) {
|
|
$this->addCSS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/css/' . $this->bo_css, 'all', 0);
|
|
}
|
|
|
|
parent::display();
|
|
}
|
|
} |