Fixed: Showed room features and amenities of the room and hotel in front, added logos for all, and renamed features to amenities in all files and classes
Co-authored-by: Name <sumit201@webkul.in>
@@ -1073,9 +1073,6 @@ class ProductCore extends ObjectModel
|
||||
if (!$this->deleteServiceInfo()) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$objHotelRoomTypeBedType = new HotelRoomTypeBedType();
|
||||
$objHotelRoomTypeBedType->deleteRoomTypeBedTypes(false, $this->id);
|
||||
}
|
||||
|
||||
Hook::exec('actionProductDelete', array('id_product' => (int)$this->id, 'product' => $this));
|
||||
|
||||
@@ -3307,7 +3307,7 @@ class AdminImportControllerCore extends AdminController
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_image`');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_access`');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_booking_detail`');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_branch_features`');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_branch_amenities`');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_cart_booking_data`');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_branch_refund_rules`');
|
||||
Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'htl_order_restrict_date`');
|
||||
|
||||
@@ -1206,16 +1206,16 @@ class AdminProductsControllerCore extends AdminController
|
||||
$selectedAmenities = array_map('intval', $selectedAmenities);
|
||||
$selectedAmenities = array_values(array_unique(array_filter($selectedAmenities)));
|
||||
|
||||
if (!Db::getInstance()->delete('htl_room_type_features', '`id_product` = '.$idProduct)) {
|
||||
if (!Db::getInstance()->delete('htl_room_type_amenities', '`id_product` = '.$idProduct)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($selectedAmenities as $idAmenity) {
|
||||
if (!Db::getInstance()->insert('htl_room_type_features', array(
|
||||
if (!Db::getInstance()->insert('htl_room_type_amenities', array(
|
||||
'id_product' => $idProduct,
|
||||
'feature_id' => (int) $idAmenity,
|
||||
'date_add' => date('Y-m-d H:i:s'),
|
||||
'date_upd' => date('Y-m-d H:i:s'),
|
||||
'amenity_id' => (int) $idAmenity,
|
||||
'date_add' => date('Y-m-d H:i:s'),
|
||||
'date_upd' => date('Y-m-d H:i:s'),
|
||||
))) {
|
||||
return false;
|
||||
}
|
||||
@@ -1234,8 +1234,8 @@ class AdminProductsControllerCore extends AdminController
|
||||
protected function getSelectedRoomTypeAmenityIds($idProduct)
|
||||
{
|
||||
$selectedAmenities = Db::getInstance()->executeS(
|
||||
'SELECT `feature_id`
|
||||
FROM `'._DB_PREFIX_.'htl_room_type_features`
|
||||
'SELECT `amenity_id`
|
||||
FROM `'._DB_PREFIX_.'htl_room_type_amenities`
|
||||
WHERE `id_product` = '.(int) $idProduct
|
||||
);
|
||||
|
||||
@@ -1243,7 +1243,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
return array();
|
||||
}
|
||||
|
||||
return array_map('intval', array_column($selectedAmenities, 'feature_id'));
|
||||
return array_map('intval', array_column($selectedAmenities, 'amenity_id'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1257,10 +1257,10 @@ class AdminProductsControllerCore extends AdminController
|
||||
{
|
||||
$selectedAmenityRows = array();
|
||||
foreach ($this->getSelectedRoomTypeAmenityIds($idProduct) as $selectedAmenityId) {
|
||||
$selectedAmenityRows[] = array('feature_id' => $selectedAmenityId);
|
||||
$selectedAmenityRows[] = array('amenity_id' => $selectedAmenityId);
|
||||
}
|
||||
|
||||
$objHotelFeatures = new HotelFeatures();
|
||||
$objHotelFeatures = new HotelAmenities();
|
||||
$roomTypeAmenities = $objHotelFeatures->HotelBranchSelectedFeaturesArray(
|
||||
$selectedAmenityRows,
|
||||
$this->context->language->id
|
||||
|
||||
@@ -38,7 +38,7 @@ class AdminSearchControllerCore extends AdminController
|
||||
'AdminOrderRefundRules' => 1,
|
||||
'AdminRoomTypeGlobalDemand' => 1,
|
||||
'AdminGroups' => 1,
|
||||
'AdminHotelFeatures' => 1,
|
||||
'AdminHotelAmenities' => 1,
|
||||
'AdminCustomers' => 1,
|
||||
'AdminAddHotel' => 1,
|
||||
'AdminNormalProducts' => 1,
|
||||
@@ -430,9 +430,9 @@ class AdminSearchControllerCore extends AdminController
|
||||
|
||||
public function searchHotelFeatures()
|
||||
{
|
||||
if (class_exists('HotelFeatures')) {
|
||||
if (isset($this->controllerAccess['AdminHotelFeatures']) && $this->controllerAccess['AdminHotelFeatures']) {
|
||||
$objHotelFeatures = new HotelFeatures();
|
||||
if (class_exists('HotelAmenities')) {
|
||||
if (isset($this->controllerAccess['AdminHotelAmenities']) && $this->controllerAccess['AdminHotelAmenities']) {
|
||||
$objHotelFeatures = new HotelAmenities();
|
||||
if ($hotelFeatures = $objHotelFeatures->searchByName($this->query, $this->context->language->id)) {
|
||||
$features = array();
|
||||
foreach ($hotelFeatures as $key => $hotelFeature) {
|
||||
@@ -939,9 +939,9 @@ class AdminSearchControllerCore extends AdminController
|
||||
$helper->identifier = 'id';
|
||||
$helper->actions = array('edit', 'view');
|
||||
$helper->show_toolbar = false;
|
||||
$helper->table = 'htl_features';
|
||||
$helper->currentIndex = $this->context->link->getAdminLink('AdminHotelFeatures', false);
|
||||
$helper->token = Tools::getAdminTokenLite('AdminHotelFeatures');
|
||||
$helper->table = 'htl_amenities';
|
||||
$helper->currentIndex = $this->context->link->getAdminLink('AdminHotelAmenities', false);
|
||||
$helper->token = Tools::getAdminTokenLite('AdminHotelAmenities');
|
||||
|
||||
if ($this->_list['hotel_features']) {
|
||||
$view = $helper->generateList($this->_list['hotel_features'], $this->fields_list['hotel_features']);
|
||||
|
||||
@@ -236,7 +236,6 @@ class CategoryControllerCore extends FrontController
|
||||
}
|
||||
}
|
||||
|
||||
$feat_img_dir = _PS_IMG_.'rf/';
|
||||
$ratting_img = _MODULE_DIR_.'hotelreservationsystem/views/img/Slices/icons-sprite.png';
|
||||
$this->context->smarty->assign(array(
|
||||
'warning_num' => $warning_num,
|
||||
@@ -249,7 +248,7 @@ class CategoryControllerCore extends FrontController
|
||||
'display_all_room_types' => $displayAllRoomsTypes,
|
||||
'id_hotel' => $id_hotel,
|
||||
'currency' => $currency,
|
||||
'feat_img_dir' => $feat_img_dir,
|
||||
'amenity_img_dir' => _MODULE_DIR_.'hotelreservationsystem/views/img/hotel_amenities/',
|
||||
'ratting_img' => $ratting_img,
|
||||
));
|
||||
|
||||
|
||||
@@ -350,8 +350,8 @@ class ProductControllerCore extends FrontController
|
||||
|
||||
if (isset($obj_hotel_feaures_ids) && $obj_hotel_feaures_ids) {
|
||||
foreach ($obj_hotel_feaures_ids as $key => $value) {
|
||||
$obj_htl_ftr = new HotelFeatures();
|
||||
$htl_info = $obj_htl_ftr->getFeatureInfoById($value['feature_id']);
|
||||
$obj_htl_ftr = new HotelAmenities();
|
||||
$htl_info = $obj_htl_ftr->getFeatureInfoById($value['amenity_id']);
|
||||
$htl_features[] = $htl_info['name'];
|
||||
}
|
||||
}
|
||||
@@ -411,6 +411,7 @@ class ProductControllerCore extends FrontController
|
||||
|
||||
$roomDynamicFeatures = $this->getRoomDynamicFeatures($this->product->id);
|
||||
$roomDynamicAmenities = $this->getRoomDynamicAmenities($this->product->id);
|
||||
$hotelDynamicAmenities = $this->getHotelDynamicAmenities($hotel_id);
|
||||
|
||||
$this->context->smarty->assign(
|
||||
array(
|
||||
@@ -440,6 +441,8 @@ class ProductControllerCore extends FrontController
|
||||
'hotel_features' => $htl_features,
|
||||
'room_dynamic_features' => $roomDynamicFeatures,
|
||||
'room_dynamic_amenities' => $roomDynamicAmenities,
|
||||
'hotel_dynamic_amenities' => $hotelDynamicAmenities,
|
||||
'amenity_img_dir' => _MODULE_DIR_.'hotelreservationsystem/views/img/hotel_amenities/',
|
||||
'hotel_image_link' => $hotelImageLink,
|
||||
'hotel_has_images' => (bool) HotelImage::getCover($hotel_id),
|
||||
'order_date_restrict' => $order_date_restrict,
|
||||
@@ -595,7 +598,7 @@ class ProductControllerCore extends FrontController
|
||||
$result = array();
|
||||
foreach ($features as $feature) {
|
||||
$result[] = array(
|
||||
'name' => $feature['feature_name'],
|
||||
'name' => $feature['feature_name'],
|
||||
'value' => $feature['feature_value'],
|
||||
);
|
||||
}
|
||||
@@ -603,30 +606,34 @@ class ProductControllerCore extends FrontController
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get assigned dynamic room amenities for the room detail page.
|
||||
*
|
||||
* @param int $idProduct
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getRoomDynamicAmenities($idProduct)
|
||||
{
|
||||
$amenities = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT hfl.`name`
|
||||
FROM `'._DB_PREFIX_.'htl_room_type_features` hrtf
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_features_lang` hfl
|
||||
ON (hfl.`id` = hrtf.`feature_id` AND hfl.`id_lang` = '.(int) $this->context->language->id.')
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_features` hf ON (hf.`id` = hrtf.`feature_id`)
|
||||
WHERE hrtf.`id_product` = '.(int) $idProduct.'
|
||||
ORDER BY hf.`position` ASC, hfl.`name` ASC'
|
||||
SELECT ha.`id`, ha.`logo_type`, ha.`logo`, hal.`name`
|
||||
FROM `'._DB_PREFIX_.'htl_room_type_amenities` hrta
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_amenities` ha ON (ha.`id` = hrta.`amenity_id`)
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_amenities_lang` hal
|
||||
ON (hal.`id` = hrta.`amenity_id` AND hal.`id_lang` = '.(int) $this->context->language->id.')
|
||||
WHERE hrta.`id_product` = '.(int) $idProduct.' AND ha.`active` = 1
|
||||
ORDER BY ha.`position` ASC, hal.`name` ASC'
|
||||
);
|
||||
|
||||
if (!$amenities) {
|
||||
return array();
|
||||
}
|
||||
return $amenities ?: array();
|
||||
}
|
||||
|
||||
return $amenities;
|
||||
protected function getHotelDynamicAmenities($idHotel)
|
||||
{
|
||||
$amenities = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT ha.`id`, ha.`logo_type`, ha.`logo`, hal.`name`
|
||||
FROM `'._DB_PREFIX_.'htl_branch_amenities` hba
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_amenities` ha ON (ha.`id` = hba.`amenity_id`)
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_amenities_lang` hal
|
||||
ON (hal.`id` = hba.`amenity_id` AND hal.`id_lang` = '.(int) $this->context->language->id.')
|
||||
WHERE hba.`id_hotel` = '.(int) $idHotel.' AND ha.`active` = 1
|
||||
ORDER BY ha.`position` ASC, hal.`name` ASC'
|
||||
);
|
||||
|
||||
return $amenities ?: array();
|
||||
}
|
||||
|
||||
public function assignRoomServiceProductVars()
|
||||
|
||||
BIN
img/rf/1.jpg
|
Before Width: | Height: | Size: 384 B After Width: | Height: | Size: 1.3 KiB |
BIN
img/rf/2.jpg
|
Before Width: | Height: | Size: 328 B After Width: | Height: | Size: 1.2 KiB |
BIN
img/rf/3.jpg
|
Before Width: | Height: | Size: 524 B After Width: | Height: | Size: 1.2 KiB |
BIN
img/rf/4.jpg
|
Before Width: | Height: | Size: 148 B After Width: | Height: | Size: 1.1 KiB |
BIN
img/rf/5.jpg
|
Before Width: | Height: | Size: 333 B After Width: | Height: | Size: 1.3 KiB |
BIN
img/rf/6.jpg
|
Before Width: | Height: | Size: 322 B After Width: | Height: | Size: 1.3 KiB |
BIN
img/rf/7.jpg
|
Before Width: | Height: | Size: 184 B After Width: | Height: | Size: 1.1 KiB |
259
modules/hotelreservationsystem/classes/HotelAmenities.php
Normal file
@@ -0,0 +1,259 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3.0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a newer
|
||||
* versions in the future. If you wish to customize this module for your needs
|
||||
* please refer to https://store.webkul.com/customisation-guidelines for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3.0-php Open Software License version 3.0
|
||||
*/
|
||||
|
||||
class HotelAmenities extends ObjectModel
|
||||
{
|
||||
public $name;
|
||||
public $parent_feature_id;
|
||||
public $position;
|
||||
public $active;
|
||||
public $is_featured;
|
||||
public $logo_type;
|
||||
public $logo;
|
||||
public $date_add;
|
||||
public $date_upd;
|
||||
|
||||
public static $definition = array(
|
||||
'table' => 'htl_amenities',
|
||||
'primary' => 'id',
|
||||
'multilang' => true,
|
||||
'fields' => array(
|
||||
'parent_feature_id' => array('type' => self::TYPE_INT, 'required' => true),
|
||||
'position' => array('type' => self::TYPE_INT),
|
||||
'active' => array('type' => self::TYPE_INT, 'required' => true),
|
||||
'is_featured' => array('type' => self::TYPE_INT),
|
||||
'logo_type' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
||||
'logo' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false),
|
||||
// lang fields
|
||||
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'required' => true),
|
||||
),
|
||||
);
|
||||
|
||||
protected $webserviceParameters = array(
|
||||
'objectsNodeName' => 'hotel_amenities',
|
||||
'objectNodeName' => 'hotel_amenity',
|
||||
'fields' => array(),
|
||||
);
|
||||
|
||||
public function delete()
|
||||
{
|
||||
if ($id = $this->id) {
|
||||
Db::getInstance()->delete('htl_branch_amenities', '`amenity_id` = '.(int)$id);
|
||||
Db::getInstance()->delete('htl_room_type_amenities', '`amenity_id` = '.(int)$id);
|
||||
$imgFile = dirname(__FILE__).'/../views/img/hotel_amenities/'.(int)$id.'.jpg';
|
||||
if (file_exists($imgFile)) {
|
||||
unlink($imgFile);
|
||||
}
|
||||
return parent::delete();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all categories (parent_feature_id = 0) with their child amenities.
|
||||
*
|
||||
* @param int $idLang
|
||||
* @return array|false
|
||||
*/
|
||||
public function getAllAmenitiesTree($idLang = 0)
|
||||
{
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$parents = Db::getInstance()->executeS(
|
||||
'SELECT ha.`id`, ha.`position`, hal.`name`
|
||||
FROM `'._DB_PREFIX_.'htl_amenities` ha
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_amenities_lang` hal
|
||||
ON (hal.`id` = ha.`id` AND hal.`id_lang` = '.(int)$idLang.')
|
||||
WHERE ha.`parent_feature_id` = 0
|
||||
ORDER BY ha.`position` ASC'
|
||||
);
|
||||
|
||||
if ($parents) {
|
||||
foreach ($parents as $parent) {
|
||||
$result[$parent['id']] = array(
|
||||
'id' => $parent['id'],
|
||||
'name' => $parent['name'],
|
||||
'position' => $parent['position'],
|
||||
'children' => array(),
|
||||
);
|
||||
|
||||
$children = Db::getInstance()->executeS(
|
||||
'SELECT ha.`id`, ha.`active`, ha.`logo_type`, ha.`logo`, hal.`name`
|
||||
FROM `'._DB_PREFIX_.'htl_amenities` ha
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_amenities_lang` hal
|
||||
ON (hal.`id` = ha.`id` AND hal.`id_lang` = '.(int)$idLang.')
|
||||
WHERE ha.`parent_feature_id` = '.(int)$parent['id']
|
||||
);
|
||||
|
||||
if ($children) {
|
||||
$result[$parent['id']]['children'] = $children;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result ?: false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all amenity categories with children, marking which children are selected for a hotel.
|
||||
*
|
||||
* @param array $branchAmenities rows from htl_branch_amenities for a hotel
|
||||
* @param int $idLang
|
||||
* @return array|false
|
||||
*/
|
||||
public function HotelBranchSelectedFeaturesArray($branchAmenities, $idLang = 0)
|
||||
{
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$parents = Db::getInstance()->executeS(
|
||||
'SELECT ha.`id`, hal.`name`
|
||||
FROM `'._DB_PREFIX_.'htl_amenities` ha
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_amenities_lang` hal
|
||||
ON (hal.`id` = ha.`id` AND hal.`id_lang` = '.(int)$idLang.')
|
||||
WHERE ha.`parent_feature_id` = 0'
|
||||
);
|
||||
|
||||
if ($parents) {
|
||||
foreach ($parents as $parent) {
|
||||
$result[$parent['id']]['name'] = $parent['name'];
|
||||
$children = Db::getInstance()->executeS(
|
||||
'SELECT ha.`id`, hal.`name`
|
||||
FROM `'._DB_PREFIX_.'htl_amenities` ha
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_amenities_lang` hal
|
||||
ON (hal.`id` = ha.`id` AND hal.`id_lang` = '.(int)$idLang.')
|
||||
WHERE ha.`parent_feature_id` = '.(int)$parent['id']
|
||||
);
|
||||
|
||||
if ($children) {
|
||||
foreach ($children as $child) {
|
||||
$selected = 0;
|
||||
if ($branchAmenities) {
|
||||
foreach ($branchAmenities as $row) {
|
||||
if ($child['id'] == $row['amenity_id']) {
|
||||
$selected = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$child['selected'] = $selected;
|
||||
$result[$parent['id']]['children'][] = $child;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result ?: false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param int $idLang
|
||||
* @return array|false
|
||||
*/
|
||||
public function getFeatureInfoById($id, $idLang = 0)
|
||||
{
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
return Db::getInstance()->getRow(
|
||||
'SELECT ha.`id`, hal.`name`
|
||||
FROM `'._DB_PREFIX_.'htl_amenities` ha
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_amenities_lang` hal
|
||||
ON (hal.`id` = ha.`id` AND hal.`id_lang` = '.(int)$idLang.')
|
||||
WHERE ha.`id` = '.(int)$id
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $parentId
|
||||
* @return array|false
|
||||
*/
|
||||
public function getChildFeaturesByParentFeatureId($parentId)
|
||||
{
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT `id` FROM `'._DB_PREFIX_.'htl_amenities` WHERE `parent_feature_id` = '.(int)$parentId
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a category and all its child amenities.
|
||||
*
|
||||
* @param int $deleteId
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteHotelFeatures($deleteId)
|
||||
{
|
||||
$rows = Db::getInstance()->executeS(
|
||||
'SELECT `id` FROM `'._DB_PREFIX_.'htl_amenities`
|
||||
WHERE `parent_feature_id` = '.(int)$deleteId.' OR `id` = '.(int)$deleteId
|
||||
);
|
||||
|
||||
if ($rows) {
|
||||
foreach ($rows as $row) {
|
||||
$obj = new HotelAmenities((int)$row['id']);
|
||||
$obj->delete();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $query
|
||||
* @param int $idLang
|
||||
* @return array|false
|
||||
*/
|
||||
public function searchByName($query, $idLang = false)
|
||||
{
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT ha.*, hal.* FROM `'._DB_PREFIX_.'htl_amenities` ha
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_amenities_lang` hal ON hal.`id` = ha.`id`
|
||||
WHERE hal.`name` LIKE \'%'.pSQL($query).'%\'
|
||||
AND hal.`id_lang` = '.(int)$idLang
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return image path for amenity logo stored in views/img/hotel_amenities/.
|
||||
*
|
||||
* @param int $id
|
||||
* @return string
|
||||
*/
|
||||
public static function getAmenityImagePath($id)
|
||||
{
|
||||
return _MODULE_DIR_.'hotelreservationsystem/views/img/hotel_amenities/'.(int)$id.'.jpg';
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a newer
|
||||
* versions in the future. If you wish to customize this module for your needs
|
||||
* please refer to https://store.webkul.com/customisation-guidelines for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*/
|
||||
|
||||
class HotelBedType extends ObjectModel
|
||||
{
|
||||
public $length;
|
||||
public $width;
|
||||
public $name;
|
||||
|
||||
public static $definition =array(
|
||||
'table' => 'htl_bed_type',
|
||||
'primary' => 'id_bed_type',
|
||||
'multilang' => true,
|
||||
'fields' => array(
|
||||
'length' => array('type' => self::TYPE_FLOAT, 'validate' => 'isUnsignedFloat'),
|
||||
'width' => array('type' => self::TYPE_FLOAT, 'validate' => 'isUnsignedFloat'),
|
||||
// lang fields
|
||||
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCatalogName', 'required' => true, 'size' => 128),
|
||||
),
|
||||
);
|
||||
|
||||
public function getAllBedTypes($idLang)
|
||||
{
|
||||
if (!$this->hasLegacyBedTypeTables()) {
|
||||
return array();
|
||||
}
|
||||
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
|
||||
$sql = 'SELECT hbt.*, hbtl.`name` FROM `'._DB_PREFIX_.$this->table.'` hbt
|
||||
LEFT JOIN `'._DB_PREFIX_.$this->table.'_lang` hbtl ON hbt.`id_bed_type` = hbtl.`id_bed_type`
|
||||
WHERE 1 AND hbtl.`id_lang` ='.(int) $idLang;
|
||||
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
if (!$this->hasLegacyBedTypeTables()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$objHotelRoomTypeBedType = new HotelRoomTypeBedType();
|
||||
$objHotelRoomTypeBedType->deleteRoomTypeBedTypes($this->id);
|
||||
|
||||
return parent::delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the deprecated bed type schema still exists.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function hasLegacyBedTypeTables()
|
||||
{
|
||||
return (bool) Db::getInstance()->getValue(
|
||||
'SHOW TABLES LIKE \'' . pSQL(_DB_PREFIX_.$this->table) . '\''
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1700,11 +1700,26 @@ class HotelBookingDetail extends ObjectModel
|
||||
if (!$only_search_data) {
|
||||
if (!empty($bookingData)) {
|
||||
foreach ($bookingData['rm_data'] as $key => $value) {
|
||||
$product_feature = Product::getFrontFeaturesStatic($context->language->id, $value['id_product']);
|
||||
// featured amenities for display in room type list
|
||||
$product_feature = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT ha.`id`, ha.`logo_type`, ha.`logo`, hal.`name`
|
||||
FROM `'._DB_PREFIX_.'htl_room_type_amenities` hrta
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_amenities` ha ON ha.`id` = hrta.`amenity_id`
|
||||
INNER JOIN `'._DB_PREFIX_.'htl_amenities_lang` hal
|
||||
ON hal.`id` = hrta.`amenity_id` AND hal.`id_lang` = '.(int)$context->language->id.'
|
||||
WHERE hrta.`id_product` = '.(int)$value['id_product'].'
|
||||
AND ha.`is_featured` = 1 AND ha.`active` = 1
|
||||
ORDER BY ha.`position` ASC
|
||||
');
|
||||
if (!$product_feature) {
|
||||
$product_feature = array();
|
||||
}
|
||||
// PS core features used by the amenities filter block
|
||||
$prod_amen = array();
|
||||
if (!empty($amenities) && $amenities) {
|
||||
$prod_amen = $amenities;
|
||||
foreach ($product_feature as $a_key => $a_val) {
|
||||
$psFeatures = Product::getFrontFeaturesStatic($context->language->id, $value['id_product']);
|
||||
foreach ($psFeatures as $a_val) {
|
||||
if (($pa_key = array_search($a_val['id_feature'], $prod_amen)) !== false) {
|
||||
unset($prod_amen[$pa_key]);
|
||||
if (empty($prod_amen)) {
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3.0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a newer
|
||||
* versions in the future. If you wish to customize this module for your needs
|
||||
* please refer to https://store.webkul.com/customisation-guidelines for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3.0-php Open Software License version 3.0
|
||||
*/
|
||||
|
||||
class HotelBranchAmenities extends ObjectModel
|
||||
{
|
||||
public $id;
|
||||
public $id_hotel;
|
||||
public $amenity_id;
|
||||
public $date_add;
|
||||
public $date_upd;
|
||||
|
||||
public static $definition = array(
|
||||
'table' => 'htl_branch_amenities',
|
||||
'primary' => 'id',
|
||||
'fields' => array(
|
||||
'id_hotel' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'amenity_id' => array('type' => self::TYPE_INT),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false),
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* @param int $idHotel
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteBranchFeaturesByHotelId($idHotel)
|
||||
{
|
||||
return Db::getInstance()->delete('htl_branch_amenities', '`id_hotel` = '.(int)$idHotel);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $idHotel
|
||||
* @param array $amenities array of amenity IDs
|
||||
* @return bool
|
||||
*/
|
||||
public function assignFeaturesToHotel($idHotel, $amenities)
|
||||
{
|
||||
if ($amenities) {
|
||||
foreach ($amenities as $amenityId) {
|
||||
$obj = new HotelBranchAmenities();
|
||||
$obj->id_hotel = (int)$idHotel;
|
||||
$obj->amenity_id = (int)$amenityId;
|
||||
$obj->save();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a newer
|
||||
* versions in the future. If you wish to customize this module for your needs
|
||||
* please refer to https://store.webkul.com/customisation-guidelines for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*/
|
||||
|
||||
class HotelBranchFeatures extends ObjectModel
|
||||
{
|
||||
public $id;
|
||||
public $id_hotel;
|
||||
public $feature_id;
|
||||
public $date_add;
|
||||
public $date_upd;
|
||||
public static $definition = array(
|
||||
'table' => 'htl_branch_features',
|
||||
'primary' => 'id',
|
||||
'fields' => array(
|
||||
'id_hotel' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'feature_id' => array('type' => self::TYPE_STRING),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false),
|
||||
));
|
||||
|
||||
/**
|
||||
* [deleteBranchFeaturesByHotelId : For deleting features of a hotel by hotel id]
|
||||
* @param [int] $idHotel [Hotel's id , which hotel's features to be deleted]
|
||||
* @return [Boolean] [true if deleted or false if no deleted]
|
||||
*/
|
||||
public function deleteBranchFeaturesByHotelId($idHotel)
|
||||
{
|
||||
return Db::getInstance()->delete('htl_branch_features', '`id_hotel` = '.(int) $idHotel);
|
||||
}
|
||||
|
||||
/**
|
||||
* [assignFeaturesToHotel : For assigning Hotel features to a hotel]
|
||||
* @param [int] $idHotel [Hotel's id , To which features to be assigned]
|
||||
* @param [Array] $features [array of features to be assigned to the hotel]
|
||||
* @return [Boolean] [true]
|
||||
*/
|
||||
public function assignFeaturesToHotel($idHotel, $features)
|
||||
{
|
||||
if ($features) {
|
||||
foreach ($features as $feature) {
|
||||
$obj_htl_features = new HotelBranchFeatures();
|
||||
$obj_htl_features->id_hotel = $idHotel;
|
||||
$obj_htl_features->feature_id = $feature;
|
||||
$obj_htl_features->save();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -506,7 +506,7 @@ class HotelBranchInformation extends ObjectModel
|
||||
$sql = 'SELECT hbi.`id`, hbl.`hotel_name` FROM `'._DB_PREFIX_.'htl_branch_info` hbi
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_branch_info_lang` hbl
|
||||
ON (hbl.`id` = hbi.`id` AND hbl.`id_lang` = '.(int)$idLang.')
|
||||
WHERE hbi.`id` NOT IN (SELECT DISTINCT id_hotel FROM `'._DB_PREFIX_.'htl_branch_features`)';
|
||||
WHERE hbi.`id` NOT IN (SELECT DISTINCT id_hotel FROM `'._DB_PREFIX_.'htl_branch_amenities`)';
|
||||
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
@@ -521,7 +521,7 @@ class HotelBranchInformation extends ObjectModel
|
||||
public function getFeaturesOfHotelByHotelId($id_hotel)
|
||||
{
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT feature_id FROM `'._DB_PREFIX_.'htl_branch_features` WHERE id_hotel='.(int)$id_hotel
|
||||
'SELECT amenity_id FROM `'._DB_PREFIX_.'htl_branch_amenities` WHERE id_hotel='.(int)$id_hotel
|
||||
);
|
||||
}
|
||||
|
||||
@@ -802,7 +802,7 @@ class HotelBranchInformation extends ObjectModel
|
||||
}
|
||||
}
|
||||
}
|
||||
$objHotelfeatures = new HotelBranchFeatures();
|
||||
$objHotelfeatures = new HotelBranchAmenities();
|
||||
$objHotelImage = new HotelImage();
|
||||
if (!$objHotelfeatures->deleteBranchFeaturesByHotelId($idHotel)) {
|
||||
$contextController->errors[] = $this->moduleInstance->l(
|
||||
@@ -1007,8 +1007,8 @@ class HotelBranchInformation extends ObjectModel
|
||||
public function getWsHotelFeatures()
|
||||
{
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT `feature_id` as `id` FROM `'._DB_PREFIX_.'htl_branch_features` WHERE `id_hotel` = '.(int)$this->id.
|
||||
' ORDER BY `feature_id` ASC'
|
||||
'SELECT `amenity_id` as `id` FROM `'._DB_PREFIX_.'htl_branch_amenities` WHERE `id_hotel` = '.(int)$this->id.
|
||||
' ORDER BY `amenity_id` ASC'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1016,12 +1016,12 @@ class HotelBranchInformation extends ObjectModel
|
||||
public function setWsHotelFeatures($branchFeatures)
|
||||
{
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `'._DB_PREFIX_.'htl_branch_features`
|
||||
DELETE FROM `'._DB_PREFIX_.'htl_branch_amenities`
|
||||
WHERE `id_hotel` = '.(int)$this->id
|
||||
);
|
||||
|
||||
foreach ($branchFeatures as $feature) {
|
||||
Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'htl_branch_features` (`id_hotel`, `feature_id`, `date_add`, `date_upd`) VALUES ('.(int)$this->id.', '.(int)$feature['id'].', NOW(), NOW())');
|
||||
Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'htl_branch_amenities` (`id_hotel`, `amenity_id`, `date_add`, `date_upd`) VALUES ('.(int)$this->id.', '.(int)$feature['id'].', NOW(), NOW())');
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1534,7 +1534,7 @@ class HotelCartBookingData extends ObjectModel
|
||||
$objCartBooking = new self();
|
||||
$objRoomType = new HotelRoomType();
|
||||
$objHotelBranch = new HotelBranchInformation();
|
||||
$objHtlFeatures = new HotelFeatures();
|
||||
$objHtlFeatures = new HotelAmenities();
|
||||
$objCartBookingData = new HotelCartBookingData();
|
||||
$objRoomDemands = new HotelRoomTypeDemand();
|
||||
$objRoomTypeServiceProduct = new RoomTypeServiceProduct();
|
||||
@@ -1612,7 +1612,7 @@ class HotelCartBookingData extends ObjectModel
|
||||
if ($hotelFeaureIds = $objHotelBranch->getFeaturesOfHotelByHotelId($roomDetail['id_hotel'])) {
|
||||
$hotelFeatures = array();
|
||||
foreach ($hotelFeaureIds as $value) {
|
||||
$htlFeatureInfo = $objHtlFeatures->getFeatureInfoById($value['feature_id']);
|
||||
$htlFeatureInfo = $objHtlFeatures->getFeatureInfoById($value['amenity_id']);
|
||||
if ($htlFeatureInfo = $objHtlFeatures->getFeatureInfoById($value['feature_id'])) {
|
||||
$hotelFeatures[] = $htlFeatureInfo['name'];
|
||||
}
|
||||
|
||||
@@ -1,228 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a newer
|
||||
* versions in the future. If you wish to customize this module for your needs
|
||||
* please refer to https://store.webkul.com/customisation-guidelines for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*/
|
||||
|
||||
class HotelFeatures extends ObjectModel
|
||||
{
|
||||
public $name;
|
||||
public $parent_feature_id;
|
||||
public $position;
|
||||
public $active;
|
||||
public $date_add;
|
||||
public $date_upd;
|
||||
|
||||
public static $definition = array(
|
||||
'table' => 'htl_features',
|
||||
'primary' => 'id',
|
||||
'multilang' => true,
|
||||
'fields' => array(
|
||||
'parent_feature_id' => array('type' => self::TYPE_INT, 'required' => true),
|
||||
'position' => array('type' => self::TYPE_INT),
|
||||
'active' => array('type' => self::TYPE_INT, 'required' => true),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false),
|
||||
//lang fields
|
||||
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'required' => true),
|
||||
)
|
||||
);
|
||||
|
||||
protected $webserviceParameters = array(
|
||||
'objectsNodeName' => 'hotel_features',
|
||||
'objectNodeName' => 'hotel_feature',
|
||||
'fields' => array(),
|
||||
);
|
||||
|
||||
public function delete()
|
||||
{
|
||||
if ($id = $this->id) {
|
||||
if (Db::getInstance()->delete('htl_branch_features', '`feature_id` = '.(int) $id)) {
|
||||
return parent::delete();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* [getFeatureInfoById :: To get feature in formation by its id]
|
||||
* @param [int] $id [description]
|
||||
* @return [false | array] [Returns false if no data found otherwise returns array of the information of the
|
||||
* feature]
|
||||
*/
|
||||
public function getFeatureInfoById($id, $idLang = 0)
|
||||
{
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
return Db::getInstance()->getRow(
|
||||
'SELECT hf.`id` , hfl.`name`
|
||||
FROM `'._DB_PREFIX_.'htl_features` hf
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_features_lang` hfl
|
||||
ON (hfl.`id` = hf.`id` AND hfl.`id_lang` = '.(int)$idLang.')
|
||||
WHERE hf.`id`='.(int) $id
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* [HotelAllCommonFeaturesArray :: To get array of all hotel features information according to parents feature and
|
||||
* children features under parent feature]
|
||||
* @return [boolean] [If data found returns array of all common features as parent then children under this parent]
|
||||
*/
|
||||
public function HotelAllCommonFeaturesArray($idLang = 0)
|
||||
{
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
$result = array();
|
||||
if ($parentFeatures = Db::getInstance()->executeS(
|
||||
'SELECT hf.`id`, hf.`position`, hfl.`name`
|
||||
FROM `'._DB_PREFIX_.'htl_features` hf
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_features_lang` hfl
|
||||
ON (hfl.`id` = hf.`id` AND hfl.`id_lang` = '.(int)$idLang.')
|
||||
WHERE hf.`parent_feature_id`=0 order by position'
|
||||
)) {
|
||||
foreach ($parentFeatures as $value) {
|
||||
$result[$value['id']]['name'] = $value['name'];
|
||||
$result[$value['id']]['id'] = $value['id'];
|
||||
$result[$value['id']]['position'] = $value['position'];
|
||||
if ($childFeatures = Db::getInstance()->executeS(
|
||||
'SELECT hf.`id`, hfl.`name`
|
||||
FROM `'._DB_PREFIX_.'htl_features` hf
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_features_lang` hfl
|
||||
ON (hfl.`id` = hf.`id` AND hfl.`id_lang` = '.(int)$idLang.')
|
||||
WHERE hf.`parent_feature_id`='.(int) $value['id']
|
||||
)) {
|
||||
foreach ($childFeatures as $value1) {
|
||||
$result[$value['id']]['children'][] = $value1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$result) {
|
||||
return false;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* [deleteHotelFeatures :: Deletes the feature which id is $deleteId and also delete all the child features which
|
||||
* parent id is $deleteId]
|
||||
* @param [int] $deleteId [id(primary_key) of the htl_features table]
|
||||
* @return [boolean] [true if deleted otherwise false]
|
||||
*/
|
||||
public function deleteHotelFeatures($deleteId, $deleteOnlyChilds = 0)
|
||||
{
|
||||
$sql = 'SELECT `id` FROM `'._DB_PREFIX_.'htl_features` WHERE `parent_feature_id`='.(int) $deleteId;
|
||||
|
||||
if (!$deleteOnlyChilds) {
|
||||
$sql .= ' OR `id`='.(int) $deleteId;
|
||||
}
|
||||
if ($idsToDetele = Db::getInstance()->executeS($sql)) {
|
||||
foreach ($idsToDetele as $value) {
|
||||
$objHotelFeatures = new HotelFeatures($value['id']);
|
||||
$objHotelFeatures->delete();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* [HotelBranchSelectedFeaturesArray :: To get array of all hotel features information according to parents and
|
||||
* children including which child features are selected for a hotel]
|
||||
* @param [array] $htl_features [array containing information of the features of a hotel]
|
||||
* @return [boolean] [If data found returns array of all common features as parent then children under this parent
|
||||
* and also set an index in the array that defines whether the child feature is selected for the hotel or not]
|
||||
*/
|
||||
public function HotelBranchSelectedFeaturesArray($htl_features, $idLang = 0)
|
||||
{
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
$result = array();
|
||||
if ($parentFeatures = Db::getInstance()->executeS(
|
||||
'SELECT hf.`id`, hfl.`name`
|
||||
FROM `'._DB_PREFIX_.'htl_features` hf
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_features_lang` hfl
|
||||
ON (hfl.`id` = hf.`id` AND hfl.`id_lang` = '.(int)$idLang.')
|
||||
WHERE hf.`parent_feature_id`=0'
|
||||
)) {
|
||||
foreach ($parentFeatures as $value) {
|
||||
$result[$value['id']]['name'] = $value['name'];
|
||||
if ($childFeatures = Db::getInstance()->executeS(
|
||||
'SELECT hf.`id`, hfl.`name`
|
||||
FROM `'._DB_PREFIX_.'htl_features` hf
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_features_lang` hfl
|
||||
ON (hfl.`id` = hf.`id` AND hfl.`id_lang` = '.(int)$idLang.')
|
||||
WHERE hf.`parent_feature_id`='.(int) $value['id']
|
||||
)) {
|
||||
foreach ($childFeatures as $value1) {
|
||||
$flag =0;
|
||||
if ($htl_features) {
|
||||
foreach ($htl_features as $ftr) {
|
||||
if ($value1['id'] == $ftr['feature_id']) {
|
||||
$flag = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($flag) {
|
||||
$value1['selected'] = 1;
|
||||
} else {
|
||||
$value1['selected'] = 0;
|
||||
}
|
||||
|
||||
$result[$value['id']]['children'][] = $value1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$result) {
|
||||
return false;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getChildFeaturesByParentFeatureId($parent_feature_id)
|
||||
{
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT `id` FROM `'._DB_PREFIX_.'htl_features` WHERE `parent_feature_id`='.(int)$parent_feature_id
|
||||
);
|
||||
}
|
||||
|
||||
public function updateHotelFeatureInfoByParentFeatureId($parent_feature_id, $update_params)
|
||||
{
|
||||
return Db::getInstance()->update('htl_features', $update_params, 'id='.(int) $parent_feature_id);
|
||||
}
|
||||
|
||||
public function searchByName($query, $idLang = false)
|
||||
{
|
||||
if (!$idLang) {
|
||||
$idLang = Context::getContext()->language->id;
|
||||
}
|
||||
|
||||
return Db::getInstance()->executeS(
|
||||
'SELECT hf.*, hfl.* FROM `'._DB_PREFIX_.'htl_features` hf
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_features_lang` hfl
|
||||
ON hfl.`id` = hf.`id`
|
||||
WHERE hfl.`name` LIKE \'%'.pSQL($query).'%\'
|
||||
AND hfl.`id_lang`='.(int) $idLang
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -977,9 +977,11 @@ class HotelHelper
|
||||
);
|
||||
// lang fields
|
||||
$languages = Language::getLanguages(false);
|
||||
$imgDir = dirname(__FILE__).'/../views/img/hotel_amenities/';
|
||||
$i = 1;
|
||||
$childCounter = 0;
|
||||
foreach ($parent_features_arr as $key => $value) {
|
||||
$obj_feature = new HotelFeatures();
|
||||
$obj_feature = new HotelAmenities();
|
||||
foreach ($languages as $lang) {
|
||||
if (isset($value['name'][$lang['iso_code']])) {
|
||||
$obj_feature->name[$lang['id_lang']] = $value['name'][$lang['iso_code']];
|
||||
@@ -994,7 +996,8 @@ class HotelHelper
|
||||
$obj_feature->save();
|
||||
$parent_feature_id = $obj_feature->id;
|
||||
foreach ($value['features'] as $val) {
|
||||
$obj_feature = new HotelFeatures();
|
||||
++$childCounter;
|
||||
$obj_feature = new HotelAmenities();
|
||||
foreach ($languages as $lang) {
|
||||
if (isset($val[$lang['iso_code']])) {
|
||||
$obj_feature->name[$lang['id_lang']] = $val[$lang['iso_code']];
|
||||
@@ -1002,9 +1005,18 @@ class HotelHelper
|
||||
$obj_feature->name[$lang['id_lang']] = $val['en'];
|
||||
}
|
||||
}
|
||||
$obj_feature->active = 1;
|
||||
$obj_feature->active = 1;
|
||||
$obj_feature->parent_feature_id = $parent_feature_id;
|
||||
$obj_feature->save();
|
||||
|
||||
$srcImg = $imgDir.'_default/'.$childCounter.'.jpg';
|
||||
if (file_exists($srcImg)) {
|
||||
if (ImageManager::resize($srcImg, $imgDir.$obj_feature->id.'.jpg')) {
|
||||
$obj_feature->logo_type = 'image';
|
||||
$obj_feature->logo = $obj_feature->id.'.jpg';
|
||||
$obj_feature->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
++$i;
|
||||
}
|
||||
@@ -1192,138 +1204,6 @@ class HotelHelper
|
||||
);
|
||||
}
|
||||
|
||||
public function createHotelDefaultBedTypes()
|
||||
{
|
||||
$htlBedTypes = array(
|
||||
array(
|
||||
'length' => '6.25',
|
||||
'width' => '3.16',
|
||||
'name' => array(
|
||||
'en' => 'Twin Bed',
|
||||
'nl' => 'Eenpersoonsbed',
|
||||
'fr' => 'Lit simple',
|
||||
'de' => 'Einzelbett',
|
||||
'ru' => 'Односпальная кровать',
|
||||
'es' => 'Cama individual',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'length' => '6.66',
|
||||
'width' => '3.16',
|
||||
'name' => array(
|
||||
'en' => 'Twin XL Bed',
|
||||
'nl' => 'Eenpersoonsbed XL',
|
||||
'fr' => 'Lit simple XL',
|
||||
'de' => 'Einzelbett XL',
|
||||
'ru' => 'Односпальная кровать XL',
|
||||
'es' => 'Cama individual XL',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'length' => '6.25',
|
||||
'width' => '4.5',
|
||||
'name' => array(
|
||||
'en' => 'Full Bed',
|
||||
'nl' => 'Tweepersoonsbed',
|
||||
'fr' => 'Lit double',
|
||||
'de' => 'Doppelbett',
|
||||
'ru' => 'Двуспальная кровать',
|
||||
'es' => 'Cama doble',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'length' => '6.66',
|
||||
'width' => '5',
|
||||
'name' => array(
|
||||
'en' => 'Queen Bed',
|
||||
'nl' => 'Queen size bed',
|
||||
'fr' => 'Lit Queen',
|
||||
'de' => 'Queen-Size-Bett',
|
||||
'ru' => 'Кровать Queen Size',
|
||||
'es' => 'Cama Queen',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'length' => '6.66',
|
||||
'width' => '6.33',
|
||||
'name' => array(
|
||||
'en' => 'King Bed',
|
||||
'nl' => 'King size bed',
|
||||
'fr' => 'Lit King',
|
||||
'de' => 'King-Size-Bett',
|
||||
'ru' => 'Кровать King Size',
|
||||
'es' => 'Cama King',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'length' => '7',
|
||||
'width' => '6',
|
||||
'name' => array(
|
||||
'en' => 'California King Bed',
|
||||
'nl' => 'California King bed',
|
||||
'fr' => 'Lit California King',
|
||||
'de' => 'California King-Bett',
|
||||
'ru' => 'Калифорнийская кровать King Size',
|
||||
'es' => 'Cama California King',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'length' => '6.25',
|
||||
'width' => '3.16',
|
||||
'name' => array(
|
||||
'en' => 'Bunk Bed',
|
||||
'nl' => 'Stapelbed',
|
||||
'fr' => 'Lit superposé',
|
||||
'de' => 'Etagenbett',
|
||||
'ru' => 'Двухъярусная кровать',
|
||||
'es' => 'Litera',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'length' => '6.25',
|
||||
'width' => '4.5',
|
||||
'name' => array(
|
||||
'en' => 'Sofa Bed',
|
||||
'nl' => 'Slaapbank',
|
||||
'fr' => 'Canapé-lit',
|
||||
'de' => 'Schlafsofa',
|
||||
'ru' => 'Диван-кровать',
|
||||
'es' => 'Sofá cama',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'length' => '6.66',
|
||||
'width' => '5',
|
||||
'name' => array(
|
||||
'en' => 'Murphy Bed',
|
||||
'nl' => 'Inklapbed',
|
||||
'fr' => 'Lit escamotable',
|
||||
'de' => 'Klappbett',
|
||||
'ru' => 'Откидная кровать',
|
||||
'es' => 'Cama abatible',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$languages = Language::getLanguages(true);
|
||||
foreach ($htlBedTypes as $htlBedType) {
|
||||
$objBedType = new HotelBedType();
|
||||
foreach ($languages as $lang) {
|
||||
if (isset($htlBedType['name'][$lang['iso_code']])) {
|
||||
$objBedType->name[$lang['id_lang']] = $htlBedType['name'][$lang['iso_code']];
|
||||
} else {
|
||||
$objBedType->name[$lang['id_lang']] = $htlBedType['name']['en'];
|
||||
}
|
||||
|
||||
$objBedType->width = $htlBedType['width'];
|
||||
$objBedType->length = $htlBedType['length'];
|
||||
$objBedType->save();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function getPsProducts($id_lang, $start = 0, $limit = 0, $booking_product = null)
|
||||
{
|
||||
$sql = 'SELECT p.`id_product`, pl.`name`, p.`booking_product`
|
||||
@@ -1764,9 +1644,9 @@ class HotelHelper
|
||||
{
|
||||
$branch_ftr_ids = array(1, 2, 4, 7, 8, 9, 11, 12, 14, 16, 17, 18, 21);
|
||||
foreach ($branch_ftr_ids as $value_ftr) {
|
||||
$htl_ftr_obj = new HotelBranchFeatures();
|
||||
$htl_ftr_obj->id_hotel = $id_hotel;
|
||||
$htl_ftr_obj->feature_id = $value_ftr;
|
||||
$htl_ftr_obj = new HotelBranchAmenities();
|
||||
$htl_ftr_obj->id_hotel = $id_hotel;
|
||||
$htl_ftr_obj->amenity_id = $value_ftr;
|
||||
$htl_ftr_obj->save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,37 +91,40 @@ class HotelReservationSystemDb
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
|
||||
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_branch_features` (
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_branch_amenities` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`id_hotel` int(10) unsigned NOT NULL,
|
||||
`feature_id` int(10) unsigned NOT NULL,
|
||||
`amenity_id` int(10) unsigned NOT NULL,
|
||||
`date_add` datetime NOT NULL,
|
||||
`date_upd` datetime NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
|
||||
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_room_type_features` (
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_room_type_amenities` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`id_product` int(10) unsigned NOT NULL,
|
||||
`feature_id` int(10) unsigned NOT NULL,
|
||||
`amenity_id` int(10) unsigned NOT NULL,
|
||||
`date_add` datetime NOT NULL,
|
||||
`date_upd` datetime NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id_product` (`id_product`),
|
||||
KEY `feature_id` (`feature_id`)
|
||||
KEY `amenity_id` (`amenity_id`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
|
||||
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_features` (
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_amenities` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`parent_feature_id` int(10) unsigned NOT NULL,
|
||||
`position` int(10) unsigned NOT NULL,
|
||||
`active` int(2) NOT NULL DEFAULT '0',
|
||||
`is_featured` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`logo_type` varchar(10) NOT NULL DEFAULT 'icon',
|
||||
`logo` varchar(255) NOT NULL DEFAULT '',
|
||||
`date_add` datetime NOT NULL,
|
||||
`date_upd` datetime NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
|
||||
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_features_lang` (
|
||||
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_amenities_lang` (
|
||||
`id` int(10) unsigned NOT NULL,
|
||||
`id_lang` int(10) unsigned NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
@@ -584,10 +587,10 @@ class HotelReservationSystemDb
|
||||
`'._DB_PREFIX_.'htl_branch_info`,
|
||||
`'._DB_PREFIX_.'htl_branch_info_lang`,
|
||||
`'._DB_PREFIX_.'htl_image`,
|
||||
`'._DB_PREFIX_.'htl_branch_features`,
|
||||
`'._DB_PREFIX_.'htl_room_type_features`,
|
||||
`'._DB_PREFIX_.'htl_features`,
|
||||
`'._DB_PREFIX_.'htl_features_lang`,
|
||||
`'._DB_PREFIX_.'htl_branch_amenities`,
|
||||
`'._DB_PREFIX_.'htl_room_type_amenities`,
|
||||
`'._DB_PREFIX_.'htl_amenities`,
|
||||
`'._DB_PREFIX_.'htl_amenities_lang`,
|
||||
`'._DB_PREFIX_.'htl_cart_booking_data`,
|
||||
`'._DB_PREFIX_.'htl_booking_detail`,
|
||||
`'._DB_PREFIX_.'htl_booking_document`,
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a newer
|
||||
* versions in the future. If you wish to customize this module for your needs
|
||||
* please refer to https://store.webkul.com/customisation-guidelines for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*/
|
||||
|
||||
class HotelRoomTypeBedType extends ObjectModel
|
||||
{
|
||||
public $id_product;
|
||||
public $id_bed_type;
|
||||
|
||||
public static $definition =array(
|
||||
'table' => 'htl_room_type_bed_type',
|
||||
'primary' => 'id_room_type_bed_type',
|
||||
'fields' => array(
|
||||
'id_bed_type' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
),
|
||||
);
|
||||
|
||||
public function getRoomTypeBedTypes($idProduct)
|
||||
{
|
||||
if (!$this->hasLegacyBedTypeTable()) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$sql = 'SELECT * FROM `'._DB_PREFIX_.$this->table.'`
|
||||
WHERE `id_product` ='.(int) $idProduct;
|
||||
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
public function updateRoomTypeBedTypes($idBedTypes, $idProduct)
|
||||
{
|
||||
if (!$this->hasLegacyBedTypeTable()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$res = true;
|
||||
if ($roomTypeBedTypes = $this->getRoomTypeBedTypes($idProduct)) {
|
||||
$roomTypeBedTypes = array_column($roomTypeBedTypes, 'id_room_type_bed_type', 'id_bed_type');
|
||||
}
|
||||
|
||||
if ($idBedTypes) {
|
||||
foreach ($idBedTypes as $idBedType) {
|
||||
// If room type bed type mapping already exits no need to update it.
|
||||
if (isset($roomTypeBedTypes[$idBedType])) {
|
||||
unset($roomTypeBedTypes[$idBedType]);
|
||||
} else {
|
||||
$objHotelRoomTypeBedType = new self();
|
||||
$objHotelRoomTypeBedType->id_product = $idProduct;
|
||||
$objHotelRoomTypeBedType->id_bed_type = $idBedType;
|
||||
$res &=$objHotelRoomTypeBedType->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Removing the non selected bed types.
|
||||
if ($roomTypeBedTypes) {
|
||||
$res &= $this->deleteRoomTypeBedTypesById($roomTypeBedTypes);
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function deleteRoomTypeBedTypesById($idRoomTypeBedTypes)
|
||||
{
|
||||
if (!$this->hasLegacyBedTypeTable()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$res = true;
|
||||
if ($idRoomTypeBedTypes) {
|
||||
foreach ($idRoomTypeBedTypes as $idRoomTypeBedType) {
|
||||
$objHotelRoomTypeBedType = new self($idRoomTypeBedType);
|
||||
$res &= $objHotelRoomTypeBedType->delete();
|
||||
}
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function deleteRoomTypeBedTypes($idBedType = false, $idProduct = false)
|
||||
{
|
||||
if (!$this->hasLegacyBedTypeTable()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return Db::getInstance()->delete(
|
||||
$this->table,
|
||||
' 1 '.($idBedType ? ' AND `id_bed_type`='.(int) $idBedType : '').($idProduct ? ' AND `id_product`='.(int) $idProduct : '')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the deprecated room-type bed mapping table still exists.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function hasLegacyBedTypeTable()
|
||||
{
|
||||
return (bool) Db::getInstance()->getValue(
|
||||
'SHOW TABLES LIKE \'' . pSQL(_DB_PREFIX_.$this->table) . '\''
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -176,7 +176,7 @@ class AdminAddHotelController extends ModuleAdminController
|
||||
}
|
||||
|
||||
$smartyVars['order_restrict_date_info'] = HotelOrderRestrictDate::getDataByHotelId($idHotel);
|
||||
$objHotelFeatures = new HotelFeatures();
|
||||
$objHotelFeatures = new HotelAmenities();
|
||||
$hotelFeatures = $this->object->getFeaturesOfHotelByHotelId($this->object->id);
|
||||
if ($features = $objHotelFeatures->HotelBranchSelectedFeaturesArray($hotelFeatures)) {
|
||||
foreach ($features as $idFeature => $feature) {
|
||||
@@ -802,7 +802,7 @@ class AdminAddHotelController extends ModuleAdminController
|
||||
|
||||
$objHotelOrderRestrictDate->save();
|
||||
|
||||
$objHotelFeatures = new HotelBranchFeatures();
|
||||
$objHotelFeatures = new HotelBranchAmenities();
|
||||
$objHotelFeatures->deleteBranchFeaturesByHotelId($idHotel);
|
||||
if (!$objHotelFeatures->assignFeaturesToHotel($idHotel, $hotelFeatures)) {
|
||||
$this->errors[] = $this->l('Some problem occurred while assigning features to the hotel.');
|
||||
|
||||
@@ -0,0 +1,355 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3.0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a newer
|
||||
* versions in the future. If you wish to customize this module for your needs
|
||||
* please refer to https://store.webkul.com/customisation-guidelines for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3.0-php Open Software License version 3.0
|
||||
*/
|
||||
|
||||
class AdminHotelAmenitiesController extends ModuleAdminController
|
||||
{
|
||||
const IMG_DIR = 'views/img/hotel_amenities/';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->bootstrap = true;
|
||||
$this->table = 'htl_amenities';
|
||||
$this->className = 'HotelAmenities';
|
||||
$this->identifier = 'id';
|
||||
$this->toolbar_title = $this->l('Manage Amenities');
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->display = 'view';
|
||||
}
|
||||
|
||||
public function initToolbar()
|
||||
{
|
||||
parent::initToolbar();
|
||||
|
||||
if ($this->display == 'view') {
|
||||
$this->page_header_toolbar_btn['add_category'] = array(
|
||||
'href' => self::$currentIndex.'&addhtl_amenities&token='.$this->token,
|
||||
'desc' => $this->l('Add new Amenity Category'),
|
||||
'imgclass' => 'new',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function initContent()
|
||||
{
|
||||
if (Tools::isSubmit('addhtl_amenities') || Tools::isSubmit('updatehtl_amenities')
|
||||
|| Tools::isSubmit('addhtl_amenity_item') || Tools::isSubmit('updatehtl_amenity_item')
|
||||
) {
|
||||
$this->display = 'edit';
|
||||
}
|
||||
|
||||
$this->initTabModuleList();
|
||||
$this->initToolbar();
|
||||
$this->initPageHeaderToolbar();
|
||||
|
||||
if ($this->display == 'edit') {
|
||||
$this->content = $this->renderForm();
|
||||
} else {
|
||||
$this->content = $this->renderView();
|
||||
}
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'content' => $this->content,
|
||||
'url_post' => self::$currentIndex.'&token='.$this->token,
|
||||
'show_page_header_toolbar' => $this->show_page_header_toolbar,
|
||||
'page_header_toolbar_title' => $this->page_header_toolbar_title,
|
||||
'page_header_toolbar_btn' => $this->page_header_toolbar_btn,
|
||||
));
|
||||
}
|
||||
|
||||
public function renderView()
|
||||
{
|
||||
$obj = new HotelAmenities();
|
||||
$this->context->smarty->assign(array(
|
||||
'amenities_tree' => $obj->getAllAmenitiesTree(),
|
||||
'img_base_url' => $this->module->getPathUri().self::IMG_DIR,
|
||||
'current_index' => self::$currentIndex,
|
||||
'token' => $this->token,
|
||||
'admin_link' => Context::getContext()->link->getAdminLink('AdminHotelAmenities'),
|
||||
));
|
||||
|
||||
return parent::renderView();
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
$languages = Language::getLanguages(false);
|
||||
$defaultLang = (int)Configuration::get('PS_LANG_DEFAULT');
|
||||
$adminLink = Context::getContext()->link->getAdminLink('AdminHotelAmenities');
|
||||
|
||||
if (Tools::isSubmit('addhtl_amenity_item') || Tools::isSubmit('updatehtl_amenity_item')) {
|
||||
$idAmenity = (int)Tools::getValue('id');
|
||||
$idCategory = (int)Tools::getValue('id_category');
|
||||
$amenity = array();
|
||||
|
||||
if ($idAmenity) {
|
||||
$obj = new HotelAmenities($idAmenity);
|
||||
if (Validate::isLoadedObject($obj)) {
|
||||
$idCategory = (int)$obj->parent_feature_id;
|
||||
$amenity = array(
|
||||
'id' => $obj->id,
|
||||
'parent_feature_id' => $idCategory,
|
||||
'active' => (int)$obj->active,
|
||||
'is_featured' => (int)$obj->is_featured,
|
||||
'logo_type' => $obj->logo_type,
|
||||
'logo' => $obj->logo,
|
||||
'name' => is_array($obj->name) ? $obj->name : array(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$imgPath = $this->module->getLocalPath().self::IMG_DIR.$idAmenity.'.jpg';
|
||||
$imgUrl = ($idAmenity && file_exists($imgPath))
|
||||
? $this->module->getPathUri().self::IMG_DIR.$idAmenity.'.jpg'
|
||||
: false;
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'languages' => $languages,
|
||||
'default_lang_id' => $defaultLang,
|
||||
'amenity' => $amenity,
|
||||
'id_category' => $idCategory,
|
||||
'existing_img' => $imgUrl,
|
||||
'current_index' => self::$currentIndex,
|
||||
'token' => $this->token,
|
||||
'admin_link' => $adminLink,
|
||||
));
|
||||
|
||||
return $this->context->smarty->createTemplate(
|
||||
$this->module->getLocalPath().'views/templates/admin/hotel_amenities/helpers/form/amenity_form.tpl'
|
||||
)->fetch();
|
||||
}
|
||||
|
||||
// category form (add or edit)
|
||||
$idCategory = (int)Tools::getValue('id');
|
||||
$category = array();
|
||||
|
||||
if ($idCategory) {
|
||||
$obj = new HotelAmenities($idCategory);
|
||||
if (Validate::isLoadedObject($obj)) {
|
||||
$category = array(
|
||||
'id' => $obj->id,
|
||||
'position' => $obj->position,
|
||||
'name' => is_array($obj->name) ? $obj->name : array(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'languages' => $languages,
|
||||
'default_lang_id' => $defaultLang,
|
||||
'category' => $category,
|
||||
'current_index' => self::$currentIndex,
|
||||
'token' => $this->token,
|
||||
'admin_link' => $adminLink,
|
||||
));
|
||||
|
||||
return $this->context->smarty->createTemplate(
|
||||
$this->module->getLocalPath().'views/templates/admin/hotel_amenities/helpers/form/category_form.tpl'
|
||||
)->fetch();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('submitHtlCategory')) {
|
||||
$idCategory = (int)Tools::getValue('id');
|
||||
$pos = (int)Tools::getValue('position');
|
||||
$languages = Language::getLanguages(false);
|
||||
$defaultLang = (int)Configuration::get('PS_LANG_DEFAULT');
|
||||
|
||||
if (!$pos || !Validate::isUnsignedInt($pos)) {
|
||||
$this->errors[] = $this->l('Position is invalid.');
|
||||
}
|
||||
|
||||
$nameDefault = trim(Tools::getValue('cat_name_'.$defaultLang));
|
||||
if (!$nameDefault) {
|
||||
$this->errors[] = $this->l('Category name is required in default language.');
|
||||
} elseif (!Validate::isGenericName($nameDefault)) {
|
||||
$this->errors[] = $this->l('Category name is invalid.');
|
||||
}
|
||||
|
||||
if (count($this->errors)) {
|
||||
$this->display = 'edit';
|
||||
return;
|
||||
}
|
||||
|
||||
$obj = $idCategory ? new HotelAmenities($idCategory) : new HotelAmenities();
|
||||
foreach ($languages as $lang) {
|
||||
$val = trim(Tools::getValue('cat_name_'.$lang['id_lang']));
|
||||
$obj->name[$lang['id_lang']] = $val ?: $nameDefault;
|
||||
}
|
||||
$obj->parent_feature_id = 0;
|
||||
$obj->position = $pos;
|
||||
$obj->active = 1;
|
||||
|
||||
if (!$obj->save()) {
|
||||
$this->errors[] = $this->l('Error saving category.');
|
||||
$this->display = 'edit';
|
||||
return;
|
||||
}
|
||||
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf='.($idCategory ? 4 : 3).'&token='.$this->token);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('submitHtlAmenityItem')) {
|
||||
$idAmenity = (int)Tools::getValue('id');
|
||||
$idCategory = (int)Tools::getValue('id_category');
|
||||
$active = (int)Tools::getValue('active');
|
||||
$isFeatured = (int)Tools::getValue('is_featured');
|
||||
$logoType = Tools::getValue('logo_type');
|
||||
$languages = Language::getLanguages(false);
|
||||
$defaultLang = (int)Configuration::get('PS_LANG_DEFAULT');
|
||||
|
||||
if (!$idCategory) {
|
||||
$this->errors[] = $this->l('Category is required.');
|
||||
}
|
||||
|
||||
$nameDefault = trim(Tools::getValue('amenity_name_'.$defaultLang));
|
||||
if (!$nameDefault) {
|
||||
$this->errors[] = $this->l('Amenity name is required in default language.');
|
||||
} elseif (!Validate::isGenericName($nameDefault)) {
|
||||
$this->errors[] = $this->l('Amenity name is invalid.');
|
||||
}
|
||||
|
||||
$logoValue = '';
|
||||
if ($logoType === 'icon') {
|
||||
$logoValue = trim(Tools::getValue('logo_icon'));
|
||||
if (!$logoValue) {
|
||||
$this->errors[] = $this->l('Icon class is required.');
|
||||
} elseif (!Validate::isGenericName(str_replace('-', ' ', $logoValue))) {
|
||||
$this->errors[] = $this->l('Icon name is invalid.');
|
||||
}
|
||||
} else {
|
||||
$hasUpload = isset($_FILES['logo_image']) && !empty($_FILES['logo_image']['tmp_name']);
|
||||
$hasExisting = $idAmenity && file_exists($this->module->getLocalPath().self::IMG_DIR.$idAmenity.'.jpg');
|
||||
if (!$hasUpload && !$hasExisting) {
|
||||
$this->errors[] = $this->l('Please upload an image for this amenity.');
|
||||
}
|
||||
}
|
||||
|
||||
if (count($this->errors)) {
|
||||
$this->display = 'edit';
|
||||
return;
|
||||
}
|
||||
|
||||
$obj = $idAmenity ? new HotelAmenities($idAmenity) : new HotelAmenities();
|
||||
foreach ($languages as $lang) {
|
||||
$val = trim(Tools::getValue('amenity_name_'.$lang['id_lang']));
|
||||
$obj->name[$lang['id_lang']] = $val ?: $nameDefault;
|
||||
}
|
||||
$obj->parent_feature_id = $idCategory;
|
||||
$obj->active = $active;
|
||||
$obj->is_featured = $isFeatured;
|
||||
$obj->logo_type = ($logoType === 'icon') ? 'icon' : 'image';
|
||||
$obj->logo = ($logoType === 'icon') ? $logoValue : $obj->logo;
|
||||
|
||||
if (!$obj->save()) {
|
||||
$this->errors[] = $this->l('Error saving amenity.');
|
||||
$this->display = 'edit';
|
||||
return;
|
||||
}
|
||||
|
||||
if ($logoType === 'icon') {
|
||||
$imgFile = $this->module->getLocalPath().self::IMG_DIR.$obj->id.'.jpg';
|
||||
if (file_exists($imgFile)) {
|
||||
unlink($imgFile);
|
||||
}
|
||||
}
|
||||
|
||||
if ($logoType === 'image' && isset($_FILES['logo_image']) && $_FILES['logo_image']['tmp_name']) {
|
||||
$imgFile = $_FILES['logo_image'];
|
||||
if ($error = ImageManager::validateUpload($imgFile, Tools::getMaxUploadSize())) {
|
||||
$this->errors[] = $error;
|
||||
} else {
|
||||
$imgDir = $this->module->getLocalPath().self::IMG_DIR;
|
||||
if (!is_dir($imgDir)) {
|
||||
mkdir($imgDir, 0755, true);
|
||||
}
|
||||
if (ImageManager::resize($imgFile['tmp_name'], $imgDir.$obj->id.'.jpg')) {
|
||||
$obj->logo = $obj->id.'.jpg';
|
||||
$obj->save();
|
||||
} else {
|
||||
$this->errors[] = $this->l('Error uploading amenity image.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($this->errors)) {
|
||||
$this->display = 'edit';
|
||||
return;
|
||||
}
|
||||
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf='.($idAmenity ? 4 : 3).'&token='.$this->token);
|
||||
return;
|
||||
}
|
||||
|
||||
if (empty($this->errors)) {
|
||||
parent::postProcess();
|
||||
}
|
||||
}
|
||||
|
||||
public function ajaxProcessDeleteCategory()
|
||||
{
|
||||
$response = array('status' => false);
|
||||
|
||||
if ($this->tabAccess['delete']) {
|
||||
$obj = new HotelAmenities();
|
||||
if ($obj->deleteHotelFeatures((int)Tools::getValue('id_category'))) {
|
||||
$response['status'] = true;
|
||||
} else {
|
||||
$response['msg'] = $this->l('Error deleting category.');
|
||||
}
|
||||
} else {
|
||||
$response['msg'] = $this->l('You do not have permission to delete.');
|
||||
}
|
||||
|
||||
$this->ajaxDie(json_encode($response));
|
||||
}
|
||||
|
||||
public function ajaxProcessDeleteAmenityItem()
|
||||
{
|
||||
$response = array('status' => false);
|
||||
|
||||
if ($this->tabAccess['delete']) {
|
||||
$obj = new HotelAmenities((int)Tools::getValue('id_amenity'));
|
||||
if (Validate::isLoadedObject($obj) && $obj->delete()) {
|
||||
$response['status'] = true;
|
||||
} else {
|
||||
$response['msg'] = $this->l('Error deleting amenity.');
|
||||
}
|
||||
} else {
|
||||
$response['msg'] = $this->l('You do not have permission to delete.');
|
||||
}
|
||||
|
||||
$this->ajaxDie(json_encode($response));
|
||||
}
|
||||
|
||||
public function setMedia()
|
||||
{
|
||||
parent::setMedia();
|
||||
$this->addJs(_MODULE_DIR_.'hotelreservationsystem/views/js/HotelReservationAdmin.js');
|
||||
$this->addCSS(_MODULE_DIR_.'hotelreservationsystem/views/css/HotelReservationAdmin.css');
|
||||
}
|
||||
}
|
||||
@@ -1,235 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a newer
|
||||
* versions in the future. If you wish to customize this module for your needs
|
||||
* please refer to https://store.webkul.com/customisation-guidelines for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*/
|
||||
|
||||
class AdminHotelBedTypesController extends ModuleAdminController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->bootstrap = true;
|
||||
$this->table = 'htl_bed_type';
|
||||
$this->className = 'HotelBedType';
|
||||
$this->identifier = 'id_bed_type';
|
||||
$this->context = Context::getContext();
|
||||
$this->lang = true;
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->_new_list_header_design = true;
|
||||
// field options for global fields
|
||||
$this->fields_options = array(
|
||||
'global' => array(
|
||||
'title' => $this->l('Dimension Unit Setting'),
|
||||
'icon' => 'icon-cogs',
|
||||
'fields' => array(
|
||||
'WK_DIMENSION_UNIT' => array(
|
||||
'title' => $this->l('Dimension Unit'),
|
||||
'type' => 'textLang',
|
||||
'lang' => true,
|
||||
'required' => true,
|
||||
'validation' => 'isGenericName',
|
||||
'hint' => $this->l('Enter a dimension unit for the bed types.')
|
||||
),
|
||||
),
|
||||
'submit' => array('title' => $this->l('Save'))
|
||||
),
|
||||
);
|
||||
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('delete');
|
||||
$this->bulk_actions = array(
|
||||
'delete' => array(
|
||||
'text' => $this->l('Delete selected'),
|
||||
'confirm' => $this->l('Delete selected items?'),
|
||||
'icon' => 'icon-trash'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function initContent()
|
||||
{
|
||||
parent::initContent();
|
||||
// to customize the view as per our requirements
|
||||
if ($this->display != 'add' && $this->display != 'edit') {
|
||||
$this->content = $this->renderOptions();
|
||||
$this->content .= $this->renderList();
|
||||
$this->context->smarty->assign('content', $this->content);
|
||||
}
|
||||
}
|
||||
|
||||
public function initPageHeaderToolbar()
|
||||
{
|
||||
if (!$this->display || $this->display == 'list') {
|
||||
$this->page_header_toolbar_btn['new_product'] = array(
|
||||
'href' => self::$currentIndex.'&add'.$this->table.'&token='.$this->token,
|
||||
'desc' => $this->l('Add new', null, null, false),
|
||||
'icon' => 'process-icon-new'
|
||||
);
|
||||
}
|
||||
|
||||
parent::initPageHeaderToolbar();
|
||||
}
|
||||
|
||||
public function initToolbar()
|
||||
{
|
||||
$this->toolbar_btn = array();
|
||||
}
|
||||
|
||||
public function renderList()
|
||||
{
|
||||
// added here instead of the constructor since the dimension unit will be update afer post processs.
|
||||
$this->fields_list = array(
|
||||
'id_bed_type' => array(
|
||||
'title' => $this->l('ID'),
|
||||
'align' => 'center',
|
||||
),
|
||||
'name' => array(
|
||||
'title' => $this->l('Name'),
|
||||
'align' => 'center',
|
||||
),
|
||||
'width' => array(
|
||||
'title' => $this->l('Width'),
|
||||
'align' => 'center',
|
||||
'suffix' => Configuration::get('WK_DIMENSION_UNIT', $this->context->language->id)
|
||||
),
|
||||
'length' => array(
|
||||
'title' => $this->l('Lenght'),
|
||||
'align' => 'center',
|
||||
'suffix' => Configuration::get('WK_DIMENSION_UNIT', $this->context->language->id)
|
||||
),
|
||||
);
|
||||
return parent::renderList();
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
if (!$this->loadObject(true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fields_form = array(
|
||||
'legend' => array(
|
||||
'title' => $this->l('Bed Type'),
|
||||
'icon' => 'icon-bed'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Bed Type Name'),
|
||||
'name' => 'name',
|
||||
'required' => true,
|
||||
'col' => 4,
|
||||
'lang' => true,
|
||||
'hint' => $this->l('Enter the name of Bed type.')
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Width'),
|
||||
'name' => 'width',
|
||||
'required' => true,
|
||||
'col' => 4,
|
||||
'hint' => $this->l('Enter the width of the Bed type in ').Configuration::get('WK_DIMENSION_UNIT', $this->context->language->id),
|
||||
'suffix' => Configuration::get('WK_DIMENSION_UNIT', $this->context->language->id),
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Length'),
|
||||
'name' => 'length',
|
||||
'col' => 4,
|
||||
'required' => true,
|
||||
'hint' => $this->l('Enter the length of the Bed type in ').Configuration::get('WK_DIMENSION_UNIT', $this->context->language->id),
|
||||
'suffix' => Configuration::get('WK_DIMENSION_UNIT', $this->context->language->id),
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save')
|
||||
),
|
||||
'buttons' => array(
|
||||
'save-and-stay' => array(
|
||||
'title' => $this->l('Save and stay'),
|
||||
'name' => 'submitAdd'.$this->table.'AndStay',
|
||||
'type' => 'submit',
|
||||
'class' => 'btn btn-default pull-right',
|
||||
'icon' => 'process-icon-save',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
return parent::renderForm();
|
||||
}
|
||||
|
||||
public function beforeUpdateOptions()
|
||||
{
|
||||
$defaultLangId = Configuration::get('PS_LANG_DEFAULT');
|
||||
$objDefaultLanguage = Language::getLanguage((int) $defaultLangId);
|
||||
$languages = Language::getLanguages(false);
|
||||
if (!trim(Tools::getValue('WK_DIMENSION_UNIT_'.$defaultLangId))
|
||||
&& Tools::getValue('WK_DIMENSION_UNIT_'.$defaultLangId)
|
||||
) {
|
||||
$this->errors[] = $this->l('Default dimension unit is required at least in ').$objDefaultLanguage['name'];
|
||||
} else {
|
||||
foreach ($languages as $lang) {
|
||||
if (Tools::getValue('WK_DIMENSION_UNIT_'.$lang['id_lang'])
|
||||
&& (!trim(Tools::getValue('WK_DIMENSION_UNIT_'.$lang['id_lang']))
|
||||
|| !Validate::isGenericName(Tools::getValue('WK_DIMENSION_UNIT_'.$lang['id_lang'])))
|
||||
) {
|
||||
$this->errors[] = $this->l('Invalid dimension unit in ').$lang['name'];
|
||||
}
|
||||
|
||||
if (!trim(Tools::getValue('WK_DIMENSION_UNIT_'.$lang['id_lang']))) {
|
||||
$_POST['WK_DIMENSION_UNIT_'.$lang['id_lang']] = Tools::getValue('WK_DIMENSION_UNIT_'.$defaultLangId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function processSave()
|
||||
{
|
||||
if (!$this->loadObject(true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$defaultLangId = Configuration::get('PS_LANG_DEFAULT');
|
||||
$objDefaultLanguage = Language::getLanguage((int) $defaultLangId);
|
||||
$languages = Language::getLanguages(false);
|
||||
if (!trim(Tools::getValue('name_'.$defaultLangId))) {
|
||||
$this->errors[] = $this->l('Bed type name is required at least in ').$objDefaultLanguage['name'];
|
||||
} else {
|
||||
foreach ($languages as $lang) {
|
||||
if (trim(Tools::getValue('name_'.$lang['id_lang'])) && !Validate::isGenericName(Tools::getValue('name_'.$lang['id_lang']))) {
|
||||
$this->errors[] = $this->l('Invalid bed type name in ').$lang['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(float) Tools::getValue('width')) {
|
||||
$this->errors[] = $this->l('The width field is required');
|
||||
}
|
||||
|
||||
if (!(float) Tools::getValue('length')) {
|
||||
$this->errors[] = $this->l('The length field is required');
|
||||
}
|
||||
|
||||
return parent::processSave();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,321 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a newer
|
||||
* versions in the future. If you wish to customize this module for your needs
|
||||
* please refer to https://store.webkul.com/customisation-guidelines for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*/
|
||||
|
||||
class AdminHotelFeaturesController extends ModuleAdminController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->bootstrap = true;
|
||||
$this->table = 'htl_features';
|
||||
$this->className = 'HotelFeatures';
|
||||
$this->identifier = 'id';
|
||||
$this->toolbar_title = $this->l('Manage Hotel Features');
|
||||
|
||||
parent::__construct();
|
||||
$this->display = 'view';
|
||||
}
|
||||
|
||||
public function initToolbar()
|
||||
{
|
||||
parent::initToolbar();
|
||||
|
||||
$this->page_header_toolbar_btn['addfeatures'] = array(
|
||||
'href' => self::$currentIndex.'&add'.$this->table.'&token='.$this->token,
|
||||
'desc' => $this->l('Add new Features'),
|
||||
'imgclass' => 'new'
|
||||
);
|
||||
}
|
||||
|
||||
public function renderView()
|
||||
{
|
||||
$objHotelFeatures = new HotelFeatures();
|
||||
$featuresList = $objHotelFeatures->HotelAllCommonFeaturesArray();
|
||||
$this->context->smarty->assign('features_list', $featuresList);
|
||||
return parent::renderView();
|
||||
}
|
||||
|
||||
public function renderForm()
|
||||
{
|
||||
if (!$this->loadObject(true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$smartyVars = array();
|
||||
//lang vars
|
||||
$languages = Language::getLanguages(false);
|
||||
$currentLangId = $this->default_form_language ? $this->default_form_language : Configuration::get('PS_LANG_DEFAULT');
|
||||
$currentLang = Language::getLanguage((int) $currentLangId);
|
||||
$smartyVars['languages'] = $languages;
|
||||
$smartyVars['currentLang'] = $currentLang;
|
||||
$smartyVars['ps_img_dir'] = _PS_IMG_.'l/';
|
||||
if ($id = $this->object->id) {
|
||||
$smartyVars['edit'] = 1;
|
||||
if (Validate::isLoadedObject($objFeatures = new HotelFeatures($id))) {
|
||||
$featureInfo = (array) $objFeatures;
|
||||
if ($childFeatures = $objFeatures->getChildFeaturesByParentFeatureId($id)) {
|
||||
$featureInfo['child_features'] = array();
|
||||
foreach ($childFeatures as $value) {
|
||||
$objChildFeatures = new HotelFeatures($value['id']);
|
||||
$featureInfo['child_features'][] = (array) $objChildFeatures;
|
||||
}
|
||||
}
|
||||
$smartyVars['featureInfo'] = $featureInfo;
|
||||
}
|
||||
}
|
||||
$this->context->smarty->assign($smartyVars);
|
||||
Media::addJsDef(
|
||||
array(
|
||||
'currentLang' => $currentLang,
|
||||
'languages' => $languages,
|
||||
'img_dir_l' => _PS_IMG_.'l/',
|
||||
)
|
||||
);
|
||||
$this->fields_form = array(
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save')
|
||||
)
|
||||
);
|
||||
return parent::renderForm();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (!$this->loadObject(true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('submitHtlFeatures') || Tools::isSubmit('submitHtlFeaturesAndStay')) {
|
||||
$conf = 3;
|
||||
if ($parentFeatureId = Tools::getValue('id')) {
|
||||
$conf = 4;
|
||||
}
|
||||
|
||||
$pos = Tools::getValue('position');
|
||||
|
||||
$defaultLangId = Configuration::get('PS_LANG_DEFAULT');
|
||||
$objDefaultLanguage = Language::getLanguage((int) $defaultLangId);
|
||||
$languages = Language::getLanguages(false);
|
||||
|
||||
if (empty($pos) || !Validate::isUnsignedInt($pos)) {
|
||||
$this->errors[] = $this->l('Position is Invalid.');
|
||||
}
|
||||
|
||||
if (!trim(Tools::getValue('parent_ftr_name_'.$defaultLangId))) {
|
||||
$this->errors[] = $this->l('Parent feature name is required at least in ').
|
||||
$objDefaultLanguage['name'];
|
||||
} elseif (!Validate::isGenericName(Tools::getValue('parent_ftr_name_'.$defaultLangId))) {
|
||||
$this->errors[] = $this->l('Parent feature name is invalid.');
|
||||
} else {
|
||||
foreach ($languages as $lang) {
|
||||
// validate non required fields
|
||||
if (trim(Tools::getValue('parent_ftr_name_'.$lang['id_lang']))) {
|
||||
if (!Validate::isGenericName(Tools::getValue('parent_ftr_name_'.$lang['id_lang']))) {
|
||||
$this->errors[] = $this->l('Invalid parent feature name in ').$lang['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($childFeaturesDefLang = Tools::getValue('child_features_'.$defaultLangId)) {
|
||||
foreach ($childFeaturesDefLang as $kChild => $childftr) {
|
||||
if (!trim($childftr)) {
|
||||
$this->errors[] = $this->l('Child features name is required at least in ').
|
||||
$objDefaultLanguage['name'];
|
||||
} elseif (!Validate::isGenericName($childftr)) {
|
||||
$this->errors[] = $this->l('Child features name is invalid : ').$childftr;
|
||||
} else {
|
||||
foreach ($languages as $lang) {
|
||||
if ($childFtrLang = Tools::getValue('child_features_'.$lang['id_lang'])) {
|
||||
if (!Validate::isGenericName($childFtrLang[$kChild])) {
|
||||
$this->errors[] = $this->l('Invalid child feature name in ').$lang['name'].
|
||||
' : '.$childFtrLang[$kChild];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Please add atleast one Child features.');
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
if (isset($parentFeatureId) && $parentFeatureId) {
|
||||
$objHotelFeatures = new HotelFeatures($parentFeatureId);
|
||||
$childFeatureIds = Tools::getValue('child_feature_id');
|
||||
foreach ($languages as $lang) {
|
||||
if (!trim(Tools::getValue('parent_ftr_name_'.$lang['id_lang']))) {
|
||||
$objHotelFeatures->name[$lang['id_lang']] = Tools::getValue(
|
||||
'parent_ftr_name_'.$defaultLangId
|
||||
);
|
||||
} else {
|
||||
$objHotelFeatures->name[$lang['id_lang']] = Tools::getValue(
|
||||
'parent_ftr_name_'.$lang['id_lang']
|
||||
);
|
||||
}
|
||||
}
|
||||
$objHotelFeatures->active = 1;
|
||||
$objHotelFeatures->position = $pos;
|
||||
$objHotelFeatures->parent_feature_id = 0;
|
||||
$objHotelFeatures->save();
|
||||
|
||||
if ($childFeaturesDefLang) {
|
||||
// get previous child features of the parent feature
|
||||
if ($childFeaturesInfo = $objHotelFeatures->getChildFeaturesByParentFeatureId(
|
||||
$parentFeatureId
|
||||
)) {
|
||||
$prevChildIds = array();
|
||||
foreach ($childFeaturesInfo as $row) {
|
||||
$prevChildIds[] = $row['id'];
|
||||
}
|
||||
}
|
||||
$usedFeatures = array();
|
||||
foreach ($childFeaturesDefLang as $key => $childftr) {
|
||||
$objHotelFeatures = new HotelFeatures();
|
||||
// We will only create new child features other wise edit the previous child feature
|
||||
if ($prevChildIds
|
||||
&& isset($childFeatureIds[$key])
|
||||
&& in_array($childFeatureIds[$key], $prevChildIds)
|
||||
) {
|
||||
$objHotelFeatures = new HotelFeatures($childFeatureIds[$key]);
|
||||
// enter child feature id in the used child feature
|
||||
$usedFeatures[] = $childFeatureIds[$key];
|
||||
}
|
||||
foreach ($languages as $lang) {
|
||||
if (!trim(Tools::getValue('child_features_'.$lang['id_lang'])[$key])) {
|
||||
$objHotelFeatures->name[$lang['id_lang']] = $childftr;
|
||||
} else {
|
||||
$objHotelFeatures->name[$lang['id_lang']] = Tools::getValue(
|
||||
'child_features_'.$lang['id_lang']
|
||||
)[$key];
|
||||
}
|
||||
}
|
||||
$objHotelFeatures->active = 1;
|
||||
$objHotelFeatures->parent_feature_id = $parentFeatureId;
|
||||
$objHotelFeatures->save();
|
||||
}
|
||||
// delete the child features which are not used now
|
||||
$notUsedChilds = array_diff($prevChildIds, $usedFeatures);
|
||||
if ($notUsedChilds = array_diff($prevChildIds, $usedFeatures)) {
|
||||
foreach ($notUsedChilds as $value) {
|
||||
if ($value) {
|
||||
$objHotelFeatures = new HotelFeatures($value);
|
||||
$objHotelFeatures->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Tools::isSubmit('submitHtlFeaturesAndStay')) {
|
||||
Tools::redirectAdmin(
|
||||
self::$currentIndex.'&id='.(int) $parentFeatureId.'&update'.$this->table.
|
||||
'&conf='.$conf.'&token='.$this->token
|
||||
);
|
||||
} else {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf='.$conf.'&token='.$this->token);
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Some error has been occurred while saving features.');
|
||||
}
|
||||
} else {
|
||||
$objHotelFeatures = new HotelFeatures();
|
||||
foreach ($languages as $lang) {
|
||||
if (!trim(Tools::getValue('parent_ftr_name_'.$lang['id_lang']))) {
|
||||
$objHotelFeatures->name[$lang['id_lang']] = Tools::getValue(
|
||||
'parent_ftr_name_'.$defaultLangId
|
||||
);
|
||||
} else {
|
||||
$objHotelFeatures->name[$lang['id_lang']] = Tools::getValue(
|
||||
'parent_ftr_name_'.$lang['id_lang']
|
||||
);
|
||||
}
|
||||
}
|
||||
$objHotelFeatures->active = 1;
|
||||
$objHotelFeatures->position = $pos;
|
||||
$objHotelFeatures->parent_feature_id = 0;
|
||||
$objHotelFeatures->save();
|
||||
if ($parentFeatureId = $objHotelFeatures->id) {
|
||||
if ($childFeaturesDefLang) {
|
||||
foreach ($childFeaturesDefLang as $key => $childftr) {
|
||||
$objHotelFeatures = new HotelFeatures();
|
||||
foreach ($languages as $lang) {
|
||||
if (!trim(Tools::getValue('child_features_'.$lang['id_lang'])[$key])) {
|
||||
$objHotelFeatures->name[$lang['id_lang']] = $childftr;
|
||||
} else {
|
||||
$objHotelFeatures->name[$lang['id_lang']] = Tools::getValue(
|
||||
'child_features_'.$lang['id_lang']
|
||||
)[$key];
|
||||
}
|
||||
}
|
||||
$objHotelFeatures->active = 1;
|
||||
$objHotelFeatures->parent_feature_id = $parentFeatureId;
|
||||
$objHotelFeatures->save();
|
||||
}
|
||||
if (Tools::isSubmit('submitHtlFeaturesAndStay')) {
|
||||
Tools::redirectAdmin(
|
||||
self::$currentIndex.'&id='.(int) $parentFeatureId.'&update'.$this->table.
|
||||
'&conf='.$conf.'&token='.$this->token
|
||||
);
|
||||
} else {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf='.$conf.'&token='.$this->token);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Some error has been occurred while saving features.');
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($parentFeatureId) {
|
||||
$this->display = 'edit';
|
||||
} else {
|
||||
$this->display = 'add';
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->errors) || $this->ajax) {
|
||||
parent::postProcess();
|
||||
}
|
||||
}
|
||||
|
||||
public function ajaxProcessDeleteFeature()
|
||||
{
|
||||
$response = array('status' => false);
|
||||
if ($this->tabAccess['delete']) {
|
||||
$idFeature = Tools::getValue('feature_id');
|
||||
$objHotelFeatures = new HotelFeatures();
|
||||
if ($objHotelFeatures->deleteHotelFeatures($idFeature)) {
|
||||
$response['status'] = true;
|
||||
} else {
|
||||
$response['msg'] = $this->l('Some error occurred while deleting feature. Please try again.');
|
||||
}
|
||||
} else {
|
||||
$response['msg'] = $this->l('You do not have the permission to delete this.');
|
||||
}
|
||||
|
||||
$this->ajaxDie(json_encode($response));
|
||||
}
|
||||
|
||||
public function setMedia()
|
||||
{
|
||||
parent::setMedia();
|
||||
|
||||
$this->addJs(_MODULE_DIR_.'hotelreservationsystem/views/js/HotelReservationAdmin.js');
|
||||
$this->addCSS(_MODULE_DIR_.'hotelreservationsystem/views/css/HotelReservationAdmin.css');
|
||||
}
|
||||
}
|
||||
@@ -26,8 +26,8 @@ require_once 'classes/HotelRoomType.php';
|
||||
require_once 'classes/HotelRoomInformation.php';
|
||||
require_once 'classes/HotelBranchInformation.php';
|
||||
require_once 'classes/HotelImage.php';
|
||||
require_once 'classes/HotelFeatures.php';
|
||||
require_once 'classes/HotelBranchFeatures.php';
|
||||
require_once 'classes/HotelAmenities.php';
|
||||
require_once 'classes/HotelBranchAmenities.php';
|
||||
require_once 'classes/HotelBookingDetail.php';
|
||||
require_once 'classes/HotelCartBookingData.php';
|
||||
require_once 'classes/HotelAdvancedPayment.php';
|
||||
@@ -47,8 +47,6 @@ require_once 'classes/HotelRoomTypeRestrictionDateRange.php';
|
||||
|
||||
require_once 'classes/HotelRoomDisableDates.php';
|
||||
require_once 'classes/HotelBranchRefundRules.php';
|
||||
require_once 'classes/HotelBedType.php';
|
||||
require_once 'classes/HotelRoomTypeBedType.php';
|
||||
|
||||
// linked products
|
||||
require_once 'classes/RoomTypeServiceProduct.php';
|
||||
|
||||
@@ -48,7 +48,7 @@ class HotelReservationSystem extends Module
|
||||
$resources = array(
|
||||
'hotels' => array('description' => 'Hotel Branch Information','class' => 'HotelBranchInformation'),
|
||||
'hotel_room_types' => array('description' => 'Hotel room types','class' => 'HotelRoomType'),
|
||||
'hotel_features' => array('description' => 'The hotel features','class' => 'HotelFeatures'),
|
||||
'hotel_amenities' => array('description' => 'The hotel amenities', 'class' => 'HotelAmenities'),
|
||||
'hotel_refund_rules' => array('description' => 'The hotel refund rules','class' => 'HotelOrderRefundRules'),
|
||||
'hotel_rooms' => array('description' => 'The hotel rooms','class' => 'HotelRoomInformation'),
|
||||
'feature_prices' => array('description' => 'Feature prices', 'class' => 'HotelRoomTypeFeaturePricing'),
|
||||
@@ -507,7 +507,7 @@ class HotelReservationSystem extends Module
|
||||
$langTables = array(
|
||||
'htl_room_type_feature_pricing',
|
||||
'htl_branch_info',
|
||||
'htl_features',
|
||||
'htl_amenities',
|
||||
'htl_room_type_global_demand',
|
||||
'htl_room_type_global_demand_advance_option',
|
||||
'htl_order_refund_rules',
|
||||
@@ -553,7 +553,7 @@ class HotelReservationSystem extends Module
|
||||
$this->installTab('AdminHotelReservationSystemManagement', 'Hotel Reservation System');
|
||||
$this->installTab('AdminAddHotel', 'Manage Hotel', 'AdminHotelReservationSystemManagement');
|
||||
$this->installTab('AdminHotelRoomsBooking', 'Book Now', 'AdminHotelReservationSystemManagement');
|
||||
$this->installTab('AdminHotelFeatures', 'Manage Amenities', 'AdminHotelReservationSystemManagement');
|
||||
$this->installTab('AdminHotelAmenities', 'Manage Amenities', 'AdminHotelReservationSystemManagement');
|
||||
$this->installTab('AdminOrderRefundRules', 'Manage Order Refund Rules', 'AdminHotelReservationSystemManagement');
|
||||
$this->installTab('AdminOrderRefundRequests', 'Manage Order Refund Requests', 'AdminHotelReservationSystemManagement');
|
||||
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
{*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a newer
|
||||
* versions in the future. If you wish to customize this module for your needs
|
||||
* please refer to https://store.webkul.com/customisation-guidelines for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*}
|
||||
|
||||
<form method="post" action="{$current|escape:'htmlall':'UTF-8'}&{if !empty($submit_action)}{$submit_action|escape:'htmlall':'UTF-8'}{/if}&token={$token|escape:'htmlall':'UTF-8'}" class="defaultForm form-horizontal {$name_controller|escape:'htmlall':'UTF-8'}" enctype="multipart/form-data">
|
||||
{if isset($edit)}
|
||||
<input name="edit_hotel_id" type="hidden" value="{$hotel_id}">
|
||||
{/if}
|
||||
<div class="panel">
|
||||
<div class="panel-heading">
|
||||
<i class="icon-user"></i> {l s='Assign Features' mod='hotelreservationsystem'}
|
||||
</div>
|
||||
{if isset($hotels) && $hotels}
|
||||
<div class="form-wrapper">
|
||||
<div class="form-group">
|
||||
{if isset($edit)}
|
||||
<label class="control-label col-sm-5">
|
||||
<span>{l s='Hotel Name' mod='hotelreservationsystem'} : </span>
|
||||
</label>
|
||||
<select class="fixed-width-xl" name="id_hotel">
|
||||
{foreach $hotels as $hotel}
|
||||
{if $hotel_id == $hotel.id}
|
||||
<option readonly="true" selected="true" value="{$hotel.id|escape:'html':'UTF-8'}" >{$hotel.hotel_name|escape:'html':'UTF-8'}</option>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</select>
|
||||
{else}
|
||||
<label class="control-label col-sm-5">
|
||||
<span>{l s='Select Hotel' mod='hotelreservationsystem'} : </span>
|
||||
</label>
|
||||
<div class="col-sm-4">
|
||||
<select class="fixed-width-xl" name="id_hotel">
|
||||
<option value='0'>{l s='Select Hotel' mod='hotelreservationsystem'}</option>>
|
||||
{foreach $hotels as $hotel}
|
||||
<option value="{$hotel.id|escape:'html':'UTF-8'}" >{$hotel.hotel_name|escape:'html':'UTF-8'}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{if isset($features_list) && $features_list}
|
||||
{assign var=i value=1}
|
||||
{foreach from=$features_list item=value}
|
||||
<div class="accordion">
|
||||
<div class="accordion-section">
|
||||
<a class="accordion-section-title" href="#accordion{$i}"><span class="icon-plus"></span>  {l s={$value.name} mod='hotelreservationsyatem'}</a>
|
||||
<div id="accordion{$i}" class="accordion-section-content">
|
||||
<table id="" class="table" style="max-width:100%">
|
||||
<tbody>
|
||||
{if isset($value.children) && $value.children}
|
||||
{foreach from=$value.children item=val}
|
||||
<tr>
|
||||
<td class="border_top border_bottom border_bold">
|
||||
<span class=""> {l s={$val.name} mod='hotelreservationsyatem'} </span>
|
||||
</td>
|
||||
<td style="">
|
||||
<input name="hotel_fac[]" type="checkbox" value="{$val.id}" class="form-control" {if isset($edit) && $val.selected}checked='true'{/if}>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{assign var=i value=$i+1}
|
||||
{/foreach}
|
||||
{/if}
|
||||
<div class="panel-footer">
|
||||
<a href="{$link->getAdminLink('AdminHotelFeatures')|escape:'html':'UTF-8'}" class="btn btn-default"><i class="process-icon-cancel"></i> {l s='Cancel' mod='hotelreservationsystem'}</a>
|
||||
<button type="submit" name="submitAddhtl_features" class="btn btn-default pull-right"><i class="process-icon-save"></i> {l s='Assign' mod='hotelreservationsystem'}</button>
|
||||
<!-- <button type="submit" name="submitAdd{$table|escape:'html':'UTF-8'}AndStay" class="btn btn-default pull-right">
|
||||
<i class="process-icon-save"></i> {l s='Assign and stay' mod='hotelreservationsystem'}
|
||||
</button> -->
|
||||
</div>
|
||||
{else}
|
||||
<div class="alert alert-warning">
|
||||
{l s='No hotel found to assign features.' mod='hotelreservationsystem'}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</form>
|
||||
@@ -0,0 +1,218 @@
|
||||
{**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a newer
|
||||
* versions in the future. If you wish to customize this module for your needs
|
||||
* please refer to https://store.webkul.com/customisation-guidelines for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*}
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel-heading">
|
||||
{if isset($amenity.id) && $amenity.id}
|
||||
<i class="icon-edit"></i> {l s='Edit Amenity' mod='hotelreservationsystem'}
|
||||
{else}
|
||||
<i class="icon-plus"></i> {l s='Add New Amenity' mod='hotelreservationsystem'}
|
||||
{/if}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form id="htl_amenity_form" class="defaultForm form-horizontal"
|
||||
action="{$current_index|escape:'htmlall':'UTF-8'}&token={$token|escape:'htmlall':'UTF-8'}"
|
||||
method="post" enctype="multipart/form-data">
|
||||
|
||||
<input type="hidden" name="id_category" value="{$id_category|intval}" />
|
||||
{if isset($amenity.id) && $amenity.id}
|
||||
<input type="hidden" name="id" value="{$amenity.id|intval}" />
|
||||
<input type="hidden" name="updatehtl_amenity_item" value="1" />
|
||||
{else}
|
||||
<input type="hidden" name="addhtl_amenity_item" value="1" />
|
||||
{/if}
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-lg-3 control-label required">
|
||||
{l s='Amenity Name' mod='hotelreservationsystem'}
|
||||
</label>
|
||||
<div class="col-lg-9">
|
||||
{if $languages|count > 1}
|
||||
<div class="form-group">
|
||||
{/if}
|
||||
{foreach from=$languages item=language}
|
||||
{if $languages|count > 1}
|
||||
<div class="translatable-field lang-{$language.id_lang}" {if $language.id_lang != $default_lang_id}style="display:none;"{/if}>
|
||||
<div class="col-lg-9">
|
||||
{/if}
|
||||
<input type="text"
|
||||
id="amenity_name_{$language.id_lang}"
|
||||
name="amenity_name_{$language.id_lang}"
|
||||
value="{if isset($amenity.name[$language.id_lang])}{$amenity.name[$language.id_lang]|escape:'htmlall':'UTF-8'}{/if}"
|
||||
class="form-control"
|
||||
maxlength="128" />
|
||||
{if $languages|count > 1}
|
||||
</div>
|
||||
<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=lang}
|
||||
<li><a href="javascript:hideOtherLanguage({$lang.id_lang});" tabindex="-1">{$lang.name}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{if $languages|count > 1}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-lg-3 control-label">
|
||||
{l s='Enabled' mod='hotelreservationsystem'}
|
||||
</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 !isset($amenity.active) || $amenity.active}checked="checked"{/if} />
|
||||
<label for="active_on">{l s='Yes'}</label>
|
||||
<input type="radio" name="active" id="active_off" value="0"
|
||||
{if isset($amenity.active) && !$amenity.active}checked="checked"{/if} />
|
||||
<label for="active_off">{l s='No'}</label>
|
||||
<a class="slide-button btn"></a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-lg-3 control-label">
|
||||
{l s='Feature this Amenity' mod='hotelreservationsystem'}
|
||||
</label>
|
||||
<div class="col-lg-9">
|
||||
<span class="switch prestashop-switch fixed-width-lg">
|
||||
<input type="radio" name="is_featured" id="is_featured_on" value="1"
|
||||
{if isset($amenity.is_featured) && $amenity.is_featured}checked="checked"{/if} />
|
||||
<label for="is_featured_on">{l s='Yes'}</label>
|
||||
<input type="radio" name="is_featured" id="is_featured_off" value="0"
|
||||
{if !isset($amenity.is_featured) || !$amenity.is_featured}checked="checked"{/if} />
|
||||
<label for="is_featured_off">{l s='No'}</label>
|
||||
<a class="slide-button btn"></a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-lg-3 control-label required">{l s='Logo Type' mod='hotelreservationsystem'}</label>
|
||||
<div class="col-lg-4">
|
||||
<select name="logo_type" id="htl_logo_type_select" class="form-control">
|
||||
<option value="image"
|
||||
{if !isset($amenity.logo_type) || $amenity.logo_type != 'icon'}selected="selected"{/if}>
|
||||
{l s='Image (Upload)' mod='hotelreservationsystem'}
|
||||
</option>
|
||||
<option value="icon"
|
||||
{if isset($amenity.logo_type) && $amenity.logo_type == 'icon'}selected="selected"{/if}>
|
||||
{l s='Icon (Font Awesome)' mod='hotelreservationsystem'}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="htl_logo_image_row"
|
||||
{if isset($amenity.logo_type) && $amenity.logo_type == 'icon'}style="display:none;"{/if}>
|
||||
<label class="col-lg-3 control-label">{l s='Logo Image' mod='hotelreservationsystem'}</label>
|
||||
<div class="col-lg-5">
|
||||
{if $existing_img}
|
||||
<div style="margin-bottom:8px;">
|
||||
<img src="{$existing_img|escape:'htmlall':'UTF-8'}" alt=""
|
||||
style="max-width:80px;max-height:80px;border:1px solid #ddd;padding:4px;" />
|
||||
</div>
|
||||
{/if}
|
||||
<input id="logo_image" type="file" name="logo_image" accept="image/*" class="hide" />
|
||||
<div class="dummyfile input-group">
|
||||
<span class="input-group-addon"><i class="icon-file"></i></span>
|
||||
<input id="logo_image-name" type="text" name="filename" class="form-control" readonly />
|
||||
<span class="input-group-btn">
|
||||
<button id="logo_image-selectbutton" type="button" class="btn btn-default">
|
||||
<i class="icon-folder-open"></i> {l s='Add file...' mod='hotelreservationsystem'}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
<p class="help-block">
|
||||
{l s='Please upload a square image. Accepted formats: JPG, PNG, GIF.' mod='hotelreservationsystem'}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="htl_logo_icon_row"
|
||||
{if !isset($amenity.logo_type) || $amenity.logo_type != 'icon'}style="display:none;"{/if}>
|
||||
<label class="col-lg-3 control-label">{l s='Icon Class' mod='hotelreservationsystem'}</label>
|
||||
<div class="col-lg-5">
|
||||
<input type="text" name="logo_icon" class="form-control"
|
||||
value="{if isset($amenity.logo) && isset($amenity.logo_type) && $amenity.logo_type == 'icon'}{$amenity.logo|escape:'htmlall':'UTF-8'}{/if}"
|
||||
placeholder="icon-cogs" />
|
||||
<p class="help-block">
|
||||
{l s='Refer to the following link for available icons:' mod='hotelreservationsystem'}
|
||||
<a href="https://fontawesome.com/v4/cheatsheet" target="_blank">https://fontawesome.com/v4/cheatsheet</a><br />
|
||||
{l s='Note: Replace fa- with icon- in icon name. Example: fa-wifi becomes icon-wifi.' mod='hotelreservationsystem'}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel-footer">
|
||||
<a href="{$admin_link|escape:'html':'UTF-8'}" class="btn btn-default">
|
||||
<i class="process-icon-cancel"></i> {l s='Cancel' mod='hotelreservationsystem'}
|
||||
</a>
|
||||
<button type="submit" name="submitHtlAmenityItem" class="btn btn-default pull-right">
|
||||
<i class="process-icon-save"></i> {l s='Save' mod='hotelreservationsystem'}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$('#htl_logo_type_select').on('change', function () {
|
||||
if ($(this).val() === 'icon') {
|
||||
$('#htl_logo_image_row').hide();
|
||||
$('#htl_logo_icon_row').show();
|
||||
} else {
|
||||
$('#htl_logo_icon_row').hide();
|
||||
$('#htl_logo_image_row').show();
|
||||
}
|
||||
});
|
||||
|
||||
$('#logo_image-selectbutton').on('click', function () {
|
||||
$('#logo_image').trigger('click');
|
||||
});
|
||||
|
||||
$('#logo_image-name').on('click', function () {
|
||||
$('#logo_image').trigger('click');
|
||||
});
|
||||
|
||||
$('#logo_image').on('change', function () {
|
||||
var files = this.files;
|
||||
if (files && files.length > 0) {
|
||||
$('#logo_image-name').val(files[0].name);
|
||||
} else {
|
||||
var name = $(this).val().split(/[\\/]/);
|
||||
$('#logo_image-name').val(name[name.length - 1]);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,104 @@
|
||||
{**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a newer
|
||||
* versions in the future. If you wish to customize this module for your needs
|
||||
* please refer to https://store.webkul.com/customisation-guidelines for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*}
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel-heading">
|
||||
{if isset($category.id) && $category.id}
|
||||
<i class="icon-edit"></i> {l s='Edit Amenity Category' mod='hotelreservationsystem'}
|
||||
{else}
|
||||
<i class="icon-plus"></i> {l s='Add New Amenity Category' mod='hotelreservationsystem'}
|
||||
{/if}
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<form id="htl_category_form" class="defaultForm form-horizontal"
|
||||
action="{$current_index|escape:'htmlall':'UTF-8'}&token={$token|escape:'htmlall':'UTF-8'}"
|
||||
method="post">
|
||||
|
||||
{if isset($category.id) && $category.id}
|
||||
<input type="hidden" name="id" value="{$category.id|intval}" />
|
||||
<input type="hidden" name="updatehtl_amenities" value="1" />
|
||||
{else}
|
||||
<input type="hidden" name="addhtl_amenities" value="1" />
|
||||
{/if}
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-lg-3 control-label required">
|
||||
{l s='Category Name' mod='hotelreservationsystem'}
|
||||
</label>
|
||||
<div class="col-lg-9">
|
||||
{if $languages|count > 1}
|
||||
<div class="form-group">
|
||||
{/if}
|
||||
{foreach from=$languages item=language}
|
||||
{if $languages|count > 1}
|
||||
<div class="translatable-field lang-{$language.id_lang}" {if $language.id_lang != $default_lang_id}style="display:none;"{/if}>
|
||||
<div class="col-lg-9">
|
||||
{/if}
|
||||
<input type="text"
|
||||
id="cat_name_{$language.id_lang}"
|
||||
name="cat_name_{$language.id_lang}"
|
||||
value="{if isset($category.name[$language.id_lang])}{$category.name[$language.id_lang]|escape:'htmlall':'UTF-8'}{/if}"
|
||||
class="form-control"
|
||||
maxlength="128" />
|
||||
{if $languages|count > 1}
|
||||
</div>
|
||||
<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=lang}
|
||||
<li><a href="javascript:hideOtherLanguage({$lang.id_lang});" tabindex="-1">{$lang.name}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{if $languages|count > 1}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-lg-3 control-label required">
|
||||
{l s='Position' mod='hotelreservationsystem'}
|
||||
</label>
|
||||
<div class="col-lg-3">
|
||||
<input type="number" min="1" name="position" class="form-control"
|
||||
value="{if isset($category.position)}{$category.position|intval}{else}1{/if}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel-footer">
|
||||
<a href="{$admin_link|escape:'html':'UTF-8'}" class="btn btn-default">
|
||||
<i class="process-icon-cancel"></i> {l s='Cancel' mod='hotelreservationsystem'}
|
||||
</a>
|
||||
<button type="submit" name="submitHtlCategory" class="btn btn-default pull-right">
|
||||
<i class="process-icon-save"></i> {l s='Save' mod='hotelreservationsystem'}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,175 @@
|
||||
{**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a newer
|
||||
* versions in the future. If you wish to customize this module for your needs
|
||||
* please refer to https://store.webkul.com/customisation-guidelines for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*}
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel-heading">
|
||||
<i class="icon-list"></i> {l s='Manage Amenities' mod='hotelreservationsystem'}
|
||||
</div>
|
||||
<div class="row">
|
||||
{if $amenities_tree}
|
||||
{foreach from=$amenities_tree item=category}
|
||||
<div class="col-sm-12 htl-amenity-category-block" id="amenity_category_{$category.id}">
|
||||
<div class="panel">
|
||||
<div class="panel-heading clearfix">
|
||||
<div class="pull-right">
|
||||
<a class="btn btn-primary"
|
||||
href="{$admin_link}&addhtl_amenity_item&id_category={$category.id}">
|
||||
<i class="icon-plus"></i> {l s='Add new Amenity' mod='hotelreservationsystem'}
|
||||
</a>
|
||||
<a class="btn btn-primary"
|
||||
href="{$admin_link}&updatehtl_amenities&id={$category.id}">
|
||||
<i class="icon-pencil"></i> {l s='Edit' mod='hotelreservationsystem'}
|
||||
</a>
|
||||
<a href="javascript:void(0)" class="btn btn-primary htl-delete-category"
|
||||
data-category-id="{$category.id}">
|
||||
<i class="icon-trash"></i> {l s='Delete' mod='hotelreservationsystem'}
|
||||
</a>
|
||||
</div>
|
||||
<span class="htl-amenity-category-name">{$category.name|escape:'htmlall':'UTF-8'}</span>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
{if isset($category.children) && $category.children}
|
||||
<table class="table tableDnD">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{l s='Logo' mod='hotelreservationsystem'}</th>
|
||||
<th>{l s='Name' mod='hotelreservationsystem'}</th>
|
||||
<th class="text-center">{l s='Active' mod='hotelreservationsystem'}</th>
|
||||
<th class="text-right">{l s='Actions' mod='hotelreservationsystem'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$category.children item=amenity}
|
||||
<tr>
|
||||
<td class="fixed-width-xs">
|
||||
{if $amenity.logo_type == 'icon' && $amenity.logo}
|
||||
<i class="{$amenity.logo|escape:'htmlall':'UTF-8'}"></i>
|
||||
{elseif $amenity.logo_type == 'image' && $amenity.logo}
|
||||
<img src="{$img_base_url}{$amenity.id}.jpg"
|
||||
alt="{$amenity.name|escape:'htmlall':'UTF-8'}"
|
||||
style="max-height:32px;max-width:32px;" />
|
||||
{else}
|
||||
—
|
||||
{/if}
|
||||
</td>
|
||||
<td>{$amenity.name|escape:'htmlall':'UTF-8'}</td>
|
||||
<td class="text-center">
|
||||
<a class="list-action-enable{if $amenity.active} action-enabled{else} action-disabled{/if}"
|
||||
href="{$admin_link}&id={$amenity.id|intval}&statushtl_amenities&token={$token|escape:'htmlall':'UTF-8'}"
|
||||
title="{if $amenity.active}{l s='Enabled' mod='hotelreservationsystem'}{else}{l s='Disabled' mod='hotelreservationsystem'}{/if}">
|
||||
<i class="icon-check{if !$amenity.active} hidden{/if}"></i>
|
||||
<i class="icon-remove{if $amenity.active} hidden{/if}"></i>
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<a class="btn btn-default"
|
||||
href="{$admin_link}&updatehtl_amenity_item&id={$amenity.id}">
|
||||
<i class="icon-pencil"></i> {l s='Edit' mod='hotelreservationsystem'}
|
||||
</a>
|
||||
<button type="button" class="btn btn-default htl-delete-amenity"
|
||||
data-amenity-id="{$amenity.id}">
|
||||
<i class="icon-trash"></i> {l s='Delete' mod='hotelreservationsystem'}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
{else}
|
||||
<div class="alert alert-info">
|
||||
{l s='No amenities found in this category.' mod='hotelreservationsystem'}
|
||||
<a href="{$admin_link}&addhtl_amenity_item&id_category={$category.id}">
|
||||
{l s='Add the first amenity.' mod='hotelreservationsystem'}
|
||||
</a>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/foreach}
|
||||
{else}
|
||||
<div class="col-sm-12">
|
||||
<div class="alert alert-warning">
|
||||
{l s='No amenity categories found. Start by adding a new category.' mod='hotelreservationsystem'}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{strip}
|
||||
{addJsDef delete_url=$admin_link js=1 mod='hotelreservationsystem'}
|
||||
{addJsDefL name=confirm_delete_msg}{l s='Are you sure you want to delete this? This action cannot be undone.' js=1 mod='hotelreservationsystem'}{/addJsDefL}
|
||||
{addJsDefL name=error_delete_msg}{l s='An error occurred while deleting. Please try again.' js=1 mod='hotelreservationsystem'}{/addJsDefL}
|
||||
{/strip}
|
||||
|
||||
<script type="text/javascript">
|
||||
(function ($) {
|
||||
$(document).on('click', '.htl-delete-category', function (e) {
|
||||
e.preventDefault();
|
||||
if (!confirm(confirm_delete_msg)) { return; }
|
||||
var $btn = $(this);
|
||||
$.ajax({
|
||||
url: delete_url,
|
||||
type: 'POST',
|
||||
data: {
|
||||
ajax: 1,
|
||||
action: 'DeleteCategory',
|
||||
id_category: $btn.data('category-id'),
|
||||
token: '{$token|escape:'javascript'}'
|
||||
},
|
||||
success: function (res) {
|
||||
var r = $.parseJSON(res);
|
||||
if (r.status) {
|
||||
$('#amenity_category_' + $btn.data('category-id')).remove();
|
||||
} else {
|
||||
alert(r.msg || error_delete_msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '.htl-delete-amenity', function (e) {
|
||||
e.preventDefault();
|
||||
if (!confirm(confirm_delete_msg)) { return; }
|
||||
var $btn = $(this);
|
||||
$.ajax({
|
||||
url: delete_url,
|
||||
type: 'POST',
|
||||
data: {
|
||||
ajax: 1,
|
||||
action: 'DeleteAmenityItem',
|
||||
id_amenity: $btn.data('amenity-id'),
|
||||
token: '{$token|escape:'javascript'}'
|
||||
},
|
||||
success: function (res) {
|
||||
var r = $.parseJSON(res);
|
||||
if (r.status) {
|
||||
$btn.closest('tr').remove();
|
||||
} else {
|
||||
alert(r.msg || error_delete_msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}(jQuery));
|
||||
</script>
|
||||
@@ -1,149 +0,0 @@
|
||||
{*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a newer
|
||||
* versions in the future. If you wish to customize this module for your needs
|
||||
* please refer to https://store.webkul.com/customisation-guidelines for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*}
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel-heading">
|
||||
{if isset($edit) && $edit}
|
||||
<i class="icon-edit"></i>  {l s='Edit Features' mod='hotelreservationsystem'}
|
||||
{else}
|
||||
<i class="icon-plus"></i>  {l s='Add New Features' mod='hotelreservationsystem'}
|
||||
{/if}
|
||||
</div>
|
||||
<div class="panel-content">
|
||||
<form id="{$table|escape:'htmlall':'UTF-8'}_form" class="defaultForm {$name_controller|escape:'htmlall':'UTF-8'} form-horizontal" action="{$current|escape:'htmlall':'UTF-8'}&{if !empty($submit_action)}{$submit_action|escape:'htmlall':'UTF-8'}{/if}&token={$token|escape:'htmlall':'UTF-8'}" method="post" enctype="multipart/form-data">
|
||||
{if count($languages) > 1}
|
||||
<div class="col-sm-12">
|
||||
<label class="control-label">{l s='Choose Language' mod='hotelreservationsystem'}</label>
|
||||
<input type="hidden" name="choosedLangId" id="choosedLangId" value="{$currentLang.id_lang}">
|
||||
<button type="button" id="multi_lang_btn" class="btn btn-default dropdown-toggle wk_language_toggle" data-toggle="dropdown">
|
||||
{$currentLang.name}
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu wk_language_menu" style="left:14%;top:32px;">
|
||||
{foreach from=$languages item=language}
|
||||
<li>
|
||||
<a href="javascript:void(0)" onclick="showLangField('{$language.name}', {$language.id_lang});">
|
||||
{$language.name}
|
||||
</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
<p class="help-block">{l s='Change language for updating information in multiple language.' mod='hotelreservationsystem'}</p>
|
||||
<hr>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 control-label" >
|
||||
{l s='Parent Feature Name' mod='hotelreservationsystem'}
|
||||
{include file="../../../_partials/htl-form-fields-flag.tpl"}
|
||||
</label>
|
||||
<div class="col-sm-4">
|
||||
{if isset($edit)}
|
||||
<input type="hidden" name="id" value="{$featureInfo.id}" />
|
||||
{/if}
|
||||
{foreach from=$languages item=language}
|
||||
{assign var="parent_ftr_name" value="parent_ftr_name_`$language.id_lang`"}
|
||||
<input type="text"
|
||||
id="parent_ftr_name_{$language.id_lang}"
|
||||
name="parent_ftr_name_{$language.id_lang}"
|
||||
value="{if isset($smarty.post.$parent_ftr_name)}{$smarty.post.$parent_ftr_name|escape:'htmlall':'UTF-8'}{elseif isset($edit)}{$featureInfo.name[{$language.id_lang}]|escape:'htmlall':'UTF-8'}{/if}"
|
||||
class="form-control wk_text_field_all wk_text_field_{$language.id_lang}"
|
||||
maxlength="128"
|
||||
{if $currentLang.id_lang != $language.id_lang}style="display:none;"{/if} />
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 control-label">{l s='Position' mod='hotelreservationsystem'}</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" name="position" class="position" placeholder="{l s='Feature position' mod='hotelreservationsystem'}" class="form-control" value="{if isset($smarty.post.position)}{$smarty.post.position|escape:'htmlall':'UTF-8'}{elseif isset($edit)}{$featureInfo.position|escape:'htmlall':'UTF-8'}{/if}"/>
|
||||
<p class="error_text" id="pos_err_p"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 control-label">
|
||||
{l s='Child Features' mod='hotelreservationsystem'}
|
||||
{include file="../../../_partials/htl-form-fields-flag.tpl"}
|
||||
</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" placeholder="Enter child feature name" class="child_ftr_name" name="child_ftr_name">
|
||||
<p class="error_text" id="chld_ftr_err_p"></p>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" class='col-sm-2 btn btn-primary add_feature_to_list'>{l s='Add' mod='hotelreservationsystem'}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="added_child_features_container">
|
||||
{if isset($edit) && $edit && isset($featureInfo.child_features) && $featureInfo.child_features}
|
||||
{foreach from=$featureInfo.child_features item=child_feature}
|
||||
<div class="child_feature_row row">
|
||||
<label class="col-sm-3 control-label text-right">
|
||||
</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="hidden" name="child_feature_id[]" value="{$child_feature.id}" />
|
||||
{foreach from=$languages item=language}
|
||||
<input type="text"
|
||||
value="{$child_feature.name[{$language.id_lang}]|escape:'htmlall':'UTF-8'}"
|
||||
name="child_features_{$language.id_lang}[]"
|
||||
class="form-control wk_text_field_all wk_text_field_{$language.id_lang}"
|
||||
maxlength="128"
|
||||
{if $currentLang.id_lang != $language.id_lang}style="display:none;"{/if} />
|
||||
{/foreach}
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<a href="#" class="remove-chld-ftr btn btn-default">
|
||||
<i class="icon-trash"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<a href="{$link->getAdminLink('AdminHotelFeatures')|escape:'html':'UTF-8'}" class="btn btn-default">
|
||||
<i class="process-icon-cancel"></i>{l s='Cancel' mod='hotelreservationsystem'}
|
||||
</a>
|
||||
<button type="submit" name="submitHtlFeatures" class="btn btn-default pull-right submit_feature">
|
||||
<i class="process-icon-save"></i> {l s='Save' mod='hotelreservationsystem'}
|
||||
</button>
|
||||
<button type="submit" name="submitHtlFeaturesAndStay" class="btn btn-default pull-right submit_feature">
|
||||
<i class="process-icon-save"></i> {l s='Save and stay' mod='hotelreservationsystem'}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{strip}
|
||||
{addJsDefL name=prnt_ftr_err}{l s='Enter Parent feature name first.' js=1 mod='hotelreservationsystem'}{/addJsDefL}
|
||||
{addJsDefL name=chld_ftr_err}{l s='Enter at least one child feature.' js=1 mod='hotelreservationsystem'}{/addJsDefL}
|
||||
{addJsDefL name=chld_ftr_text_err}{l s='Enter child feature name.' js=1 mod='hotelreservationsystem'}{/addJsDefL}
|
||||
{addJsDefL name=pos_numeric_err}{l s='Position should be numeric.' js=1 mod='hotelreservationsystem'}{/addJsDefL}
|
||||
{/strip}
|
||||
|
||||
{block name=script}
|
||||
<script type="text/javascript">
|
||||
var id_language = {$defaultFormLanguage|intval};
|
||||
allowEmployeeFormLang = {$allowEmployeeFormLang|intval};
|
||||
</script>
|
||||
{/block}
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a newer
|
||||
* versions in the future. If you wish to customize this module for your needs
|
||||
* please refer to https://store.webkul.com/customisation-guidelines for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*/
|
||||
|
||||
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;
|
||||
@@ -1,68 +0,0 @@
|
||||
{*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a newer
|
||||
* versions in the future. If you wish to customize this module for your needs
|
||||
* please refer to https://store.webkul.com/customisation-guidelines for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*}
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel-heading">
|
||||
{l s='Hotel Features' mod='hotelreservationsystem'}
|
||||
</div>
|
||||
<div class="row">
|
||||
<form method="post" action="{$current|escape:'htmlall':'UTF-8'}&{if !empty($submit_action)}{$submit_action|escape:'htmlall':'UTF-8'}{/if}&token={$token|escape:'htmlall':'UTF-8'}" class="defaultForm form-horizontal features_list_form" enctype="multipart/form-data">
|
||||
{if $features_list}
|
||||
{foreach from=$features_list item=value}
|
||||
<div class="col-sm-12 feature_div" id="grand_feature_div_{$value.id}">
|
||||
<div class="row row-margin-bottom row-margin-top">
|
||||
<div class="col-sm-12">
|
||||
<div class="row feature-border-div">
|
||||
<div class="col-sm-12 feature-header-div">
|
||||
<span>{l s={$value.name} mod='hotelreservationsyatem'}</span>
|
||||
<a class="btn btn-primary pull-right edit_feature col-sm-1" href="{$link->getAdminLink('AdminHotelFeatures')}&updatehtl_features&id={$value.id}"><span><i class="icon-pencil"></i> {l s='Edit' mod='hotelreservationsystem'}</span></a>
|
||||
<button class="btn btn-primary pull-right dlt-feature col-sm-1" data-feature-id="{$value.id}"><i class="icon-trash"></i> {l s='Delete' mod='hotelreservationsystem'}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row child-features-container">
|
||||
<div class="col-sm-12">
|
||||
{if isset($value.children) && $value.children}
|
||||
{foreach from=$value.children item=val}
|
||||
<p>{l s={$val.name} mod='hotelreservationsyatem'}</p>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/foreach}
|
||||
{else}
|
||||
<div class="alert alert-warning">
|
||||
{l s='No hotel features found. Start adding new features for the hotels.' mod='hotelreservationsystem'}
|
||||
</div>
|
||||
{/if}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{strip}
|
||||
{addJsDef delete_url=$link->getAdminLink('AdminHotelFeatures') js=1 mod='hotelreservationsystem'}
|
||||
{addJsDefL name=success_delete_msg}{l s='Successfully Deleted.' js=1 mod='hotelreservationsystem'}{/addJsDefL}
|
||||
{addJsDefL name=error_delete_msg}{l s='Some error occured while deleting feature.Please try again.' js=1 mod='hotelreservationsystem'}{/addJsDefL}
|
||||
{addJsDefL name=no_feature_warning_txt}{l s='No hotel features found. Start adding new features for the hotels.' js=1 mod='hotelreservationsystem'}{/addJsDefL}
|
||||
{addJsDefL name=confirm_delete_msg}{l s='Are you sure?' js=1 mod='hotelreservationsystem'}{/addJsDefL}
|
||||
{/strip}
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a newer
|
||||
* versions in the future. If you wish to customize this module for your needs
|
||||
* please refer to https://store.webkul.com/customisation-guidelines for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*/
|
||||
|
||||
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;
|
||||
@@ -690,8 +690,8 @@ class QloCleaner extends Module
|
||||
array('htl_room_type_global_demand_lang', 'id_global_demand', 'htl_room_type_global_demand', 'id_global_demand'),
|
||||
array('htl_branch_info_lang', 'id_lang', 'lang', 'id_lang'),
|
||||
array('htl_branch_info_lang', 'id', 'htl_branch_info', 'id'),
|
||||
array('htl_features_lang', 'id_lang', 'lang', 'id_lang'),
|
||||
array('htl_features_lang', 'id', 'htl_features', 'id'),
|
||||
array('htl_amenities_lang', 'id_lang', 'lang', 'id_lang'),
|
||||
array('htl_amenities_lang', 'id', 'htl_amenities', 'id'),
|
||||
array('htl_room_type_demand', 'id_global_demand', 'htl_room_type_global_demand', 'id_global_demand'),
|
||||
array('htl_room_type_demand', 'id_product', 'product', 'id_product'),
|
||||
array('htl_room_type_demand_price', 'id_product', 'product', 'id_product'),
|
||||
@@ -704,7 +704,7 @@ class QloCleaner extends Module
|
||||
array('htl_booking_demands', 'id_htl_booking', 'htl_booking_detail', 'id_htl_booking'),
|
||||
array('htl_cart_booking_data', 'id_order', 'orders', 'id_order'),
|
||||
array('htl_cart_booking_data', 'id_customer', 'customer', 'id_customer'),
|
||||
array('htl_branch_features', 'id_hotel', 'htl_branch_info', 'id'),
|
||||
array('htl_branch_amenities', 'id_hotel', 'htl_branch_info', 'id'),
|
||||
array('htl_image', 'id_hotel', 'htl_branch_info', 'id'),
|
||||
array('htl_branch_info', 'id_category', 'category', 'id_category'),
|
||||
array('htl_room_information', 'id_product', 'product', 'id_product'),
|
||||
@@ -727,8 +727,8 @@ class QloCleaner extends Module
|
||||
array('htl_room_type_service_product', 'id_element', 'product', 'id_product'),
|
||||
array('htl_room_type_service_product_price', 'id_product', 'product', 'id_product'),
|
||||
array('htl_room_type_service_product_price', 'id_element', 'product', 'id_product'),
|
||||
array('htl_room_type_features', 'id_product', 'product', 'id_product'),
|
||||
array('htl_room_type_features', 'feature_id', 'htl_features', 'id'),
|
||||
array('htl_room_type_amenities', 'id_product', 'product', 'id_product'),
|
||||
array('htl_room_type_amenities', 'amenity_id', 'htl_amenities', 'id'),
|
||||
|
||||
)
|
||||
);
|
||||
@@ -812,7 +812,7 @@ class QloCleaner extends Module
|
||||
'htl_branch_info',
|
||||
'htl_branch_info_lang',
|
||||
'htl_image',
|
||||
'htl_branch_features',
|
||||
'htl_branch_amenities',
|
||||
'htl_advance_payment',
|
||||
'htl_branch_refund_rules',
|
||||
'htl_order_restrict_date',
|
||||
@@ -830,7 +830,7 @@ class QloCleaner extends Module
|
||||
'htl_room_type_global_demand',
|
||||
'htl_room_type_service_product',
|
||||
'htl_room_type_service_product_price',
|
||||
'htl_room_type_features',
|
||||
'htl_room_type_amenities',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,13 @@
|
||||
{if !empty($room_v['feature'])}
|
||||
<p class="rm_amenities_cont">
|
||||
{foreach from=$room_v['feature'] key=feat_k item=feat_v}
|
||||
<img title="{$feat_v.name|escape:'htmlall':'UTF-8'}" src="{$link->getMediaLink("`$feat_img_dir`{$feat_v.value}")|escape:'htmlall':'UTF-8'}" class="rm_amen">
|
||||
{if $feat_v.logo_type == 'icon' && $feat_v.logo}
|
||||
<i class="{$feat_v.logo|escape:'htmlall':'UTF-8'} rm_amen" title="{$feat_v.name|escape:'htmlall':'UTF-8'}"></i>
|
||||
{elseif $feat_v.logo_type == 'image' && $feat_v.logo}
|
||||
<img title="{$feat_v.name|escape:'htmlall':'UTF-8'}"
|
||||
src="{$amenity_img_dir|escape:'htmlall':'UTF-8'}{$feat_v.id|intval}.jpg"
|
||||
class="rm_amen" />
|
||||
{/if}
|
||||
{/foreach}
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
@@ -280,15 +280,47 @@
|
||||
{/block}
|
||||
{* Block for booking products *}
|
||||
{if isset($id_hotel) && $id_hotel}
|
||||
{block name='product_info_tab_hotel_features'}
|
||||
{block name='product_info_tab_room_amenities'}
|
||||
{if isset($room_dynamic_amenities) && $room_dynamic_amenities}
|
||||
<div class="info_margin_div">
|
||||
<div class="room_info_heading">
|
||||
<span>{l s='Amenities'}</span>
|
||||
<span>{l s='Room Amenities'}</span>
|
||||
</div>
|
||||
<div class="room_info_content row">
|
||||
{foreach from=$room_dynamic_amenities item=amenity}
|
||||
<div class="col-sm-4 col-xs-12"><i class="circle-small">o</i> {$amenity.name|escape:'html':'UTF-8'}</div>
|
||||
<div class="col-sm-4 col-xs-12">
|
||||
{if $amenity.logo_type == 'icon' && $amenity.logo}
|
||||
<i class="{$amenity.logo|escape:'html':'UTF-8'}"></i>
|
||||
{elseif $amenity.logo_type == 'image' && $amenity.logo}
|
||||
<img src="{$amenity_img_dir|escape:'html':'UTF-8'}{$amenity.id|intval}.jpg"
|
||||
alt="{$amenity.name|escape:'html':'UTF-8'}"
|
||||
style="max-height:20px;max-width:20px;" />
|
||||
{/if}
|
||||
{$amenity.name|escape:'html':'UTF-8'}
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/block}
|
||||
{block name='product_info_tab_hotel_features'}
|
||||
{if isset($hotel_dynamic_amenities) && $hotel_dynamic_amenities}
|
||||
<div class="info_margin_div">
|
||||
<div class="room_info_heading">
|
||||
<span>{l s='Hotel Amenities'}</span>
|
||||
</div>
|
||||
<div class="room_info_content row">
|
||||
{foreach from=$hotel_dynamic_amenities item=amenity}
|
||||
<div class="col-sm-4 col-xs-12">
|
||||
{if $amenity.logo_type == 'icon' && $amenity.logo}
|
||||
<i class="{$amenity.logo|escape:'html':'UTF-8'}"></i>
|
||||
{elseif $amenity.logo_type == 'image' && $amenity.logo}
|
||||
<img src="{$amenity_img_dir|escape:'html':'UTF-8'}{$amenity.id|intval}.jpg"
|
||||
alt="{$amenity.name|escape:'html':'UTF-8'}"
|
||||
style="max-height:20px;max-width:20px;" />
|
||||
{/if}
|
||||
{$amenity.name|escape:'html':'UTF-8'}
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
|
||||