setSubtheme($(select)); | setSubtheme($(select)); | ||||
$(select).trigger('change'); | $(select).trigger('change'); | ||||
}) | }) | ||||
//setSubtheme(); | |||||
// $(document).on('click', '.theme option', function (e) { | |||||
// alert('test'); | |||||
// $(this).closest('.form-widget-compound').find('.subtheme option').show(); | |||||
// $(this).closest('.form-widget-compound').find('.subtheme option[data-class]').not("[data-class='" + $(this).data('class') + "']").hide(); | |||||
// }); | |||||
}); | }); | ||||
function setSubtheme($select) { | function setSubtheme($select) { | ||||
$select.on('change', function (e) { | $select.on('change', function (e) { | ||||
SovTools.log($(e.target).find('option:selected').data('class')); | |||||
$(e.target).closest('.form-widget-compound').find('.subtheme option').prop('disabled', false); | $(e.target).closest('.form-widget-compound').find('.subtheme option').prop('disabled', false); | ||||
$(e.target).closest('.form-widget-compound').find('.subtheme option[data-class]').not("[data-class='" + $(e.target).find('option:selected').data('class') + "']").prop('disabled', true); | $(e.target).closest('.form-widget-compound').find('.subtheme option[data-class]').not("[data-class='" + $(e.target).find('option:selected').data('class') + "']").prop('disabled', true); | ||||
SovWidgets.setSelect2($(this).closest('.form-widget-compound').find('.subtheme')); | SovWidgets.setSelect2($(this).closest('.form-widget-compound').find('.subtheme')); |
app_homepage: | app_homepage: | ||||
path: / | path: / | ||||
controller: App\Controller\Frontend\DefaultController:home | |||||
controller: App\Controller\Frontend\HomeController:home | |||||
app_legal_mention: | app_legal_mention: | ||||
path: /mentions-legales | path: /mentions-legales | ||||
controller: App\Controller\Frontend\DefaultController::mention | |||||
controller: App\Controller\Frontend\MentionController::mention | |||||
app_carto_interactive: | app_carto_interactive: | ||||
path: /cartographie-interactive | path: /cartographie-interactive | ||||
controller: App\Controller\Frontend\DefaultController::cartoInteractive | |||||
controller: App\Controller\Frontend\CartoController::cartoInteractive | |||||
app_carto_liste: | app_carto_liste: | ||||
path: /cartographie-list | path: /cartographie-list | ||||
controller: App\Controller\Frontend\DefaultController::cartoListe | |||||
controller: App\Controller\Frontend\CartoController::cartoListe | |||||
app_carto_carte: | app_carto_carte: | ||||
path: /cartographie-carte | path: /cartographie-carte | ||||
controller: App\Controller\Frontend\DefaultController::cartoCarte | |||||
controller: App\Controller\Frontend\CartoController::cartoCarte | |||||
app_contact: | app_contact: | ||||
path: /contact | path: /contact | ||||
controller: App\Controller\Frontend\DefaultController::contact | |||||
controller: App\Controller\Frontend\ContactController::contact | |||||
app_contact_form: | app_contact_form: | ||||
path: /contact-form | path: /contact-form | ||||
controller: App\Controller\Frontend\DefaultController::contactForm | |||||
controller: App\Controller\Frontend\ContactController::contactForm | |||||
app_about: | app_about: | ||||
path: /a-propos | path: /a-propos | ||||
controller: App\Controller\Frontend\DefaultController::about | |||||
controller: App\Controller\Frontend\AboutController::about | |||||
app_contribuate: | app_contribuate: | ||||
path: /contribution-individuel | path: /contribution-individuel | ||||
controller: App\Controller\Frontend\DefaultController::contribuate | |||||
controller: App\Controller\Frontend\ContribuateController::contribuate |
<?php | |||||
namespace App\Controller\Frontend; | |||||
class AboutController extends DefaultController | |||||
{ | |||||
public function about() | |||||
{ | |||||
return $this->render('frontend/about.html.twig'); | |||||
} | |||||
} |
<?php | |||||
namespace App\Controller\Frontend; | |||||
use App\Entity\Dream; | |||||
use App\Entity\ProjectBoost; | |||||
use App\Entity\ProjectInspiring; | |||||
use App\Entity\Revolt; | |||||
use App\Form\ContactForm; | |||||
use App\Form\IndividualForm; | |||||
use App\Form\SearchListForm; | |||||
use App\Repository\DreamStore; | |||||
use App\Repository\ProjectBoostStore; | |||||
use App\Repository\ProjectInspiringStore; | |||||
use App\Repository\RevoltStore; | |||||
use Doctrine\ORM\EntityManagerInterface; | |||||
use Knp\Component\Pager\PaginatorInterface; | |||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | |||||
use Symfony\Component\HttpFoundation\JsonResponse; | |||||
use Symfony\Component\HttpFoundation\Response; | |||||
use App\Entity\Site\Page; | |||||
use Symfony\Component\Mailer\MailerInterface; | |||||
use Symfony\Component\Mime\Email; | |||||
use Symfony\Component\HttpFoundation\Request; | |||||
class CartoController extends DefaultController | |||||
{ | |||||
protected EntityManagerInterface $em; | |||||
protected DreamStore $dreamStore; | |||||
protected RevoltStore $revoltStore; | |||||
protected ProjectBoostStore $projectBoostStore; | |||||
protected ProjectInspiringStore $projectInspiringStore; | |||||
protected PaginatorInterface $paginator; | |||||
public function __construct( | |||||
EntityManagerInterface $em, | |||||
DreamStore $dreamStore, | |||||
RevoltStore $revoltStore, | |||||
ProjectBoostStore $projectBoostStore, | |||||
ProjectInspiringStore $projectInspiringStore, | |||||
PaginatorInterface $paginator | |||||
) { | |||||
$this->em = $em; | |||||
$this->dreamStore = $dreamStore; | |||||
$this->revoltStore = $revoltStore; | |||||
$this->projectBoostStore = $projectBoostStore; | |||||
$this->projectInspiringStore = $projectInspiringStore; | |||||
$this->paginator = $paginator; | |||||
} | |||||
public function cartoInteractive() | |||||
{ | |||||
return $this->render( | |||||
'frontend/carto-int.html.twig', | |||||
[ | |||||
'nbContrib' => $this->countContrib() | |||||
] | |||||
); | |||||
} | |||||
public function cartoListe(Request $request) | |||||
{ | |||||
$dreamArray = $revoltArray = $projectBoostArray = $projectInspiringArray = $resultArray = $resultArrayPagination = array(); | |||||
$form = $this->createForm(SearchListForm::class); | |||||
$form->handleRequest($request); | |||||
if ($form->isSubmitted() && $form->isValid()) { | |||||
$data = $form->getData(); | |||||
$page = $data['page']; | |||||
$description = $data['search']; | |||||
$categoryArray = $data['category']; | |||||
$territoryArray = $data['territory']; | |||||
$thematicArray = $data['thematic']; | |||||
if (in_array('dream', $categoryArray) || empty($categoryArray)) { | |||||
$dreamArray = $this->dreamStore->filterSearch($description, $territoryArray, $thematicArray); | |||||
} | |||||
if (in_array('revolt', $categoryArray) || empty($categoryArray)) { | |||||
$revoltArray = $this->revoltStore->filterSearch($description, $territoryArray, $thematicArray); | |||||
} | |||||
if (in_array('projectBoost', $categoryArray) || empty($categoryArray)) { | |||||
$projectBoostArray = $this->projectBoostStore->filterSearch( | |||||
$description, | |||||
$territoryArray, | |||||
$thematicArray | |||||
); | |||||
} | |||||
if (in_array('projectInspiring', $categoryArray) || empty($categoryArray)) { | |||||
$projectInspiringArray = $this->projectInspiringStore->filterSearch( | |||||
$description, | |||||
$territoryArray, | |||||
$thematicArray | |||||
); | |||||
} | |||||
$resultArray = array_merge($dreamArray, $revoltArray, $projectBoostArray, $projectInspiringArray); | |||||
$resultArrayPagination = $this->paginator->paginate( | |||||
$resultArray, | |||||
$page, | |||||
10 | |||||
); | |||||
} | |||||
return $this->render( | |||||
'frontend/carto-liste.html.twig', | |||||
[ | |||||
'form' => $form->createView(), | |||||
'nbContrib' => $this->countContrib(), | |||||
'resultArray' => $resultArrayPagination | |||||
] | |||||
); | |||||
} | |||||
public function cartoCarte() | |||||
{ | |||||
return $this->render( | |||||
'frontend/carto-carte.html.twig', | |||||
[ | |||||
'nbContrib' => $this->countContrib() | |||||
] | |||||
); | |||||
} | |||||
} |
<?php | |||||
namespace App\Controller\Frontend; | |||||
use App\Form\ContactForm; | |||||
use Symfony\Component\HttpFoundation\JsonResponse; | |||||
use Symfony\Component\Mailer\MailerInterface; | |||||
use Symfony\Component\Mime\Email; | |||||
use Symfony\Component\HttpFoundation\Request; | |||||
class ContactController extends DefaultController | |||||
{ | |||||
public function contact() | |||||
{ | |||||
$form = $this->createForm(ContactForm::class, null, array( | |||||
'action' => $this->generateUrl('app_contact_form') | |||||
)); | |||||
return $this->render('frontend/contact.html.twig', [ | |||||
'form' => $form->createView() | |||||
]); | |||||
} | |||||
public function contactForm(Request $request, MailerInterface $mailer) | |||||
{ | |||||
$form = $this->createForm(ContactForm::class); | |||||
$form->handleRequest($request); | |||||
if ($form->isSubmitted() && $form->isValid() && $form->get('lccap')->getData() == 'blop') { | |||||
$message = '<p>De : ' . $form->get('firstname')->getData() . ' ' . $form->get('lastname')->getData( | |||||
) . '<br />Email : ' . $form->get('email')->getData() . '<br />Objet : ' . $form->get( | |||||
'object' | |||||
)->getData() . '</p><p>' . $form->get('message')->getData() . '</p>'; | |||||
$email = (new Email()) | |||||
->from('charly@laclic.fr') | |||||
->from('nepasrepondre@laclic.fr') | |||||
->replyTo($form->get('email')->getData()) | |||||
// ->to('agir@lacooperativedescitoyens.fr') | |||||
->to('charly@laclic.fr') | |||||
->subject('Message de contact sur Aux Actes Citoyens !') | |||||
->text(strip_tags($message)) | |||||
->html($message); | |||||
$mailer->send($email); | |||||
return new JsonResponse( | |||||
[ | |||||
'status' => 'success' | |||||
] | |||||
); | |||||
} | |||||
return new JsonResponse( | |||||
[ | |||||
'status' => 'error' | |||||
] | |||||
); | |||||
} | |||||
} |
<?php | |||||
namespace App\Controller\Frontend; | |||||
use App\Form\IndividualForm; | |||||
class ContribuateController extends DefaultController | |||||
{ | |||||
public function contribuate() | |||||
{ | |||||
$form = $this->createForm(IndividualForm::class); | |||||
return $this->render( | |||||
'frontend/contribuate.html.twig', | |||||
[ | |||||
'nbContrib' => $this->countContrib(), | |||||
'form' => $form->createView() | |||||
] | |||||
); | |||||
} | |||||
} |
use App\Entity\ProjectBoost; | use App\Entity\ProjectBoost; | ||||
use App\Entity\ProjectInspiring; | use App\Entity\ProjectInspiring; | ||||
use App\Entity\Revolt; | use App\Entity\Revolt; | ||||
use App\Form\ContactForm; | |||||
use App\Form\IndividualForm; | |||||
use App\Form\SearchListForm; | |||||
use App\Repository\DreamStore; | |||||
use App\Repository\ProjectBoostStore; | |||||
use App\Repository\ProjectInspiringStore; | |||||
use App\Repository\RevoltStore; | |||||
use Doctrine\ORM\EntityManagerInterface; | use Doctrine\ORM\EntityManagerInterface; | ||||
use Knp\Component\Pager\PaginatorInterface; | |||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||||
use Symfony\Component\HttpFoundation\JsonResponse; | |||||
use Symfony\Component\HttpFoundation\Response; | |||||
use App\Entity\Site\Page; | |||||
use Symfony\Component\Mailer\MailerInterface; | |||||
use Symfony\Component\Mime\Email; | |||||
use Symfony\Component\HttpFoundation\Request; | |||||
class DefaultController extends AbstractController | class DefaultController extends AbstractController | ||||
{ | { | ||||
protected EntityManagerInterface $em; | protected EntityManagerInterface $em; | ||||
protected DreamStore $dreamStore; | |||||
protected RevoltStore $revoltStore; | |||||
protected ProjectBoostStore $projectBoostStore; | |||||
protected ProjectInspiringStore $projectInspiringStore; | |||||
protected PaginatorInterface $paginator; | |||||
public function __construct( | public function __construct( | ||||
EntityManagerInterface $em, | |||||
DreamStore $dreamStore, | |||||
RevoltStore $revoltStore, | |||||
ProjectBoostStore $projectBoostStore, | |||||
ProjectInspiringStore $projectInspiringStore, | |||||
PaginatorInterface $paginator | |||||
EntityManagerInterface $em | |||||
) { | ) { | ||||
$this->em = $em; | $this->em = $em; | ||||
$this->dreamStore = $dreamStore; | |||||
$this->revoltStore = $revoltStore; | |||||
$this->projectBoostStore = $projectBoostStore; | |||||
$this->projectInspiringStore = $projectInspiringStore; | |||||
$this->paginator = $paginator; | |||||
} | } | ||||
public function home() | |||||
{ | |||||
return $this->render('frontend/home.html.twig'); | |||||
} | |||||
public function cartoInteractive() | |||||
{ | |||||
return $this->render( | |||||
'frontend/carto-int.html.twig', | |||||
[ | |||||
'nbContrib' => $this->countContrib() | |||||
] | |||||
); | |||||
} | |||||
public function cartoListe(Request $request) | |||||
{ | |||||
$dreamArray = $revoltArray = $projectBoostArray = $projectInspiringArray = $resultArray = $resultArrayPagination = array(); | |||||
$form = $this->createForm(SearchListForm::class); | |||||
$form->handleRequest($request); | |||||
if ($form->isSubmitted() && $form->isValid()) { | |||||
$data = $form->getData(); | |||||
$page = $data['page']; | |||||
$description = $data['search']; | |||||
$categoryArray = $data['category']; | |||||
$territoryArray = $data['territory']; | |||||
$thematicArray = $data['thematic']; | |||||
if (in_array('dream', $categoryArray) || empty($categoryArray)) { | |||||
$dreamArray = $this->dreamStore->filterSearch($description, $territoryArray, $thematicArray); | |||||
} | |||||
if (in_array('revolt', $categoryArray) || empty($categoryArray)) { | |||||
$revoltArray = $this->revoltStore->filterSearch($description, $territoryArray, $thematicArray); | |||||
} | |||||
if (in_array('projectBoost', $categoryArray) || empty($categoryArray)) { | |||||
$projectBoostArray = $this->projectBoostStore->filterSearch( | |||||
$description, | |||||
$territoryArray, | |||||
$thematicArray | |||||
); | |||||
} | |||||
if (in_array('projectInspiring', $categoryArray) || empty($categoryArray)) { | |||||
$projectInspiringArray = $this->projectInspiringStore->filterSearch( | |||||
$description, | |||||
$territoryArray, | |||||
$thematicArray | |||||
); | |||||
} | |||||
$resultArray = array_merge($dreamArray, $revoltArray, $projectBoostArray, $projectInspiringArray); | |||||
$resultArrayPagination = $this->paginator->paginate( | |||||
$resultArray, | |||||
$page, | |||||
10 | |||||
); | |||||
} | |||||
return $this->render( | |||||
'frontend/carto-liste.html.twig', | |||||
[ | |||||
'form' => $form->createView(), | |||||
'nbContrib' => $this->countContrib(), | |||||
'resultArray' => $resultArrayPagination | |||||
] | |||||
); | |||||
} | |||||
public function cartoCarte() | |||||
{ | |||||
return $this->render( | |||||
'frontend/carto-carte.html.twig', | |||||
[ | |||||
'nbContrib' => $this->countContrib() | |||||
] | |||||
); | |||||
} | |||||
public function contactForm(Request $request, MailerInterface $mailer) | |||||
{ | |||||
$form = $this->createForm(ContactForm::class); | |||||
$form->handleRequest($request); | |||||
if ($form->isSubmitted() && $form->isValid() && $form->get('lccap')->getData() == 'blop') { | |||||
$message = '<p>De : ' . $form->get('firstname')->getData() . ' ' . $form->get('lastname')->getData( | |||||
) . '<br />Email : ' . $form->get('email')->getData() . '<br />Objet : ' . $form->get( | |||||
'object' | |||||
)->getData() . '</p><p>' . $form->get('message')->getData() . '</p>'; | |||||
$email = (new Email()) | |||||
->from('charly@laclic.fr') | |||||
->from('nepasrepondre@laclic.fr') | |||||
->replyTo($form->get('email')->getData()) | |||||
// ->to('agir@lacooperativedescitoyens.fr') | |||||
->to('charly@laclic.fr') | |||||
->subject('Message de contact sur Aux Actes Citoyens !') | |||||
->text(strip_tags($message)) | |||||
->html($message); | |||||
$mailer->send($email); | |||||
return new JsonResponse( | |||||
[ | |||||
'status' => 'success' | |||||
] | |||||
); | |||||
} | |||||
return new JsonResponse( | |||||
[ | |||||
'status' => 'error' | |||||
] | |||||
); | |||||
} | |||||
public function contact() | |||||
{ | |||||
$form = $this->createForm(ContactForm::class, null, array( | |||||
'action' => $this->generateUrl('app_contact_form') | |||||
)); | |||||
return $this->render('frontend/contact.html.twig', [ | |||||
'form' => $form->createView() | |||||
]); | |||||
} | |||||
public function about() | |||||
{ | |||||
return $this->render('frontend/about.html.twig'); | |||||
} | |||||
public function contribuate() | |||||
{ | |||||
$form = $this->createForm(IndividualForm::class); | |||||
return $this->render( | |||||
'frontend/contribuate.html.twig', | |||||
[ | |||||
'nbContrib' => $this->countContrib(), | |||||
'form' => $form->createView() | |||||
] | |||||
); | |||||
} | |||||
public function mention(): Response | |||||
{ | |||||
$pageRepository = $this->em->getRepository(Page::class); | |||||
return $this->render( | |||||
'page/page.html.twig', | |||||
[ | |||||
'controller_name' => 'IndexController', | |||||
'page' => $pageRepository->findOneByDevAlias('legal-mention') | |||||
] | |||||
); | |||||
} | |||||
private function countContrib(): int | |||||
protected function countContrib(): int | |||||
{ | { | ||||
$dreamRepository = $this->em->getRepository(Dream::class); | $dreamRepository = $this->em->getRepository(Dream::class); | ||||
$revoltRepository = $this->em->getRepository(Revolt::class); | $revoltRepository = $this->em->getRepository(Revolt::class); |
<?php | |||||
namespace App\Controller\Frontend; | |||||
class HomeController extends DefaultController | |||||
{ | |||||
public function home() | |||||
{ | |||||
return $this->render('frontend/home.html.twig'); | |||||
} | |||||
} |
<?php | |||||
namespace App\Controller\Frontend; | |||||
use App\Entity\Site\Page; | |||||
use Symfony\Component\HttpFoundation\Response; | |||||
class MentionController extends DefaultController | |||||
{ | |||||
public function mention(): Response | |||||
{ | |||||
$pageRepository = $this->em->getRepository(Page::class); | |||||
return $this->render( | |||||
'page/page.html.twig', | |||||
[ | |||||
'controller_name' => 'IndexController', | |||||
'page' => $pageRepository->findOneByDevAlias('legal-mention') | |||||
] | |||||
); | |||||
} | |||||
} |
public function __toString() | public function __toString() | ||||
{ | { | ||||
return $this->description; | |||||
return "Nos rêves"; | |||||
} | } | ||||
public function getId(): ?int | public function getId(): ?int |
public function __toString() | public function __toString() | ||||
{ | { | ||||
return $this->description; | |||||
return "Les actions à booster"; | |||||
} | } | ||||
public function getId(): ?int | public function getId(): ?int |
public function __toString() | public function __toString() | ||||
{ | { | ||||
return $this->description; | |||||
return "Les actions inspirantes"; | |||||
} | } | ||||
public function getId(): ?int | public function getId(): ?int |
public function __toString() | public function __toString() | ||||
{ | { | ||||
return $this->description; | |||||
return "Nos révoltes"; | |||||
} | } | ||||
public function getId(): ?int | public function getId(): ?int |
<tbody> | <tbody> | ||||
{% for result in resultArray %} | {% for result in resultArray %} | ||||
<tr> | <tr> | ||||
<td>{{ result }}</td> | |||||
<td>{{ result }}</td> | |||||
<td>{{ result }}</td> | |||||
<td>{{ result }}</td> | |||||
<td> | |||||
{{ result }} | |||||
</td> | |||||
<td> | |||||
{{ result.thematic }} | |||||
</td> | |||||
<td> | |||||
{{ result.subthematic }} | |||||
</td> | |||||
<td> | |||||
{% if result.individualData is not empty %} | |||||
{{ result.individualData.territory }} | |||||
{% elseif result.collectifData is not empty %} | |||||
{{ result.collectifData.territory }} | |||||
{% endif %} | |||||
</td> | |||||
</tr> | </tr> | ||||
{% endfor %} | {% endfor %} | ||||
</tbody> | </tbody> |