<?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
 */

defined('_JEXEC') or die;

// Include the component HTML helpers.
Joomla\CMS\HTML\HTMLHelper::addIncludePath(JPATH_ROOT.'/administrator/components/com_djcatalog2' . '/helpers/html');

//Joomla\CMS\HTML\HTMLHelper::_('bootstrap.tooltip');
Joomla\CMS\HTML\HTMLHelper::_('behavior.multiselect');
//Joomla\CMS\HTML\HTMLHelper::_('formbehavior.chosen', 'select');

$user      = JFactory::getUser();
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn  = $this->escape($this->state->get('list.direction'));

$nullDate = JFactory::getDbo()->getNullDate();

?>
<form action="<?php echo JRoute::_('index.php?option=com_djcatalog2&view=templates'); ?>" 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)); ?>
		<div class="clearfix"></div>
		<?php if (empty($this->items)) : ?>
			<div class="alert alert-no-items">
				<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
			</div>
		<?php else : ?>
			<table class="table table-striped">
				<thead>
					<tr>
						<th width="1%" class="nowrap center">
							<?php echo Joomla\CMS\HTML\HTMLHelper::_('grid.checkall'); ?>
						</th>
						<th class="title nowrap">
							<?php echo Joomla\CMS\HTML\HTMLHelper::_('searchtools.sort', 'COM_DJCATALOG2_HEADING_NAME', 'a.name', $listDirn, $listOrder); ?>
						</th>
						<th width="1%" class="nowrap center">
							<?php echo Joomla\CMS\HTML\HTMLHelper::_('searchtools.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?>
						</th>
						<th width="1%" class="nowrap center">
							<?php echo Joomla\CMS\HTML\HTMLHelper::_('searchtools.sort', 'ID', 'a.id', $listDirn, $listOrder); ?>
						</th>
					</tr>
				</thead>
				<tfoot>
					<tr>
						<td colspan="4">
							<?php echo $this->pagination->getListFooter(); ?>
						</td>
					</tr>
				</tfoot>
				<tbody>
				<?php foreach ($this->items as $i => $item) :
					$canChange = $user->authorise('core.edit.state', 'com_djcatalog2');
					?>
					<tr class="row<?php echo $i % 2; ?>">
						<td class="center">
							<?php echo Joomla\CMS\HTML\HTMLHelper::_('grid.id', $i, $item->id); ?>
						</td>
						<td>
							<a href="<?php echo JRoute::_('index.php?option=com_djcatalog2&task=template.edit&id=' . (int) $item->id); ?>">
								<?php echo $this->escape($item->name); ?></a>
							<p class="small smallsub"><?php echo $item->type?></p>
						</td>
						<td class="center">
							<?php echo Joomla\CMS\HTML\HTMLHelper::_('jgrid.published', $item->state, $i, 'templates.', $canChange, 'cb', null, null); ?>
						</td>
						<td class="center">
							<?php echo $item->id; ?>
						</td>
					</tr>
					<?php endforeach; ?>
				</tbody>
			</table>
		<?php endif; ?>
		<div>
			<input type="hidden" name="task" value="" />
			<input type="hidden" name="boxchecked" value="0" />
			<?php echo Joomla\CMS\HTML\HTMLHelper::_('form.token'); ?>
		</div>
	</div>
</div>
</form>
