bebeboutik/adm/tabs/AdminCustomerThreads.php
2018-02-23 12:19:46 +01:00

1323 lines
68 KiB
PHP
Executable File

<?php
/*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/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 license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 8673 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
class AdminCustomerThreads extends AdminTab
{
public function __construct()
{
global $cookie;
$this->table = 'customer_thread';
$this->lang = false;
$this->className = 'CustomerThread';
$this->edit = false;
$this->view = true;
$this->delete = true;
$this->_select = '
CONCAT(c.firstname, " ", c.lastname) as customer, cl.name as contact,
l.name as language, group_concat(message) as messages,
(SELECT IFNULL(CONCAT(LEFT(e.firstname, 1), ". ", e.lastname), "--")
FROM '._DB_PREFIX_.'customer_message cm2 INNER JOIN '._DB_PREFIX_.'employee e ON e.id_employee = cm2.id_employee
WHERE cm2.id_employee > 0 AND cm2.`id_customer_thread` = a.`id_customer_thread`
ORDER BY cm2.date_add DESC LIMIT 1
) as employee';
$this->_group = 'GROUP BY cm.id_customer_thread';
$this->_join = '
LEFT JOIN `'._DB_PREFIX_.'customer` c ON c.`id_customer` = a.`id_customer`
LEFT JOIN `'._DB_PREFIX_.'customer_message` cm ON cm.`id_customer_thread` = a.`id_customer_thread`
LEFT JOIN `'._DB_PREFIX_.'lang` l ON l.`id_lang` = a.`id_lang`
LEFT JOIN `'._DB_PREFIX_.'contact_lang` cl ON (cl.`id_contact` = a.`id_contact` AND cl.`id_lang` = '.(int)$cookie->id_lang.')';
$contactArray = array();
$contacts = Contact::getContacts($cookie->id_lang);
foreach ($contacts AS $contact)
$contactArray[$contact['id_contact']] = $contact['name'];
$languageArray = array();
$languages = Language::getLanguages(FALSE);
foreach ($languages AS $language)
$languageArray[$language['id_lang']] = $language['name'];
$statusArray = array(
'open' => $this->l('Open'),
'closed' => $this->l('Closed'),
'pending1' => $this->l('Pending 1'),
'pending2' => $this->l('Pending 2')
);
$imagesArray = array(
'open' => 'status_green.gif',
'closed' => 'status_red.gif',
'pending1' => 'status_orange.gif',
'pending2' => 'status_orange.gif'
);
$anticonArray = array(
'open' => 'anticon-radio-checked text-green-light',
'closed' => 'anticon-radio-checked2 text-rose',
'pending1' => 'anticon-hour-glass text-orange',
'pending2' => 'anticon-hour-glass text-orange'
);
$this->fieldsDisplay = array(
'id_customer_thread' => array('title' => $this->l('ID'), 'width' => 25),
'customer' => array('title' => $this->l('Customer'), 'width' => 100, 'filter_key' => 'customer', 'tmpTableFilter' => true),
'email' => array('title' => $this->l('E-mail'), 'width' => 100, 'filter_key' => 'a!email'),
'contact' => array('title' => $this->l('Type'), 'width' => 75, 'type' => 'select', 'select' => $contactArray, 'filter_key' => 'cl!id_contact', 'filter_type' => 'int', 'align' =>'text-bold'),
'id_lang' => array('title' => $this->l('Language'), 'width' => 60, 'callback' => 'printCountry', 'type' => 'select', 'select' => $languageArray, 'filter_key' => 'l!id_lang', 'filter_type' => 'int', 'align'=>'center'),
'status' => array('title' => $this->l('Status'), 'width' => 50, 'type' => 'select', 'select' => $statusArray, 'anticon' => $anticonArray, 'align' => 'center', 'filter_key' => 'a!status', 'filter_type' => 'string'),
'employee' => array('title' => $this->l('Employee'), 'width' => 100, 'filter_key' => 'employee', 'tmpTableFilter' => true),
'id_product' => array('title' => $this->l('> 10€'), 'width' => 50, 'maxlength' => 0, 'align' =>'center'),
'id_order' => array('title' => $this->l('Nb products'), 'width' => 50, 'maxlength' => 0, 'align' =>'center text-bold','search'=>false),
'order' => array('title' => $this->l('Total cmd'), 'width' => 50, 'maxlength' => 0, 'align' =>'center text-bold'),
'date_upd' => array('title' => $this->l('Last message'), 'width' => 50, 'type'=>'datetimeLight')
);
parent::__construct();
}
public function postProcess()
{
global $currentIndex, $cookie, $link;
if ($id_customer_thread = (int)Tools::getValue('id_customer_thread'))
{
if (($id_contact = (int)Tools::getValue('id_contact')))
Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'customer_thread SET id_contact = '.(int)$id_contact.' WHERE id_customer_thread = '.(int)$id_customer_thread);
if ($id_status = (int)Tools::getValue('setstatus'))
{
$statusArray = array(1 => 'open', 2 => 'closed', 3 => 'pending1', 4 => 'pending2');
Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'customer_thread SET status = "'.$statusArray[$id_status].'" WHERE id_customer_thread = '.(int)$id_customer_thread.' LIMIT 1');
Tools::redirectAdmin($currentIndex.'&token='.Tools::getValue('token'));
}
if (isset($_POST['id_employee_forward']))
{
// Todo: need to avoid doubles
$messages = Db::getInstance()->ExecuteS('
SELECT ct.*, cm.*, cl.name subject, CONCAT(e.firstname, \' \', e.lastname) employee_name, CONCAT(c.firstname, \' \', c.lastname) customer_name, c.firstname
FROM '._DB_PREFIX_.'customer_thread ct
LEFT JOIN '._DB_PREFIX_.'customer_message cm ON (ct.id_customer_thread = cm.id_customer_thread)
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.(int)$cookie->id_lang.')
LEFT OUTER JOIN '._DB_PREFIX_.'employee e ON e.id_employee = cm.id_employee
LEFT OUTER JOIN '._DB_PREFIX_.'customer c ON (c.email = ct.email)
WHERE ct.id_customer_thread = '.(int)Tools::getValue('id_customer_thread').'
ORDER BY cm.date_add DESC');
$output = '';
foreach ($messages AS $message)
$output .= $this->displayMsgCustom($message, true, (int)Tools::getValue('id_employee_forward'));
$cm = new CustomerMessage();
$cm->id_employee = (int)$cookie->id_employee;
$cm->id_customer_thread = (int)Tools::getValue('id_customer_thread');
$cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']);
$currentEmployee = new Employee($cookie->id_employee);
/* ANTADIS */
$message_en_cours = new CustomerThread((int)Tools::getValue('id_customer_thread'));
if($message_en_cours->id_customer == 0){
$objet_mail = Mail::l('Fwd: Customer message') . ' - ' . $message_en_cours->email;
}else{
$customer_sav = new Customer($message_en_cours->id_customer);
$objet_mail = Mail::l('Fwd: Customer message') . ' - ' . $customer_sav->id . ' ' . $customer_sav->lastname . ' ' .$customer_sav->firstname;
}
if (($id_employee = (int)Tools::getValue('id_employee_forward')) AND ($employee = new Employee($id_employee)) AND Validate::isLoadedObject($employee))
{
$params = array(
'{messages}' => $output,
'{employee}' => $currentEmployee->firstname.' '.$currentEmployee->lastname,
'{comment}' => stripslashes($_POST['message_forward']));
if (Mail::Send((int)($cookie->id_lang), 'forward_msg', $objet_mail , $params,
$employee->email, $employee->firstname.' '.$employee->lastname,
$currentEmployee->email, $currentEmployee->firstname.' '.$currentEmployee->lastname,
NULL, NULL, _PS_MAIL_DIR_, true))
{
$cm->message = $this->l('Message forwarded to').' '.$employee->firstname.' '.$employee->lastname."\n".$this->l('Comment:').' '.$_POST['message_forward'];
$cm->add();
}
}
elseif (($email = Tools::getValue('email')) AND Validate::isEmail($email))
{
$params = array(
'{messages}' => $output,
'{employee}' => $currentEmployee->firstname.' '.$currentEmployee->lastname,
'{comment}' => stripslashes($_POST['message_forward']));
if (Mail::Send((int)($cookie->id_lang), 'forward_msg', $objet_mail , $params,
$email, NULL,
$currentEmployee->email, $currentEmployee->firstname.' '.$currentEmployee->lastname,
NULL, NULL, _PS_MAIL_DIR_, true))
{
$cm->message = $this->l('Message forwarded to').' '.$email."\n".$this->l('Comment:').' '.$_POST['message_forward'];
$cm->add();
}
}
else
echo '<div class="alert error">'.Tools::displayError('Email invalid.').'</div>';
}
if (Tools::isSubmit('submitReply'))
{
$ct = new CustomerThread($id_customer_thread);
$cm = new CustomerMessage();
$cm->id_employee = (int)$cookie->id_employee;
$cm->id_customer_thread = $ct->id;
$cm->message = Tools::htmlentitiesutf8(nl2br2(Tools::getValue('reply_message')));
$cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']);
if (isset($_FILES) AND !empty($_FILES['joinFile']['name']) AND $_FILES['joinFile']['error'] != 0)
$this->_errors[] = Tools::displayError('An error occurred with the file upload.');
elseif ($cm->add())
{
$fileAttachment = NULL;
if (!empty($_FILES['joinFile']['name']))
{
$cm->file_name = $_FILES['joinFile']['name'];
$fileAttachment['content'] = file_get_contents($_FILES['joinFile']['tmp_name']);
$fileAttachment['name'] = $_FILES['joinFile']['name'];
$fileAttachment['mime'] = $_FILES['joinFile']['type'];
}
if($ct->id_contact == 9 || $ct->id_contact == 1) {
$id_reason = Db::getInstance()->getValue('
SELECT sr.`id_reason`
FROM `'._DB_PREFIX_.'support_reason` sr
LEFT JOIN `'._DB_PREFIX_.'support_reason_customerthread` src ON (src.id_reason = sr.id_reason)
WHERE `id_customer_thread` = '.(int)($ct->id)
);
$link_reply = ($ct->id_lang == 3 ? str_replace('com','es',Tools::getShopDomain(true).__PS_BASE_URI__):Tools::getShopDomain(true).__PS_BASE_URI__).'modules/ant_support_form/support.php?id_customer_thread='.(int)($ct->id).'&token='.$ct->token.(($ct->id_contact == 9 || $ct->id_contact == 1)?'&id_contact='.$ct->id_contact : '').((isset($id_reason) && $id_reason)?'&id_reason='.(int)$id_reason : '');
} else {
$link_reply = $link->getPageLink('contact-form.php', true).'?id_customer_thread='.(int)($ct->id).'&token='.$ct->token;
if($ct->id_lang == 3) {
$link_reply = str_replace('com','es',$link_reply);
}
}
$params = array(
'{reply}' => nl2br2(Tools::getValue('reply_message')),
'{link}' => $link_reply);
if (Mail::Send($ct->id_lang, 'reply_msg', Mail::l('An answer to your message is available'),
$params, Tools::getValue('msg_email'), NULL, NULL, NULL, $fileAttachment, NULL,
_PS_MAIL_DIR_, true))
{
$ct->status = 'closed';
$ct->update();
$cm->update();
}
Tools::redirectAdmin($currentIndex.'&id_customer_thread='.(int)$id_customer_thread.'&viewcustomer_thread&token='.Tools::getValue('token'));
}
else
$this->_errors[] = Tools::displayError('An error occurred, your message was not sent. Please contact your system administrator.');
}
}
return parent::postProcess();
}
public function display()
{
global $cookie;
if (isset($_GET['filename']) AND file_exists(_PS_UPLOAD_DIR_.$_GET['filename']))
self::openUploadedFile();
elseif (isset($_GET['view'.$this->table]))
$this->viewcustomer_thread();
else
{
$this->getList((int)$cookie->id_lang, !Tools::getValue($this->table.'Orderby') ? 'date_upd' : NULL, !Tools::getValue($this->table.'Orderway') ? 'DESC' : NULL);
$this->displayList();
}
}
public function displayListHeader($token = NULL)
{
global $currentIndex, $cookie;
$contacts = Db::getInstance()->ExecuteS('
SELECT cl.*, COUNT(*) as total, (
SELECT id_customer_thread
FROM '._DB_PREFIX_.'customer_thread ct2
WHERE status = "open" AND ct.id_contact = ct2.id_contact
ORDER BY date_upd ASC
LIMIT 1
) as id_customer_thread
FROM '._DB_PREFIX_.'customer_thread ct
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.$cookie->id_lang.')
WHERE ct.status = "open"
GROUP BY ct.id_contact HAVING COUNT(*) > 0');
$categories = Db::getInstance()->ExecuteS('
SELECT cl.*
FROM '._DB_PREFIX_.'contact ct
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.$cookie->id_lang.')
ORDER BY ct.`position` ASC');
$dim = count($categories);
echo '<div style="float:left;border:0;width:640px;" class="tab_customer_thread">';
foreach ($categories as $key => $val)
{
$totalThread = 0;
$id_customer_thread = 0;
foreach ($contacts as $tmp => $tmp2)
if ($val['id_contact'] == $tmp2['id_contact'])
{
$totalThread = $tmp2['total'];
$id_customer_thread = $tmp2['id_customer_thread'];
break;
}
echo '<div style="background-color:rgba(226,110,162,0.2);float:left;margin:0 10px 10px 0;width:'.($dim > 6 ? '200' : '300').'px;border:1px solid #CFCFCF" >
<h3 style="overflow:hidden;line-height:25px;color:#e36ea2;height:25px;margin:0;">&nbsp;'.$val['name'].'</h3>'.
($dim > 6 ? '' : '<p style="overflow:hidden;line-height:15px;height:45px;margin:0;padding:0 5px;">'.$val['description'].'</p>').
($totalThread == 0 ? '<h3 style="padding:0 5px;margin:0;height:23px;line-height:23px;background-color:#DEDEDE">'.$this->l('No new message').'</h3>'
: '<a href="'.$currentIndex.'&token='.Tools::getValue('token').'&id_customer_thread='.$id_customer_thread.'&viewcustomer_thread" style="padding:0 5px;display:block;height:23px;line-height:23px;border:0;" class="button">'.$totalThread.' '.($totalThread > 1 ? $this->l('new messages'): $this->l('new message')).'</a>').'
</div>';
}
echo '</div>';
$params = array(
$this->l('Total threads') => $all = Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'customer_thread'),
$this->l('Threads pending') => $pending = Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'customer_thread WHERE status LIKE "%pending%"'),
$this->l('Total customer messages') => Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'customer_message WHERE id_employee = 0'),
$this->l('Total employee messages') => Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'customer_message WHERE id_employee != 0'),
$this->l('Threads unread') => $unread = Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'customer_thread WHERE status = "open"'),
$this->l('Threads closed') => $all - ($unread + $pending));
echo '<div style="float:right;padding 0px;border:1px solid #CFCFCF;width:280px;" class="tab_customer_thread">
<h3 class="button" style="margin:0;line-height:23px;height:23px;border:0;padding:0 5px;">'.$this->l('Customer service').' : '.$this->l('Statistics').'</h3>
<table cellspacing="1" class="table" style="border-collapse:separate;width:280px;border:0">';
$count = 0;
foreach ($params as $key => $val)
echo '<tr '.(++$count % 2 == 0 ? 'class="alt_row"' : '').'><td>'.$key.'</td><td>'.$val.'</td></tr>';
echo ' </table>
</div><p class="clear">&nbsp;</p>
<p style="text-align:right;"><span class="anticon anticon-coin-euro"></span> '.$this->l('> 10€').'</p>
<p style="text-align:right;"><span class="anticon anticon-coin-euro"></span><span class="anticon anticon-coin-euro"></span> '.$this->l('> 100€').'</p>';
$this->displayListHeaderBis($token);
}
public function displayListHeaderBis($token = NULL)
{
global $currentIndex, $cookie;
$isCms = false;
if (preg_match('/cms/Ui', $this->identifier))
$isCms = true;
$id_cat = Tools::getValue('id_'.($isCms ? 'cms_' : '').'category');
if (!isset($token) OR empty($token))
$token = $this->token;
/* Determine total page number */
$totalPages = ceil($this->_listTotal / Tools::getValue('pagination', (isset($cookie->{$this->table.'_pagination'}) ? $cookie->{$this->table.'_pagination'} : $this->_pagination[0])));
if (!$totalPages) $totalPages = 1;
echo '<a name="'.$this->table.'">&nbsp;</a>';
echo '<form id="form_customer_thread" method="post" action="'.$currentIndex;
if (Tools::getIsset($this->identifier))
echo '&'.$this->identifier.'='.(int)(Tools::getValue($this->identifier));
echo '&token='.$token;
if (Tools::getIsset($this->table.'Orderby'))
echo '&'.$this->table.'Orderby='.urlencode($this->_orderBy).'&'.$this->table.'Orderway='.urlencode(strtolower($this->_orderWay));
echo '#'.$this->table.'" class="form">
<input type="hidden" id="submitFilter'.$this->table.'" name="submitFilter'.$this->table.'" value="0">
<table>
<tr>
<td style="vertical-align: bottom;">
<span style="float: left;">';
/* Determine current page number */
$page = (int)(Tools::getValue('submitFilter'.$this->table));
if (!$page) $page = 1;
if ($page > 1)
echo '
<input type="image" src="../img/admin/list-prev2.gif" onclick="getE(\'submitFilter'.$this->table.'\').value=1"/>
&nbsp; <input type="image" src="../img/admin/list-prev.gif" onclick="getE(\'submitFilter'.$this->table.'\').value='.($page - 1).'"/> ';
echo $this->l('Page').' <b>'.$page.'</b> / '.$totalPages;
if ($page < $totalPages)
echo '
<input type="image" src="../img/admin/list-next.gif" onclick="getE(\'submitFilter'.$this->table.'\').value='.($page + 1).'"/>
&nbsp;<input type="image" src="../img/admin/list-next2.gif" onclick="getE(\'submitFilter'.$this->table.'\').value='.$totalPages.'"/>';
echo ' | '.$this->l('Display').'
<select name="pagination">';
/* Choose number of results per page */
$selectedPagination = Tools::getValue('pagination', (isset($cookie->{$this->table.'_pagination'}) ? $cookie->{$this->table.'_pagination'} : NULL));
foreach ($this->_pagination AS $value)
echo '<option value="'.(int)($value).'"'.($selectedPagination == $value ? ' selected="selected"' : (($selectedPagination == NULL && $value == $this->_pagination[1]) ? ' selected="selected2"' : '')).'>'.(int)($value).'</option>';
echo '
</select>
/ '.(int)($this->_listTotal).' '.$this->l('result(s)').'
</span>
<span style="float: right;">
<input type="submit" name="submitReset'.$this->table.'" value="'.$this->l('Reset').'" class="button" />
<input type="submit" id="submitFilterButton_'.$this->table.'" name="submitFilter" value="'.$this->l('Filter').'" class="button" />
</span>
<span class="clear"></span>
</td>
</tr>
<tr>
<td>';
/* Display column names and arrows for ordering (ASC, DESC) */
if (array_key_exists($this->identifier,$this->identifiersDnd) AND $this->_orderBy == 'position')
{
echo '
<script type="text/javascript" src="../js/jquery/jquery.tablednd_0_5.js"></script>
<script type="text/javascript">
var token = \''.($token!=NULL ? $token : $this->token).'\';
var come_from = \''.$this->table.'\';
var alternate = \''.($this->_orderWay == 'DESC' ? '1' : '0' ).'\';
</script>
<script type="text/javascript" src="../js/admin-dnd.js"></script>
';
}
echo '<table'.(array_key_exists($this->identifier,$this->identifiersDnd) ? ' id="'.(((int)(Tools::getValue($this->identifiersDnd[$this->identifier], 1))) ? substr($this->identifier,3,strlen($this->identifier)) : '').'"' : '' ).' class="table'.((array_key_exists($this->identifier,$this->identifiersDnd) AND ($this->_orderBy != 'position 'AND $this->_orderWay != 'DESC')) ? ' tableDnD' : '' ).'" cellpadding="0" cellspacing="0">
<thead>
<tr class="nodrag nodrop">
<th>';
if ($this->delete)
echo ' <input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \''.$this->table.'Box[]\', this.checked)" />';
echo ' </th>';
foreach ($this->fieldsDisplay AS $key => $params)
{
echo ' <th '.(isset($params['widthColumn']) ? 'style="width: '.$params['widthColumn'].'px"' : '').'>'.$params['title'];
if (!isset($params['orderby']) OR $params['orderby'])
{
// Cleaning links
if (Tools::getValue($this->table.'Orderby') && Tools::getValue($this->table.'Orderway'))
$currentIndex = preg_replace('/&'.$this->table.'Orderby=([a-z _]*)&'.$this->table.'Orderway=([a-z]*)/i', '', $currentIndex);
echo ' <br />
<a href="'.$currentIndex.'&'.$this->identifier.'='.$id_cat.'&'.$this->table.'Orderby='.urlencode($key).'&'.$this->table.'Orderway=desc&token='.$token.'"><img border="0" src="../img/admin/down'.((isset($this->_orderBy) AND ($key == $this->_orderBy) AND ($this->_orderWay == 'DESC')) ? '_d' : '').'.gif" /></a>
<a href="'.$currentIndex.'&'.$this->identifier.'='.$id_cat.'&'.$this->table.'Orderby='.urlencode($key).'&'.$this->table.'Orderway=asc&token='.$token.'"><img border="0" src="../img/admin/up'.((isset($this->_orderBy) AND ($key == $this->_orderBy) AND ($this->_orderWay == 'ASC')) ? '_d' : '').'.gif" /></a>';
}
echo ' </th>';
}
/* Check if object can be modified, deleted or detailed */
if ($this->edit OR $this->delete OR ($this->view AND $this->view !== 'noActionColumn'))
echo ' <th style="width: 52px">'.$this->l('Actions').'</th>';
echo ' </tr>
<tr class="nodrag nodrop" style="height: 35px;">
<td class="center">';
if ($this->delete)
echo ' --';
echo ' </td>';
/* Javascript hack in order to catch ENTER keypress event */
$keyPress = 'onkeypress="formSubmit(event, \'submitFilterButton_'.$this->table.'\');"';
/* Filters (input, select, date or bool) */
foreach ($this->fieldsDisplay AS $key => $params)
{
$width = (isset($params['width']) ? ' style="width: '.(int)($params['width']).'px;"' : '');
echo '<td'.(isset($params['align']) ? ' class="'.$params['align'].'"' : '').'>';
if (!isset($params['type']))
$params['type'] = 'text';
$value = Tools::getValue($this->table.'Filter_'.(array_key_exists('filter_key', $params) ? $params['filter_key'] : $key));
if (isset($params['search']) AND !$params['search'])
{
echo '--</td>';
continue;
}
switch ($params['type'])
{
case 'bool':
echo '
<select name="'.$this->table.'Filter_'.$key.'">
<option value="">--</option>
<option value="1"'.($value == 1 ? ' selected="selected"' : '').'>'.$this->l('Yes').'</option>
<option value="0"'.(($value == 0 AND $value != '') ? ' selected="selected"' : '').'>'.$this->l('No').'</option>
</select>';
break;
case 'date':
case 'datetime':
if (is_string($value))
$value = unserialize($value);
if (!Validate::isCleanHtml($value[0]) OR !Validate::isCleanHtml($value[1]))
$value = '';
$name = $this->table.'Filter_'.(isset($params['filter_key']) ? $params['filter_key'] : $key);
$nameId = str_replace('!', '__', $name);
includeDatepicker(array($nameId.'_0', $nameId.'_1'));
echo $this->l('From').' <input type="text" id="'.$nameId.'_0" name="'.$name.'[0]" value="'.(isset($value[0]) ? $value[0] : '').'"'.$width.' '.$keyPress.' /><br />
'.$this->l('To').' <input type="text" id="'.$nameId.'_1" name="'.$name.'[1]" value="'.(isset($value[1]) ? $value[1] : '').'"'.$width.' '.$keyPress.' />';
break;
case 'select':
if (isset($params['filter_key']))
{
echo '<select onchange="$(\'#submitFilter'.$this->table.'\').focus();$(\'#submitFilter'.$this->table.'\').click();" name="'.$this->table.'Filter_'.$params['filter_key'].'" '.(isset($params['width']) ? 'style="width: '.$params['width'].'px"' : '').'>
<option value=""'.(($value == 0 AND $value != '') ? ' selected="selected"' : '').'>--</option>';
if (isset($params['select']) AND is_array($params['select']))
foreach ($params['select'] AS $optionValue => $optionDisplay)
{
echo '<option value="'.$optionValue.'"'.((isset($_POST[$this->table.'Filter_'.$params['filter_key']]) AND Tools::getValue($this->table.'Filter_'.$params['filter_key']) == $optionValue AND Tools::getValue($this->table.'Filter_'.$params['filter_key']) != '') ? ' selected="selected"' : '').'>'.$optionDisplay.'</option>';
}
echo '</select>';
break;
}
case 'text':
default:
if (!Validate::isCleanHtml($value))
$value = '';
echo '<input type="text" name="'.$this->table.'Filter_'.(isset($params['filter_key']) ? $params['filter_key'] : $key).'" value="'.htmlentities($value, ENT_COMPAT, 'UTF-8').'"'.$width.' '.$keyPress.' />';
}
echo '</td>';
}
if ($this->edit OR $this->delete OR ($this->view AND $this->view !== 'noActionColumn'))
echo '<td class="center">--</td>';
echo '</tr>
</thead>';
}
public function displayListContent($token = NULL)
{
/* Display results in a table
*
* align : determine value alignment
* prefix : displayed before value
* suffix : displayed after value
* image : object image
* icon : icon determined by values
* active : allow to toggle status
*/
global $currentIndex, $cookie;
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$id_category = 1; // default categ
$irow = 0;
if ($this->_list AND isset($this->fieldsDisplay['position']))
{
$positions = array_map(create_function('$elem', 'return (int)($elem[\'position\']);'), $this->_list);
sort($positions);
}
if ($this->_list)
{
$isCms = false;
if (preg_match('/cms/Ui', $this->identifier))
$isCms = true;
$keyToGet = 'id_'.($isCms ? 'cms_' : '').'category'.(in_array($this->identifier, array('id_category', 'id_cms_category')) ? '_parent' : '');
foreach ($this->_list AS $tr)
{
$id = $tr[$this->identifier];
echo '<tr'.(array_key_exists($this->identifier,$this->identifiersDnd) ? ' id="tr_'.(($id_category = (int)(Tools::getValue('id_'.($isCms ? 'cms_' : '').'category', '1'))) ? $id_category : '').'_'.$id.'_'.$tr['position'].'"' : '').($irow++ % 2 ? ' class="alt_row"' : '').' '.((isset($tr['color']) AND $this->colorOnBackground) ? 'style="background-color: '.$tr['color'].'"' : '').'>
<td class="center">';
if ($this->delete AND (!isset($this->_listSkipDelete) OR !in_array($id, $this->_listSkipDelete)))
echo '<input type="checkbox" name="'.$this->table.'Box[]" value="'.$id.'" class="noborder" />';
echo '</td>';
foreach ($this->fieldsDisplay AS $key => $params)
{
$tmp = explode('!', $key);
$key = isset($tmp[1]) ? $tmp[1] : $tmp[0];
echo '
<td '.(isset($params['position']) ? ' id="td_'.(isset($id_category) AND $id_category ? $id_category : 0).'_'.$id.'"' : '').' class="'.((!isset($this->noLink) OR !$this->noLink) ? 'pointer' : '').((isset($params['position']) AND $this->_orderBy == 'position')? ' dragHandle' : ''). (isset($params['align']) ? ' '.$params['align'] : '').'" ';
if (!isset($params['position']) AND (!isset($this->noLink) OR !$this->noLink))
echo ' onclick="document.location = \''.$currentIndex.'&'.$this->identifier.'='.$id.($this->view? '&view' : '&update').$this->table.'&token='.($token!=NULL ? $token : $this->token).'\'">'.(isset($params['prefix']) ? $params['prefix'] : '');
else
echo '>';
if ($key == 'id_product'
AND isset($tr[$key])
AND $tr[$key] !=0
AND isset($tr['id_order'])
) {
$order = new Order((int)$tr['id_order']);
$cart = new Cart((int)$order->id_cart);
$products = Db::getInstance()->executeS('
SELECT * FROM `'._DB_PREFIX_.'support_product_customerthread`
WHERE `id_customer_thread` = '.(int)$tr['id_customer_thread']
);
$supTo10 = 0;
$supTo100 = 0;
if(!empty($products)) {
foreach ($products as $product) {
$tax_rate = Tax::getProductTaxRate((int)$product['id_product'], (int)($cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
$price = Product::getPriceStatic((int)$product['id_product'], false, (int)$product['id_product_attribute'], 6, NULL, false, true, 1, false, ((int)($tr['id_customer']) ? (int)($tr['id_customer']) : NULL), (int)($order->id_cart), ((int)($cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}) ? (int)($cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}) : NULL), $specificPriceOutput);
$price = Tools::ps_round($price * (1 + (float)($tax_rate) / 100), 2);
if($price>10){
$supTo10++;
}
if($price>100){
$supTo100++;
}
}
}
echo ($supTo10>0?'<p class="bg-green-light text-green-light"><span class="anticon anticon-coin-euro"></span>'.($supTo100>0?'<span class="anticon anticon-coin-euro"></span>':'').'</p>':'<p class="bg-rose-light text-rose-light"><span class="anticon anticon-cancel-circle"></span</p>');
} elseif ($key == 'id_order' AND isset($tr[$key])) {
$order = new Order((int)$tr[$key]);
$cart = new Cart((int)$order->id_cart);
$nb_products = $cart->nbProducts();
echo '<p>'.($nb_products>0?$nb_products:'--').'</p>';
} elseif ($key == 'order' AND isset($tr['id_order']) AND (int)$tr['id_order']!=0) {
$currency = new Currency((int)(Configuration::get('PS_CURRENCY_DEFAULT')));
$order = new Order((int)$tr['id_order']);
$cart = new Cart((int)$order->id_cart);
echo '<p>'.($order?Tools::displayPrice($cart->getOrderTotal(TRUE),$currency):'--').'</p>';
} elseif (isset($params['active']) AND isset($tr[$key])) {
$this->_displayEnableLink($token, $id, $tr[$key], $params['active'], Tools::getValue('id_category'), Tools::getValue('id_product'));
} elseif (isset($params['activeVisu']) AND isset($tr[$key])) {
echo '<img src="../img/admin/'.($tr[$key] ? 'enabled.gif' : 'disabled.gif').'"
alt="'.($tr[$key] ? $this->l('Enabled') : $this->l('Disabled')).'" title="'.($tr[$key] ? $this->l('Enabled') : $this->l('Disabled')).'" />';
} elseif (isset($params['position'])) {
if ($this->_orderBy == 'position' AND $this->_orderWay != 'DESC')
{
echo '<a'.(!($tr[$key] != $positions[sizeof($positions) - 1]) ? ' style="display: none;"' : '').' href="'.$currentIndex.
'&'.$keyToGet.'='.(int)($id_category).'&'.$this->identifiersDnd[$this->identifier].'='.$id.'
&way=1&position='.(int)($tr['position'] + 1).'&token='.($token!=NULL ? $token : $this->token).'">
<img src="../img/admin/'.($this->_orderWay == 'ASC' ? 'down' : 'up').'.gif"
alt="'.$this->l('Down').'" title="'.$this->l('Down').'" /></a>';
echo '<a'.(!($tr[$key] != $positions[0]) ? ' style="display: none;"' : '').' href="'.$currentIndex.
'&'.$keyToGet.'='.(int)($id_category).'&'.$this->identifiersDnd[$this->identifier].'='.$id.'
&way=0&position='.(int)($tr['position'] - 1).'&token='.($token!=NULL ? $token : $this->token).'">
<img src="../img/admin/'.($this->_orderWay == 'ASC' ? 'up' : 'down').'.gif"
alt="'.$this->l('Up').'" title="'.$this->l('Up').'" /></a>'; }
else
echo (int)($tr[$key] + 1);
}
elseif (isset($params['image']))
{
// item_id is the product id in a product image context, else it is the image id.
$item_id = isset($params['image_id']) ? $tr[$params['image_id']] : $id;
// If it's a product image
if (isset($tr['id_image']))
{
$image = new Image((int)$tr['id_image']);
$path_to_image = _PS_IMG_DIR_.$params['image'].'/'.$image->getExistingImgPath().'.'.$this->imageType;
}else
$path_to_image = _PS_IMG_DIR_.$params['image'].'/'.$item_id.(isset($tr['id_image']) ? '-'.(int)($tr['id_image']) : '').'.'.$this->imageType;
echo cacheImage($path_to_image, $this->table.'_mini_'.$item_id.'.'.$this->imageType, 45, $this->imageType);
}
elseif (isset($params['icon']) AND (isset($params['icon'][$tr[$key]]) OR isset($params['icon']['default'])))
echo '<img src="../img/admin/'.(isset($params['icon'][$tr[$key]]) ? $params['icon'][$tr[$key]] : $params['icon']['default'].'" alt="'.$tr[$key]).'" title="'.$tr[$key].'" />';
elseif (isset($params['anticon']) AND (isset($params['anticon'][$tr[$key]]) OR isset($params['anticon']['default'])))
echo '<span class="anticon '.(isset($params['anticon'][$tr[$key]]) ? $params['anticon'][$tr[$key]] : $params['anticon']['default']).'"> </span>';
elseif (isset($params['price']))
echo Tools::displayPrice($tr[$key], (isset($params['currency']) ? Currency::getCurrencyInstance((int)($tr['id_currency'])) : $currency), false);
elseif (isset($params['float']))
echo rtrim(rtrim($tr[$key], '0'), '.');
elseif (isset($params['type']) AND $params['type'] == 'date')
echo Tools::displayDate($tr[$key], (int)$cookie->id_lang);
elseif (isset($params['type']) AND $params['type'] == 'datetime')
echo Tools::displayDate($tr[$key], (int)$cookie->id_lang, true);
elseif (isset($params['type']) AND $params['type'] == 'datetimeLight')
echo date('d/m/Y H:i',strtotime($tr[$key]));
elseif (isset($tr[$key]))
{
$echo = ($key == 'price' ? round($tr[$key], 2) : isset($params['maxlength']) ? Tools::substr($tr[$key], 0, $params['maxlength']).'...' : $tr[$key]);
echo isset($params['callback']) ? call_user_func_array(array($this->className, $params['callback']), array($echo, $tr)) : $echo;
}
else
echo '--';
echo (isset($params['suffix']) ? $params['suffix'] : '').
'</td>';
}
if ($this->edit OR $this->delete OR ($this->view AND $this->view !== 'noActionColumn'))
{
echo '<td class="center" style="white-space: nowrap;">';
if ($this->view)
$this->_displayViewLink($token, $id);
if ($this->edit)
$this->_displayEditLink($token, $id);
if ($this->delete AND (!isset($this->_listSkipDelete) OR !in_array($id, $this->_listSkipDelete)))
$this->_displayDeleteLink($token, $id);
if ($this->duplicate)
$this->_displayDuplicate($token, $id);
echo '</td>';
}
echo '</tr>';
}
}
}
protected function _displayDeleteLink($token, $id)
{
global $currentIndex;
$_cacheLang['Delete'] = $this->l('Delete');
$_cacheLang['DeleteItem'] = $this->l('Delete item #', __CLASS__, TRUE, FALSE);
echo '
<a class="link-anticon" href="'.$currentIndex.'&'.$this->identifier.'='.$id.'&delete'.$this->table.'&token='.($token!=NULL ? $token : $this->token).'" onclick="return confirm(\''.$_cacheLang['DeleteItem'].$id.' ?'.
(!is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : '').'\');">
<span class="anticon anticon-bin"></span></a>';
}
protected function _displayViewLink($token = NULL, $id)
{
global $currentIndex;
$_cacheLang['View'] = $this->l('View');
echo '
<a class="link-anticon" href="'.$currentIndex.'&'.$this->identifier.'='.$id.'&view'.$this->table.'&token='.($token!=NULL ? $token : $this->token).'">
<span class="anticon anticon-search"></span></a>';
}
private function openUploadedFile()
{
$filename = $_GET['filename'];
$extensions = array('.txt' => 'text/plain', '.rtf' => 'application/rtf', '.doc' => 'application/msword', '.docx'=> 'application/msword',
'.pdf' => 'application/pdf', '.zip' => 'multipart/x-zip', '.png' => 'image/png', '.jpeg' => 'image/jpeg', '.gif' => 'image/gif', '.jpg' => 'image/jpeg');
$extension = '';
foreach ($extensions AS $key => $val)
if (substr($filename, -4) == $key OR substr($filename, -5) == $key)
{
$extension = $val;
break;
}
ob_end_clean();
header('Content-Type: '.$extension);
header('Content-Disposition:attachment;filename="'.$filename.'"');
readfile(_PS_UPLOAD_DIR_.$filename);
die;
}
private function displayMsgCustom($message, $email = false, $id_employee = null)
{
global $cookie, $currentIndex;
$customersToken = Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee));
$contacts = Contact::getContacts($cookie->id_lang);
$output = '<div class="panel-message">';
if (!$email)
{
if (!empty($message['id_product']) AND empty($message['employee_name']))
$id_order_product = Db::getInstance()->getValue('
SELECT o.id_order
FROM '._DB_PREFIX_.'orders o
LEFT JOIN '._DB_PREFIX_.'order_detail od ON o.id_order = od.id_order
WHERE o.id_customer = '.(int)$message['id_customer'].'
AND od.product_id = '.(int)$message['id_product'].'
ORDER BY o.date_add DESC');
$output .= '
<div class="panel-head '.(!empty($message['employee_name'])?'bg-rose':'bg-purple').'">
<div class="panel-head-left">
<div class="user-info">
'.(!empty($message['employee_name'])
?'<span class="anticon anticon-user-tie"></span> '.Configuration::get('PS_SHOP_NAME').' - '.$message['employee_name']
:'<span class="anticon anticon-user"></span>
'.(!empty($message['id_customer'])
?'<a href="index.php?tab=AdminCustomers&id_customer='.(int)($message['id_customer']).'&viewcustomer&token='.$customersToken.'" title="'.$this->l('View customer').'">'.strtoupper($message['customer_name']).'</a>'
: $message['email'])
).
'</div>
<div class="grey div-date"><span class="anticon anticon-clock"></span> '.Tools::displayDate($message['date_add'], (int)($cookie->id_lang), true).'</div>
</div>
<div class="panel-head-right">
'.(
(!empty($message['file_name']) AND file_exists(_PS_UPLOAD_DIR_.$message['file_name']))
? '<a href="index.php?tab=AdminCustomerThreads&id_customer_thread='.$message['id_customer_thread'].'&viewcustomer_thread&token='.Tools::getAdminToken('AdminCustomerThreads'.(int)(Tab::getIdFromClassName('AdminCustomerThreads')).(int)($cookie->id_employee)).'&filename='.$message['file_name'].'" title="'.$this->l('View file').'"><span class="anticon anticon-attachment"></span></a>'
: ''
)
.(empty($message['employee_name'])
?'<a onclick="$(\'#info_'.(int)$message['id_customer_message'].'\').toggle();"><span class="anticon anticon-info"></span></a>'
:'').'
</div>
</div>';
if(empty($message['employee_name'])){
$output .='
<div class="more-info" id="info_'.(int)$message['id_customer_message'].'"" style="font-size:11px">
<h4><span class="anticon anticon-info"></span> '.$this->l('Informations').'</h4>
<ul>';
// if(empty($message['employee_name'])) {
// $output .= '<li><span class="anticon anticon-sphere"></span> '.strip_tags($message['user_agent']).'</li>';
// }
// $output .= '<li><b>'.$this->l('Thread ID:').'</b> '.(int)$message['id_customer_thread'].'</li>
// <li><b>'.$this->l('Message ID:').'</b> '.(int)$message['id_customer_message'].'</li>';
if(!empty($message['id_order']) AND empty($message['employee_name'])) {
$output .= '<li><b>'.$this->l('Order #').'</b> <a href="index.php?tab=AdminOrders&id_order='.(int)($message['id_order']).'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)).'" title="'.$this->l('View order').'">'.(int)($message['id_order']).' <span class="anticon anticon-eye"></span></a></li>';
}
if(!empty($message['id_product']) && empty($message['employee_name'])){
$products = Db::getInstance()->ExecuteS('
SELECT spc.*, od.`product_name` as name, od.`product_quantity`
FROM `ps_support_product_customerthread` spc
LEFT JOIN `ps_order_detail` od ON (od.`product_id` = spc.`id_product` AND od.`id_order` = '.(int)$message['id_order'].')
WHERE spc.`id_customer_thread` = '.(int)$message['id_customer_thread']
);
$output .= '
<li>
<p><b>'.$this->l('Chosen Products:').'</b></p>';
foreach ($products as $key => $product) {
$img_path = '';
$img = Db::getInstance()->getRow('
SELECT id_image
FROM `'._DB_PREFIX_.'image` i
WHERE i.`id_product` = '.(int)$product['id_product'].'
AND i.`cover` = 1'
);
if (isset($img['id_image']) && !empty($img['id_image'])) {
$image_obj = new Image((int)$img['id_image']);
$img_path = (isset($image_obj)?$image_obj->getExistingImgPath():'');
}
$output .= '
<div class="product-box">
<span class="quantity">'.(int)($product['product_return_quantity']).'</span>
<a target="_blank" href="index.php?tab=AdminCatalog&id_product='.(int)($product['id_product']).'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" title="'.$product['name'].'">
<img width="62" src="'.(isset($img_path)?_THEME_PROD_DIR_.$img_path.'-small.jpg':'').'"/>
<p><b>#'.(int)($product['id_product']).'</b><br />'.mb_strimwidth($product['name'], 0, 100, "...").'</p>
</a>
</div>';
}
$output .= '<p class="clear">&nbsp;</p>
</li>';
}
$output .= '
</ul>
</div>';
}
$output .= '<form class="form-subject-message" action="'.Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']).'" method="post">
<label>'.$this->l('Subject:').'</label>
<input type="hidden" name="id_customer_message" value="'.$message['id_customer_message'].'" />
<div class="styled-select semi-square '.(!empty($message['employee_name'])?'bg-rose':'bg-purple-light').'">
<select name="id_contact" class="" onchange="this.form.submit();">';
foreach ($contacts as $contact)
$output .= '<option value="'.(int)$contact['id_contact'].'" '.($contact['id_contact'] == $message['id_contact'] ? 'selected="selected"' : '').'>'.Tools::htmlentitiesutf8($contact['name']).'</option>';
$output .= '</select>
</div>
</form>';
}
else
{
$output .= '
'.($id_employee ? '<a href="'.Tools::getHttpHost(true).$currentIndex.'&token='.Tools::getAdminToken('AdminCustomerThreads'.(int)(Tab::getIdFromClassName('AdminCustomerThreads')).(int)($id_employee)).'&id_customer_thread='.(int)$message['id_customer_thread'].'&viewcustomer_thread">'.$this->l('View this thread').'</a><br />' : '').'
<b>'.$this->l('Sent by:').'</b> '.(!empty($message['customer_name']) ? $message['customer_name'].' ('.$message['email'].')' : $message['email'])
.((!empty($message['id_customer']) AND empty($message['employee_name'])) ? '<br /><b>'.$this->l('Customer ID:').'</b> '.(int)($message['id_customer']).'<br />' : '')
.((!empty($message['id_order']) AND empty($message['employee_name'])) ? '<br /><b>'.$this->l('Order #').':</b> '.(int)($message['id_order']).'<br />' : '')
.((!empty($message['id_product']) AND empty($message['employee_name'])) ? '<br /><b>'.$this->l('Product #').':</b> '.(int)($message['id_product']).'<br />' : '')
.'<b>'.$this->l('Subject:').'</b> '.$message['subject'];
}
$employees = Db::getInstance()->ExecuteS('
SELECT e.id_employee, e.firstname, e.lastname FROM '._DB_PREFIX_.'employee e
WHERE e.active = 1 ORDER BY e.lastname ASC');
$output .= '<form class="form-forward-message" action="'.Tools::htmlentitiesUTF8($_SERVER['REQUEST_URI']).'" method="post" enctype="multipart/form-data">
<div>
<label for="id_employee_forward">'.$this->l('Forward this discussion to an employee:').'</label>
<div class="styled-select semi-square '.(!empty($message['employee_name'])?'bg-rose':'bg-purple-light').'">
<select name="id_employee_forward" style="vertical-align: middle;" onchange="
if ($(this).val() >= 0)
$(\'#message_forward\').show(400);
else
$(\'#message_forward\').hide(200);
if ($(this).val() == 0)
$(\'#message_forward_email\').show(200);
else
$(\'#message_forward_email\').hide(200);
">
<option value="-1">'.$this->l('-- Choose --').'</option>
<option value="0">'.$this->l('Someone else').'</option>';
foreach ($employees AS $employee) {
$output.= ' <option value="'.(int)($employee['id_employee']).'">'.substr($employee['firstname'], 0, 1).'. '.$employee['lastname'].'</option>';
}
$output.= ' </select>
</div>
<div id="message_forward_email" style="display:none">
<b>'.$this->l('E-mail').'</b> <input type="text" name="email" />
</div>
<div id="message_forward" style="display:none;margin-bottom:10px">
<textarea name="message_forward" style="width: 340px; height: 80px; margin-top: 15px;" onclick="if ($(this).val() == \''.addslashes($this->l('You can add a comment here.')).'\') { $(this).val(\'\'); }">'.$this->l('You can add a comment here.').'</textarea><br />
<input type="Submit" name="submitForward" class="button" value="'.$this->l('Forward this discussion').'" style="margin-top: 10px;" />
</div>
</div>
</form>';
if(!empty($message['employee_name']) && !empty($message['file_name'])) {
$output .='<p>Fichier joint : '.$message['file_name'].'</p>';
}
// Adding Antadis - linking with ant_support_form module
if (Module::isInstalled('ant_support_form')) {
$result = Db::getInstance()->getRow('
SELECT sr.*, srl.title
FROM `'._DB_PREFIX_.'support_reason` sr
LEFT JOIN `'._DB_PREFIX_.'support_reason_lang` srl ON (srl.id_reason = sr.id_reason)
LEFT JOIN `'._DB_PREFIX_.'support_reason_customerthread` src ON (src.id_reason = sr.id_reason)
WHERE `id_customer_thread` = '.(int) $message['id_customer_thread'].'
AND srl.id_lang = '.$cookie->id_lang
);
if ($result) {
$output .='<br />
<b>'.$this->l('Reason:').'</b> '.$result['title'].'<br />';
}
}
// end adding
$message['message'] = preg_replace('/(https?:\/\/[a-z0-9#%&_=\(\)\.\? \+\-@\/]{6,1000})([\s\n<])/Uui', '<a href="\1">\1</a>\2', html_entity_decode($message['message'], ENT_NOQUOTES, 'UTF-8'));
$output .= '<div class="panel-content-message '.(!empty($message['employee_name'])?'bg-rose':'bg-purple').'">
<b>'.$this->l('Message:').'</b><br />
'.$message['message'].'
</div>';
if (!$email)
{
if (empty($message['employee_name'])) {
$orderMessages = OrderMessage::getOrderMessages((int)($message['id_lang']));
$output .= '
<p class="btn-answer" style="text-align:right">
<button class="button" onclick="$(\'#reply_to_'.(int)($message['id_customer_message']).'\').show(500); $(this).hide();">
<span class="anticon anticon-bubbles3"></span> '.$this->l('Reply to this message').'
</button>
</p>
<p class="clear">&nbsp;</p>
<div id="reply_to_'.(int)($message['id_customer_message']).'" style="display: none; margin-top: 10px;" class="panel-answer">
<form action="'.Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']).'" method="post" enctype="multipart/form-data">
<p>'.$this->l('Please type your reply below:').'</p>
<div class="styled-select bg-purple-light semi-square">
<select name="order_message" id="order_message" onchange="savOverwriteMessage(this, \''.$this->l('Do you want to overwrite your existing message?').'\', \''.(int)($message['id_customer_message']).'\')">
<option value="0" selected="selected">-- '.$this->l('Choose a standard message').' --</option>';
foreach ($orderMessages AS $orderMessage) {
$output .= '<option value="'.htmlentities($orderMessage['message'], ENT_COMPAT, 'UTF-8').'">'.$orderMessage['name'].'</option>';
}
$output .= '
</select>
</div>
<div style="width: 450px; margin-top: 0px;margin-bottom:5px;">
<input type="file" name="joinFile"/>
</div>
<textarea id="txt_msg_'.(int)($message['id_customer_message']).'" name="reply_message">'.str_replace('\r\n', "\n", Configuration::get('PS_CUSTOMER_SERVICE_SIGNATURE', $message['id_lang'])).'</textarea>
<div style="text-align: right; font-style: italic; font-size: 9px; margin-top: 2px;">
'.$this->l('Your reply will be sent to:').' '.$message['email'].'
</div>
<div style="text-align: right;">
<input type="submit" class="button" name="submitReply" value="'.$this->l('Send my reply').'" style="margin-top:20px;" />
<input type="hidden" name="id_customer_thread" value="'.(int)($message['id_customer_thread']).'" />
<input type="hidden" name="msg_email" value="'.$message['email'].'" />
</div>
</form>
</div>';
}
}
$output .= '</div>';
return $output;
}
private function displayMsg($message, $email = false, $id_employee = null)
{
global $cookie, $currentIndex;
$customersToken = Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)($cookie->id_employee));
$contacts = Contact::getContacts($cookie->id_lang);
if (!$email)
{
if (!empty($message['id_product']) AND empty($message['employee_name']))
$id_order_product = Db::getInstance()->getValue('
SELECT o.id_order
FROM '._DB_PREFIX_.'orders o
LEFT JOIN '._DB_PREFIX_.'order_detail od ON o.id_order = od.id_order
WHERE o.id_customer = '.(int)$message['id_customer'].'
AND od.product_id = '.(int)$message['id_product'].'
ORDER BY o.date_add DESC');
$output = '
<fieldset style="'.(!empty($message['employee_name']) ? 'background: rgb(255,236,242);' : '').'width:600px;margin-top:10px">
<legend '.(empty($message['employee_name']) ? '' : 'style="background:rgb(255,210,225)"').'>'.(
!empty($message['employee_name'])
? '<img src="../img/t/AdminCustomers.gif" alt="'.Configuration::get('PS_SHOP_NAME').'" /> '.Configuration::get('PS_SHOP_NAME').' - '.$message['employee_name']
: '<img src="'.__PS_BASE_URI__.'img/admin/tab-customers.gif" alt="'.Configuration::get('PS_SHOP_NAME').'" /> '.(
!empty($message['id_customer'])
? '<a href="index.php?tab=AdminCustomers&id_customer='.(int)($message['id_customer']).'&viewcustomer&token='.$customersToken.'" title="'.$this->l('View customer').'">'.$message['customer_name'].'</a>'
: $message['email']
)
).'</legend>
<div style="font-size:11px">'.(
(!empty($message['id_customer']) AND empty($message['employee_name']))
? '<b>'.$this->l('Customer ID:').'</b> <a href="index.php?tab=AdminCustomers&id_customer='.(int)($message['id_customer']).'&viewcustomer&token='.$customersToken.'" title="'.$this->l('View customer').'">'.(int)($message['id_customer']).' <img src="../img/admin/search.gif" alt="'.$this->l('view').'" /></a><br />'
: ''
).'
<b>'.$this->l('Sent on:').'</b> '.Tools::displayDate($message['date_add'], (int)($cookie->id_lang), true).'<br />'.(
empty($message['employee_name'])
? '<b>'.$this->l('Browser:').'</b> '.strip_tags($message['user_agent']).'<br />'
: ''
).(
(!empty($message['file_name']) AND file_exists(_PS_UPLOAD_DIR_.$message['file_name']))
? '<b>'.$this->l('File attachment').'</b> <a href="index.php?tab=AdminCustomerThreads&id_customer_thread='.$message['id_customer_thread'].'&viewcustomer_thread&token='.Tools::getAdminToken('AdminCustomerThreads'.(int)(Tab::getIdFromClassName('AdminCustomerThreads')).(int)($cookie->id_employee)).'&filename='.$message['file_name'].'" title="'.$this->l('View file').'"><img src="../img/admin/search.gif" alt="'.$this->l('view').'" /></a><br />'
: ''
).(
(!empty($message['id_order']) AND empty($message['employee_name']))
? '<b>'.$this->l('Order #').'</b> <a href="index.php?tab=AdminOrders&id_order='.(int)($message['id_order']).'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)).'" title="'.$this->l('View order').'">'.(int)($message['id_order']).' <img src="../img/admin/search.gif" alt="'.$this->l('view').'" /></a><br />'
: ''
).(
(!empty($message['id_product']) AND empty($message['employee_name']))
? '<b>'.$this->l('Product #').'</b> <a href="index.php?tab=AdminOrders&id_order='.(int)($id_order_product).'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)).'" title="'.$this->l('View order').'">'.(int)($message['id_product']).' <img src="../img/admin/search.gif" alt="'.$this->l('view').'" /></a><br />'
: ''
).'<br />
<form action="'.Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']).'" method="post">
<b>'.$this->l('Subject:').'</b>
<input type="hidden" name="id_customer_message" value="'.$message['id_customer_message'].'" />
<select name="id_contact" onchange="this.form.submit();">';
foreach ($contacts as $contact)
$output .= '<option value="'.(int)$contact['id_contact'].'" '.($contact['id_contact'] == $message['id_contact'] ? 'selected="selected"' : '').'>'.Tools::htmlentitiesutf8($contact['name']).'</option>';
$output .= '</select>
</form>';
}
else
{
$output = '<div style="font-size:11px">
'.($id_employee ? '<a href="'.Tools::getHttpHost(true).$currentIndex.'&token='.Tools::getAdminToken('AdminCustomerThreads'.(int)(Tab::getIdFromClassName('AdminCustomerThreads')).(int)($id_employee)).'&id_customer_thread='.(int)$message['id_customer_thread'].'&viewcustomer_thread">'.$this->l('View this thread').'</a><br />' : '').'
<b>'.$this->l('Sent by:').'</b> '.(!empty($message['customer_name']) ? $message['customer_name'].' ('.$message['email'].')' : $message['email'])
.((!empty($message['id_customer']) AND empty($message['employee_name'])) ? '<br /><b>'.$this->l('Customer ID:').'</b> '.(int)($message['id_customer']).'<br />' : '')
.((!empty($message['id_order']) AND empty($message['employee_name'])) ? '<br /><b>'.$this->l('Order #').':</b> '.(int)($message['id_order']).'<br />' : '')
.((!empty($message['id_product']) AND empty($message['employee_name'])) ? '<br /><b>'.$this->l('Product #').':</b> '.(int)($message['id_product']).'<br />' : '')
.'<br /><b>'.$this->l('Subject:').'</b> '.$message['subject'];
}
// Adding Antadis - linking with ant_support_form module
if (Module::isInstalled('ant_support_form')) {
$result = Db::getInstance()->getRow('
SELECT sr.*, srl.title
FROM `'._DB_PREFIX_.'support_reason` sr
LEFT JOIN `'._DB_PREFIX_.'support_reason_lang` srl ON (srl.id_reason = sr.id_reason)
LEFT JOIN `'._DB_PREFIX_.'support_reason_customerthread` src ON (src.id_reason = sr.id_reason)
WHERE `id_customer_thread` = '.(int) $message['id_customer_thread'].'
AND srl.id_lang = '.$cookie->id_lang
);
if ($result) {
$output .='<br /><br />
<b>'.$this->l('Reason:').'</b> '.$result['title'].'<br />';
}
}
// end adding
$message['message'] = preg_replace('/(https?:\/\/[a-z0-9#%&_=\(\)\.\? \+\-@\/]{6,1000})([\s\n<])/Uui', '<a href="\1">\1</a>\2', html_entity_decode($message['message'], ENT_NOQUOTES, 'UTF-8'));
$output .= '<br /><br />
<b>'.$this->l('Thread ID:').'</b> '.(int)$message['id_customer_thread'].'<br />
<b>'.$this->l('Message ID:').'</b> '.(int)$message['id_customer_message'].'<br />
<b>'.$this->l('Message:').'</b><br />
'.$message['message'].'
</div>';
if (!$email)
{
if (empty($message['employee_name']))
$output .= '
<p style="text-align:right">
<button style="font-family: Verdana; font-size: 11px; font-weight:bold; height: 65px; width: 120px;" onclick="$(\'#reply_to_'.(int)($message['id_customer_message']).'\').show(500); $(this).hide();">
<img src="'.__PS_BASE_URI__.'img/admin/contact.gif" alt="" style="margin-bottom: 5px;" /><br />'.$this->l('Reply to this message').'
</button>
</p>
<div id="reply_to_'.(int)($message['id_customer_message']).'" style="display: none; margin-top: 20px;"">
<form action="'.Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']).'" method="post" enctype="multipart/form-data">
<p>'.$this->l('Please type your reply below:').'</p>
<textarea style="width: 450px; height: 175px;" name="reply_message">'.str_replace('\r\n', "\n", Configuration::get('PS_CUSTOMER_SERVICE_SIGNATURE', $message['id_lang'])).'</textarea>
<div style="width: 450px; text-align: right; font-style: italic; font-size: 9px; margin-top: 2px;">
'.$this->l('Your reply will be sent to:').' '.$message['email'].'
</div>
<div style="width: 450px; margin-top: 0px;">
<input type="file" name="joinFile"/>
<div>
<div style="width: 450px; text-align: center;">
<input type="submit" class="button" name="submitReply" value="'.$this->l('Send my reply').'" style="margin-top:20px;" />
<input type="hidden" name="id_customer_thread" value="'.(int)($message['id_customer_thread']).'" />
<input type="hidden" name="msg_email" value="'.$message['email'].'" />
</div>
</form>
</div>';
$output .= '
</fieldset>';
}
return $output;
}
public function viewcustomer_thread()
{
global $cookie, $currentIndex;
if (!($thread = $this->loadObject()))
return;
$cookie->{'customer_threadFilter_cl!id_contact'} = $thread->id_contact;
echo '
<h2>'.$this->l('Messages').'</h2>
<div class="btn-action">';
// if ($nextThread)
// echo $this->displayButton('
// <a href="'.$currentIndex.'&id_customer_thread='.(int)$nextThread.'&viewcustomer_thread&token='.$this->token.'">
// '.$this->l('Answer to the next unanswered message in this category').' &gt;
// </a>');
// else
// echo $this->displayButton('
// <span class="non-action"><span class="anticon anticon-tick">&#xea10;</span> '.$this->l('The other messages in this category have been answered').'</span>');
if ($thread->status != "closed")
echo $this->displayButton('
<a href="'.$currentIndex.'&viewcustomer_thread&setstatus=2&id_customer_thread='.Tools::getValue('id_customer_thread').'&viewmsg&token='.$this->token.'">
<span class="anticon anticon-tick">&#xea10;</span> '.$this->l('Set this message as handled').'
</a>');
if ($thread->status != "pending1")
echo $this->displayButton('
<a href="'.$currentIndex.'&viewcustomer_thread&setstatus=3&id_customer_thread='.Tools::getValue('id_customer_thread').'&viewmsg&token='.$this->token.'">
<span class="anticon anticon-tick">&#xea07;</span> '.$this->l('pending 1').'
</a>');
else
echo $this->displayButton('
<a class="active" href="'.$currentIndex.'&viewcustomer_thread&setstatus=1&id_customer_thread='.Tools::getValue('id_customer_thread').'&viewmsg&token='.$this->token.'">
<span class="anticon anticon-tick">&#xea07;</span> '.$this->l('In Pending 1').'
</a>');
if ($thread->status != "pending2")
echo $this->displayButton('
<a href="'.$currentIndex.'&viewcustomer_thread&setstatus=4&id_customer_thread='.Tools::getValue('id_customer_thread').'&viewmsg&token='.$this->token.'">
<span class="anticon anticon-tick">&#xea07;</span> '.$this->l('pending 2').'
</a>');
else
echo $this->displayButton('
<a class="active" href="'.$currentIndex.'&viewcustomer_thread&setstatus=1&id_customer_thread='.Tools::getValue('id_customer_thread').'&viewmsg&token='.$this->token.'">
<span class="anticon anticon-tick">&#xea07;</span> '.$this->l('In Pending 2').'
</a>');
echo '</div><div class="clear">&nbsp;</div>';
$messages = Db::getInstance()->ExecuteS('
SELECT ct.*, cm.*, cl.name subject, CONCAT(e.firstname, \' \', e.lastname) employee_name, CONCAT(c.firstname, \' \', c.lastname) customer_name, c.firstname
FROM '._DB_PREFIX_.'customer_thread ct
LEFT JOIN '._DB_PREFIX_.'customer_message cm ON (ct.id_customer_thread = cm.id_customer_thread)
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.(int)$cookie->id_lang.')
LEFT JOIN '._DB_PREFIX_.'employee e ON e.id_employee = cm.id_employee
LEFT JOIN '._DB_PREFIX_.'customer c ON (IFNULL(ct.id_customer, ct.email) = IFNULL(c.id_customer, c.email))
WHERE ct.id_customer_thread = '.(int)Tools::getValue('id_customer_thread').'
ORDER BY cm.date_add DESC');
echo '<div style="float:right">';
$nextThread = Db::getInstance()->getValue('
SELECT id_customer_thread FROM '._DB_PREFIX_.'customer_thread ct
WHERE ct.status = "open" AND ct.date_upd = (
SELECT date_add FROM '._DB_PREFIX_.'customer_message
WHERE (id_employee IS NULL OR id_employee = 0) AND id_customer_thread = '.(int)$thread->id.'
ORDER BY date_add DESC LIMIT 1
)
'.($cookie->{'customer_threadFilter_cl!id_contact'} ? 'AND ct.id_contact = '.(int)$cookie->{'customer_threadFilter_cl!id_contact'} : '').'
'.($cookie->{'customer_threadFilter_l!id_lang'} ? 'AND ct.id_lang = '.(int)$cookie->{'customer_threadFilter_l!id_lang'} : '').
' ORDER BY ct.date_upd ASC');
$order_thread = null;
foreach ($messages AS $message){
if ($message['id_order']){
$order_thread = new Order((int)($message['id_order']));
break;
}
}
if ($thread->id_customer) {
$customer = new Customer($thread->id_customer);
$products = $customer->getBoughtProducts();
$nb_orders = Db::getInstance()->getValue('
SELECT COUNT(id_order) FROM '._DB_PREFIX_.'orders
WHERE id_customer = '.(int)$customer->id.' AND valid=1
');
$customer_info = array(
'nb_orders' => $nb_orders,
);
}
echo '<div style="margin-top:10px">';
if ($thread->id_customer) {
Module::hookExec('rightColumnSav', array(
'customer' => $customer,
'customer_info' => $customer_info,
'order' => $order_thread)
);
}
echo '</div>';
echo '</div>';
echo '<div style="float:left;margin-top:10px"><div>';
foreach ($messages AS $message) {
echo $this->displayMsgCustom($message);
}
echo '</div>';
if ($thread->id_customer) {
$conversations = CustomerThread::getCustomerConversations((int)$customer->id,'ASC',(int)Tools::getValue('id_customer_thread'));
if(!empty($conversations)){
echo '<div>';
$this->displayOldMessages($conversations,$customer);
echo '</div>';
}
}
echo '</div>';
echo '<div class="clear">&nbsp;</div>';
if ($thread->id_customer)
{
$customer = new Customer($thread->id_customer);
//$products = $customer->getBoughtProducts();
$orders = Order::getCustomerOrders($customer->id);
echo '<div style="float:left;width:700px">';
if ($orders AND sizeof($orders))
{
$totalOK = 0;
$ordersOK = array();
$tokenOrders = Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee));
foreach ($orders as $order)
if ($order['valid'])
{
$ordersOK[] = $order;
$totalOK += $order['total_paid_real'];
}
if ($countOK = sizeof($ordersOK))
{
echo '<div style="float:left;margin-right:20px;">
<h2>'.$this->l('Orders').'</h2>
<h3 style="font-weight:700;margin-top:10px">'.$this->l('Validated Orders:').' '.$countOK.' '.$this->l('for').' '.Tools::displayPrice($totalOK, new Currency(Configuration::get('PS_CURRENCY_DEFAULT'))).'</h3>
<table cellspacing="0" cellpadding="0" class="table float customerThread-table">
<tr>
<th class="center">'.$this->l('ID').'</th>
<th class="center">'.$this->l('Date').'</th>
<th class="center">'.$this->l('Products').'</th>
<th class="center">'.$this->l('Total paid').'</th>
<th class="center">'.$this->l('Payment').'</th>
<th class="center">'.$this->l('State').'</th>
<th class="center">'.$this->l('Actions').'</th>
</tr>';
$irow = 0;
foreach ($ordersOK AS $order)
echo '<tr '.($irow++ % 2 ? 'class="alt_row"' : '').' style="cursor: pointer" onclick="document.location = \'?tab=AdminOrders&id_order='.$order['id_order'].'&vieworder&token='.$tokenOrders.'\'">
<td class="center">'.$order['id_order'].'</td>
<td>'.Tools::displayDate($order['date_add'], (int)($cookie->id_lang)).'</td>
<td align="right">'.$order['nb_products'].'</td>
<td align="right">'.Tools::displayPrice($order['total_paid_real'], new Currency((int)($order['id_currency']))).'</td>
<td>'.$order['payment'].'</td>
<td>'.$order['order_state'].'</td>
<td align="center"><a href="?tab=AdminOrders&id_order='.$order['id_order'].'&vieworder&token='.$tokenOrders.'"><img src="../img/admin/details.gif" /></a></td>
</tr>';
echo '</table>
</div>';
}
}
// if ($products AND sizeof($products))
// {
// echo '<div style="float:left;margin-right:20px">
// <h2>'.$this->l('Products').'</h2>
// <table cellspacing="0" cellpadding="0" class="table customerThread-table">
// <tr>
// <th class="center">'.$this->l('Date').'</th>
// <th class="center">'.$this->l('ID').'</th>
// <th class="center">'.$this->l('Name').'</th>
// <th class="center">'.$this->l('Quantity').'</th>
// <th class="center">'.$this->l('Actions').'</th>
// </tr>';
// $irow = 0;
// $tokenOrders = Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee));
// foreach ($products AS $product)
// echo '
// <tr '.($irow++ % 2 ? 'class="alt_row"' : '').' style="cursor: pointer" onclick="document.location = \'?tab=AdminOrders&id_order='.$product['id_order'].'&vieworder&token='.$tokenOrders.'\'">
// <td>'.Tools::displayDate($product['date_add'], (int)($cookie->id_lang), true).'</td>
// <td>'.$product['product_id'].'</td>
// <td>'.$product['product_name'].'</td>
// <td align="right">'.$product['product_quantity'].'</td>
// <td align="center"><a href="?tab=AdminOrders&id_order='.$product['id_order'].'&vieworder&token='.$tokenOrders.'"><img src="../img/admin/details.gif" /></a></td>
// </tr>';
// echo '</table>
// </div>';
// }
echo '</div>';
}
echo '<div class="clear">&nbsp;</div>';
}
private function displayOldMessages($conversations,$customer)
{
global $cookie;
$output = '<div class="panel-message">';
foreach($conversations as $key => $conv){
$output .= '<div class="panel-head" style=background-color:#efefef;'.($key!=0?'margin-top:30px;':'').'">
<div class="panel-head-left">
<div class="user-info">
<span class="anticon anticon-bubbles2"></span>
<a href="index.php?tab=AdminCustomerThreads&id_customer_thread='.(int)($conv['id_customer_thread']).'&viewcustomer_thread&token='.Tools::getAdminTokenLite('AdminCustomerThreads').'" title=Voir la conversation"> Conversation #'.(int)($conv['id_customer_thread']).' ('.$conv['status'].')</a>
</div>
<div class="grey div-date"><span class="anticon anticon-clock"></span> '.Tools::displayDate($conv['date_add'], (int)($cookie->id_lang), true).'</div>
</div>
</div>';
$messages = Db::getInstance()->ExecuteS('
SELECT ct.*, cm.*, cl.name subject, CONCAT(e.firstname, \' \', e.lastname) employee_name, CONCAT(c.firstname, \' \', c.lastname) customer_name, c.firstname
FROM '._DB_PREFIX_.'customer_thread ct
LEFT JOIN '._DB_PREFIX_.'customer_message cm ON (ct.id_customer_thread = cm.id_customer_thread)
LEFT JOIN '._DB_PREFIX_.'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = '.(int)$cookie->id_lang.')
LEFT JOIN '._DB_PREFIX_.'employee e ON e.id_employee = cm.id_employee
LEFT JOIN '._DB_PREFIX_.'customer c ON (IFNULL(ct.id_customer, ct.email) = IFNULL(c.id_customer, c.email))
WHERE ct.id_customer_thread = '.(int)($conv['id_customer_thread']).' AND ct.id_customer_thread != '.(int)Tools::getValue('id_customer_thread').'
ORDER BY cm.date_add DESC'
);
foreach ($messages as $key => $message) {
if(!empty($message['employee_name'])) {
$output .= '<p style="margin:0;text-align:right;">Bébé Boutik <span class="anticon anticon-user-tie"></span></p>
<div class="panel-content-message bg-rose" style="margin:0 0 10px 0;">
<b>Message</b><br>
'.$message['message'] = preg_replace('/(https?:\/\/[a-z0-9#%&_=\(\)\.\? \+\-@\/]{6,1000})([\s\n<])/Uui', '<a href="\1">\1</a>\2', html_entity_decode($message['message'], ENT_NOQUOTES, 'UTF-8')).'
</div>';
} else {
$output .= '<p style="margin:0; text-transform: capitalize;"><span class="anticon anticon-user"></span> '.$customer->firstname.' '.$customer->lastname.'</p>
<div class="panel-content-message bg-purple" style="margin:0 0 10px 0;">
<b>Message</b><br>
'.$message['message'] = preg_replace('/(https?:\/\/[a-z0-9#%&_=\(\)\.\? \+\-@\/]{6,1000})([\s\n<])/Uui', '<a href="\1">\1</a>\2', html_entity_decode($message['message'], ENT_NOQUOTES, 'UTF-8')).'
</div>';
}
}
}
$output .= '</div>';
echo $output;
}
private function displayButton($content)
{
return '
<div class="btn-action-message">
<p style="text-align:center;font-size:13px;">
'.$content.'
</p>
</div>';
}
}