Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed Other Modules setting from admin Hotel Reservation System -> Settings #206

Merged
merged 2 commits into from
Feb 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public function renderView()
'feature_price_setting_link' => $this->context->link->getAdminLink('AdminHotelFeaturePricesSettings'),
'general_setting_link' => $this->context->link->getAdminLink('AdminHotelGeneralSettings'),
'order_restrict_setting_link' => $this->context->link->getAdminLink('AdminOrderRestrictSettings'),
'other_module_setting_link' => $this->context->link->getAdminLink('AdminOtherHotelModulesSetting'),
'additional_demand_setting_link' => $this->context->link->getAdminLink('AdminRoomTypeGlobalDemand'),
);
// Reviews setting link if only productcomment module is enabled
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion modules/hotelreservationsystem/hotelreservationsystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,6 @@ public function callInstallTab()
//Controllers which are to be used in this modules but we have not to create tab for those ontrollers...
$this->installTab('AdminOrderRestrictSettings', 'order restrict configuration', false, false);
$this->installTab('AdminHotelGeneralSettings', 'Hotel General configuration', false, false);
$this->installTab('AdminOtherHotelModulesSetting', 'other hotel configuration', false, false);
$this->installTab('AdminHotelFeaturePricesSettings', 'feature pricing configuration', false, false);
$this->installTab('AdminRoomTypeGlobalDemand', 'Additional demand configuration', false, false);
$this->installTab('AdminAssignHotelFeatures', 'Assign Hotel Features', false, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,6 @@
<i class="icon-question-circle"></i>
</a>
</div>
<div class="btn-group setting-link-div col-sm-3 col-xs-12">
<a type="button" href="{$other_module_setting_link}" class="setting-link btn btn-default col-sm-10 col-xs-10">
<span class="col-sm-2 col-xs-2"><i class="icon-support"></i></span>
<span class="setting-title col-sm-10 col-xs-10">{l s='Other Modules' mod='hotelreservationsystem'}</span>
</a>
<a tabindex="0" class="btn btn-default col-sm-2 col-xs-2" role="button" data-toggle="popover" data-trigger="focus" title="{l s='Other Modules Settings' mod='hotelreservationsystem'}" data-content="{l s='Configure here settings of other modules of the software.' mod='hotelreservationsystem'}" data-placement="bottom">
<i class="icon-question-circle"></i>
</a>
</div>
<!-- Setting to set prices for date range -->
<div class="btn-group setting-link-div col-sm-3 col-xs-12">
<a type="button" href="{$feature_price_setting_link}" class="setting-link btn btn-default col-sm-10 col-xs-10">
Expand Down
155 changes: 123 additions & 32 deletions modules/wkhotelfilterblock/wkhotelfilterblock.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,52 +42,143 @@ public function __construct()
$this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
}

public function install()
public function getContent()
{
if (!parent::install()
|| !$this->registerHook('header')
|| !$this->registerHook('addOtherModuleSetting')
|| !$this->registerHook('displayLeftColumn')) {
return false;
if (Tools::isSubmit('btnConfigSubmit')) {
$this->postProcess();
} else {
$this->html .= '<br />';
}

//set default config variable
Configuration::updateValue('SHOW_RATTING_FILTER', 1);
Configuration::updateValue('SHOW_AMENITIES_FILTER', 1);
Configuration::updateValue('SHOW_PRICE_FILTER', 1);
$this->html .= $this->renderForm();

return true;
return $this->html;
}

public function hookAddOtherModuleSetting($params)
public function renderForm()
{
$params['fields_options']['categoryfiltersetting'] = array(
'title' => $this->l('Category Filter Configuration'),
'fields' => array(
'SHOW_RATTING_FILTER' => array(
'title' => $this->l('Show Guest Rating Filter'),
$fields_form = array();
$fields_form['form'] = array(
'legend' => array(
'icon' => 'icon-cog',
'title' => $this->l('Search Results Filter Configuration'),
),
'input' => array(
array(
'type' => 'switch',
'label' => $this->l('Show Guest Rating Filter'),
'name' => 'SHOW_RATTING_FILTER',
'is_bool' => true,
'values' => array(
array(
'id' => 'active_on',
'value' => 1,
),
array(
'id' => 'active_off',
'value' => 0,
),
),
'hint' => $this->l('If yes, it will display Guest Rating Filter.'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool',
),
'SHOW_AMENITIES_FILTER' => array(
'title' => $this->l('Show Amenities Filter'),
array(
'type' => 'switch',
'label' => $this->l('Show Amenities Filter'),
'name' => 'SHOW_AMENITIES_FILTER',
'is_bool' => true,
'values' => array(
array(
'id' => 'active_on',
'value' => 1,
),
array(
'id' => 'active_off',
'value' => 0,
),
),
'hint' => $this->l('If yes, it will display Amenities Filter.'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool',
),
'SHOW_PRICE_FILTER' => array(
'title' => $this->l('Show Price Filter'),
'hint' => $this->l('If yes, it will display Price Filter.'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool',
array(
'type' => 'switch',
'label' => $this->l('Show Price Filter'),
'name' => 'SHOW_PRICE_FILTER',
'is_bool' => true,
'values' => array(
array(
'id' => 'active_on',
'value' => 1,
),
array(
'id' => 'active_off',
'value' => 0,
),
),
'hint' => $this->l('If yes, it will display price Filter.'),
),
),
'submit' => array('title' => $this->l('Save')),
'submit' => array(
'title' => $this->l('Save'),
'name' => 'submit_conf_filter',
),
);

$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;
$this->fields_form = array();
$helper->identifier = $this->identifier;
$helper->submit_action = 'btnConfigSubmit';
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).
'&configure='.$this->name.'&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 postProcess()
{
if (Tools::isSubmit('btnConfigSubmit')) {
Configuration::updateValue(
'SHOW_RATTING_FILTER',
Tools::getValue('SHOW_RATTING_FILTER')
);
Configuration::updateValue(
'SHOW_AMENITIES_FILTER',
Tools::getValue('SHOW_AMENITIES_FILTER')
);
Configuration::updateValue('SHOW_PRICE_FILTER', Tools::getValue('SHOW_PRICE_FILTER'));

// redirect after saving the configuration
Tools::redirectAdmin(
$this->context->link->getAdminLink('AdminModules').'&configure='.$this->name.'&tab_module='.$this->tab.
'&module_name='.$this->name.'&conf=4'
);
}
}

public function install()
{
if (!parent::install()
|| !$this->registerHook('header')
|| !$this->registerHook('addOtherModuleSetting')
|| !$this->registerHook('displayLeftColumn')) {
return false;
}

//set default config variable`
Configuration::updateValue('SHOW_RATTING_FILTER', 1);
Configuration::updateValue('SHOW_AMENITIES_FILTER', 1);
Configuration::updateValue('SHOW_PRICE_FILTER', 1);

return true;
}

public function hookHeader()
Expand Down