using person template

This commit is contained in:
Marc Ducobu 2014-11-10 12:51:52 +01:00
parent a3c67dd9b0
commit bd4538604e
6 changed files with 55 additions and 39 deletions

View File

@ -121,6 +121,8 @@ class ReportController extends Controller
{
$em = $this->getDoctrine()->getManager();
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
$entity = new Report();
$cFGroup = $em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')->find($cf_group_id);
@ -131,6 +133,7 @@ class ReportController extends Controller
return $this->render('ChillReportBundle:Report:new.html.twig', array(
'entity' => $entity,
'form' => $form->createView(),
'person' => $person
));
}
@ -161,7 +164,8 @@ class ReportController extends Controller
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl('report_show', array('id' => $entity->getId())));
return $this->redirect($this->generateUrl('report_show',
array('person_id' => $person_id,'id' => $entity->getId())));
}
return $this->render('ChillReportBundle:Report:new.html.twig', array(
@ -196,21 +200,24 @@ class ReportController extends Controller
* Finds and displays a Report entity.
*
*/
public function showAction($id)
public function showAction($id, $person_id)
{
$em = $this->getDoctrine()->getManager();
$person = $em->getRepository('ChillPersonBundle:Person')->find($person_id);
$entity = $em->getRepository('ChillReportBundle:Report')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Report entity.');
}
$deleteForm = $this->createDeleteForm($id);
//$deleteForm = $this->createDeleteForm($id);
return $this->render('ChillReportBundle:Report:show.html.twig', array(
'entity' => $entity,
'delete_form' => $deleteForm->createView(),
'entity' => $entity,
'person' => $person,
//'delete_form' => $deleteForm->createView(),
));
}

View File

@ -6,7 +6,6 @@ report_select_type:
person:
order: 100
label: Add a report
report_new:
path: /person/{person_id}/report/cfgroup/{cf_group_id}/new
defaults: { _controller: "ChillReportBundle:Report:new" }
@ -17,7 +16,7 @@ report_create:
requirements: { _method: post }
report_show:
path: report/{id}/show
path: /person/{person_id}/report/{id}/show
defaults: { _controller: "ChillReportBundle:Report:show" }
cl_custom_fields_report:

View File

@ -2,10 +2,6 @@ report:
path: /
defaults: { _controller: "ChillReportBundle:Report:index" }
report_show:
path: /{id}/show
defaults: { _controller: "ChillReportBundle:Report:show" }
report_edit:
path: /{id}/edit
defaults: { _controller: "ChillReportBundle:Report:edit" }

View File

@ -1,15 +1,25 @@
{% extends "ChillMainBundle::layout.html.twig" %}
{#
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "ChillPersonBundle::layout.html.twig" %}
{% block content %}
<h1>Report creation</h1>
{% set activeRouteKey = 'report_select_type' %}
{% block title %}{{ 'Ajout d\' un rapport' |trans() }}{% endblock title %}
{% block personcontent %}
{{ form(form) }}
<ul class="record_actions">
<li>
<a href="{{ path('report') }}">
Back to the list
</a>
</li>
</ul>
{% endblock %}

View File

@ -1,3 +1,19 @@
{#
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "ChillPersonBundle::layout.html.twig" %}
{% set activeRouteKey = 'report_select_type' %}

View File

@ -14,11 +14,13 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "ChillMainBundle::layout.html.twig" %}
{% extends "ChillPersonBundle::layout.html.twig" %}
{% block content %}
<h1>Report</h1>
{% set activeRouteKey = 'report_select_type' %}
{% block title %}{{ 'Details d\' un rapport' |trans() }}{% endblock title %}
{% block personcontent %}
<table class="record_properties">
<tbody>
<tr>
@ -51,18 +53,4 @@
</tr>
</tbody>
</table>
<ul class="record_actions">
<li>
<a href="{{ path('report') }}">
Back to the list
</a>
</li>
<li>
<a href="{{ path('report_edit', { 'id': entity.id }) }}">
Edit
</a>
</li>
<li>{{ form(delete_form) }}</li>
</ul>
{% endblock %}