/
chatcheckoperatormessage.tpl.php
90 lines (77 loc) · 6.45 KB
/
chatcheckoperatormessage.tpl.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php if (isset($reopen_chat)) : ?>
lh_inst.stopCheckNewMessage();
lh_inst.addCookieAttribute('hash','<?php echo $reopen_chat->id;?>_<?php echo $reopen_chat->hash?>');
lh_inst.showStartWindow();
<?php elseif ($visitor->has_message_from_operator == true && (!isset($dynamic_everytime) || $dynamic_everytime == false)) : ?>
lh_inst.stopCheckNewMessage();
<?php if ($visitor->invitation instanceof erLhAbstractModelProactiveChatInvitation && $visitor->invitation->show_on_mobile == 1) : ?>
<?php if (($visitor->invitation_assigned == false && $visitor->invitation->delay > 0) || $visitor->invitation->delay_init > 0) : ?>
setTimeout(function() {
<?php endif; ?>
var invitationURL = '<?php echo erLhcoreClassSystem::getHost()?><?php echo erLhcoreClassDesign::baseurl('chat/readoperatormessage')?><?php $department !== false ? print '/(department)/'.$department : '' ?><?php $theme !== false ? print '/(theme)/'.$theme : ''?><?php $operator !== false ? print '/(operator)/'.$operator : ''?><?php $priority !== false ? print '/(priority)/'.$priority : ''?><?php $uarguments !== false ? print '/(ua)/'.$uarguments : ''?><?php $tag !== false ? print '/(tag)/' . $tag : ''?><?php $survey !== false ? print '/(survey)/'.$survey : ''?>/(vid)/<?php echo $vid;?><?php $visitor->invitation_assigned == true ? print '/(playsound)/true' : ''?>/(fullheight)/<?= $fullheight ? 'true' : 'false' ?>';
<?php if (isset($visitor->invitation->design_data_array['mobile_html']) && $visitor->invitation->design_data_array['mobile_html'] != '') : ?>
<?php if (isset($visitor->invitation->design_data_array['mobile_style']) && $visitor->invitation->design_data_array['mobile_style'] != '') : ?>
<?php
$replaceStyleArray = array();
for ($i = 1; $i < 5; $i++) {
$replaceStyleArray['{proactive_img_' . $i . '}'] = erLhcoreClassSystem::getHost() . $visitor->invitation->{'design_data_img_' . $i . '_url'};
}
?>
<?php
$contentCSS = str_replace(array_keys($replaceStyleArray),array_values($replaceStyleArray),$visitor->invitation->design_data_array['mobile_style']);
$contentCSS = str_replace(array("\n","\r"),'',$contentCSS);
?>
lh_inst.addCss(<?php echo json_encode($contentCSS)?>);
<?php endif; ?>
lh_inst.invitationURL = invitationURL;
var fragmentInv = lh_inst.appendHTML(<?php echo json_encode(str_replace(array("\n","\r",'{readmessage}','{hideInvitation}'),array('','',"return lh_inst.showHTMLInvitation(lh_inst.invitationURL)","return lh_inst.hideHTMLInvitation()"),$visitor->invitation->design_data_array['mobile_html']))?>);
document.body.insertBefore(fragmentInv, document.body.childNodes[0]);
lh_inst.isProactivePending = 1;
lh_inst.toggleStatusWidget(true);
<?php else : ?>
<?php if (isset($visitor->invitation->design_data_array['api_do_not_show']) && $visitor->invitation->design_data_array['api_do_not_show'] == 1) : ?>
lh_inst.showBasicInvitation(invitationURL);
<?php else : ?>
if (window.innerWidth > 700) {
lh_inst.isProactivePending = 1;
lh_inst.showStartWindow(invitationURL,true);
} else {
lh_inst.showBasicInvitation(invitationURL);
}
<?php endif; ?>
<?php endif; ?>
<?php if (($visitor->invitation_assigned == false && $visitor->invitation->delay > 0) || $visitor->invitation->delay_init > 0) : ?>
},<?php echo ($visitor->invitation_assigned == true ? $visitor->invitation->delay_init : $visitor->invitation->delay) * 1000?>);
<?php endif; ?>
<?php else : ?>
<?php if ($visitor->invitation instanceof erLhAbstractModelProactiveChatInvitation && (($visitor->invitation_assigned == false && $visitor->invitation->delay > 0) || $visitor->invitation->delay_init > 0)) : ?>
setTimeout(function() {
<?php endif; ?>
var urlInvitation = '<?php echo erLhcoreClassSystem::getHost()?><?php echo erLhcoreClassDesign::baseurl('chat/readoperatormessage')?><?php $department !== false ? print '/(department)/'.$department : '' ?><?php $theme !== false ? print '/(theme)/'.$theme : ''?><?php $tag !== false ? print '/(tag)/' . $tag : ''?><?php $operator !== false ? print '/(operator)/'.$operator : ''?><?php $priority !== false ? print '/(priority)/'.$priority : ''?><?php $uarguments !== false ? print '/(ua)/'.$uarguments : ''?><?php $survey !== false ? print '/(survey)/'.$survey : ''?>/(vid)/<?php echo $vid;?><?php $visitor->invitation_assigned == true ? print '/(playsound)/true' : ''?>/(fullheight)/<?= $fullheight ? 'true' : 'false' ?>';
<?php if ($visitor->invitation instanceof erLhAbstractModelProactiveChatInvitation && isset($visitor->invitation->design_data_array['api_do_not_show']) && $visitor->invitation->design_data_array['api_do_not_show'] == 1) : ?>
lh_inst.showBasicInvitation(urlInvitation);
<?php else : ?>
if (window.innerWidth > 700) {
lh_inst.isProactivePending = 1;
lh_inst.showStartWindow(urlInvitation,true);
} else {
lh_inst.showBasicInvitation(urlInvitation);
}
<?php endif; ?>
<?php if ($visitor->invitation instanceof erLhAbstractModelProactiveChatInvitation && ($visitor->invitation_assigned == false && $visitor->invitation->delay > 0 || $visitor->invitation->delay_init > 0)) : ?>
},<?php echo ($visitor->invitation_assigned == true ? $visitor->invitation->delay_init : $visitor->invitation->delay) * 1000?>);
<?php endif; ?>
<?php endif; ?>
<?php elseif (isset($dynamic)) : ?>
<?php include(erLhcoreClassDesign::designtpl('lhchat/getstatus/dynamic_events.tpl.php')); ?>
<?php endif; ?>
<?php if (isset($inject_html)) : ?>
<?php include(erLhcoreClassDesign::designtpl('lhchat/getstatus/inject_events.tpl.php')); ?>
<?php endif; ?>
<?php if (isset($operation)) : ?><?php echo $operation;?><?php endif;?>
<?php if ($visitor->next_reschedule > 0) : ?>
setTimeout(function() {
lh_inst.startNewMessageCheckSingle();
},<?php echo (($visitor->next_reschedule + 1)*1000);?>);
<?php endif; ?>
<?php include(erLhcoreClassDesign::designtpl('lhchat/getstatus/chatcheckoperatormessage_multiinclude.tpl.php')); ?>