Allowing export for reports

This commit is contained in:
Marc Ducobu
2015-02-17 15:11:42 +01:00
parent 897a0361a8
commit 6ec0892ac6
5 changed files with 183 additions and 18 deletions

View File

@@ -34,4 +34,18 @@ report_edit:
report_update:
path: /{_locale}/person/{person_id}/report/{report_id}/update
defaults: { _controller: "ChillReportBundle:Report:update" }
requirements: { _method: post|put }
requirements: { _method: post|put }
report_export_list:
path: /{_locale}/export/report/cfgroup/{cf_group_id}
defaults: { _controller: "ChillReportBundle:Report:export" }
report_export_select_type:
pattern: /{_locale}/export/report/select/type
defaults: {_controller: "ChillReportBundle:Report:selectReportTypeForExport" }
options:
menus:
export:
order: 100
label: Export reports

View File

@@ -0,0 +1,23 @@
"{{ 'Person'|trans }}",{#
#}"{{ 'Date'|trans }}",{#
#}"{{ 'User'|trans }}",{#
#}"{{ 'Report type'|trans }}",{#
#}{% for customField in cf_group.customFields %}{#
#}"{{ chill_custom_field_label(customField) }}"{% if not loop.last %},{% endif %}{#
#}{% endfor %}
{% for report in reports %}{#
#}"{{ report.person }}",{#
#}"{{ report.date|localizeddate('long', 'none') }}",{#
#}"{{ report.user }}",{#
#}"{{ report.cFGroup.getName(app.request.locale) }}",{#
#}{% for customField in report.cFGroup.customFields %}{#
#}{% if customField.type == 'title' %}{#
#}""{#
#}{% else %}{#
#}"{{ chill_custom_field_widget(report.cFData , customField, 'csv') }}"{#
#}{% endif %}{#
#}{% if not loop.last %},{% endif %}{#
#}{% endfor %}
{% endfor %}

View File

@@ -22,7 +22,6 @@
{% block personcontent %}
{{ form_start(form) }}
{{ form_widget(form.cFGroup) }}
<button class="sc-button green" type="submit">
@@ -30,6 +29,5 @@
{{ 'Create a new report'|trans }}
</button>
{{ form_end(form) }}
{% endblock %}

View File

@@ -0,0 +1,33 @@
{#
* 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 "ChillMainBundle::Export/layout.html.twig" %}
{% set activeRouteKey = 'report_export_list' %}
{% block title %}{{ 'Reports export'|trans() }}{% endblock title %}
{% block export_content %}
{{ form_start(form) }}
{{ form_widget(form.cFGroup) }}
<button class="sc-button green" type="submit">
<i class="fa fa-upload"></i>
{{ 'Export this kind of reports'|trans }}
</button>
{{ form_end(form) }}
{% endblock %}