<?php
/**
 * Available fields template
 *
 * @package 		CSVIVirtueMart
 * @subpackage 		AvailableFields
 * @author 			Roland Dalmulder
 * @link 			http://www.csvimproved.com
 * @copyright 	Copyright (C) 2006 - 2012 RolandD Cyber Produksi
 * @license 	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 * @version 		$Id: default.php 1892 2012-02-11 11:01:09Z RolandD $
 */
 
defined( '_JEXEC' ) or die( 'Direct Access to this location is not allowed.' ); 
?>
<form action="index.php?option=com_csvivirtuemart&view=availablefields" method="post" name="adminForm">
	<div id="filterbox">
		<?php echo JText::_('COM_CSVIVIRTUEMART_AV_FILTER'); ?>:
		<?php echo $this->list['templatetypes']; ?>
		<input type="text" value="<?php echo JRequest::getVar('filter_avfields'); ?>" name="filter_avfields" id="filter_avfields" size="25" />
		<input type="submit" onclick="this.form.submit();" value="<?php echo JText::_('COM_CSVIVIRTUEMART_AV_GO'); ?>" />
		<input type="submit" onclick="document.adminForm.filter_avfields.value = ''; document.adminForm.filter_idfields.checked=false;" value="<?php echo JText::_('COM_CSVIVIRTUEMART_AV_RESET'); ?>" />
		<?php 
			if (JRequest::getBool('filter_idfields', 0)) $checked = 'checked="checked"';
			else $checked = '';
		?>
		<input type="checkbox" value="1" <?php echo $checked; ?> name="filter_idfields" id="filter_idfields" /><?php echo JText::_('COM_CSVIVIRTUEMART_SHOW_IDFIELDS'); ?>
		<div class="resultscounter"><?php echo $this->pagination->getResultsCounter(); ?></div>
	</div>
	<div id="availablefieldslist" style="text-align: left;">
		<table id="available_fields" class="adminlist">
			<thead>
			<tr>
				<th width="20">
				<?php echo JText::_('COM_CSVIVIRTUEMART_AV_ID'); ?>
				</th>
				<th class="title">
				<?php echo JHTML::_('grid.sort', 'COM_CSVIVIRTUEMART_AV_CSVI_NAME', 'c.csvi_name', $this->list['filter_order_Dir'], $this->list['filter_order'] ); ?>
				</th>
				<th class="title">
				<?php echo JText::_('COM_CSVIVIRTUEMART_AV_VM_NAME'); ?>
				</th>
				<th class="title">
				<?php echo JHTML::_('grid.sort', 'COM_CSVIVIRTUEMART_AV_TABLE', 'c.vm_table', $this->list['filter_order_Dir'], $this->list['filter_order'] ); ?>
				</th>
			</tr>
			</thead>
			<tfoot>
				<tr>
					<td colspan="7"><?php echo $this->pagination->getListFooter(); ?></td>
				</tr>
			</tfoot>
			<tbody>
			<?php
			for ($i=0, $n=count( $this->availablefields ); $i < $n; $i++) {
				$row = $this->availablefields[$i];
				?>
				<tr>
					<td align="center">
					<?php echo $this->pagination->getRowOffset($i); ?>
					</td>
					<td>
						<?php
							if ($row->core) echo JHTML::_('link', 'http://www.csvimproved.com/csvi-virtuemart-documentation/available-fields/'.str_replace('_', '', $row->csvi_name).'.html', $row->csvi_name, 'target="_blank"');
							else echo $row->csvi_name;
							if ($row->isprimary) echo '<span class="isprimary">'.JText::_('COM_CSVIVIRTUEMART_IS_PRIMARY').'</span>';
						?>
					</td>
					<td>
						<?php echo $row->vm_name; ?>
					</td>
					<td>
						<?php echo $row->vm_table; ?>
					</td>
				</tr>
				<?php
			}
			?>
			</tbody>
		</table>
	</div>
	<input type="hidden" name="task" value="availablefields" />
	<input type="hidden" name="filter_order" value="<?php echo $this->list['filter_order']; ?>" />
	<input type="hidden" name="filter_order_Dir" value="<?php echo $this->list['filter_order_Dir']; ?>" />
</form>
<script type="text/javascript">
	UpdateRowClass('available_fields');
</script>