<?php
$gates = Gate::getGateListPk ();
$gates [- 1] = t ( 'All gates' );

$times = TimeSchedule::getTimeScheduleArrayForZtl ();
$times [- 1] = t ( 'Always' );

$trans = array (
    'Transito' => t ( 'Free access' ),
    'Limitato' => t ( 'Limited access' ) 
);

$form = $this->beginWidget ( 'bootstrap.widgets.TbActiveForm', array (
    'id' => 'ztl-form',
    'enableAjaxValidation' => false 
) );

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

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

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

echo $form->dropDownListRow ( $model, 'TimeID', $times, array (
    'class' => 'span5',
    'maxlength' => 20 
) );

if (user ()->checkAccess ( 'manage_time_schedule' ))
  echo " " . CHtml::link ( "<span class=\"icon-plus\">" . t ( "New time schedule" ) . "</span>", url ( 'timeSchedule/create', array (
      'returnUrl' => $this->getPageLink (),
      'for_run' => 0,
      'for_whitelisttable' => 0,
      'for_ztl' => 1 
  )
   ) );

echo $form->dropDownListRow ( $model, 'Transito', $trans, array (
    'class' => 'span5',
    'maxlength' => 20 
) );

?><div class="form-actions"><?php
$this->widget ( 'bootstrap.widgets.TbButton', array (
    'buttonType' => 'submit',
    'type' => 'primary',
    'label' => $model->isNewRecord ? 'Create' : 'Save' 
) );
?></div><?php

$this->endWidget ();

?>
