| Current Path : /var/www/html/administrator/components/com_jchat/tmpl/lamessages/ |
| Current File : /var/www/html/administrator/components/com_jchat/tmpl/lamessages/default_list.php |
<?php
/**
* @package JCHAT::LAMESSAGES::administrator::components::com_jchat
* @subpackage views
* @subpackage lamessages
* @subpackage tmpl
* @author Joomla! Extensions Store
* @copyright (C) 2024 - Joomla! Extensions Store
* @license GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html
*/
defined ( '_JEXEC' ) or die ( 'Restricted access' );
use Joomla\CMS\Language\Text;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
?>
<form action="index.php" method="post" name="adminForm" id="adminForm">
<table class="headerlist">
<tr>
<td class="left">
<div class="input-group">
<span class="input-group-text" aria-label="<?php echo Text::_('COM_JCHAT_FILTER');?>"><span class="icon-filter" aria-hidden="true"></span> <?php echo Text::_('COM_JCHAT_FILTER' ); ?>:</span>
<input type="text" name="search" id="search" value="<?php echo htmlspecialchars($this->searchword, ENT_COMPAT, 'UTF-8');?>" class="text_area"/>
</div>
<button class="btn btn-primary btn-sm" onclick="this.form.submit();"><?php echo Text::_('COM_JCHAT_GO' ); ?></button>
<button class="btn btn-primary btn-sm" onclick="document.getElementById('search').value='';this.form.submit();"><?php echo Text::_('COM_JCHAT_RESET' ); ?></button>
<div class="clr vspacer"></div>
<div class="input-group input-group-date active">
<span class="input-group-text" aria-label="<?php echo Text::_('COM_JCHAT_FILTER_BY_DATE_FROM');?>"><span class="icon-calendar" aria-hidden="true"></span> <?php echo Text::_('COM_JCHAT_FILTER_BY_DATE_FROM' ); ?>:</span>
<input type="text" name="fromperiod" id="fromPeriod" data-role="calendar" autocomplete="off" value="<?php echo $this->dates['start'];?>" class="text_area"/>
</div>
<div class="input-group input-group-date active">
<span class="input-group-text" aria-label="<?php echo Text::_('COM_JCHAT_FILTER_BY_DATE_TO');?>"><span class="icon-calendar" aria-hidden="true"></span> <?php echo Text::_('COM_JCHAT_FILTER_BY_DATE_TO' ); ?>:</span>
<input type="text" name="toperiod" id="toPeriod" data-role="calendar" autocomplete="off" value="<?php echo $this->dates['to'];?>" class="text_area"/>
</div>
<button class="btn btn-primary btn-sm" onclick="document.adminForm.task.value='lamessages.display';this.form.submit();"><?php echo Text::_('COM_JCHAT_GO' ); ?></button>
<button class="btn btn-primary btn-sm" onclick="document.getElementById('fromPeriod').value='';document.getElementById('toPeriod').value='';this.form.submit();"><?php echo Text::_('COM_JCHAT_RESET' ); ?></button>
</td>
<td class="right d-flex justify-content-end">
<div class="input-group d-none d-md-inline-flex flex-end">
<span class="input-group-text" aria-label="<?php echo Text::_('COM_JCHAT_STATE');?>"><span class="icon-filter" aria-hidden="true"></span> <?php echo Text::_('COM_JCHAT_STATE' ); ?></span>
<label class="visually-hidden" for="workedfilter"><?php echo Text::_('COM_JCHAT_ALL_TICKETS');?></label>
<?php
echo $this->lists['answered'];
?>
<label class="visually-hidden" for="closedfilter"><?php echo Text::_('COM_JCHAT_ALL_TICKETS');?></label>
<?php
echo $this->lists['closed'];
?>
<label class="visually-hidden" for="limit"><?php echo Text::_('JGLOBAL_LIST_LIMIT');?></label>
<?php
echo $this->pagination->getLimitBox();
?>
</div>
</td>
</tr>
</table>
<table class="adminlist table table-striped" cellpadding="1">
<thead>
<tr>
<th width="5%" class="title">
<?php echo Text::_( 'COM_JCHAT_NUM' ); ?>
</th>
<th width="1%" class="title">
<input type="checkbox" name="checkall-toggle" value="" class="form-check-input" onclick="Joomla.checkAll(this);" />
</th>
<th width="8%"class="title">
<?php echo HTMLHelper::_('grid.sort', 'COM_JCHAT_LAMESSAGE_NAME', 'a.name', @$this->orders['order_Dir'], @$this->orders['order'], 'lamessages.display' ); ?>
</th>
<th width="8%" class="title d-none d-md-table-cell" >
<?php echo HTMLHelper::_('grid.sort', 'COM_JCHAT_LAMESSAGE_EMAIL', 'a.email', @$this->orders['order_Dir'], @$this->orders['order'], 'lamessages.display' ); ?>
</th>
<?php if($this->phoneNumberEnabled):?>
<th width="8%" class="title d-none d-md-table-cell">
<?php echo Text::_('COM_JCHAT_LAMESSAGE_PHONENUMBER'); ?>
</th>
<?php endif;?>
<th width="25%" class="title d-none d-md-table-cell">
<?php echo Text::_('COM_JCHAT_MESSAGE'); ?>
</th>
<th width="5%" class="title d-none d-md-table-cell">
<?php echo HTMLHelper::_('grid.sort', 'COM_JCHAT_SENT', 'a.sentdate', @$this->orders['order_Dir'], @$this->orders['order'], 'lamessages.display' ); ?>
</th>
<th width="5%" class="title d-none d-md-table-cell">
<?php echo Text::_('COM_JCHAT_NUM_REPLIES');?>
</th>
<th width="5%" class="title">
<?php echo Text::_('COM_JCHAT_LAST_REPLY');?>
</th>
<th width="5%" class="title d-none d-md-table-cell">
<?php echo HTMLHelper::_('grid.sort', 'COM_JCHAT_USERID', 'a.userid', @$this->orders['order_Dir'], @$this->orders['order'], 'lamessages.display' ); ?>
</th>
<th width="5%" class="title">
<?php echo HTMLHelper::_('grid.sort', 'COM_JCHAT_WORKED', 'a.worked', @$this->orders['order_Dir'], @$this->orders['order'], 'lamessages.display' ); ?>
</th>
<th width="5%" class="title">
<?php echo HTMLHelper::_('grid.sort', 'COM_JCHAT_CLOSED_TICKET', 'a.closed_ticket', @$this->orders['order_Dir'], @$this->orders['order'], 'lamessages.display' ); ?>
</th>
<th width="1%" class="title d-none d-md-table-cell" nowrap="nowrap">
<?php echo HTMLHelper::_('grid.sort', 'ID', 'a.id', @$this->orders['order_Dir'], @$this->orders['order'], 'lamessages.display' ); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="100%">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php
$k = 0;
for ($i=0, $n=count( $this->items ); $i < $n; $i++) {
$row = & $this->items[$i];
// Try to find num responses and last response info
$numResponses = 0;
$lastResponse = array('date'=>null, 'user'=>null);
if(!empty($row->responses)) {
$responses = unserialize($row->responses);
$numResponses = count($responses);
foreach ($responses as $response) {
if($lastResponse['date'] < $response[0]) {
$lastResponse = array('date'=>$response[0], 'user'=>$response[2]);
}
}
}
// Read status
$imgRead = $row->worked ? 'icon-16-tick.png' : 'icon-16-publish_x.png';
$altRead = $row->worked ? Text::_( 'COM_JCHAT_READ' ) : Text::_( 'COM_JCHAT_NOTREAD' );
$taskState = $row->worked ? 'lamessages.workedFlagOff()' : 'lamessages.workedFlagOn()';
// Closed status
$imgClosed = $row->closed_ticket ? 'icon-16-tick.png' : 'icon-16-publish_x.png';
$altClosed = $row->closed_ticket ? Text::_( 'COM_JCHAT_CLOSED_TICKET' ) : Text::_( 'COM_JCHAT_NOTCLOSED_TICKET' );
$taskClosed = $row->closed_ticket ? 'lamessages.closedFlagOff()' : 'lamessages.closedFlagOn()';
// Accorciamento message text
$row->message = strlen($row->message) > 80 ? substr($row->message, 0, 80) . '...' : $row->message;
?>
<tr class="<?php echo "row$k"; ?>">
<td align="center">
<a class="badge bg-primary badge-font100" href="javascript:void(0);" onclick="return Joomla.listItemTask('cb<?php echo $i;?>','lamessages.editEntity')">
<span class="fas fa-pen-square" aria-hidden="true"></span>
<?php echo $i+1+$this->pagination->limitstart;?>
</a>
</td>
<td align="center">
<?php
$canCheckin = $this->user->authorise('core.manage', 'com_checkin');
$checked = $row->checked_out && $row->checked_out != $this->user->id ?
HTMLHelper::_('jgrid.checkedout', $i, Factory::getContainer()->get(\Joomla\CMS\User\UserFactoryInterface::class)->loadUserById($row->checked_out)->name, $row->checked_out_time, 'lamessages.', $canCheckin) . '<input type="checkbox" style="display:none" data-enabled="false" id="cb' . $i . '" name="cid[]" value="' . $row->id . '"/>' :
HTMLHelper::_('grid.id', $i, $row->id);
echo $checked;
?>
</td>
<td>
<?php echo $row->name; ?>
</td>
<td class="d-none d-md-table-cell">
<?php echo $row->email; ?>
</td>
<?php if($this->phoneNumberEnabled):?>
<td class="d-none d-md-table-cell">
<?php echo $row->phonenumber; ?>
</td>
<?php endif;?>
<td class="d-none d-md-table-cell">
<?php echo $row->message; ?>
</td>
<td class="d-none d-md-table-cell">
<?php echo $row->sentdate; ?>
</td>
<td class="d-none d-md-table-cell">
<?php echo $numResponses; ?>
</td>
<td>
<?php echo $lastResponse['date'] . ' / ' . $lastResponse['user']; ?>
</td>
<td class="d-none d-md-table-cell">
<?php echo isset($row->username_logged) ? $row->username_logged : Text::_('COM_JCHAT_ANONYMOUS'); ?>
</td>
<td align="center">
<a href="javascript:void(0);" onclick="return Joomla.listItemTask('cb<?php echo $i;?>','<?php echo $taskState;?>')">
<img src="components/com_jchat/images/<?php echo $imgRead;?>" width="16" height="16" border="0" alt="<?php echo $altRead; ?>" />
</a>
</td>
<td align="center">
<a href="javascript:void(0);" onclick="return Joomla.listItemTask('cb<?php echo $i;?>','<?php echo $taskClosed;?>')">
<img src="components/com_jchat/images/<?php echo $imgClosed;?>" width="16" height="16" border="0" title="<?php echo $altClosed; ?>" alt="<?php echo $altClosed; ?>" />
</a>
</td>
<td class="d-none d-md-table-cell">
<?php echo $row->id; ?>
</td>
</tr>
<?php
$k = 1 - $k;
}
?>
</tbody>
</table>
<input type="hidden" name="option" value="<?php echo $this->option;?>" />
<input type="hidden" name="task" value="lamessages.display" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $this->orders['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->orders['order_Dir']; ?>" />
</form>