1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
<?php
class CalendrierForm extends BaseCalendrierForm
{
public function configure()
{
$this->setWidgets(array(
'id' => new sfWidgetFormInputHidden(),
'id_sfguarduser' => new sfWidgetFormInputHidden(),
'id_tache' => new sfWidgetFormInputHidden(),
'date_calendrier' => new sfWidgetFormInputText(array(), array(
'readonly' => 'readonly',
'style' => 'width: 7em;'
)
),
'temps_minute' => new sfWidgetFormInputText(array(), array(
'style' => 'text-align:right; width: 50px;'
)
),
'type_temps' => new sfWidgetFormChoice(array(
'expanded' => true,
'choices' => array(
'P' => 'Previsionnel',
'R' => 'Reel'),
))
));
$this->setValidators(array(
'id' => new sfValidatorChoice(
array(
'choices' => array($this->getObject()->get('id')),
'empty_value' => $this->getObject()->get('id'),
'required' => false
)),
'id_sfguarduser' => new sfValidatorString(array('max_length' => 16, 'required' => true)),
'id_tache' => new sfValidatorString(array('max_length' => 16, 'required' => true)),
'date_calendrier' => new sfValidatorString(array('max_length' => 24, 'required' => true)),
'temps_minute' => new sfValidatorInteger(
array('max' => 480, 'min' => 5, 'required' => true),
array('max' => '480 minutes maximun', 'min' => '5 minutes minimun')
),
'type_temps' => new sfValidatorString(array('max_length' => 1, 'required' => true)),
));
$this->widgetSchema->setLabels(
array(
'id_sfguarduser' => 'Utilisateur',
'id_tache' => 'Tache',
'date_calendrier' => 'Date',
'temps_minute' => 'Temps',
'type_temps' => 'Type temps'
)
);
$this->widgetSchema->setNameFormat('calendrier[%s]');
//$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
}
} |
Partager