<?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');
$path	  	= JURI::root();
?>
<form action="<?php echo JRoute::_('index.php?option=com_adodisblog&view=users'); ?>" 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_ADODISBLOG_SEARCH_BY_NAME_USERNAME'); ?>" class="hasTip"/>
			<button type="submit">
				<?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?>
			</button>
			<button type="button" onclick="document.id('filter_search').value='';document.id('filter_user').value='';this.form.submit();">
				<?php echo JText::_('JSEARCH_FILTER_CLEAR'); ?>
			</button>
		</div>
		<div class="filter-select fltrt">
			<?php  echo $this->filteruser;?>
		</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_NAME', 'ur.name', $listDirn, $listOrder); ?>
				</th>
				<th width="20%">
					<?php echo JHtml::_('grid.sort',  'COM_ADODISBLOG_USER_USERNAME', 'ur.username', $listDirn, $listOrder); ?>
				</th>
				<th width="25%">
					<?php echo JHtml::_('grid.sort',  'COM_ADODISBLOG_EMAIL', 'ur.email', $listDirn, $listOrder); ?>
				</th>
				<th width="20%">
					<?php echo JHtml::_('grid.sort', 'COM_ADODISBLOG_BLOCK', 'ur.block', $listDirn, $listOrder); ?>
				</th>
				<th width="10%">
					<?php echo JHtml::_('grid.sort', 'COM_ADODISBLOG_USERID', 'ur.user_id', $listDirn, $listOrder); ?>
				</th>
				<th width="1%">
					<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'ur.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) :
				$ordering	= $listOrder == 'ur.ordering';
				$onclick	= "onclick=\"document.id('blockid').value='".$item->id."';document.id('blockval').value='".$item->block."';blockSubmit()\"";
				if( $item->block == 0) {
					$user	= " <img src=\"$path"."administrator/components/com_adodisblog/assets/images/blocked_user.png\" title=\"".JText::_('COM_ADODISBLOG_BLOCKEDUSER')."\" class=\"hasTip adodisblog_imageblock\" ".$onclick."/>";
				} else {
				   $user	= " <img src=\"$path"."administrator/components/com_adodisblog/assets/images/user.png\" title=\"".JText::_('COM_ADODISBLOG_UNBLOCKEDUSER')."\" class=\"hasTip adodisblog_imageblock\" ".$onclick."/>";
				}
				?>
				<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 class="center">
						<?php echo $item->name; ?>
					</td>
					<td align="center">
						<?php echo $item->username; ?>
					</td>
					<td align="center">
						<?php echo $item->email; ?>
					</td>
					<td align="center">
						<?php echo $user; ?>
					</td>
					<td align="center">
						<?php echo $item->user_id; ?>
					</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="blockid" id="blockid" value='0' />
		<input type="hidden" name="blockval" id="blockval" value='0' />
		<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>