Allow admin to create new links on Hotel Reservation System > Settings page
This commit is contained in:
@@ -527,6 +527,80 @@ class HotelHelper
|
||||
}
|
||||
}
|
||||
|
||||
public function saveDefaultHotelSettingsLinks()
|
||||
{
|
||||
$settingsLinks = array(
|
||||
array(
|
||||
'name' => 'General Settings',
|
||||
'hint' => 'Configure Your Hotel general Settings using this option.',
|
||||
'icon' => 'icon-cogs',
|
||||
'link' => 'index.php?controller=AdminHotelGeneralSettings',
|
||||
'unremovable' => 1,
|
||||
),
|
||||
array(
|
||||
'name' => 'Order Restrict',
|
||||
'hint' => 'Configure if you want to restrict orders till a specific date for your hotels.',
|
||||
'icon' => 'icon-list-alt',
|
||||
'link' => 'index.php?controller=AdminOrderRestrictSettings',
|
||||
'unremovable' => 1,
|
||||
),
|
||||
array(
|
||||
'name' => 'Advanced Price Rules',
|
||||
'hint' => 'Here set advanced price rules for specific dates.',
|
||||
'icon' => 'icon-cog',
|
||||
'link' => 'index.php?controller=AdminHotelFeaturePricesSettings',
|
||||
'unremovable' => 1,
|
||||
),
|
||||
array(
|
||||
'name' => 'Additional Facilities',
|
||||
'hint' => 'Here create additional facilities and their prices for room types.',
|
||||
'icon' => 'icon-cog',
|
||||
'link' => 'index.php?controller=AdminRoomTypeGlobalDemand',
|
||||
'unremovable' => 1,
|
||||
),
|
||||
array(
|
||||
'name' => 'Hotel Interior Block',
|
||||
'hint' => 'Configure Hotel Interior block. You can display hotel interior images using this block. This block will be displayed on home page.',
|
||||
'icon' => 'icon-file-text',
|
||||
'link' => 'index.php?controller=AdminAboutHotelBlockSetting',
|
||||
'unremovable' => 0,
|
||||
),
|
||||
array(
|
||||
'name' => 'Hotel Amenities Block',
|
||||
'hint' => 'Configure Hotels Amenities settings. You can display hotel amenities images using this block. This block will be displayed on home page.',
|
||||
'icon' => 'icon-th-list',
|
||||
'link' => 'index.php?controller=AdminFeaturesModuleSetting',
|
||||
'unremovable' => 0,
|
||||
),
|
||||
);
|
||||
|
||||
$languages = Language::getLanguages();
|
||||
foreach ($settingsLinks as $key => $settingsLink) {
|
||||
$name = array();
|
||||
$hint = array();
|
||||
foreach ($languages as $language) {
|
||||
$name[$language['id_lang']] = $settingsLink['name'];
|
||||
$hint[$language['id_lang']] = $settingsLink['hint'];
|
||||
}
|
||||
|
||||
$objHotelSettingsLink = new HotelSettingsLink();
|
||||
$objHotelSettingsLink->name = $name;
|
||||
$objHotelSettingsLink->hint = $hint;
|
||||
$objHotelSettingsLink->icon = $settingsLink['icon'];
|
||||
$objHotelSettingsLink->link = $settingsLink['link'];
|
||||
$objHotelSettingsLink->new_window = 0;
|
||||
$objHotelSettingsLink->position = (int) $key;
|
||||
$objHotelSettingsLink->unremovable = $settingsLink['unremovable'];
|
||||
$objHotelSettingsLink->active = 1;
|
||||
|
||||
if (!$objHotelSettingsLink->save()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function saveAdvancedPaymentInfo($id_product)
|
||||
{
|
||||
$obj_adv_pmt = new HotelAdvancedPayment();
|
||||
@@ -573,6 +647,7 @@ class HotelHelper
|
||||
$this->saveDummyHotelImages($htl_id);
|
||||
$this->saveDummyHotelFeatures($htl_id);
|
||||
$this->saveDummyProductsAndRelatedInfo($htl_id);
|
||||
$this->saveDefaultHotelSettingsLinks();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -358,6 +358,27 @@ class HotelReservationSystemDb
|
||||
`access` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id_profile`, `id_hotel`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8;",
|
||||
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_settings_link` (
|
||||
`id_settings_link` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`icon` varchar(32) character set utf8 NOT NULL,
|
||||
`link` text NOT NULL,
|
||||
`new_window` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`position` int(11) unsigned NOT NULL DEFAULT '0',
|
||||
`unremovable` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`active` tinyint(1) NOT NULL,
|
||||
`date_add` datetime NOT NULL,
|
||||
`date_upd` datetime NOT NULL,
|
||||
PRIMARY KEY (`id_settings_link`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
|
||||
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_settings_link_lang` (
|
||||
`id_settings_link` int(10) unsigned NOT NULL,
|
||||
`id_lang` int(10) unsigned NOT NULL,
|
||||
`name` varchar(255) character set utf8 NOT NULL,
|
||||
`hint` varchar(255) character set utf8 NOT NULL,
|
||||
PRIMARY KEY (`id_settings_link`, `id_lang`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8;",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -408,7 +429,9 @@ class HotelReservationSystemDb
|
||||
`'._DB_PREFIX_.'htl_room_type_demand_price`,
|
||||
`'._DB_PREFIX_.'htl_room_type_demand`,
|
||||
`'._DB_PREFIX_.'htl_room_disable_dates`,
|
||||
`'._DB_PREFIX_.'htl_access`'
|
||||
`'._DB_PREFIX_.'htl_access`,
|
||||
`'._DB_PREFIX_.'htl_settings_link`,
|
||||
`'._DB_PREFIX_.'htl_settings_link_lang`'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
148
modules/hotelreservationsystem/classes/HotelSettingsLink.php
Normal file
148
modules/hotelreservationsystem/classes/HotelSettingsLink.php
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
/**
|
||||
* 2010-2022 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through LICENSE.txt file inside our module
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to CustomizationPolicy.txt file inside our module for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright 2010-2022 Webkul IN
|
||||
* @license LICENSE.txt
|
||||
*/
|
||||
|
||||
class HotelSettingsLink extends ObjectModel
|
||||
{
|
||||
public $id_settings_link;
|
||||
public $name;
|
||||
public $hint;
|
||||
public $icon;
|
||||
public $link;
|
||||
public $new_window;
|
||||
public $position;
|
||||
public $unremovable;
|
||||
public $active;
|
||||
public $date_add;
|
||||
public $date_upd;
|
||||
|
||||
public static $definition = array(
|
||||
'table' => 'htl_settings_link',
|
||||
'primary' => 'id_settings_link',
|
||||
'multilang' => true,
|
||||
'fields' => array(
|
||||
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'lang' => true, 'required' => true),
|
||||
'hint' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'lang' => true, 'required' => true),
|
||||
'icon' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'required' => true),
|
||||
'link' => array('type' => self::TYPE_STRING, 'validate' => 'isUrl', 'required' => true),
|
||||
'new_window' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'position' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
|
||||
'unremovable' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false),
|
||||
),
|
||||
);
|
||||
|
||||
public function getAll($active = true)
|
||||
{
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT * FROM `'._DB_PREFIX_.'htl_settings_link` hsl
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_settings_link_lang` hsll
|
||||
ON hsll.`id_settings_link` = hsl.`id_settings_link` AND hsll.`id_lang` = '.(int) Context::getContext()->language->id.
|
||||
($active ? ' WHERE hsl.`active` = 1' : '').'
|
||||
ORDER BY hsl.`position`'
|
||||
);
|
||||
}
|
||||
|
||||
public function generateLink($link = null, $id_employee = null)
|
||||
{
|
||||
if ($link) {
|
||||
$this->link = $link;
|
||||
}
|
||||
|
||||
$context = Context::getContext();
|
||||
if ($this->link == '../') {
|
||||
return $context->shop->getBaseURL();
|
||||
} else {
|
||||
preg_match('/controller=(.+)(&.+)?$/', $this->link, $adminTab);
|
||||
if (isset($adminTab[1])) {
|
||||
if (strpos($adminTab[1], '&')) {
|
||||
$adminTab[1] = substr($adminTab[1], 0, strpos($adminTab[1], '&'));
|
||||
}
|
||||
|
||||
$token = Tools::getAdminToken($adminTab[1].(int) Tab::getIdFromClassName($adminTab[1]).(int) ($id_employee ? $id_employee : $context->employee->id));
|
||||
return $link.'&token='.$token;
|
||||
}
|
||||
}
|
||||
|
||||
return $link;
|
||||
}
|
||||
|
||||
public function getUnremovableLinks()
|
||||
{
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT *
|
||||
FROM `'._DB_PREFIX_.'htl_settings_link` hsl
|
||||
WHERE hsl.`unremovable` = 1'
|
||||
);
|
||||
}
|
||||
|
||||
public function getHigherPosition()
|
||||
{
|
||||
$position = Db::getInstance()->getValue(
|
||||
'SELECT MAX(`position`) FROM `'._DB_PREFIX_.'htl_settings_link`'
|
||||
);
|
||||
|
||||
$result = (is_numeric($position)) ? $position : -1;
|
||||
|
||||
return $result + 1;
|
||||
}
|
||||
|
||||
public function updatePosition($way, $position)
|
||||
{
|
||||
if (!$result = Db::getInstance()->executeS(
|
||||
'SELECT hsl.`id_settings_link`, hsl.`position`
|
||||
FROM `'._DB_PREFIX_.'htl_settings_link` hsl
|
||||
WHERE hsl.`id_settings_link` = '.(int) $this->id.' ORDER BY `position` ASC')
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$movedBlock = false;
|
||||
foreach ($result as $block) {
|
||||
if ((int)$block['id_settings_link'] == (int) $this->id) {
|
||||
$movedBlock = $block;
|
||||
}
|
||||
}
|
||||
|
||||
if ($movedBlock === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (Db::getInstance()->execute(
|
||||
'UPDATE `'._DB_PREFIX_.'htl_settings_link` SET `position`= `position` '.($way ? '- 1' : '+ 1').
|
||||
' WHERE `position`'.($way ? '> '.
|
||||
(int) $movedBlock['position'].' AND `position` <= '.(int) $position : '< '
|
||||
.(int) $movedBlock['position'].' AND `position` >= '.(int) $position)
|
||||
) && Db::getInstance()->execute(
|
||||
'UPDATE `'._DB_PREFIX_.'htl_settings_link`
|
||||
SET `position` = '.(int) $position.'
|
||||
WHERE `id_settings_link`='.(int) $movedBlock['id_settings_link']
|
||||
));
|
||||
}
|
||||
|
||||
public function cleanPositions()
|
||||
{
|
||||
Db::getInstance()->execute('SET @i = -1', false);
|
||||
$sql = 'UPDATE `'._DB_PREFIX_.'htl_settings_link` SET `position` = @i:=@i+1 ORDER BY `position` ASC';
|
||||
|
||||
return Db::getInstance()->execute($sql);
|
||||
}
|
||||
}
|
||||
@@ -2,37 +2,339 @@
|
||||
|
||||
class AdminHotelConfigurationSettingController extends ModuleAdminController
|
||||
{
|
||||
protected $position_identifier = 'id_settings_link';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'configuration';
|
||||
$this->className = 'Configuration';
|
||||
$this->table = 'htl_settings_link';
|
||||
$this->identifier = 'id_settings_link';
|
||||
$this->className = 'HotelSettingsLink';
|
||||
$this->_defaultOrderBy = 'position';
|
||||
$this->lang = true;
|
||||
$this->bootstrap = true;
|
||||
if (!($obj = $this->loadObject(true))) {
|
||||
return;
|
||||
}
|
||||
$this->toolbar_title = $this->l('Manage Hotel Settings');
|
||||
$this->list_no_link = true;
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('delete');
|
||||
|
||||
$this->fields_list = array(
|
||||
'id_settings_link' => array(
|
||||
'title' => $this->l('ID'),
|
||||
'hint' => $this->l('ID of the settings link.'),
|
||||
'align' => 'center',
|
||||
'class' => 'fixed-width-xs',
|
||||
),
|
||||
'name' => array(
|
||||
'title' => $this->l('Name'),
|
||||
'hint' => $this->l('Name of the settings link.'),
|
||||
'align' => 'left',
|
||||
'class' => 'fixed-width-xxl',
|
||||
),
|
||||
'link' => array(
|
||||
'title' => $this->l('Link'),
|
||||
'hint' => $this->l('Link of the page where admin is redirected.'),
|
||||
'align' => 'left',
|
||||
'callback' => 'displayColumnLink',
|
||||
),
|
||||
'icon' => array(
|
||||
'title' => $this->l('Icon'),
|
||||
'hint' => $this->l('Icon of the settings link.'),
|
||||
'align' => 'center',
|
||||
'callback' => 'displayColumnIcon',
|
||||
),
|
||||
'new_window' => array(
|
||||
'title' => $this->l('New Window'),
|
||||
'hint' => $this->l('Active if link is opened in a new window.'),
|
||||
'align' => 'center',
|
||||
'active' => 'new_window',
|
||||
'ajax' => true,
|
||||
'orderby' => false,
|
||||
'type' => 'bool',
|
||||
'class' => 'fixed-width-sm',
|
||||
),
|
||||
'position' => array(
|
||||
'title' => $this->l('Position'),
|
||||
'filter_key' => 'a!position',
|
||||
'position' => 'position',
|
||||
'align' => 'center',
|
||||
'class' => 'fixed-width-md',
|
||||
),
|
||||
'active' => array(
|
||||
'title' => $this->l('Status'),
|
||||
'hint' => $this->l('Current status of the settings link.'),
|
||||
'type' => 'bool',
|
||||
'active' => 'status',
|
||||
'align' => 'center',
|
||||
'class' => 'fixed-width-lg',
|
||||
'filter_key' => 'a!active',
|
||||
),
|
||||
);
|
||||
|
||||
$this->bulk_actions = array(
|
||||
'enableSelection' => array(
|
||||
'text' => $this->l('Enable selection'),
|
||||
'icon' => 'icon-power-off text-success'
|
||||
),
|
||||
'disableSelection' => array(
|
||||
'text' => $this->l('Disable selection'),
|
||||
'icon' => 'icon-power-off text-danger'
|
||||
),
|
||||
'divider' => array(
|
||||
'text' => 'divider'
|
||||
),
|
||||
'delete' => array(
|
||||
'text' => $this->l('Delete selected'),
|
||||
'confirm' => $this->l('Delete selected items?'),
|
||||
'icon' => 'icon-trash'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function displayColumnIcon($icon)
|
||||
{
|
||||
$tpl = $this->context->smarty->createTemplate(
|
||||
$this->module->getLocalPath().'views/templates/admin/'.$this->tpl_folder.'helpers/list/link-icon.tpl'
|
||||
);
|
||||
|
||||
$tpl->assign('icon', $icon);
|
||||
|
||||
return $tpl->fetch();
|
||||
}
|
||||
|
||||
public function displayColumnLink($link)
|
||||
{
|
||||
$this->loadObject(true);
|
||||
$tpl = $this->context->smarty->createTemplate(
|
||||
$this->module->getLocalPath().'views/templates/admin/'.$this->tpl_folder.'helpers/list/link-page.tpl'
|
||||
);
|
||||
|
||||
$tpl->assign(array(
|
||||
'saved_link' => $link,
|
||||
'generated_link' => $this->object->generateLink($link),
|
||||
));
|
||||
|
||||
return $tpl->fetch();
|
||||
}
|
||||
|
||||
public function initToolbar()
|
||||
{
|
||||
parent::initToolbar();
|
||||
if ($this->display == 'view') {
|
||||
$this->toolbar_title = $this->l('Hotel Settings');
|
||||
$this->page_header_toolbar_btn['manage_links'] = array(
|
||||
'icon' => 'process-icon-cogs',
|
||||
'href' => self::$currentIndex.'&display=list&token='.$this->token,
|
||||
'desc' => $this->l('Manage links'),
|
||||
);
|
||||
} elseif ($this->display == 'list') {
|
||||
$this->page_header_toolbar_title = $this->l('Settings Links');
|
||||
$this->page_header_toolbar_btn['new'] = array(
|
||||
'href' => self::$currentIndex.'&add'.$this->table.'&token='.$this->token,
|
||||
'desc' => $this->l('Add new link'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function initContent()
|
||||
{
|
||||
$this->show_toolbar = false;
|
||||
$this->display = 'view';
|
||||
if (!$this->ajax) {
|
||||
if (Tools::getValue('display') == 'list') {
|
||||
$this->display = 'list';
|
||||
} elseif (empty($this->display)
|
||||
&& !Tools::isSubmit('submitFilter'.$this->table)
|
||||
) {
|
||||
$this->display = 'view';
|
||||
}
|
||||
}
|
||||
|
||||
parent::initContent();
|
||||
}
|
||||
|
||||
public function renderList()
|
||||
{
|
||||
$this->context->smarty->assign('icon', 'icon-list');
|
||||
$this->toolbar_title = $this->l('Settings Links');
|
||||
|
||||
$this->loadObject(true);
|
||||
$unremovableLinks = $this->object->getUnremovableLinks();
|
||||
if (is_array($unremovableLinks) && count($unremovableLinks)) {
|
||||
$ids = array();
|
||||
foreach ($unremovableLinks as $unremovableLink) {
|
||||
$ids[] = $unremovableLink['id_settings_link'];
|
||||
}
|
||||
$this->addRowActionSkipList('delete', $ids);
|
||||
}
|
||||
|
||||
return parent::renderList();
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
$smartyVars = array();
|
||||
$idSettingsLink = (int) Tools::getValue($this->identifier);
|
||||
$objHotelSettingsLink = $this->loadObject(true);
|
||||
|
||||
$smartyVars['id_hotel_settings_link'] = $idSettingsLink;
|
||||
$smartyVars['currentTab'] = $this;
|
||||
$smartyVars['currentObject'] = $objHotelSettingsLink;
|
||||
|
||||
$this->fields_form = $this->getFieldsForm();
|
||||
$this->context->smarty->assign($smartyVars);
|
||||
|
||||
return parent::renderForm();
|
||||
}
|
||||
|
||||
public function getFieldsForm()
|
||||
{
|
||||
$fields_form = array();
|
||||
|
||||
$fields_form[] = array(
|
||||
'form' => array(
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
'name' => 'submitHotelSettingsLink',
|
||||
'class' => 'btn btn-default pull-right',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
return $fields_form;
|
||||
}
|
||||
|
||||
public function renderView()
|
||||
{
|
||||
$settingsLinks = $this->object->getAll();
|
||||
foreach ($settingsLinks as $index => &$settingsLink) {
|
||||
$settingsLink['generated_link'] = $this->object->generateLink($settingsLink['link']);
|
||||
}
|
||||
|
||||
$this->tpl_view_vars = array(
|
||||
'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'),
|
||||
'additional_demand_setting_link' => $this->context->link->getAdminLink('AdminRoomTypeGlobalDemand'),
|
||||
'settings_links' => $settingsLinks,
|
||||
);
|
||||
|
||||
return parent::renderView();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('submitHotelSettingsLink') || Tools::isSubmit('submitHotelSettingsLinkAndStay')) {
|
||||
$idHotelSettingsLink = Tools::getValue($this->identifier);
|
||||
$this->validateRules();
|
||||
|
||||
if (is_array($this->errors) && !count($this->errors)) {
|
||||
$objHotelSettingsLink = new HotelSettingsLink($idHotelSettingsLink);
|
||||
$this->copyFromPost($objHotelSettingsLink, $this->table);
|
||||
if (!$idHotelSettingsLink) {
|
||||
$objHotelSettingsLink->position = $objHotelSettingsLink->getHigherPosition();
|
||||
}
|
||||
if ($objHotelSettingsLink->save()) {
|
||||
$newId = $objHotelSettingsLink->id;
|
||||
|
||||
if (is_array($this->errors) && !count($this->errors)) {
|
||||
if (Tools::isSubmit('submitHotelSettingsLinkAndStay')) {
|
||||
if ($idHotelSettingsLink) {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token.
|
||||
'&update'.$this->table.'&'.$this->identifier.'='.$newId);
|
||||
} else {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=3&token='.$this->token.
|
||||
'&update'.$this->table.'&'.$this->identifier.'='.$newId);
|
||||
}
|
||||
} else {
|
||||
self::$currentIndex .= '&display=list';
|
||||
if ($idHotelSettingsLink) {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
|
||||
} else {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=3&token='.$this->token);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
public function processStatus()
|
||||
{
|
||||
self::$currentIndex .= '&display=list';
|
||||
return parent::processStatus();
|
||||
}
|
||||
|
||||
public function processDelete()
|
||||
{
|
||||
self::$currentIndex .= '&display=list';
|
||||
return parent::processDelete();
|
||||
}
|
||||
|
||||
public function processBulkDelete()
|
||||
{
|
||||
self::$currentIndex .= '&display=list';
|
||||
return parent::processBulkDelete();
|
||||
}
|
||||
|
||||
public function ajaxProcessNewWindowHtlSettingsLink()
|
||||
{
|
||||
$response = array(
|
||||
'success' => 0,
|
||||
'text' => $this->l('An error occurred while updating object.')
|
||||
);
|
||||
|
||||
$idSettingsLink = Tools::getValue('id_settings_link');
|
||||
$objHotelSettingsLink = new HotelSettingsLink($idSettingsLink);
|
||||
|
||||
if (Validate::isLoadedObject($objHotelSettingsLink)) {
|
||||
$objHotelSettingsLink->new_window = (int) !$objHotelSettingsLink->new_window;
|
||||
|
||||
if ($objHotelSettingsLink->save()) {
|
||||
$response['success'] = 1;
|
||||
$response['text'] = $this->l('The object has been updated successfully.');
|
||||
}
|
||||
}
|
||||
|
||||
$this->ajaxDie(json_encode($response));
|
||||
}
|
||||
|
||||
public function ajaxProcessUpdatePositions()
|
||||
{
|
||||
$way = (int) Tools::getValue('way');
|
||||
$idSettingsLink = (int) Tools::getValue('id');
|
||||
$positions = Tools::getValue('settings_link');
|
||||
|
||||
foreach ($positions as $position => $value) {
|
||||
$pos = explode('_', $value);
|
||||
|
||||
if (isset($pos[2]) && (int) $pos[2] === $idSettingsLink) {
|
||||
if ($objHotelSettingsLink = new HotelSettingsLink((int) $pos[2])) {
|
||||
if (isset($position) && $objHotelSettingsLink->updatePosition($way, $position, $idSettingsLink)) {
|
||||
$this->ajaxDie(json_encode(true));
|
||||
} else {
|
||||
$this->ajaxDie(json_encode(array(
|
||||
'hasError' => true,
|
||||
'errors' => sprintf(
|
||||
$this->l('Can not update position for object ID: %d to position %d'),
|
||||
(int) $idSettingsLink,
|
||||
$position
|
||||
),
|
||||
)));
|
||||
}
|
||||
} else {
|
||||
$this->ajaxDie(json_encode(array(
|
||||
'hasError' => true,
|
||||
'errors' => sprintf(
|
||||
$this->l('The object with ID: %d can not be loaded.'),
|
||||
(int) $idSettingsLink
|
||||
),
|
||||
)));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function setMedia()
|
||||
{
|
||||
parent::setMedia();
|
||||
|
||||
@@ -45,6 +45,8 @@ require_once 'classes/QloRoomType.php';
|
||||
require_once 'classes/HotelRoomDisableDates.php';
|
||||
require_once 'classes/HotelBranchRefundRules.php';
|
||||
|
||||
require_once 'classes/HotelSettingsLink.php';
|
||||
|
||||
// Web services classes
|
||||
require_once 'classes/WebserviceSpecificManagementQlo.php';
|
||||
require_once 'classes/WebserviceSpecificManagementHotelImages.php';
|
||||
@@ -0,0 +1,172 @@
|
||||
{**
|
||||
* 2010-2022 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through LICENSE.txt file inside our module
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to CustomizationPolicy.txt file inside our module for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright 2010-2022 Webkul IN
|
||||
* @license LICENSE.txt
|
||||
*}
|
||||
|
||||
{extends file='helpers/form/form.tpl'}
|
||||
|
||||
{block name='fieldset'}
|
||||
<div class="panel" id="general">
|
||||
<div class="panel-heading">
|
||||
<i class="icon-info-circle"></i>
|
||||
{l s='Link Information' mod='hotelreservationsystem'}
|
||||
</div>
|
||||
|
||||
<div class="form-wrapper" id="fields-meta-tags-rule">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-lg-3">
|
||||
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="{l s='Enable to show this link.' mod='hotelreservationsystem'}">
|
||||
{l s='Enabled' mod='hotelreservationsystem'}
|
||||
</span>
|
||||
</label>
|
||||
<div class="col-lg-9">
|
||||
<span class="switch prestashop-switch fixed-width-lg">
|
||||
<input type="radio" name="active" id="active_on" value="1"
|
||||
{if $currentTab->getFieldValue($currentObject, 'active')|intval}checked="checked"{/if}>
|
||||
<label for="active_on">{l s='Yes' mod='hotelreservationsystem'}</label>
|
||||
<input type="radio" name="active" id="active_off" value="0"
|
||||
{if !$currentTab->getFieldValue($currentObject, 'active')|intval}checked="checked"{/if}>
|
||||
<label for="active_off">{l s='No' mod='hotelreservationsystem'}</label>
|
||||
<a class="slide-button btn"></a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-lg-3 required">
|
||||
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="{l s='Enter a memorable name for this link.' mod='hotelreservationsystem'}">
|
||||
{l s='Name' mod='hotelreservationsystem'}
|
||||
</span>
|
||||
</label>
|
||||
<div class="col-lg-9">
|
||||
{if $languages|count > 0}
|
||||
{foreach $languages as $language}
|
||||
{assign var='value_text' value=$currentTab->getFieldValue($currentObject, 'name', $language.id_lang)}
|
||||
<div class="translatable-field lang-{$language.id_lang}" {if $language.id_lang != $defaultFormLanguage}style="display:none"{/if}>
|
||||
<div class="col-lg-6">
|
||||
<input type="text" name="name_{$language.id_lang}" class="form-control" value="{$value_text|escape:'html':'UTF-8'}">
|
||||
</div>
|
||||
{if $languages|count > 1}
|
||||
<div class="col-lg-2">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" tabindex="-1" data-toggle="dropdown">
|
||||
{$language.iso_code}
|
||||
<i class="icon-caret-down"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
{foreach from=$languages item=language}
|
||||
<li><a href="javascript:hideOtherLanguage({$language.id_lang});" tabindex="-1">{$language.name}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-lg-3 required">
|
||||
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="{l s='Enter a hint for this link.' mod='hotelreservationsystem'}">
|
||||
{l s='Hint' mod='hotelreservationsystem'}
|
||||
</span>
|
||||
</label>
|
||||
<div class="col-lg-9">
|
||||
{if $languages|count > 0}
|
||||
{foreach $languages as $language}
|
||||
{assign var='value_text' value=$currentTab->getFieldValue($currentObject, 'hint', $language.id_lang)}
|
||||
<div class="translatable-field lang-{$language.id_lang}" {if $language.id_lang != $defaultFormLanguage}style="display:none"{/if}>
|
||||
<div class="col-lg-6">
|
||||
<input type="text" name="hint_{$language.id_lang}" class="form-control" value="{$value_text|escape:'html':'UTF-8'}">
|
||||
</div>
|
||||
{if $languages|count > 1}
|
||||
<div class="col-lg-2">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" tabindex="-1" data-toggle="dropdown">
|
||||
{$language.iso_code}
|
||||
<i class="icon-caret-down"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
{foreach from=$languages item=language}
|
||||
<li><a href="javascript:hideOtherLanguage({$language.id_lang});" tabindex="-1">{$language.name}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-lg-3 required">
|
||||
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="{l s='Set icon class for this link.' mod='hotelreservationsystem'}">
|
||||
{l s='Icon' mod='hotelreservationsystem'}
|
||||
</span>
|
||||
</label>
|
||||
<div class="col-lg-5">
|
||||
<input name="icon" class="form-control" placeholder="{l s='Eg. icon-user' mod='hotelreservationsystem'}" value="{$currentTab->getFieldValue($currentObject, 'icon')|escape}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-lg-3 required">
|
||||
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="{l s='Set URL of the desired page. If it is a Back office URL please remove the token from it.' mod='hotelreservationsystem'}">
|
||||
{l s='URL' mod='hotelreservationsystem'}
|
||||
</span>
|
||||
</label>
|
||||
<div class="col-lg-5">
|
||||
<input name="link" class="form-control" value="{$currentTab->getFieldValue($currentObject, 'link')|escape}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-lg-3">
|
||||
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="{l s='Enable to open the link in a new window.' mod='hotelreservationsystem'}">
|
||||
{l s='Open in new window' mod='hotelreservationsystem'}
|
||||
</span>
|
||||
</label>
|
||||
<div class="col-lg-9">
|
||||
<span class="switch prestashop-switch fixed-width-lg">
|
||||
<input type="radio" name="new_window" id="new_window_on" value="1"
|
||||
{if $currentTab->getFieldValue($currentObject, 'new_window')|intval}checked="checked"{/if}>
|
||||
<label for="new_window_on">{l s='Yes' mod='hotelreservationsystem'}</label>
|
||||
<input type="radio" name="new_window" id="new_window_off" value="0"
|
||||
{if !$currentTab->getFieldValue($currentObject, 'new_window')|intval}checked="checked"{/if}>
|
||||
<label for="new_window_off">{l s='No' mod='hotelreservationsystem'}</label>
|
||||
<a class="slide-button btn"></a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel-footer">
|
||||
<button type="submit" value="1" name="submitHotelSettingsLink" class="btn btn-default pull-right">
|
||||
<i class="process-icon-save"></i>
|
||||
{l s='Save' mod='hotelreservationsystem'}
|
||||
</button>
|
||||
<button type="submit" value="1" name="submitHotelSettingsLinkAndStay" class="btn btn-default pull-right">
|
||||
<i class="process-icon-save"></i>
|
||||
{l s='Save and stay' mod='hotelreservationsystem'}
|
||||
</button>
|
||||
<a href="{$link->getAdminLink('AdminHotelConfigurationSetting')}&display=list" class="btn btn-default" onclick="window.history.back();">
|
||||
<i class="process-icon-back"></i>
|
||||
{l s='Back to list' mod='hotelreservationsystem'}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* 2010-2022 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through LICENSE.txt file inside our module
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to CustomizationPolicy.txt file inside our module for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright 2010-2022 Webkul IN
|
||||
* @license LICENSE.txt
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../');
|
||||
exit;
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* 2010-2022 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through LICENSE.txt file inside our module
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to CustomizationPolicy.txt file inside our module for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright 2010-2022 Webkul IN
|
||||
* @license LICENSE.txt
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../');
|
||||
exit;
|
||||
@@ -0,0 +1,20 @@
|
||||
{**
|
||||
* 2010-2022 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through LICENSE.txt file inside our module
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to CustomizationPolicy.txt file inside our module for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright 2010-2022 Webkul IN
|
||||
* @license LICENSE.txt
|
||||
*}
|
||||
|
||||
<i class="icon {$icon}"></i>
|
||||
@@ -0,0 +1,20 @@
|
||||
{**
|
||||
* 2010-2022 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through LICENSE.txt file inside our module
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to CustomizationPolicy.txt file inside our module for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright 2010-2022 Webkul IN
|
||||
* @license LICENSE.txt
|
||||
*}
|
||||
|
||||
<a href="{$generated_link}" target="_blank">{$saved_link}</a>
|
||||
@@ -1,44 +1,36 @@
|
||||
{**
|
||||
* 2010-2022 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through LICENSE.txt file inside our module
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to CustomizationPolicy.txt file inside our module for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright 2010-2022 Webkul IN
|
||||
* @license LICENSE.txt
|
||||
*}
|
||||
|
||||
<div class="panel htl_conf_panel">
|
||||
<h3 class="tab"> <i class="icon-cogs"></i> {l s='Hotel Configuration' mod='hotelreservationsystem'}</h3>
|
||||
<div class="panel-body">
|
||||
<div class="btn-group setting-link-div col-sm-3 col-xs-12">
|
||||
<a type="button" href="{$general_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-cogs"></i></span>
|
||||
<span class="setting-title col-sm-10 col-xs-10">{l s='General Settings' 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='Hotel General Settings' mod='hotelreservationsystem'}" data-content="{l s='Configure Your Hotel general Settings using this option.' mod='hotelreservationsystem'}" data-placement="bottom">
|
||||
<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="{$order_restrict_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-list-alt"></i></span>
|
||||
<span class="setting-title col-sm-10 col-xs-10">{l s='Order Restrict' 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='Order Restrict Settings' mod='hotelreservationsystem'}" data-content="{l s='Configure if you want to restrict orders till a specific date for your hotels.' 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">
|
||||
<span class="col-sm-2 col-xs-2"><i class="icon-cog"></i></span>
|
||||
<span class="setting-title col-sm-10 col-xs-10">{l s='Advanced Price Rules' 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='Advanced Price Rule Settings' mod='hotelreservationsystem'}" data-content="{l s='Here set advanced price rules for specific dates.' mod='hotelreservationsystem'}" data-placement="bottom">
|
||||
<i class="icon-question-circle"></i>
|
||||
</a>
|
||||
</div>
|
||||
<!-- Setting to set addition demands for the room type -->
|
||||
<div class="btn-group setting-link-div col-sm-3 col-xs-12">
|
||||
<a type="button" href="{$additional_demand_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-cog"></i></span>
|
||||
<span class="setting-title col-sm-10 col-xs-10">{l s='Additional Facilities' 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='Additional Facilities Settings' mod='hotelreservationsystem'}" data-content="{l s='Here create additional facilities and their prices for room types.' mod='hotelreservationsystem'}" data-placement="bottom">
|
||||
<i class="icon-question-circle"></i>
|
||||
</a>
|
||||
</div>
|
||||
{foreach from=$settings_links item=settings_link}
|
||||
<div class="btn-group setting-link-div col-sm-3 col-xs-12">
|
||||
<a type="button" href="{$settings_link.generated_link|escape:'html':'UTF-8'}" {if $settings_link.new_window}target="_blank"{/if} class="setting-link btn btn-default col-sm-10 col-xs-10">
|
||||
<span class="col-sm-2 col-xs-2"><i class="{$settings_link.icon}"></i></span>
|
||||
<span class="setting-title col-sm-10 col-xs-10">{$settings_link.name|escape:'html':'UTF-8'}</span>
|
||||
</a>
|
||||
<a tabindex="0" class="btn btn-default col-sm-2 col-xs-2" role="button" data-toggle="popover" data-trigger="focus" title="{$settings_link.name|escape:'html':'UTF-8'}" data-content="{$settings_link.hint|escape:'html':'UTF-8'}" data-placement="bottom">
|
||||
<i class="icon-question-circle"></i>
|
||||
</a>
|
||||
</div>
|
||||
{/foreach}
|
||||
|
||||
{hook h='displayAddModuleSettingLink'}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user