Merge branch 'develop' into gli-2967_2

This commit is contained in:
amit sharma
2026-09-09 13:33:15 +05:30
29 changed files with 3340 additions and 208 deletions

View File

@@ -100,6 +100,8 @@
});
}
{/if}
changeStandardProductAddressType();
});
</script>
{/if}
@@ -110,6 +112,5 @@
<script type="text/javascript">
changeCMSActivationAuthorization();
changeOverbookingOrderAction();
changeStandardProductAddressType();
</script>
{/block}

View File

@@ -121,7 +121,7 @@
<a href="#" class="btn btn-default connectedRoomModal" data-toggle="modal"
data-target="#connectedRoomModal" data-id-room="{$room_info['id']|intval}"
data-room-num="{$room_info['room_num']|escape:'html':'UTF-8'}"
data-room-type="{$room_info['id_product']|intval}">
data-room-type="{if isset($room_info['id_product'])}{$room_info['id_product']|intval}{/if}">
<span class="connected-room-icon-wrapper">
<i class="icon-random"></i>
<span class="connected-room-count">

View File

@@ -121,6 +121,19 @@ $(function() {
</div>
{/if}
{if isset($num_hotel_amenities) && $num_hotel_amenities}
<div class="panel">
<h3>
{if $num_hotel_amenities == 1}
{l s='1 hotel amenity'}
{else}
{l s='%d hotel amenities' sprintf=$num_hotel_amenities}
{/if}
</h3>
{$hotel_amenities}
</div>
{/if}
{if isset($num_hotel_features) && $num_hotel_features}
<div class="panel">
<h3>

View File

@@ -45,9 +45,9 @@ class MediaCore
'ui.tabs' => array('fileName' => 'jquery.ui.tabs.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true),
'ui.datepicker' => array('fileName' => 'jquery.ui.datepicker.min.js', 'dependencies' => array('ui.core'), 'theme' => true),
'ui.progressbar' => array('fileName' => 'jquery.ui.progressbar.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true),
'ui.tooltip' => array('fileName' => 'jquery.ui.tooltip.min.js', 'dependencies' => array('ui.core', 'ui.widget','ui.position','effects.core'), 'theme' => true),
'ui.accordion' => array('fileName' => 'jquery.ui.accordion.min.js', 'dependencies' => array('ui.core', 'ui.widget','effects.core'), 'theme' => true),
'effects.core' => array('fileName' => 'jquery.effects.core.min.js', 'dependencies' => array(), 'theme' => false),
'ui.tooltip' => array('fileName' => 'jquery.ui.tooltip.min.js', 'dependencies' => array('ui.core', 'ui.widget','ui.position','ui.effect'), 'theme' => true),
'ui.accordion' => array('fileName' => 'jquery.ui.accordion.min.js', 'dependencies' => array('ui.core', 'ui.widget','ui.effect'), 'theme' => true),
'ui.effect' => array('fileName' => 'jquery.ui.effect.min.js', 'dependencies' => array(), 'theme' => false),
'effects.blind' => array('fileName' => 'jquery.effects.blind.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.bounce' => array('fileName' => 'jquery.effects.bounce.min.js', 'dependencies' => array('effects.core'), 'theme' => false),
'effects.clip' => array('fileName' => 'jquery.effects.clip.min.js', 'dependencies' => array('effects.core'), 'theme' => false),

View File

@@ -660,11 +660,11 @@ class FrontControllerCore extends Controller
}
/**
* Renders and outputs maintenance page and ends controller process.
* Redirects a cursed request (e.g. an invalid/expired access token) to page not found and ends controller process.
*/
public function initCursedPage()
{
$this->displayMaintenancePage();
Tools::redirect($this->context->link->getPageLink('pagenotfound'));
}
/**

View File

@@ -189,7 +189,6 @@ class AdminSearchControllerCore extends AdminController
if (!$searchType) {
$this->searchAddress();
$this->searchHotelFeatures();
$this->searchHotelAmenities();
$this->searchRefundRules();
}
@@ -435,6 +434,7 @@ class AdminSearchControllerCore extends AdminController
if ($hotelAmenities = $objHotelAmenities->searchByName($this->query, $this->context->language->id)) {
$amenities = array();
foreach ($hotelAmenities as $key => $hotelAmenity) {
$amenities[$hotelAmenity['id_amenity']]['id_amenity'] = $hotelAmenity['id_amenity'];
$amenities[$hotelAmenity['id_amenity']]['name'] = $hotelAmenity['name'];
if ($hotelAmenity['id_parent']) {
$amenities[$hotelAmenity['id_amenity']]['id'] = $hotelAmenity['id_parent'];
@@ -818,10 +818,10 @@ class AdminSearchControllerCore extends AdminController
$helper = new HelperList();
$helper->shopLinkType = '';
$helper->simple_header = true;
$helper->identifier = 'id_customer_message';
$helper->actions = array('edit');
$helper->identifier = 'id_customer_thread';
$helper->actions = array('view');
$helper->show_toolbar = false;
$helper->table = 'feature';
$helper->table = 'customer_thread';
$helper->currentIndex = $this->context->link->getAdminLink('AdminCustomerThreads', false);
$query = trim(Tools::getValue('bo_query'));

View File

@@ -25,9 +25,7 @@
var current_product = null;
var ajaxQueries = new Array();
if (typeof jQuery !== 'undefined' && jQuery.effects && !jQuery.effects.effect) {
jQuery.effects.effect = {};
}
$(document).ready(function() {
// Init all events
init();

View File

@@ -110,7 +110,7 @@ class DashGuestCycle extends Module
),
array(
'id' => 'box-dgc-guests',
'color' => 'color1',
'color' => 'color7',
'title' => $this->l('Guests (Adults/Children)'),
'tooltip' => $this->l('The number of adults and children scheduled to stay today.'),
'value' => $kpiValues['box-dgc-guests'],

View File

@@ -30,41 +30,54 @@
}
/* ── KPI row container: strip panel chrome ──────────────────────────────── */
.kpi-container {
.bootstrap .kpi-container {
background: transparent !important;
border: none !important;
box-shadow: none !important;
padding: 0 0 15px !important;
padding: 0 0 8px !important;
margin-bottom: 0 !important;
}
.kpi-container .kpis-wrap {
flex-wrap: nowrap !important;
overflow-x: auto;
gap: 8px;
margin: 0 !important;
overflow: auto;
margin: -5px !important;
padding-bottom: 10px !important;
}
.kpi-container .kpis-wrap .kpi-wrap {
width: 14.28% !important;
min-width: 110px;
padding: 0 !important;
padding: 5px !important;
margin-bottom: 0 !important;
}
.kpi-container .box-stats {
position: relative;
height: 80px !important;
background: #fff !important;
border-radius: 10px !important;
overflow: hidden;
font-size: inherit !important;
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15) !important;
}
.kpi-container .box-stats::before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 10px;
height: 100%;
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
background: currentColor;
}
.kpi-container .box-stats .kpi-content {
border: none !important;
border-left: 10px solid !important;
border-radius: 0 !important;
height: 100% !important;
padding: 8px 12px !important;
padding: 8px 12px 8px 20px !important;
align-items: center !important;
gap: 0 !important;
}
@@ -110,23 +123,26 @@
display: none !important;
}
.kpi-container .box-stats.color1 .kpi-content { border-left-color: #266FFE !important; }
.kpi-container .box-stats.color1 .value { color: #266FFE !important; }
.kpi-container .box-stats.color1 { color: #266FFE !important; }
.kpi-container .box-stats.color1 .value { color: #266FFE !important; }
.kpi-container .box-stats.color2 .kpi-content { border-left-color: #72C3F0 !important; }
.kpi-container .box-stats.color2 .value { color: #72C3F0 !important; }
.kpi-container .box-stats.color2 { color: #72C3F0 !important; }
.kpi-container .box-stats.color2 .value { color: #72C3F0 !important; }
.kpi-container .box-stats.color3 .kpi-content { border-left-color: #56CE56 !important; }
.kpi-container .box-stats.color3 .value { color: #56CE56 !important; }
.kpi-container .box-stats.color3 { color: #56CE56 !important; }
.kpi-container .box-stats.color3 .value { color: #56CE56 !important; }
.kpi-container .box-stats.color4 .kpi-content { border-left-color: #FFC148 !important; }
.kpi-container .box-stats.color4 .value { color: #FFC148 !important; }
.kpi-container .box-stats.color4 { color: #FFC148 !important; }
.kpi-container .box-stats.color4 .value { color: #FFC148 !important; }
.kpi-container .box-stats.color5 .kpi-content { border-left-color: #A569DF !important; }
.kpi-container .box-stats.color5 .value { color: #A569DF !important; }
.kpi-container .box-stats.color5 { color: #A569DF !important; }
.kpi-container .box-stats.color5 .value { color: #A569DF !important; }
.kpi-container .box-stats.color6 .kpi-content { border-left-color: #FF4036 !important; }
.kpi-container .box-stats.color6 .value { color: #FF4036 !important; }
.kpi-container .box-stats.color6 { color: #FF4036 !important; }
.kpi-container .box-stats.color6 .value { color: #FF4036 !important; }
.kpi-container .box-stats.color7 { color: #FF809E !important; }
.kpi-container .box-stats.color7 .value { color: #FF809E !important; }
.kpi-container .actions-wrap {
display: none !important;

View File

@@ -0,0 +1,297 @@
<?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
*/
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* Stores homepage header image items for the image slider.
* Video configuration is stored as Configuration keys (QLO_HEADER_VIDEO_SOURCE_TYPE,
* QLO_HEADER_VIDEO_NAME) rather than as rows in this table, since only one video exists.
*/
class HotelHeaderImage extends ObjectModel
{
const MEDIA_TYPE_IMAGE = 1;
const MEDIA_TYPE_VIDEO = 2;
const NAV_TYPE_DOTS = 1;
const NAV_TYPE_ARROWS = 2;
const NAV_TYPE_BOTH = 3;
const ANIMATION_TYPE_SLIDE = 1;
const ANIMATION_TYPE_FADE = 2;
const ANIMATION_TYPE_ZOOM = 3;
const ANIMATION_TYPE_BLUR = 4;
const CONTENT_ALIGN_LEFT = 1;
const CONTENT_ALIGN_CENTER = 2;
const CONTENT_ALIGN_RIGHT = 3;
const TITLE_LIMIT = 128;
public $name;
public $position;
public $title;
public $description;
public $description_color = '#ffffff';
public $description_font_size = 16;
public $description_font_weight = '400';
public $active;
public $date_add;
public $date_upd;
public static $definition = array(
'table' => 'htl_header_image',
'primary' => 'id_header_image',
'multilang' => true,
'fields' => array(
'name' => array('type' => self::TYPE_STRING, 'size' => 512),
'title' => array('type' => self::TYPE_STRING, 'lang' => true, 'size' => self::TITLE_LIMIT),
'description' => array('type' => self::TYPE_STRING, 'lang' => true, 'size' => 512),
'description_color' => array('type' => self::TYPE_STRING, 'validate' => 'isColor', 'size' => 7),
'description_font_size' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'description_font_weight' => array('type' => self::TYPE_STRING, 'size' => 10),
'position' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
),
);
public function __construct($id = null, $id_lang = null, $id_shop = null)
{
$this->image_dir = _PS_IMG_DIR_.'hotel_header_media/';
parent::__construct($id, $id_lang, $id_shop);
}
/**
* @inheritdoc
*/
public function delete()
{
if (!$this->deleteImageFile()
|| !parent::delete()
|| !$this->cleanPositions()
) {
return false;
}
return true;
}
/**
* Deletes the physical image file from disk.
*
* @return bool
*/
public function deleteImageFile()
{
if (!$this->name) {
return true;
}
$filePath = $this->image_dir.$this->name;
if (file_exists($filePath) && !unlink($filePath)) {
return false;
}
return true;
}
/**
* Fetches image rows, optionally filtered by active status.
*
* @param int|null $active 1 = active only, 0 = inactive only, null = all
* @param int|null $idLang Language id for title/description; null = context default
* @param bool $withAllLangs true = also include titles[id_lang]/descriptions[id_lang] maps (admin edit forms)
* @return array
*/
public static function getItems($active = 1, $idLang = null, $withAllLangs = false)
{
if (!$idLang) {
$idLang = (int)Context::getContext()->language->id;
}
if (!$withAllLangs) {
$sql = 'SELECT m.*, IFNULL(ml.`title`, \'\') AS `title`, IFNULL(ml.`description`, \'\') AS `description`
FROM `'._DB_PREFIX_.'htl_header_image` m
LEFT JOIN `'._DB_PREFIX_.'htl_header_image_lang` ml
ON (m.`id_header_image` = ml.`id_header_image`
AND ml.`id_lang` = '.(int)$idLang.')';
if ($active !== null) {
$sql .= ' WHERE m.`active` = '.(int)$active;
}
$sql .= ' ORDER BY m.`position` ASC';
return Db::getInstance()->executeS($sql) ?: array();
}
$sql = 'SELECT m.*, ml.`id_lang`, IFNULL(ml.`title`, \'\') AS `lang_title`, IFNULL(ml.`description`, \'\') AS `lang_description`
FROM `'._DB_PREFIX_.'htl_header_image` m
LEFT JOIN `'._DB_PREFIX_.'htl_header_image_lang` ml
ON m.`id_header_image` = ml.`id_header_image`';
if ($active !== null) {
$sql .= ' WHERE m.`active` = '.(int)$active;
}
$sql .= ' ORDER BY m.`position` ASC, ml.`id_lang` ASC';
$rows = Db::getInstance()->executeS($sql);
if (!$rows) {
return array();
}
$itemsMap = array();
foreach ($rows as $row) {
$id = (int)$row['id_header_image'];
if (!isset($itemsMap[$id])) {
$itemsMap[$id] = $row;
$itemsMap[$id]['title'] = '';
$itemsMap[$id]['titles'] = array();
$itemsMap[$id]['description'] = '';
$itemsMap[$id]['descriptions'] = array();
unset($itemsMap[$id]['id_lang'], $itemsMap[$id]['lang_title'], $itemsMap[$id]['lang_description']);
}
if (isset($row['id_lang'])) {
$langId = (int)$row['id_lang'];
$title = $row['lang_title'];
$description = $row['lang_description'];
$itemsMap[$id]['titles'][$langId] = $title;
$itemsMap[$id]['descriptions'][$langId] = $description;
if ($langId === (int)$idLang) {
$itemsMap[$id]['title'] = $title;
$itemsMap[$id]['description'] = $description;
}
}
}
return array_values($itemsMap);
}
/**
* Returns the next available position value (MAX + 1).
*
* @return int
*/
public function getHigherPosition()
{
$position = Db::getInstance()->getValue(
'SELECT MAX(`position`) FROM `'._DB_PREFIX_.'htl_header_image`'
);
return (is_numeric($position) ? (int)$position : -1) + 1;
}
/**
* Resequences position values to be contiguous (0-based) after a deletion.
* Uses a single CASE...WHEN UPDATE instead of N individual queries.
*
* @return bool
*/
public function cleanPositions()
{
$items = Db::getInstance()->executeS(
'SELECT `id_header_image` FROM `'._DB_PREFIX_.'htl_header_image` ORDER BY `position` ASC'
);
if (!$items) {
return true;
}
$cases = '';
$ids = array();
foreach ($items as $i => $item) {
$id = (int)$item['id_header_image'];
$cases .= ' WHEN '.$id.' THEN '.$i;
$ids[] = $id;
}
return (bool)Db::getInstance()->execute(
'UPDATE `'._DB_PREFIX_.'htl_header_image`
SET `position` = CASE `id_header_image`'.$cases.' END
WHERE `id_header_image` IN ('.implode(',', $ids).')'
);
}
/**
* Returns the stored video configuration, or null when no video is set.
*
* @return array|null ['source_type' => 'upload'|'url', 'name' => string]
*/
public static function getVideoConfig()
{
$name = Configuration::get('QLO_HEADER_VIDEO_NAME');
$sourceType = Configuration::get('QLO_HEADER_VIDEO_SOURCE_TYPE');
if (!$sourceType || !$name) {
return null;
}
return array('source_type' => $sourceType, 'name' => $name);
}
/**
* Persists video source type and name/url to Configuration.
*
* @param string $sourceType 'upload' or 'url'
* @param string $name Filename (upload) or full URL (url)
* @return bool
*/
public static function saveVideoConfig($sourceType, $name)
{
return Configuration::updateValue('QLO_HEADER_VIDEO_SOURCE_TYPE', pSQL($sourceType))
&& Configuration::updateValue('QLO_HEADER_VIDEO_NAME', pSQL($name));
}
/**
* Clears video configuration and deletes the uploaded file from disk if applicable.
*
* @return bool
*/
public static function deleteVideoConfig()
{
$sourceType = Configuration::get('QLO_HEADER_VIDEO_SOURCE_TYPE');
$name = Configuration::get('QLO_HEADER_VIDEO_NAME');
if ($sourceType === 'upload' && $name) {
$filePath = _PS_IMG_DIR_.'hotel_header_media/'.$name;
if (file_exists($filePath)) {
unlink($filePath);
}
}
Configuration::updateValue('QLO_HEADER_VIDEO_SOURCE_TYPE', '');
Configuration::updateValue('QLO_HEADER_VIDEO_NAME', '');
return true;
}
/**
* Creates the upload directory with security controls if it does not exist.
*
* @return bool
*/
public static function createMediaDirectory()
{
$dir = _PS_IMG_DIR_.'hotel_header_media/';
if (!is_dir($dir) && !mkdir($dir, 0755, true)) {
return false;
}
if (!file_exists($dir.'index.php') && file_exists(_PS_IMG_DIR_.'index.php')) {
copy(_PS_IMG_DIR_.'index.php', $dir.'index.php');
}
if (!file_exists($dir.'.htaccess')) {
file_put_contents(
$dir.'.htaccess',
"Options -ExecCGI\nAddHandler cgi-script .php .php3 .php4 .php5 .phtml .pl .py .jsp .asp .cgi\nphp_flag engine off\n"
);
}
return true;
}
}

View File

@@ -1069,7 +1069,40 @@ class HotelHelper
Configuration::updateValue('WK_TITLE_HEADER_BLOCK', $home_banner_default_title);
Configuration::updateValue('WK_CONTENT_HEADER_BLOCK', $home_banner_default_content);
Configuration::updateValue('WK_HOTEL_HEADER_IMAGE', 'hotel_header_image.jpg');
Configuration::updateValue('QLO_HEADER_MEDIA_TYPE', HotelHeaderImage::MEDIA_TYPE_IMAGE);
Configuration::updateValue('QLO_HEADER_SLIDER_NAV_TYPE', HotelHeaderImage::NAV_TYPE_ARROWS);
Configuration::updateValue('QLO_HEADER_SLIDER_AUTO_PLAY', 1);
Configuration::updateValue('QLO_HEADER_SLIDER_INTERVAL', 5000);
Configuration::updateValue('QLO_HEADER_SLIDER_ANIM_TYPE', HotelHeaderImage::ANIMATION_TYPE_SLIDE);
Configuration::updateValue('QLO_HEADER_CONTENT_ALIGN', HotelHeaderImage::CONTENT_ALIGN_CENTER);
Configuration::updateValue('QLO_HEADER_VIDEO_SOURCE_TYPE', '');
Configuration::updateValue('QLO_HEADER_VIDEO_NAME', '');
HotelHeaderImage::createMediaDirectory();
$defaultImgSrc = _PS_IMG_DIR_.'hotel_header_image.jpg';
$defaultImgDest = 'default_hotel_header_image.jpg';
$mediaDir = _PS_IMG_DIR_.'hotel_header_media/';
if (file_exists($defaultImgSrc) && !file_exists($mediaDir.$defaultImgDest)) {
@copy($defaultImgSrc, $mediaDir.$defaultImgDest);
}
if (file_exists($mediaDir.$defaultImgDest)) {
Db::getInstance()->execute(
'INSERT INTO `'._DB_PREFIX_.'htl_header_image`
(`name`, `position`, `active`, `date_add`, `date_upd`)
VALUES (\''.pSQL($defaultImgDest).'\', 0, 1, NOW(), NOW())'
);
$newId = (int)Db::getInstance()->Insert_ID();
if ($newId) {
foreach (Language::getLanguages(false) as $lang) {
$title = isset($homeBannerTitleLang[$lang['iso_code']]) ? $homeBannerTitleLang[$lang['iso_code']] : $homeBannerTitleLang['en'];
$description = isset($homeBannerContentLang[$lang['iso_code']]) ? $homeBannerContentLang[$lang['iso_code']] : $homeBannerContentLang['en'];
Db::getInstance()->execute(
'INSERT INTO `'._DB_PREFIX_.'htl_header_image_lang`
(`id_header_image`, `id_lang`, `title`, `description`)
VALUES ('.$newId.', '.(int)$lang['id_lang'].', \''.pSQL($title).'\', \''.pSQL($description).'\')'
);
}
}
}
Configuration::updateValue('WK_ALLOW_ADVANCED_PAYMENT', 1);
Configuration::updateValue('WK_ADVANCED_PAYMENT_GLOBAL_MIN_AMOUNT', 10);
Configuration::updateValue('WK_ADVANCED_PAYMENT_INC_TAX', 1);
@@ -1094,14 +1127,6 @@ class HotelHelper
// lang fields
$languages = Language::getLanguages(false);
$htlTagLineLang = array(
'en' => 'A place where comfort and luxury are blended with nature!',
'nl' => 'Een plek waar comfort en luxe worden gecombineerd met de natuur!',
'fr' => 'Un endroit où le confort et le luxe se mêlent à la nature!',
'de' => 'Ein Ort, an dem Komfort und Luxus mit der Natur verschmelzen!',
'ru' => 'Место, где комфорт и роскошь сочетаются с природой!',
'es' => '¡Un lugar donde el confort y el lujo se mezclan con la naturaleza!',
);
$htlShortDescLang = array(
'en' => 'We offer elegant rooms, gourmet dining, and attentive service for a memorable stay.',
@@ -1120,25 +1145,21 @@ class HotelHelper
'es' => 'ft',
);
$WK_HTL_CHAIN_NAME = array();
$WK_HTL_TAG_LINE = array();
$WK_HTL_SHORT_DESC = array();
$defaultDimensionUnit = array();
foreach ($languages as $lang) {
if (isset($htlTagLineLang[$lang['iso_code']])) {
$WK_HTL_TAG_LINE[$lang['id_lang']] = $htlTagLineLang[$lang['iso_code']];
if (isset($htlShortDescLang[$lang['iso_code']])) {
$WK_HTL_SHORT_DESC[$lang['id_lang']] = $htlShortDescLang[$lang['iso_code']];
$WK_HTL_CHAIN_NAME[$lang['id_lang']] = $homeBannerTitleLang[$lang['iso_code']];
$defaultDimensionUnit[$lang['id_lang']] = $defaultDimensionUnitLang[$lang['iso_code']];
} else {
$defaultDimensionUnit[$lang['id_lang']] = $defaultDimensionUnitLang['en'];
$WK_HTL_CHAIN_NAME[$lang['id_lang']] = $homeBannerTitleLang['en'];
$WK_HTL_TAG_LINE[$lang['id_lang']] = $htlTagLineLang['en'];
$WK_HTL_SHORT_DESC[$lang['id_lang']] = $htlShortDescLang['en'];
}
}
Configuration::updateValue('WK_HTL_CHAIN_NAME', $WK_HTL_CHAIN_NAME);
Configuration::updateValue('WK_HTL_TAG_LINE', $WK_HTL_TAG_LINE);
Configuration::updateValue('WK_HTL_SHORT_DESC', $WK_HTL_SHORT_DESC);
Configuration::updateValue('WK_DIMENSION_UNIT', $defaultDimensionUnit);

View File

@@ -452,11 +452,32 @@ class HotelReservationSystemDb
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_settings_link`)
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_header_image` (
`id_header_image` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(512) NOT NULL,
`description_color` VARCHAR(7) NOT NULL DEFAULT '#ffffff',
`description_font_size` TINYINT(3) UNSIGNED NOT NULL DEFAULT '16',
`description_font_weight` VARCHAR(10) NOT NULL DEFAULT '400',
`position` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`active` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1',
`date_add` DATETIME NOT NULL,
`date_upd` DATETIME NOT NULL,
PRIMARY KEY (`id_header_image`)
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_header_image_lang` (
`id_header_image` INT(10) UNSIGNED NOT NULL,
`id_lang` INT(11) NOT NULL,
`title` VARCHAR(512) NOT NULL DEFAULT '',
`description` VARCHAR(512) NOT NULL DEFAULT '',
PRIMARY KEY (`id_header_image`, `id_lang`)
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8;",
"INSERT IGNORE INTO `"._DB_PREFIX_."htl_settings_link` (`id_settings_link`, `icon`, `link`, `new_window`, `position`, `unremovable`, `active`, `date_add`, `date_upd`) VALUES
(1, 'icon-cogs', 'index.php?controller=AdminHotelGeneralSettings', 0, 0, 1, 1, NOW(), NOW()),
(2, 'icon-dollar', 'index.php?controller=AdminHotelFeaturePricesSettings', 0, 2, 1, 1, NOW(), NOW()),
(3, 'icon-file-text', 'index.php?controller=AdminAboutHotelBlockSetting', 0, 4, 0, 1, NOW(), NOW()),
(4, 'icon-th-list', 'index.php?controller=AdminFeaturesModuleSetting', 0, 5, 0, 1, NOW(), NOW());",
(4, 'icon-th-list', 'index.php?controller=AdminFeaturesModuleSetting', 0, 5, 0, 1, NOW(), NOW()),
(5, 'icon-picture', 'index.php?controller=AdminHotelHeaderImage', 0, 6, 0, 1, NOW(), NOW());",
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_settings_link_lang` (
`id_settings_link` int(10) unsigned NOT NULL,
@@ -485,6 +506,11 @@ class HotelReservationSystemDb
SELECT 4, `id_lang`, 'Hotel Amenities Block', 'Configure Hotels Amenities settings. You can display hotel amenities images using this block. This block will be displayed on home page.'
FROM `"._DB_PREFIX_."lang`
ORDER BY `id_lang`;",
"INSERT IGNORE INTO `"._DB_PREFIX_."htl_settings_link_lang` (`id_settings_link`, `id_lang`, `name`, `hint`)
SELECT 5, `id_lang`, 'Landing Page Header Media', 'Configure and manage header images or videos displayed on the home page.'
FROM `"._DB_PREFIX_."lang`
ORDER BY `id_lang`;",
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_connected_room` (
`id_connected_room` int(11) NOT NULL AUTO_INCREMENT,
`id_room` int(11) NOT NULL,
@@ -555,6 +581,8 @@ class HotelReservationSystemDb
`'._DB_PREFIX_.'htl_access`,
`'._DB_PREFIX_.'htl_settings_link`,
`'._DB_PREFIX_.'htl_settings_link_lang`,
`'._DB_PREFIX_.'htl_header_image`,
`'._DB_PREFIX_.'htl_header_image_lang`,
`'._DB_PREFIX_.'htl_connected_room`'
);
}

View File

@@ -1207,7 +1207,7 @@ class AdminAddHotelController extends ModuleAdminController
$this->addJqueryUI('ui.sortable');
$this->addJS(_MODULE_DIR_.$this->module->name.'/views/js/hotelImage.js');
$this->addJS(_MODULE_DIR_.$this->module->name.'/views/js/admin/qhrs_hotel_image.js');
$this->addJS(_MODULE_DIR_.$this->module->name.'/views/js/HotelReservationAdmin.js');
$this->addCSS(_MODULE_DIR_.$this->module->name.'/views/css/HotelReservationAdmin.css');
}

View File

@@ -30,10 +30,6 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
$this->bootstrap = true;
parent::__construct();
$psImgUrl = $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('WK_HOTEL_HEADER_IMAGE'));
if ($imgExist = (bool)Tools::file_get_contents($psImgUrl)) {
$image = '<img class="img-thumbnail img-responsive" style="max-width:200px" src="'.$psImgUrl.'">';
}
$objHotelInfo = new HotelBranchInformation();
if (!$hotelsInfo = $objHotelInfo->hotelBranchesInfo(false, 1)) {
$hotelsInfo = array();
@@ -129,21 +125,13 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
'title' => $this->l('Website Configuration'),
'fields' => array(
'WK_HTL_CHAIN_NAME' => array(
'title' => $this->l('Hotel Name'),
'title' => $this->l('Hotel Brand Name'),
'type' => 'textLang',
'lang' => true,
'required' => true,
'validation' => 'isGenericName',
'hint' => $this->l('Enter Hotel name in case of single hotel or enter your hotels chain name in case of multiple hotels.'),
),
'WK_HTL_TAG_LINE' => array(
'title' => $this->l('Hotel Tag Line'),
'type' => 'textareaLang',
'lang' => true,
'required' => true,
'validation' => 'isGenericName',
'hint' => $this->l('This will display hotel tag line in hotel page.'),
),
'WK_HTL_SHORT_DESC' => array(
'title' => $this->l('Hotel Short Description'),
'type' => 'textareaLang',
@@ -166,14 +154,6 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
'hint' => $this->l('The year when your hotel site was launched.'),
'type' => 'text',
'class' => 'fixed-width-xxl',
),
'WK_HTL_HEADER_IMAGE' => array(
'title' => $this->l('Header Background Image'),
'type' => 'file',
'image' => $imgExist ? $image : false,
'hint' => $this->l('This image appears as header background image on home page.'),
'name' => 'WK_HOTEL_HEADER_IMAGE',
'url' => _PS_IMG_,
),
'WK_DISPLAY_PROPERTIES_LINK_IN_HEADER' => array(
'title' => $this->l('Display Our Properties link in Header'),
@@ -571,17 +551,6 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
}
}
}
if (!trim(Tools::getValue('WK_HTL_TAG_LINE_'.$defaultLangId))) {
$this->errors[] = $this->l('Hotel tag line is required at least in ').$objDefaultLanguage['name'];
} else {
foreach ($languages as $lang) {
if (trim(Tools::getValue('WK_HTL_TAG_LINE_'.$lang['id_lang']))) {
if (!Validate::isGenericName(Tools::getValue('WK_HTL_TAG_LINE_'.$lang['id_lang']))) {
$this->errors[] = $this->l('Invalid Hotel tag line in ').$lang['name'];
}
}
}
}
if (!trim(Tools::getValue('WK_HTL_SHORT_DESC_'.$defaultLangId))) {
$this->errors[] = $this->l('Hotel short description is required at least in ').
$objDefaultLanguage['name'];
@@ -594,24 +563,6 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
}
}
}
if ($_FILES['WK_HOTEL_HEADER_IMAGE']['name']) {
if ($error = ImageManager::validateUpload($_FILES['WK_HOTEL_HEADER_IMAGE'], Tools::getMaxUploadSize())) {
$this->errors[] = $error;
}
if (!count($this->errors)) {
$file_name = 'hotel_header_image_'.time().'.jpg';
$img_path = _PS_IMG_DIR_.$file_name;
if (ImageManager::resize($_FILES['WK_HOTEL_HEADER_IMAGE']['tmp_name'], $img_path)) {
$olderHeaderImg = _PS_IMG_DIR_.Configuration::get('WK_HOTEL_HEADER_IMAGE');
Configuration::updateValue('WK_HOTEL_HEADER_IMAGE', $file_name);
Tools::deleteFile($olderHeaderImg);
} else {
$this->errors[] = $this->l('Some error occured while uoploading image.Please try again.');
}
}
}
if (!Validate::isUnsignedInt(Tools::getValue('WK_ADVANCED_PAYMENT_GLOBAL_MIN_AMOUNT'))) {
$this->errors[] = $this->l('Invalid minimum partial payment percentage.');
} elseif (Tools::getValue('WK_ADVANCED_PAYMENT_GLOBAL_MIN_AMOUNT') <= 0) {
@@ -661,11 +612,6 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
Tools::getValue('WK_HTL_CHAIN_NAME_'.$defaultLangId)
);
}
if (!trim(Tools::getValue('WK_HTL_TAG_LINE_'.$lang['id_lang']))) {
$_POST['WK_HTL_TAG_LINE_'.$lang['id_lang']] = trim(
Tools::getValue('WK_HTL_TAG_LINE_'.$defaultLangId)
);
}
if (!trim(Tools::getValue('WK_HTL_SHORT_DESC_'.$lang['id_lang']))) {
$_POST['WK_HTL_SHORT_DESC_'.$lang['id_lang']] = trim(
Tools::getValue('WK_HTL_SHORT_DESC_'.$defaultLangId)

View File

@@ -0,0 +1,863 @@
<?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
*/
if (!defined('_PS_VERSION_')) {
exit;
}
class AdminHotelHeaderImageController extends ModuleAdminController
{
public function __construct()
{
$this->table = 'htl_header_image';
$this->className = 'HotelHeaderImage';
$this->bootstrap = true;
$this->identifier = 'id_header_image';
$this->lang = true;
parent::__construct();
$this->bulk_actions = array(
'delete' => array(
'text' => $this->l('Delete selected'),
'confirm' => $this->l('Delete selected images? This cannot be undone.'),
'icon' => 'icon-trash',
),
);
}
public function initContent()
{
if (!$this->ajax) {
$this->display = 'view';
}
parent::initContent();
}
public function initToolbar()
{
parent::initToolbar();
$this->page_header_toolbar_title = $this->l('Header Image Configuration');
unset($this->toolbar_btn['back']);
}
public function renderView()
{
$this->meta_title = $this->l('Header Image Configuration');
$mediaType = (int)Tools::getValue('QLO_HEADER_MEDIA_TYPE', (int)(Configuration::get('QLO_HEADER_MEDIA_TYPE') ?: HotelHeaderImage::MEDIA_TYPE_IMAGE));
$languages = Language::getLanguages(false);
$defaultLangId = (int)Configuration::get('PS_LANG_DEFAULT');
$imageItems = HotelHeaderImage::getItems(null, $defaultLangId, true);
$shopId = (int)$this->context->shop->id;
foreach ($imageItems as &$item) {
$item['titles_json'] = json_encode((object)$item['titles']);
$item['descriptions_json'] = json_encode((object)$item['descriptions']);
$srcPath = _PS_IMG_DIR_.'hotel_header_media/'.$item['name'];
$cacheName = 'htl_header_image_mini_'.(int)$item['id_header_image'].'_'.$shopId.'.jpg';
$item['thumb'] = ImageManager::thumbnail($srcPath, $cacheName, 45, 'jpg', false);
}
unset($item);
$videoItem = HotelHeaderImage::getVideoConfig();
$videoMimeType = 'video/mp4';
if ($videoItem) {
if ($videoItem['source_type'] === 'upload') {
$ext = strtolower(pathinfo($videoItem['name'], PATHINFO_EXTENSION));
} else {
$urlPath = parse_url($videoItem['name'], PHP_URL_PATH);
$ext = strtolower(pathinfo($urlPath ?: '', PATHINFO_EXTENSION));
}
$mimeMap = array('mp4' => 'video/mp4', 'webm' => 'video/webm', 'ogg' => 'video/ogg');
$videoMimeType = isset($mimeMap[$ext]) ? $mimeMap[$ext] : 'video/mp4';
}
$sourceType = Tools::getValue('source_type', $videoItem ? $videoItem['source_type'] : 'upload');
$videoUrlValue = Tools::getValue(
'video_url',
($videoItem && $videoItem['source_type'] === 'url') ? $videoItem['name'] : ''
);
$showVideoUrlPreview = ($sourceType === 'url' && $videoUrlValue && Validate::isAbsoluteUrl($videoUrlValue));
Media::addJsDef(array(
'qloHmCurrentIndex' => self::$currentIndex,
'qloHmToken' => $this->token,
'qloHmMediaType' => $mediaType,
'qloHmMediaTypeImage' => HotelHeaderImage::MEDIA_TYPE_IMAGE,
'qloHmMediaTypeVideo' => HotelHeaderImage::MEDIA_TYPE_VIDEO,
'qloHmMaxUpload' => Tools::getMaxUploadSize((int)Configuration::get('PS_LIMIT_UPLOAD_IMAGE_VALUE') * 1024 * 1024),
'qloHmMaxVideoUpload' => Tools::getMaxUploadSize(),
'qloHmDefaultLangId' => $defaultLangId,
'qloHmI18n' => array(
'noFileSelected' => $this->l('Please select at least one image file.'),
'deleteFailed' => $this->l('Delete failed.'),
'requestFailed' => $this->l('Request failed.'),
'imageUploadedSuccess' => $this->l('Image uploaded successfully.'),
'imageUpdatedSuccess' => $this->l('Image updated successfully.'),
'uploadFailed' => $this->l('Upload failed.'),
'updateFailed' => $this->l('Update failed.'),
'editLabel' => $this->l('Edit'),
'deleteImageLabel' => $this->l('Delete this image'),
'fileTooLarge' => $this->l('File exceeds the maximum allowed upload size.'),
),
));
$this->tpl_view_vars = array(
'mediaType' => $mediaType,
'imageItems' => $imageItems,
'videoItem' => $videoItem,
'videoMimeType' => $videoMimeType,
'sourceType' => $sourceType,
'videoUrlValue' => $videoUrlValue,
'showVideoUrlPreview' => $showVideoUrlPreview,
'config' => array(
'QLO_HEADER_MEDIA_TYPE' => $mediaType,
'QLO_HEADER_SLIDER_NAV_TYPE' => (int)Tools::getValue('QLO_HEADER_SLIDER_NAV_TYPE', (int)(Configuration::get('QLO_HEADER_SLIDER_NAV_TYPE') ?: HotelHeaderImage::NAV_TYPE_ARROWS)),
'QLO_HEADER_SLIDER_AUTO_PLAY' => (int)Tools::getValue('QLO_HEADER_SLIDER_AUTO_PLAY', (int)Configuration::get('QLO_HEADER_SLIDER_AUTO_PLAY')),
'QLO_HEADER_SLIDER_INTERVAL' => Tools::getValue('QLO_HEADER_SLIDER_INTERVAL', (int)Configuration::get('QLO_HEADER_SLIDER_INTERVAL') ?: 5000),
'QLO_HEADER_SLIDER_ANIM_TYPE' => (int)Tools::getValue('QLO_HEADER_SLIDER_ANIM_TYPE', (int)(Configuration::get('QLO_HEADER_SLIDER_ANIM_TYPE') ?: HotelHeaderImage::ANIMATION_TYPE_SLIDE)),
'QLO_HEADER_CONTENT_ALIGN' => (int)Tools::getValue('QLO_HEADER_CONTENT_ALIGN', (int)(Configuration::get('QLO_HEADER_CONTENT_ALIGN') ?: HotelHeaderImage::CONTENT_ALIGN_CENTER)),
),
'languages' => $languages,
'defaultLangId' => $defaultLangId,
'imgBaseUrl' => $this->context->link->getMediaLink(_PS_IMG_.'hotel_header_media/'),
'maxUpload' => Tools::formatBytes(Tools::getMaxUploadSize()),
'maxImageUpload' => Tools::formatBytes(Tools::getMaxUploadSize((int)Configuration::get('PS_LIMIT_UPLOAD_IMAGE_VALUE') * 1024 * 1024)),
'descriptionLimit' => (int)Configuration::get('PS_SHORT_DESC_LIMIT') ?: Configuration::PS_SHORT_DESC_LIMIT,
'titleLimit' => HotelHeaderImage::TITLE_LIMIT,
);
return parent::renderView();
}
public function postProcess()
{
if (Tools::isSubmit('submitHeaderMedia')) {
$this->processSaveSettings();
}
parent::postProcess();
}
protected function processBulkDelete()
{
$ids = Tools::getValue($this->table.'Box', array());
$activeImages = HotelHeaderImage::getItems(1);
$activeIds = array_column($activeImages, 'id_header_image');
$activeToDelete = array_intersect(array_map('intval', (array)$ids), array_map('intval', $activeIds));
if (count($activeIds) - count($activeToDelete) < 1) {
$this->errors[] = $this->l('At least one active image is required.');
return;
}
parent::processBulkDelete();
}
protected function processSaveSettings()
{
$mediaType = (int)Tools::getValue('QLO_HEADER_MEDIA_TYPE', HotelHeaderImage::MEDIA_TYPE_IMAGE);
$previousMediaType = (int)Configuration::get('QLO_HEADER_MEDIA_TYPE');
if (!in_array($mediaType, array(HotelHeaderImage::MEDIA_TYPE_IMAGE, HotelHeaderImage::MEDIA_TYPE_VIDEO))) {
$this->errors[] = $this->l('Invalid media type selected.');
return;
}
$sourceType = Tools::getValue('source_type', 'upload');
$existingVideo = HotelHeaderImage::getVideoConfig();
$hasMatchingExistingVideo = ($existingVideo && $existingVideo['source_type'] === $sourceType);
$hasNewVideoFile = isset($_FILES['header_video_file']) && !empty($_FILES['header_video_file']['size']);
$hasNewVideoUrl = ($sourceType === 'url' && trim(Tools::getValue('video_url', '')) !== '');
if ($mediaType === HotelHeaderImage::MEDIA_TYPE_VIDEO && !$hasMatchingExistingVideo && !$hasNewVideoFile && !$hasNewVideoUrl) {
$this->errors[] = $this->l('Please upload or link a video before switching the header to Video mode.');
return;
}
if ($mediaType === HotelHeaderImage::MEDIA_TYPE_IMAGE && !HotelHeaderImage::getItems(1)) {
$this->errors[] = $this->l('Please add at least one active image before switching the header to Image mode.');
return;
}
$autoPlay = 0;
$interval = 0;
$navType = HotelHeaderImage::NAV_TYPE_ARROWS;
$animType = HotelHeaderImage::ANIMATION_TYPE_SLIDE;
$contentAlign = HotelHeaderImage::CONTENT_ALIGN_CENTER;
if ($mediaType === HotelHeaderImage::MEDIA_TYPE_IMAGE) {
$autoPlay = (int)(bool)Tools::getValue('QLO_HEADER_SLIDER_AUTO_PLAY', 1);
if ($autoPlay) {
$interval = Tools::getValue('QLO_HEADER_SLIDER_INTERVAL', 5000);
if (!Validate::isUnsignedInt($interval) || (int)$interval < 500) {
$this->errors[] = $this->l('Auto Slide Interval must be at least 500 milliseconds.');
return;
}
$interval = (int)$interval;
}
$navType = (int)Tools::getValue('QLO_HEADER_SLIDER_NAV_TYPE', HotelHeaderImage::NAV_TYPE_ARROWS);
if (!in_array($navType, array(HotelHeaderImage::NAV_TYPE_DOTS, HotelHeaderImage::NAV_TYPE_ARROWS, HotelHeaderImage::NAV_TYPE_BOTH))) {
$navType = HotelHeaderImage::NAV_TYPE_ARROWS;
}
$animType = (int)Tools::getValue('QLO_HEADER_SLIDER_ANIM_TYPE', HotelHeaderImage::ANIMATION_TYPE_SLIDE);
if (!in_array($animType, array(HotelHeaderImage::ANIMATION_TYPE_SLIDE, HotelHeaderImage::ANIMATION_TYPE_FADE, HotelHeaderImage::ANIMATION_TYPE_ZOOM, HotelHeaderImage::ANIMATION_TYPE_BLUR))) {
$animType = HotelHeaderImage::ANIMATION_TYPE_SLIDE;
}
$contentAlign = (int)Tools::getValue('QLO_HEADER_CONTENT_ALIGN', HotelHeaderImage::CONTENT_ALIGN_CENTER);
if (!in_array($contentAlign, array(HotelHeaderImage::CONTENT_ALIGN_LEFT, HotelHeaderImage::CONTENT_ALIGN_CENTER, HotelHeaderImage::CONTENT_ALIGN_RIGHT))) {
$contentAlign = HotelHeaderImage::CONTENT_ALIGN_CENTER;
}
}
if ($mediaType === HotelHeaderImage::MEDIA_TYPE_VIDEO) {
$imagesToDrop = array();
if ($previousMediaType === HotelHeaderImage::MEDIA_TYPE_IMAGE) {
$imagesToDrop = HotelHeaderImage::getItems(null);
array_shift($imagesToDrop);
}
if ($imagesToDrop && Tools::getValue('confirm_delete_images') !== '1') {
$this->errors[] = $this->l('Switching to Video will delete all images except the one in the first position. Please confirm this action.');
return;
}
$this->processSaveVideo();
if (!count($this->errors)) {
foreach ($imagesToDrop as $imgData) {
$obj = new HotelHeaderImage((int)$imgData['id_header_image']);
if (Validate::isLoadedObject($obj)) {
$obj->delete();
}
}
}
}
if (!count($this->errors)) {
Configuration::updateValue('QLO_HEADER_MEDIA_TYPE', $mediaType);
if ($mediaType === HotelHeaderImage::MEDIA_TYPE_IMAGE) {
Configuration::updateValue('QLO_HEADER_CONTENT_ALIGN', $contentAlign);
Configuration::updateValue('QLO_HEADER_SLIDER_NAV_TYPE', $navType);
Configuration::updateValue('QLO_HEADER_SLIDER_AUTO_PLAY', $autoPlay);
Configuration::updateValue('QLO_HEADER_SLIDER_ANIM_TYPE', $animType);
if ($autoPlay) {
Configuration::updateValue('QLO_HEADER_SLIDER_INTERVAL', $interval);
}
}
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
}
}
protected function processSaveVideo()
{
$sourceType = Tools::getValue('source_type', 'upload');
$videoUrl = trim(Tools::getValue('video_url', ''));
$file = isset($_FILES['header_video_file']) ? $_FILES['header_video_file'] : null;
$hasNewFile = ($file && isset($file['error']) && $file['error'] === UPLOAD_ERR_OK && $file['size'] > 0);
$hasNewUrl = ($sourceType === 'url' && $videoUrl !== '');
if ($sourceType === 'url' && $videoUrl === '') {
$this->errors[] = $this->l('Please enter a video URL.');
return;
}
if ($hasNewUrl && !Validate::isAbsoluteUrl($videoUrl)) {
$this->errors[] = $this->l('Please enter a valid video URL.');
return;
}
if ($hasNewFile) {
$allowedExts = array('mp4', 'webm', 'ogg');
$allowedMimes = array('video/mp4', 'video/webm', 'video/ogg', 'video/x-matroska');
$ext = strtolower(pathinfo($file['name'], PATHINFO_EXTENSION));
if (!in_array($ext, $allowedExts)) {
$this->errors[] = $this->l('Only .mp4, .webm, and .ogg video formats are allowed.');
return;
}
if (filesize($file['tmp_name']) > Tools::getMaxUploadSize()) {
$this->errors[] = $this->l('Video file exceeds the maximum allowed upload size.');
return;
}
if (!function_exists('finfo_open')) {
$this->errors[] = $this->l('Server cannot verify file type. Please enable the fileinfo PHP extension.');
return;
}
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$detectedMime = finfo_file($finfo, $file['tmp_name']);
finfo_close($finfo);
if (!in_array($detectedMime, $allowedMimes)) {
$this->errors[] = $this->l('Invalid video file type detected.');
return;
}
}
if ($hasNewUrl) {
HotelHeaderImage::deleteVideoConfig();
HotelHeaderImage::saveVideoConfig('url', $videoUrl);
} elseif ($hasNewFile) {
if (!HotelHeaderImage::createMediaDirectory()) {
$this->errors[] = $this->l('Could not create the media directory.');
return;
}
$ext = strtolower(pathinfo($file['name'], PATHINFO_EXTENSION));
do {
$uniqueName = bin2hex(random_bytes(16)).'.'.$ext;
} while (file_exists(_PS_IMG_DIR_.'hotel_header_media/'.$uniqueName));
if (!move_uploaded_file($file['tmp_name'], _PS_IMG_DIR_.'hotel_header_media/'.$uniqueName)) {
$this->errors[] = $this->l('Failed to save video file.');
return;
}
HotelHeaderImage::deleteVideoConfig();
HotelHeaderImage::saveVideoConfig('upload', $uniqueName);
}
}
public function ajaxProcessUploadImage()
{
$response = array('errors' => array(), 'success' => false);
$file = isset($_FILES['header_image_file']) ? $_FILES['header_image_file'] : null;
if (!$file || !$file['size']) {
$response['errors'][] = $this->l('No file received.');
$this->ajaxDie(json_encode($response));
}
if ($error = ImageManager::validateUpload($file, Tools::getMaxUploadSize((int)Configuration::get('PS_LIMIT_UPLOAD_IMAGE_VALUE') * 1024 * 1024))) {
$response['errors'][] = $error;
$this->ajaxDie(json_encode($response));
}
if (!HotelHeaderImage::createMediaDirectory()) {
$response['errors'][] = $this->l('Could not create the media directory.');
$this->ajaxDie(json_encode($response));
}
$ext = strtolower(pathinfo($file['name'], PATHINFO_EXTENSION));
$isGif = ($ext === 'gif');
$outExt = $isGif ? 'gif' : 'jpg';
do {
$uniqueName = bin2hex(random_bytes(16)).'.'.$outExt;
} while (file_exists(_PS_IMG_DIR_.'hotel_header_media/'.$uniqueName));
$destPath = _PS_IMG_DIR_.'hotel_header_media/'.$uniqueName;
$saved = $isGif ? (bool)move_uploaded_file($file['tmp_name'], $destPath) : (bool)ImageManager::resize($file['tmp_name'], $destPath);
if (!$saved) {
$response['errors'][] = $this->l('Failed to save image file.');
$this->ajaxDie(json_encode($response));
}
$titleByLang = array();
$descriptionByLang = array();
foreach (Language::getLanguages(false) as $lang) {
$titleByLang[$lang['id_lang']] = trim(Tools::getValue('title_'.$lang['id_lang'], ''));
$descriptionByLang[$lang['id_lang']] = trim(Tools::getValue('description_'.$lang['id_lang'], ''));
}
foreach (array_merge($titleByLang, $descriptionByLang) as $textValue) {
if (!Validate::isGenericName($textValue)) {
if (file_exists($destPath)) {
unlink($destPath);
}
$response['errors'][] = $this->l('Invalid title or description. Characters < > = { } are not allowed.');
$this->ajaxDie(json_encode($response));
}
}
foreach ($titleByLang as $titleValue) {
if (Tools::strlen($titleValue) > HotelHeaderImage::TITLE_LIMIT) {
if (file_exists($destPath)) {
unlink($destPath);
}
$response['errors'][] = sprintf($this->l('Title is too long: %d chars max.'), HotelHeaderImage::TITLE_LIMIT);
$this->ajaxDie(json_encode($response));
}
}
$descriptionLimit = (int)Configuration::get('PS_SHORT_DESC_LIMIT') ?: Configuration::PS_SHORT_DESC_LIMIT;
foreach ($descriptionByLang as $descriptionValue) {
if (Tools::strlen($descriptionValue) > $descriptionLimit) {
if (file_exists($destPath)) {
unlink($destPath);
}
$response['errors'][] = sprintf($this->l('Description is too long: %d chars max.'), $descriptionLimit);
$this->ajaxDie(json_encode($response));
}
}
$descriptionColor = Tools::getValue('description_color', '#ffffff');
if (!preg_match('/^#[0-9a-fA-F]{6}$/', $descriptionColor)) {
$response['errors'][] = $this->l('Invalid description color. Use a 6-digit hex value (e.g. #ffffff).');
$this->ajaxDie(json_encode($response));
}
$descriptionFontSize = (int)Tools::getValue('description_font_size', 16);
if ($descriptionFontSize < 8 || $descriptionFontSize > 72) {
$response['errors'][] = $this->l('Description font size must be between 8 and 72 pixels.');
$this->ajaxDie(json_encode($response));
}
$descriptionFontWeight = Tools::getValue('description_font_weight', '400');
if (!in_array($descriptionFontWeight, array('400', '700'))) {
$response['errors'][] = $this->l('Invalid description font weight.');
$this->ajaxDie(json_encode($response));
}
$objImage = new HotelHeaderImage();
$objImage->name = $uniqueName;
$objImage->position = $objImage->getHigherPosition();
$objImage->active = (int)(bool)Tools::getValue('active', 1);
$objImage->title = $titleByLang;
$objImage->description = $descriptionByLang;
$objImage->description_color = $descriptionColor;
$objImage->description_font_size = $descriptionFontSize;
$objImage->description_font_weight = $descriptionFontWeight;
if (!$objImage->save()) {
if (file_exists($destPath)) {
unlink($destPath);
}
$response['errors'][] = $this->l('Failed to save image record.');
$this->ajaxDie(json_encode($response));
}
$defaultLangId = (int)Configuration::get('PS_LANG_DEFAULT');
$shopId = (int)$this->context->shop->id;
$cacheName = 'htl_header_image_mini_'.(int)$objImage->id.'_'.$shopId.'.jpg';
$thumb = ImageManager::thumbnail($destPath, $cacheName, 45, 'jpg', true, true);
$this->context->smarty->assign(array(
'img' => array(
'id_header_image' => (int)$objImage->id,
'name' => $uniqueName,
'thumb' => $thumb,
'title' => isset($titleByLang[$defaultLangId]) ? $titleByLang[$defaultLangId] : '',
'titles_json' => json_encode((object)$titleByLang),
'description' => isset($descriptionByLang[$defaultLangId]) ? $descriptionByLang[$defaultLangId] : '',
'descriptions_json' => json_encode((object)$descriptionByLang),
'description_color' => $descriptionColor,
'description_font_size' => $descriptionFontSize,
'description_font_weight' => $descriptionFontWeight,
'active' => (int)$objImage->active,
),
'position' => count(HotelHeaderImage::getItems(null)),
'current' => self::$currentIndex,
'token' => $this->token,
'imgBaseUrl' => $this->context->link->getMediaLink(_PS_IMG_.'hotel_header_media/'),
));
$response['success'] = true;
$response['data']['image_row'] = $this->context->smarty->fetch(
_PS_MODULE_DIR_.$this->module->name.'/views/templates/admin/hotel_header_image/_partials/htl-header-image-row.tpl'
);
$this->ajaxDie(json_encode($response));
}
public function ajaxProcessEditImage()
{
$response = array('errors' => array(), 'success' => false);
$id = (int)Tools::getValue('id_header_image');
if (!$id) {
$response['errors'][] = $this->l('Invalid item ID.');
$this->ajaxDie(json_encode($response));
}
$objImage = new HotelHeaderImage($id);
if (!Validate::isLoadedObject($objImage)) {
$response['errors'][] = $this->l('Image not found.');
$this->ajaxDie(json_encode($response));
}
$titleByLang = array();
$descriptionByLang = array();
foreach (Language::getLanguages(false) as $lang) {
$titleByLang[$lang['id_lang']] = trim(Tools::getValue('title_'.$lang['id_lang'], ''));
$descriptionByLang[$lang['id_lang']] = trim(Tools::getValue('description_'.$lang['id_lang'], ''));
}
foreach ($titleByLang as $titleValue) {
if (!Validate::isGenericName($titleValue)) {
$response['errors'][] = $this->l('Invalid title. Characters < > = { } are not allowed.');
$this->ajaxDie(json_encode($response));
}
if (Tools::strlen($titleValue) > HotelHeaderImage::TITLE_LIMIT) {
$response['errors'][] = sprintf($this->l('Title is too long: %d chars max.'), HotelHeaderImage::TITLE_LIMIT);
$this->ajaxDie(json_encode($response));
}
}
$descriptionLimit = (int)Configuration::get('PS_SHORT_DESC_LIMIT') ?: Configuration::PS_SHORT_DESC_LIMIT;
foreach ($descriptionByLang as $descriptionValue) {
if (Tools::strlen($descriptionValue) > $descriptionLimit) {
$response['errors'][] = sprintf($this->l('Description is too long: %d chars max.'), $descriptionLimit);
$this->ajaxDie(json_encode($response));
}
}
$activeVal = Tools::getValue('active');
if ($activeVal !== false) {
$newActive = (int)(bool)$activeVal;
if ($newActive === 0 && (int)$objImage->active === 1) {
$activeImages = HotelHeaderImage::getItems(1);
if (is_array($activeImages) && count($activeImages) <= 1) {
$response['errors'][] = $this->l('At least one image must remain active.');
$this->ajaxDie(json_encode($response));
}
}
$objImage->active = $newActive;
}
$descriptionColor = Tools::getValue('description_color', $objImage->description_color);
if (!preg_match('/^#[0-9a-fA-F]{6}$/', $descriptionColor)) {
$response['errors'][] = $this->l('Invalid description color. Use a 6-digit hex value (e.g. #ffffff).');
$this->ajaxDie(json_encode($response));
}
$descriptionFontSize = (int)Tools::getValue('description_font_size', $objImage->description_font_size);
if ($descriptionFontSize < 8 || $descriptionFontSize > 72) {
$response['errors'][] = $this->l('Description font size must be between 8 and 72 pixels.');
$this->ajaxDie(json_encode($response));
}
$descriptionFontWeight = Tools::getValue('description_font_weight', $objImage->description_font_weight);
if (!in_array($descriptionFontWeight, array('400', '700'))) {
$response['errors'][] = $this->l('Invalid description font weight.');
$this->ajaxDie(json_encode($response));
}
$replacementFile = isset($_FILES['header_image_file']) ? $_FILES['header_image_file'] : null;
$hasReplacementFile = ($replacementFile && isset($replacementFile['error']) && $replacementFile['error'] === UPLOAD_ERR_OK && $replacementFile['size'] > 0);
$newImageName = null;
if ($hasReplacementFile) {
if ($error = ImageManager::validateUpload($replacementFile, Tools::getMaxUploadSize((int)Configuration::get('PS_LIMIT_UPLOAD_IMAGE_VALUE') * 1024 * 1024))) {
$response['errors'][] = $error;
$this->ajaxDie(json_encode($response));
}
if (!HotelHeaderImage::createMediaDirectory()) {
$response['errors'][] = $this->l('Could not create the media directory.');
$this->ajaxDie(json_encode($response));
}
$ext = strtolower(pathinfo($replacementFile['name'], PATHINFO_EXTENSION));
$isGif = ($ext === 'gif');
$outExt = $isGif ? 'gif' : 'jpg';
do {
$newImageName = bin2hex(random_bytes(16)).'.'.$outExt;
} while (file_exists(_PS_IMG_DIR_.'hotel_header_media/'.$newImageName));
$destPath = _PS_IMG_DIR_.'hotel_header_media/'.$newImageName;
$saved = $isGif ? (bool)move_uploaded_file($replacementFile['tmp_name'], $destPath) : (bool)ImageManager::resize($replacementFile['tmp_name'], $destPath);
if (!$saved) {
$response['errors'][] = $this->l('Failed to save image file.');
$this->ajaxDie(json_encode($response));
}
}
$oldImageName = $objImage->name;
$objImage->title = $titleByLang;
$objImage->description = $descriptionByLang;
$objImage->description_color = $descriptionColor;
$objImage->description_font_size = $descriptionFontSize;
$objImage->description_font_weight = $descriptionFontWeight;
if ($newImageName) {
$objImage->name = $newImageName;
}
if (!$objImage->save()) {
if ($newImageName && file_exists($destPath)) {
unlink($destPath);
}
$response['errors'][] = $this->l('Failed to update image.');
$this->ajaxDie(json_encode($response));
}
if ($newImageName) {
$oldPath = _PS_IMG_DIR_.'hotel_header_media/'.$oldImageName;
if (file_exists($oldPath)) {
unlink($oldPath);
}
}
$defaultLangId = (int)Configuration::get('PS_LANG_DEFAULT');
$response['success'] = true;
$response['active'] = (int)$objImage->active;
$response['confirmations'] = $this->l('Image updated successfully.');
$response['title'] = isset($titleByLang[$defaultLangId]) ? $titleByLang[$defaultLangId] : '';
$response['titles_json'] = json_encode((object)$titleByLang);
$response['description'] = isset($descriptionByLang[$defaultLangId]) ? $descriptionByLang[$defaultLangId] : '';
$response['descriptions_json'] = json_encode((object)$descriptionByLang);
$response['description_color'] = $descriptionColor;
$response['description_font_size'] = $descriptionFontSize;
$response['description_font_weight'] = $descriptionFontWeight;
if ($newImageName) {
$shopId = (int)$this->context->shop->id;
$srcPath = _PS_IMG_DIR_.'hotel_header_media/'.$newImageName;
$cacheName = 'htl_header_image_mini_'.$id.'_'.$shopId.'.jpg';
$response['thumb'] = ImageManager::thumbnail($srcPath, $cacheName, 45, 'jpg', true, true);
$response['thumb_src'] = $this->context->link->getMediaLink(_PS_IMG_.'hotel_header_media/'.$newImageName).'?'.time();
}
$this->ajaxDie(json_encode($response));
}
public function ajaxProcessDeleteMedia()
{
$response = array('errors' => array(), 'success' => false);
$id = (int)Tools::getValue('id_header_image');
if (!$id) {
$response['errors'][] = $this->l('Invalid item ID.');
$this->ajaxDie(json_encode($response));
}
$objImage = new HotelHeaderImage($id);
if (!Validate::isLoadedObject($objImage)) {
$response['errors'][] = $this->l('Image not found.');
$this->ajaxDie(json_encode($response));
}
if ($objImage->active) {
$activeImages = HotelHeaderImage::getItems(1);
if (is_array($activeImages) && count($activeImages) <= 1) {
$response['errors'][] = $this->l('At least one active image is required');
$this->ajaxDie(json_encode($response));
}
}
if (!$objImage->delete()) {
$response['errors'][] = $this->l('Unable to delete image.');
$this->ajaxDie(json_encode($response));
}
$response['success'] = true;
$response['confirmations'] = $this->l('Image deleted successfully.');
$this->ajaxDie(json_encode($response));
}
public function ajaxProcessDeleteVideo()
{
$response = array('errors' => array(), 'success' => false);
if (!HotelHeaderImage::getVideoConfig()) {
$response['errors'][] = $this->l('No video is currently set.');
$this->ajaxDie(json_encode($response));
}
HotelHeaderImage::deleteVideoConfig();
$response['success'] = true;
$response['confirmations'] = $this->l('Video deleted successfully.');
$this->ajaxDie(json_encode($response));
}
public function ajaxProcessToggleImageActive()
{
$response = array('errors' => array(), 'success' => false);
$id = (int)Tools::getValue('id_header_image');
$active = (int)(bool)Tools::getValue('active');
if (!$id) {
$response['errors'][] = $this->l('Invalid item ID.');
$this->ajaxDie(json_encode($response));
}
$objImage = new HotelHeaderImage($id);
if (!Validate::isLoadedObject($objImage)) {
$response['errors'][] = $this->l('Image not found.');
$this->ajaxDie(json_encode($response));
}
if ($active === 0) {
$activeImages = HotelHeaderImage::getItems(1);
if (is_array($activeImages) && count($activeImages) <= 1) {
$response['errors'][] = $this->l('At least one image must remain active.');
$this->ajaxDie(json_encode($response));
}
}
$objImage->active = $active;
if (!$objImage->save()) {
$response['errors'][] = $this->l('Unable to update active status.');
$this->ajaxDie(json_encode($response));
}
$response['success'] = true;
$response['confirmations'] = $this->l('The status has been successfully updated.');
$this->ajaxDie(json_encode($response));
}
public function ajaxProcessSaveImagePositions()
{
$ids = Tools::getValue('image_ids', array());
if (!is_array($ids)) {
$this->ajaxDie(json_encode(array('success' => false)));
}
foreach ($ids as $position => $id) {
$objImage = new HotelHeaderImage((int)$id);
if (!Validate::isLoadedObject($objImage)) {
$this->ajaxDie(json_encode(array('success' => false, 'errors' => array($this->l('One or more image IDs are invalid.')))));
}
$objImage->position = (int)$position;
$objImage->update();
}
$this->ajaxDie(json_encode(array(
'success' => true,
'confirmations' => $this->l('The selected images have successfully been moved.'),
)));
}
public function ajaxProcessBulkUpdateImages()
{
$response = array('errors' => array(), 'success' => false);
$ids = array_values(array_unique(array_filter(array_map('intval', (array)Tools::getValue('id_header_image', array())))));
if (!$ids) {
$response['errors'][] = $this->l('No images selected.');
$this->ajaxDie(json_encode($response));
}
$activeVal = Tools::getValue('active', '');
if ($activeVal !== '' && !in_array($activeVal, array('0', '1'))) {
$response['errors'][] = $this->l('Invalid status selected.');
$this->ajaxDie(json_encode($response));
}
if ($activeVal === '0') {
$activeImages = HotelHeaderImage::getItems(1);
$activeIds = array_map('intval', array_column($activeImages, 'id_header_image'));
$activeToDisable = array_intersect($ids, $activeIds);
if (count($activeIds) - count($activeToDisable) < 1) {
$response['errors'][] = $this->l('At least one image must remain active.');
$this->ajaxDie(json_encode($response));
}
}
$updateTitle = (bool)Tools::getValue('update_title', false);
$titleByLang = array();
if ($updateTitle) {
foreach (Language::getLanguages(false) as $lang) {
$titleByLang[$lang['id_lang']] = trim(Tools::getValue('title_'.$lang['id_lang'], ''));
}
foreach ($titleByLang as $titleValue) {
if (!Validate::isGenericName($titleValue)) {
$response['errors'][] = $this->l('Invalid title. Characters < > = { } are not allowed.');
$this->ajaxDie(json_encode($response));
}
if (Tools::strlen($titleValue) > HotelHeaderImage::TITLE_LIMIT) {
$response['errors'][] = sprintf($this->l('Title is too long: %d chars max.'), HotelHeaderImage::TITLE_LIMIT);
$this->ajaxDie(json_encode($response));
}
}
}
$updateDescription = (bool)Tools::getValue('update_description', false);
$descriptionByLang = array();
if ($updateDescription) {
$descriptionLimit = (int)Configuration::get('PS_SHORT_DESC_LIMIT') ?: Configuration::PS_SHORT_DESC_LIMIT;
foreach (Language::getLanguages(false) as $lang) {
$descriptionByLang[$lang['id_lang']] = trim(Tools::getValue('description_'.$lang['id_lang'], ''));
}
foreach ($descriptionByLang as $descriptionValue) {
if (!Validate::isGenericName($descriptionValue)) {
$response['errors'][] = $this->l('Invalid description. Characters < > = { } are not allowed.');
$this->ajaxDie(json_encode($response));
}
if (Tools::strlen($descriptionValue) > $descriptionLimit) {
$response['errors'][] = sprintf($this->l('Description is too long: %d chars max.'), $descriptionLimit);
$this->ajaxDie(json_encode($response));
}
}
}
$descriptionColor = trim(Tools::getValue('description_color', ''));
if ($descriptionColor !== '' && !preg_match('/^#[0-9a-fA-F]{6}$/', $descriptionColor)) {
$response['errors'][] = $this->l('Invalid description color. Use a 6-digit hex value (e.g. #ffffff).');
$this->ajaxDie(json_encode($response));
}
$descriptionFontSize = (int)Tools::getValue('description_font_size', 0);
if ($descriptionFontSize !== 0 && ($descriptionFontSize < 8 || $descriptionFontSize > 72)) {
$response['errors'][] = $this->l('Description font size must be between 8 and 72 pixels.');
$this->ajaxDie(json_encode($response));
}
$descriptionFontWeight = Tools::getValue('description_font_weight', '');
if ($descriptionFontWeight !== '' && !in_array($descriptionFontWeight, array('400', '700'))) {
$response['errors'][] = $this->l('Invalid description font weight.');
$this->ajaxDie(json_encode($response));
}
$defaultLangId = (int)Configuration::get('PS_LANG_DEFAULT');
$updatedRows = array();
foreach ($ids as $id) {
$objImage = new HotelHeaderImage($id);
if (!Validate::isLoadedObject($objImage)) {
continue;
}
if ($activeVal !== '') {
$objImage->active = (int)$activeVal;
}
if ($updateTitle) {
$objImage->title = $titleByLang;
}
if ($updateDescription) {
$objImage->description = $descriptionByLang;
}
if ($descriptionColor !== '') {
$objImage->description_color = $descriptionColor;
}
if ($descriptionFontSize !== 0) {
$objImage->description_font_size = $descriptionFontSize;
}
if ($descriptionFontWeight !== '') {
$objImage->description_font_weight = $descriptionFontWeight;
}
$objImage->save();
$currentTitles = is_array($objImage->title) ? $objImage->title : array();
$currentDescriptions = is_array($objImage->description) ? $objImage->description : array();
$updatedRows[] = array(
'id' => (int)$objImage->id,
'active' => (int)$objImage->active,
'title' => isset($currentTitles[$defaultLangId]) ? $currentTitles[$defaultLangId] : '',
'titles_json' => json_encode((object)$currentTitles),
'description' => isset($currentDescriptions[$defaultLangId]) ? $currentDescriptions[$defaultLangId] : '',
'descriptions_json' => json_encode((object)$currentDescriptions),
'description_color' => $objImage->description_color,
'description_font_size' => $objImage->description_font_size,
'description_font_weight' => $objImage->description_font_weight,
);
}
if (!$updatedRows) {
$response['errors'][] = $this->l('No valid images were updated.');
$this->ajaxDie(json_encode($response));
}
$response['success'] = true;
$response['data']['rows'] = $updatedRows;
$response['confirmations'] = $this->l('Selected images updated successfully.');
$this->ajaxDie(json_encode($response));
}
public function setMedia()
{
parent::setMedia();
$this->addJqueryPlugin('tablednd');
$this->addJqueryPlugin('colorpicker');
$adminJsPath = _PS_MODULE_DIR_.'hotelreservationsystem/views/js/admin/qhrs_hotel_header_image_admin.js';
$this->addJS(_MODULE_DIR_.'hotelreservationsystem/views/js/admin/qhrs_hotel_header_image_admin.js?'.@filemtime($adminJsPath));
$this->addCSS(_MODULE_DIR_.'hotelreservationsystem/views/css/HotelReservationAdmin.css');
$this->addCSS(_MODULE_DIR_.'hotelreservationsystem/views/css/admin/qhrs_header_media.css');
}
}

View File

@@ -1162,7 +1162,7 @@ public function ajaxProcessGetCalenderData()
// add fullcalender plugin
$this->addJqueryUI('ui.tooltip', 'base', true);
$this->removeJS(Media::getJqueryUIPath('effects.core', 'base', false), false);
$this->removeJS(Media::getJqueryUIPath('ui.effect', 'base', false), false);
$this->addCSS(array(_MODULE_DIR_.'hotelreservationsystem/views/css/HotelReservationAdmin.css'));
$this->addCSS(_PS_JS_DIR_.'fullcalendar/main.css');

View File

@@ -692,7 +692,7 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
if ($this->display == 'view') {
$this->addJqueryUI('ui.tooltip', 'base', true);
$this->removeJS(Media::getJqueryUIPath('effects.core', 'base', false), false);
$this->removeJS(Media::getJqueryUIPath('ui.effect', 'base', false), false);
$this->addJs(_MODULE_DIR_.$this->module->name.'/views/js/admin/wk_refund_request.js');
$this->addCSS(_MODULE_DIR_.$this->module->name.'/views/css/admin/wk_refund_request.css');

View File

@@ -56,6 +56,7 @@ require_once 'classes/ServiceProductOption.php';
require_once 'classes/HotelSettingsLink.php';
require_once 'classes/HotelBookingDocument.php';
require_once 'classes/HotelHeaderImage.php';
// Web services classes
require_once 'classes/WebserviceSpecificManagementHotelAri.php';

View File

@@ -71,7 +71,45 @@ class HotelReservationSystem extends Module
}
}
//End
$this->context->controller->addCSS($this->_path.'/views/css/HotelReservationFront.css');
if (Tools::getValue('controller') == 'index') {
$headerMediaFrontJs = _PS_MODULE_DIR_.'hotelreservationsystem/views/js/qhrs_hotel_header_media_front.js';
$this->context->controller->addJS($this->_path.'views/js/qhrs_hotel_header_media_front.js?'.@filemtime($headerMediaFrontJs));
$mediaTypeInt = (int)(Configuration::get('QLO_HEADER_MEDIA_TYPE') ?: HotelHeaderImage::MEDIA_TYPE_IMAGE);
if ($mediaTypeInt === HotelHeaderImage::MEDIA_TYPE_VIDEO) {
$videoConfig = HotelHeaderImage::getVideoConfig();
if ($videoConfig) {
$mimeMap = array('mp4' => 'video/mp4', 'webm' => 'video/webm', 'ogg' => 'video/ogg');
if ($videoConfig['source_type'] === 'upload') {
$ext = strtolower(pathinfo($videoConfig['name'], PATHINFO_EXTENSION));
} else {
$urlPath = parse_url($videoConfig['name'], PHP_URL_PATH);
$ext = strtolower(pathinfo($urlPath ?: '', PATHINFO_EXTENSION));
}
$videoConfig['mime_type'] = isset($mimeMap[$ext]) ? $mimeMap[$ext] : 'video/mp4';
$headerMediaItems = array($videoConfig);
} else {
$headerMediaItems = array();
}
} else {
$headerMediaItems = HotelHeaderImage::getItems();
}
$this->context->smarty->assign(array(
'QLO_HEADER_MEDIA_TYPE' => $mediaTypeInt,
'QLO_HEADER_MEDIA_TYPE_IMAGE' => HotelHeaderImage::MEDIA_TYPE_IMAGE,
'QLO_HEADER_MEDIA_TYPE_VIDEO' => HotelHeaderImage::MEDIA_TYPE_VIDEO,
'WK_HEADER_NAV_TYPE_DOTS' => HotelHeaderImage::NAV_TYPE_DOTS,
'QLO_HEADER_ANIM_TYPE_SLIDE' => HotelHeaderImage::ANIMATION_TYPE_SLIDE,
'headerMediaItems' => $headerMediaItems,
'headerSliderConfig' => array(
'nav_type' => (int)(Configuration::get('QLO_HEADER_SLIDER_NAV_TYPE') ?: HotelHeaderImage::NAV_TYPE_ARROWS),
'auto_play' => (int)Configuration::get('QLO_HEADER_SLIDER_AUTO_PLAY'),
'interval' => (int)Configuration::get('QLO_HEADER_SLIDER_INTERVAL'),
'anim_type' => (int)(Configuration::get('QLO_HEADER_SLIDER_ANIM_TYPE') ?: HotelHeaderImage::ANIMATION_TYPE_SLIDE),
),
));
}
$this->context->controller->addCSS($this->_path.'/views/css/qhrs_header_media.css');
$this->context->controller->addJS($this->_path.'/views/js/HotelReservationFront.js');
}
@@ -261,12 +299,19 @@ class HotelReservationSystem extends Module
public function hookDisplayAfterHookTop()
{
if (Tools::getValue('controller') == 'index') {
$this->context->smarty->assign(
array(
'WK_HTL_CHAIN_NAME' => Configuration::get('WK_HTL_CHAIN_NAME', $this->context->language->id),
'WK_HTL_TAG_LINE' => Configuration::get('WK_HTL_TAG_LINE', $this->context->language->id),
)
);
$headerMediaItems = $this->context->smarty->getTemplateVars('headerMediaItems');
$firstItem = ($headerMediaItems && !empty($headerMediaItems[0])) ? $headerMediaItems[0] : array();
$this->context->smarty->assign(array(
'wkHeaderMediaTitle' => !empty($firstItem['title']) ? $firstItem['title'] : '',
'wkHeaderMediaDescription' => !empty($firstItem['description']) ? $firstItem['description'] : '',
'wkDescriptionColor' => !empty($firstItem['description_color']) ? $firstItem['description_color'] : '#ffffff',
'wkDescriptionFontSize' => !empty($firstItem['description_font_size']) ? (int)$firstItem['description_font_size'] : 16,
'wkDescriptionFontWeight' => !empty($firstItem['description_font_weight']) ? $firstItem['description_font_weight'] : '400',
'wkHeaderContentAlign' => (int)(Configuration::get('QLO_HEADER_CONTENT_ALIGN') ?: HotelHeaderImage::CONTENT_ALIGN_CENTER),
'QLO_HEADER_MEDIA_TYPE' => (int)(Configuration::get('QLO_HEADER_MEDIA_TYPE') ?: HotelHeaderImage::MEDIA_TYPE_IMAGE),
'QLO_HEADER_MEDIA_TYPE_IMAGE' => HotelHeaderImage::MEDIA_TYPE_IMAGE,
'QLO_HEADER_MEDIA_TYPE_VIDEO' => HotelHeaderImage::MEDIA_TYPE_VIDEO,
));
return $this->display(__FILE__, 'headerHotelDescBlock.tpl');
}
}
@@ -414,7 +459,6 @@ class HotelReservationSystem extends Module
// update configuration keys
$configKeys = array(
'WK_HTL_CHAIN_NAME',
'WK_HTL_TAG_LINE',
'WK_HTL_SHORT_DESC',
);
HotelHelper::updateConfigurationLangKeys($newIdLang, $configKeys);
@@ -448,6 +492,7 @@ class HotelReservationSystem extends Module
// Controllers without tabs
$this->installTab('AdminHotelGeneralSettings', 'Hotel General Configuration', 'AdminHotelConfigurationSetting', false);
$this->installTab('AdminHotelFeaturePricesSettings', 'Advanced Price Rules', 'AdminHotelConfigurationSetting', false);
$this->installTab('AdminHotelHeaderImage', 'Header Image Configuration', 'AdminHotelConfigurationSetting', false);
$this->installTab('AdminBookingDocument', 'Booking Documents', false, false);
$this->installTab('AdminHotelImageCategory', 'Hotel Image Category', false, false);
@@ -555,9 +600,10 @@ class HotelReservationSystem extends Module
'WK_ROOM_LEFT_WARNING_NUMBER',
'WK_HTL_ESTABLISHMENT_YEAR',
'WK_HTL_CHAIN_NAME',
'WK_HTL_TAG_LINE',
'WK_TITLE_HEADER_BLOCK',
'WK_CONTENT_HEADER_BLOCK',
'WK_HTL_HEADER_IMAGE',
'WK_HOTEL_HEADER_IMAGE',
'WK_ALLOW_ADVANCED_PAYMENT',
'WK_ADVANCED_PAYMENT_GLOBAL_MIN_AMOUNT',
'WK_ADVANCED_PAYMENT_INC_TAX',
@@ -567,6 +613,14 @@ class HotelReservationSystem extends Module
'WK_CUSTOMER_SUPPORT_PHONE_NUMBER',
'WK_CUSTOMER_SUPPORT_EMAIL',
'WK_DISPLAY_CONTACT_PAGE_HOTEL_LIST',
'QLO_HEADER_MEDIA_TYPE',
'QLO_HEADER_CONTENT_ALIGN',
'QLO_HEADER_VIDEO_SOURCE_TYPE',
'QLO_HEADER_VIDEO_NAME',
'QLO_HEADER_SLIDER_NAV_TYPE',
'QLO_HEADER_SLIDER_AUTO_PLAY',
'QLO_HEADER_SLIDER_INTERVAL',
'QLO_HEADER_SLIDER_ANIM_TYPE',
'QLO_USE_TOURISM_TAX',
'QLO_TOURISM_TAX_GROSSED_UP',
);

View File

@@ -1,82 +0,0 @@
/* ===== headerHotelDescBlock.tpl ===== */
.header-desc-container {
bottom: 0;
left: 0;
position: absolute;
right: 0;
top: 0;
z-index: -10;
/*height: 100%;*/
}
.header-desc-wrapper {
display: table;
height: 100%;
width: 100%;
}
.header-desc-primary {
display: table-cell;
vertical-align: middle;
text-align: center;
color: #FFFFFF;
}
.header-desc-welcome{
font-size: 18px;
font-weight: 300;
margin: 0;
}
.header-desc-primary hr {
margin-bottom: 10px;
}
.heasder-desc-hr-first {
width: 42px;
margin-top: 10px;
}
.header-hotel-name {
font-size: 55px;
font-weight: 400;
margin-top: 5px;
margin-bottom: 25px;
}
.header-hotel-desc {
font-size: 400;
font-size: 18px;
line-height: 24px;
}
.heasder-desc-hr-second {
width: 190px;
margin-top: 30px;
}
@media (max-width: 767px) {
.topSubSecondaryBlock {
margin-top: 0px; } }
/* ===== headerHotelDescBlock.tpl ===== */
.copyRightWrapper {
background-color: #242424;
padding: 30px;
}
.copyRightWrapper p {
color: #868686;
font-size: 16px;
font-weight: 400;
margin: 0;
text-align: center;
}
.copyRightWrapper {
background-color: #242424;
padding: 30px;
width: 100%; }
.copyRightWrapper .copyRight {
color: #868686;
font-size: 16px;
margin: 0;
text-align: center;
line-height: 23px; }

View File

@@ -0,0 +1,64 @@
/**
* 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
*/
.qlo-video-preview-card {
background: #111;
border-radius: 4px;
overflow: hidden;
margin-bottom: 10px;
max-width: 480px;
display: inline-block;
vertical-align: top;
width: 100%;
}
.qlo-video-preview-player {
display: block;
width: 100%;
max-height: 240px;
background: #000;
}
.qlo-img-thumb {
width: 120px;
height: 75px;
-o-object-fit: cover;
object-fit: cover;
display: block;
}
#qlo-image-table tbody tr.qlo-img-row:hover {
background-color: #f9f9f9;
}
.qlo-img-tagline-cell {
max-width: 220px;
color: #555;
vertical-align: middle !important;
}
#qlo-img-edit-thumb {
max-width: 160px;
max-height: 100px;
object-fit: cover;
border-radius: 3px;
}

View File

@@ -0,0 +1,217 @@
/**
* 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-ext-dots {
position: absolute;
bottom: 120px;
left: 0;
right: 0;
text-align: center;
z-index: 15;
pointer-events: none;
}
.header-ext-dots .owl-dot {
display: inline-block;
margin: 0 5px;
cursor: pointer;
pointer-events: all;
}
.header-ext-dots .owl-dot span {
display: block;
width: 10px;
height: 10px;
border-radius: 50%;
background: rgba(255, 255, 255, 0.5);
border: 1px solid rgba(255, 255, 255, 0.8);
transition: background 0.25s ease;
}
.header-ext-dots .owl-dot.active span,
.header-ext-dots .owl-dot:hover span {
background: #ffffff;
}
/* ===== Content alignment (1=left, 2=center, 3=right) ===== */
.header-align-1 { text-align: left; }
.header-align-2 { text-align: center; }
.header-align-3 { text-align: right; }
.header-align-1 .heasder-desc-hr-second { margin-left: 0; margin-right: auto; }
.header-align-3 .heasder-desc-hr-second { margin-left: auto; margin-right: 0; }
/* ===== headerHotelDescBlock.tpl ===== */
.header-desc-container {
bottom: 0;
left: 0;
position: absolute;
right: 0;
top: 0;
z-index: -10;
/*height: 100%;*/
}
.header-bg-video {
min-height: 100%;
}
.header-desc-wrapper {
display: table;
height: 100%;
width: 100%;
}
.header-desc-primary {
display: table-cell;
vertical-align: middle;
text-align: center;
color: #FFFFFF;
}
.header-desc-primary hr {
margin-bottom: 10px;
}
.header-hotel-name {
font-size: 55px;
font-weight: 400;
margin-top: 5px;
margin-bottom: 25px;
}
.header-hotel-desc {
font-size: 400;
font-size: 18px;
line-height: 24px;
}
.heasder-desc-hr-second {
display: none;
}
/* Owl carousel slide animation classes */
.wkFadeOut { animation: wkFadeOut 0.7s forwards; }
.wkFadeIn { animation: wkFadeIn 0.7s forwards; }
.wkZoomOut { animation: wkZoomOut 0.7s forwards; }
.wkZoomIn { animation: wkZoomIn 0.7s forwards; }
.wkBlurOut { animation: wkBlurOut 0.7s forwards; }
.wkBlurIn { animation: wkBlurIn 0.7s forwards; }
.wkSlideOut { animation: wkSlideOut 0.7s forwards; }
.wkSlideIn { animation: wkSlideIn 0.7s forwards; }
@keyframes wkFadeOut { from { opacity:1; } to { opacity:0; } }
@keyframes wkFadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes wkZoomOut { from { opacity:1; transform:scale(1); } to { opacity:0; transform:scale(1.15); } }
@keyframes wkZoomIn { from { opacity:0; transform:scale(0.88); } to { opacity:1; transform:scale(1); } }
@keyframes wkBlurOut { from { opacity:1; filter:blur(0); } to { opacity:0; filter:blur(10px); } }
@keyframes wkBlurIn { from { opacity:0; filter:blur(10px); } to { opacity:1; filter:blur(0); } }
@keyframes wkSlideOut { from { opacity:1; transform:translateX(0); } to { opacity:0; transform:translateX(-60px); } }
@keyframes wkSlideIn { from { opacity:0; transform:translateX(60px); } to { opacity:1; transform:translateX(0); } }
/* Description slide animation on slide change */
.js-header-description {
transition: opacity 0.4s ease, transform 0.4s ease;
}
.js-header-description.wk-tagline-out {
opacity: 0;
transform: translateY(-10px);
}
.js-header-description.wk-tagline-in {
opacity: 1;
transform: translateY(0);
}
.header-media-layer {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -11;
overflow: hidden;
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
}
.header-media-layer::after {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1;
pointer-events: none;
}
.header-media-layer .owl-carousel,
.header-media-layer .owl-stage-outer,
.header-media-layer .owl-stage,
.header-media-layer .owl-item {
height: 100%;
}
.header-slide-img {
width: 100%;
height: 100%;
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
}
.header-media-nav-wrapper {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 15;
pointer-events: none;
}
.header-media-btn {
position: absolute;
top: 50%;
transform: translateY(-50%);
pointer-events: all;
background: rgba(0, 0, 0, 0.4);
color: #fff;
border: none;
border-radius: 2px;
padding: 8px 14px;
font-size: 20px;
line-height: 1;
cursor: pointer;
transition: background 0.2s;
outline: none;
}
.header-media-btn:hover {
background: rgba(0, 0, 0, 0.65);
color: #fff;
}
.js-header-media-prev {
left: 15px;
}
.js-header-media-next {
right: 15px;
}

View File

@@ -0,0 +1,682 @@
/**
* 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
*/
$(document).ready(function () {
$('#qlo-media-type').on('change', function () {
var type = parseInt($(this).val(), 10);
if (type === qloHmMediaTypeImage) {
$('#qlo-video-settings').hide();
$('#qlo-image-settings, #qlo-image-panel, #qlo-slider-info').show();
closeImgForm();
} else {
closeImgForm();
$('#qlo-image-settings, #qlo-image-panel, #qlo-slider-info').hide();
$('#qlo-video-settings').show();
}
});
$('#qlo-header-media-form').on('submit', function (e) {
var newType = parseInt($('#qlo-media-type').val(), 10);
if (newType === qloHmMediaTypeVideo && qloHmMediaType === qloHmMediaTypeImage) {
var imageCount = $('#qlo-image-tbody .qlo-img-row').length;
if (imageCount > 1 && $('#qlo-confirm-delete-images').val() !== '1') {
e.preventDefault();
$('#qlo-confirm-switch-video-modal').modal('show');
return false;
}
}
});
$('#qlo-confirm-switch-video-btn').on('click', function () {
$('#qlo-confirm-switch-video-modal').modal('hide');
$('#qlo-confirm-delete-images').val('1');
$('#qlo-header-media-form')[0].submit();
});
var pendingBulkDeleteForm = null;
var pendingBulkDeleteAction = null;
var editImagePreviewUrl = null;
function revokeEditImagePreview() {
if (editImagePreviewUrl) {
URL.revokeObjectURL(editImagePreviewUrl);
editImagePreviewUrl = null;
}
}
$(document).on('click', '.qlo-bulk-delete-images-trigger', function (e) {
e.preventDefault();
pendingBulkDeleteForm = $(this).closest('form').get(0);
pendingBulkDeleteAction = $(this).data('action');
$('#qlo-confirm-bulk-delete-modal').modal('show');
});
$('#qlo-confirm-bulk-delete-btn').on('click', function () {
$('#qlo-confirm-bulk-delete-modal').modal('hide');
if (pendingBulkDeleteForm && pendingBulkDeleteAction) {
sendBulkAction(pendingBulkDeleteForm, pendingBulkDeleteAction);
}
});
$(document).on('change', 'input[name="QLO_HEADER_SLIDER_AUTO_PLAY"]', function () {
if ($(this).val() === '1') {
$('#qlo-slide-interval-group').show(200);
} else {
$('#qlo-slide-interval-group').hide(200);
}
});
hideOtherLanguage(qloHmDefaultLangId);
function updateImgFileNameHm(files) {
var names = [];
for (var i = 0; files && i < files.length; i++) {
names.push(files[i].name);
}
$('#qlo-img-form-file-name').val(names.join(', '));
}
$('#qlo-img-form-file-selectbutton, #qlo-img-form-file-name').on('click', function () {
$('#qlo-img-form-file').trigger('click');
});
$('#qlo-img-form-file-name').on('dragenter dragover', function (e) {
e.stopPropagation();
e.preventDefault();
});
$('#qlo-img-form-file-name').on('drop', function (e) {
e.preventDefault();
var files = e.originalEvent.dataTransfer.files;
document.getElementById('qlo-img-form-file').files = files;
updateImgFileNameHm(files);
});
$('#qlo-img-form-file').on('change', function () {
updateImgFileNameHm(this.files);
});
$('#qlo-img-edit-file-selectbutton, #qlo-img-edit-file-name').on('click', function () {
$('#qlo-img-edit-file').trigger('click');
});
$('#qlo-img-edit-file').on('change', function () {
var file = this.files && this.files[0] ? this.files[0] : null;
$('#qlo-img-edit-file-name').val(file ? file.name : '');
revokeEditImagePreview();
if (file) {
editImagePreviewUrl = URL.createObjectURL(file);
$('#qlo-img-edit-thumb').attr('src', editImagePreviewUrl);
$('#qlo-img-edit-preview-group').show();
}
});
$(document).on('change', '#qlo-source-type', function () {
if ($(this).val() === 'url') {
$('#qlo-vid-file-wrap').hide();
$('#qlo-vid-url-wrap').show();
$('#qlo-current-video-wrap').hide();
} else {
$('#qlo-vid-file-wrap').show();
$('#qlo-vid-url-wrap').hide();
if ($('#qlo-current-video-wrap').length) {
$('#qlo-current-video-wrap').show();
}
}
});
$(document).on('change', '#qlo-video-file-input', function () {
var file = this.files && this.files[0] ? this.files[0] : null;
var $hint = $('.qlo-vid-filename');
if (file && typeof qloHmMaxVideoUpload !== 'undefined' && qloHmMaxVideoUpload > 0 && file.size > qloHmMaxVideoUpload) {
this.value = '';
$hint.hide();
showErrorMessage(qloHmI18n.fileTooLarge);
return;
}
if (file) {
$hint.text(file.name).show();
} else {
$hint.hide();
}
});
$(document).on('click', '#qlo-vid-file-add-btn', function () {
$('#qlo-video-file-input').trigger('click');
});
var videoUrlMimeMap = { mp4: 'video/mp4', webm: 'video/webm', ogg: 'video/ogg' };
$(document).on('input change', '#qlo-video-url-input', function () {
var url = $.trim($(this).val());
var $wrap = $('#qlo-video-url-preview-wrap');
var $player = $('#qlo-video-url-preview-player')[0];
var $source = $('#qlo-video-url-preview-source');
if (!/^https?:\/\//i.test(url)) {
$wrap.hide();
return;
}
var ext = (url.split('?')[0].split('.').pop() || '').toLowerCase();
$source.attr('src', url);
$source.attr('type', videoUrlMimeMap[ext] || 'video/mp4');
if ($player) { $player.load(); }
$wrap.show();
});
$('#qlo-add-image-btn').on('click', function () {
openImgForm('add');
});
$(document).on('click', '.qlo-edit-img', function () {
var $row = $(this).closest('tr.qlo-img-row');
var id = parseInt($row.data('id'), 10);
var titles = $row.data('titles') || {};
var descriptions = $row.data('descriptions') || {};
var isActive = $row.find('.js-toggle-active').hasClass('action-enabled');
var thumbSrc = $row.attr('data-thumb-src') || '';
var descColor = $row.attr('data-description-color') || '#ffffff';
var descFontSize = parseInt($row.attr('data-description-font-size') || 16, 10);
var descFontWeight = $row.attr('data-description-font-weight') || '400';
openImgForm('edit', id, titles, descriptions, isActive, thumbSrc, descColor, descFontSize, descFontWeight);
});
function updateBulkUpdateTriggerState() {
$('#qlo-bulk-update-trigger').attr('disabled', !$('.qlo-img-checkbox:checked').length);
}
$(document).on('change', '.qlo-img-checkbox', updateBulkUpdateTriggerState);
$('.qlo-select-all-images, .qlo-unselect-all-images').on('click', updateBulkUpdateTriggerState);
$('#qlo-bulk-update-modal').on('show.bs.modal', function (e) {
if ($(e.relatedTarget).attr('disabled')) {
return false;
}
$('#qlo-bulk-active').val('');
$('#qlo_bulk_update_title_off').prop('checked', true);
$('#qlo-bulk-title-fields-wrap').hide();
$('.qlo-bulk-title-field').val('');
$('#qlo_bulk_update_description_off').prop('checked', true);
$('#qlo-bulk-description-fields-wrap').hide();
$('.qlo-bulk-description-field').val('');
$('#qlo-bulk-desc-color').val('').trigger('keyup');
$('#qlo-bulk-desc-font-size').val(0);
$('#qlo-bulk-desc-font-weight').val('');
hideOtherLanguage(qloHmDefaultLangId);
});
$(document).on('change', 'input[name="qlo_bulk_update_title"]', function () {
if ($(this).val() === '1') {
$('#qlo-bulk-title-fields-wrap').show(200);
} else {
$('#qlo-bulk-title-fields-wrap').hide(200);
}
});
$(document).on('change', 'input[name="qlo_bulk_update_description"]', function () {
if ($(this).val() === '1') {
$('#qlo-bulk-description-fields-wrap').show(200);
} else {
$('#qlo-bulk-description-fields-wrap').hide(200);
}
});
$('#qlo-bulk-update-apply').on('click', function () {
var ids = $('.qlo-img-checkbox:checked').map(function () { return $(this).val(); }).get();
var updateTitle = $('input[name="qlo_bulk_update_title"]:checked').val() === '1';
var updateDescription = $('input[name="qlo_bulk_update_description"]:checked').val() === '1';
var postData = {
ajax: 1, action: 'bulkUpdateImages', token: qloHmToken,
id_header_image: ids,
active: $('#qlo-bulk-active').val(),
update_title: updateTitle ? 1 : 0,
update_description: updateDescription ? 1 : 0,
description_color: $.trim($('#qlo-bulk-desc-color').val()),
description_font_size: $('#qlo-bulk-desc-font-size').val(),
description_font_weight: $('#qlo-bulk-desc-font-weight').val()
};
if (updateTitle) {
$('.qlo-bulk-title-field').each(function () {
postData['title_' + $(this).data('lang')] = $.trim($(this).val());
});
}
if (updateDescription) {
$('.qlo-bulk-description-field').each(function () {
postData['description_' + $(this).data('lang')] = $.trim($(this).val());
});
}
var $btn = $(this).prop('disabled', true);
$('#page-loader').show();
$.ajax({
url: qloHmCurrentIndex,
type: 'POST',
data: postData,
success: function (raw) {
$btn.prop('disabled', false);
var data = safeParseJsonHm(raw);
if (data && data.success) {
(data.data.rows || []).forEach(function (rowData) {
var $row = $('#qlo-image-tbody .qlo-img-row[data-id="' + rowData.id + '"]');
patchImageRow($row, rowData);
});
$('#qlo-bulk-update-modal').modal('hide');
showSuccessMessage(data.confirmations);
} else {
showErrorMessage(data ? data.errors.join('<br>') : qloHmI18n.updateFailed);
}
},
error: function () { $btn.prop('disabled', false); showErrorMessage(qloHmI18n.requestFailed); }
}).always(function () { $('#page-loader').hide(); });
});
$('#qlo-img-form-upload-btn').on('click', function () {
var fileInput = document.getElementById('qlo-img-form-file');
var files = fileInput ? Array.prototype.slice.call(fileInput.files) : [];
if (!files.length) {
showErrorMessage((typeof qloHmI18n !== 'undefined') ? qloHmI18n.noFileSelected : 'Please select at least one image file.');
return;
}
uploadImagesWithDetails(files);
});
$('#qlo-img-form-save-btn').on('click', function () {
var id = parseInt($.trim($('#qlo-img-form-id').val()), 10);
if (id) {
saveEditedImage(id);
}
});
$(document).on('click', '.qlo-img-row .js-toggle-active', function (e) {
e.preventDefault();
var $link = $(this);
var $row = $link.closest('tr.qlo-img-row');
var id = parseInt($row.data('id'), 10);
var active = $link.hasClass('action-enabled') ? 0 : 1;
$('#page-loader').show();
$.ajax({
url: qloHmCurrentIndex,
type: 'POST',
data: { ajax: 1, action: 'toggle_image_active', id_header_image: id, active: active, token: qloHmToken },
success: function (raw) {
var data = safeParseJsonHm(raw);
if (data && data.success) {
$link.toggleClass('action-enabled action-disabled');
$link.find('i').toggleClass('hidden');
showSuccessMessage(data.confirmations);
} else {
showErrorMessage(data ? data.errors.join('<br>') : qloHmI18n.updateFailed);
}
},
error: function () { showErrorMessage(qloHmI18n.requestFailed); }
}).always(function () { $('#page-loader').hide(); });
});
$(document).on('click', '.qlo-delete-img', function () {
var id = parseInt($(this).data('id'), 10);
$('#page-loader').show();
$.ajax({
url: qloHmCurrentIndex,
type: 'POST',
data: { ajax: 1, action: 'deleteMedia', id_header_image: id, token: qloHmToken },
success: function (raw) {
var data = safeParseJsonHm(raw);
if (data && data.success) {
var $row = $('#qlo-image-tbody .qlo-img-row[data-id="' + id + '"]');
if (parseInt($('#qlo-img-form-id').val(), 10) === id) {
closeImgForm();
}
$row.fadeOut(250, function () {
$row.remove();
var count = $('#qlo-image-tbody .qlo-img-row').length;
$('#qlo-image-count').text(count);
if (!count) {
$('#qlo-no-images').show();
}
updateBulkActionsVisibility();
});
showSuccessMessage(data.confirmations || qloHmI18n.deleteFailed);
} else {
showErrorMessage(data ? data.errors.join('<br>') : qloHmI18n.deleteFailed);
}
},
error: function () { showErrorMessage(qloHmI18n.requestFailed); }
}).always(function () { $('#page-loader').hide(); });
});
if ($('#qlo-image-table').length) {
var _hmDragOriginalOrder = null;
$('#qlo-image-table').tableDnD({
dragHandle: 'dragHandle',
onDragClass: 'myDragClass',
onDragStart: function (table) {
_hmDragOriginalOrder = [];
$(table).find('tbody tr.qlo-img-row').each(function () {
_hmDragOriginalOrder.push(parseInt($(this).data('id'), 10));
});
},
onDrop: function (table) {
var ids = [];
$(table).find('tbody tr.qlo-img-row').each(function (i) {
var id = parseInt($(this).data('id'), 10);
ids.push(id);
$(this).find('.positions').text(i + 1);
});
if (_hmDragOriginalOrder && JSON.stringify(ids) === JSON.stringify(_hmDragOriginalOrder)) {
return;
}
$('#page-loader').show();
$.post(qloHmCurrentIndex, {
ajax: 1,
action: 'saveImagePositions',
image_ids: ids,
token: qloHmToken
}, function (raw) {
var data = safeParseJsonHm(raw);
if (data && data.success) {
showSuccessMessage(data.confirmations);
}
}).always(function () { $('#page-loader').hide(); });
}
});
}
function openImgForm(mode, id, titles, descriptions, isActive, imgUrl, descColor, descFontSize, descFontWeight) {
$('#qlo-img-form-id').val(id || '');
$('#qlo-form-upload-progress').hide();
if (mode === 'edit') {
$('#qlo-img-modal-title-add').hide();
$('#qlo-img-modal-title-edit').show();
$('#qlo-img-add-footer').hide();
$('#qlo-img-edit-footer').show();
$('#qlo-img-form-file-group').hide();
$('#qlo-img-form-add-active-group').hide();
$('#qlo-img-form-edit-group').show();
$('#qlo-img-edit-file-group').show();
var editFileInput = document.getElementById('qlo-img-edit-file');
if (editFileInput) {
editFileInput.value = '';
}
$('#qlo-img-edit-file-name').val('');
revokeEditImagePreview();
if (isActive) {
$('#qlo_img_active_edit_on').prop('checked', true);
} else {
$('#qlo_img_active_edit_off').prop('checked', true);
}
titles = titles || {};
descriptions = descriptions || {};
$('.qlo-form-title-field').each(function () {
var langId = $(this).data('lang');
$(this).val(titles[langId] || '');
});
$('.qlo-form-description-field').each(function () {
var langId = $(this).data('lang');
$(this).val(descriptions[langId] || '');
});
if (imgUrl) {
$('#qlo-img-edit-thumb').attr('src', imgUrl);
$('#qlo-img-edit-preview-group').show();
} else {
$('#qlo-img-edit-preview-group').hide();
}
$('#qlo-img-desc-color').val(descColor || '#ffffff');
$('#qlo-img-desc-font-size').val(descFontSize || 16);
var fw = descFontWeight || '400';
$('#qlo-img-desc-font-weight').val(fw);
} else {
$('#qlo-img-modal-title-edit').hide();
$('#qlo-img-modal-title-add').show();
$('#qlo-img-edit-footer').hide();
$('#qlo-img-add-footer').show();
$('#qlo-img-form-file-group').show();
$('#qlo-img-form-add-active-group').show();
$('#qlo-img-form-edit-group').hide();
$('#qlo-img-edit-preview-group').hide();
$('#qlo-img-edit-file-group').hide();
var fileInput = document.getElementById('qlo-img-form-file');
if (fileInput) {
fileInput.value = '';
}
$('#qlo-img-form-file-name').val('');
$('#qlo_img_active_add_on').prop('checked', true);
$('.qlo-form-title-field').val('');
$('.qlo-form-description-field').val('');
$('#qlo-img-desc-color').val('#ffffff');
$('#qlo-img-desc-font-size').val(16);
$('#qlo-img-desc-font-weight').val('400');
}
$('#qlo-img-desc-color').trigger('keyup');
hideOtherLanguage(id_language);
$('#qlo-img-form-modal').modal('show');
}
function closeImgForm() {
$('#qlo-img-form-modal').modal('hide');
revokeEditImagePreview();
}
function getFormTitles() {
var titles = {};
$('.qlo-form-title-field').each(function () {
titles[$(this).data('lang')] = $.trim($(this).val());
});
return titles;
}
function getFormDescriptions() {
var descriptions = {};
$('.qlo-form-description-field').each(function () {
descriptions[$(this).data('lang')] = $.trim($(this).val());
});
return descriptions;
}
function saveEditedImage(id) {
var titles = getFormTitles();
var descriptions = getFormDescriptions();
var active = parseInt($('input[name="qlo_img_active_edit"]:checked').val() || 0, 10);
var descColor = $('#qlo-img-desc-color').val() || '#ffffff';
var descFontSize = parseInt($('#qlo-img-desc-font-size').val() || 16, 10);
var descFontWeight = $('#qlo-img-desc-font-weight').val() || '400';
var editFileInput = document.getElementById('qlo-img-edit-file');
var newFile = editFileInput && editFileInput.files && editFileInput.files[0] ? editFileInput.files[0] : null;
if (newFile && typeof qloHmMaxUpload !== 'undefined' && qloHmMaxUpload > 0 && newFile.size > qloHmMaxUpload) {
showErrorMessage(qloHmI18n.fileTooLarge);
return;
}
var fd = new FormData();
fd.append('ajax', '1');
fd.append('action', 'edit_image');
fd.append('id_header_image', id);
fd.append('active', active);
fd.append('token', qloHmToken);
fd.append('description_color', descColor);
fd.append('description_font_size', descFontSize);
fd.append('description_font_weight', descFontWeight);
$.each(titles, function (langId, val) {
fd.append('title_' + langId, val);
});
$.each(descriptions, function (langId, val) {
fd.append('description_' + langId, val);
});
if (newFile) {
fd.append('header_image_file', newFile);
}
$('#page-loader').show();
$.ajax({
url: qloHmCurrentIndex,
type: 'POST',
data: fd,
processData: false,
contentType: false,
success: function (raw) {
var resp = safeParseJsonHm(raw);
if (resp && resp.success) {
var $row = $('#qlo-image-tbody .qlo-img-row[data-id="' + id + '"]');
patchImageRow($row, $.extend({ id: id }, resp));
closeImgForm();
showSuccessMessage(resp.confirmations || qloHmI18n.imageUpdatedSuccess);
} else {
showErrorMessage(resp ? resp.errors.join('<br>') : qloHmI18n.updateFailed);
}
},
error: function () { showErrorMessage(qloHmI18n.requestFailed); }
}).always(function () { $('#page-loader').hide(); });
}
function uploadImagesWithDetails(files) {
var index = 0;
var titles = getFormTitles();
var descriptions = getFormDescriptions();
var active = parseInt($('input[name="qlo_img_active_add"]:checked').val() || 1, 10);
var descColor = $('#qlo-img-desc-color').val() || '#ffffff';
var descFontSize = parseInt($('#qlo-img-desc-font-size').val() || 16, 10);
var descFontWeight = $('#qlo-img-desc-font-weight').val() || '400';
$('#qlo-form-upload-progress').show();
$('#qlo-img-form-upload-btn').prop('disabled', true);
$('#page-loader').show();
function next() {
if (index >= files.length) {
$('#qlo-form-upload-progress').hide();
$('#qlo-img-form-upload-btn').prop('disabled', false);
$('#page-loader').hide();
closeImgForm();
return;
}
var file = files[index++];
if (typeof qloHmMaxUpload !== 'undefined' && qloHmMaxUpload > 0 && file.size > qloHmMaxUpload) {
showErrorMessage(qloHmI18n.fileTooLarge);
next();
return;
}
var fd = new FormData();
fd.append('header_image_file', file);
fd.append('ajax', '1');
fd.append('action', 'uploadImage');
fd.append('token', qloHmToken);
fd.append('active', active);
fd.append('description_color', descColor);
fd.append('description_font_size', descFontSize);
fd.append('description_font_weight', descFontWeight);
$.each(titles, function (langId, val) {
fd.append('title_' + langId, val);
});
$.each(descriptions, function (langId, val) {
fd.append('description_' + langId, val);
});
$.ajax({
url: qloHmCurrentIndex,
type: 'POST',
data: fd,
processData: false,
contentType: false,
success: function (raw) {
var resp = safeParseJsonHm(raw);
if (resp && resp.success) {
appendImageRow(resp.data.image_row);
showSuccessMessage(qloHmI18n.imageUploadedSuccess);
} else {
showErrorMessage(file.name + ': ' + (resp ? resp.errors.join(', ') : qloHmI18n.uploadFailed));
}
next();
},
error: function () {
showErrorMessage(file.name + ': ' + qloHmI18n.requestFailed);
next();
}
});
}
next();
}
function appendImageRow(rowHtml) {
$('#qlo-image-tbody').append(rowHtml);
$('#qlo-image-table').tableDnDUpdate();
$('#qlo-no-images').hide();
$('#qlo-image-count').text(parseInt($('#qlo-image-count').text(), 10) + 1);
updateBulkActionsVisibility();
}
function updateBulkActionsVisibility() {
var count = $('#qlo-image-tbody .qlo-img-row').length;
$('#qlo-bulk-actions-row').toggle(count > 1);
updateBulkUpdateTriggerState();
}
function patchImageRow($row, data) {
var id = parseInt(data.id, 10);
if (data.thumb) {
var $thumbCell = $row.find('.qlo-img-thumb-cell');
if (!$thumbCell.length) {
$thumbCell = $row.find('td').eq(1);
}
$thumbCell.html(data.thumb);
}
if (data.thumb_src) {
$row.attr('data-thumb-src', data.thumb_src);
}
var updatedTitles = safeParseJsonHm(data.titles_json) || {};
$row.attr('data-titles', data.titles_json);
$row.data('titles', updatedTitles);
var titleDisplay = data.title || '';
$row.find('.qlo-img-title-cell').text(
titleDisplay.length > 50 ? titleDisplay.substring(0, 50) + '...' : (titleDisplay || '—')
);
var updatedDescriptions = safeParseJsonHm(data.descriptions_json) || {};
$row.attr('data-descriptions', data.descriptions_json);
$row.data('descriptions', updatedDescriptions);
$row.attr('data-description-color', data.description_color || '#ffffff');
$row.attr('data-description-font-size', data.description_font_size || 16);
$row.attr('data-description-font-weight', data.description_font_weight || '400');
var descDisplay = data.description || '';
$row.find('.qlo-img-description-cell').text(
descDisplay.length > 50 ? descDisplay.substring(0, 50) + '...' : (descDisplay || '—')
);
var nowActive = parseInt(data.active, 10);
var $toggle = $row.find('.js-toggle-active');
$toggle.toggleClass('action-enabled', !!nowActive)
.toggleClass('action-disabled', !nowActive);
$toggle.find('i.icon-check').toggleClass('hidden', !nowActive);
$toggle.find('i.icon-remove').toggleClass('hidden', !!nowActive);
$toggle.attr('href', $toggle.attr('href').replace(/id_header_image=\d+/, 'id_header_image=' + id)
.replace(/active=\d+/, 'active=' + (nowActive ? 0 : 1)));
}
function safeParseJsonHm(raw) {
try { return JSON.parse(raw); } catch (_e) { return null; }
}
});

View File

@@ -0,0 +1,176 @@
/**
* 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
*/
$(document).ready(function () {
/* Background video autoplay fallback (handles strict browser autoplay policies) */
var $bgVideo = $('video.header-bg-video');
if ($bgVideo.length) {
$bgVideo.each(function () {
var vid = this;
vid.muted = true;
var p = vid.play();
if (p !== undefined) {
p.catch(function () {});
}
});
}
var $imgCarousel = $('.header-img-carousel');
if (!$imgCarousel.length) { return; }
var autoPlay = parseInt($imgCarousel.data('auto-play'), 10) === 1;
var interval = parseInt($imgCarousel.data('interval'), 10) || 5000;
var navType = parseInt($imgCarousel.data('nav-type'), 10) || 1; // 1=dots 2=arrows 3=both
var animType = parseInt($imgCarousel.data('anim-type'), 10) || 1; // 1=slide 2=fade 3=zoom 4=blur
var animNames = {1: 'Slide', 2: 'Fade', 3: 'Zoom', 4: 'Blur'};
var animLabel = animNames[animType] || 'Slide';
var showDots = (navType === 1 || navType === 3);
$imgCarousel.owlCarousel({
loop: true,
items: 1,
dots: showDots,
dotsContainer: showDots ? '#wk-header-owl-dots' : false,
nav: false,
autoplay: autoPlay,
autoplayTimeout: interval,
autoplaySpeed: 800,
autoplayHoverPause: false,
animateOut: 'wk' + animLabel + 'Out',
animateIn: 'wk' + animLabel + 'In',
responsiveClass: true,
rtl: (typeof language_is_rtl !== 'undefined' ? language_is_rtl : false)
});
var owl = $imgCarousel.data('owl.carousel');
var _origLeave = $.proxy(owl.leave, owl);
owl.leave = function (name) {
_origLeave(name);
var cur = owl._states.current;
for (var k in cur) {
if (cur[k] < 0) { cur[k] = 0; }
}
};
var $descriptionEl = $('.js-header-description');
var $titleEl = $('.js-header-title');
var _fadeTimer = null;
var _shownIndex = -1;
var $slides = $imgCarousel.find('.owl-item:not(.cloned) .header-slide-img');
var titles = $slides.map(function () { return $(this).data('title') || ''; }).get();
var descriptions = $slides.map(function () { return $(this).data('description') || ''; }).get();
var descStyles = $slides.map(function () {
return {
color: $(this).data('desc-color') || '#ffffff',
fontSize: $(this).data('desc-font-size') || 16,
fontWeight: $(this).data('desc-font-weight') || '400'
};
}).get();
function showTitle(title) {
if (!$titleEl.length) { return; }
$titleEl.text(title);
$titleEl.toggle(!!title);
}
function showDescription(text, style) {
if (!$descriptionEl.length) { return; }
if (_fadeTimer) { clearTimeout(_fadeTimer); _fadeTimer = null; }
style = style || { color: '#ffffff', fontSize: 16, fontWeight: '400' };
$descriptionEl.css({
color: style.color,
fontSize: style.fontSize + 'px',
fontWeight: style.fontWeight
});
$descriptionEl.removeClass('wk-tagline-out wk-tagline-in').text(text);
if (!text) { $descriptionEl.hide(); return; }
$descriptionEl.show();
$descriptionEl[0].offsetHeight; // force reflow so the transition actually runs
$descriptionEl.addClass('wk-tagline-in');
_fadeTimer = setTimeout(function () {
_fadeTimer = null;
$descriptionEl.removeClass('wk-tagline-in');
}, 400);
}
_shownIndex = owl.relative(owl.current());
showTitle(titles[_shownIndex] || '');
showDescription(descriptions[_shownIndex] || '', descStyles[_shownIndex]);
$imgCarousel.on('changed.owl.carousel', function () {
var realIndex = owl.relative(owl.current());
if (realIndex === _shownIndex) { return; } // loop-snap second fire — no-op
_shownIndex = realIndex;
showTitle(titles[realIndex] || '');
showDescription(descriptions[realIndex] || '', descStyles[realIndex]);
});
$('.js-header-media-prev').on('click', function () {
$imgCarousel.trigger('prev.owl.carousel');
});
$('.js-header-media-next').on('click', function () {
$imgCarousel.trigger('next.owl.carousel');
});
if (autoPlay) {
var ap = owl._plugins && owl._plugins.autoplay;
if (ap) { ap.pause = function () {}; }
$imgCarousel.on('translated.owl.carousel', function () {
if (ap && owl.is('rotating') && !ap._paused) {
ap._setAutoPlayInterval();
}
});
document.addEventListener('visibilitychange', function () {
if (!document.hidden) {
$imgCarousel.trigger('stop.owl.autoplay');
$imgCarousel.trigger('play.owl.autoplay');
}
});
var _watchdogTimer = setInterval(function () {
if (document.hidden) { return; }
var apNow = owl._plugins && owl._plugins.autoplay;
if (!owl.is('rotating') || (apNow && apNow._paused)) {
$imgCarousel.trigger('stop.owl.autoplay');
$imgCarousel.trigger('play.owl.autoplay');
}
}, interval + 1000);
$(window).one('beforeunload', function () {
clearInterval(_watchdogTimer);
});
}
});

View File

@@ -0,0 +1,77 @@
{**
* 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
*}
<tr class="qlo-img-row" id="qlo_img_{$img.id_header_image|intval}"
data-id="{$img.id_header_image|intval}"
data-thumb-src="{$imgBaseUrl|escape:'htmlall':'UTF-8'}{$img.name|escape:'htmlall':'UTF-8'}"
data-titles="{$img.titles_json|escape:'htmlall':'UTF-8'}"
data-descriptions="{$img.descriptions_json|escape:'htmlall':'UTF-8'}"
data-description-color="{$img.description_color|default:'#ffffff'|escape:'htmlall':'UTF-8'}"
data-description-font-size="{$img.description_font_size|default:16|intval}"
data-description-font-weight="{$img.description_font_weight|default:'400'|escape:'htmlall':'UTF-8'}">
<td class="row-selector text-center">
<input type="checkbox" name="htl_header_imageBox[]" class="noborder qlo-img-checkbox" value="{$img.id_header_image|intval}">
</td>
<td>
{if $img.thumb}{$img.thumb nofilter}{else}<img src="{$imgBaseUrl|escape:'html':'UTF-8'}{$img.name|escape:'html':'UTF-8'}" class="img-thumbnail" width="100" alt="">{/if}
</td>
<td class="qlo-img-title-cell">
{if $img.title}{$img.title|truncate:50:'...'|escape:'html':'UTF-8'}{else}&mdash;{/if}
</td>
<td class="qlo-img-description-cell">
{if $img.description}{$img.description|truncate:50:'...'|escape:'html':'UTF-8'}{else}&mdash;{/if}
</td>
<td class="pointer dragHandle center positionImage" id="td_qlo_img_{$img.id_header_image|intval}">
<div class="dragGroup">
<div class="positions">{$position|intval}</div>
</div>
</td>
<td class="center">
<a class="list-action-enable ajax_table_link js-toggle-active {if $img.active}action-enabled{else}action-disabled{/if}"
href="{$current|escape:'html':'UTF-8'}&amp;ajax=1&amp;action=toggle_image_active&amp;id_header_image={$img.id_header_image|intval}&amp;active={if $img.active}0{else}1{/if}&amp;token={$token|escape:'html':'UTF-8'}"
title="{if $img.active}{l s='Enabled' mod='hotelreservationsystem'}{else}{l s='Disabled' mod='hotelreservationsystem'}{/if}">
<i class="icon-check{if !$img.active} hidden{/if}"></i>
<i class="icon-remove{if $img.active} hidden{/if}"></i>
</a>
</td>
<td class="text-right">
<div class="btn-group-action">
<div class="btn-group pull-right">
<button type="button" class="btn btn-default btn qlo-edit-img"
data-id="{$img.id_header_image|intval}">
<i class="icon-pencil"></i>&nbsp;{l s='Edit' mod='hotelreservationsystem'}
</button>
<button class="btn btn-default btn dropdown-toggle" data-toggle="dropdown">
<i class="icon-caret-down"></i>&nbsp;
</button>
<ul class="dropdown-menu">
<li>
<a href="javascript:void(0);" class="qlo-delete-img"
data-id="{$img.id_header_image|intval}">
<i class="icon-trash"></i>&nbsp;{l s='Delete image' mod='hotelreservationsystem'}
</a>
</li>
</ul>
</div>
</div>
</td>
</tr>

View File

@@ -0,0 +1,704 @@
{**
* 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 id="qlo-header-media-form" class="form-horizontal"
action="{$current|escape:'htmlall':'UTF-8'}&token={$token|escape:'htmlall':'UTF-8'}"
method="post" enctype="multipart/form-data">
<input type="hidden" name="submitHeaderMedia" value="1">
<input type="hidden" name="confirm_delete_images" id="qlo-confirm-delete-images" value="0">
<div class="panel">
<div class="panel-heading">
<i class="icon-cogs"></i>&nbsp;{l s='Header Media Settings' mod='hotelreservationsystem'}
</div>
<div class="panel-body">
<div class="form-group">
<label class="control-label col-lg-3">
{l s='Header Media Type' mod='hotelreservationsystem'}
</label>
<div class="col-lg-9">
<select name="QLO_HEADER_MEDIA_TYPE" id="qlo-media-type" class="fixed-width-lg">
<option value="{HotelHeaderImage::MEDIA_TYPE_IMAGE}"{if $config.QLO_HEADER_MEDIA_TYPE == HotelHeaderImage::MEDIA_TYPE_IMAGE} selected{/if}>{l s='Images' mod='hotelreservationsystem'}</option>
<option value="{HotelHeaderImage::MEDIA_TYPE_VIDEO}"{if $config.QLO_HEADER_MEDIA_TYPE == HotelHeaderImage::MEDIA_TYPE_VIDEO} selected{/if}>{l s='Video' mod='hotelreservationsystem'}</option>
</select>
<p class="help-block">{l s='Choose whether the home page header shows a slideshow of images or a background video.' mod='hotelreservationsystem'}</p>
</div>
</div>
<div id="qlo-image-settings"{if $config.QLO_HEADER_MEDIA_TYPE != HotelHeaderImage::MEDIA_TYPE_IMAGE} style="display:none"{/if}>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Navigation Type' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<select name="QLO_HEADER_SLIDER_NAV_TYPE" class="fixed-width-lg">
<option value="{HotelHeaderImage::NAV_TYPE_ARROWS}"{if $config.QLO_HEADER_SLIDER_NAV_TYPE == HotelHeaderImage::NAV_TYPE_ARROWS} selected{/if}>{l s='Arrows' mod='hotelreservationsystem'}</option>
<option value="{HotelHeaderImage::NAV_TYPE_DOTS}"{if $config.QLO_HEADER_SLIDER_NAV_TYPE == HotelHeaderImage::NAV_TYPE_DOTS} selected{/if}>{l s='Dots' mod='hotelreservationsystem'}</option>
<option value="{HotelHeaderImage::NAV_TYPE_BOTH}"{if $config.QLO_HEADER_SLIDER_NAV_TYPE == HotelHeaderImage::NAV_TYPE_BOTH} selected{/if}>{l s='Both (Dots + Arrows)' mod='hotelreservationsystem'}</option>
</select>
<p class="help-block">{l s='Visible only when 2 or more active images exist.' mod='hotelreservationsystem'}</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Auto Slide' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" name="QLO_HEADER_SLIDER_AUTO_PLAY" id="auto_play_on" value="1"{if $config.QLO_HEADER_SLIDER_AUTO_PLAY} checked{/if}>
<label for="auto_play_on">{l s='Yes' mod='hotelreservationsystem'}</label>
<input type="radio" name="QLO_HEADER_SLIDER_AUTO_PLAY" id="auto_play_off" value="0"{if !$config.QLO_HEADER_SLIDER_AUTO_PLAY} checked{/if}>
<label for="auto_play_off">{l s='No' mod='hotelreservationsystem'}</label>
<a class="slide-button btn"></a>
</span>
</div>
</div>
<div class="form-group" id="qlo-slide-interval-group"{if !$config.QLO_HEADER_SLIDER_AUTO_PLAY} style="display:none"{/if}>
<label class="control-label col-lg-3">{l s='Slide Interval' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<div class="input-group fixed-width-lg">
<input type="text" name="QLO_HEADER_SLIDER_INTERVAL"
class="form-control"
value="{$config.QLO_HEADER_SLIDER_INTERVAL|escape:'html':'UTF-8'}">
<span class="input-group-addon">ms</span>
</div>
<p class="help-block">{l s='Milliseconds between slides. Min: 500. Example: 5000 = 5 s.' mod='hotelreservationsystem'}</p>
</div>
</div>
<div class="form-group" id="qlo-slide-anim-group">
<label class="control-label col-lg-3">{l s='Slide Animation' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<select name="QLO_HEADER_SLIDER_ANIM_TYPE" class="fixed-width-lg">
<option value="{HotelHeaderImage::ANIMATION_TYPE_SLIDE}"{if $config.QLO_HEADER_SLIDER_ANIM_TYPE == HotelHeaderImage::ANIMATION_TYPE_SLIDE} selected{/if}>{l s='Slide' mod='hotelreservationsystem'}</option>
<option value="{HotelHeaderImage::ANIMATION_TYPE_FADE}"{if $config.QLO_HEADER_SLIDER_ANIM_TYPE == HotelHeaderImage::ANIMATION_TYPE_FADE} selected{/if}>{l s='Fade' mod='hotelreservationsystem'}</option>
<option value="{HotelHeaderImage::ANIMATION_TYPE_ZOOM}"{if $config.QLO_HEADER_SLIDER_ANIM_TYPE == HotelHeaderImage::ANIMATION_TYPE_ZOOM} selected{/if}>{l s='Zoom' mod='hotelreservationsystem'}</option>
<option value="{HotelHeaderImage::ANIMATION_TYPE_BLUR}"{if $config.QLO_HEADER_SLIDER_ANIM_TYPE == HotelHeaderImage::ANIMATION_TYPE_BLUR} selected{/if}>{l s='Blur' mod='hotelreservationsystem'}</option>
</select>
<p class="help-block">{l s='Transition effect between slides.' mod='hotelreservationsystem'}</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Content Alignment' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<select name="QLO_HEADER_CONTENT_ALIGN" class="fixed-width-lg">
<option value="{HotelHeaderImage::CONTENT_ALIGN_CENTER}"{if $config.QLO_HEADER_CONTENT_ALIGN == HotelHeaderImage::CONTENT_ALIGN_CENTER || !$config.QLO_HEADER_CONTENT_ALIGN} selected{/if}>{l s='Center' mod='hotelreservationsystem'}</option>
<option value="{HotelHeaderImage::CONTENT_ALIGN_LEFT}"{if $config.QLO_HEADER_CONTENT_ALIGN == HotelHeaderImage::CONTENT_ALIGN_LEFT} selected{/if}>{l s='Left' mod='hotelreservationsystem'}</option>
<option value="{HotelHeaderImage::CONTENT_ALIGN_RIGHT}"{if $config.QLO_HEADER_CONTENT_ALIGN == HotelHeaderImage::CONTENT_ALIGN_RIGHT} selected{/if}>{l s='Right' mod='hotelreservationsystem'}</option>
</select>
<p class="help-block">{l s='Horizontal alignment of the title and description on the header.' mod='hotelreservationsystem'}</p>
</div>
</div>
</div>
<div id="qlo-video-settings"{if $config.QLO_HEADER_MEDIA_TYPE != HotelHeaderImage::MEDIA_TYPE_VIDEO} style="display:none"{/if}>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Video Source' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<select name="source_type" id="qlo-source-type" class="fixed-width-lg">
<option value="upload"{if $sourceType != 'url'} selected{/if}>{l s='Upload video file' mod='hotelreservationsystem'}</option>
<option value="url"{if $sourceType == 'url'} selected{/if}>{l s='External video URL' mod='hotelreservationsystem'}</option>
</select>
</div>
</div>
<div id="qlo-vid-file-wrap"{if $sourceType == 'url'} style="display:none"{/if}>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Video File' mod='hotelreservationsystem'}</label>
<div class="col-lg-6">
<input type="file" name="header_video_file" id="qlo-video-file-input" accept=".mp4,.webm,.ogg"
style="width:0;height:0;overflow:hidden;position:absolute;">
<button class="btn btn-default" type="button" id="qlo-vid-file-add-btn">
<i class="icon-folder-open"></i>&nbsp;{l s='Choose file...' mod='hotelreservationsystem'}
</button>
<span class="qlo-vid-filename help-block" style="display:none;margin-top:4px;"></span>
<p class="help-block">
{l s='Formats: .mp4, .webm, .ogg' mod='hotelreservationsystem'}
&mdash; {l s='Max:' mod='hotelreservationsystem'} {$maxUpload|escape:'html':'UTF-8'}
</p>
{if $videoItem && $videoItem.source_type == 'upload'}
<p class="help-block">{l s='Selecting a new file will replace the current video.' mod='hotelreservationsystem'}</p>
{/if}
</div>
</div>
</div>
<div id="qlo-vid-url-wrap"{if $sourceType != 'url'} style="display:none"{/if}>
<div class="form-group">
<label class="control-label col-lg-3">{l s='External Video URL' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<input type="text" name="video_url" id="qlo-video-url-input" class="form-control"
placeholder="https://example.com/video.mp4"
value="{$videoUrlValue|escape:'html':'UTF-8'}">
<p class="help-block">{l s='Enter a direct URL to an MP4, WebM, or OGG video file (server-hosted only). Streaming links (e.g., YouTube, Vimeo) are not supported.' mod='hotelreservationsystem'}</p>
{if $videoItem && $videoItem.source_type == 'url'}
<p class="help-block">{l s='Entering a new URL will replace the current video.' mod='hotelreservationsystem'}</p>
{/if}
<div class="qlo-video-preview-card" id="qlo-video-url-preview-wrap"{if !$showVideoUrlPreview} style="display:none"{/if}>
<video controls muted preload="metadata" class="qlo-video-preview-player" id="qlo-video-url-preview-player">
<source id="qlo-video-url-preview-source"
src="{$videoUrlValue|escape:'html':'UTF-8'}"
type="{$videoMimeType|escape:'html':'UTF-8'}">
{l s='Your browser does not support the video tag.' mod='hotelreservationsystem'}
</video>
</div>
</div>
</div>
</div>
{if $videoItem && $videoItem.source_type == 'upload'}
<div id="qlo-current-video-wrap"{if $sourceType != 'upload'} style="display:none"{/if}>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Current Video' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<div class="qlo-video-preview-card">
<video controls muted preload="metadata" class="qlo-video-preview-player">
<source src="{$imgBaseUrl|escape:'html':'UTF-8'}{$videoItem.name|escape:'html':'UTF-8'}"
type="{$videoMimeType|escape:'html':'UTF-8'}">
{l s='Your browser does not support the video tag.' mod='hotelreservationsystem'}
</video>
</div>
</div>
</div>
</div>
{/if}
</div>
</div>
<div class="panel-footer">
<button type="submit" class="btn btn-default pull-right">
<i class="process-icon-save"></i>&nbsp;{l s='Save' mod='hotelreservationsystem'}
</button>
</div>
</div>
</form>
{* Confirm switch-to-video modal — triggered when saving with Video selected while 2+ images exist *}
<div class="modal fade" id="qlo-confirm-switch-video-modal" tabindex="-1" role="dialog" aria-labelledby="qloConfirmSwitchVideoModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="qloConfirmSwitchVideoModalLabel">
<i class="icon-exclamation-triangle"></i>&nbsp;{l s='Confirm Switch to Video' mod='hotelreservationsystem'}
</h4>
</div>
<div class="modal-body">
<p>{l s='Switching to Video will delete all images except the one in the first position. This cannot be undone. Continue?' mod='hotelreservationsystem'}</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-close" data-dismiss="modal">{l s='Close' mod='hotelreservationsystem'}</button>
<button type="button" class="btn btn-primary" id="qlo-confirm-switch-video-btn">{l s='Continue' mod='hotelreservationsystem'}</button>
</div>
</div>
</div>
</div>
{* Confirm bulk-delete images modal — triggered by the "Delete selected" bulk action *}
<div class="modal fade" id="qlo-confirm-bulk-delete-modal" tabindex="-1" role="dialog" aria-labelledby="qloConfirmBulkDeleteModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="qloConfirmBulkDeleteModalLabel">
<i class="icon-exclamation-triangle"></i>&nbsp;{l s='Confirm Delete' mod='hotelreservationsystem'}
</h4>
</div>
<div class="modal-body">
<p>{l s='Delete selected images? This cannot be undone.' mod='hotelreservationsystem'}</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default btn-close" data-dismiss="modal">{l s='Close' mod='hotelreservationsystem'}</button>
<button type="button" class="btn btn-primary" id="qlo-confirm-bulk-delete-btn">{l s='Delete' mod='hotelreservationsystem'}</button>
</div>
</div>
</div>
</div>
<div id="qlo-image-panel"{if $config.QLO_HEADER_MEDIA_TYPE != HotelHeaderImage::MEDIA_TYPE_IMAGE} style="display:none"{/if}>
<div class="panel">
<div class="panel-heading">
<i class="icon-picture"></i>&nbsp;{l s='Header Images' mod='hotelreservationsystem'}
&nbsp;<span class="badge" id="qlo-image-count">{$imageItems|count}</span>
<span class="panel-heading-action">
<a id="qlo-add-image-btn" class="btn btn-primary" href="javascript:void(0);">
<i class="icon-plus-sign"></i>&nbsp;{l s='Add Images' mod='hotelreservationsystem'}
</a>
</span>
</div>
<div class="alert alert-info" id="qlo-slider-info"{if $config.QLO_HEADER_MEDIA_TYPE != HotelHeaderImage::MEDIA_TYPE_IMAGE} style="display:none"{/if}>
<b>
{l s='Slider navigation and auto-slide controls take effect only when 2 or more images are active. With a single active image these settings have no visible impact on the front end.' mod='hotelreservationsystem'}</b>
</div>
<hr>
<form method="post" action="{$current|escape:'htmlall':'UTF-8'}&amp;token={$token|escape:'htmlall':'UTF-8'}" id="qlo-bulk-form">
<div class="table-responsive">
<table class="table" id="qlo-image-table">
<thead>
<tr class="nodrag nodrop">
<th class="center fixed-width-xs"></th>
<th>{l s='Image' mod='hotelreservationsystem'}</th>
<th>{l s='Title' mod='hotelreservationsystem'}</th>
<th>{l s='Description' mod='hotelreservationsystem'}</th>
<th class="center fixed-width-xs">{l s='Position' mod='hotelreservationsystem'}</th>
<th class="center">{l s='Active' mod='hotelreservationsystem'}</th>
<th></th>
</tr>
</thead>
<tbody id="qlo-image-tbody">
{foreach from=$imageItems item=img}
{include file="../../_partials/htl-header-image-row.tpl" img=$img position=$img@iteration}
{foreachelse}
<tr class="list-empty-tr" id="qlo-no-images">
<td class="list-empty" colspan="7">
<div class="list-empty-msg">
<i class="icon-warning-sign list-empty-icon"></i>
{l s='No Image Found' mod='hotelreservationsystem'}
</div>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
<div class="row" id="qlo-bulk-actions-row"{if $imageItems|count <= 1} style="display:none"{/if}>
<div class="col-lg-6">
<div class="btn-group bulk-actions dropup">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
{l s='Bulk actions' mod='hotelreservationsystem'} <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li>
<a href="#" class="qlo-select-all-images" onclick="javascript:checkDelBoxes($(this).closest('form').get(0), 'htl_header_imageBox[]', true);return false;">
<i class="icon-check-sign"></i>&nbsp;{l s='Select all' mod='hotelreservationsystem'}
</a>
</li>
<li>
<a href="#" class="qlo-unselect-all-images" onclick="javascript:checkDelBoxes($(this).closest('form').get(0), 'htl_header_imageBox[]', false);return false;">
<i class="icon-check-empty"></i>&nbsp;{l s='Unselect all' mod='hotelreservationsystem'}
</a>
</li>
<li class="divider"></li>
<li>
<a href="#" id="qlo-bulk-update-trigger" data-toggle="modal" data-target="#qlo-bulk-update-modal" disabled>
<i class="icon-edit"></i>&nbsp;{l s='Update selection' mod='hotelreservationsystem'}
</a>
</li>
<li class="divider"></li>
<li>
<a href="#" class="qlo-bulk-delete-images-trigger" data-action="submitBulkdeletehtl_header_image">
<i class="icon-trash"></i>&nbsp;{l s='Delete selected' mod='hotelreservationsystem'}
</a>
</li>
</ul>
</div>
</div>
</div>
</form>
</div>
</div>
{* Bulk update modal — triggered by the "Bulk update" bulk action; only touches fields the admin actually sets *}
<div class="modal fade" id="qlo-bulk-update-modal" tabindex="-1" role="dialog" aria-labelledby="qloBulkUpdateModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="qloBulkUpdateModalLabel">
<i class="icon-edit"></i>&nbsp;{l s='Bulk Update Images' mod='hotelreservationsystem'}
</h4>
</div>
<div class="modal-body">
<div class="form-horizontal">
<div class="form-group">
<label class="control-label col-lg-3">{l s='Enable Image' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<select id="qlo-bulk-active" class="fixed-width-lg">
<option value="" selected="selected">{l s='Select status' mod='hotelreservationsystem'}</option>
<option value="1">{l s='Yes' mod='hotelreservationsystem'}</option>
<option value="0">{l s='No' mod='hotelreservationsystem'}</option>
</select>
<p class="help-block">{l s='Leave \'Select status\' to keep the current status.' mod='hotelreservationsystem'}</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Update Title' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" name="qlo_bulk_update_title" id="qlo_bulk_update_title_on" value="1">
<label for="qlo_bulk_update_title_on">{l s='Yes' mod='hotelreservationsystem'}</label>
<input type="radio" name="qlo_bulk_update_title" id="qlo_bulk_update_title_off" value="0" checked="checked">
<label for="qlo_bulk_update_title_off">{l s='No' mod='hotelreservationsystem'}</label>
<a class="slide-button btn"></a>
</span>
<p class="help-block">{l s='Turn on to overwrite the title text for all selected images.' mod='hotelreservationsystem'}</p>
</div>
</div>
<div class="form-group" id="qlo-bulk-title-fields-wrap" style="display:none">
<label class="control-label col-lg-3">{l s='Title' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
{foreach from=$languages item=lang}
{if count($languages) > 1}
<div class="translatable-field row lang-{$lang.id_lang}"{if $lang.id_lang != $defaultLangId} style="display:none"{/if}>
<div class="col-lg-10">
{/if}
<input type="text"
class="form-control qlo-bulk-title-field"
data-lang="{$lang.id_lang}"
maxlength="{$titleLimit|intval}"
placeholder="{l s='Title...' mod='hotelreservationsystem'}" />
{if count($languages) > 1}
</div>
<div class="col-lg-2">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" tabindex="-1">
{$lang.iso_code|escape:'html':'UTF-8'} <span class="caret"></span>
</button>
<ul class="dropdown-menu">
{foreach from=$languages item=lang2}
<li><a href="javascript:hideOtherLanguage({$lang2.id_lang});">{$lang2.name|escape:'html':'UTF-8'}</a></li>
{/foreach}
</ul>
</div>
</div>
{/if}
{/foreach}
<p class="help-block">{l s='Leave empty to clear the title for all selected images.' mod='hotelreservationsystem'}</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Update Description' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" name="qlo_bulk_update_description" id="qlo_bulk_update_description_on" value="1">
<label for="qlo_bulk_update_description_on">{l s='Yes' mod='hotelreservationsystem'}</label>
<input type="radio" name="qlo_bulk_update_description" id="qlo_bulk_update_description_off" value="0" checked="checked">
<label for="qlo_bulk_update_description_off">{l s='No' mod='hotelreservationsystem'}</label>
<a class="slide-button btn"></a>
</span>
<p class="help-block">{l s='Turn on to overwrite the description text for all selected images.' mod='hotelreservationsystem'}</p>
</div>
</div>
<div class="form-group" id="qlo-bulk-description-fields-wrap" style="display:none">
<label class="control-label col-lg-3">{l s='Description' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
{foreach from=$languages item=lang}
{if count($languages) > 1}
<div class="translatable-field row lang-{$lang.id_lang}"{if $lang.id_lang != $defaultLangId} style="display:none"{/if}>
<div class="col-lg-10">
{/if}
<input type="text"
class="form-control qlo-bulk-description-field"
data-lang="{$lang.id_lang}"
maxlength="{$descriptionLimit|intval}"
placeholder="{l s='Description...' mod='hotelreservationsystem'}" />
{if count($languages) > 1}
</div>
<div class="col-lg-2">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" tabindex="-1">
{$lang.iso_code|escape:'html':'UTF-8'} <span class="caret"></span>
</button>
<ul class="dropdown-menu">
{foreach from=$languages item=lang2}
<li><a href="javascript:hideOtherLanguage({$lang2.id_lang});">{$lang2.name|escape:'html':'UTF-8'}</a></li>
{/foreach}
</ul>
</div>
</div>
{/if}
{/foreach}
<p class="help-block">{l s='Leave empty to clear the description for all selected images.' mod='hotelreservationsystem'}</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Description Color' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<div class="input-group fixed-width-lg">
<input type="color" id="qlo-bulk-desc-color" name="bulk_description_color"
class="color mColorPickerInput" data-hex="true" value="">
</div>
<p class="help-block">{l s='Leave empty to keep each image\'s current color unchanged.' mod='hotelreservationsystem'}</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Description Font Size' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<div class="input-group fixed-width-lg">
<input type="number" id="qlo-bulk-desc-font-size" class="form-control" value="0" min="0" max="72">
<span class="input-group-addon">px</span>
</div>
<p class="help-block">{l s='Leave as 0 to keep the current size.' mod='hotelreservationsystem'}</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Description Font Weight' mod='hotelreservationsystem'}</label>
<div class="col-lg-3">
<select id="qlo-bulk-desc-font-weight" class="fixed-width-lg">
<option value="" selected="selected">{l s='Select font weight' mod='hotelreservationsystem'}</option>
<option value="400">{l s='Normal' mod='hotelreservationsystem'}</option>
<option value="700">{l s='Bold' mod='hotelreservationsystem'}</option>
</select>
</div>
<div class="col-lg-9 col-lg-offset-3">
<p class="help-block">{l s='Leave \'Select font weight\' to keep the current weight.' mod='hotelreservationsystem'}</p>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="qlo-bulk-update-apply">{l s='Submit' mod='hotelreservationsystem'}</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="qlo-img-form-modal" tabindex="-1" role="dialog" aria-labelledby="qloImgFormModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="qloImgFormModalLabel">
<i class="icon-picture"></i>&nbsp;<span id="qlo-img-modal-title-add">{l s='Add Images' mod='hotelreservationsystem'}</span><span id="qlo-img-modal-title-edit" style="display:none">{l s='Edit Image' mod='hotelreservationsystem'}</span>
</h4>
</div>
<div class="modal-body">
<div class="form-horizontal">
<div class="form-group" id="qlo-img-edit-preview-group" style="display:none">
<label class="control-label col-lg-3">{l s='Image' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<img id="qlo-img-edit-thumb" src="" class="img-thumbnail" alt=""
style="max-width:160px;max-height:100px;object-fit:cover;">
</div>
</div>
<div class="form-group" id="qlo-img-edit-file-group" style="display:none">
<label class="control-label col-lg-3 file_upload_label">
{l s='Update Image' mod='hotelreservationsystem'}
</label>
<div class="col-lg-9">
<input type="file" id="qlo-img-edit-file"
accept="image/jpeg,image/jpg,image/png,image/webp,image/gif" class="hide">
<div class="dummyfile input-group">
<span class="input-group-addon"><i class="icon-file"></i></span>
<input id="qlo-img-edit-file-name" type="text" readonly>
<span class="input-group-btn">
<button id="qlo-img-edit-file-selectbutton" type="button" class="btn btn-default">
<i class="icon-folder-open"></i> {l s='Update image' mod='hotelreservationsystem'}
</button>
</span>
</div>
</div>
</div>
<div class="form-group" id="qlo-img-form-file-group">
<label class="control-label col-lg-3 file_upload_label">
{l s='Images' mod='hotelreservationsystem'}
</label>
<div class="col-lg-9">
<input type="file" id="qlo-img-form-file" multiple
accept="image/jpeg,image/jpg,image/png,image/webp,image/gif" class="hide">
<div class="dummyfile input-group">
<span class="input-group-addon"><i class="icon-file"></i></span>
<input id="qlo-img-form-file-name" type="text" readonly>
<span class="input-group-btn">
<button id="qlo-img-form-file-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='Formats: .jpg, .jpeg, .png, .webp, .gif' mod='hotelreservationsystem'}
&mdash; {l s='Recommended: 1920×600 px' mod='hotelreservationsystem'}
&mdash; {l s='Max:' mod='hotelreservationsystem'} {$maxImageUpload|escape:'html':'UTF-8'}
</p>
</div>
</div>
<div class="form-group" id="qlo-img-form-add-active-group">
<label class="control-label col-lg-3">{l s='Enable' mod='hotelreservationsystem'}</label>
<div class="col-lg-6">
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" name="qlo_img_active_add" id="qlo_img_active_add_on" value="1" checked>
<label for="qlo_img_active_add_on">{l s='Yes' mod='hotelreservationsystem'}</label>
<input type="radio" name="qlo_img_active_add" id="qlo_img_active_add_off" value="0">
<label for="qlo_img_active_add_off">{l s='No' mod='hotelreservationsystem'}</label>
<a class="slide-button btn"></a>
</span>
</div>
</div>
<div class="form-group" id="qlo-img-form-edit-group" style="display:none">
<label class="control-label col-lg-3">{l s='Enable Image' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" name="qlo_img_active_edit" id="qlo_img_active_edit_on" value="1">
<label for="qlo_img_active_edit_on">{l s='Yes' mod='hotelreservationsystem'}</label>
<input type="radio" name="qlo_img_active_edit" id="qlo_img_active_edit_off" value="0">
<label for="qlo_img_active_edit_off">{l s='No' mod='hotelreservationsystem'}</label>
<a class="slide-button btn"></a>
</span>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Title' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
{foreach from=$languages item=lang}
{if count($languages) > 1}
<div class="translatable-field row lang-{$lang.id_lang}"{if $lang.id_lang != $defaultLangId} style="display:none"{/if}>
<div class="col-lg-10">
{/if}
<input type="text"
id="qlo-form-title-{$lang.id_lang}"
class="form-control qlo-form-title-field"
data-lang="{$lang.id_lang}"
maxlength="{$titleLimit|intval}"
placeholder="{l s='Title...' mod='hotelreservationsystem'}" />
{if count($languages) > 1}
</div>
<div class="col-lg-2">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" tabindex="-1">
{$lang.iso_code|escape:'html':'UTF-8'} <span class="caret"></span>
</button>
<ul class="dropdown-menu">
{foreach from=$languages item=lang2}
<li><a href="javascript:hideOtherLanguage({$lang2.id_lang});">{$lang2.name|escape:'html':'UTF-8'}</a></li>
{/foreach}
</ul>
</div>
</div>
{/if}
{/foreach}
<p class="help-block">{l s='Short title shown as an input field on this image. Leave empty for no title.' mod='hotelreservationsystem'}</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Description' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
{foreach from=$languages item=lang}
{if count($languages) > 1}
<div class="translatable-field row lang-{$lang.id_lang}"{if $lang.id_lang != $defaultLangId} style="display:none"{/if}>
<div class="col-lg-10">
{/if}
<input type="text"
id="qlo-form-description-{$lang.id_lang}"
class="form-control qlo-form-description-field"
data-lang="{$lang.id_lang}"
maxlength="{$descriptionLimit|intval}"
placeholder="{l s='Description...' mod='hotelreservationsystem'}" />
{if count($languages) > 1}
</div>
<div class="col-lg-2">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" tabindex="-1">
{$lang.iso_code|escape:'html':'UTF-8'} <span class="caret"></span>
</button>
<ul class="dropdown-menu">
{foreach from=$languages item=lang2}
<li><a href="javascript:hideOtherLanguage({$lang2.id_lang});">{$lang2.name|escape:'html':'UTF-8'}</a></li>
{/foreach}
</ul>
</div>
</div>
{/if}
{/foreach}
<p class="help-block">{l s='Short text overlay shown on this image. Leave empty for no overlay.' mod='hotelreservationsystem'}</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Description Color' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<div class="input-group fixed-width-lg">
<input type="color" id="qlo-img-desc-color" name="description_color"
class="color mColorPickerInput" data-hex="true" value="#ffffff">
</div>
<p class="help-block">{l s='Text color for the description overlay.' mod='hotelreservationsystem'}</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Description Font Size' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<div class="input-group fixed-width-lg">
<input type="number" id="qlo-img-desc-font-size" name="description_font_size"
class="form-control" value="16" min="8" max="72">
<span class="input-group-addon">px</span>
</div>
<p class="help-block">{l s='Default: 16px. Recommended: 12px–48px.' mod='hotelreservationsystem'}</p>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Description Font Weight' mod='hotelreservationsystem'}</label>
<div class="col-lg-9">
<select id="qlo-img-desc-font-weight" name="description_font_weight" class="fixed-width-lg">
<option value="400" selected="selected">{l s='Normal' mod='hotelreservationsystem'}</option>
<option value="700">{l s='Bold' mod='hotelreservationsystem'}</option>
</select>
</div>
</div>
<div class="form-group" id="qlo-form-upload-progress" style="display:none">
<div class="col-lg-offset-3 col-lg-9">
<div class="alert alert-info" style="margin:0">
<i class="icon-spinner icon-spin"></i>&nbsp;{l s='Uploading, please wait...' mod='hotelreservationsystem'}
</div>
</div>
</div>
<input type="hidden" id="qlo-img-form-id" value="">
</div>
</div>
<div class="modal-footer" id="qlo-img-add-footer">
<button type="button" id="qlo-img-form-upload-btn" class="btn btn-primary"><i class="icon-upload"></i>&nbsp;{l s='Upload' mod='hotelreservationsystem'}</button>
</div>
<div class="modal-footer" id="qlo-img-edit-footer" style="display:none">
<button type="button" id="qlo-img-form-save-btn" class="btn btn-primary"><i class="icon-save"></i>&nbsp;{l s='Save' mod='hotelreservationsystem'}</button>
</div>
</div>
</div>
</div>

View File

@@ -24,17 +24,17 @@
<div class="header-desc-container">
<div class="header-desc-wrapper">
<div class="header-desc-primary">
<div class="container">
<div class="container header-align-{$wkHeaderContentAlign|default:HotelHeaderImage::CONTENT_ALIGN_CENTER|intval}">
<div class="row">
<div class="col-md-offset-1 col-md-10 col-lg-offset-2 col-lg-8">
<p class="header-desc-welcome">{l s='Welcome To' mod='hotelreservationsystem'}</p>
<hr class="heasder-desc-hr-first"/>
<div class="col-md-offset-1 col-md-10 col-lg-offset-0 col-lg-12">
<div class="header-desc-inner-wrapper">
{block name='header_hotel_chain_name'}
<h1 class="header-hotel-name">{$WK_HTL_CHAIN_NAME|escape:'htmlall':'UTF-8'}</h1>
{if $QLO_HEADER_MEDIA_TYPE == $QLO_HEADER_MEDIA_TYPE_IMAGE}
{block name='header_hotel_title'}
<h1 class="header-hotel-name js-header-title"{if !isset($wkHeaderMediaTitle) || !$wkHeaderMediaTitle} style="display:none"{/if}>{if isset($wkHeaderMediaTitle) && $wkHeaderMediaTitle}{$wkHeaderMediaTitle|escape:'htmlall':'UTF-8'}{/if}</h1>
{/block}
{/if}
{block name='header_hotel_description'}
<p class="header-hotel-desc">{$WK_HTL_TAG_LINE|escape:'htmlall':'UTF-8'}</p>
<p class="header-hotel-desc js-header-description"{if !isset($wkHeaderMediaDescription) || !$wkHeaderMediaDescription} style="display:none"{else} style="color:{$wkDescriptionColor|default:'#ffffff'|escape:'html':'UTF-8'};font-size:{$wkDescriptionFontSize|default:16|intval}px;font-weight:{$wkDescriptionFontWeight|default:'400'|escape:'html':'UTF-8'}"{/if}>{if isset($wkHeaderMediaDescription) && $wkHeaderMediaDescription}{$wkHeaderMediaDescription|escape:'html':'UTF-8'}{/if}</p>
{/block}
<hr class="heasder-desc-hr-second"/>
</div>

View File

@@ -87,7 +87,63 @@
{/if}
<div id="page" style="{if $page_name == 'index'}height: 100%;{/if}">
<div class="header-container" style="{if $page_name == 'index'}height: 100%;{/if}">
<header id="header" style='{if $page_name == "index"}background-image:url("{$link->getMediaLink("`$smarty.const._PS_IMG_`{Configuration::get('WK_HOTEL_HEADER_IMAGE')}")}"); height: 100%;{else}background-color:#252525;{/if}' >
<header id="header" style='{if $page_name == "index"}height: 100%;{else}background-color:#252525;{/if}'>
{if $page_name == "index" && $headerMediaItems}
{if $QLO_HEADER_MEDIA_TYPE == $QLO_HEADER_MEDIA_TYPE_IMAGE}
{if $headerMediaItems|@count == 1}
{assign var='singleImg' value=$headerMediaItems[0]}
<div class="header-media-layer" style="background-image:url('{$link->getMediaLink("`$smarty.const._PS_IMG_`hotel_header_media/{$singleImg.name}")}')">
</div>
{else}
<div class="header-media-layer header-media-slider">
<div class="owl-carousel header-img-carousel"
data-auto-play="{if isset($headerSliderConfig.auto_play)}{$headerSliderConfig.auto_play|intval}{else}1{/if}"
data-interval="{if isset($headerSliderConfig.interval) && $headerSliderConfig.interval > 0}{$headerSliderConfig.interval|intval}{else}5000{/if}"
data-nav-type="{if isset($headerSliderConfig.nav_type)}{$headerSliderConfig.nav_type|intval}{else}{$WK_HEADER_NAV_TYPE_DOTS}{/if}"
data-anim-type="{if isset($headerSliderConfig.anim_type)}{$headerSliderConfig.anim_type|intval}{else}{$QLO_HEADER_ANIM_TYPE_SLIDE|intval}{/if}"
>
{foreach from=$headerMediaItems item=imgItem}
<div class="header-slide-img"
style="background-image:url('{$link->getMediaLink("`$smarty.const._PS_IMG_`hotel_header_media/{$imgItem.name}")}')"
data-title="{$imgItem.title|escape:'html':'UTF-8'}"
data-description="{$imgItem.description|escape:'html':'UTF-8'}"
data-desc-color="{$imgItem.description_color|default:'#ffffff'|escape:'html':'UTF-8'}"
data-desc-font-size="{$imgItem.description_font_size|default:16|intval}"
data-desc-font-weight="{$imgItem.description_font_weight|default:'400'|escape:'html':'UTF-8'}">
</div>
{/foreach}
</div>
</div>
<div id="wk-header-owl-dots" class="header-ext-dots"></div>
{if isset($headerSliderConfig.nav_type) && $headerSliderConfig.nav_type != $WK_HEADER_NAV_TYPE_DOTS && $headerMediaItems|@count > 1}
<div class="header-media-nav-wrapper">
<button class="header-media-btn js-header-media-prev" aria-label="Previous"><i class="icon-angle-left"></i></button>
<button class="header-media-btn js-header-media-next" aria-label="Next"><i class="icon-angle-right"></i></button>
</div>
{/if}
{/if}
{elseif $QLO_HEADER_MEDIA_TYPE == $QLO_HEADER_MEDIA_TYPE_VIDEO}
{assign var='singleVid' value=$headerMediaItems[0]}
<div class="header-media-layer header-video-layer">
<video class="header-bg-video"
style="width: 100%;object-fit: cover;"
autoplay
loop
muted
preload="auto"
playsinline>
{if $singleVid.source_type == 'url' || $singleVid.name|substr:0:4 == 'http' || $singleVid.name|substr:0:2 == '//'}
<source src="{$singleVid.name|escape:'html':'UTF-8'}"
type="{if isset($singleVid.mime_type)}{$singleVid.mime_type|escape:'html':'UTF-8'}{else}video/mp4{/if}">
{else}
<source src="{$link->getMediaLink("`$smarty.const._PS_IMG_`hotel_header_media/{$singleVid.name}")}"
type="{if isset($singleVid.mime_type)}{$singleVid.mime_type|escape:'html':'UTF-8'}{else}video/mp4{/if}">
{/if}
</video>
</div>
{/if}
{/if}
<div class="banner">
<div class="container">
<div class="row">