Bläddra i källkod

bubulle dynamique!

v1
Charly 3 år sedan
förälder
incheckning
1d19f88c0b
31 ändrade filer med 251119 tillägg och 16783 borttagningar
  1. +1
    -0
      assets/app/frontend/app/app.js
  2. +105
    -0
      assets/app/frontend/js/bulle.js
  3. +5
    -0
      assets/app/frontend/scss/carto-int.scss
  4. +4
    -0
      config/routes.yaml
  5. +859
    -25
      package-lock.json
  6. +6
    -3
      package.json
  7. +2
    -2
      public/build/adminlte-plugins.52943ca2.js
  8. +11198
    -0
      public/build/app-frontend.1fba758f.css
  9. +0
    -190
      public/build/app-frontend.36f3c878.js
  10. +296
    -0
      public/build/app-frontend.6a1e9044.js
  11. +0
    -11194
      public/build/app-frontend.e9883437.css
  12. +14415
    -0
      public/build/canvg.3c523da1.js
  13. +18
    -17
      public/build/entrypoints.json
  14. +12
    -7
      public/build/manifest.json
  15. +78236
    -0
      public/build/pdfmake.fbf70324.js
  16. +346
    -0
      public/build/runtime.2742d602.js
  17. +0
    -197
      public/build/runtime.3095b250.js
  18. +2
    -549
      public/build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-cd1e13.4b3e0d6f.js
  19. +1
    -1
      public/build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-cd1e13.fa890b12.css
  20. +111676
    -0
      public/build/vendors-node_modules_amcharts_amcharts4_charts_js-node_modules_amcharts_amcharts4_core_js-nod-329af8.85737a1c.js
  21. +0
    -4580
      public/build/vendors-node_modules_bootstrap_dist_js_bootstrap_js-node_modules_core-js_modules_es_array_for-85fc9f.e742e2fb.js
  22. +551
    -0
      public/build/vendors-node_modules_core-js_modules_es_array_filter_js-node_modules_core-js_modules_es_array-f22e6e.ed1ad144.js
  23. +32438
    -0
      public/build/vendors-node_modules_xlsx_xlsx_js.f1747964.js
  24. +34
    -0
      public/build/xlsx.05855660.js
  25. +56
    -0
      src/Controller/Frontend/CartoController.php
  26. +9
    -0
      src/Repository/SearchStore.php
  27. +15
    -0
      src/Repository/ThematicRepositoryQuery.php
  28. +34
    -0
      src/Repository/ThematicStore.php
  29. +9
    -1
      templates/frontend/carto-int.html.twig
  30. +1
    -1
      webpack.config.js
  31. +790
    -16
      yarn.lock

+ 1
- 0
assets/app/frontend/app/app.js Visa fil

@@ -1,3 +1,4 @@
import 'bootstrap';

import "../js/script";
import "../js/bulle";

+ 105
- 0
assets/app/frontend/js/bulle.js Visa fil

@@ -0,0 +1,105 @@
import * as am4core from "@amcharts/amcharts4/core";
import * as am4charts from "@amcharts/amcharts4/charts";
import * as am4plugins_forceDirected from "@amcharts/amcharts4/plugins/forceDirected";

// Create chart
let chart = am4core.create("carto-bulles", am4plugins_forceDirected.ForceDirectedTree);

// Create series
let series = chart.series.push(new am4plugins_forceDirected.ForceDirectedSeries())

