src/Controller/HomeController.php line 30

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\User;
  4. use App\Entity\Image;
  5. use App\Entity\Channel;
  6. use App\Entity\Campagne;
  7. use App\Entity\Category;
  8. use App\Entity\Candidature;
  9. use App\Entity\EnablePhase;
  10. use App\Questionary\QuestionaryService;
  11. use Doctrine\ORM\EntityManagerInterface;
  12. use Doctrine\Persistence\ManagerRegistry;
  13. use Symfony\Component\HttpFoundation\Response;
  14. use Symfony\Component\Routing\Annotation\Route;
  15. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  16. class HomeController extends AbstractController
  17. {
  18. /*****************************************************************************************************************************************
  19.  * 
  20.  * section des vues du visiteur
  21.  * 
  22.  * ******************************************************************************************************************************************/    
  23.     // vu de la page d'accueil
  24.     #[Route('/'name'app_home')]
  25.     public function index(EntityManagerInterface $entityManager): Response{
  26.         // recuperation de la liste des chaine TV
  27.         $Channel $entityManager->getRepository(Channel::class)->findAll();
  28.         // tableau de l'ordre de filtrage
  29.         $Filtre_Tab = [
  30.             'CRTV','Crtv sports and entertainment','Crtv News','Canal 2 international',
  31.             'Canal 2 Movies','DBS TV','Balafon TV','Dash sports and entertainment',
  32.             'Dash News','LTM TV','STV TV','Info TV','My Media Prime TV','Cam 10 TV',
  33.             'Vision4 TV','Galaxie TV','Equinoxe TV'
  34.         ];
  35.         $Ordre_Channel = [];
  36.         for ($i=0$i count($Filtre_Tab) ; $i++) { 
  37.             // organisation
  38.             for ($a=0$a count($Channel); $a++) {
  39.                 // verification 
  40.                 if( $Filtre_Tab[$i] === $Channel[$a]->getName() ) array_push($Ordre_Channel,$Channel[$a]);
  41.             }
  42.         }
  43.         // recuperation de la liste des Candidature
  44.         $Candidature $entityManager->getRepository(Candidature::class)->findAll();
  45.         // recuperation des donnees d'affichage
  46.         $Data = [
  47.             ['icon'=>'bi bi-play-btn','number'=>16,'name'=>'CHAINES ELIGIBLES'],
  48.             ['icon'=>'bi bi-award','number'=>05 ,'name'=>'PRIX SPECIAUX'],
  49.             ['icon'=>'bi bi-fast-forward-circle','number'=>32,'name'=>'CATEGORIES'],
  50.             ['icon'=>'bi bi-person-video3','number'=>count($Candidature),'name'=>'NOMMES'], 
  51.            ];
  52.         // renvois de la vue
  53.         return $this->render('home/home.html.twig', [
  54.             'title'=>'Liste des Categories',
  55.             'data'=>$Data,
  56.             'Channel'=>$Ordre_Channel
  57.         ]);
  58.     }
  59.     // vu de la liste des chaines
  60.     #[Route('/get/channel'name'get_channel')]
  61.     public function Channel(EntityManagerInterface $entityManager): Response{
  62.         // recuperation de la liste des chaine TV
  63.         $Channel $entityManager->getRepository(Channel::class)->findAll();
  64.         // tableau de l'ordre de filtrage
  65.         $Filtre_Tab = [
  66.             'CRTV','Crtv sports and entertainment','Crtv News','Canal 2 international',
  67.             'Canal 2 Movies','DBS TV','Balafon TV','Dash sports and entertainment',
  68.             'Dash News','LTM TV','STV TV','Info TV','My Media Prime TV','Cam 10 TV',
  69.             'Vision4 TV','Galaxie TV','Equinoxe TV'
  70.         ];
  71.         $Ordre_Channel = [];
  72.         for ($i=0$i count($Filtre_Tab) ; $i++) { 
  73.             // organisation
  74.             for ($a=0$a count($Channel); $a++) {
  75.                 // verification 
  76.                 if( $Filtre_Tab[$i] === $Channel[$a]->getName() ) array_push($Ordre_Channel,$Channel[$a]);
  77.             }
  78.         }
  79.         // renvois de la vue
  80.         return $this->render('home/channel.html.twig', [
  81.             'title'=>'Chaines Eligibles',
  82.             'element'=>$Ordre_Channel
  83.         ]);
  84.     }
  85.     // recuperation de toute les sous caterogies
  86.     #[Route('/all/sub-category'name'all_sub_category')]
  87.     public function GetAllSubCategorie(EntityManagerInterface $entityManager): Response{
  88.         // recuperaton de la compagne active
  89.         $SubCategory $entityManager->getRepository(Category::class)->findAll();   
  90.         // renvois de la vue
  91.         return $this->render('home/sub_category.html.twig', [
  92.             'element' =>  $SubCategory,
  93.             'link'=>'Listcanditure_form_id',
  94.             'title'=> ['les CTA','Liste des Categories']
  95.         ]);
  96.     }
  97.     // recuperation de toute les caterogies
  98.     #[Route('/story_tv'name'story_tv')]
  99.     public function GetStoryTV(): Response{    
  100.         // renvois de la vue
  101.         return $this->render('home/story_tv.html.twig', [
  102.             'title'=> ['les CTA','L’AUBE DE LA TÉLÉVISION CAMEROUNAISE']
  103.         ]);
  104.     }
  105.      // vu de la page about
  106.      #[Route('/about'name'about')]
  107.      public function Page_About(): Response{
  108.         // recuperation des donnees d'affichage
  109.          $Data = [
  110.           ['icon'=>'bi bi-play-btn','number'=>13,'name'=>'CHAINES ELIGIBLES'],
  111.           ['icon'=>'bi bi-tv','number'=>14,'name'=>'CATEGORIES'],
  112.           ['icon'=>'bi bi-fast-forward-circle','number'=>34,'name'=>'SOUS-CATEGORIES'],
  113.           ['icon'=>'bi bi-person-video3','number'=>100,'name'=>'CANDIDATURE'], 
  114.          ];
  115.          // renvois de la vue
  116.          return $this->render('home/about.html.twig', [
  117.             'title'=>"A PROPOS DE L'EVENEMENT",
  118.             'data'=>$Data
  119.          ]);
  120.      }
  121.      
  122.      // vu de la page du patronage
  123.      #[Route('/patronage'name'patronage')]
  124.      public function Page_MineCom(): Response{
  125.          // renvois de la vue
  126.          return $this->render('home/mincom.html.twig', ['title'=>"MINISTERE DE LA COMMUNICATION",]);
  127.      }
  128.       // vu de la page pour le live
  129.       #[Route('/live'name'live')]
  130.       public function Page_CT_live(): Response{
  131.           // renvois de la vue
  132.           return $this->render('home/live.html.twig', ['title'=>"Live CTA",]);
  133.       }
  134.  
  135.      // vu de la page du Cameroon
  136.      #[Route('/cameroon'name'cameroon')]
  137.      public function Page_Cameroon(): Response{
  138.          // renvois de la vue
  139.          return $this->render('home/cameroun.html.twig', ['title'=>"A Propos du Cameroun",]);
  140.      }
  141.      // vu de la page du palis des sport de yaounde
  142.      #[Route('/palais_sport'name'palais_sport')]
  143.      public function Page_Palais_sport(): Response{
  144.          // renvois de la vue
  145.          return $this->render('home/palais_sport.html.twig', [
  146.             'title'=>"Le palais des Sport de Yaounde",
  147.              'Palais' => ['Palais-1.jpg','Palais-2.jpg','Palais-3.jpg']
  148.         ]);
  149.      }
  150.     // vu de la page a Propos de Yaounde
  151.     #[Route('/yaounde'name'yaounde')]
  152.     public function Page_Yaounde(): Response{
  153.           // renvois de la vue
  154.           return $this->render('home/yaounde.html.twig',
  155.            [
  156.             'title'=>"A Propos de Yaounde",
  157.              'Yde_img'=> ['yde-1.jpg','yde-2.jpg','yde-3.webp']
  158.             ]
  159.         );
  160.     }
  161.     // vu de la page a Propos de  Maraboo
  162.     #[Route('/maraboo'name'maraboo')]
  163.     public function Page_Maraboo(): Response{
  164.           // renvois de la vue
  165.           return $this->render('home/maraboo.html.twig', ['title'=>"A Propos de Maraboo",]);
  166.     }
  167.     
  168.      // recuperation des candidatures du CTA FormA
  169.      #[Route('/Listcanditure/form_a/{id}'name'Listcanditure_form_id')]
  170.      public function List_CandituresFormsA(EntityManagerInterface $entityManager$id): Response{
  171.          // recuperation de la campagne de vote
  172.          $Candidature =  $entityManager->getRepository(Category::class)->find($id);
  173.          // renvois de la vue
  174.          return $this->render('home/list_candidature.html.twig', [
  175.              'Candidatures' =>  $Candidature->getCandidatures(),
  176.              'Description' =>$Candidature->getCampagne(),
  177.              'Enable_vote' => true,
  178.              'title'=>['Categorie',"Categorie {$Candidature->getName()}",'Liste des Candidatures']
  179.          ]);
  180.      }
  181.     //  function des liste des sous categorie vu par un visiteur
  182.     #[Route('/SubCategory/{id}'name'SubCategory_id')]
  183.     public function Home_Consult_SubCategoryOfCategoryVisitor(EntityManagerInterface $entityManager,int $id): Response{
  184.         // recuperation des sous categorie de vote
  185.         $Sub_Category =  $entityManager->getRepository(Campagne::class)->find($id);
  186.         //  renvois a la vue des sous categorie
  187.         return $this->render('home/sub_category.html.twig', [
  188.             'element' => $Sub_Category->getCategories(),
  189.             'title'=>['Categorie',"Categorie {$Sub_Category->getName()}",'Liste des Categories']
  190.         ]);
  191.     }
  192.      // recuperation des informations utils
  193.      #[Route('/utils'name'utils')]
  194.      public function GetInfoUtils(): Response{
  195.          // recuperaton de la compagne active
  196.          $Utils = [
  197.             ['hotel'=>'HILTON HOTEL','img'=>'logo_hotel_8.png','link'=>'https://www.hilton.com/'],
  198.             ['hotel'=>'LA FALAISE HOTEL','img'=>'logo_hotel_7.png','link'=>'https://www.lafalaisebonapriso.com/'],
  199.             ['hotel'=>'DJEUGA PALACE','img'=>'logo_hotel_4.png','link'=>'https://www.djeuga.com/'],
  200.             ['hotel'=>'SOMATEL HOTEL','img'=>'logo_hotel_6.png','link'=>'https://somatelhotel.com/'],
  201.             ['hotel'=>'BOUM’S HOTEL','img'=>'logo_hotel_2.png','link'=>'https://www.bounshotels.com/index.php'],
  202.             ['hotel'=>'MERINA HOTEL','img'=>'logo_hotel_1.png','link'=>'https://hotel-merina.com/fr'],
  203.             ['hotel'=>'FRANCO HOTEL','img'=>'logo_hotel_3.png','link'=>'https://www.hotel-franco.com/'],
  204.             ['hotel'=>'PRODIGES HOTEL','img'=>'logo_hotel_5.png','link'=>'https://prodigeshotel.com/fr/']
  205.          ];  
  206.          // renvois de la vue
  207.          return $this->render('home/utils.html.twig', [
  208.              'element' =>  $Utils,
  209.              'title'=> 'Liste des Information utils'
  210.          ]);
  211.      }
  212.  
  213.      
  214.      //  function des detaille sur une candidature cote visiteur
  215.      #[Route('/consult/detail/candidate/{id}'name'consult_detail_candidate')]
  216.      public function Home_Detail_Candidate(EntityManagerInterface $entityManager,int $id): Response
  217.      {
  218.          // recuperation de la campagne de vote
  219.          $Candidature =  $entityManager->getRepository(Candidature::class)->find($id);
  220.          // recuperation de la campagne de vote
  221.          $AllCandidature =  $entityManager->getRepository(Candidature::class)->findBy(["Category"=>$Candidature->getCategory()]);
  222.          // recuperation de l'activation des votes de la premiere phase
  223.          $Enable_vote =   $entityManager->getRepository(EnablePhase::class)->findAll()[0];
  224.          // verification si la candidature exite toujours
  225.          if( $Candidature === null ){
  226.             $this->addFlash('error_user_exist',"cette utilisateur n'existe pas ou viens d'etre supprimer!");   
  227.          }
  228.          // recuperation de la liste de question
  229.          $Questionary = new QuestionaryService();
  230.         return $this->render('home/detail_candidature.html.twig', [
  231.             'Candidature' => $Candidature,
  232.             'Questionary' =>  $Questionary->OnGetQuestionaryVote(),
  233.             'AllCandidature' => $AllCandidature,
  234.             'Enable_vote' => $Enable_vote->isPhaseOne(),
  235.             'AllVote'=>$Enable_vote,
  236.             'first_tour'=>true,
  237.             'title'=>"Candidature {$Candidature->getName()}"
  238.         ]);
  239.     }
  240.  
  241.     //  function des detaille sur une candidature cote visiteur pour la 2e phase
  242.     #[Route('/consult/detail/candidate/phase_two/{id}'name'consult_detail_candidate_phase_two')]
  243.     public function Home_Detail_Candidate_PhaseTwo(EntityManagerInterface $entityManager,int $id): Response
  244.     {
  245.         // recuperation de la candidature de vote
  246.         $Candidature =  $entityManager->getRepository(Candidature::class)->find($id);
  247.         // recuperation de la category de vote
  248.         $Category =  $entityManager->getRepository(Category::class)->find($Candidature->getCategory()->getId());
  249.         // recuperation de l'activation des votes de la premiere phase
  250.         $Enable_vote =   $entityManager->getRepository(EnablePhase::class)->findAll()[0];
  251.         // verification si la candidature exite toujours
  252.         if( $Candidature === null ){
  253.             $this->addFlash('error_user_exist',"cette utilisateur n'existe pas ou viens d'etre supprimer!");   
  254.         }
  255.         // liste des vote par candidature
  256.         $all_vote = [];
  257.         // liste des candidatures definitive
  258.         $Def_Candidature = [];
  259.         // boucle et ajout des votes
  260.         for ($i0$i count($Category->getCandidatures()) ; $i++)  {
  261.             count($Category->getCandidatures()[$i]->getVote()) !== ?  
  262.             array_push($all_vote,count($Category->getCandidatures()[$i]->getVote())) : null;
  263.          }
  264.          // filtre en decroissance du tableau
  265.          rsort($all_vote,SORT_NUMERIC);
  266.          // recuperation de la classification 
  267.          for ($o 0$o count($all_vote); $o++) { 
  268.              // verification si cela est dasn l'interval permis
  269.              for ($a 0$a count($Category->getCandidatures()) ; $a++) { 
  270.                  // verification s'il existe   
  271.                  if( count($Category->getCandidatures()[$a]->getVote()) === $all_vote[$o]  ){
  272.                      // recuperation de la candidature 
  273.                      array_push($Def_Candidature,$Category->getCandidatures()[$a]);    
  274.                  }
  275.              }    
  276.          }
  277.          // recuperation de la liste limite
  278.          $Limit_Cand = [];
  279.          for ($k=0$k $Category->getNumber(); $k++) {
  280.              if( count($Def_Candidature) >= $k ) !in_array($Def_Candidature[$k],$Limit_Cand,true) ? array_push($Limit_Cand,$Def_Candidature[$k]):null;
  281.          }
  282.          // renvois de la vue
  283.          return count($Limit_Cand) === $this->redirectToRoute('app_home'):
  284.          $this->render('home/detail_candidature.html.twig', [
  285.             'Candidature' => $Candidature,
  286.             'AllCandidature' => $Limit_Cand,
  287.             'Enable_vote' => $Enable_vote->isPhaseTwo(),
  288.             'AllVote'=>$Enable_vote,
  289.             'first_tour'=>false,
  290.             'title'=>"Candidature {$Candidature->getName()}"
  291.          ]); 
  292.     }
  293.     // function recuperation des candidatures du second tour
  294.     #[Route('/Listcanditure/second_tour/{id}'name'Listcanditure_second_tour_id')]
  295.     public function Listcanditure_SecondTour(EntityManagerInterface $entityManager$id): Response{
  296.         // recuperation de la campagne de vote
  297.         $Candidature =  $entityManager->getRepository(Category::class)->find($id);
  298.         // recuperation des candidatures
  299.         $Candidature->getCandidatures();
  300.         // liste des vote par candidature
  301.         $all_vote = [];
  302.         // liste des candidatures definitive
  303.         $Def_Candidature = [];
  304.         // boucle et ajout des votes
  305.         for ($i0$i count($Candidature->getCandidatures()) ; $i++)  {
  306.            count$Candidature->getCandidatures()[$i]->getVote()) !== ?  
  307.            array_push($all_vote,count($Candidature->getCandidatures()[$i]->getVote())) : null;
  308.         }
  309.         // filtre en decroissance du tableau
  310.         rsort($all_vote,SORT_NUMERIC);
  311.         // recuperation de la classification 
  312.         for ($o 0$o count($all_vote); $o++) { 
  313.             // verification si cela est dasn l'interval permis
  314.             for ($a 0$a count($Candidature->getCandidatures()) ; $a++) { 
  315.                 // verification s'il existe   
  316.                 if( count($Candidature->getCandidatures()[$a]->getVote()) === $all_vote[$o]  ){
  317.                     // recuperation de la candidature
  318.                     array_push($Def_Candidature,$Candidature->getCandidatures()[$a]);      
  319.                 }
  320.             }    
  321.         }
  322.         // recuperation de la liste limite
  323.         $Limit_Cand = [];
  324.         for ($k=0$k $Candidature->getNumber(); $k++){
  325.              if( count($Def_Candidature) >= $k ) !in_array($Def_Candidature[$k],$Limit_Cand,true) ? array_push($Limit_Cand,$Def_Candidature[$k]):null;
  326.          }
  327.         // renvois de la vue
  328.         return count($Limit_Cand) === $this->redirectToRoute('app_home'):
  329.         $this->render('home/list_candidature.html.twig', [
  330.             'Candidatures' =>  $Limit_Cand,
  331.             'Description' => $Candidature->getCampagne(),
  332.             'Enable_vote' => false,
  333.             'title'=>['Categorie',"Categorie {$Candidature->getName()}",'Liste des Candidatures']
  334.         ]);   
  335.     }
  336.     
  337.     // function recuperation des categories du second tour
  338.     #[Route('/all_category/second_tour'name'all_category_second_tour')]
  339.     public function Categorie_SecondTour(EntityManagerInterface $entityManager): Response{
  340.         // recuperaton de la compagne active
  341.         $SubCategory $entityManager->getRepository(Category::class)->findAll(); 
  342.         // liste des candidatures definitive
  343.         $Def_Categorie = [];
  344.         // boucle
  345.         for ($i=0$i count($SubCategory) ; $i++) { 
  346.             // liste des vote par candidature
  347.             $all_vote $this->GetAllOfNomines($SubCategory[$i]);
  348.             // filtre en decroissance du tableau
  349.             rsort($all_vote,SORT_NUMERIC);
  350.             // verification si cela est dasn l'interval permis
  351.             for ($a=0$a $SubCategory[$i]->getNumber() ; $a++) { 
  352.                 // verification s'il existe 
  353.                 $number_vote =  count($SubCategory[$i]->getCandidatures()[$a]->getVote()); 
  354.                 if( in_array($number_vote$all_vote) && $number_vote 0){
  355.                     // recuperation de la categorie
  356.                     if( !in_array($SubCategory[$i],$Def_Categorie) ) array_push($Def_Categorie,$SubCategory[$i]);       
  357.                 }
  358.             }
  359.             // renvois des categories lister de la 2e phase   
  360.             if(  count($SubCategory) === ( $i ) ){
  361.                 // renvois de la vue
  362.                 return $this->render('home/sub_category.html.twig', [
  363.                     'element' =>  $Def_Categorie,
  364.                     'link'=>'Listcanditure_second_tour_id',
  365.                     'title'=> ['les CTA','Suivie des votes']
  366.                 ]);
  367.             }    
  368.         }
  369.         // retour vers la home page
  370.         return $this->redirectToRoute('app_home');     
  371.     }
  372.     // function de recuperation du nombre des votes par candidatures
  373.     private function GetAllOfNominesCategory $Candidature):Array{
  374.         $all_vote = [];
  375.         // boucle
  376.         for ($i0$i count($Candidature->getCandidatures()) ; $i++) {
  377.             // ajout des votes
  378.             array_push($all_vote,count($Candidature->getCandidatures()[$i]->getVote()));
  379.         }
  380.         return $all_vote;
  381.     }
  382.    
  383.     // functions access au categorie de vote
  384.     #[Route('/get_categorie_vote'name'get_categorie_vote')]
  385.     public function GetCategoriesVote(EntityManagerInterface $entityManager): Response{
  386.           // recuperation de l'activation des votes de la premiere phase
  387.           $Enable_vote =   $entityManager->getRepository(EnablePhase::class)->findAll()[0];
  388.          // redirection vers la categorie respective   
  389.           return $Enable_vote->isPhaseTwo() ? 
  390.           $this->redirectToRoute('all_category_second_tour') :  
  391.           $this->redirectToRoute('all_sub_category'); 
  392.     }
  393.    
  394. /******************************************************************************************************************************
  395.  * 
  396.  * fin section des vues du visiteur
  397.  * 
  398.  * *****************************************************************************************************************************/  
  399.  
  400.       // function recuperation de tout les categorie
  401.       #[Route('/admin/consult/campagne'name'consult_campagne')]
  402.       public function Home_Consult_Categorie(EntityManagerInterface $entityManager): Response
  403.       {
  404.           $repository $entityManager->getRepository(Campagne::class);
  405.           $categorie $repository->findAll();
  406.           return $this->render('dashboard/home_consult_campagne.html.twig', [
  407.             'Campagne' => $categorie,
  408.           ]);
  409.       }
  410.   
  411.   
  412.      
  413.     // function activation et desactivation d'une categorie
  414.     #[Route('/admin/valid/campagne/{id}'name'valid_campagne_id')]
  415.     public function CheckedAndUncheck_Categorie(int $id,ManagerRegistry $manager): Response
  416.     {
  417.         // verification du paramettre
  418.         if(!(int)$id){
  419.             $this->addFlash('error_not_params',"Oups! une erreur inhabituel s'est produite");
  420.             return $this->redirectToRoute('consult_profil');
  421.         }
  422.         $categorie_check $manager->getRepository(Campagne::class)->find($id);
  423.         // verification de l'identite unique
  424.         if( $categorie_check === null ){
  425.             $this->addFlash('error_campagne_exist',"cette campagne n'existe pas ou viens d'etre supprimer!");
  426.             return $this->redirectToRoute('consult_campagne');
  427.         }
  428.         // changement du statut de la campagne
  429.         $categorie_check->setStatus(!$categorie_check->isStatus());
  430.         $manager->getManager()->flush();
  431.         return $this->redirectToRoute('consult_campagne');
  432.     }
  433.  
  434.     // function recuperation de tout les utilisateurs
  435.     #[Route('/admin/consult/profil'name'consult_profil')]
  436.     public function Home_Consult_Profil(EntityManagerInterface $entityManager): Response
  437.     {
  438.         $repository $entityManager->getRepository(User::class);
  439.         $Admin $repository->findAll();
  440.         return $this->render('dashboard/home_consult_profil.html.twig', [
  441.           'Admin' => $Admin,
  442.         ]);
  443.     }
  444.     // function mise a jour des informations d'un utilisateur
  445.     #[Route('/admin/valid/profil/{id}'name'valid_profil_id')]
  446.     public function CheckedAndUncheck_Profil(int $id,ManagerRegistry $manager): Response
  447.     {
  448.         // verification du paramettre
  449.         if(!(int)$id){
  450.             $this->addFlash('error_not_params',"Oups! une erreur inhabituel s'est produite");
  451.             return $this->redirectToRoute('consult_profil');
  452.         }
  453.         $repository $manager->getRepository(User::class);
  454.         $user_check $repository->find($id);
  455.         // verification de l'identite unique
  456.         if( $user_check === null ){
  457.             $this->addFlash('error_user_exist',"cette utilisateur n'existe pas ou viens d'etre supprimer!");
  458.             return $this->redirectToRoute('consult_profil');
  459.         }
  460.         // changement du statut de l'utilisateur
  461.         $user_check->setStatut(!$user_check->isStatut());
  462.         $manager->getManager()->flush();
  463.         return $this->redirectToRoute('consult_profil');
  464.     }
  465.       // function recuperation de tout les sous categorie
  466.       #[Route('/admin/consult/sub-categorie'name'consult_subcategorie')]
  467.       public function Home_Consult_AllSubCategory(EntityManagerInterface $entityManager): Response
  468.       {
  469.           $repository $entityManager->getRepository(Category::class);
  470.           $Categorie $repository->findAll();
  471.           return $this->render('dashboard/home_consult_categorie.html.twig', [
  472.             'Sub_Category' => $Categorie,
  473.           ]);
  474.       }
  475.   
  476.     //  function des liste de candidature cote admin
  477.     #[Route('/admin/consult/campagne/candidate/{id}'name'consult_campagne_candidate')]
  478.     public function Home_Consult_Candidate(EntityManagerInterface $entityManager,int $id): Response
  479.     {
  480.         // recuperation de la campagne de vote
  481.         $Campagne =  $entityManager->getRepository(Category::class)->find($id)->getCandidatures();
  482.         // renvois de  la liste des candidature a la vue
  483.         return $this->render('dashboard/home_consult_candidate.html.twig', ['Candidature' => $Campagne]);
  484.     }
  485.      //  function des liste des sous categorie
  486.      #[Route('/admin/consult/SubCategory/{id}'name'consult_SubCategory_id')]
  487.      public function Home_Consult_SubCategoryOfCategoryAdmin(EntityManagerInterface $entityManager,int $id): Response
  488.      {
  489.          // recuperation des sous categorie de vote
  490.          $Sub_Category =  $entityManager->getRepository(Campagne::class)->find($id);
  491.          //  renvois a la vue des sous categorie
  492.          return $this->render('dashboard/home_consult_categorie.html.twig', ['Sub_Category' => $Sub_Category->getCategories()]);
  493.      }
  494.  
  495.     // function de la page dashbord
  496.     #[Route('/admin/dashbord'name'home_dashbord')]
  497.     public function Home_Consult_Vote(EntityManagerInterface $entityManager): Response
  498.     {
  499.         // recuperation de l'activation des votes de la premiere phase
  500.         $Enable_vote =   $entityManager->getRepository(EnablePhase::class)->findAll()[0];
  501.         return $this->render('dashboard/index.html.twig', [
  502.             'Enable_vote' => $Enable_vote,
  503.         ]);
  504.     }
  505.     
  506.       // function recuperation de tout les Chaines
  507.       #[Route('/admin/consult/channel'name'consult_channel')]
  508.       public function Home_Consult_Channel(EntityManagerInterface $entityManager): Response
  509.       {
  510.           $repository $entityManager->getRepository(Channel::class);
  511.           $Channel $repository->findAll();
  512.           return $this->render('dashboard/home_consult_channel.html.twig', [
  513.             'Channel' => $Channel,
  514.           ]);
  515.       }
  516.       // function recuperation de tout les Images
  517.       #[Route('/admin/consult/image'name'consult_image')]
  518.       public function Home_Consult_Images(EntityManagerInterface $entityManager): Response
  519.       {
  520.           $repository $entityManager->getRepository(Image::class);
  521.           $Images $repository->findAll();
  522.           return $this->render('dashboard/home_consult_image.html.twig', [
  523.             'Images' => $Images,
  524.           ]);
  525.       }
  526.       // function recuperation de tout les Chaines
  527.       #[Route('/test'name'test')]
  528.       public function PageTest(EntityManagerInterface $entityManager): Response
  529.       {
  530.            
  531.           return $this->render('home/detail_candidature.html.twig', [
  532.             'title'=>"A propos de l'Evement",
  533.           ]);
  534.       }
  535.   
  536.   
  537.   
  538. }