<?php

/**
 * KataoMemberAdhesion form.
 *
 * @package    form
 * @subpackage katao_member_adhesion
 * @version    SVN: $Id: sfPropelFormTemplate.php 6174 2007-11-27 06:22:40Z fabien $
 */
class KataoMemberAdhesionForm extends BaseKataoMemberAdhesionForm
{
  	static public $PAYMENT_KIND		= array( '0' => 'Sols-Violette',
  	'1' => 'Carte bancaire',
  	'2' => 'Chèque',
  	'3' => 'Espèces');

  	static public $PAYMENT_AMOUNT	= array( '0' => '5',
  	'1'	=> '15',
  	'2' => '100');

  	public function configure()
  	{
  		parent::configure();

  		//	unset($this->validatorSchema['id']);
  		//	unset($this->widgetSchema['id']);

      $this->widgetSchema['year'] = new wpWidgetFormRichDate();
      $this->validatorSchema['year'] = new sfValidatorDateTime(array('date_format' => '@(?P<day>\d{2}).(?P<month>\d{2}).(?P<year>\d{4})@'));

  		$this->widgetSchema['katao_user_id'] = new sfWidgetFormInputHidden();

  		$this->widgetSchema['type'] = new sfWidgetFormSelectRadio(array('choices' => array('1' => 'Nouvelle adhésion',
																						   '2' => 'Renouvellement')));

  		$this->validatorSchema['type'] = new sfValidatorString(array('max_length' => 255), array('required' => 'Choisissez le type d\'adhésion'));

  		$this->widgetSchema['amount'] = new sfWidgetFormInput();
  		$this->validatorSchema['amount'] = new sfValidatorString(array('max_length' => 255), array('required' => 'Veuillez entrer le montant'));

  		$this->widgetSchema['payment_kind'] = new sfWidgetFormSelectRadio(array('choices' => self::$PAYMENT_KIND));
  		$this->validatorSchema['payment_kind'] = new sfValidatorString(array('max_length' => 255), array('required' => 'Veuillez choisir le mode de paiment'));

  		$this->widgetSchema['check_no'] = new sfWidgetFormInput();
  		$this->validatorSchema['check_no'] = new sfValidatorPass();
  		$this->widgetSchema->setLabels(array(
  		'year' => 'Date d\'adhésion',
  		'amount' => 'Montant',
  		'type'		=> 'Type d\'adhésion',
  		'payment_kind'	=> 'Mode de paiment',
  		'check_no'	=> 'Numéro de chèque'
  		));

  		$this->widgetSchema->setNameFormat('form_subscription[%s]');
  	}
}
