diff --git a/Controller/ReportController.php b/Controller/ReportController.php index 26e0f54b9..2e3b068ef 100644 --- a/Controller/ReportController.php +++ b/Controller/ReportController.php @@ -19,16 +19,38 @@ class ReportController extends Controller * Lists all Report entities. * */ - public function indexAction() + public function indexAction(Request $request) { $em = $this->getDoctrine()->getManager(); $entities = $em->getRepository('ChillReportBundle:Report')->findAll(); + $cFGroups = $em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup') + ->findByEntity('Chill\ReportBundle\Entity\Report'); + + $cFGroupsChoice = array(); + + foreach ($cFGroups as $g) { + $cFGroupsChoice[$g->getId()] = $g->getName($request->getLocale()); + } + + $form = $this->get('form.factory') + ->createNamedBuilder(null, 'form', null, array( + 'method' => 'GET', + 'action' => $this->generateUrl('report_new'), + 'csrf_protection' => false + )) + ->add('type', 'choice', array( + 'choices' => $cFGroupsChoice + )) + ->getForm(); + return $this->render('ChillReportBundle:Report:index.html.twig', array( 'entities' => $entities, + 'form' => $form->createView() )); } + /** * Creates a new Report entity. * diff --git a/Resources/views/Report/index.html.twig b/Resources/views/Report/index.html.twig index 7cc7549f1..c021d8dbc 100644 --- a/Resources/views/Report/index.html.twig +++ b/Resources/views/Report/index.html.twig @@ -41,11 +41,11 @@ -