<?php
namespace App\Controller\Site;
use App\Controller\BaseController;
//use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Doctrine\ORM\EntityManagerInterface;
use Knp\Component\Pager\PaginatorInterface;
use App\Form\TypenewsType;
use App\Entity\News;
use App\Entity\Evenement;
use App\Entity\Video;
use App\Entity\Pays;
use App\Entity\Produit;
use App\Entity\Commentaire;
use App\Form\CommentaireType;
use App\Repository\CommentaireRepository;
use App\Repository\PubliciteRepository;
use App\Repository\ServiceRepository;
use App\Repository\VideoRepository;
use App\Repository\PaysRepository;
use App\Repository\CategorieVideoRepository;
use App\Repository\ProgrammeFormationRepository;
use App\Repository\ContenupartenaireRepository;
use App\Repository\ContenuorishasRepository;
use App\Repository\EvenementRepository;
use App\Repository\NewsRepository;
use App\Repository\TypenewsRepository;
use App\Repository\ProduitRepository;
use App\Repository\CategorieRepository;
use App\Entity\Contenuorishas;
use App\Entity\Service;
use App\Entity\Contenupartenaire;
use App\Entity\Categorie;
use App\Entity\Typenews;
use App\Entity\ProgrammeFormation;
class HomeController extends BaseController
{
/**
* @var EntityManagerInterface
*/
private $em;
public function __construct(EntityManagerInterface $em)
{
$this->em=$em;
}
/**
* @Route("/4tpm-solutions")
* @Route("/dow-jones")
* @Route("/finances-2")
* @Route("/produits")
* @Route("/references")
* @Route("/six-group")
*/
public function redirectNXPath(Request $request)
{
$path = $request->getPathInfo();
switch ($path){
case "/dow-jones":
return $this->redirectToRoute("servicefront_show", ['id' => 2]);
break;
case "/six-group":
return $this->redirectToRoute("servicefront_show", ['id' => 3]);
break;
default:
return $this->redirectToRoute("site_home");
}
}
/**
* @Route("/", name="site_home")
*/
public function index(VideoRepository $VideoRepository,
ProgrammeFormationRepository $PformationRepository,ProduitRepository $produit,
EvenementRepository $EvenementRepository,NewsRepository $NewsRepository,
ContenupartenaireRepository $Contenupartenaire): Response
{
$commentaireRepository = $this->em->getRepository(Commentaire::class);
$status=true;
$premium=true;
$date= date('Y-m-d');
return $this->render('site/home/index3.html.twig', [
'controller_name' => 'HomeController',
//'services' => $serviceRepository->FindAll(),
'produit' => $produit->FindAll(),
'programmes'=>$PformationRepository->findByPfort($status),
//'publicites' => $publiciteRepository->FindAll(),
'videosa'=>$VideoRepository->findByVA($status),
'partenaires' => $Contenupartenaire->FindAll(),
'newsimgfinance' => $NewsRepository->findBynewsimg($status),
'evenements' => $EvenementRepository->findByCEA($status,$date),
'commentaires'=>$commentaireRepository->findAll(),
'newsfinance' => $NewsRepository->findBynewsA($status),
]);
}
/**
* ("/service", name="show_service")
*/
public function showService()
{
return $this->render('site/services/services.html.twig', [
'title' => 'NOS SERVCES',
]);
}
/**
* ("/produit", name="show_produit")
*/
public function showProduits()
{
return $this->render('site/produits/produit.html.twig', [
'title' => 'Nom Produit',
]);
}
/**
* ("/Video", name="videotv")
*/
public function showVideotv()
{
return $this->render('site/videos/video.html.twig', [
'title' => 'Nom Produit',
]);
}
/**
* @Route("/Souscription", name="souscri")
*/
public function Souscription()
{
return $this->render('site/home/souscri.html.twig', [
//'title' => 'Nom Produit',
]);
}
}