_decodeProperties($_smarty_tpl, array (
'version' => '3.1.39',
'unifunc' => 'content_6494329106e761_24673620',
'has_nocache_code' => false,
'file_dependency' =>
array (
'93cfe9b05d0b0b858312ec9d56e1c22b03ec8c84' =>
array (
0 => 'C:\\xampp\\htdocs\\hotelcommerce\\admin\\themes\\default\\template\\controllers\\products\\images.tpl',
1 => 1687433793,
2 => 'file',
),
),
'includes' =>
array (
),
),false)) {
function content_6494329106e761_24673620 (Smarty_Internal_Template $_smarty_tpl) {
if ((isset($_smarty_tpl->tpl_vars['id_product']->value)) && (isset($_smarty_tpl->tpl_vars['product']->value))) {?>
smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Images'),$_smarty_tpl ) );?>
tpl_vars['countImages']->value;?>
| smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Image'),$_smarty_tpl ) );?>
|
smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Caption'),$_smarty_tpl ) );?>
|
smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Position'),$_smarty_tpl ) );?>
|
tpl_vars['shops']->value) {?>
smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['shops']->value, 'shop');
$_smarty_tpl->tpl_vars['shop']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['shop']->value) {
$_smarty_tpl->tpl_vars['shop']->do_else = false;
?>
tpl_vars['shop']->value['name'];?>
|
smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Cover'),$_smarty_tpl ) );?>
|
|
type="text/javascript">
var upbutton = 'smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Upload an image'),$_smarty_tpl ) );?>
';
var come_from = 'tpl_vars['table']->value;?>
';
var success_add = 'smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'The image has been successfully added.'),$_smarty_tpl ) );?>
';
var id_tmp = 0;
var current_shop_id = tpl_vars['current_shop_id']->value);?>
;
//Ready Function
function imageLine(id, path, position, cover, shops, legend)
{
line = $("#lineType").html();
line = line.replace(/image_id/g, id);
line = line.replace(/(\/)?[a-z]{0,2}-default/g, function($0, $1){
return $1 ? $1 + path : $0;
});
line = line.replace(/image_path/g, path);
line = line.replace(/\.jpg"\s/g, '.jpg?time=' + new Date().getTime() + '" ');
line = line.replace(/image_position/g, position);
line = line.replace(/legend/g, legend);
line = line.replace(/icon-check-empty/g, cover);
line = line.replace(/
/gi, "");
line = line.replace(/<\/tbody>/gi, "");
if (shops != false)
{
$.each(shops, function(key, value){
if (value == 1)
line = line.replace('id="' + key + '' + id + '"','id="' + key + '' + id + '" checked=checked');
});
}
$("#imageList").append(line);
}
$(document).ready(function(){
smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['images']->value, 'image');
$_smarty_tpl->tpl_vars['image']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['image']->value) {
$_smarty_tpl->tpl_vars['image']->do_else = false;
?>
assoc = "{";
tpl_vars['shops']->value) {?>
smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['shops']->value, 'shop');
$_smarty_tpl->tpl_vars['shop']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['shop']->value) {
$_smarty_tpl->tpl_vars['shop']->do_else = false;
?>
assoc += '"tpl_vars['shop']->value['id_shop'];?>
" : tpl_vars['image']->value->isAssociatedToShop($_smarty_tpl->tpl_vars['shop']->value['id_shop'])) {?>10,';
smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
if (assoc != "{")
{
assoc = assoc.slice(0, -1);
assoc += "}";
assoc = jQuery.parseJSON(assoc);
}
else
assoc = false;
imageLine(tpl_vars['image']->value->id;?>
, "tpl_vars['image']->value->getExistingImgPath();?>
", tpl_vars['image']->value->position;?>
, "tpl_vars['image']->value->cover) {?>icon-check-signicon-check-empty", assoc, "tpl_vars['image']->value->legend[$_smarty_tpl->tpl_vars['default_language']->value], ENT_QUOTES, 'UTF-8', true), "HTML-ENTITIES", 'UTF-8');?>
");
smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
var originalOrder = false;
$("#imageTable").tableDnD(
{ dragHandle: 'dragHandle',
onDragClass: 'myDragClass',
onDragStart: function(table, row) {
originalOrder = $.tableDnD.serialize();
reOrder = ':even';
if (table.tBodies[0].rows[1] && $('#' + table.tBodies[0].rows[1].id).hasClass('alt_row'))
reOrder = ':odd';
$(table).find('#' + row.id).parent('tr').addClass('myDragClass');
},
onDrop: function(table, row) {
if (originalOrder != $.tableDnD.serialize()) {
current = $(row).attr("id");
stop = false;
image_up = "{";
$("#imageList").find("tr").each(function(i) {
$("#td_" + $(this).attr("id")).html('');
if (!stop || (i + 1) == 2)
image_up += '"' + $(this).attr("id") + '" : ' + (i + 1) + ',';
});
image_up = image_up.slice(0, -1);
image_up += "}";
updateImagePosition(image_up);
}
}
});
/**
* on success function
*/
function afterDeleteProductImage(data)
{
data = $.parseJSON(data);
if (data)
{
cover = 0;
id = data.content.id;
if (data.status == 'ok')
{
if ($("#" + id + ' .covered').hasClass('icon-check-sign'))
cover = 1;
$("#" + id).remove();
}
if (cover)
$("#imageTable tr").eq(1).find(".covered").addClass('icon-check-sign');
$("#countImage").html(parseInt($("#countImage").html()) - 1);
refreshImagePositions($("#imageTable"));
showSuccessMessage(data.confirmations);
if (parseInt($("#countImage").html()) <= 1)
$('#caption_selection').addClass('hidden');
}
}
$('.delete_product_image').die().live('click', function(e)
{
e.preventDefault();
id = $(this).parent().parent().attr('id');
if (confirm("smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['l'][0], array( array('s'=>'Delete selected item?','js'=>1),$_smarty_tpl ) );?>
"))
doAdminAjax({
"action":"deleteProductImage",
"id_image":id,
"id_product" : tpl_vars['id_product']->value;?>
,
"id_category" : tpl_vars['id_category_default']->value;?>
,
"token" : "tpl_vars['token']->value, ENT_QUOTES, 'UTF-8', true);?>
",
"tab" : "AdminProducts",
"ajax" : 1 }, afterDeleteProductImage
);
});
$('.covered').die().live('click', function(e)
{
e.preventDefault();
id = $(this).parent().parent().parent().attr('id');
$("#imageList .cover i").each( function(i){
$(this).removeClass('icon-check-sign').addClass('icon-check-empty');
});
$(this).removeClass('icon-check-empty').addClass('icon-check-sign');
if (current_shop_id != 0)
$('#' + current_shop_id + id).attr('check', true);
else
$(this).parent().parent().parent().children('td input').attr('check', true);
doAdminAjax({
"action":"UpdateCover",
"id_image":id,
"id_product" : tpl_vars['id_product']->value;?>
,
"token" : "tpl_vars['token']->value, ENT_QUOTES, 'UTF-8', true);?>
",
"controller" : "AdminProducts",
"ajax" : 1 }
);
});
$('.image_shop').die().live('click', function()
{
active = false;
if ($(this).attr("checked"))
active = true;
id = $(this).parent().parent().attr('id');
id_shop = $(this).attr("id").replace(id, "");
doAdminAjax(
{
"action":"UpdateProductImageShopAsso",
"id_image":id,
"id_product":id_product,
"id_shop": id_shop,
"active":active,
"token" : "tpl_vars['token']->value, ENT_QUOTES, 'UTF-8', true);?>
",
"tab" : "AdminProducts",
"ajax" : 1
});
});
function updateImagePosition(json)
{
doAdminAjax(
{
"action":"updateImagePosition",
"json":json,
"token" : "tpl_vars['token']->value, ENT_QUOTES, 'UTF-8', true);?>
",
"tab" : "AdminProducts",
"ajax" : 1
});
}
function delQueue(id)
{
$("#img" + id).fadeOut("slow");
$("#img" + id).remove();
}
$('.fancybox').fancybox();
});
if (tabs_manager.allow_hide_other_languages)
hideOtherLanguage(default_language);
>