<?php defined('_JEXEC') or die('Restricted access'); ?>
<?php JHTML::_('behavior.tooltip'); ?>
<?php
JToolBarHelper::title( JText::_( 'Chalange' ).": <small><small>[".JText::_( $this->task )."]</small></small>", 'plugin.png' );
JToolBarHelper::save();
JToolBarHelper::apply();
JToolBarHelper::cancel();
JToolBarHelper::divider();
JToolBarHelper::addNew('addNewRace', JText::_('Crear Carrera y Añadir'));
JToolBarHelper::publish('addRace', JText::_('Añadir Carrera'));
JToolBarHelper::deleteList(JText::_('desea borrar la carrera?'),'delRace', JText::_('Borrar Carrera'));
//apadir aquà los botones de añadir y eliminar carreras
//JToolBarHelper::help( 'screen.plugins' );
?>
<form action="index.php" method="post" name="adminForm" id="adminForm" enctype="multipart/form-data">
<fieldset class="adminForm">
<legend><?php echo JText::_( "Details" )?></legend>
<table class="admintable">
<?php
if($this->task=="edit"){ ?>
<tr>
<td width="100" align="right" class="key">
<?php echo JText::_( "ID" )?>:
</td>
<td>
<?php echo $this->row->id;?>
</td>
</tr>
<?php }?>
<tr>
<td width="100" align="right" class="key">
<?php echo JText::_( "Name" )?>:
</td>
<td>
<input class="text_area" type="text" name="name" id="name" size="100" maxlength="256" value="<?php echo $this->row->name;?>"/>
</td>
</tr>
<tr>
<td width="100" align="right" class="key">
<?php echo JText::_( "description" )?>:
</td>
<td>
<input class="text_area" type="text" name="description" id="description" size="100" maxlength="256" value="<?php echo $this->row->description;?>"/>
</td>
</tr>
<tr>
<td width="100" align="right" class="key">
<?php echo JText::_( "season" )?>:
</td>
<td>
<input class="text_area" type="text" name="season" id="season" size="4" maxlength="4" value="<?php echo $this->row->season;?>"/>
</td>
</tr>
<tr>
<td width="100" align="right" class="key">
<?php echo JText::_( "clasificaciones" )?>:
</td>
<td>
<a href="<?php echo JURI::root()."components". DS ."com_chalange". DS . "uploads" . DS . $this->row->resultsfilelocation;?>"><?php echo $this->row->resultsfilelocation;?></a>
<input name="raceResults" type="file" id="raceResults" size="30" maxlength="50"/>
</td>
</tr>
<tr>
<!-- Relación de carreras que componen la chalange -->
<td width="100" align="right" class="key">
<?php echo JText::_( "Carreras" )?>:
</td>
<td>
<table class="adminlist">
<thead>
<?php $n= count($this->races); ?>
<tr>
<th width="20">
<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo $n;?>);"/>
</th>
<th width="5"> ID </th>
<th> <?php echo JText::_('Nombre')?></th>
<th> <?php echo JText::_('Fecha')?></th>
<th> <?php echo JText::_('ubicacion')?></th>
<th> </th>
</tr>
</thead>
<?php
$k=0;
for ($i=0; $i<$n; $i++){
$row=& $this->races[$i];
$checked=JHTML::_('grid.id',$i,$row->id);
$link="index.php?option=com_chalange&view=raceAdmin&task=edit&cid[]=$row->id&chalangeId=".$this->row->id;
$registerdLink="index.php?option=com_chalange&view=registeredsAdmin&idRace=".$row->id;
?>
<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->nombre;?></a>
</td>
<td>
<?php echo strftime("%e de %B de %Y",strtotime($row->fecha)); ?>
</td>
<td>
<?php echo $row->ubicacion;?>
</td>
<td>
<a href="<?php echo $registerdLink?>"><?php echo JText::_('registereds')?></a>
</td>
</tr>
<?php
$k=1-$k;
}
?>
</table>
</td>
</table>
</fieldset>
<input type="hidden" name="id" value="<?php echo $this->row->id;?>"/>
<input type="hidden" name="option" value="com_chalange"/>
<input type="hidden" name="task" value=""/>
<input type="hidden" name="boxchecked" value="0"/>
<input type="hidden" name="controller" value="chalange"/>
</form>