mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-10-31 17:28:23 +00:00 
			
		
		
		
	Linking report <> person
This commit is contained in:
		| @@ -51,6 +51,39 @@ class ReportController extends Controller | ||||
|         )); | ||||
|     } | ||||
|  | ||||
|  | ||||
|     /** | ||||
|      * Select the type of the Report | ||||
|      */ | ||||
|     public function selectReportTypeAction($person_id, Request $request) | ||||
|     { | ||||
|         $em = $this->getDoctrine()->getManager(); | ||||
|  | ||||
|         $cFGroups = $em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup') | ||||
|             ->findByEntity('Chill\ReportBundle\Entity\Report'); | ||||
|  | ||||
|         $cFGroupsChoice = array(); | ||||
|  | ||||
|         foreach ($cFGroups as $cFGroup) { | ||||
|             $cFGroupsChoice[$cFGroup->getId()] = $cFGroup->getName($request->getLocale()); | ||||
|         } | ||||
|  | ||||
|         $form = $this->get('form.factory') | ||||
|             ->createNamedBuilder(null, 'form', null, array( | ||||
|                 'method' => 'GET', | ||||
|                 'action' => $this->generateUrl('report_new'), | ||||
|                 'csrf_protection' => false | ||||
|             )) | ||||
|             ->add('cFGroup', 'choice', array( | ||||
|                 'choices' => $cFGroupsChoice | ||||
|             )) | ||||
|             ->getForm(); | ||||
|  | ||||
|         return $this->render('ChillReportBundle:Report:select_report_type.html.twig', array( | ||||
|             'form'     => $form->createView() | ||||
|         )); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Creates a new Report entity. | ||||
|      * | ||||
|   | ||||
| @@ -1,3 +1,12 @@ | ||||
| report_select_type: | ||||
|     pattern:  /person/{person_id}/report/create | ||||
|     defaults: { _controller: "ChillReportBundle:Report:selectReportType" } | ||||
|     options: | ||||
|         menus: | ||||
|             person: | ||||
|                 order: 100 | ||||
|                 label: Add a report | ||||
|  | ||||
| cl_custom_fields_report: | ||||
|     resource: "@ChillReportBundle/Resources/config/routing/report.yml" | ||||
|     prefix:   /report | ||||
							
								
								
									
										13
									
								
								Resources/views/Report/select_report_type.html.twig
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								Resources/views/Report/select_report_type.html.twig
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| {% extends "ChillMainBundle::layout.html.twig" %} | ||||
|   | ||||
|  | ||||
|  {% block content %} | ||||
|  | ||||
|     {{ form_start(form) }} | ||||
|         {{ form_row(form) }} | ||||
|         <button type="submit"> | ||||
|             Create a new report | ||||
|         </button> | ||||
|     {{ form_end(form) }}  | ||||
|   | ||||
| {% endblock %} | ||||
		Reference in New Issue
	
	Block a user