<?php
/*
 * @component UserPoints
 * @copyright Copyright (C) 2015-2022 Bernard Gilly - Adrien Roussel - Martin Brampton
 * @license : GNU/GPL
 * @Website : https://remository.com
 */

defined( '_JEXEC' ) or die( 'Restricted access' );

use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\HTML\HTMLHelper;

$columns = 7;
?>
<script type="text/javascript">
	Joomla.submitbutton = function(task)
	{
		//if (task == 'cancelrule' || document.formvalidator.isValid(document.id('listinglevelranks-form'))) {
			Joomla.submitform(task, document.getElementById('adminForm'));
		//}
		//else {
			//alert('<?php echo $this->escape(Text::_('JGLOBAL_VALIDATION_FORM_FAILED'));?>');
		//}
	}
</script>
<div id="j-main-container">
<form action="index.php?option=com_userpoints" method="post" name="adminForm" id="adminForm" class="form-validate">
	<table class="table table-striped">
		<thead>
			<tr>
				<th width="2%" class="title">
					<?php echo Text::_( 'NUM' ); ?>
				</th>
				<th width="5%" class="title">&nbsp;
					
				</th>
				<th width="12%" class="title">
					<?php echo Text::_('AUP_NAME'); ?>
				</th>
				<th width="10%" class="title" nowrap="nowrap">
					<?php echo Text::_( 'AUP_USERNAME' ); ?>
				</th>
				<th width="10%" class="title" nowrap="nowrap">
					<?php echo Text::_('AUP_DATE'); ?>
				</th>
				<th width="50%" class="title" nowrap="nowrap">
					<?php echo Text::_( 'AUP_REASON_FOR_AWARD' ); ?>
				</th>
				<th class="title" nowrap="nowrap">&nbsp;
										
				</th>		
			</tr>
		</thead>
		<tfoot>
			<tr>
				<td colspan="<?php echo $columns ; ?>">
					<?php echo $this->pagination->getListFooter(); ?>
				</td>
			</tr>
		</tfoot>
		<tbody>
		<?php
			$i = $k = 0;
			
			foreach ($this->detailrank as $row)		
			{
				if ($row->icon ) {
					$pathicon = Uri::root() . 'components/com_userpoints/assets/images/awards/icons/';
					$icone = '<img src="'.$pathicon . $row->icon.'" width="16" height="16" border="0" alt="" />';
				} else $icone = '';
				
			?>
			<tr class="<?php echo "row$k"; ?>">
				<td>
					<?php echo $i+1+$this->pagination->limitstart;?>
				</td>
				<td>
					<div align="center">
					<?php echo $icone; ?>
					</div>
				</td>
				<td>					
					<?php echo Text::_( $row->name ); ?>
				</td>
				<td>
					<?php echo Text::_( $row->username ); ?>
				</td>
				<td>
					<div align="center">
					<?php 
					echo $this->presentDate('date',  $row->dateawarded,  Text::_('DATE_FORMAT_LC') );
					?>
					</div>
				</td>
				<td>					
					<?php 
					echo Text::_( $row->rank );
					if ( $row->reason ) echo ' - ' . Text::_( $row->reason ); 
					?>
				</td>
				<td>&nbsp;
				</td>
			</tr>
			<?php
				$k = 1 - $k;
                                $i++;
				}
			?>
		</tbody>
	</table>
	<input type="hidden" name="option" value="com_userpoints" />
	<input type="hidden" name="task" value="detailrank" />
	<input type="hidden" name="cid" value="<?php echo $row->cid ; ?>" />
	<input type="hidden" name="typerank" value="<?php echo $row->typerank ; ?>" />	
	<input type="hidden" name="table" value="" />
	<input type="hidden" name="redirect" value="detailrank" />
	<input type="hidden" name="boxchecked" value="0" />
</form>
</div>