<?php
/**
 * @version		$Id$
 * @package		TAOJ.Quanta
 * @subpackage	com_quanta
 * @copyright	Copyright (C) 2009 New Life in IT Pty Ltd. All rights reserved.
 * @license		GNU General Public License <http://www.gnu.org/copyleft/gpl.html>
 * @link		http://www.theartofjoomla.com
 */

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

JHtml::addIncludePath(JPATH_COMPONENT.DS.'helpers'.DS.'html');
JHtml::_('behavior.tooltip');
JHtml::script('checkall.js', 'administrator/components/com_quanta/media/js/');
JHtml::stylesheet('default.css', 'administrator/components/com_quanta/media/css/');
?>
<form action="<?php echo JRoute::_('index.php?option=com_quanta&view=histories');?>" method="post" name="adminForm">
	<fieldset class="filter clearfix">
		<div class="left">
			<label for="filter_search">
				<?php echo JText::_('Quanta_Filter_Search_Label'); ?>
			</label>
			<input type="text" name="filter_search" id="filter_search" value="<?php echo $this->state->get('filter.search'); ?>" size="60" title="<?php echo JText::_('Quanta_Filter_Search_Desc'); ?>" />

			<button type="submit">
				<?php echo JText::_('Quanta_Button_Go'); ?></button>
			<button type="button" onclick="document.getElementById('filter_search').value='';this.form.submit();">
				<?php echo JText::_('Quanta_Button_Clear'); ?></button>
		</div>
		<div class="right">
			<select name="filter_record_id" id="filter_record_id" class="inputbox" onchange="this.form.submit()">
				<option value=""><?php echo JText::_('Quanta_Option_Record_Filter'); ?></option>
				<?php echo JHtml::_('quanta.recordOptions', $this->state->get('filter.record_id'), $this->state->get('filter.category_id')); ?>
			</select>
			<select name="filter_category_id" id="filter_category_id" class="inputbox" onchange="this.form.submit()">
				<option value=""><?php echo JText::_('Quanta_Option_Category_Filter'); ?></option>
				<?php echo JHtml::_('quanta.categoryOptions', $this->state->get('filter.category_id')); ?>
			</select>
			<select name="filter_published" id="filter_published" class="inputbox" onchange="this.form.submit()">
				<?php echo JHtml::_('quanta.publishedOptions', $this->state->get('filter.published')); ?>
			</select>
		</div>
	</fieldset>
	<table class="adminlist">
		<thead>
			<tr>
				<th width="20">
					<input type="checkbox" name="toggle" value="" onclick="checkAll(this)" />
				</th>
				<th class="title">
					<?php echo JHtml::_('grid.sort', 'Quanta_Heading_Record_Time', 'a.record_time', $this->state->get('list.direction'), $this->state->get('list.ordering')); ?>
				</th>
				<th class="title">
					<?php echo JHtml::_('grid.sort', 'Quanta_Heading_Record_Value', 'a.record_value', $this->state->get('list.direction'), $this->state->get('list.ordering')); ?>
				</th>
				<th>
					<?php echo JHtml::_('grid.sort', 'Quanta_Heading_Record_Title', 'r.record_title', $this->state->get('list.direction'), $this->state->get('list.ordering')); ?>
				</th>
				<th>
					<?php echo JHtml::_('grid.sort', 'Quanta_Heading_Record_Category', 'r.record_title', $this->state->get('list.direction'), $this->state->get('list.ordering')); ?>
				</th>
				<th width="5%">
					<?php echo JHtml::_('grid.sort', 'Quanta_Heading_Published', 'a.published', $this->state->get('list.direction'), $this->state->get('list.ordering')); ?>
				</th>
				<th width="1%">
					<?php echo JHtml::_('grid.sort', 'Quanta_Heading_ID', 'a.id', $this->state->get('list.direction'), $this->state->get('list.ordering')); ?>
				</th>
				<th width="30%">
					&nbsp;
				</th>
			</tr>
		</thead>
		<tfoot>
			<tr>
				<td colspan="15">
					<?php echo $this->pagination->getListFooter(); ?>
				</td>
			</tr>
		</tfoot>
		<tbody>
		<?php
			foreach ($this->items as $i => $item) : ?>
			<tr class="row<?php echo $i % 2; ?>">
				<td style="text-align:center">
					<?php echo JHtml::_('grid.id', $item->id, $item->id); ?>
				</td>
				<td align="center">
					<a href="<?php echo JRoute::_('index.php?option=com_quanta&task=history.edit&cid[]='.$item->id);?>">
						<?php echo intval($item->record_time) ? JHtml::date($item->record_time, '%Y-%m-%d %H:%M:%S') : '-'; ?></a>
				</td>
				<td align="center">
					<a href="<?php echo JRoute::_('index.php?option=com_quanta&task=history.edit&cid[]='.$item->id);?>">
						<?php echo $item->record_value; ?></a>
				</td>
				<td>
					<?php echo $item->record_title; ?>
				</td>
				<td align="center">
					<?php echo $item->category_title; ?>
				</td>
				<td align="center">
					<?php echo JHtml::_('jxgrid.published', $item->id, $item->published, 'histories.'); ?>
				</td>
				<td align="center">
					<?php echo $item->id; ?>
				</td>
				<td>
					&nbsp;
				</td>
			</tr>
		<?php endforeach; ?>
		</tbody>
	</table>

	<input type="hidden" name="task" value="" />

	<input type="hidden" name="boxchecked" value="0" />
	<input type="hidden" name="filter_order" value="<?php echo $this->state->get('list.ordering'); ?>" />
	<input type="hidden" name="filter_order_Dir" value="<?php echo $this->state->get('list.direction'); ?>" />
	<?php echo JHtml::_('form.token'); ?>
</form>
