Browse Source

[Backend] CollectifData : export CSV

develop
Guillaume 2 years ago
parent
commit
27a15fdb5e
6 changed files with 138 additions and 65 deletions
  1. +10
    -11
      package.json
  2. +24
    -24
      public/build/entrypoints.json
  3. +15
    -14
      public/build/manifest.json
  4. +2
    -2
      src/Controller/AbstractAdminController.php
  5. +84
    -11
      src/Controller/Admin/CollectifDataCrudController.php
  6. +3
    -3
      yarn.lock

+ 10
- 11
package.json View File

"build": "encore production --progress" "build": "encore production --progress"
}, },
"dependencies": { "dependencies": {
"@amcharts/amcharts4": "^4.10.22",
"@symfony/stimulus-bridge": "^2.0.0", "@symfony/stimulus-bridge": "^2.0.0",
"@symfony/webpack-encore": "^1.4.0", "@symfony/webpack-encore": "^1.4.0",
"admin-lte": "^3.1.0",
"bootstrap-autocomplete": "^2.3.7",
"bootstrap-daterangepicker": "^3.1.0", "bootstrap-daterangepicker": "^3.1.0",
"ckeditor": "^4.12.1",
"core-js": "^3.0.0", "core-js": "^3.0.0",
"file-loader": "^6.0.0",
"jquery": "^3.6.0",
"jquery-ui-sortable": "^1.0.0",
"regenerator-runtime": "^0.13.2", "regenerator-runtime": "^0.13.2",
"sass": "^1.34.0", "sass": "^1.34.0",
"sass-loader": "^11.1.1",
"select2-bootstrap4-theme": "^1.0.0", "select2-bootstrap4-theme": "^1.0.0",
"stimulus": "^2.0.0", "stimulus": "^2.0.0",
"ts-loader": "^8.0.1", "ts-loader": "^8.0.1",
"typescript": "^4.4.2", "typescript": "^4.4.2",
"webpack-notifier": "^1.6.0",
"@amcharts/amcharts4": "^4.10.22",
"admin-lte": "^3.1.0",
"bootstrap-autocomplete": "^2.3.7",
"jquery": "^3.6.0",
"jquery-ui-sortable": "^1.0.0",
"sass-loader": "^11.1.1",
"ckeditor": "^4.12.1",
"file-loader": "^6.0.0"
"webpack-notifier": "^1.6.0"
}, },
"devDependencies": {
}
"devDependencies": {}
} }

+ 24
- 24
public/build/entrypoints.json View File

