<?php

defined ( '_JEXEC' ) or die ( 'Restricted access' );
/*
 * @component Calc Builder 
 * @copyright Copyright (C) January 2017. 
 * @license GPL 3.0 
 * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 * See the GNU General Public License for more details. 
 * See <http://www.gnu.org/licenses/>. 
 * More info www.moonsoft.es 
 * gestion@moonsoft.es
 */
$document = JFactory::getDocument ();
$css = $this->__getCSS ();
foreach ( $css as $style ) {
	$document->addStyleSheet ( $style );
}
$js = $this->__getJS ();
foreach ( $js as $jscript ) {
	?><script src="<?php echo $jscript;?>"></script><?php
}
?>
<form action="index.php" method="post" name="adminForm" id="adminForm">
	<div id="editcell" class="cb_table_wrapper">
		<table class="table table-hover">
			<thead>
				<tr>
					<th width="20"><input type="checkbox" name="toggle" value=""
						onclick="Joomla.checkAll(this);" /></th>
					<th width="5">
                <?php echo JText::_( 'ID' ); ?>
            </th>
					<th width="45%">
                <?php echo JText::_( 'NAME' ); ?>
            </th>
					<th width="45%">
                <?php echo JText::_( 'MATRIX_VAR' ); ?>
            </th>
				</tr>
			</thead>
    <?php
				$k = 0;
				foreach ( $this->items as &$row ) {
					$checked = JHTML::_ ( 'grid.id', - 1, $row->id );
					$link = JRoute::_ ( 'index.php?option=com_calcbuilder&controller=matrix&task=edit&' . JSession::getFormToken () . '=1&cid[]=' . $row->id . '&idobj=' . $this->lists ['idobj'] . '&class=' . $this->lists ['class'] );
					?>
        <tr class="<?php echo "row$k"; ?>">
				<td>
                <?php echo $checked; ?>
            </td>
				<td>
                <?php echo $row->id; ?>
            </td>
				<td><a href="<?php echo $link; ?>"><?php echo $row->name; ?></a></td>
				<td>
                <?php echo $row->var; ?>
            </td>
			</tr>
        <?php
					$k = 1 - $k;
				}
				?>
    <tfoot>
				<td colspan="6"><?php echo $this->pagenav->getListFooter();?></td>
			</tfoot>
		</table>
	</div>

	<input type="hidden" name="option" value="com_calcbuilder" /> <input
		type="hidden" name="task" value="show" /> <input type="hidden"
		name="boxchecked" value="0" /> <input type="hidden" name="controller"
		value="matrix" /> <input type="hidden" name="idobj"
		value="<?php echo $this->lists['idobj'];?>" /> <input type="hidden"
		name="class" value="<?php echo $this->lists['class'];?>" />
<?php echo JHtml::_( 'form.token' ); ?>
</form>
<?php defined('_JEXEC') or die('Restricted access'); ?>
