Your IP : 216.73.216.224


Current Path : /var/www/html/administrator/components/com_jchat/tmpl/messages/
Upload File :
Current File : /var/www/html/administrator/components/com_jchat/tmpl/messages/default_list.php

<?php 
/** 
 * @package JCHAT::MESSAGES::administrator::components::com_jchat
 * @subpackage views
 * @subpackage messages
 * @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\Uri\Uri;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\String\StringHelper;
?>
<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='messages.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="msg_type"><?php echo Text::_('COM_JCHAT_MESSAGE_TYPE');?></label>
					<?php
						echo $this->lists['type'];
					?>
					
					<label class="visually-hidden" for="msg_status"><?php echo Text::_('COM_JCHAT_STATUS_MSGS');?></label>
					<?php
						echo $this->lists['status'];
					?>
					
					<label class="visually-hidden" for="rooms_filter"><?php echo Text::_('COM_JCHAT_ROOMS_FILTER');?></label>
					<?php
						echo $this->lists['rooms'];
					?>
					
					<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 table-hover">
		<thead>
			<tr>
				<th width="1%" 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_SENDER_NAME', 'a.actualfrom', @$this->orders['order_Dir'], @$this->orders['order'], 'messages.display' ); ?>
				</th>
				<th width="8%" class="title" >
					<?php echo HTMLHelper::_('grid.sort', 'COM_JCHAT_RECEIVER_NAME', 'a.actualto', @$this->orders['order_Dir'], @$this->orders['order'], 'messages.display' ); ?>
				</th>  
				<th width="25%" class="title" nowrap="nowrap">
					<?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.sent', @$this->orders['order_Dir'], @$this->orders['order'], 'messages.display' ); ?>
				</th>
				<th width="2%" class="title d-none d-md-table-cell">
					<?php echo HTMLHelper::_('grid.sort', 'COM_JCHAT_READ', 'a.read', @$this->orders['order_Dir'], @$this->orders['order'], 'messages.display' ); ?>
				</th>
				<th width="5%" class="title d-none d-md-table-cell">
					<?php echo HTMLHelper::_('grid.sort', 'COM_JCHAT_TYPE', 'a.type', @$this->orders['order_Dir'], @$this->orders['order'], 'messages.display' ); ?>
				</th>
				<th width="5%" class="title d-none d-md-table-cell">
					<?php echo HTMLHelper::_('grid.sort', 'COM_JCHAT_ROOM', 'r.name', @$this->orders['order_Dir'], @$this->orders['order'], 'messages.display' ); ?>
				</th>
				<th width="5%" class="title d-none d-md-table-cell">
					<?php echo Text::_('COM_JCHAT_IPADDRESS'); ?>
				</th>
				<th width="1%" class="title d-none d-md-table-cell" nowrap="nowrap">
					<?php echo HTMLHelper::_('grid.sort', 'COM_JCHAT_ID', 'a.id', @$this->orders['order_Dir'], @$this->orders['order'], 'messages.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]; 
				
				// Skip rooms enter/leave messages
				if(StringHelper::strpos($row->message, 'jchat_roomenter') !== false) {
					continue;
				}
				
				// Read status
				$imgRead 	= $row->read ? 'icon-16-tick.png' : 'icon-16-publish_x.png'; 
				$altRead 	= $row->read ? Text::_('COM_JCHAT_READ' ) : Text::_('COM_JCHAT_NOTREAD' );
 
				$imgFileDownloaded 	= $row->status ? 'icon-16-download-tick.png' : 'icon-16-download-notick.png';
				$altFileDownloaded 	= $row->status ? Text::_('COM_JCHAT_DOWNLOADED' ) : Text::_('COM_JCHAT_NOTDOWNLOADED' );
				 
				// Sent datetime formatting
				$sentDateTime = HTMLHelper::_('date', $row->sent, 'Y-m-d H:i:s');
			?>
			<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;?>','messages.showEntity')">
						<span class='fas fa-pen-square' aria-hidden='true'></span> 
						<?php echo $i+1+$this->pagination->limitstart;?>
					</a>
				</td>
				<td align="center">
					<?php echo HTMLHelper::_('grid.id', $i, $row->id ); ?>
				</td>
				<td> 
					<?php echo $row->actualfrom; ?> 
				</td>
				<td>
					<?php echo $row->actualto ? $row->actualto : Text::_('COM_JCHAT_MULTIPLE_RECEIVER_USERS'); ?>
				</td> 
				<td style="position:relative">
					<div style="width:98%; max-height:100px; overflow:auto"><?php echo $row->message; ?></div>
					<?php 
					if($this->componentParams->get('language_translation_enabled', 0)):
						$encodedMessage = rawurlencode(strip_tags($row->message)); 
						$translateToImageFlag = Uri::root(false) . $this->defaultFlagsPath . $this->defaultTranslateToLanguage . '.gif';?>
						<a class='google_translate' title="<?php echo Text::_('COM_JCHAT_CLICKTO_GOOGLE_TRANSLATE');?>" target="_blank" href="https://translate.google.it/#auto/<?php echo $this->defaultTranslateToLanguage . '/' . $encodedMessage;?>">
							<img alt="translate" src='<?php echo $translateToImageFlag;?>' />
						</a>
					<?php endif;?>
				</td>    
				<td class="d-none d-md-table-cell">
					<?php echo $sentDateTime; ?>
				</td>
				<td align="center" class="d-none d-md-table-cell"> 
					<?php if($row->actualto):?>
						<img src="components/com_jchat/images/<?php echo $imgRead;?>" width="16" height="16" border="0" alt="<?php echo $altRead; ?>" />
					<?php else:
						echo Text::_('COM_JCHAT_ND');
						endif;
					?>
				</td>
				<td class="d-none d-md-table-cell"> 
					<?php
						if($row->type == 'message') {
							echo Text::_('COM_JCHAT_TIPO_TEXT');
						} else {
							$fileDownloadLink = Uri::root(false) . 'index.php?option=com_jchat&task=attachments.showEntity&format=raw&idMessage=' . $row->id . '&from=' . $row->from;
							echo "<a target='_blank' href='" . $fileDownloadLink . "'>" . 
								 Text::_('COM_JCHAT_TIPO_FILE') . 
								 "<img class='inner_spia' src='components/com_jchat/images/$imgFileDownloaded' title='$altFileDownloaded' width='16' height='16' border='0' alt='$altFileDownloaded'/></a>";
						}
					?>
				</td>
				<td class="d-none d-md-table-cell">
					<?php echo $row->roomname; ?>
				</td>
				<td class="d-none d-md-table-cell">
					<?php echo $row->ipaddress; ?>
				</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="messages.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>