series.dataSource.url = routes.app_carto_json;
// Set data
// series.data = [{
// "name": "Nos révoltes",
// "link": ["Nos rêves"],
// "children": [{
// "name": "A1", "value": 100
// }, {
// "name": "A2", "value": 60
// }, {
// "name": "A3", "value": 30
// }]
// }, {
// "name": "Nos rêves",
// "link": ["Les actions \n inspirantes"],
// "children": [{
// "name": "B1", "value": 135
// }, {
// "name": "B2", "value": 98
// }, {
// "name": "B3", "value": 56
// }]
// }, {
// "name": "Les actions \n inspirantes",
// "link": ["Les actions \n à booster"],
// "children": [{
// "name": "C1", "value": 335
// }, {
// "name": "C2", "value": 148
// }, {
// "name": "C3", "value": 126
// }, {
// "name": "C4", "value": 26
// }]
// }, {
// "name": "Les actions \n à booster",
// "link": ["Nos révoltes"],
// "children": [{
// "name": "D1", "value": 415
// }, {
// "name": "D2", "value": 148
// }, {
// "name": "D3", "value": 89
// }, {
// "name": "D4", "value": 64
// }, {
// "name": "D5", "value": 16
// }]
// }];

series.nodes.template.events.on("hit", function(event) {
console.log(event.target.dataItem.nb);
});

series.manyBodyStrength = -25;
series.links.template.strength = 2;
series.centerStrength = 1.2;

//active le zoom
chart.zoomable = true;
//Nombre de level affiché par défaut
series.maxLevels = 1

//link entre "frere"
// series.dataFields.id = "name";
// series.dataFields.linkWith = "link";

//distance entre les bulles
series.links.template.distance = 1.7;

// Set up data fields
series.dataFields.name = "name";
series.dataFields.children = "children";
series.dataFields.nb = "nb";

// Add labels
series.nodes.template.label.text = "{name}";
series.fontSize = 20;
series.minRadius = 70;
series.maxRadius = 100;

//Couleur des bulles
series.colors.list = [
am4core.color("#dc5b2f"),
am4core.color("#fce767"),
am4core.color("#97533a"),
am4core.color("#568b6f")
];

//Apparence des liens entre les bulles
series.links.template.strokeWidth = 5;
series.links.template.strokeOpacity = 1;

//tooltip
series.nodes.template.tooltipText = "{nb}";

+ 5
- 0
assets/app/frontend/scss/carto-int.scss Visa fil

@@ -9,5 +9,10 @@

.carto-bulles {
border: 2px solid $green;
min-height: 800px;

tspan {
font-family: dinbold;
}
}
}

+ 4
- 0
config/routes.yaml Visa fil

@@ -22,6 +22,10 @@ app_carto_interactive:
path: /cartographie-interactive
controller: App\Controller\Frontend\CartoController::cartoInteractive

app_carto_json:
path: /cartographie-json
controller: App\Controller\Frontend\CartoController::cartoJson

app_carto_liste:
path: /cartographie-list
controller: App\Controller\Frontend\CartoController::cartoListe

+ 859
- 25
package-lock.json
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 6
- 3
package.json Visa fil

