<?php
$gates = Gate::getGateList ();
foreach ( $gates as $gateId => $gateLabel )
{
  $gates [$gateId] = "[{$gateId}] {$gateLabel}";
}

$form = $this->beginWidget ( 'bootstrap.widgets.TbActiveForm', array (
    'id' => 'crossing-time-form',
    'enableAjaxValidation' => false 
) );
/** @var TbActiveForm $form */
/** @var CrossingTime $model */

?>

<p class="help-block">
  Fields with <span class="required">*</span> are required.
</p>
<?php
echo $form->errorSummary ( $model );

echo $form->dropDownListRow ( $model, 'id_gate_start', $gates, array (
    'class' => 'span5' 
) );

echo $form->dropDownListRow ( $model, 'id_gate_end', $gates, array (
    'class' => 'span5' 
) );
/*
 * echo $form->textFieldRow ( $model, 'range', array (
 * 'class' => 'span5'
 * ) );
 */
if (! $model->isNewRecord)
{
  echo $form->textFieldRow ( $model, 'done', array (
      'class' => 'span5'
  ) );

  echo $form->textFieldRow ( $model, 'result_code', array (
      'class' => 'span5'
  ) );

  echo $form->textFieldRow ( $model, 'result_message', array (
      'class' => 'span5'
  ) );

  echo $form->textFieldRow ( $model, 'source', array (
      'class' => 'span5'
  ) );
  
  echo $form->textFieldRow ( $model, 'duration_avg', array (
      'class' => 'span5' 
  ) );
  
  echo $form->textFieldRow ( $model, 'duration_stddev', array (
      'class' => 'span5' 
  ) );
  
  echo $form->textFieldRow ( $model, 'duration_min', array (
      'class' => 'span5' 
  ) );
  
  echo $form->textFieldRow ( $model, 'duration_max', array (
      'class' => 'span5' 
  ) );
  
  echo $form->textFieldRow ( $model, 'duration_count', array (
      'class' => 'span5' 
  ) );
  echo $form->textFieldRow ( $model, 'epoch', array (
      'class' => 'span5' 
  ) );
  
  echo $form->textFieldRow ( $model, 'timestamp', array (
      'class' => 'span5' 
  ) );
  
  echo $form->dropDownListRow ( $model, 'ref_section', array (
      'class' => 'span5' 
  ) );
}
?>
<div class="form-actions">
		<?php
  
  $this->widget ( 'bootstrap.widgets.TbButton', array (
      'buttonType' => 'submit',
      'type' => 'primary',
      'label' => $model->isNewRecord ? 'Create' : 'Save' 
  ) );
  ?>
	</div>

<?php

$this->endWidget ();
