parent
384015bc6b
commit
eef9c88cf0
@ -105,10 +105,6 @@ class AdvSlide extends ObjectModel
|
||||
// Check user group
|
||||
if (Configuration::get('ADVSLIDER_RESTRICT_GROUP')) {
|
||||
$groups = Customer::getGroupsStatic($context->customer->id);
|
||||
if ($context->customer->logged == 0) {
|
||||
$groups = array(Configuration::get('ADVSLIDER_DEFAULT_GROUP'));
|
||||
}
|
||||
|
||||
$sql.= ' AND EXISTS(SELECT * FROM `'._DB_PREFIX_.'advslider_group` ag WHERE ag.id_group IN('.join(',', $groups).'))';
|
||||
}
|
||||
|
||||
|
@ -14,30 +14,14 @@ class AdvSliderGetContentController
|
||||
if (Tools::isSubmit('submitAdvsliderconfig')) {
|
||||
$enable_date = Tools::getValue('enable_date');
|
||||
$enable_groups = Tools::getValue('enable_groups');
|
||||
$default_group = Tools::getValue('default_group');
|
||||
Configuration::updateValue('ADVSLIDER_RESTRICT_DATE', $enable_date);
|
||||
Configuration::updateValue('ADVSLIDER_RESTRICT_GROUP', $enable_groups);
|
||||
Configuration::updateValue('ADVSLIDER_DEFAULT_GROUP', $default_group);
|
||||
$this->context->smarty->assign('confirmation', 'ok');
|
||||
}
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
$groups = Group::getGroups($this->context->language->id);
|
||||
$optionGroups = array();
|
||||
if (count($groups) > 0) {
|
||||
foreach ($groups as $group) {
|
||||
if (in_array($group['id_group'], array(1,2))) {
|
||||
continue;
|
||||
}
|
||||
$optionGroups[] = array(
|
||||
'id_group' => $group['id_group'],
|
||||
'name' => $group['name'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$fields_form = array(
|
||||
'form' => array(
|
||||
'legend' => array(
|
||||
@ -66,34 +50,8 @@ class AdvSliderGetContentController
|
||||
),
|
||||
|
||||
),
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'label' => $this->module->l('User group to display for restriction'),
|
||||
'name' => 'groups',
|
||||
'values' => array(
|
||||
'query' => $optionGroups,
|
||||
'id' => 'id_group',
|
||||
'name' => 'name',
|
||||
),
|
||||
'expand' => array(
|
||||
'default' => 'show',
|
||||
'show' => array('text' => $this->module->l('show'), 'icon' => 'plus-sign-alt'),
|
||||
'hide' => array('text' => $this->module->l('hide'), 'icon' => 'minus-sign-alt')
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'select',
|
||||
'label' => $this->module->l('Default group to display:'),
|
||||
'name' => 'default_group',
|
||||
'desc' => $this->module->l('Set a Default group to display slider with unauthenticated user.'),
|
||||
'options' => array(
|
||||
'query' => $optionGroups,
|
||||
'id' => 'id_group',
|
||||
'name' => 'name',
|
||||
),
|
||||
),
|
||||
),
|
||||
'submit' => array('title' => $this->module->l('Save')),
|
||||
'submit' => array('title' => $this->module->l('Save'))
|
||||
)
|
||||
);
|
||||
|
||||
@ -108,7 +66,6 @@ class AdvSliderGetContentController
|
||||
'fields_value' => array(
|
||||
'enable_date' => Tools::getValue('enable_date', Configuration::get('ADVSLIDER_RESTRICT_DATE')),
|
||||
'enable_groups' => Tools::getValue('enable_groups', Configuration::get('ADVSLIDER_RESTRICT_GROUP')),
|
||||
'default_group' => Tools::getValue('default_group', Configuration::get('ADVSLIDER_DEFAULT_GROUP')),
|
||||
),
|
||||
'languages' => $this->context->controller->getLanguages()
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user