"entrypoints": { "entrypoints": {
"adminlte-plugins": { "adminlte-plugins": {
"js": [ "js": [
"/build/runtime.3d27a626.js",
"/build/runtime.13c4345a.js",
"/build/vendors-node_modules_core-js_internals_export_js.b6b23703.js", "/build/vendors-node_modules_core-js_internals_export_js.b6b23703.js",
"/build/vendors-node_modules_core-js_internals_advance-string-index_js-node_modules_core-js_internals-7d93ee.fb71db4a.js", "/build/vendors-node_modules_core-js_internals_advance-string-index_js-node_modules_core-js_internals-7d93ee.fb71db4a.js",
"/build/vendors-node_modules_jquery_src_jquery_js.e65c0e33.js", "/build/vendors-node_modules_jquery_src_jquery_js.e65c0e33.js",
"/build/vendors-node_modules_core-js_internals_add-to-unscopables_js-node_modules_core-js_modules_es_-cd53d9.25be4035.js", "/build/vendors-node_modules_core-js_internals_add-to-unscopables_js-node_modules_core-js_modules_es_-cd53d9.25be4035.js",
"/build/vendors-node_modules_core-js_modules_es_string_split_js-node_modules_popper_js_dist_esm_popper_js.2bb90f63.js", "/build/vendors-node_modules_core-js_modules_es_string_split_js-node_modules_popper_js_dist_esm_popper_js.2bb90f63.js",
"/build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-0f2281.3c330cc7.js", "/build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-0f2281.3c330cc7.js",
"/build/adminlte-plugins.d8487c35.js"
"/build/adminlte-plugins.57e6b1d2.js"
], ],
"css": [ "css": [
"/build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-0f2281.bb1c83c0.css" "/build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-0f2281.bb1c83c0.css"
}, },
"adminlte-index": { "adminlte-index": {
"js": [ "js": [
"/build/runtime.3d27a626.js",
"/build/runtime.13c4345a.js",
"/build/vendors-node_modules_core-js_internals_export_js.b6b23703.js", "/build/vendors-node_modules_core-js_internals_export_js.b6b23703.js",
"/build/vendors-node_modules_core-js_internals_advance-string-index_js-node_modules_core-js_internals-7d93ee.fb71db4a.js", "/build/vendors-node_modules_core-js_internals_advance-string-index_js-node_modules_core-js_internals-7d93ee.fb71db4a.js",
"/build/vendors-node_modules_core-js_internals_add-to-unscopables_js-node_modules_core-js_modules_es_-cd53d9.25be4035.js", "/build/vendors-node_modules_core-js_internals_add-to-unscopables_js-node_modules_core-js_modules_es_-cd53d9.25be4035.js",
"/build/vendors-node_modules_core-js_modules_es_array_find_js-node_modules_core-js_modules_es_array_i-feaec3.5bf458bc.js", "/build/vendors-node_modules_core-js_modules_es_array_find_js-node_modules_core-js_modules_es_array_i-feaec3.5bf458bc.js",
"/build/adminlte-index.4f294872.js"
"/build/adminlte-index.95eb752b.js"
], ],
"css": [ "css": [
"/build/adminlte-index.5737ef9f.css"
"/build/adminlte-index.22b0d5e9.css"
] ]
}, },
"adminlte-form": { "adminlte-form": {
"js": [ "js": [
"/build/runtime.3d27a626.js",
"/build/runtime.13c4345a.js",
"/build/vendors-node_modules_core-js_internals_export_js.b6b23703.js", "/build/vendors-node_modules_core-js_internals_export_js.b6b23703.js",
"/build/vendors-node_modules_core-js_modules_es_array_find_js-_7db01.c27eb96d.js", "/build/vendors-node_modules_core-js_modules_es_array_find_js-_7db01.c27eb96d.js",
"/build/adminlte-form.24a91721.js"
"/build/adminlte-form.98ea3027.js"
], ],
"css": [ "css": [
"/build/adminlte-form.3e7d9bc7.css" "/build/adminlte-form.3e7d9bc7.css"
}, },
"adminlte-sort": { "adminlte-sort": {
"js": [ "js": [
"/build/runtime.3d27a626.js",
"/build/runtime.13c4345a.js",
"/build/vendors-node_modules_core-js_internals_export_js.b6b23703.js", "/build/vendors-node_modules_core-js_internals_export_js.b6b23703.js",
"/build/vendors-node_modules_core-js_internals_advance-string-index_js-node_modules_core-js_internals-7d93ee.fb71db4a.js", "/build/vendors-node_modules_core-js_internals_advance-string-index_js-node_modules_core-js_internals-7d93ee.fb71db4a.js",
"/build/vendors-node_modules_jquery_src_jquery_js.e65c0e33.js", "/build/vendors-node_modules_jquery_src_jquery_js.e65c0e33.js",
"/build/vendors-node_modules_jquery-ui-sortable_jquery-ui_min_js.4192d4ce.js", "/build/vendors-node_modules_jquery-ui-sortable_jquery-ui_min_js.4192d4ce.js",
"/build/vendors-node_modules_core-js_modules_es_array_find_js-node_modules_core-js_modules_es_string_-b9e064.2ecf2f9f.js", "/build/vendors-node_modules_core-js_modules_es_array_find_js-node_modules_core-js_modules_es_string_-b9e064.2ecf2f9f.js",
"/build/adminlte-sort.e6f4f49f.js"
"/build/adminlte-sort.1719f809.js"
], ],
"css": [ "css": [
"/build/adminlte-sort.7e9350c2.css" "/build/adminlte-sort.7e9350c2.css"
}, },
"adminlte-field-filemanager": { "adminlte-field-filemanager": {
"js": [ "js": [
"/build/runtime.3d27a626.js",
"/build/runtime.13c4345a.js",
"/build/vendors-node_modules_core-js_internals_export_js.b6b23703.js", "/build/vendors-node_modules_core-js_internals_export_js.b6b23703.js",
"/build/adminlte-field-filemanager.cf4425cd.js"
"/build/adminlte-field-filemanager.be92c053.js"
], ],
"css": [ "css": [
"/build/adminlte-field-filemanager.2473d8f3.css" "/build/adminlte-field-filemanager.2473d8f3.css"
}, },
"adminlte-field-collection": { "adminlte-field-collection": {
"js": [ "js": [
"/build/runtime.3d27a626.js",
"/build/runtime.13c4345a.js",
"/build/vendors-node_modules_jquery_src_jquery_js.e65c0e33.js", "/build/vendors-node_modules_jquery_src_jquery_js.e65c0e33.js",
"/build/vendors-node_modules_jquery-ui-sortable_jquery-ui_min_js.4192d4ce.js", "/build/vendors-node_modules_jquery-ui-sortable_jquery-ui_min_js.4192d4ce.js",
"/build/adminlte-field-collection.bf51b4fd.js"
"/build/adminlte-field-collection.7e6cc250.js"
], ],
"css": [ "css": [
"/build/adminlte-field-collection.0e96676f.css" "/build/adminlte-field-collection.0e96676f.css"
}, },
"adminlte-main": { "adminlte-main": {
"js": [ "js": [
"/build/runtime.3d27a626.js",
"/build/runtime.13c4345a.js",
"/build/vendors-node_modules_core-js_internals_export_js.b6b23703.js", "/build/vendors-node_modules_core-js_internals_export_js.b6b23703.js",
"/build/vendors-node_modules_core-js_internals_advance-string-index_js-node_modules_core-js_internals-7d93ee.fb71db4a.js", "/build/vendors-node_modules_core-js_internals_advance-string-index_js-node_modules_core-js_internals-7d93ee.fb71db4a.js",
"/build/adminlte-main.a68c6b41.js"
"/build/adminlte-main.a8e37b78.js"
], ],
"css": [ "css": [
"/build/adminlte-main.1c300872.css"
"/build/adminlte-main.56708bb5.css"
] ]
}, },
"sov-reminder": { "sov-reminder": {
"js": [ "js": [
"/build/runtime.3d27a626.js",
"/build/sov-reminder.5e053a2b.js"
"/build/runtime.13c4345a.js",
"/build/sov-reminder.8302acd0.js"
], ],
"css": [ "css": [
"/build/sov-reminder.3a67c840.css" "/build/sov-reminder.3a67c840.css"
}, },
"sov-ticket": { "sov-ticket": {
"js": [ "js": [
"/build/runtime.3d27a626.js",
"/build/sov-ticket.ed87120e.js"
"/build/runtime.13c4345a.js",
"/build/sov-ticket.3527403c.js"
] ]
}, },
"app-backend": { "app-backend": {
"js": [ "js": [
"/build/runtime.3d27a626.js",
"/build/runtime.13c4345a.js",
"/build/vendors-node_modules_core-js_internals_export_js.b6b23703.js", "/build/vendors-node_modules_core-js_internals_export_js.b6b23703.js",
"/build/vendors-node_modules_core-js_modules_es_array_find_js-_7db00.48e9ded1.js", "/build/vendors-node_modules_core-js_modules_es_array_find_js-_7db00.48e9ded1.js",
"/build/app-backend.bca91793.js" "/build/app-backend.bca91793.js"
}, },
"app-frontend": { "app-frontend": {
"js": [ "js": [
"/build/runtime.3d27a626.js",
"/build/runtime.13c4345a.js",
"/build/vendors-node_modules_core-js_internals_export_js.b6b23703.js", "/build/vendors-node_modules_core-js_internals_export_js.b6b23703.js",
"/build/vendors-node_modules_core-js_internals_advance-string-index_js-node_modules_core-js_internals-7d93ee.fb71db4a.js", "/build/vendors-node_modules_core-js_internals_advance-string-index_js-node_modules_core-js_internals-7d93ee.fb71db4a.js",
"/build/vendors-node_modules_jquery_src_jquery_js.e65c0e33.js", "/build/vendors-node_modules_jquery_src_jquery_js.e65c0e33.js",
"/build/app-frontend.f8975c31.js" "/build/app-frontend.f8975c31.js"
], ],
"css": [ "css": [
"/build/app-frontend.e5188731.css"
"/build/app-frontend.91dae722.css"
] ]
}, },
"app-bulle": { "app-bulle": {
"js": [ "js": [
"/build/runtime.3d27a626.js",
"/build/runtime.13c4345a.js",
"/build/vendors-node_modules_core-js_internals_export_js.b6b23703.js", "/build/vendors-node_modules_core-js_internals_export_js.b6b23703.js",
"/build/vendors-node_modules_core-js_internals_advance-string-index_js-node_modules_core-js_internals-7d93ee.fb71db4a.js", "/build/vendors-node_modules_core-js_internals_advance-string-index_js-node_modules_core-js_internals-7d93ee.fb71db4a.js",
"/build/vendors-node_modules_amcharts_amcharts4_charts_js-node_modules_amcharts_amcharts4_core_js-nod-680fc8.3921a227.js", "/build/vendors-node_modules_amcharts_amcharts4_charts_js-node_modules_amcharts_amcharts4_core_js-nod-680fc8.3921a227.js",

+ 15
- 14
public/build/manifest.json View File

{ {
"build/adminlte-plugins.js": "/build/adminlte-plugins.d8487c35.js",
"build/adminlte-index.css": "/build/adminlte-index.5737ef9f.css",
"build/adminlte-index.js": "/build/adminlte-index.4f294872.js",
"build/adminlte-plugins.js": "/build/adminlte-plugins.57e6b1d2.js",
"build/adminlte-index.css": "/build/adminlte-index.22b0d5e9.css",
"build/adminlte-index.js": "/build/adminlte-index.95eb752b.js",
"build/adminlte-form.css": "/build/adminlte-form.3e7d9bc7.css", "build/adminlte-form.css": "/build/adminlte-form.3e7d9bc7.css",
"build/adminlte-form.js": "/build/adminlte-form.24a91721.js",
"build/adminlte-form.js": "/build/adminlte-form.98ea3027.js",
"build/adminlte-sort.css": "/build/adminlte-sort.7e9350c2.css", "build/adminlte-sort.css": "/build/adminlte-sort.7e9350c2.css",
"build/adminlte-sort.js": "/build/adminlte-sort.e6f4f49f.js",
"build/adminlte-sort.js": "/build/adminlte-sort.1719f809.js",
"build/adminlte-field-filemanager.css": "/build/adminlte-field-filemanager.2473d8f3.css", "build/adminlte-field-filemanager.css": "/build/adminlte-field-filemanager.2473d8f3.css",
"build/adminlte-field-filemanager.js": "/build/adminlte-field-filemanager.cf4425cd.js",
"build/adminlte-field-filemanager.js": "/build/adminlte-field-filemanager.be92c053.js",
"build/adminlte-field-collection.css": "/build/adminlte-field-collection.0e96676f.css", "build/adminlte-field-collection.css": "/build/adminlte-field-collection.0e96676f.css",
"build/adminlte-field-collection.js": "/build/adminlte-field-collection.bf51b4fd.js",
"build/adminlte-main.css": "/build/adminlte-main.1c300872.css",
"build/adminlte-main.js": "/build/adminlte-main.a68c6b41.js",
"build/adminlte-field-collection.js": "/build/adminlte-field-collection.7e6cc250.js",
"build/adminlte-main.css": "/build/adminlte-main.56708bb5.css",
"build/adminlte-main.js": "/build/adminlte-main.a8e37b78.js",
"build/sov-reminder.css": "/build/sov-reminder.3a67c840.css", "build/sov-reminder.css": "/build/sov-reminder.3a67c840.css",
"build/sov-reminder.js": "/build/sov-reminder.5e053a2b.js",
"build/sov-ticket.js": "/build/sov-ticket.ed87120e.js",
"build/sov-reminder.js": "/build/sov-reminder.8302acd0.js",
"build/sov-ticket.js": "/build/sov-ticket.3527403c.js",
"build/app-backend.css": "/build/app-backend.90192bf1.css", "build/app-backend.css": "/build/app-backend.90192bf1.css",
"build/app-backend.js": "/build/app-backend.bca91793.js", "build/app-backend.js": "/build/app-backend.bca91793.js",
"build/app-frontend.css": "/build/app-frontend.e5188731.css",
"build/app-frontend.css": "/build/app-frontend.91dae722.css",
"build/app-frontend.js": "/build/app-frontend.f8975c31.js", "build/app-frontend.js": "/build/app-frontend.f8975c31.js",
"build/app-bulle.js": "/build/app-bulle.351444bd.js", "build/app-bulle.js": "/build/app-bulle.351444bd.js",
"build/runtime.js": "/build/runtime.3d27a626.js",
"build/runtime.js": "/build/runtime.13c4345a.js",
"build/pdfmake.js": "/build/pdfmake.594e5fcf.js", "build/pdfmake.js": "/build/pdfmake.594e5fcf.js",
"build/canvg.js": "/build/canvg.07f0c63e.js", "build/canvg.js": "/build/canvg.07f0c63e.js",
"build/xlsx.js": "/build/xlsx.05855660.js", "build/xlsx.js": "/build/xlsx.05855660.js",
"build/vendors-node_modules_core-js_internals_add-to-unscopables_js-node_modules_core-js_modules_es_-cd53d9.25be4035.js": "/build/vendors-node_modules_core-js_internals_add-to-unscopables_js-node_modules_core-js_modules_es_-cd53d9.25be4035.js", "build/vendors-node_modules_core-js_internals_add-to-unscopables_js-node_modules_core-js_modules_es_-cd53d9.25be4035.js": "/build/vendors-node_modules_core-js_internals_add-to-unscopables_js-node_modules_core-js_modules_es_-cd53d9.25be4035.js",
"build/vendors-node_modules_core-js_modules_es_string_split_js-node_modules_popper_js_dist_esm_popper_js.2bb90f63.js": "/build/vendors-node_modules_core-js_modules_es_string_split_js-node_modules_popper_js_dist_esm_popper_js.2bb90f63.js", "build/vendors-node_modules_core-js_modules_es_string_split_js-node_modules_popper_js_dist_esm_popper_js.2bb90f63.js": "/build/vendors-node_modules_core-js_modules_es_string_split_js-node_modules_popper_js_dist_esm_popper_js.2bb90f63.js",
"build/vendors-node_modules_jquery-ui-sortable_jquery-ui_min_js.4192d4ce.js": "/build/vendors-node_modules_jquery-ui-sortable_jquery-ui_min_js.4192d4ce.js", "build/vendors-node_modules_jquery-ui-sortable_jquery-ui_min_js.4192d4ce.js": "/build/vendors-node_modules_jquery-ui-sortable_jquery-ui_min_js.4192d4ce.js",
"build/vendors-node_modules_symfony_webpack-encore_lib_webpack_copy-files-loader_js_context_var_www_-d8ac68.95095c71.js": "/build/vendors-node_modules_symfony_webpack-encore_lib_webpack_copy-files-loader_js_context_var_www_-d8ac68.95095c71.js",
"build/vendors-node_modules_symfony_webpack-encore_lib_webpack_copy-files-loader_js_context_home_gui-f9c03a.7d817997.js": "/build/vendors-node_modules_symfony_webpack-encore_lib_webpack_copy-files-loader_js_context_home_gui-f9c03a.7d817997.js",
"build/vendors-node_modules_amcharts_amcharts4_charts_js-node_modules_amcharts_amcharts4_core_js-nod-680fc8.3921a227.js": "/build/vendors-node_modules_amcharts_amcharts4_charts_js-node_modules_amcharts_amcharts4_core_js-nod-680fc8.3921a227.js", "build/vendors-node_modules_amcharts_amcharts4_charts_js-node_modules_amcharts_amcharts4_core_js-nod-680fc8.3921a227.js": "/build/vendors-node_modules_amcharts_amcharts4_charts_js-node_modules_amcharts_amcharts4_core_js-nod-680fc8.3921a227.js",
"build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-0f2281.bb1c83c0.css": "/build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-0f2281.bb1c83c0.css", "build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-0f2281.bb1c83c0.css": "/build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-0f2281.bb1c83c0.css",
"build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-0f2281.3c330cc7.js": "/build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-0f2281.3c330cc7.js", "build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-0f2281.3c330cc7.js": "/build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-0f2281.3c330cc7.js",
"build/ckeditor/plugins/bbcode/plugin.js": "/build/ckeditor/plugins/bbcode/plugin.js", "build/ckeditor/plugins/bbcode/plugin.js": "/build/ckeditor/plugins/bbcode/plugin.js",
"build/ckeditor/skins/kama/dialog.css": "/build/ckeditor/skins/kama/dialog.css", "build/ckeditor/skins/kama/dialog.css": "/build/ckeditor/skins/kama/dialog.css",
"build/ckeditor/plugins/balloonpanel/plugin.js": "/build/ckeditor/plugins/balloonpanel/plugin.js", "build/ckeditor/plugins/balloonpanel/plugin.js": "/build/ckeditor/plugins/balloonpanel/plugin.js",
"build/images/stripped.png": "/build/images/stripped.74df2199.png",
"build/ckeditor/plugins/autocomplete/plugin.js": "/build/ckeditor/plugins/autocomplete/plugin.js", "build/ckeditor/plugins/autocomplete/plugin.js": "/build/ckeditor/plugins/autocomplete/plugin.js",
"build/ckeditor/plugins/table/dialogs/table.js": "/build/ckeditor/plugins/table/dialogs/table.js", "build/ckeditor/plugins/table/dialogs/table.js": "/build/ckeditor/plugins/table/dialogs/table.js",
"build/ckeditor/plugins/imagebase/plugin.js": "/build/ckeditor/plugins/imagebase/plugin.js", "build/ckeditor/plugins/imagebase/plugin.js": "/build/ckeditor/plugins/imagebase/plugin.js",

+ 2
- 2
src/Controller/AbstractAdminController.php View File



namespace App\Controller; namespace App\Controller;


use Lc\SovBundle\Controller\AbstractAdminController as SovAbstractAdminController;
use Lc\PietroBundle\Controller\AbstractAdminController as PietroAbstractAdminController;


abstract class AbstractAdminController extends SovAbstractAdminController
abstract class AbstractAdminController extends PietroAbstractAdminController
{ {
use ControllerTrait; use ControllerTrait;
} }

+ 84
- 11
src/Controller/Admin/CollectifDataCrudController.php View File



use App\Controller\AbstractAdminController; use App\Controller\AbstractAdminController;
use App\Entity\CollectifData\CollectifData; use App\Entity\CollectifData\CollectifData;
use Lc\PietroBundle\Form\Dream\DreamType;
use Lc\PietroBundle\Form\ProjectBoost\ProjectBoostType;
use Lc\PietroBundle\Form\ProjectInspiring\ProjectInspiringType;
use Lc\PietroBundle\Form\Revolt\RevoltType;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\QueryBuilder;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection; use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FilterCollection; use EasyCorp\Bundle\EasyAdminBundle\Collection\FilterCollection;
use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto; use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto;
use EasyCorp\Bundle\EasyAdminBundle\Dto\SearchDto; use EasyCorp\Bundle\EasyAdminBundle\Dto\SearchDto;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\HiddenField;
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Field\CollectionField;
use Lc\SovBundle\Field\StatusField;
use Lc\SovBundle\Generator\CsvGenerator;
use Lc\SovBundle\Repository\RepositoryQueryInterface; use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Symfony\Component\HttpFoundation\Request;


class CollectifDataCrudController extends AbstractAdminController class CollectifDataCrudController extends AbstractAdminController
{ {
->getFields($pageName); ->getFields($pageName);
} }


public function configureActions(Actions $actions): Actions
{
parent::configureActions($actions);

$export = Action::new('export', 'actions.export')
->setIcon('fa fa-download')
->linkToCrudAction('exportCsv')
->setCssClass('btn btn-sm btn-primary export-csv')
->createAsGlobalAction();

return $actions->add(Crud::PAGE_INDEX, $export);
}

public function getRepositoryQuery(): RepositoryQueryInterface public function getRepositoryQuery(): RepositoryQueryInterface
{ {
return $this->getCollectifDataContainer()->getRepositoryQuery(); return $this->getCollectifDataContainer()->getRepositoryQuery();


parent::persistEntity($entityManager, $entityInstance); parent::persistEntity($entityManager, $entityInstance);
} }

public function exportCsv(Request $request)
{
$csv = new CsvGenerator();
$csv->enableConvertEncoding('ISO-8859-1');
$csv->setTitle('Export_Liste_Collectif', true);

$columns = [
'category' => 'Catégorie',
'thematic' => 'Thématique',
'subthematic' => 'Contribution',
'territory' => 'Lieu',
'nb_participant' => 'Participants',
'description' => 'Description'
];
$csv->setColumns($columns);

$resultArray = $this->generateAllResultArray();

$csv = $this->generateCsvData($csv, $resultArray);

return $csv->getReponse();
}

private function generateAllResultArray(): array
{
$dreamArray = $this->getDreamContainer()->getStore()->get();
$revoltArray = $this->getRevoltContainer()->getStore()->get();
$projectBoostArray = $this->getProjectBoostContainer()->getStore()->get();
$projectInspiringArray = $this->getProjectInspiringContainer()->getStore()->get();

return array_merge($dreamArray, $revoltArray, $projectBoostArray, $projectInspiringArray);
}

private function generateCsvData($csv, $resultArray)
{
foreach ($resultArray as $result) {
$territory = $subthematic = $thematic = "";

if ($result->getCollectifData()) {
$collectifData = $result->getCollectifData();
$territory = $collectifData->getTerritory()->getName();

if ($result->getSubthematic()) {
$subthematic = $result->getSubthematic()->getName();
}

if ($result->getThematic()) {
$thematic = $result->getThematic()->getName();
}

$data = [
'category' => $result->__toString(),
'thematic' => $thematic,
'subthematic' => $subthematic,
'territory' => $territory,
'nb_participant' => $collectifData->getNbParticipant(),
'description' => $result->getDescription()
];

$csv->row($data);
}
}

return $csv;
}
} }

+ 3
- 3
yarn.lock View File

lodash.uniq "^4.5.0" lodash.uniq "^4.5.0"


caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001271: caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001271:
version "1.0.30001271"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001271.tgz#0dda0c9bcae2cf5407cd34cac304186616cc83e8"
integrity sha512-BBruZFWmt3HFdVPS8kceTBIguKxu4f99n5JNp06OlPD/luoAMIaIK5ieV5YjnBLH3Nysai9sxj9rpJj4ZisXOA==
version "1.0.30001299"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001299.tgz"
integrity sha512-iujN4+x7QzqA2NCSrS5VUy+4gLmRd4xv6vbBBsmfVqTx8bLAD8097euLqQgKxSVLvxjSDcvF1T/i9ocgnUFexw==


center-align@^0.1.1: center-align@^0.1.1:
version "0.1.3" version "0.1.3"

Loading…
Cancel
Save