<?php
/**
 * Adodis Blog package
 * @author J-Extension <contact@jextn.com>
 * @link http://www.jextn.com
 * @copyright (C) 2012 - 2013 J-Extension
 * @license GNU/GPL, see LICENSE.php for full license.
**/

// Check to ensure this file is included in Joomla!
	defined('_JEXEC') or die('Restricted access');

$listOrder	= $this->state->get('list.ordering');
$listDirn	= $this->state->get('list.direction');

?>
<form action="<?php echo JRoute::_('index.php?option=com_adodisblog&view=comments'); ?>" method="post" name="adminForm" id="adminForm">
	<fieldset id="filter-bar">
		<div class="filter-search fltlft">
			<label class="filter-search-lbl" for="filter_search">
				<?php echo JText::_('JSEARCH_FILTER_LABEL'); ?>
			</label>
			<input type="text" name="filter_search" id="filter_search" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" title="<?php echo JText::_('COM_JETESTIMONIAL_SEARCH_IN_NAME'); ?>" />
			<button type="submit">
				<?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?>
			</button>
			<button type="button" onclick="document.getElementById('filter_published').value=''; document.getElementById('filter_user').value=''; document.getElementById('filter_access').value=''; document.getElementById('filter_language').value=''; document.id('filter_search').value='';this.form.submit();">
				<?php echo JText::_('JSEARCH_FILTER_CLEAR'); ?>
			</button>
		</div>

		<div class="filter-select fltrt">
			<select name="filter_published" id="filter_published" class="inputbox" onchange="this.form.submit()">
				<option value="">
					<?php echo JText::_('JOPTION_SELECT_PUBLISHED');?>
				</option>
				<?php echo JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true);?>
			</select>
			<?php  echo $this->filteruser;?>
	        <select name="filter_access" id="filter_access" class="inputbox" onchange="this.form.submit()">
				<option value="">
					<?php echo JText::_('JOPTION_SELECT_ACCESS');?>
				</option>
				<?php echo JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'));?>
			</select>

			<select name="filter_language" id="filter_language" class="inputbox" onchange="this.form.submit()">
				<option value="">
					<?php echo JText::_('JOPTION_SELECT_LANGUAGE');?>
				</option>
				<?php echo JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $this->state->get('filter.language'));?>
			</select>
		</div>
	</fieldset>

	<div class="clr"> </div>

	<table class="adminlist">
		<thead>
			<tr>
				<th width="3%">
					<?php echo JText::_( 'JE_SERNO' ); ?>
				</th>
				<th width="1%">
					<input type="checkbox" name="checkall-toggle" value="" onclick="checkAll(this)" />
				</th>
				<th width="20%">
					<?php echo JHtml::_('grid.sort',  'COM_ADODISBLOG_BLOG_TITLE', 'blog_title', $listDirn, $listOrder); ?>
				</th>
				<th width="25%">
					<?php echo JHtml::_('grid.sort',  'COM_ADODISBLOG_BLOG_COMMENT', 'ct.comment', $listDirn, $listOrder); ?>
				</th>
				<th width="12%">
					<?php echo JHtml::_('grid.sort', 'COM_ADODISBLOG_USER_USERNAME', 'user_name', $listDirn, $listOrder); ?>
				</th>
				<th width="10%">
					<?php echo JHtml::_('grid.sort',  'COM_ADODISBLOG_IPADDRESS', 'ct.ip_address', $listDirn, $listOrder); ?>
				</th>
				<th width="8%">
					<?php echo JHtml::_('grid.sort', 'JPUBLISHED', 'ct.published', $listDirn, $listOrder); ?>
				</th>
				<th width="10%">
					<?php echo JHtml::_('grid.sort', 'COM_ADODISBLOG_CREATED_DATE', 'ct.created_date', $listDirn, $listOrder); ?>
				</th>
				<th width="7%">
					<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_LANGUAGE', 'ct.language', $listDirn, $listOrder); ?>
				</th>
				<th width="3%">
					<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'ct.id', $listDirn, $listOrder); ?>
				</th>
			</tr>
		</thead>

		<tfoot>
			<tr>
				<td colspan="11">
					<?php echo $this->pagination->getListFooter(); ?>
				</td>
			</tr>
		</tfoot>

		<tbody>
			<?php
			$n = count($this->items);
			foreach ($this->items as $i => $item) :
				?>
				<tr class="row<?php echo $i % 2; ?>">
					<td align="center">
						<?php echo $i+1; ?>
					</td>
					<td class="center">
						<?php echo JHtml::_('grid.id', $i, $item->id); ?>
					</td>
					<td>
						<span class="editlinktip hasTip" title="<?php echo addslashes(htmlspecialchars(JText::_('COM_ADODISBLOG_TOOLTIP_EDIT_COMMENT').'::'.$item->blog_title)); ?>">
							<a href="<?php echo JRoute::_('index.php?option=com_adodisblog&task=comment.edit&id='.(int) $item->id); ?>">
								<?php echo $item->blog_title; ?>
							</a> &nbsp;
						</span>
					</td>
					<td align="center">
						<?php if(strlen($item->comment)>40){echo substr($item->comment,0,40)."...";}else{echo $item->comment;} ?>
					</td>
					<td align="center">
						<?php
							if($item->user_name)
								echo $item->user_name;
							else
								echo $item->name;
						?>
					</td>
					<td align="center">
						<?php echo $item->ip_address; ?>
					</td>
					<td align="center">
						<?php echo JHtml::_('jgrid.published', $item->published, $i, 'comments.', true, 'cb'); ?>
					</td>
					<td align="center">
						<?php echo $item->created_date; ?>
					</td>
					<td class="center">
						<?php if ($item->language=='*'):?>
							<?php echo JText::alt('JALL','language'); ?>
						<?php else:?>
							<?php echo $item->language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?>
						<?php endif;?>
					</td>
					<td align="center">
						<?php echo $item->id; ?>
					</td>
				</tr>
			<?php endforeach; ?>
		</tbody>
	</table>

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

<div class="clr"></div>
<p class="copyright" align="center">
	<?php /*require_once( JPATH_COMPONENT . DS . 'copyright' . DS . 'copyright.php' );*/ ?>
</p>