<?php

namespace HVCSiteBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class FichefraisRechercheType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('Visiteur', 'entity', array(
                'class' => 'HVCSiteBundle:Comptes',
                'choice_label' => 'nomPrenomUsername',
                'required' => true,
                'empty_value' => 'Choisir un Utilisateur',
            ))
            ->add('DateFiche','date',
                array(
                    'label' => 'Date de la fiche',
                    'input'  => 'datetime',
                    'widget' => 'choice',
                    'format' => 'dd-MMM-yyyy',
                    'years' => range(date('Y'), date('Y') - 12),
                    'days'=>array(1),
                    'empty_value' => array('year' => 'Année', 'month' => 'Mois', 'day' => false)
            ))
            ->add('Rechercher','submit')


        ;
    }


    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'hvcsitebundle_fichefraisrecherche';
    }
}
