<?php
/**
 * @package DJ-Catalog2
 * @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
 * @license http://www.gnu.org/licenses GNU/GPL
 * @author url: http://dj-extensions.com
 * @author email contact@dj-extensions.com
 *
 */

// no direct access
defined('_JEXEC') or die;

JHtml::_('bootstrap.tooltip');

$listOrder	= $this->state->get('list.ordering');
$listDirn	= $this->state->get('list.direction');
$nullDate = JFactory::getDbo()->getNullDate();
$params = JComponentHelper::getParams('com_djcatalog2');

?>
<form action="<?php echo JRoute::_('index.php?option=com_djcatalog2&view=reviews');?>" method="post" name="adminForm" id="adminForm">
<div class="row">
	<div id="j-sidebar-container" class="col-md-2">
		<?php echo $this->sidebar; ?>
	</div>
	<div id="j-main-container" class="col-md-10">
	
	
	<?php echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>

	<table class="table table-striped">
		<thead>
			<tr>
				<th width="1%" class="hidden-phone">
					<input type="checkbox" name="checkall-toggle" value="" title="<?php echo JText::_('JGLOBAL_CHECK_ALL'); ?>" onclick="Joomla.checkAll(this)" />
				</th>
				<th>
					<?php echo Joomla\CMS\HTML\HTMLHelper::_('searchtools.sort', 'COM_DJCATALOG2_PRODUCT', 'i.name', $listDirn, $listOrder); ?>
				</th>
				<th class="center">
					<?php echo Joomla\CMS\HTML\HTMLHelper::_('searchtools.sort', 'COM_DJCATALOG2_RATE', 'a.rating', $listDirn, $listOrder); ?>
				</th>
				<th class="center">
					<?php echo Joomla\CMS\HTML\HTMLHelper::_('searchtools.sort', 'COM_DJCATALOG2_AUTHOR', 'a.author', $listDirn, $listOrder); ?>
				</th>
				<th class="center">
					<?php echo Joomla\CMS\HTML\HTMLHelper::_('searchtools.sort', 'COM_DJCATALOG2_REVIEW_CONTENT', 'a.review', $listDirn, $listOrder); ?>
				</th>
				<th class="center">
					<?php echo Joomla\CMS\HTML\HTMLHelper::_('searchtools.sort', 'COM_DJCATALOG2_CREATED_DATE', 'a.created', $listDirn, $listOrder); ?>
				</th>
				<th width="10%">
                	<?php echo Joomla\CMS\HTML\HTMLHelper::_('searchtools.sort', 'COM_DJCATALOG2_LANGUAGE', 'a.language', $listDirn, $listOrder); ?>
                </th>
				<th class="center">
					<?php echo Joomla\CMS\HTML\HTMLHelper::_('searchtools.sort', 'COM_DJCATALOG2_IP', 'a.ip', $listDirn, $listOrder); ?>
				</th>
				<th width="1%" class="nowrap">
					<?php echo Joomla\CMS\HTML\HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
				</th>
			</tr>
		</thead>
		<tfoot>
			<tr>
				<td colspan="9">
					<?php echo $this->pagination->getListFooter(); ?>
				</td>
			</tr>
		</tfoot>
		<tbody>
		<?php foreach ($this->items as $i => $item) :
			if (empty($item->name)) {
				$item->name = '[---] ID=' . $item->item_id; 
			}
			?>
			<tr class="row<?php echo $i % 2; ?>">
				<td class="center">
					<?php echo JHtml::_('grid.id', $i, $item->id); ?>
				</td>
				<td>
					<span class="editlinktip hasTip" title="<?php echo JText::_( 'COM_DJCATALOG2_EDIT_TOOLTIP' );?>::<?php echo $this->escape($item->name); ?>">
						<a href="<?php echo JRoute::_('index.php?option=com_djcatalog2&task=review.edit&id='.$item->id);?>">
							<?php echo $this->escape($item->name); ?></a>
						</span>
				</td>
				<td class="center">
					<?php echo $item->rating . '/5';  ?>
				</td>
				<td class="center">
					<?php echo $item->author; ?>
				</td>
				<td class="center">
					<?php echo $item->review; ?>
				</td>
				<td class="center">
					<?php echo ($item->created && $item->created != $nullDate) ? JHtml::_('date', $item->created, $params->get('date_format_datetime', 'd/m/Y H:i')) : '---'; ?>
				</td>
				<td align="center">
                    <?php echo JLayoutHelper::render('joomla.content.language', $item); ?>
                </td>
				<td class="center">
					<?php echo $item->ip; ?>
				</td>
				<td class="center">
					<?php echo (int) $item->id; ?>
				</td>
			</tr>
			<?php endforeach; ?>
		</tbody>
	</table>

	<div>
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		<?php echo JHtml::_('form.token'); ?>
	</div>
	</div>
</div>
</form>
