<?php
namespace App\Controller\Commun;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use App\Entity\Parametrage\EnumModule;
use App\Entity\Parametrage\EnumParametre;
use App\Service\Parametrage\ParametrageService;
class IndexBackOfficeController extends AbstractController
{
private $logger;
private $parametrageService;
public function __construct(LoggerInterface $logger, ParametrageService $parametrageService)
{
$this->logger = $logger;
$this->parametrageService = $parametrageService;
}
/**
* @Route("/", name="index_back_office")
*/
public function index()
{
$contentContact = $this->parametrageService->getParametre(EnumParametre::CONTENU_MES_CONTACTS)->getValeur();
$contactsActifs = $this->parametrageService->estModuleActif(EnumModule::CONTACTS) && $contentContact != '';
$urlRedirect = $this->parametrageService->getParametre(EnumParametre::URL_ADMIN_AM_LEGACY)->getValeur();
$moderationActive = $this->parametrageService->getParametre(EnumParametre::ACTIVE_MODERATION_OFFRE_ACCUEIL)->getValeur() == 'true';
return $this->render('commun/index.html.twig', [
'assmat' => $this->getUser()->getAssistantMaternel(),
'moduleGDAActif' => $this->parametrageService->estModuleActif(EnumModule::GDA),
'moduleMAMActif' => $this->parametrageService->estModuleActif(EnumModule::MAM),
'moduleFormulaireActif' => $this->parametrageService->estModuleActif(EnumModule::FORMULAIRES),
'moduleGrandPublicActif' => $this->parametrageService->estModuleActif(EnumModule::GRANDPUBLIC) && $urlRedirect != '',
'moduleGrandPublicEditActif' => $this->parametrageService->estModuleActif(EnumModule::GRANDPUBLIC) && $urlRedirect == '',
'moduleListesActif' => $this->parametrageService->estModuleActif(EnumModule::LISTES),
'moduleStatistiquesActif' => $this->parametrageService->estModuleActif(EnumModule::STATISTIQUES),
'moduleContactsActif' => $contactsActifs,
'moderationActive' => $moderationActive,
]);
}
/**
* Page Mes contacts pour l'assmat
* @Route("/contacts/", name="contacts_assmat")
*/
public function contactsAssmat()
{
$content = $this->parametrageService->getParametre(EnumParametre::CONTENU_MES_CONTACTS)->getValeur();
return $this->render('commun/mes_contacts.html.twig', [
'content' => $content
]);
}
/**
* @Route("/mentions_legales/", name="mentions_legales")
*/
public function mentionsLegales()
{
$content = $this->parametrageService->getParametre(EnumParametre::CONTENU_MENTIONS_LEGALES_EFC)->getValeur();
return $this->render('commun/mentions_legales.html.twig', [
'content' => $content
]);
}
/**
* @Route("/protection_donnees/", name="protection_donnees")
*/
public function protectionDonnees()
{
$num = $this->parametrageService->getParametre(EnumParametre::NUMERO_DEPARTEMENT)->getValeur();
$content = $this->parametrageService->getParametre(EnumParametre::CONTENU_MENTIONS_LEGALES_EFC)->getValeur();
if($num == ''){
return $this->mentionsLegales();
}
return $this->render('commun/protection_donnees_'.$num.'.html.twig', [
'content' => $content
]);
}
}