src/JuridicusBundle/Controller/ExamensklausurenController.php line 86

Open in your IDE?
  1. <?php
  2. namespace JF\JuridicusBundle\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  5. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  6. use Symfony\Component\Form\Extension\Core\Type\DateType;
  7. use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  8. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  9. /**
  10. * Examensklausuren controller.
  11. *
  12. */
  13. class ExamensklausurenController extends AbstractController
  14. {
  15. /**
  16. * @Route("/examensklausuren", name="examensklausuren")
  17. */
  18. public function indexAction()
  19. {
  20. $filter_form = $this->createParagraphFilterForm();
  21. return $this->render("@JFJuridicusBundle/Examensklausuren/index.html.twig", array(
  22. 'filter_form' => $filter_form->createView(),
  23. ));
  24. }
  25. /**
  26. *
  27. * @param array $data
  28. * @return \Symfony\Component\Form\Form
  29. */
  30. private function createParagraphFilterForm(array $data = array())
  31. {
  32. return $this->createFormBuilder($data)
  33. ->add('bundesland', EntityType::class, array(
  34. 'label' => false,
  35. 'class' => 'JF\JuridicusBundle\Entity\Bundesland',
  36. 'placeholder' => 'Bundesland wählen...',
  37. 'required' => false,
  38. ))
  39. ->add('fach', ChoiceType::class, array(
  40. 'label' => false,
  41. 'placeholder' => 'Examen auswählen...',
  42. 'choices' => array(
  43. 'Strafrecht' => 'Strafrecht',
  44. 'Öffentliches Recht' => 'Öffentliches Recht',
  45. 'Zivilrecht' => 'Zivilrecht',
  46. 'Arbeitsrecht' => 'Arbeitsrecht',
  47. 'Verwaltungsrecht' => 'Verwaltungsrecht',
  48. ),
  49. 'required' => false,
  50. ))
  51. ->add('startdatum', DateType::class, array(
  52. 'label' => false,
  53. 'placeholder' => 'Zeitraum von',
  54. 'widget' => 'single_text',
  55. //'format' => 'dd.MM.yyyy',
  56. 'required' => false,
  57. //'attr' => ['class' => 'js-datepicker', 'placeholder' => 'Zeitraum von ...',],
  58. ))
  59. ->add('endedatum', DateType::class, array(
  60. 'label' => false,
  61. 'placeholder' => 'bis ...',
  62. 'widget' => 'single_text',
  63. //'format' => 'dd.MM.yyyy',
  64. 'placeholder' => '',
  65. 'required' => false,
  66. //'attr' => ['class' => 'js-datepicker', 'placeholder' => 'bis',],
  67. ))
  68. ->add('examen', ChoiceType::class, array(
  69. 'label' => false,
  70. 'placeholder' => 'Fach auswählen...',
  71. 'choices' => array_flip(array( //changedFrom added array_flip
  72. '1' => '1. Staatsexamen',
  73. '2' => '2. Staatsexamen',
  74. )),
  75. 'required' => false,
  76. ))
  77. ->getForm();
  78. }
  79. }