@@ -2,13 +2,15 @@
"devDependencies": {
"@symfony/stimulus-bridge": "^2.0.0",
"@symfony/webpack-encore": "^1.4.0",
"bootstrap-daterangepicker": "^3.1.0",
"core-js": "^3.0.0",
"regenerator-runtime": "^0.13.2",
"sass": "^1.34.0",
"stimulus": "^2.0.0",
"webpack-notifier": "^1.6.0",
"select2-bootstrap4-theme": "^1.0.0",
"bootstrap-daterangepicker": "^3.1.0"
"stimulus": "^2.0.0",
"ts-loader": "^8.0.1",
"typescript": "^4.4.2",
"webpack-notifier": "^1.6.0"
},
"license": "UNLICENSED",
"private": true,
@@ -19,6 +21,7 @@
"build": "encore production --progress"
},
"dependencies": {
"@amcharts/amcharts4": "^4.10.22",
"admin-lte": "^3.1.0",
"bootstrap-autocomplete": "^2.3.7",
"jquery": "^3.6.0",

public/build/adminlte-plugins.52943ca2.js
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 11198
- 0
public/build/app-frontend.1fba758f.css
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 0
- 190
public/build/app-frontend.36f3c878.js
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 296
- 0
public/build/app-frontend.6a1e9044.js
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 0
- 11194
public/build/app-frontend.e9883437.css
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 14415
- 0
public/build/canvg.3c523da1.js
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 18
- 17
public/build/entrypoints.json Visa fil

@@ -2,21 +2,22 @@
"entrypoints": {
"adminlte-plugins": {
"js": [
"/build/runtime.3095b250.js",
"/build/runtime.2742d602.js",
"/build/vendors-node_modules_core-js_internals_export_js.2e873f33.js",
"/build/vendors-node_modules_core-js_modules_es_string_replace_js.06749256.js",
"/build/vendors-node_modules_core-js_internals_array-iteration_js-node_modules_jquery_src_jquery_js.a55f993d.js",
"/build/vendors-node_modules_core-js_modules_es_string_split_js-node_modules_popper_js_dist_esm_popper_js.22d0763b.js",
"/build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-5760c2.7a48c88c.js",
"/build/adminlte-plugins.724fdba0.js"
"/build/vendors-node_modules_core-js_modules_es_array_filter_js-node_modules_core-js_modules_es_array-f22e6e.ed1ad144.js",
"/build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-cd1e13.4b3e0d6f.js",
"/build/adminlte-plugins.52943ca2.js"
],
"css": [
"/build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-5760c2.fa890b12.css"
"/build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-cd1e13.fa890b12.css"
]
},
"adminlte-index": {
"js": [
"/build/runtime.3095b250.js",
"/build/runtime.2742d602.js",
"/build/vendors-node_modules_core-js_internals_export_js.2e873f33.js",
"/build/vendors-node_modules_core-js_modules_es_string_replace_js.06749256.js",
"/build/vendors-node_modules_core-js_modules_es_array_filter_js-node_modules_core-js_modules_es_array-2f9703.9d3214e1.js",
@@ -28,7 +29,7 @@
},
"adminlte-form": {
"js": [
"/build/runtime.3095b250.js",
"/build/runtime.2742d602.js",
"/build/vendors-node_modules_core-js_internals_export_js.2e873f33.js",
"/build/vendors-node_modules_core-js_modules_es_array_find_js-_7db01.8e56d6b5.js",
"/build/adminlte-form.52acb20e.js"
@@ -39,7 +40,7 @@
},
"adminlte-sort": {
"js": [
"/build/runtime.3095b250.js",
"/build/runtime.2742d602.js",
"/build/vendors-node_modules_core-js_internals_export_js.2e873f33.js",
"/build/vendors-node_modules_core-js_modules_es_string_replace_js.06749256.js",
"/build/vendors-node_modules_core-js_internals_array-iteration_js-node_modules_jquery_src_jquery_js.a55f993d.js",
@@ -52,7 +53,7 @@
},
"adminlte-field-filemanager": {
"js": [
"/build/runtime.3095b250.js",
"/build/runtime.2742d602.js",
"/build/vendors-node_modules_core-js_internals_export_js.2e873f33.js",
"/build/adminlte-field-filemanager.5b4b01b5.js"
],
@@ -62,7 +63,7 @@
},
"adminlte-field-collection": {
"js": [
"/build/runtime.3095b250.js",
"/build/runtime.2742d602.js",
"/build/vendors-node_modules_core-js_internals_export_js.2e873f33.js",
"/build/vendors-node_modules_core-js_modules_es_string_replace_js.06749256.js",
"/build/vendors-node_modules_core-js_internals_array-iteration_js-node_modules_jquery_src_jquery_js.a55f993d.js",
@@ -75,7 +76,7 @@
},
"adminlte-main": {
"js": [
"/build/runtime.3095b250.js",
"/build/runtime.2742d602.js",
"/build/vendors-node_modules_core-js_internals_export_js.2e873f33.js",
"/build/vendors-node_modules_core-js_modules_es_string_replace_js.06749256.js",
"/build/adminlte-main.b8c5ec34.js"
@@ -86,7 +87,7 @@
},
"sov-reminder": {
"js": [
"/build/runtime.3095b250.js",
"/build/runtime.2742d602.js",
"/build/sov-reminder.27580486.js"
],
"css": [
@@ -95,13 +96,13 @@
},
"sov-ticket": {
"js": [
"/build/runtime.3095b250.js",
"/build/runtime.2742d602.js",
"/build/sov-ticket.df76c7a0.js"
]
},
"app-backend": {
"js": [
"/build/runtime.3095b250.js",
"/build/runtime.2742d602.js",
"/build/vendors-node_modules_core-js_internals_export_js.2e873f33.js",
"/build/vendors-node_modules_core-js_modules_es_array_find_js-_7db00.020ca672.js",
"/build/app-backend.e87ef456.js"
@@ -112,16 +113,16 @@
},
"app-frontend": {
"js": [
"/build/runtime.3095b250.js",
"/build/runtime.2742d602.js",
"/build/vendors-node_modules_core-js_internals_export_js.2e873f33.js",
"/build/vendors-node_modules_core-js_modules_es_string_replace_js.06749256.js",
"/build/vendors-node_modules_core-js_internals_array-iteration_js-node_modules_jquery_src_jquery_js.a55f993d.js",
"/build/vendors-node_modules_core-js_modules_es_string_split_js-node_modules_popper_js_dist_esm_popper_js.22d0763b.js",
"/build/vendors-node_modules_bootstrap_dist_js_bootstrap_js-node_modules_core-js_modules_es_array_for-85fc9f.e742e2fb.js",
"/build/app-frontend.36f3c878.js"
"/build/vendors-node_modules_amcharts_amcharts4_charts_js-node_modules_amcharts_amcharts4_core_js-nod-329af8.85737a1c.js",
"/build/app-frontend.6a1e9044.js"
],
"css": [
"/build/app-frontend.e9883437.css"
"/build/app-frontend.1fba758f.css"
]
}
}

+ 12
- 7
public/build/manifest.json Visa fil

@@ -1,5 +1,5 @@
{
"build/adminlte-plugins.js": "/build/adminlte-plugins.724fdba0.js",
"build/adminlte-plugins.js": "/build/adminlte-plugins.52943ca2.js",
"build/adminlte-index.css": "/build/adminlte-index.e4548695.css",
"build/adminlte-index.js": "/build/adminlte-index.b12b9c93.js",
"build/adminlte-form.css": "/build/adminlte-form.59862983.css",
@@ -17,20 +17,25 @@
"build/sov-ticket.js": "/build/sov-ticket.df76c7a0.js",
"build/app-backend.css": "/build/app-backend.3d882954.css",
"build/app-backend.js": "/build/app-backend.e87ef456.js",
"build/app-frontend.css": "/build/app-frontend.e9883437.css",
"build/app-frontend.js": "/build/app-frontend.36f3c878.js",
"build/runtime.js": "/build/runtime.3095b250.js",
"build/app-frontend.css": "/build/app-frontend.1fba758f.css",
"build/app-frontend.js": "/build/app-frontend.6a1e9044.js",
"build/runtime.js": "/build/runtime.2742d602.js",
"build/pdfmake.js": "/build/pdfmake.fbf70324.js",
"build/canvg.js": "/build/canvg.3c523da1.js",
"build/xlsx.js": "/build/xlsx.05855660.js",
"build/vendors-node_modules_core-js_internals_export_js.2e873f33.js": "/build/vendors-node_modules_core-js_internals_export_js.2e873f33.js",
"build/vendors-node_modules_core-js_modules_es_string_replace_js.06749256.js": "/build/vendors-node_modules_core-js_modules_es_string_replace_js.06749256.js",
"build/vendors-node_modules_core-js_internals_array-iteration_js-node_modules_jquery_src_jquery_js.a55f993d.js": "/build/vendors-node_modules_core-js_internals_array-iteration_js-node_modules_jquery_src_jquery_js.a55f993d.js",
"build/vendors-node_modules_core-js_modules_es_array_find_js-node_modules_jquery-ui-dist_jquery-ui_js.2e367944.js": "/build/vendors-node_modules_core-js_modules_es_array_find_js-node_modules_jquery-ui-dist_jquery-ui_js.2e367944.js",
"build/vendors-node_modules_core-js_modules_es_string_split_js-node_modules_popper_js_dist_esm_popper_js.22d0763b.js": "/build/vendors-node_modules_core-js_modules_es_string_split_js-node_modules_popper_js_dist_esm_popper_js.22d0763b.js",
"build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-5760c2.fa890b12.css": "/build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-5760c2.fa890b12.css",
"build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-5760c2.7a48c88c.js": "/build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-5760c2.7a48c88c.js",
"build/vendors-node_modules_core-js_modules_es_array_filter_js-node_modules_core-js_modules_es_array-f22e6e.ed1ad144.js": "/build/vendors-node_modules_core-js_modules_es_array_filter_js-node_modules_core-js_modules_es_array-f22e6e.ed1ad144.js",
"build/vendors-node_modules_amcharts_amcharts4_charts_js-node_modules_amcharts_amcharts4_core_js-nod-329af8.85737a1c.js": "/build/vendors-node_modules_amcharts_amcharts4_charts_js-node_modules_amcharts_amcharts4_core_js-nod-329af8.85737a1c.js",
"build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-cd1e13.fa890b12.css": "/build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-cd1e13.fa890b12.css",
"build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-cd1e13.4b3e0d6f.js": "/build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-cd1e13.4b3e0d6f.js",
"build/vendors-node_modules_core-js_modules_es_array_filter_js-node_modules_core-js_modules_es_array-2f9703.9d3214e1.js": "/build/vendors-node_modules_core-js_modules_es_array_filter_js-node_modules_core-js_modules_es_array-2f9703.9d3214e1.js",
"build/vendors-node_modules_core-js_modules_es_array_find_js-_7db00.020ca672.js": "/build/vendors-node_modules_core-js_modules_es_array_find_js-_7db00.020ca672.js",
"build/vendors-node_modules_core-js_modules_es_array_find_js-_7db01.8e56d6b5.js": "/build/vendors-node_modules_core-js_modules_es_array_find_js-_7db01.8e56d6b5.js",
"build/vendors-node_modules_bootstrap_dist_js_bootstrap_js-node_modules_core-js_modules_es_array_for-85fc9f.e742e2fb.js": "/build/vendors-node_modules_bootstrap_dist_js_bootstrap_js-node_modules_core-js_modules_es_array_for-85fc9f.e742e2fb.js",
"build/vendors-node_modules_xlsx_xlsx_js.f1747964.js": "/build/vendors-node_modules_xlsx_xlsx_js.f1747964.js",
"build/images/fa-solid-900.svg": "/build/images/fa-solid-900.13de59f1.svg",
"build/images/fa-brands-400.svg": "/build/images/fa-brands-400.216edb96.svg",
"build/fonts/fa-solid-900.eot": "/build/fonts/fa-solid-900.efbd5d20.eot",

+ 78236
- 0
public/build/pdfmake.fbf70324.js
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 346
- 0
public/build/runtime.2742d602.js
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 0
- 197
public/build/runtime.3095b250.js
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


public/build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-cd1e13.4b3e0d6f.js
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


public/build/vendors-node_modules_admin-lte_dist_js_adminlte_min_js-node_modules_bootstrap-autocomplete_di-cd1e13.fa890b12.css
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 111676
- 0
public/build/vendors-node_modules_amcharts_amcharts4_charts_js-node_modules_amcharts_amcharts4_core_js-nod-329af8.85737a1c.js
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 0
- 4580
public/build/vendors-node_modules_bootstrap_dist_js_bootstrap_js-node_modules_core-js_modules_es_array_for-85fc9f.e742e2fb.js
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 551
- 0
public/build/vendors-node_modules_core-js_modules_es_array_filter_js-node_modules_core-js_modules_es_array-f22e6e.ed1ad144.js
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 32438
- 0
public/build/vendors-node_modules_xlsx_xlsx_js.f1747964.js
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 34
- 0
public/build/xlsx.05855660.js Visa fil

@@ -0,0 +1,34 @@
(self["webpackChunk"] = self["webpackChunk"] || []).push([["xlsx"],{

/***/ "?e708":
/*!************************!*\
!*** crypto (ignored) ***!
\************************/
/***/ (() => {

/* (ignored) */

/***/ }),

/***/ "?58fb":
/*!********************!*\
!*** fs (ignored) ***!
\********************/
/***/ (() => {

/* (ignored) */

/***/ }),

/***/ "?20df":
/*!************************!*\
!*** stream (ignored) ***!
\************************/
/***/ (() => {

/* (ignored) */

/***/ })

}]);
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vaWdub3JlZHwvdmFyL3d3dy9BY3Rlc0NpdG95ZW5zL25vZGVfbW9kdWxlcy94bHN4fGNyeXB0byIsIndlYnBhY2s6Ly8vaWdub3JlZHwvdmFyL3d3dy9BY3Rlc0NpdG95ZW5zL25vZGVfbW9kdWxlcy94bHN4fGZzIiwid2VicGFjazovLy9pZ25vcmVkfC92YXIvd3d3L0FjdGVzQ2l0b3llbnMvbm9kZV9tb2R1bGVzL3hsc3h8c3RyZWFtIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O0FBQUEsZTs7Ozs7Ozs7OztBQ0FBLGU7Ozs7Ozs7Ozs7QUNBQSxlIiwiZmlsZSI6Inhsc3guMDU4NTU2NjAuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvKiAoaWdub3JlZCkgKi8iLCIvKiAoaWdub3JlZCkgKi8iLCIvKiAoaWdub3JlZCkgKi8iXSwic291cmNlUm9vdCI6IiJ9

+ 56
- 0
src/Controller/Frontend/CartoController.php Visa fil

@@ -9,6 +9,7 @@ use App\Repository\ProjectBoostStore;
use App\Repository\ProjectInspiringStore;
use App\Repository\RevoltStore;
use App\Repository\TerritoryStore;
use App\Repository\ThematicStore;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\EntityManagerInterface;
use Dompdf\Dompdf;
@@ -16,6 +17,7 @@ use Dompdf\Options;
use Knp\Component\Pager\PaginatorInterface;
use Lc\SovBundle\Generator\CsvGenerator;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Twig\Environment;
use ReflectionClass;
@@ -28,6 +30,7 @@ class CartoController extends DefaultController
protected ProjectBoostStore $projectBoostStore;
protected ProjectInspiringStore $projectInspiringStore;
protected TerritoryStore $territoryStore;
protected ThematicStore $thematicStore;
protected PaginatorInterface $paginator;
protected Environment $templating;
protected ParameterBagInterface $parameterBag;
@@ -39,6 +42,7 @@ class CartoController extends DefaultController
ProjectBoostStore $projectBoostStore,
ProjectInspiringStore $projectInspiringStore,
TerritoryStore $territoryStore,
ThematicStore $thematicStore,
PaginatorInterface $paginator,
Environment $templating,
ParameterBagInterface $parameterBag
@@ -49,6 +53,7 @@ class CartoController extends DefaultController
$this->projectBoostStore = $projectBoostStore;
$this->projectInspiringStore = $projectInspiringStore;
$this->territoryStore = $territoryStore;
$this->thematicStore = $thematicStore;
$this->paginator = $paginator;
$this->templating = $templating;
$this->parameterBag = $parameterBag;
@@ -101,6 +106,57 @@ class CartoController extends DefaultController
);
}

public function cartoJson(Request $request)
{
$thematicArray = $this->thematicStore->get();
$data = array();
$key = 0;

foreach ($thematicArray as $thematic) {
$revoltArray = $this->revoltStore->getByThematic($thematic);
$dreamArray = $this->dreamStore->getByThematic($thematic);
$projectBoostArray = $this->projectBoostStore->getByThematic($thematic);
$projectInspArray = $this->projectInspiringStore->getByThematic($thematic);

$contribArray = array_merge($revoltArray, $dreamArray, $projectBoostArray, $projectInspArray);

foreach ($contribArray as $contrib) {
$keyAlreadyHere = array_search($contrib->__toString(), array_column($data, 'name'));
// si "Nos révoltes" ou "Nos Reves" etc, n'existe pas encore on le créer
if ($keyAlreadyHere === false) {
$data[$key] = [
'name' => $contrib->__toString(),
'children' => []
];
// on insere le premier thème de la contribution
$data[$key]['children'][] = [
'name' => $contrib->getThematic()->getName(),
'nb' => 1,
];
$key++;
} else {
$keyTheme = array_search(
$contrib->getThematic()->getName(),
array_column($data[$keyAlreadyHere]['children'], 'name')
);
// si le thème de la contribution n'existe pas encore on le créer
if ($keyTheme === false) {
$data[$keyAlreadyHere]['children'][] = [
'name' => $contrib->getThematic()->getName(),
'nb' => 1,
];
} else {
$data[$keyAlreadyHere]['children'][$keyTheme]['nb']++;
}
}
}
}
// dump($data);
// die;

return new JsonResponse($data);
}

private function generateResultArray($data): array
{
$dreamArray = $revoltArray = $projectBoostArray = $projectInspiringArray = array();

+ 9
- 0
src/Repository/SearchStore.php Visa fil

@@ -3,6 +3,7 @@
namespace App\Repository;


use App\Entity\Thematic;
use Doctrine\Common\Collections\ArrayCollection;
use Lc\SovBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
@@ -54,4 +55,12 @@ class SearchStore extends AbstractStore implements StoreInterface
return $query->find();
}

public function getByThematic(Thematic $thematic, $query = null)
{
$query = $this->createDefaultQuery($query);
$query->filterByThematic(new ArrayCollection([$thematic]));

return $query->find();
}

}

+ 15
- 0
src/Repository/ThematicRepositoryQuery.php Visa fil

@@ -0,0 +1,15 @@
<?php

namespace App\Repository;

use Knp\Component\Pager\PaginatorInterface;
use Lc\SovBundle\Repository\AbstractRepositoryQuery;
use Lc\SovBundle\Repository\RepositoryQueryInterface;

class ThematicRepositoryQuery extends AbstractRepositoryQuery implements RepositoryQueryInterface
{
public function __construct(ThematicRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'r', $paginator);
}
}

+ 34
- 0
src/Repository/ThematicStore.php Visa fil

@@ -0,0 +1,34 @@
<?php

namespace App\Repository;


use Lc\SovBundle\Repository\AbstractStore;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Lc\SovBundle\Repository\StoreInterface;

class ThematicStore extends AbstractStore implements StoreInterface
{

public function __construct(ThematicRepositoryQuery $query)
{
$this->query = $query;
}

public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
$query->orderBy('id');
return $query;
}

public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
return $query;
}

public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
return $query;
}

}

+ 9
- 1
templates/frontend/carto-int.html.twig Visa fil

@@ -5,7 +5,15 @@
<h1 class="title-interactive">La cartographie interactive Nord Franche-Comté</h1>

<div class="carto-bulles">
Bubulle!
</div>
</div>
{% endblock %}

{% block javascripts %}
<script>
var routes = {
app_carto_json: '{{ absolute_url(path('app_carto_json')) }}'
};
</script>
{% endblock %}

+ 1
- 1
webpack.config.js Visa fil

@@ -98,7 +98,7 @@ Encore
//.enableSassLoader()

// uncomment if you use TypeScript
//.enableTypeScriptLoader()
// .enableTypeScriptLoader()

// uncomment if you use React
//.enableReactPreset()

+ 790
- 16
yarn.lock
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


Laddar…
Avbryt
Spara