src\Controller\Site\HomeController.php line 74

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Site;
  3. use App\Controller\BaseController;
  4. //use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\HttpFoundation\Cookie;
  7. use Symfony\Component\HttpFoundation\Request;
  8. use Symfony\Component\HttpFoundation\Response;
  9. use Symfony\Component\Routing\Annotation\Route;
  10. use Doctrine\ORM\EntityManagerInterface;
  11. use Knp\Component\Pager\PaginatorInterface;
  12. use App\Form\TypenewsType;
  13. use App\Entity\News;
  14. use App\Entity\Evenement;
  15. use App\Entity\Video;
  16. use App\Entity\Pays;
  17. use App\Entity\Produit;
  18. use App\Entity\Commentaire;
  19. use App\Form\CommentaireType;
  20. use App\Repository\CommentaireRepository;
  21. use App\Repository\PubliciteRepository;
  22. use App\Repository\ServiceRepository;
  23. use App\Repository\VideoRepository;
  24. use App\Repository\PaysRepository;
  25. use App\Repository\CategorieVideoRepository;
  26. use App\Repository\ProgrammeFormationRepository;
  27. use App\Repository\ContenupartenaireRepository;
  28. use App\Repository\ContenuorishasRepository;
  29. use App\Repository\EvenementRepository;
  30. use App\Repository\NewsRepository;
  31. use App\Repository\TypenewsRepository;
  32. use App\Repository\ProduitRepository;
  33. use App\Repository\CategorieRepository;
  34. use App\Entity\Contenuorishas;
  35. use App\Entity\Service;
  36. use App\Entity\Contenupartenaire;
  37. use App\Entity\Categorie;
  38. use App\Entity\Typenews;
  39. use App\Entity\ProgrammeFormation;
  40. class HomeController extends BaseController
  41. {
  42.     public function __construct(private readonly EntityManagerInterface $em)
  43.     {
  44.     }
  45.     #[Route(path'/4tpm-solutions')]
  46.     #[Route(path'/dow-jones')]
  47.     #[Route(path'/finances-2')]
  48.     #[Route(path'/produits')]
  49.     #[Route(path'/references')]
  50.     #[Route(path'/six-group')]
  51.     public function redirectNXPath(Request $request)
  52.     {
  53.         $path $request->getPathInfo();
  54.         return match ($path) {
  55.             "/dow-jones" => $this->redirectToRoute("servicefront_show", ['id' => 2]),
  56.             "/six-group" => $this->redirectToRoute("servicefront_show", ['id' => 3]),
  57.             default => $this->redirectToRoute("site_home"),
  58.         };
  59.     }
  60.     #[Route(path'/'name'site_home')]
  61.     public function index(VideoRepository $VideoRepository,
  62.                           ProgrammeFormationRepository $PformationRepository,ProduitRepository $produit,
  63.                           EvenementRepository $EvenementRepository,NewsRepository $NewsRepository,
  64.                           ContenupartenaireRepository $Contenupartenaire): Response
  65.     {
  66.         $commentaireRepository $this->em->getRepository(Commentaire::class);
  67.         $status=true;
  68.            $premium=true;
  69.            $datedate('Y-m-d');
  70.         return $this->render('site/home/index3.html.twig', [
  71.             'controller_name' => 'HomeController',
  72.              //'services' => $serviceRepository->FindAll(),
  73.              'produit' => $produit->FindAll(),
  74.             'programmes'=>$PformationRepository->findByPfort($status),
  75.              //'publicites' => $publiciteRepository->FindAll(),
  76.              'videosa'=>$VideoRepository->findByVA($status),
  77.              'partenaires' => $Contenupartenaire->FindAll(),
  78.             'newsimgfinance' => $NewsRepository->findBynewsimg($status),
  79.             'evenements' => $EvenementRepository->findByCEA($status,$date),
  80.             'commentaires'=>$commentaireRepository->findAll(),
  81.              'newsfinance' => $NewsRepository->findBynewsA($status),
  82.         ]);
  83.     }
  84.     
  85.     /**
  86.      * ("/service", name="show_service")
  87.      */
  88.     public function showService()
  89.     {
  90.         return $this->render('site/services/services.html.twig', [
  91.             'title' => 'NOS SERVCES',
  92.         ]);
  93.     }
  94.     /**
  95.      * ("/produit", name="show_produit")
  96.      */
  97.     public function showProduits()
  98.     {
  99.         return $this->render('site/produits/produit.html.twig', [
  100.             'title' => 'Nom Produit',
  101.         ]);
  102.     }
  103.      
  104. /**
  105.      * ("/Video", name="videotv")
  106.      */
  107.     public function showVideotv()
  108.     {
  109.         return $this->render('site/videos/video.html.twig', [
  110.             'title' => 'Nom Produit',
  111.         ]);
  112.     }
  113. #[Route(path'/Souscription'name'souscri')]
  114.     public function Souscription()
  115.     {
  116.         return $this->render('site/home/souscri.html.twig', [
  117.             //'title' => 'Nom Produit',
  118.         ]);
  119.     }
  120. }