diff --git a/Controller/PersonController.php b/Controller/PersonController.php index 2e12dbca2..7fa60a50c 100644 --- a/Controller/PersonController.php +++ b/Controller/PersonController.php @@ -21,6 +21,20 @@ class PersonController extends Controller { } + public function editAction($id) { + $person = $this->_getPerson($id); + + if ($person === null) { + $this->createNotFoundException(); + } + + $form = $this->createForm(new \CL\Chill\PersonBundle\Form\PersonType(), $person); + + return $this->render('CLChillPersonBundle:Person:edit.html.twig', + array('person' => $person, + 'form' => $form->createView())); + } + public function searchAction() { $q = $this->getRequest()->query->getAlnum('q', ''); $q = trim($q); diff --git a/Form/PersonType.php b/Form/PersonType.php new file mode 100644 index 000000000..49c68cc16 --- /dev/null +++ b/Form/PersonType.php @@ -0,0 +1,51 @@ +add('name') + ->add('surname') + ->add('dateOfBirth') + ->add('placeOfBirth') + ->add('genre') + ->add('civil_union') + ->add('nbOfChild') + ->add('belgian_national_number') + ->add('memo') + ->add('address') + ->add('email') + ->add('countryOfBirth') + ->add('nationality') + ; + } + + /** + * @param OptionsResolverInterface $resolver + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) + { + $resolver->setDefaults(array( + 'data_class' => 'CL\Chill\PersonBundle\Entity\Person' + )); + } + + /** + * @return string + */ + public function getName() + { + return 'cl_chill_personbundle_person'; + } +} diff --git a/Resources/config/routing.yml b/Resources/config/routing.yml index 4a02729d0..a8ac83e21 100644 --- a/Resources/config/routing.yml +++ b/Resources/config/routing.yml @@ -7,6 +7,11 @@ chill_person_view: menu: person order: 50 label: menu.person.general_view + +chill_person_general_edit: + pattern: /view/{id}/edit + defaults: {_controller: CLChillPersonBundle:Person:edit } + chill_person_search: diff --git a/Resources/views/Person/edit.html.twig b/Resources/views/Person/edit.html.twig new file mode 100644 index 000000000..1d0054815 --- /dev/null +++ b/Resources/views/Person/edit.html.twig @@ -0,0 +1,14 @@ +{% extends "CLChillPersonBundle::layout.html.twig" %} + +{% set activeRouteKey = '' %} + +{% block title %}CLChillPersonBundle:Person:see{% endblock %} + +{% block personcontent %} + +{% form_theme form 'CLChillMainBundle:Form:fields.html.twig' %} + +{{ form(form) }} + + +{% endblock personcontent %} \ No newline at end of file