mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-22 15:43:51 +00:00
add feature: update the date of an opened file
This commit is contained in:
56
Form/PersonHistoryFileType.php
Normal file
56
Form/PersonHistoryFileType.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace CL\Chill\PersonBundle\Form;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
|
||||
class PersonHistoryFileType extends AbstractType
|
||||
{
|
||||
|
||||
private $motives = array();
|
||||
|
||||
public function __construct(array $motivesArray) {
|
||||
foreach ($motivesArray as $key => $params ) {
|
||||
$this->motives[$key] = $params['label'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FormBuilderInterface $builder
|
||||
* @param array $options
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('date_opening', 'date', array("required" => true,
|
||||
'widget' => 'single_text'))
|
||||
->add('date_closing', 'date', array('required' => true,
|
||||
'widget' => 'single_text'))
|
||||
->add('motive', 'choice', array(
|
||||
'choices' => $this->motives,
|
||||
'required' => true
|
||||
))
|
||||
->add('memo', 'textarea')
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OptionsResolverInterface $resolver
|
||||
*/
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => 'CL\Chill\PersonBundle\Entity\PersonHistoryFile'
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'cl_chill_personbundle_personhistoryfile';
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user