<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
class DefaultController extends AbstractController
{
/**
* @Route("/", name="home")
* @Route("/contact", name="contact")
* @Route("/partenaires", name="partnaires")
* @Route("/inscription-en-ligne-particulier", name="inscription.particulier")
* @Route("/inscription-en-ligne-professionel",name="inscription.pro")
*/
public function index(Request $request)
{
$routeName = $request->attributes->get('_route');
if($routeName == 'home'){
return $this->render('default/index.html.twig');
}
if($routeName == 'contact'){
return $this->render('default/contact.html.twig');
}
if($routeName == 'partnaires'){
return $this->render('default/partnaire.html.twig');
}
if($routeName == 'inscription.particulier'){
$page="particulier";
return $this->render('default/inscription.html.twig',
['page'=>$page]);
}
if($routeName == 'inscription.pro'){
$page="pro";
return $this->render('default/inscription.html.twig',
['page'=>$page]);
}
}
/**
* @Route("/idcie/qui-sommes-nous", name="idcie.qms")
* @Route("/idcie/notre-mission", name="idcie.mission")
* @Route("/idcie/l-interet-pour-le-territoire", name="idcie.interet")
*/
public function idcie(Request $request)
{
$routeName = $request->attributes->get('_route');
if($routeName == 'idcie.qms'){
$rubrique = "qms";
return $this->render('default/about.html.twig',[
'rubrique'=>$rubrique
]);
}elseif($routeName == 'idcie.mission'){
$rubrique = "mission";
return $this->render('default/mission.html.twig',[
'rubrique'=>$rubrique
]);
}elseif($routeName == 'idcie.interet'){
$rubrique = "interet";
return $this->render('default/interet.html.twig',[
'rubrique'=>$rubrique
]);
}
}
/**
* @Route("/nos-services/formation-professionnelle", name="service.formation")
* @Route("/nos-services/coaching-personnel-et-professionnel", name="service.coaching")
* @Route("/nos-services/conseil-rh-aux-entreprises", name="service.conseil")
* @Route("/nos-services/consultation-entretien-retraite", name="service.retraite")
*/
public function services(Request $request)
{
$routeName = $request->attributes->get('_route');
if($routeName == 'service.formation'){
$service = "formation";
return $this->render('default/service.html.twig',[
'service'=>$service
]);
}elseif($routeName == 'service.coaching'){
$service = "coaching";
return $this->render('default/service.html.twig',[
'service'=>$service
]);
}elseif($routeName == 'service.conseil'){
$service = "conseil";
return $this->render('default/service.html.twig',[
'service'=>$service
]);
}elseif($routeName == 'service.retraite'){
$service = "retraite";
return $this->render('default/service.html.twig',[
'service'=>$service
]);
}
}
/**
* @Route("/nos-formations/transitions-et-changements", name="formation.transition")
* @Route("/nos-formations/de-la-connaissance-de-soi-a-la-construction-de-son-projet", name="formation.confiance")
* @Route("/nos-formations/emotion-zen-maitrisez-votre-stress", name="formation.zen")
* @Route("/nos-formations/en-marche-vers-l-emploi", name="formation.emploi")
* @Route("/nos-formations/entreprenariat-et-creation-entreprise", name="formation.entreprise")
* @Route("/nos-formations/developpez-votre-efficacite-professionnelle", name="formation.efficacite")
* @Route("/nos-formations/consolidez-votre-projet-de-creation", name="formation.consolidez")
* @Route("/nos-formations/trouver-son-equilibre-and-glow-up", name="formation.equilibre")
* @Route("/nos-formations/je-m-inite-a-la-posture-de-coach-et-aux-nouvelles-mthodes-d-accommpagnement", name="formation.posture")
* @Route("/nos-formations/j-optimise-la-gestion-de-mon-activite-asp", name="formation.optimisation")
*/
public function formation(Request $request)
{
$routeName = $request->attributes->get('_route');
if($routeName == 'formation.transition'){
$formation = "transition";
return $this->render('default/formation.html.twig',[
'formation'=>$formation
]);
}elseif($routeName == 'formation.confiance'){
$formation = "confiance";
return $this->render('default/formation.html.twig',[
'formation'=>$formation
]);
}elseif($routeName == 'formation.zen'){
$formation = "zen";
return $this->render('default/formation.html.twig',[
'formation'=>$formation
]);
}elseif($routeName == 'formation.emploi'){
$formation = "emploi";
return $this->render('default/formation.html.twig',[
'formation'=>$formation
]);
}elseif($routeName == 'formation.entreprise'){
$formation = "entreprise";
return $this->render('default/formation.html.twig',[
'formation'=>$formation
]);
}elseif($routeName == 'formation.efficacite'){
$formation = "efficacite";
return $this->render('default/formation.html.twig',[
'formation'=>$formation
]);
}elseif($routeName == 'formation.consolidez'){
$formation = "consolidez";
return $this->render('default/formation.html.twig',[
'formation'=>$formation
]);
}elseif($routeName == 'formation.optimisation'){
$formation = "optimisation";
return $this->render('default/formation.html.twig',[
'formation'=>$formation
]);
}elseif($routeName == 'formation.equilibre'){
$formation = "equilibre";
return $this->render('default/formation.html.twig',[
'formation'=>$formation
]);
}elseif($routeName == 'formation.posture'){
$formation = "posture";
return $this->render('default/formation.html.twig',[
'formation'=>$formation
]);
}
return $this->render('default/formation.html.twig');
}
/**
* @Route("/mention-legales", name="mention.legal")
* @Route("/conditions-d-utilisation", name="mention.conditions")
* @Route("/assistance-technique", name="mention.technique")
* @Route("/assistance-technique-et-pedagogique", name="mention.pedagogique")
* @Route("/politique-de-confidentialite", name="mention.confidentialite")
* @Route("/conditions-generales-de-vente", name="mention.cgv")
* @Route("/reglement-interieur", name="mention.reglement")
* @Route("/conditions-d-admission", name="mention.admission")
*/
public function mention(Request $request)
{
$routeName = $request->attributes->get('_route');
if($routeName == 'mention.legal'){
$mention = "legal";
return $this->render('default/mention.html.twig',[
'mention'=>$mention
]);
}elseif($routeName == 'mention.conditions'){
$mention = "conditions";
return $this->render('default/mention.html.twig',[
'mention'=>$mention
]);
}elseif($routeName == 'mention.technique'){
$mention = "technique";
return $this->render('default/mention.html.twig',[
'mention'=>$mention
]);
}elseif($routeName == 'mention.pedagogique'){
$mention = "pedagogique";
return $this->render('default/mention.html.twig',[
'mention'=>$mention
]);
}elseif($routeName == 'mention.confidentialite'){
$mention = "confidentialite";
return $this->render('default/mention.html.twig',[
'mention'=>$mention
]);
}elseif($routeName == 'mention.cgv'){
$mention = "cgv";
return $this->render('default/mention.html.twig',[
'mention'=>$mention
]);
}elseif($routeName == 'mention.reglement'){
$mention = "reglement";
return $this->render('default/mention.html.twig',[
'mention'=>$mention
]);
}elseif($routeName == 'mention.admission'){
$mention = "admission";
return $this->render('default/mention.html.twig',[
'mention'=>$mention
]);
}
}
/**
* @Route("/download/pdf/{id}", name="download_pdf")
*/
public function downloadPdf($id)
{
// Associe chaque ID à un fichier PDF spécifique
$pdfFiles = [
1 => 'fiche-programme-changement-et-transition.pdf',
2 => 'fiche-programme-changement-et-transition-version-courte.pdf',
3 => 'fiche-programme-trouver-son-equilibre-en-glow-up.pdf',
4 => 'fiche-programme-optimiser-la-gestion-de-votre-activite-au-quotidien.pdf',
5 => 'fiche-programme-je-m-initie-a-la-posture-de-coach-et-aux-nouvelles-methodes-d-accompagnement.pdf',
6 => 'fiche-programme-en-marche-vers-l-emploi.pdf',
7 => 'fiche-programme-emotions-zen-maitriser-votre-stress-pour-reveler-votre-potentiel.pdf',
8 => 'fiche-programme-developper-son-efficacite-professionnelle-et-votre-leadership.pdf',
9 => 'fiche-programme-de-la-connaissance-de-soi-a-la-construction-de-son-projet.pdf',
10 => 'fiche-programme-developper-son-efficacite-personnelle-et-professionnelle.pdf',
// Ajoute d'autres fichiers si nécessaire
];
// Vérifie si l'ID est valide (présent dans le tableau)
if (!isset($pdfFiles[$id])) {
throw $this->createNotFoundException("Le fichier PDF demandé n'existe pas.");
}
// Récupère le nom du fichier PDF à partir de l'ID
$filename = $pdfFiles[$id];
$filePath = $this->getParameter('kernel.project_dir').'/public/doc/'.$filename;
// Vérifie si le fichier existe
if (!file_exists($filePath)) {
throw $this->createNotFoundException("Le fichier n'existe pas.");
}
// Crée la réponse pour envoyer le fichier
$response = new BinaryFileResponse($filePath);
$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $filename);
return $response;
}
}