manageFormContact(); | manageFormContact(); | ||||
manageFormSearch(); | manageFormSearch(); | ||||
manageFormIndiv(); | manageFormIndiv(); | ||||
initialisePopovers(); | |||||
}); | }); | ||||
function initialisePopovers() { | |||||
$('[data-toggle="popover"]').popover({ | |||||
html: true, | |||||
container: '.map', | |||||
placement: 'top', | |||||
}); | |||||
} | |||||
function manageFormIndiv() { | function manageFormIndiv() { | ||||
document | document | ||||
.querySelectorAll('.add_item_link') | .querySelectorAll('.add_item_link') |
padding: 10px 10px 40px; | padding: 10px 10px 40px; | ||||
position: relative; | position: relative; | ||||
.popover { | |||||
border: 2px solid $green; | |||||
border-radius: 0; | |||||
.popover-body { | |||||
color: $green; | |||||
font-family: dinbold; | |||||
padding: 0; | |||||
span { | |||||
padding: 10px 0 10px 50px; | |||||
display: inline-block; | |||||
} | |||||
a { | |||||
font-family: dinbold; | |||||
background-image: url($dir-img + 'Picto-Loupe.png'); | |||||
background-repeat: no-repeat; | |||||
background-size: 20px; | |||||
background-position: 15px center; | |||||
color: $green; | |||||
display: inline-block; | |||||
width: 100%; | |||||
background-color: $yellow; | |||||
padding: 5px 0 5px 50px; | |||||
} | |||||
} | |||||
.arrow { | |||||
&:after { | |||||
border-top-color: $green; | |||||
} | |||||
&:before { | |||||
border-top-color: $green; | |||||
} | |||||
} | |||||
} | |||||
.img-map { | .img-map { | ||||
display: none; | |||||
img { | img { | ||||
width: 75px; | width: 75px; | ||||
&:hover { | |||||
cursor: pointer; | |||||
} | |||||
} | } | ||||
} | } | ||||
.img-vosges { | .img-vosges { | ||||
display: block; | |||||
position: absolute; | position: absolute; | ||||
top: 257px; | top: 257px; | ||||
left: 387px; | left: 387px; | ||||
} | } | ||||
.img-belfort { | .img-belfort { | ||||
display: block; | |||||
position: absolute; | position: absolute; | ||||
top: 493px; | top: 493px; | ||||
left: 491px; | left: 491px; | ||||
} | } | ||||
.img-hericourt { | .img-hericourt { | ||||
display: block; | |||||
position: absolute; | position: absolute; | ||||
top: 639px; | top: 639px; | ||||
left: 217px; | left: 217px; | ||||
} | } | ||||
.img-montbeliard { | .img-montbeliard { | ||||
display: block; | |||||
position: absolute; | position: absolute; | ||||
top: 1003px; | top: 1003px; | ||||
left: 319px; | left: 319px; | ||||
width: 160px; | width: 160px; | ||||
} | } | ||||
.img-sud { | |||||
.img-sud_territoire { | |||||
display: block; | |||||
position: absolute; | position: absolute; | ||||
top: 798px; | top: 798px; | ||||
left: 746px; | left: 746px; |
"/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_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_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/app-frontend.9cc512c2.js" | |||||
"/build/app-frontend.36f3c878.js" | |||||
], | ], | ||||
"css": [ | "css": [ | ||||
"/build/app-frontend.94f1a107.css" | |||||
"/build/app-frontend.e9883437.css" | |||||
] | ] | ||||
} | } | ||||
} | } |
"build/sov-ticket.js": "/build/sov-ticket.df76c7a0.js", | "build/sov-ticket.js": "/build/sov-ticket.df76c7a0.js", | ||||
"build/app-backend.css": "/build/app-backend.3d882954.css", | "build/app-backend.css": "/build/app-backend.3d882954.css", | ||||
"build/app-backend.js": "/build/app-backend.e87ef456.js", | "build/app-backend.js": "/build/app-backend.e87ef456.js", | ||||
"build/app-frontend.css": "/build/app-frontend.94f1a107.css", | |||||
"build/app-frontend.js": "/build/app-frontend.9cc512c2.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/runtime.js": "/build/runtime.3095b250.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_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_modules_es_string_replace_js.06749256.js": "/build/vendors-node_modules_core-js_modules_es_string_replace_js.06749256.js", | ||||
"build/fonts/fa-regular-400.woff": "/build/fonts/fa-regular-400.36722648.woff", | "build/fonts/fa-regular-400.woff": "/build/fonts/fa-regular-400.36722648.woff", | ||||
"build/fonts/din_regular-webfont.woff2": "/build/fonts/din_regular-webfont.b4ef15d4.woff2", | "build/fonts/din_regular-webfont.woff2": "/build/fonts/din_regular-webfont.b4ef15d4.woff2", | ||||
"build/fonts/fa-regular-400.woff2": "/build/fonts/fa-regular-400.68c5af1f.woff2", | "build/fonts/fa-regular-400.woff2": "/build/fonts/fa-regular-400.68c5af1f.woff2", | ||||
"build/images/Picto-Loupe.png": "/build/images/Picto-Loupe.516b7cc4.png", | |||||
"build/images/Picto-Envoyer.png": "/build/images/Picto-Envoyer.7553602c.png" | "build/images/Picto-Envoyer.png": "/build/images/Picto-Envoyer.7553602c.png" | ||||
} | } |
namespace App\Controller\Frontend; | namespace App\Controller\Frontend; | ||||
use App\Entity\AbstractData; | |||||
use App\Form\SearchListForm; | use App\Form\SearchListForm; | ||||
use App\Repository\DreamStore; | use App\Repository\DreamStore; | ||||
use App\Repository\ProjectBoostStore; | use App\Repository\ProjectBoostStore; | ||||
use App\Repository\ProjectInspiringStore; | use App\Repository\ProjectInspiringStore; | ||||
use App\Repository\RevoltStore; | use App\Repository\RevoltStore; | ||||
use App\Repository\TerritoryStore; | |||||
use Doctrine\Common\Collections\ArrayCollection; | |||||
use Doctrine\ORM\EntityManagerInterface; | use Doctrine\ORM\EntityManagerInterface; | ||||
use Dompdf\Dompdf; | use Dompdf\Dompdf; | ||||
use Dompdf\Options; | use Dompdf\Options; | ||||
use Lc\SovBundle\Generator\CsvGenerator; | use Lc\SovBundle\Generator\CsvGenerator; | ||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; | use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; | ||||
use Symfony\Component\HttpFoundation\Request; | use Symfony\Component\HttpFoundation\Request; | ||||
use Symfony\Component\HttpFoundation\Response; | |||||
use Twig\Environment; | use Twig\Environment; | ||||
use ReflectionClass; | |||||
class CartoController extends DefaultController | class CartoController extends DefaultController | ||||
{ | { | ||||
protected RevoltStore $revoltStore; | protected RevoltStore $revoltStore; | ||||
protected ProjectBoostStore $projectBoostStore; | protected ProjectBoostStore $projectBoostStore; | ||||
protected ProjectInspiringStore $projectInspiringStore; | protected ProjectInspiringStore $projectInspiringStore; | ||||
protected TerritoryStore $territoryStore; | |||||
protected PaginatorInterface $paginator; | protected PaginatorInterface $paginator; | ||||
protected Environment $templating; | protected Environment $templating; | ||||
protected ParameterBagInterface $parameterBag; | protected ParameterBagInterface $parameterBag; | ||||
RevoltStore $revoltStore, | RevoltStore $revoltStore, | ||||
ProjectBoostStore $projectBoostStore, | ProjectBoostStore $projectBoostStore, | ||||
ProjectInspiringStore $projectInspiringStore, | ProjectInspiringStore $projectInspiringStore, | ||||
TerritoryStore $territoryStore, | |||||
PaginatorInterface $paginator, | PaginatorInterface $paginator, | ||||
Environment $templating, | Environment $templating, | ||||
ParameterBagInterface $parameterBag | ParameterBagInterface $parameterBag | ||||
$this->revoltStore = $revoltStore; | $this->revoltStore = $revoltStore; | ||||
$this->projectBoostStore = $projectBoostStore; | $this->projectBoostStore = $projectBoostStore; | ||||
$this->projectInspiringStore = $projectInspiringStore; | $this->projectInspiringStore = $projectInspiringStore; | ||||
$this->territoryStore = $territoryStore; | |||||
$this->paginator = $paginator; | $this->paginator = $paginator; | ||||
$this->templating = $templating; | $this->templating = $templating; | ||||
$this->parameterBag = $parameterBag; | $this->parameterBag = $parameterBag; | ||||
public function cartoListe(Request $request) | public function cartoListe(Request $request) | ||||
{ | { | ||||
$resultArrayPagination = array(); | $resultArrayPagination = array(); | ||||
$form = $this->createForm(SearchListForm::class, null, [ | |||||
'method' => 'GET', | |||||
]); | |||||
$form = $this->createForm(SearchListForm::class); | |||||
$form->handleRequest($request); | $form->handleRequest($request); | ||||
if ($form->isSubmitted() && $form->isValid()) { | if ($form->isSubmitted() && $form->isValid()) { | ||||
$data = $form->getData(); | $data = $form->getData(); | ||||
$resultArray = $this->generateResultArray($data); | $resultArray = $this->generateResultArray($data); | ||||
if ($form->get('search_button')->isClicked()) { | |||||
if ($form->get('export_excel')->isClicked()) { | |||||
return $this->exportCsv($resultArray); | |||||
} elseif ($form->get('export_pdf')->isClicked()) { | |||||
return $this->exportPdf($resultArray); | |||||
} else { | |||||
$page = $data['page']; | $page = $data['page']; | ||||
$resultArrayPagination = $this->paginator->paginate( | $resultArrayPagination = $this->paginator->paginate( | ||||
$page, | $page, | ||||
10 | 10 | ||||
); | ); | ||||
} elseif ($form->get('export_excel')->isClicked()) { | |||||
return $this->exportCsv($resultArray); | |||||
} elseif ($form->get('export_pdf')->isClicked()) { | |||||
return $this->exportPdf($resultArray); | |||||
} | } | ||||
} | } | ||||
$territoryArray = $data['territory']; | $territoryArray = $data['territory']; | ||||
$thematicArray = $data['thematic']; | $thematicArray = $data['thematic']; | ||||
if (in_array('dream', $categoryArray) || empty($categoryArray)) { | |||||
if (in_array(AbstractData::CATEGORY_DREAM, $categoryArray) || empty($categoryArray)) { | |||||
$dreamArray = $this->dreamStore->filterSearch($subthematic, $territoryArray, $thematicArray); | $dreamArray = $this->dreamStore->filterSearch($subthematic, $territoryArray, $thematicArray); | ||||
} | } | ||||
if (in_array('revolt', $categoryArray) || empty($categoryArray)) { | |||||
if (in_array(AbstractData::CATEGORY_REVOLT, $categoryArray) || empty($categoryArray)) { | |||||
$revoltArray = $this->revoltStore->filterSearch($subthematic, $territoryArray, $thematicArray); | $revoltArray = $this->revoltStore->filterSearch($subthematic, $territoryArray, $thematicArray); | ||||
} | } | ||||
if (in_array('projectBoost', $categoryArray) || empty($categoryArray)) { | |||||
if (in_array(AbstractData::CATEGORY_PROJECTBOOST, $categoryArray) || empty($categoryArray)) { | |||||
$projectBoostArray = $this->projectBoostStore->filterSearch( | $projectBoostArray = $this->projectBoostStore->filterSearch( | ||||
$subthematic, | $subthematic, | ||||
$territoryArray, | $territoryArray, | ||||
$thematicArray | $thematicArray | ||||
); | ); | ||||
} | } | ||||
if (in_array('projectInspiring', $categoryArray) || empty($categoryArray)) { | |||||
if (in_array(AbstractData::CATEGORY_PROJECTINSPIRING, $categoryArray) || empty($categoryArray)) { | |||||
$projectInspiringArray = $this->projectInspiringStore->filterSearch( | $projectInspiringArray = $this->projectInspiringStore->filterSearch( | ||||
$subthematic, | $subthematic, | ||||
$territoryArray, | $territoryArray, | ||||
public function cartoCarte() | public function cartoCarte() | ||||
{ | { | ||||
$resultArray = $this->generateAllResultArray(); | |||||
$resultSortArray = array(); | |||||
$territoryArray = $this->territoryStore->get(); | |||||
foreach ($territoryArray as $territory) { | |||||
$resultSortArray[$territory->getDevAlias()] = | |||||
[ | |||||
AbstractData::TERRITORY => "", | |||||
AbstractData::CATEGORY_REVOLT => "0", | |||||
AbstractData::CATEGORY_DREAM => "0", | |||||
AbstractData::CATEGORY_PROJECTBOOST => "0", | |||||
AbstractData::CATEGORY_PROJECTINSPIRING => "0", | |||||
]; | |||||
} | |||||
foreach ($resultArray as $result) { | |||||
$className = (new ReflectionClass($result))->getShortName(); | |||||
if ($result->getIndividualData()) { | |||||
$devAliasTerritory = $result->getIndividualData()->getTerritory()->getDevAlias(); | |||||
$idTerritory = $result->getIndividualData()->getTerritory()->getId(); | |||||
} elseif ($result->getCollectifData()->getTerritory()) { | |||||
$devAliasTerritory = $result->getCollectifData()->getTerritory()->getDevAlias(); | |||||
$idTerritory = $result->getCollectifData()->getTerritory()->getId(); | |||||
} | |||||
if (empty($resultSortArray[$devAliasTerritory][AbstractData::TERRITORY])) { | |||||
$resultSortArray[$devAliasTerritory][AbstractData::TERRITORY] = $idTerritory; | |||||
} | |||||
$resultSortArray[$devAliasTerritory][$className] = $resultSortArray[$devAliasTerritory][$className] + 1; | |||||
} | |||||
return $this->render( | return $this->render( | ||||
'frontend/carto-carte.html.twig', | 'frontend/carto-carte.html.twig', | ||||
[ | [ | ||||
'resultSortArray' => $resultSortArray, | |||||
'nbContrib' => $this->countContrib() | 'nbContrib' => $this->countContrib() | ||||
] | ] | ||||
); | ); | ||||
) | ) | ||||
]); | ]); | ||||
// return new Response($html); | |||||
// Load HTML to Dompdf | // Load HTML to Dompdf | ||||
$dompdf->loadHtml($html); | $dompdf->loadHtml($html); | ||||
<?php | |||||
namespace App\Entity; | |||||
use App\Entity\User\User; | |||||
use App\Repository\AbstractDataRepository; | |||||
use Doctrine\Common\Collections\ArrayCollection; | |||||
use Doctrine\Common\Collections\Collection; | |||||
use Doctrine\ORM\Mapping as ORM; | |||||
use Lc\SovBundle\Doctrine\EntityInterface; | |||||
use Lc\SovBundle\Doctrine\Extension\StatusInterface; | |||||
use Lc\SovBundle\Doctrine\Extension\StatusTrait; | |||||
/** | |||||
* @ORM\MappedSuperclass() | |||||
*/ | |||||
abstract class AbstractData implements StatusInterface, EntityInterface | |||||
{ | |||||
use StatusTrait; | |||||
const TERRITORY = "Territory"; | |||||
const CATEGORY_REVOLT = "Revolt"; | |||||
const CATEGORY_DREAM = "Dream"; | |||||
const CATEGORY_PROJECTBOOST = "ProjectBoost"; | |||||
const CATEGORY_PROJECTINSPIRING = "ProjectInspiring"; | |||||
const CATEGORY_LABEL_REVOLT = "Nos révoltes"; | |||||
const CATEGORY_LABEL_DREAM = "Nos rêves"; | |||||
const CATEGORY_LABEL_PROJECTBOOST = "Les actions à booster"; | |||||
const CATEGORY_LABEL_PROJECTINSPIRING = "Les actions inspirantes"; | |||||
static function getCategory(): array | |||||
{ | |||||
return [ | |||||
self::CATEGORY_LABEL_REVOLT => self::CATEGORY_REVOLT, | |||||
self::CATEGORY_LABEL_DREAM => self::CATEGORY_DREAM, | |||||
self::CATEGORY_LABEL_PROJECTBOOST => self::CATEGORY_PROJECTBOOST, | |||||
self::CATEGORY_LABEL_PROJECTINSPIRING => self::CATEGORY_PROJECTINSPIRING, | |||||
]; | |||||
} | |||||
/** | |||||
* @ORM\OneToMany(targetEntity=Revolt::class, mappedBy="collectifData", cascade={"persist", "remove"}) | |||||
*/ | |||||
protected $revolt; | |||||
/** | |||||
* @ORM\OneToMany(targetEntity=Dream::class, mappedBy="collectifData", cascade={"persist", "remove"}) | |||||
*/ | |||||
protected $dream; | |||||
/** | |||||
* @ORM\OneToMany(targetEntity=ProjectBoost::class, mappedBy="collectifData", cascade={"persist", "remove"}) | |||||
*/ | |||||
protected $projectBoost; | |||||
/** | |||||
* @ORM\OneToMany(targetEntity=ProjectInspiring::class, mappedBy="collectifData", cascade={"persist", "remove"}) | |||||
*/ | |||||
protected $projectInspiring; | |||||
/** | |||||
* @ORM\ManyToOne(targetEntity=Territory::class, inversedBy="collectifData") | |||||
*/ | |||||
protected $territory; | |||||
public function __construct() | |||||
{ | |||||
$this->revolt = new ArrayCollection(); | |||||
$this->dream = new ArrayCollection(); | |||||
$this->projectBoost = new ArrayCollection(); | |||||
$this->projectInspiring = new ArrayCollection(); | |||||
} | |||||
public function getResume() | |||||
{ | |||||
return count($this->getRevolt()) . " révolte(s) - " . count($this->getDream()) . " rêve(s) - " . count( | |||||
$this->getProjectBoost() | |||||
) . " projet(s) boosté(s) - " . count($this->getProjectInspiring()) . " projets inspirants"; | |||||
} | |||||
public function getNbDream(): string | |||||
{ | |||||
return count($this->getDream()); | |||||
} | |||||
public function getNbRevolt(): string | |||||
{ | |||||
return count($this->getRevolt()); | |||||
} | |||||
public function getNbProjectBoost(): string | |||||
{ | |||||
return count($this->getProjectBoost()); | |||||
} | |||||
public function getNbProjectInspiring(): string | |||||
{ | |||||
return count($this->getProjectInspiring()); | |||||
} | |||||
/** | |||||
* @return Collection|Revolt[] | |||||
*/ | |||||
public function getRevolt(): Collection | |||||
{ | |||||
return $this->revolt; | |||||
} | |||||
public function addRevolt(Revolt $revolt): self | |||||
{ | |||||
if (!$this->revolt->contains($revolt)) { | |||||
$this->revolt[] = $revolt; | |||||
$revolt->setCollectifData($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removeRevolt(Revolt $revolt): self | |||||
{ | |||||
if ($this->revolt->removeElement($revolt)) { | |||||
// set the owning side to null (unless already changed) | |||||
if ($revolt->getCollectifData() === $this) { | |||||
$revolt->setCollectifData(null); | |||||
} | |||||
} | |||||
return $this; | |||||
} | |||||
/** | |||||
* @return Collection|Dream[] | |||||
*/ | |||||
public function getDream(): Collection | |||||
{ | |||||
return $this->dream; | |||||
} | |||||
public function addDream(Dream $dream): self | |||||
{ | |||||
if (!$this->dream->contains($dream)) { | |||||
$this->dream[] = $dream; | |||||
$dream->setCollectifData($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removeDream(Dream $dream): self | |||||
{ | |||||
if ($this->dream->removeElement($dream)) { | |||||
// set the owning side to null (unless already changed) | |||||
if ($dream->getCollectifData() === $this) { | |||||
$dream->setCollectifData(null); | |||||
} | |||||
} | |||||
return $this; | |||||
} | |||||
/** | |||||
* @return Collection|ProjectBoost[] | |||||
*/ | |||||
public function getProjectBoost(): Collection | |||||
{ | |||||
return $this->projectBoost; | |||||
} | |||||
public function addProjectBoost(ProjectBoost $projectBoost): self | |||||
{ | |||||
if (!$this->projectBoost->contains($projectBoost)) { | |||||
$this->projectBoost[] = $projectBoost; | |||||
$projectBoost->setCollectifData($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removeProjectBoost(ProjectBoost $projectBoost): self | |||||
{ | |||||
if ($this->projectBoost->removeElement($projectBoost)) { | |||||
// set the owning side to null (unless already changed) | |||||
if ($projectBoost->getCollectifData() === $this) { | |||||
$projectBoost->setCollectifData(null); | |||||
} | |||||
} | |||||
return $this; | |||||
} | |||||
/** | |||||
* @return Collection|ProjectInspiring[] | |||||
*/ | |||||
public function getProjectInspiring(): Collection | |||||
{ | |||||
return $this->projectInspiring; | |||||
} | |||||
public function addProjectInspiring(ProjectInspiring $projectInspiring): self | |||||
{ | |||||
if (!$this->projectInspiring->contains($projectInspiring)) { | |||||
$this->projectInspiring[] = $projectInspiring; | |||||
$projectInspiring->setCollectifData($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removeProjectInspiring(ProjectInspiring $projectInspiring): self | |||||
{ | |||||
if ($this->projectInspiring->removeElement($projectInspiring)) { | |||||
// set the owning side to null (unless already changed) | |||||
if ($projectInspiring->getCollectifData() === $this) { | |||||
$projectInspiring->setCollectifData(null); | |||||
} | |||||
} | |||||
return $this; | |||||
} | |||||
public function getTerritory(): ?Territory | |||||
{ | |||||
return $this->territory; | |||||
} | |||||
public function setTerritory(?Territory $territory): self | |||||
{ | |||||
$this->territory = $territory; | |||||
return $this; | |||||
} | |||||
} |
/** | /** | ||||
* @ORM\Entity(repositoryClass=CollectifDataRepository::class) | * @ORM\Entity(repositoryClass=CollectifDataRepository::class) | ||||
*/ | */ | ||||
class CollectifData implements StatusInterface, EntityInterface | |||||
class CollectifData extends AbstractData | |||||
{ | { | ||||
use StatusTrait; | |||||
/** | /** | ||||
* @ORM\Id | * @ORM\Id | ||||
* @ORM\GeneratedValue | * @ORM\GeneratedValue | ||||
*/ | */ | ||||
private $id; | private $id; | ||||
/** | |||||
* @ORM\Column(type="integer") | |||||
*/ | |||||
private $nbParticipant; | |||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="collectifData") | * @ORM\ManyToOne(targetEntity=User::class, inversedBy="collectifData") | ||||
*/ | */ | ||||
private $user; | private $user; | ||||
/** | /** | ||||
* @ORM\OneToMany(targetEntity=Revolt::class, mappedBy="collectifData", cascade={"persist", "remove"}) | |||||
*/ | |||||
private $revolt; | |||||
/** | |||||
* @ORM\OneToMany(targetEntity=Dream::class, mappedBy="collectifData", cascade={"persist", "remove"}) | |||||
*/ | |||||
private $dream; | |||||
/** | |||||
* @ORM\OneToMany(targetEntity=ProjectBoost::class, mappedBy="collectifData", cascade={"persist", "remove"}) | |||||
*/ | |||||
private $projectBoost; | |||||
/** | |||||
* @ORM\OneToMany(targetEntity=ProjectInspiring::class, mappedBy="collectifData", cascade={"persist", "remove"}) | |||||
*/ | |||||
private $projectInspiring; | |||||
/** | |||||
* @ORM\ManyToOne(targetEntity=Territory::class, inversedBy="collectifData") | |||||
* @ORM\Column(type="integer") | |||||
*/ | */ | ||||
private $territory; | |||||
public function __construct() | |||||
{ | |||||
$this->revolt = new ArrayCollection(); | |||||
$this->dream = new ArrayCollection(); | |||||
$this->projectBoost = new ArrayCollection(); | |||||
$this->projectInspiring = new ArrayCollection(); | |||||
} | |||||
private $nbParticipant; | |||||
public function __toString() | public function __toString() | ||||
{ | { | ||||
return $this->nbParticipant . " participants"; | return $this->nbParticipant . " participants"; | ||||
} | } | ||||
public function getResume() | |||||
{ | |||||
return count($this->getRevolt()) . " révolte(s) - " . count($this->getDream()) . " rêve(s) - " . count($this->getProjectBoost()) . " projet(s) boosté(s) - " . count($this->getProjectInspiring()) . " projets inspirants"; | |||||
} | |||||
public function getNbDream():string | |||||
{ | |||||
return count($this->getDream()); | |||||
} | |||||
public function getNbRevolt():string | |||||
{ | |||||
return count($this->getRevolt()); | |||||
} | |||||
public function getNbProjectBoost():string | |||||
{ | |||||
return count($this->getProjectBoost()); | |||||
} | |||||
public function getNbProjectInspiring():string | |||||
{ | |||||
return count($this->getProjectInspiring()); | |||||
} | |||||
public function getId(): ?int | public function getId(): ?int | ||||
{ | { | ||||
return $this->id; | return $this->id; | ||||
} | } | ||||
public function getNbParticipant(): ?int | |||||
{ | |||||
return $this->nbParticipant; | |||||
} | |||||
public function setNbParticipant(int $nbParticipant): self | |||||
{ | |||||
$this->nbParticipant = $nbParticipant; | |||||
return $this; | |||||
} | |||||
public function getUser(): ?User | public function getUser(): ?User | ||||
{ | { | ||||
return $this->user; | return $this->user; | ||||
return $this; | return $this; | ||||
} | } | ||||
/** | |||||
* @return Collection|Revolt[] | |||||
*/ | |||||
public function getRevolt(): Collection | |||||
{ | |||||
return $this->revolt; | |||||
} | |||||
public function addRevolt(Revolt $revolt): self | |||||
{ | |||||
if (!$this->revolt->contains($revolt)) { | |||||
$this->revolt[] = $revolt; | |||||
$revolt->setCollectifData($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removeRevolt(Revolt $revolt): self | |||||
{ | |||||
if ($this->revolt->removeElement($revolt)) { | |||||
// set the owning side to null (unless already changed) | |||||
if ($revolt->getCollectifData() === $this) { | |||||
$revolt->setCollectifData(null); | |||||
} | |||||
} | |||||
return $this; | |||||
} | |||||
/** | |||||
* @return Collection|Dream[] | |||||
*/ | |||||
public function getDream(): Collection | |||||
{ | |||||
return $this->dream; | |||||
} | |||||
public function addDream(Dream $dream): self | |||||
{ | |||||
if (!$this->dream->contains($dream)) { | |||||
$this->dream[] = $dream; | |||||
$dream->setCollectifData($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removeDream(Dream $dream): self | |||||
{ | |||||
if ($this->dream->removeElement($dream)) { | |||||
// set the owning side to null (unless already changed) | |||||
if ($dream->getCollectifData() === $this) { | |||||
$dream->setCollectifData(null); | |||||
} | |||||
} | |||||
return $this; | |||||
} | |||||
/** | |||||
* @return Collection|ProjectBoost[] | |||||
*/ | |||||
public function getProjectBoost(): Collection | |||||
{ | |||||
return $this->projectBoost; | |||||
} | |||||
public function addProjectBoost(ProjectBoost $projectBoost): self | |||||
{ | |||||
if (!$this->projectBoost->contains($projectBoost)) { | |||||
$this->projectBoost[] = $projectBoost; | |||||
$projectBoost->setCollectifData($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removeProjectBoost(ProjectBoost $projectBoost): self | |||||
{ | |||||
if ($this->projectBoost->removeElement($projectBoost)) { | |||||
// set the owning side to null (unless already changed) | |||||
if ($projectBoost->getCollectifData() === $this) { | |||||
$projectBoost->setCollectifData(null); | |||||
} | |||||
} | |||||
return $this; | |||||
} | |||||
/** | |||||
* @return Collection|ProjectInspiring[] | |||||
*/ | |||||
public function getProjectInspiring(): Collection | |||||
{ | |||||
return $this->projectInspiring; | |||||
} | |||||
public function addProjectInspiring(ProjectInspiring $projectInspiring): self | |||||
{ | |||||
if (!$this->projectInspiring->contains($projectInspiring)) { | |||||
$this->projectInspiring[] = $projectInspiring; | |||||
$projectInspiring->setCollectifData($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removeProjectInspiring(ProjectInspiring $projectInspiring): self | |||||
{ | |||||
if ($this->projectInspiring->removeElement($projectInspiring)) { | |||||
// set the owning side to null (unless already changed) | |||||
if ($projectInspiring->getCollectifData() === $this) { | |||||
$projectInspiring->setCollectifData(null); | |||||
} | |||||
} | |||||
return $this; | |||||
} | |||||
public function getTerritory(): ?Territory | |||||
public function getNbParticipant(): ?int | |||||
{ | { | ||||
return $this->territory; | |||||
return $this->nbParticipant; | |||||
} | } | ||||
public function setTerritory(?Territory $territory): self | |||||
public function setNbParticipant(int $nbParticipant): self | |||||
{ | { | ||||
$this->territory = $territory; | |||||
$this->nbParticipant = $nbParticipant; | |||||
return $this; | return $this; | ||||
} | } |
/** | /** | ||||
* @ORM\Entity(repositoryClass=IndividualDataRepository::class) | * @ORM\Entity(repositoryClass=IndividualDataRepository::class) | ||||
*/ | */ | ||||
class IndividualData implements StatusInterface, EntityInterface | |||||
class IndividualData extends AbstractData | |||||
{ | { | ||||
use StatusTrait; | |||||
/** | /** | ||||
* @ORM\Id | * @ORM\Id | ||||
*/ | */ | ||||
private $introAnswer; | private $introAnswer; | ||||
/** | |||||
* @ORM\OneToMany(targetEntity=Revolt::class, mappedBy="individualData", cascade={"persist", "remove"}) | |||||
*/ | |||||
private $revolt; | |||||
/** | |||||
* @ORM\OneToMany(targetEntity=Dream::class, mappedBy="individualData", cascade={"persist", "remove"}) | |||||
*/ | |||||
private $dream; | |||||
/** | |||||
* @ORM\OneToMany(targetEntity=ProjectBoost::class, mappedBy="individualData", cascade={"persist", "remove"}) | |||||
*/ | |||||
private $projectBoost; | |||||
/** | |||||
* @ORM\OneToMany(targetEntity=ProjectInspiring::class, mappedBy="individualData", cascade={"persist", "remove"}) | |||||
*/ | |||||
private $projectInspiring; | |||||
/** | |||||
* @ORM\ManyToOne(targetEntity=Territory::class, inversedBy="individualData") | |||||
*/ | |||||
private $territory; | |||||
public function __construct() | |||||
{ | |||||
$this->revolt = new ArrayCollection(); | |||||
$this->dream = new ArrayCollection(); | |||||
$this->projectBoost = new ArrayCollection(); | |||||
$this->projectInspiring = new ArrayCollection(); | |||||
} | |||||
public function __toString() | public function __toString() | ||||
{ | { | ||||
return $this->firstname . " " . $this->lastname; | return $this->firstname . " " . $this->lastname; | ||||
} | } | ||||
public function getNbDream(): string | |||||
{ | |||||
return count($this->getDream()); | |||||
} | |||||
public function getNbRevolt(): string | |||||
{ | |||||
return count($this->getRevolt()); | |||||
} | |||||
public function getNbProjectBoost(): string | |||||
{ | |||||
return count($this->getProjectBoost()); | |||||
} | |||||
public function getNbProjectInspiring(): string | |||||
{ | |||||
return count($this->getProjectInspiring()); | |||||
} | |||||
public function getId(): ?int | public function getId(): ?int | ||||
{ | { | ||||
return $this->id; | return $this->id; | ||||
return $this; | return $this; | ||||
} | } | ||||
/** | |||||
* @return Collection|Revolt[] | |||||
*/ | |||||
public function getRevolt(): Collection | |||||
{ | |||||
return $this->revolt; | |||||
} | |||||
public function addRevolt(Revolt $revolt): self | |||||
{ | |||||
if (!$this->revolt->contains($revolt)) { | |||||
$this->revolt[] = $revolt; | |||||
$revolt->setIndividualData($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removeRevolt(Revolt $revolt): self | |||||
{ | |||||
if ($this->revolt->removeElement($revolt)) { | |||||
// set the owning side to null (unless already changed) | |||||
if ($revolt->getIndividualData() === $this) { | |||||
$revolt->setIndividualData(null); | |||||
} | |||||
} | |||||
return $this; | |||||
} | |||||
/** | |||||
* @return Collection|Dream[] | |||||
*/ | |||||
public function getDream(): Collection | |||||
{ | |||||
return $this->dream; | |||||
} | |||||
public function addDream(Dream $dream): self | |||||
{ | |||||
if (!$this->dream->contains($dream)) { | |||||
$this->dream[] = $dream; | |||||
$dream->setIndividualData($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removeDream(Dream $dream): self | |||||
{ | |||||
if ($this->dream->removeElement($dream)) { | |||||
// set the owning side to null (unless already changed) | |||||
if ($dream->getIndividualData() === $this) { | |||||
$dream->setIndividualData(null); | |||||
} | |||||
} | |||||
return $this; | |||||
} | |||||
/** | |||||
* @return Collection|ProjectBoost[] | |||||
*/ | |||||
public function getProjectBoost(): Collection | |||||
{ | |||||
return $this->projectBoost; | |||||
} | |||||
public function addProjectBoost(ProjectBoost $projectBoost): self | |||||
{ | |||||
if (!$this->projectBoost->contains($projectBoost)) { | |||||
$this->projectBoost[] = $projectBoost; | |||||
$projectBoost->setIndividualData($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removeProjectBoost(ProjectBoost $projectBoost): self | |||||
{ | |||||
if ($this->projectBoost->removeElement($projectBoost)) { | |||||
// set the owning side to null (unless already changed) | |||||
if ($projectBoost->getIndividualData() === $this) { | |||||
$projectBoost->setIndividualData(null); | |||||
} | |||||
} | |||||
return $this; | |||||
} | |||||
/** | |||||
* @return Collection|ProjectInspiring[] | |||||
*/ | |||||
public function getProjectInspiring(): Collection | |||||
{ | |||||
return $this->projectInspiring; | |||||
} | |||||
public function addProjectInspiring(ProjectInspiring $projectInspiring): self | |||||
{ | |||||
if (!$this->projectInspiring->contains($projectInspiring)) { | |||||
$this->projectInspiring[] = $projectInspiring; | |||||
$projectInspiring->setIndividualData($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removeProjectInspiring(ProjectInspiring $projectInspiring): self | |||||
{ | |||||
if ($this->projectInspiring->removeElement($projectInspiring)) { | |||||
// set the owning side to null (unless already changed) | |||||
if ($projectInspiring->getIndividualData() === $this) { | |||||
$projectInspiring->setIndividualData(null); | |||||
} | |||||
} | |||||
return $this; | |||||
} | |||||
public function getTerritory(): ?Territory | |||||
{ | |||||
return $this->territory; | |||||
} | |||||
public function setTerritory(?Territory $territory): self | |||||
{ | |||||
$this->territory = $territory; | |||||
return $this; | |||||
} | |||||
} | } |
namespace App\Form; | namespace App\Form; | ||||
use App\Entity\AbstractData; | |||||
use App\Entity\Territory; | use App\Entity\Territory; | ||||
use App\Entity\Thematic; | use App\Entity\Thematic; | ||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType; | use Symfony\Component\Form\Extension\Core\Type\HiddenType; | ||||
'expanded' => true, | 'expanded' => true, | ||||
'multiple' => true, | 'multiple' => true, | ||||
'choices' => [ | 'choices' => [ | ||||
'Nos révoltes' => 'revolt', | |||||
'Nos rêves' => 'dream', | |||||
'Les actions à booster' => 'projectBoost', | |||||
'Les actions inspirantes' => 'projectInspiring' | |||||
AbstractData::getCategory() | |||||
] | ] | ||||
]) | ]) | ||||
->add('thematic', EntityType::class, [ | ->add('thematic', EntityType::class, [ | ||||
public function configureOptions(OptionsResolver $resolver) | public function configureOptions(OptionsResolver $resolver) | ||||
{ | { | ||||
$resolver->setDefaults([ | |||||
// Configure your form options here | |||||
]); | |||||
$resolver->setDefaults( | |||||
[ | |||||
'csrf_protection' => false, | |||||
] | |||||
); | |||||
} | } | ||||
} | } |
<?php | |||||
namespace App\Repository; | |||||
use Knp\Component\Pager\PaginatorInterface; | |||||
use Lc\SovBundle\Repository\AbstractRepositoryQuery; | |||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
class TerritoryRepositoryQuery extends AbstractRepositoryQuery implements RepositoryQueryInterface | |||||
{ | |||||
public function __construct(TerritoryRepository $repository, PaginatorInterface $paginator) | |||||
{ | |||||
parent::__construct($repository, 'r', $paginator); | |||||
} | |||||
} |
<?php | |||||
namespace App\Repository; | |||||
use Lc\SovBundle\Repository\AbstractStore; | |||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||||
use Lc\SovBundle\Repository\StoreInterface; | |||||
class TerritoryStore extends AbstractStore implements StoreInterface | |||||
{ | |||||
public function __construct(TerritoryRepositoryQuery $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; | |||||
} | |||||
} |
</div> | </div> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
<div class="help-legend">Cliquer sur les pictos pour découvrir les résultats de la consultation par territoire !</div> | |||||
<div class="help-legend">Cliquer sur les pictos pour découvrir les résultats de la consultation par territoire | |||||
! | |||||
</div> | |||||
<div class="map"> | <div class="map"> | ||||
<img src="{{ 'assets/img/Carte-NFC.png' }}" alt="carte"> | <img src="{{ 'assets/img/Carte-NFC.png' }}" alt="carte"> | ||||
<div class="img-map img-vosges"> | |||||
<a href="" title=""> | |||||
<img src="{{ 'assets/img/Picto-Revoltes.png' }}" alt=""> | |||||
</a> | |||||
<a href="" title=""> | |||||
<img src="{{ 'assets/img/Picto-Reve.png' }}" alt=""> | |||||
</a> | |||||
<a href="" title=""> | |||||
<img src="{{ 'assets/img/Picto-Actions-Booster.png' }}" alt=""> | |||||
</a> | |||||
<a href="" title=""> | |||||
<img src="{{ 'assets/img/Picto-Actions-Inspirantes.png' }}" alt=""> | |||||
</a> | |||||
</div> | |||||
<div class="img-map img-belfort"> | |||||
<a href="" title=""> | |||||
<img src="{{ 'assets/img/Picto-Revoltes.png' }}" alt=""> | |||||
</a> | |||||
<a href="" title=""> | |||||
<img src="{{ 'assets/img/Picto-Reve.png' }}" alt=""> | |||||
</a> | |||||
<a href="" title=""> | |||||
<img src="{{ 'assets/img/Picto-Actions-Booster.png' }}" alt=""> | |||||
</a> | |||||
<a href="" title=""> | |||||
<img src="{{ 'assets/img/Picto-Actions-Inspirantes.png' }}" alt=""> | |||||
</a> | |||||
</div> | |||||
<div class="img-map img-hericourt"> | |||||
<a href="" title=""> | |||||
<img src="{{ 'assets/img/Picto-Revoltes.png' }}" alt=""> | |||||
</a> | |||||
<a href="" title=""> | |||||
<img src="{{ 'assets/img/Picto-Reve.png' }}" alt=""> | |||||
</a> | |||||
<a href="" title=""> | |||||
<img src="{{ 'assets/img/Picto-Actions-Booster.png' }}" alt=""> | |||||
</a> | |||||
<a href="" title=""> | |||||
<img src="{{ 'assets/img/Picto-Actions-Inspirantes.png' }}" alt=""> | |||||
</a> | |||||
</div> | |||||
{% for key, result in resultSortArray %} | |||||
<div class="img-map img-{{ key }}"> | |||||
{% set url = '<a href="'~ path('app_carto_liste', {search_list_form:{category:{'':constant('App\\Entity\\AbstractData::CATEGORY_REVOLT')}, territory:{'':result.Territory}}}) ~'">Consulter la liste</a>' %} | |||||
<img src="{{ 'assets/img/Picto-Revoltes.png' }}" alt="" data-toggle="popover" | |||||
data-content='<span>Nombre de Révoltes : {{ result.Revolt }} </span> {{ url }}'> | |||||
<div class="img-map img-montbeliard"> | |||||
<a href="" title=""> | |||||
<img src="{{ 'assets/img/Picto-Revoltes.png' }}" alt=""> | |||||
</a> | |||||
<a href="" title=""> | |||||
<img src="{{ 'assets/img/Picto-Reve.png' }}" alt=""> | |||||
</a> | |||||
<a href="" title=""> | |||||
<img src="{{ 'assets/img/Picto-Actions-Booster.png' }}" alt=""> | |||||
</a> | |||||
<a href="" title=""> | |||||
<img src="{{ 'assets/img/Picto-Actions-Inspirantes.png' }}" alt=""> | |||||
</a> | |||||
</div> | |||||
{% set url = '<a href="'~ path('app_carto_liste', {search_list_form:{category:{'':constant('App\\Entity\\AbstractData::CATEGORY_DREAM')}, territory:{'':result.Territory}}}) ~'">Consulter la liste</a>' %} | |||||
<img src="{{ 'assets/img/Picto-Reve.png' }}" alt="" data-toggle="popover" | |||||
data-content='<span>Nombre de Rêves : {{ result.Dream }} </span> {{ url }}'> | |||||
<div class="img-map img-montbeliard"> | |||||
<a href="" title=""> | |||||
<img src="{{ 'assets/img/Picto-Revoltes.png' }}" alt=""> | |||||
</a> | |||||
<a href="" title=""> | |||||
<img src="{{ 'assets/img/Picto-Reve.png' }}" alt=""> | |||||
</a> | |||||
<a href="" title=""> | |||||
<img src="{{ 'assets/img/Picto-Actions-Booster.png' }}" alt=""> | |||||
</a> | |||||
<a href="" title=""> | |||||
<img src="{{ 'assets/img/Picto-Actions-Inspirantes.png' }}" alt=""> | |||||
</a> | |||||
</div> | |||||
{% set url = '<a href="'~ path('app_carto_liste', {search_list_form:{category:{'':constant('App\\Entity\\AbstractData::CATEGORY_PROJECTBOOST')}, territory:{'':result.Territory}}}) ~'">Consulter la liste</a>' %} | |||||
<img src="{{ 'assets/img/Picto-Actions-Booster.png' }}" alt="" data-toggle="popover" | |||||
data-content='<span>Nombre de projets à booster : {{ result.ProjectBoost }} </span> {{ url }}'> | |||||
<div class="img-map img-sud"> | |||||
<a href="" title=""> | |||||
<img src="{{ 'assets/img/Picto-Revoltes.png' }}" alt=""> | |||||
</a> | |||||
<a href="" title=""> | |||||
<img src="{{ 'assets/img/Picto-Reve.png' }}" alt=""> | |||||
</a> | |||||
<a href="" title=""> | |||||
<img src="{{ 'assets/img/Picto-Actions-Booster.png' }}" alt=""> | |||||
</a> | |||||
<a href="" title=""> | |||||
<img src="{{ 'assets/img/Picto-Actions-Inspirantes.png' }}" alt=""> | |||||
</a> | |||||
</div> | |||||
{% set url = '<a href="'~ path('app_carto_liste', {search_list_form:{category:{'':constant('App\\Entity\\AbstractData::CATEGORY_PROJECTINSPIRING')}, territory:{'':result.Territory}}}) ~'">Consulter la liste</a>' %} | |||||
<img src="{{ 'assets/img/Picto-Actions-Inspirantes.png' }}" alt="" data-toggle="popover" | |||||
data-content='<span>Nombre de projets inspirants : {{ result.ProjectInspiring }} </span> {{ url }}'> | |||||
</div> | |||||
{% endfor %} | |||||
</div> | </div> | ||||
</div> | </div> | ||||
{% endblock %} | {% endblock %} |
{% block carto %} | {% block carto %} | ||||
<div id="carto-liste"> | <div id="carto-liste"> | ||||
<h1 class="title-liste">La liste simple... et rêvolutionnaire !</h1> | <h1 class="title-liste">La liste simple... et rêvolutionnaire !</h1> | ||||
{{ form_start(form, { 'attr' : { 'class': 'form-search' } }) }} | |||||
{{ form_start(form, { 'attr' : { 'class': 'form-search' }}) }} | |||||
<div class="row"> | <div class="row"> | ||||
<div class="col-6"> | <div class="col-6"> | ||||
{{ form_errors(form) }} | {{ form_errors(form) }} |