src/Controller/Backend/AbstractsController.php line 131

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Backend;
  3. use App\Entity\Abstractt;
  4. use App\Entity\AuteurAbstract;
  5. use App\Form\Abstractt\ajoutAbstracttType;
  6. use App\Form\Abstractt\modifAbstracttType;
  7. use App\Form\Abstractt\SoumissionType;
  8. use App\Form\AuteurAbstract\AuteurAbstractType;
  9. use App\Repository\AbstracttRepository;
  10. use App\Repository\AuteurAbstractRepository;
  11. use App\Repository\CongresRepository;
  12. use App\Repository\PaysRepository;
  13. use Doctrine\ORM\EntityManagerInterface;
  14. use App\Repository\UserRepository;
  15. use DatePeriod;
  16. use DateTime;
  17. use Dompdf\Dompdf;
  18. use App\Entity\AbstractInscription;
  19. use App\Repository\AbstractInscriptionRepository;
  20. use Dompdf\Options;
  21. use Knp\Component\Pager\PaginatorInterface;
  22. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  23. use Symfony\Component\HttpFoundation\File\File;
  24. use Symfony\Component\HttpFoundation\JsonResponse;
  25. use Symfony\Component\HttpFoundation\Request;
  26. use Symfony\Component\HttpFoundation\Response;
  27. use Symfony\Component\Routing\Annotation\Route;
  28. use Symfony\Component\HttpFoundation\RequestStack;
  29. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  30. class AbstractsController extends AbstractController
  31. {
  32.     /**
  33.      * @var AbstracttRepository
  34.      */
  35.     private $repository;
  36.     public function __construct(AbstracttRepository $repository)
  37.     {
  38.         $this->repository = $repository;
  39.     }
  40.     /**
  41.      * @Route("/admin/abstractsIndex", name="tous_abstracts")
  42.      */
  43.     public function findAll(Request $request, EntityManagerInterface $em, PaginatorInterface $paginator, UserRepository $userRepository, CongresRepository $congresRepository)
  44.     {
  45.         $abstract = new Abstractt();
  46.         $users = $userRepository->findAll();
  47.         $congres = $congresRepository->findAll();
  48.         $currentDate = new DateTime();
  49.         $form = $this->createForm(ajoutAbstracttType::class, $abstract);
  50.         $form->handleRequest($request);
  51.         if ($form->isSubmitted() && $form->isValid()) {
  52.             $em->persist($abstract);
  53.             $em->flush();
  54.             return $this->redirectToRoute('tous_abstracts');
  55.         }
  56.         $abstracts = $this->repository->findAllDesc();
  57.         return $this->render('backend/abstracts/abstracts.html.twig', array('form' => $form->createView(), 'abstracts' => $abstracts,'users'=>$users,'congres'=>$congres,'currentDate'=>$currentDate));
  58.     }
  59.      /**
  60.      * @Route("/user/abstractsIndexUser", name="abstractsUser")
  61.      */
  62.     public function findAllAbstractUser(Request $request, AbstracttRepository $abstracttRepository, PaginatorInterface $paginator)
  63.     {
  64.         $user = $this->container->get('security.token_storage')->getToken()->getUser();
  65.         $abstracts = $abstracttRepository->findBy(['emailCorrespondant'=>$user->getEmail()]);
  66.         $tousabstracts= $abstracttRepository->findAll();
  67.         return $this->render('backend/abstracts/abstractsUser.html.twig', array('abstracts' => $abstracts,'tousabstracts'=>$tousabstracts));
  68.     }
  69.     /**
  70.      * @Route("/admin/auteurIndex", name="auteurs_index")
  71.      */
  72.     public function findAllAuteurs(Request $request, EntityManagerInterface $em, AuteurAbstractRepository $repository)
  73.     {
  74.         $auteurAbstract = new AuteurAbstract();
  75.         $form = $this->createForm(AuteurAbstractType::class, $auteurAbstract);
  76.         $form->handleRequest($request);
  77.         $auteurAbstract = $repository->findAll();
  78.        
  79.         return $this->render('backend/auteurAbstract/auteurAbstract.html.twig', array('form' => $form->createView(), 'auteurs' => $auteurAbstract));
  80.     }
  81.     /**
  82.      * @Route("/modifierAbstract/{id}", name="modifier_abstract")
  83.      * @param Abstractt $abstract
  84.      * @param Request $request
  85.      * @return \Symfony\Component\HttpFoundation\Response
  86.      */
  87.     public function editer(Abstractt $abstract, Request $request, $id, EntityManagerInterface $em, AbstracttRepository $repository)
  88.     {
  89.         $abstract = $repository->find($id);
  90.         $form = $this->createForm(modifAbstracttType::class, $abstract);
  91.         $form->handleRequest($request);
  92.         $abstracts = $this->repository->findAll();
  93.         if ($form->isSubmitted() && $form->isValid()) {
  94.             $em->flush();
  95.             //    $this->addFlash('success','user modifié avec succès!');
  96.             return $this->redirectToRoute('tous_abstracts');
  97.         }
  98.         return $this->render('backend/abstracts/edit.html.twig', array('form' => $form->createView(), 'abstracts' => $abstracts));
  99.     }
  100.     /**
  101.      * @Route("/admin/ajoutAbstract", name="ajouter_abstract")
  102.      */
  103.     public function ajoutAbstact(Request $request, EntityManagerInterface $em)
  104.     {
  105.         $abstract = new Abstractt();
  106.         $form = $this->createForm(SoumissionType::class, $abstract);
  107.         $form->handleRequest($request);
  108.         if ($form->isSubmitted() && $form->isValid()) {
  109.             $abstract->setStatut("en attente");
  110.             $abstract->setDateSoumission(new \DateTime('now'));
  111.             foreach ($abstract->getAuteur() as $auteur) {
  112.                 $auteur->setAbstractt($abstract);
  113.             }
  114.             $em->persist($abstract);
  115.             $em->flush();
  116.             return $this->redirectToRoute('tous_abstracts');
  117.         }
  118.         return $this->render('backend/abstracts/add.html.twig', array('form' => $form->createView()));
  119.     }
  120.     /**
  121.      * @Route("{id}/soumettreabstract", name="soumettre_abstract")
  122.      */
  123.     public function soumettreAbstract($id,Request $request, EntityManagerInterface $em, CongresRepository $congresRepository, PaysRepository $paysRepository, RequestStack $requestStack, SessionInterface $session, AbstractInscriptionRepository $abstractInscriptionRepository)
  124.     {
  125.         
  126.         if ($session->has('user_abstract')){
  127.         $abstract = new Abstractt();
  128.         $user = $abstractInscriptionRepository->findOneBy(['id'=>$session->has('user_abstract')]);
  129.         $congres = $congresRepository->findOneBy(['id'=>$id]);
  130.         
  131.         $dateNow=new \DateTime('now');
  132.         // $congresDuAnnee = $congresrepository->findOneByDateDebut($dateNow);
  133.         
  134.         $form = $this->createForm(SoumissionType::class, $abstract);
  135.         $form->handleRequest($request);
  136.         if ($form->isSubmitted() && $form->isValid()) {
  137.             $abstract->setStatut("en attente");
  138.             $abstract->setUser($user);
  139.             $abstract->setDateSoumission(new \DateTime('now'));
  140.             
  141.             foreach ($abstract->getAuteur() as $auteur) {
  142.                 $auteur->setAbstractt($abstract);
  143.             }
  144.             $abstract->setCongres($congres);
  145.             // $abstract->setUser($congres);
  146.             $em->persist($abstract);
  147.             $em->flush();
  148.             if($request->getLocale()=='fr'){
  149.                 $this->addFlash('success','Votre abstract a soumis avec succès. Vous recevrez un e-mail après décision du comité scientifique');
  150.             }
  151.             elseif($request->getLocale()=='en'){
  152.                 $this->addFlash('success','Your abstract has been successfully submitted. You will receive a e-mail after decision of the scientific committee');
  153.             }
  154.             $to      = 'urotunisia22@gmail.com';
  155.             $subject = "ATU - Abstract submission";
  156.             $headers = "MIME-Version: 1.0\r\n";
  157.             $headers .= "Content-type: text/html; charset=UTF-8\r\n";
  158.             $headers .= 'From: contact@urotunisia.com' . "\r\n" .
  159.             'Reply-To: contact@urotunisia.com' . "\r\n" .
  160.             'X-Mailer: PHP/' . phpversion();
  161.             // $template= new TwigEngine();
  162.             $message = "<div align='center'><img src='http://urotunisia.com/front-assets/assets/img/logo1.png' width='40%' class='img-responsive center-block' align='center'></div><h4>Dear Dr ".$abstract->getNomAuteurCorrespondant()." ".$abstract->getPrenomAuteurCorrespondant()."!</h4><p>We inform you that we received your abstract <strong> ".$abstract->getTitle()."</strong></p>
  163.             <p>It will  be submitted to the scientific committee.</p>
  164.             <p>The decision will be sent to you by e-mail</p>
  165.             <p>We remain at your disposal for any further information.</p>
  166.             <p><br />Best regards, <br />Le secrétariat de l'ATU</p><br><br>
  167.             <h4>Cher Dr ".$abstract->getNomAuteurCorrespondant()." ".$abstract->getPrenomAuteurCorrespondant()."!</h4><p>Nous vous informons que nous avons reçu votre résumé <strong> ".$abstract->getTitle()."</strong></p>
  168.             <p>Il sera soumis au comité scientifique.</p>
  169.             <p>La décision vous sera envoyée par e-mail</p>
  170.             <p>Nous restons à votre disposition pour toute information complémentaire.</p>
  171.             <p><br />Bien à vous, <br />Le secrétariat de l'ATU</p>";
  172.             mail($to, $subject, $message, $headers);
  173.             $to      = $abstract->getEmailCorrespondant();
  174.             $subject = "ATU - Abstract submission";
  175.             $headers = "MIME-Version: 1.0\r\n";
  176.             $headers .= "Content-type: text/html; charset=UTF-8\r\n";
  177.             $headers .= 'From: contact@urotunisia.com' . "\r\n" .
  178.             'Reply-To: contact@urotunisia.com' . "\r\n" .
  179.             'X-Mailer: PHP/' . phpversion();
  180.             // $template= new TwigEngine();
  181.             $message = "<div align='center'><img src='http://urotunisia.com/front-assets/assets/img/logo1.png' width='40%' class='img-responsive center-block' align='center'></div><h4>Cher Dr ".$abstract->getNomAuteurCorrespondant()." ".$abstract->getPrenomAuteurCorrespondant()."!</h4><p>Nous vous informons que nous avons reçu votre résumé <strong> ".$abstract->getTitle()."</strong></p>
  182.             <p>Il sera soumis au comité scientifique.</p>
  183.             <p>La décision vous sera envoyée par E mail</p>
  184.             <p>Nous restons à votre disposition pour toute information complémentaire.</p>
  185.             <br /><br />Bien cordialement, <br />Le secrétariat de l'ATU</p><br><br>
  186.             <h4>Dear Dr ".$abstract->getNomAuteurCorrespondant()." ".$abstract->getPrenomAuteurCorrespondant()."!</h4><p>We inform you that we received your abstract <strong> ".$abstract->getTitle()."</strong></p>
  187.             <p>It will  be submitted to the scientific committee.</p>
  188.             <p>The decision will be sent to you by E mail</p>
  189.             <p>We remain at your disposal for any further information.</p>
  190.             <br /><br />Best regards, <br />The ATU secretariat</p>
  191.             ";
  192.             mail($to, $subject, $message, $headers);
  193.             
  194.             return $this->redirectToRoute('congres_nationaux');
  195.         }
  196.         return $this->render('backend/abstracts/soumettre.html.twig', array('form' => $form->createView(),'congresCurrent'=>$congres,'pays' => $paysRepository->findAll(),'dateNow'=>$dateNow));
  197.         } else{
  198.             return $this->redirectToRoute('app_login_abstract');
  199.         }
  200.     }
  201.     /**
  202.      * @Route("/reviewer/abstractsIndex", name="liste_abstracts")
  203.      */
  204.     public function allAbstracts(Request $request, EntityManagerInterface $em, PaginatorInterface $paginator)
  205.     {
  206.         $abstracts = $this->repository->findAll();
  207.         
  208.         return $this->render('backend/abstracts/reviewer_abstracts.html.twig', array('abstracts' => $abstracts));
  209.     }
  210.     /**
  211.      * @Route("/reviewer/accepterabstactposter", name="accepter_Poster")
  212.      * @param Abstractt $abstract
  213.      * @param Request $request
  214.      * @return \Symfony\Component\HttpFoundation\Response
  215.      */
  216.     public function accepter_Poster(Request $request, EntityManagerInterface $em, AbstracttRepository $repository)
  217.     {
  218.         $id = $request->request->get('id');
  219.         $abstract= $repository->findOneBy(['id'=>$id]);
  220.         $abstract->setTypeFinal("poster");
  221.         $abstract->setStatut("accepter");
  222.         $em->flush();
  223.         $to      = $abstract->getEmailCorrespondant();
  224.         $subject = "ATU - Acceptance of Your Abstract - ".$abstract->getCongres()->getLabelEn();
  225.         $headers = "MIME-Version: 1.0\r\n";
  226.         $headers .= "Content-type: text/html; charset=UTF-8\r\n";
  227.         $headers .= 'From: contact@urotunisia.com' . "\r\n" .
  228.         'Reply-To: contact@urotunisia.com' . "\r\n" .
  229.         'X-Mailer: PHP/' . phpversion();
  230.         $message = "<table width='100%' border='0' cellspacing='0' cellpadding='5'>
  231.                         <tr>
  232.                             <td align='center'>
  233.                                 <table width='600' border='0' cellspacing='0' cellpadding='5'>
  234.                                     <tr><td bgcolor='#fff' align='center'><div align='center'><img src='http://urotunisia.com/front-assets/assets/img/logo1.png' width='40%' class='img-responsive center-block'></div></td></tr>
  235.                                     <tr>
  236.                                         <td valign='top' class='body'>
  237.                                             <table width='100%' border='0' cellspacing='0' cellpadding='0'>
  238.                                                 <tr>
  239.                                                     <td width='10' bgcolor='#FFFFFF'  >&nbsp;</td>
  240.                                                     <td valign='top' bgcolor='#FFFFFF' align='left'>
  241.                                                         <h4>Dear Dr. ".$abstract->getNomAuteurCorrespondant()." " .$abstract->getPrenomAuteurCorrespondant(). "!</h4><p>We are pleased to inform you that your abstract <strong> (N°".$abstract->getId().") entitled « ".$abstract->getTitle()." »</strong> has been accepted by the Scientific Committee as an electronic poster for presentation at the ".$abstract->getCongres()->getLabelEn().".</p>
  242.                                                         <p>Please note the following important recommendations for your presentation:</p>
  243.                                                         <ul>
  244.                                                             <li>Poster Type: Displayed electronic poster</li>
  245.                                                             <li>Poster Format: One single slide in portrait mode</li>
  246.                                                             <li>File Format: PPTX (PowerPoint)</li>
  247.                                                             <li>Submission Deadline: October 10th, 2026, before midnight</li>
  248.                                                         </ul>
  249.                                                         <p>Please click <a href='http://urotunisia.com/user/abstractsIndexUser'>HERE</a> to upload your poster or alternatively, you can send it directly to <a href='mailto:urotunisia22@gmail.com'>urotunisia22@gmail.com</a></p>
  250.                                                         <br/><br/>Best regards, <br/>On behalf of the TAU office.
  251.                                                         <p>&nbsp;</p>
  252.                                                     </td>
  253.                                                     <td width='10' bgcolor='#FFFFFF' >&nbsp;</td>
  254.                                                 </tr>
  255.                                             </table>
  256.                                         </td>
  257.                                     </tr>
  258.                                     
  259.                                     <tr>
  260.                                         <td valign='top' class='body'>
  261.                                             <table width='100%' border='0' cellspacing='0' cellpadding='0'>
  262.                                                 <tr>
  263.                                                     <td width='10' bgcolor='#FFFFFF'  >&nbsp;</td>
  264.                                                     <td valign='top' bgcolor='#FFFFFF' align='left'>
  265.                                                         <h4>Cher Dr ".$abstract->getNomAuteurCorrespondant()." " .$abstract->getPrenomAuteurCorrespondant(). "!</h4><p>Nous avons le plaisir de vous informer que votre résumé <strong> (N°".$abstract->getId().") intitulé « ".$abstract->getTitle()." »</strong> été accepté par le comité scientifique en tant que poster électronique dans le cadre du ".$abstract->getCongres()->getLabel().".</p>
  266.                                                         <p>Veuillez noter les recommandations importantes suivantes pour votre présentation :</p>
  267.                                                         <ul>
  268.                                                             <li>Type de poster : Poster électronique affiché</li>
  269.                                                             <li>Format du poster : Une seule diapositive en mode portrait</li>
  270.                                                             <li>Format du fichier : PPTX (PowerPoint)</li>
  271.                                                             <li>Délai d'envoi : 10 octobre 2025 avant minuit</li>
  272.                                                         </ul>
  273.                                                         <p>Veuillez cliquer <a href='http://urotunisia.com/user/abstractsIndexUser'>ICI</a> pour télécharger votre poster ou bien l'envoyer directement à l'adresse <a href='mailto:urotunisia22@gmail.com'>urotunisia22@gmail.com</a></p>
  274.                                                         <br/><br/>Cordialement, <br/>Pour le bureau de l'ATU.
  275.                                                         <p>&nbsp;</p>
  276.                                                     </td>
  277.                                                     <td width='10' bgcolor='#FFFFFF' >&nbsp;</td>
  278.                                                 </tr>
  279.                                             </table>
  280.                                         </td>
  281.                                     </tr>
  282.                                 </table>
  283.                             </td>
  284.                         </tr>
  285.                     </table>";
  286.             mail($to, $subject, $message, $headers);
  287.         //    $this->addFlash('success','user modifié avec succès!');
  288.         return new JsonResponse('abstractAcceperPoster');
  289.     }
  290.     /**
  291.      * @Route("/reviewer/accepterabstactvideo", name="accepter_Video")
  292.      * @param Abstractt $abstract
  293.      * @param Request $request
  294.      * @return \Symfony\Component\HttpFoundation\Response
  295.      */
  296.     public function acceptervideo(Request $request, EntityManagerInterface $em, AbstracttRepository $repository)
  297.     {
  298.         $id = $request->request->get('id');
  299.         $abstract= $repository->findOneBy(['id'=>$id]);
  300.         $abstract->setTypeFinal("video");
  301.         $abstract->setStatut("accepter");
  302.         $em->flush();
  303.         $to      = $abstract->getEmailCorrespondant();
  304.         $subject = "ATU - Acceptance of an abstract in the form of Video - ".$abstract->getCongres()->getLabelEn();
  305.         $headers = "MIME-Version: 1.0\r\n";
  306.         $headers .= "Content-type: text/html; charset=UTF-8\r\n";
  307.         $headers .= 'From: contact@urotunisia.com' . "\r\n" .
  308.         'Reply-To: contact@urotunisia.com' . "\r\n" .
  309.         'X-Mailer: PHP/' . phpversion();
  310.         $message = "<table width='100%' border='0' cellspacing='0' cellpadding='5'>
  311.                         <tr>
  312.                             <td align='center'>
  313.                                 <table width='600' border='0' cellspacing='0' cellpadding='5'>
  314.                                     <tr><td bgcolor='#fff' align='center'><div align='center'><img src='http://urotunisia.com/front-assets/assets/img/logo1.png' width='40%' class='img-responsive center-block'></div></td></tr>
  315.                                     <tr>
  316.                                         <td valign='top' class='body'>
  317.                                             <table width='100%' border='0' cellspacing='0' cellpadding='0'>
  318.                                                 <tr>
  319.                                                     <td width='10' bgcolor='#FFFFFF'  >&nbsp;</td>
  320.                                                     <td valign='top' bgcolor='#FFFFFF' align='left'>
  321.                                                         <h4>Dear Dr. ".$abstract->getNomAuteurCorrespondant()." " .$abstract->getPrenomAuteurCorrespondant(). "!</h4><p>We are pleased to inform you that your abstract <strong> ".$abstract->getId()." entitled « ".$abstract->getTitle()." »</strong> has been accepted by the Scientific Committee as a video for presentation at the ".$abstract->getCongres()->getLabel().".</p>
  322.                                                         <p>Further instructions regarding your submission will be provided in a forthcoming email</p>
  323.                                                         <p>In the meantime, please click <a href='http://urotunisia.com/user/abstractsIndexUser'>HERE</a> to upload your poster or alternatively, you can send it directly to <a href='mailto:urotunisia22@gmail.com'>urotunisia22@gmail.com</a></p>
  324.                                                         <br/><br/>Best regards, <br/>On behalf of the TAU office.
  325.                                                         <p>&nbsp;</p>
  326.                                                     </td>
  327.                                                     <td width='10' bgcolor='#FFFFFF' >&nbsp;</td>
  328.                                                 </tr>
  329.                                             </table>
  330.                                         </td>
  331.                                     </tr>
  332.                                     
  333.                                     <tr>
  334.                                         <td valign='top' class='body'>
  335.                                             <table width='100%' border='0' cellspacing='0' cellpadding='0'>
  336.                                                 <tr>
  337.                                                     <td width='10' bgcolor='#FFFFFF'  >&nbsp;</td>
  338.                                                     <td valign='top' bgcolor='#FFFFFF' align='left'>
  339.                                                         <h4>Cher Dr ".$abstract->getNomAuteurCorrespondant()." " .$abstract->getPrenomAuteurCorrespondant(). "!</h4><p>Nous avons le plaisir de vous informer que votre résumé <strong> ".$abstract->getId()." intitulé « ".$abstract->getTitle()." »</strong> été accepté par le comité scientifique en tant que vidéo dans le cadre du ".$abstract->getCongres()->getLabel().".</p>
  340.                                                         <p>Des instructions complémentaires concernant votre soumission vous seront communiquées dans un prochain email.</p>
  341.                                                         <p>En attendant, veuillez cliquer <a href='http://urotunisia.com/user/abstractsIndexUser'>ICI</a> pour télécharger votre poster ou bien l'envoyer directement à l'adresse <a href='mailto:urotunisia22@gmail.com'>urotunisia22@gmail.com</a></p>
  342.                                                         <br/><br/>Cordialement, <br/>Pour le bureau de l'ATU.
  343.                                                         <p>&nbsp;</p>
  344.                                                     </td>
  345.                                                     <td width='10' bgcolor='#FFFFFF' >&nbsp;</td>
  346.                                                 </tr>
  347.                                             </table>
  348.                                         </td>
  349.                                     </tr>
  350.                                 </table>
  351.                             </td>
  352.                         </tr>
  353.                     </table>";
  354.             mail($to, $subject, $message, $headers);
  355.         //    $this->addFlash('success','user modifié avec succès!');
  356.         return new JsonResponse('abstractAcceperVideo');
  357.     }
  358.     /**
  359.      * @Route("/reviewer/accepterabstactcomm", name="accepter_CO")
  360.      * @param Abstractt $abstract
  361.      * @param Request $request
  362.      * @return \Symfony\Component\HttpFoundation\Response
  363.      */
  364.     public function accepterComm(Request $request, EntityManagerInterface $em, AbstracttRepository $repository)
  365.     {
  366.         $id = $request->request->get('id');
  367.         $abstract= $repository->findOneBy(['id'=>$id]);
  368.         $abstract->setTypeFinal("communication orale");
  369.         $abstract->setStatut("accepter");
  370.         $em->flush();
  371.         $to      = $abstract->getEmailCorrespondant();
  372.         $subject = "ATU - Acceptance of an abstract in the form of an oral communication - ".$abstract->getCongres()->getLabelEn();
  373.         $headers = "MIME-Version: 1.0\r\n";
  374.         $headers .= "Content-type: text/html; charset=UTF-8\r\n";
  375.         $headers .= 'From: contact@urotunisia.com' . "\r\n" .
  376.         'Reply-To: contact@urotunisia.com' . "\r\n" .
  377.         'X-Mailer: PHP/' . phpversion();
  378.         $message = "<table width='100%' border='0' cellspacing='0' cellpadding='5'>
  379.                         <tr>
  380.                             <td align='center'>
  381.                                 <table width='600' border='0' cellspacing='0' cellpadding='5'>
  382.                                     <tr><td bgcolor='#fff' align='center'><div align='center'><img src='http://urotunisia.com/front-assets/assets/img/logo1.png' width='40%' class='img-responsive center-block'></div></td></tr>
  383.                                     <tr>
  384.                                         <td valign='top' class='body'>
  385.                                             <table width='100%' border='0' cellspacing='0' cellpadding='0'>
  386.                                                 <tr>
  387.                                                     <td width='10' bgcolor='#FFFFFF'  >&nbsp;</td>
  388.                                                     <td valign='top' bgcolor='#FFFFFF' align='left'>
  389.                                                         <h4>Dear Dr. ".$abstract->getNomAuteurCorrespondant()." " .$abstract->getPrenomAuteurCorrespondant(). "!</h4><p>We are pleased to inform you that your abstract <strong> (N°".$abstract->getId().") entitled « ".$abstract->getTitle()." »</strong> has been accepted by the Scientific Committee as an oral communication for presentation at the ".$abstract->getCongres()->getLabelEn().".</p>
  390.                                                         <p>Please note the following important recommendations for your presentation:</p>
  391.                                                         <ul>
  392.                                                             <li>Poster Type: Oral presentation</li>
  393.                                                             <li>Presentation Duration: 5 minutes</li>
  394.                                                             <li>Maximum Slides: <strong style='color:red'><u>5 slides (excluding the title slide)</u></strong></li>
  395.                                                             <li>Format: PPTX (PowerPoint)</li>
  396.                                                             <li>Submission Deadline: October 10th, 2025, before midnight</li>
  397.                                                         </ul>
  398.                                                         <p>Please click <a href='http://urotunisia.com/user/abstractsIndexUser'>HERE</a> to upload your poster or alternatively, you can send it directly to <a href='mailto:urotunisia22@gmail.com'>urotunisia22@gmail.com</a></p>
  399.                                                         <br/><br/>Best regards, <br/>On behalf of the TAU office.
  400.                                                         <p>&nbsp;</p>
  401.                                                     </td>
  402.                                                     <td width='10' bgcolor='#FFFFFF' >&nbsp;</td>
  403.                                                 </tr>
  404.                                             </table>
  405.                                         </td>
  406.                                     </tr>
  407.                                     <tr>
  408.                                         <td valign='top' class='body'>
  409.                                             <table width='100%' border='0' cellspacing='0' cellpadding='0'>
  410.                                                 <tr>
  411.                                                     <td width='10' bgcolor='#FFFFFF'  >&nbsp;</td>
  412.                                                     <td valign='top' bgcolor='#FFFFFF' align='left'>
  413.                                                         <h4>Cher Dr ".$abstract->getNomAuteurCorrespondant()." " .$abstract->getPrenomAuteurCorrespondant(). "!</h4><p>Nous avons le plaisir de vous informer que votre résumé <strong> (N°".$abstract->getId().") intitulé « ".$abstract->getTitle()." »</strong> été accepté par le comité scientifique en tant que communication orale dans le cadre du ".$abstract->getCongres()->getLabel().".</p>
  414.                                                         <p>Veuillez noter les recommandations importantes suivantes pour votre présentation :</p>
  415.                                                         <ul>
  416.                                                             <li>Type de présentation : communication orale</li>
  417.                                                             <li>Durée de la présentation : 5 minutes</li>
  418.                                                             <li>Nombre maximum de diapositives : <strong style='color:red'><u>5 diapositives (hors diapositive de titre)</u></strong></li>
  419.                                                             <li>Format : PPTX (PowerPoint)</li>
  420.                                                             <li>Délai d'envoi des diapositives : 10 octobre 2025 avant minuit</li>
  421.                                                         </ul>
  422.                                                         <p>Veuillez cliquer <a href='http://urotunisia.com/user/abstractsIndexUser'>ICI</a> pour télécharger votre poster ou bien l'envoyer directement à l'adresse <a href='mailto:urotunisia22@gmail.com'>urotunisia22@gmail.com</a></p>
  423.                                                         <br/><br/>Cordialement, <br/>Pour le bureau de l'ATU.
  424.                                                         <p>&nbsp;</p>
  425.                                                     </td>
  426.                                                     <td width='10' bgcolor='#FFFFFF' >&nbsp;</td>
  427.                                                 </tr>
  428.                                             </table>
  429.                                         </td>
  430.                                     </tr>
  431.                                 </table>
  432.                             </td>
  433.                         </tr>
  434.                     </table>";
  435.             mail($to, $subject, $message, $headers);
  436.         //    $this->addFlash('success','user modifié avec succès!');
  437.         return new JsonResponse('abstractAcceperCO');
  438.     }
  439.     /**
  440.      * @Route("/reviewer/refuserabstact", name="refuser_abstract")
  441.      * @param Abstractt $abstract
  442.      * @param Request $request
  443.      * @return \Symfony\Component\HttpFoundation\Response
  444.      */
  445.     public function refuser( Request $request, EntityManagerInterface $em, AbstracttRepository $repository)
  446.     {
  447.         $id = $request->request->get('id');
  448.         $abstract= $repository->findOneBy(['id'=>$id]);
  449.         $abstract->setStatut("refuser");
  450.         $abstract->setTypeFinal("refuser");
  451.         $em->flush();
  452.         $to      = $abstract->getEmailCorrespondant();
  453.         $subject = "ATU - Notification Regarding Your Abstract - ".$abstract->getCongres()->getLabelEn();
  454.         $headers = "MIME-Version: 1.0\r\n";
  455.         $headers .= "Content-type: text/html; charset=UTF-8\r\n";
  456.         $headers .= 'From: contact@urotunisia.com' . "\r\n" .
  457.         'Reply-To: contact@urotunisia.com' . "\r\n" .
  458.         'X-Mailer: PHP/' . phpversion();
  459.         $message = "<table width='100%' border='0' cellspacing='0' cellpadding='5'>
  460.                         <tr>
  461.                             <td align='center'>
  462.                                 <table width='600' border='0' cellspacing='0' cellpadding='5'>
  463.                                     <tr><td bgcolor='#fff' align='center'><div align='center'><img src='http://urotunisia.com/front-assets/assets/img/logo1.png' width='40%' class='img-responsive center-block'></div></td></tr>
  464.                                     <tr>
  465.                                         <td valign='top' class='body'>
  466.                                             <table width='100%' border='0' cellspacing='0' cellpadding='0'>
  467.                                                 <tr>
  468.                                                     <td width='10' bgcolor='#FFFFFF'  >&nbsp;</td>
  469.                                                     <td valign='top' bgcolor='#FFFFFF' align='left'>
  470.                                                         <h4>Dear Dr. ".$abstract->getNomAuteurCorrespondant()." " .$abstract->getPrenomAuteurCorrespondant(). "!</h4><p>On behalf of the Scientific Committee of the TAU, we regret to inform you that, despite the high quality of your abstract <strong> (N°".$abstract->getId().") entitled « ".$abstract->getTitle()." »</strong>, it was not selected for presentation at the ".$abstract->getCongres()->getLabelEn().".</p>
  471.                                                         <p>This year, we received an exceptionally large number of submissions, making the selection process highly competitive. We sincerely appreciate your contribution and encourage your continued participation in future events.</p>
  472.                                                         <p>We hope to see you at the conference.</p>
  473.                                                         <br/><br/>Best regards, <br/>On behalf of the TAU office.
  474.                                                         <p>&nbsp;</p>
  475.                                                     </td>
  476.                                                     <td width='10' bgcolor='#FFFFFF' >&nbsp;</td>
  477.                                                 </tr>
  478.                                             </table>
  479.                                         </td>
  480.                                     </tr>
  481.                                     <tr>
  482.                                         <td valign='top' class='body'>
  483.                                             <table width='100%' border='0' cellspacing='0' cellpadding='0'>
  484.                                                 <tr>
  485.                                                     <td width='10' bgcolor='#FFFFFF'  >&nbsp;</td>
  486.                                                     <td valign='top' bgcolor='#FFFFFF' align='left'>
  487.                                                         <h4>Cher Dr ".$abstract->getNomAuteurCorrespondant()." " .$abstract->getPrenomAuteurCorrespondant(). "!</h4><p>Au nom du comité scientifique de l'ATU, nous avons le regret de vous informer que, malgré la grande qualité de votre résumé <strong> (N°".$abstract->getId().") intitulé « ".$abstract->getTitle()." »</strong>, celui-ci n'a pas été retenu pour une présentation lors du ".$abstract->getCongres()->getLabel().".</p>
  488.                                                         <p>Cette année, nous avons reçu un nombre exceptionnellement élevé de soumissions, rendant le processus de sélection particulièrement compétitif. Nous vous remercions chaleureusement pour votre contribution et espérons vivement vous compter parmi nous lors des prochains événements.</p>
  489.                                                         <p>Nous espérons vous voir au congrès.</p>
  490.                                                         <br/><br/>Cordialement, <br/>Pour le bureau de l'ATU.
  491.                                                         <p>&nbsp;</p>
  492.                                                     </td>
  493.                                                     <td width='10' bgcolor='#FFFFFF' >&nbsp;</td>
  494.                                                 </tr>
  495.                                             </table>
  496.                                         </td>
  497.                                     </tr>
  498.                                 </table>
  499.                             </td>
  500.                         </tr>
  501.                     </table>";
  502.         mail($to, $subject, $message, $headers);
  503.         //    $this->addFlash('success','user modifié avec succès!');
  504.         return new JsonResponse('abstractRefuser');
  505.     }
  506.     /**
  507.      * @Route("/user/uploadsAbstract/{id}", name="uploadsAbstract")
  508.      */
  509.     public function uploadsAbstract(Request $request, AbstracttRepository $abstracttRepository, $id, EntityManagerInterface $em)
  510.     {
  511.         $user = $this->container->get('security.token_storage')->getToken()->getUser();
  512.         $abstract = $abstracttRepository->findOneBy(['id'=>$id]);
  513.         $oldFile = $abstract->getUploads();
  514.         if($abstract->getUploads()!=null)
  515.         {$abstract->setUploads(
  516.             new File($this->getParameter('uploadAbstractuploads_directory') . '/' . $abstract->getUploads())
  517.         );}
  518.         if($request->isMethod('post')){
  519.             if ($abstract->getTypeFinal()=='poster' || $abstract->getTypeFinal()=='communication orale' ){
  520.                 $brochureFile = $request->files->get('uploads');
  521.                 if ($brochureFile) {
  522.                     $fileNameimage = md5(uniqid()) . '.' . $brochureFile->guessExtension();
  523.                     $abstract->setUploads($fileNameimage);
  524.                     $brochureFile->move(
  525.                         $this->getParameter('uploadAbstractuploads_directory'),
  526.                         $fileNameimage
  527.                     );
  528.                 } else {
  529.                     $abstract->setUploads($oldFile);
  530.                 }
  531.             }
  532.             elseif($abstract->getTypeFinal()=='video'){
  533.                 $abstract->setUploads($request->request->get('uploads')); 
  534.             }
  535.             $em->flush();
  536.             return $this->redirectToRoute('abstractsUser');
  537.         }
  538.         return $this->render('backend/abstracts/uploadsAbstract.html.twig', array('abstracts' => $abstract));
  539.     }
  540.     /**
  541.      * @Route("/admin/supprimerAbstarct/{id}", name="supprimer_abstract")
  542.      */
  543.     public function supprimer($id, AbstracttRepository $repository, EntityManagerInterface $em)
  544.     {
  545.         $abstract = $repository->find($id);
  546.         $em->remove($abstract);
  547.         $em->flush();
  548.         return $this->redirectToRoute('tous_abstracts');
  549.     }
  550.     /**
  551.      * @Route("/admin/abstractsearch/", name="abstract_search")
  552.      */
  553.     public function searchAbstarct(AbstracttRepository $repository, Request $request, PaginatorInterface $paginator)
  554.     {
  555.         $abstract = $repository->findByNamePopular(
  556.             $request->query->get('query')
  557.         );
  558.         $abstract = $paginator->paginate(
  559.             // Doctrine Query, not results
  560.             $abstract,
  561.             // Define the page parameter
  562.             $request->query->getInt('page', 1),
  563.             // Items per page
  564.             2
  565.         );
  566.         $entityManager = $this->getDoctrine()->getManager();
  567.         $categoryRepository = $entityManager->getRepository(Abstractt::class);
  568.         return $this->render('backend/abstracts/reviewer_abstracts.html.twig', [
  569.             'abstract' => $abstract
  570.         ]);
  571.     }
  572.     /**
  573.      * @Route("/reviewer/abstractrecherche/", name="abstract_recherche")
  574.      */
  575.     public function rechercheAbstract(AbstracttRepository $repository, Request $request, PaginatorInterface $paginator)
  576.     {
  577.         $abstract = $repository->findByNamePopular(
  578.             $request->query->get('query')
  579.         );
  580.         $abstract = $paginator->paginate(
  581.             // Doctrine Query, not results
  582.             $abstract,
  583.             // Define the page parameter
  584.             $request->query->getInt('page', 1),
  585.             // Items per page
  586.             2
  587.         );
  588.         $entityManager = $this->getDoctrine()->getManager();
  589.         $categoryRepository = $entityManager->getRepository(Abstractt::class);
  590.         return $this->render('backend/abstracts/abstracts.html.twig', [
  591.             'abstract' => $abstract
  592.         ]);
  593.     }
  594.     
  595.     /**
  596.      * @Route("/user/telechargerAbstract/{id}", name="telecharger_abstract")
  597.      */
  598.     public function pdfAbstract(AbstracttRepository $repository, $id, EntityManagerInterface $em, AuteurAbstractRepository $repositoryAuteur)
  599.     {
  600.         $abstract = $repository->find($id);
  601.         $auteurAbstract = new AuteurAbstract();
  602.         $auteurAbstract = $repositoryAuteur->findBy(array('abstractt' => $id));
  603.         // Configure Dompdf according to your needs
  604.         $pdfOptions = new Options();
  605.         $pdfOptions->set('defaultFont', 'Arial');
  606.         $pdfOptions->set('isRemoteEnabled', true); // temp folder with write permission
  607.         $pdfOptions->setIsRemoteEnabled(true);
  608.         // Instantiate Dompdf with our options
  609.         $dompdf = new Dompdf($pdfOptions);
  610.         // Retrieve the HTML generated in our twig file
  611.         $html = $this->renderView('backend/abstracts/pdfAbstract.html.twig', ['abstract' => $abstract, 'auteurs' => $auteurAbstract]);
  612.         // Load HTML to Dompdf
  613.         $dompdf->loadHtml($html);
  614.         // $paper_size = array(0,0,360,360);
  615.         // (Optional) Setup the paper size and orientation 'portrait' or 'portrait'
  616.         $dompdf->setPaper('A4', 'portrait');
  617.         // Render the HTML as PDF
  618.         $dompdf->render();
  619.         // Output the generated PDF to Browser (force download)
  620.         $dompdf->stream("Abstract-" . $abstract->getId() . ".pdf", [
  621.             "Attachment" => true
  622.         ]);
  623.         return $this->render('backend/abstracts/abstracts.html.twig');
  624.     }
  625. }