src/Controller/EspaceParentController.php line 234

Open in your IDE?
  1. <?php
  2. /*
  3.  * To change this license header, choose License Headers in Project Properties.
  4.  * To change this template file, choose Tools | Templates
  5.  * and open the template in the editor.
  6.  */
  7. namespace App\Controller;
  8. use Symfony\Component\Mailer\MailerInterface;
  9. use Swift_Message;
  10. use Symfony\Component\Mime\Email;
  11. use Unirest;
  12. use Swift_Image;
  13. use Dompdf\Dompdf;
  14. use App\Entity\Ref;
  15. use Dompdf\Options;
  16. use App\Entity\Page;
  17. use App\Entity\User;
  18. use Twig\Environment;
  19. use App\Entity\Panier;
  20. use App\Entity\Sejour;
  21. use App\Entity\Clipart;
  22. use App\Entity\Produit;
  23. use App\Entity\CommandeNumerique;
  24. use App\Entity\Typeref;
  25. use App\Entity\Commande;
  26. use App\Entity\Emailing;
  27. use App\Entity\Typeproduit;
  28. use App\Entity\ParentSejour;
  29. use App\Entity\PanierProduit;
  30. use App\Service\JetonService;
  31. use App\Entity\ComandeProduit;
  32. use App\Entity\SejourAttachment;
  33. use App\Service\PrinterService;
  34. use App\Entity\Likephoto;
  35. use App\Entity\Attachment;
  36. use App\Service\EmailsCmdService;
  37. use App\Entity\TypeProduitConditionnement;
  38. use App\Service\AttachementService;
  39. use App\Service\CarteService;
  40. use App\Service\ComandeService;
  41. use App\Service\EtablissementService;
  42. use App\Service\PayementService;
  43. use App\Service\PhotosFavorisService;
  44. use App\Service\SejourService;
  45. use App\Service\TypeProduiteService;
  46. use App\Service\UserService;
  47. use Doctrine\Persistence\ManagerRegistry;
  48. use Psr\Log\LoggerInterface;
  49. use Qipsius\TCPDFBundle\Controller\TCPDFController;
  50. use SebastianBergmann\Environment\Console;
  51. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  52. use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
  53. use Symfony\Component\HttpFoundation\Request;
  54. use Symfony\Component\HttpFoundation\Response;
  55. use Symfony\Component\Routing\Annotation\Route;
  56. use Symfony\Component\HttpFoundation\JsonResponse;
  57. use Symfony\Component\HttpFoundation\ResponseHeaderBag;
  58. use Symfony\Component\HttpFoundation\BinaryFileResponse;
  59. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  60. use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
  61. use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
  62. class EspaceParentController extends AbstractController
  63. {
  64.     private $em;
  65.     private $session;
  66.     private $templating;
  67.     private $mailer;
  68.     private $symfonyMailer;
  69.     private $EmailServie;
  70.     private $urlGenerator;
  71.     private $commandeService;
  72.     private $printerService;
  73.     private $emailsCmdService;
  74.     private $userService;
  75.     private $typeProduiteService;
  76.     private $sejourService;
  77.     private $attachementService;
  78.     private $etablissementService;
  79.     private $payementService;
  80.     private $carteService;
  81.     private $photosFavorisService;
  82.     private $params;
  83.     private $tcpdf;
  84.     private $logger;
  85.   
  86.     public function __construct(UrlGeneratorInterface $urlGeneratorManagerRegistry $emSessionInterface $session\Swift_Mailer $mailerMailerInterface $symfonyMailerEnvironment $templatingEmailsCmdService $EmailCommandeServiceComandeService $commandeServiceUserService $userServiceTypeProduiteService $typeProduiteServiceSejourService $sejourServiceAttachementService $attachementServiceEtablissementService $etablissementServicePayementService $payementServiceCarteService $carteServicePhotosFavorisService $photosFavorisServiceParameterBagInterface $paramsTCPDFController $tcpdfLoggerInterface $loggerPrinterService $printerServiceEmailsCmdService $emailsCmdService)
  87.     {
  88.         $this->em $em;
  89.         $this->session $session;
  90.         $this->templating $templating;
  91.         $this->mailer $mailer;
  92.         $this->symfonyMailer $symfonyMailer;
  93.         $this->EmailServie $EmailCommandeService;
  94.         $this->urlGenerator $urlGenerator;
  95.         $this->commandeService $commandeService;
  96.         $this->emailsCmdService $emailsCmdService;
  97.         $this->userService $userService;
  98.         $this->typeProduiteService $typeProduiteService;
  99.         $this->sejourService $sejourService;
  100.         $this->attachementService $attachementService;
  101.         $this->etablissementService $etablissementService;
  102.         $this->payementService $payementService;
  103.         $this->carteService $carteService;
  104.         $this->photosFavorisService $photosFavorisService;
  105.         $this->params $params;
  106.         $this->tcpdf $tcpdf;
  107.         $this->logger $logger;
  108.         $this->printerService $printerService;
  109.     }
  110.     /**
  111.      * @Route("/Parent/CreerAlbumSejourTest", name="CreerAlbumSejourTest")
  112.      */
  113.     public function CreerAlbumSejourTest(Request $request)
  114.     {
  115.         $serviceuser $this->etablissementService;
  116.         $page $request->get("pages");
  117.         $idsejour $request->get("id_du_sejour");
  118.         $prodid $request->get('idProd');
  119.         $nomprod $request->get('nomprod');
  120.         $stat $request->get('stat');
  121.         $version $request->get('new');
  122.         $user $this->getUser();
  123.         $Album $serviceuser->savealbumAcc($page$user$idsejour$prodid$stat$nomprod$version);
  124.         //Envoi des mails aux parents 
  125.         // Envoi SMS aux parents 
  126.         // Envoi mail proposition achat groupé au accompagnateur 
  127.         //YOSRA HERE
  128.         $PrentsConnextees $this->em->getRepository(ParentSejour::class)->findBy(array('idSejour' =>  $idsejour));
  129.         dd($PrentsConnextees);
  130.         return new response('done');
  131.     }
  132.     /**
  133.      * @Route("/Parent/DirectAchatAlbumm", name="DirectAchatAlbumm")
  134.      */
  135.     public function DirectAchatAlbumm(Request $request)
  136.     {
  137.         $session $this->session;
  138.         $serviceuser $this->etablissementService;
  139.         $page $request->get("pages");
  140.         $sejour $request->get("sejour");
  141.         $prodid $request->get('idProd');
  142.         $nomprod $request->get('nomprod');
  143.         $versionalbm $request->get('new');
  144.         $user $this->getUser();
  145.         $dateNow = new \Datetime();
  146.         $produit $session->get("produittype");
  147.         $produitcondi $session->get("produit");
  148.         $Album $serviceuser->savealbumParent($page$user$sejour$prodid$produit$produitcondi$nomprod$versionalbm);
  149.         $inser false;
  150.         $produit $this->em->getRepository(Produit::class)->find($Album->getId());
  151.         $em $this->em;
  152.         $user $this->getUser();
  153.         $typeref $em->getRepository(Typeref::class)->find(8);
  154.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "achatdirect""typeref" => $typeref));
  155.         $panierTrace = new Panier();
  156.         $dateNow = new \Datetime();
  157.         $panierTrace->setDateCreation($dateNow);
  158.         $panierTrace->setCreerPar($user);
  159.         $panierTrace->setStatut($statutPanier);
  160.         $em->getManager()->persist($panierTrace);
  161.         $em->getManager()->flush();
  162.         $panierProduit = new PanierProduit();
  163.         $panierProduit->setIdProduit($Album);
  164.         $panierProduit->setIdPanier($panierTrace);
  165.         $em->getManager()->persist($panierProduit);
  166.         $em->getManager()->flush();
  167.         $panierProduit->setQuantite(1);
  168.         $panierProduit->setPrixTotal($Album->getIdConditionnement()->getMontantTTC());
  169.         $this->em->getManager()->persist($panierProduit);
  170.         $this->em->getManager()->flush();
  171.         return new response('achat direct done');
  172.     }
  173.     /**
  174.      * @Route("/Parent/Achat_direct", name="Achat_direct")
  175.      */
  176.     public function Achat_direct()
  177.     {
  178.         $em $this->em;
  179.         $session $this->session;
  180.         $idSejour $session->get("Sejour");
  181.         $sejour $this->em->getRepository(Sejour::class)->find($idSejour);
  182.         $typeref $em->getRepository(Typeref::class)->find(8);
  183.         $user $this->getUser();
  184.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "achatdirect""typeref" => $typeref));
  185.         $panier $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  186.         return $this->render('Parent/achatdirect.html.twig', ["user" => $user"sejour" => $sejour"panier" => $panier]);
  187.     }
  188.     /**
  189.      * @Route("/Parent/AccueilParent", name="AccueilParent")
  190.      */
  191.     public function AccueilParent(Request $requestLoggerInterface $loggerInterface): Response
  192.     {
  193.         $session $this->session;
  194.         /** @var \App\Entity\User $user */
  195.         $user $this->getUser();
  196.         $userId $user->getId();
  197.         $code $request->get("codeSejour");
  198.         $sejour $this->em->getRepository(Sejour::class)->findOneBy(['codeSejour' => $code]);
  199.         if (isset($code)) {
  200.             $sejour $this->em->getRepository(Sejour::class)->findOneBy(['codeSejour' => $code]);
  201.             if ($sejour == null) {
  202.                 $sejour $this->em->getRepository(Sejour::class)->USeOldCodes($code);
  203.                 if ($sejour == null) {
  204.                     $this->session->set('rout''code');
  205.                     return $this->render('Parent/EntrerVotreCodeSejour.html.twig', ['user' => $user"defaultval" => 1'smsnotif' => $user->getSmsnotif()]);
  206.                 }
  207.             } else {
  208.                 $this->session->set('Sejour'$sejour->getId());
  209.             }
  210.         }
  211.         if ($session->has('paymentmoniteco') || $session->get("Sejour") != "" || $session->get("Sejour") != null) {
  212.             $code $session->get("Sejour");
  213.             $sejour $this->em->getRepository(Sejour::class)->find($code);
  214.         } else {
  215.             $code $request->get("codeSejour");
  216.             $sejour $this->em->getRepository(Sejour::class)->findOneBy(['codeSejour' => $code]);
  217.         }
  218.         if ($sejour == null) {
  219.             $sejour $this->em->getRepository(Sejour::class)->USeOldCodes($code);
  220.         }
  221.         if ($sejour == null) {
  222.             $this->session->set('rout''code');
  223.             return $this->render('Parent/EntrerVotreCodeSejour.html.twig', ['user' => $user"defaultval" => 1'smsnotif' => $user->getSmsnotif()]);
  224.         }
  225.         $idSejour $sejour->getId();
  226.         $SEjourService $this->sejourService;
  227.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  228.         $this->session->set('Sejour'$idSejour);
  229.         $dateCreationArch = clone $sejour->getDateFinCode();
  230.         if ($dateCreationArch <= new \DateTime()) {
  231.             return $this->render('Parent/SejourDepassee.html.twig');
  232.         }
  233.         $session->set('pageMenu''MonSejour');
  234.         $AllAttachements $SEjourService->getphotosVideosSejour($idSejour'watermark'$userId);
  235.         $nbImages count($AllAttachements);
  236.         $messages $SEjourService->getCombinedattachSejour($idSejour'message');
  237.         $positions $SEjourService->getsejourposition($idSejour);
  238.         $em $this->em;
  239.         $idAcc $sejour->getIdAcommp();
  240.         //VERIFICATION DE L EXISTANCE DE LIVRE OU D ALBUM SEJOUR 
  241.         $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  242.         if ($albumAcc == null) {
  243.             $albumAcc $em->getRepository(Produit::class)->findOneBy(['iduser' => 1'statut' => "Album_sejour"'idsjour' => $sejour]);
  244.         }
  245.         $label "Livre_sejour" $sejour->getCodeSejour();
  246.         $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  247.         $livreSej $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  248.         if ($albumAcc == null) {
  249.             $albumAcc $em->getRepository(Produit::class)->findOneBy(['iduser' => 1'statut' => "Album_sejour"'idsjour' => $sejour]);
  250.         }
  251.         if ($livreSej == null) {
  252.             $livreSejour $em->getRepository(Produit::class)->findOneBy(['statut' => "Livre_sejour"'idsjour' => $sejour'labele' => $label'version' => "Livre_Admin"]);
  253.         }
  254.         $parentsejour $SEjourService->getparentsejour($userId$idSejour);
  255.         if ($parentsejour == NULL) {
  256.             $parentsejour $SEjourService->inserparentsejour($userId$idSejour);
  257.         }
  258.         if ($AllAttachements == null && $messages == null) {
  259.             $this->session->set('rout''rout');
  260.             return $this->render('Parent/Aucunphoto.html.twig', [
  261.                 "sejour" => $sejour,
  262.                 "parentsejour" => $parentsejour
  263.             ]);
  264.         } else {
  265.             $attachementsCount $AllAttachements['total'];
  266.             unset($AllAttachements['total']);
  267.             if ($sejour->getPaym() == 0) {
  268.                 $produits $this->typeProduiteService;
  269.                 $liste $produits->produitlistTypeConditionnement();
  270.                 $pubProd $user->getShowpubprod();
  271.                 $em $this->em;
  272.                 $idAcc $sejour->getIdAcommp();
  273.                 $nbmessages count($messages);
  274.                 $nblikes =  count($listeattachlikephoto);
  275.                 return $this->render('Parent/DetailsSejour.html.twig', [
  276.                     "sejour" => $sejour,
  277.                     'albumAcc' => $albumAcc,
  278.                     "livreSejour" => $livreSejour,
  279.                     'listeattach' => $AllAttachements,
  280.                     'nbmessages' => $nbmessages,
  281.                     'attachementsCount' => $attachementsCount,
  282.                     'prod' => $liste,
  283.                     'nbImages' => $nbImages,
  284.                     'positions' => $positions,
  285.                     'messages' => $messages,
  286.                     'nblikes' => $nblikes,
  287.                     'likes' => $listeattachlikephoto,
  288.                     "parentsejour" => $parentsejour,
  289.                     'smsnotif' => $parentsejour->getSmsnotif(),
  290.                     'showpub' => $pubProd
  291.                 ]);
  292.             }
  293.             if ($sejour->getPaym() == 1) {
  294.                 if ($parentsejour->getPayment() == 0) {
  295.                     $this->session->set('rout''rout');
  296.                     $ses_id session_id();
  297.                     return $this->render('Parent/achatsejour.html.twig', ["sejour" => $sejour'images' => $AllAttachements"session_id" => $ses_id'ParentSejour' => $parentsejour]);
  298.                 }
  299.                 if ($parentsejour->getPayment() == 1) {
  300.                     $produits $this->typeProduiteService;
  301.                     $liste $produits->produitlistTypeConditionnement();
  302.                     $pubProd $user->getShowpubprod();
  303.                     return $this->render('Parent/DetailsSejour.html.twig', [
  304.                         "sejour" => $sejour,
  305.                         'listeattach' => $AllAttachements,
  306.                         'attachementsCount' => $attachementsCount,
  307.                         'prod' => $liste,
  308.                         'albumAcc' => $albumAcc,
  309.                         "livreSejour" => $livreSejour,
  310.                         'nbImages' => $nbImages,
  311.                         'positions' => $positions,
  312.                         'messages' => $messages,
  313.                         'like' => $listeattachlikephoto,
  314.                         "parentsejour" => $parentsejour,
  315.                         'smsnotif' => $parentsejour->getSmsnotif(),
  316.                         'showpub' => $pubProd
  317.                     ]);
  318.                 }
  319.             }
  320.         }
  321.     }
  322.     /**
  323.      * @Route("/Parent/MessagesVocaux", name="MessagesVocaux")
  324.      */
  325.     public function MessagesVocaux_Accueil(Request $requestLoggerInterface $loggerInterface): Response
  326.     {
  327.         $session $this->session;
  328.         $session->set('pageMenu''MessagesVocaux');
  329.         /** @var \App\Entity\User $user */
  330.         $user $this->getUser();
  331.         $userId $user->getId();
  332.         $code $request->get("codeSejour");
  333.         $SEjourService $this->sejourService;
  334.         if (isset($code)) {
  335.             $sejour $this->em->getRepository(Sejour::class)->findOneBy(['codeSejour' => $code]);
  336.             if ($sejour == null) {
  337.                 $sejour $this->em->getRepository(Sejour::class)->USeOldCodes($code);
  338.                 if ($sejour == null) {
  339.                     $this->session->set('rout''code');
  340.                     return $this->render('Parent/EntrerVotreCodeSejour.html.twig', ['user' => $user"defaultval" => 1'smsnotif' => $user->getSmsnotif()]);
  341.                 }
  342.             } else {
  343.                 $this->session->set('Sejour'$sejour->getId());
  344.             }
  345.         }
  346.         if ($session->has('paymentmoniteco') || $session->get("Sejour") != "" || $session->get("Sejour") != null) {
  347.             $code $session->get("Sejour");
  348.             $sejour $this->em->getRepository(Sejour::class)->find($code);
  349.         } else {
  350.             $code $request->get("codeSejour");
  351.             $sejour $this->em->getRepository(Sejour::class)->findOneBy(['codeSejour' => $code]);
  352.         }
  353.         if ($sejour == null) {
  354.             $sejour $this->em->getRepository(Sejour::class)->USeOldCodes($code);
  355.         }
  356.         if ($sejour == null) {
  357.             $this->session->set('rout''code');
  358.             return $this->render('Parent/EntrerVotreCodeSejour.html.twig', ['user' => $user"defaultval" => 1'smsnotif' => $user->getSmsnotif()]);
  359.         }
  360.         $idSejour $sejour->getId();
  361.         $this->session->set('Sejour'$idSejour);
  362.         $dateCreationArch = clone $sejour->getDateFinCode();
  363.         if ($dateCreationArch <= new \DateTime()) {
  364.             return $this->render('Parent/SejourDepassee.html.twig');
  365.         }
  366.         $AllAttachements $SEjourService->getCombinedattachSejour($idSejour'photoVideo');
  367.         $nbImages count($AllAttachements);
  368.         $messages $SEjourService->getCombinedattachSejour($idSejour'message');
  369.         $positions $SEjourService->getsejourposition($idSejour);
  370.         $em $this->em;
  371.         $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => "1"'statut' => 'saved'], ['id' => 'DESC']);
  372.         if ($albumAcc == null) {
  373.             $albumAcc $em->getRepository(Produit::class)->findOneBy(['iduser' => 1'statut' => "Album_sejour"'idsjour' => $sejour]);
  374.         }
  375.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  376.         $parentsejour $SEjourService->getparentsejour($userId$idSejour);
  377.         if ($parentsejour == NULL) {
  378.             $parentsejour $SEjourService->inserparentsejour($userId$idSejour);
  379.         }
  380.         if ($AllAttachements == null && $messages == null) {
  381.             $this->session->set('rout''rout');
  382.             return $this->render('Parent/Aucunphoto.html.twig', [
  383.                 "sejour" => $sejour,
  384.                 "parentsejour" => $parentsejour
  385.             ]);
  386.         } else {
  387.             $attachementsCount $AllAttachements['total'];
  388.             unset($AllAttachements['total']);
  389.             if ($sejour->getPaym() == 0) {
  390.                 $produits $this->typeProduiteService;
  391.                 $liste $produits->produitlistTypeConditionnement();
  392.                 $pubProd $user->getShowpubprod();
  393.                 return $this->render('Parent/DetailsSejour.html.twig', [
  394.                     "sejour" => $sejour,
  395.                     'albumAcc' =>  $albumAcc,
  396.                     'listeattach' => $AllAttachements,
  397.                     'attachementsCount' => $attachementsCount,
  398.                     'prod' => $liste,
  399.                     'nbImages' => $nbImages,
  400.                     'positions' => $positions,
  401.                     'messages' => $messages,
  402.                     'like' => $listeattachlikephoto,
  403.                     "parentsejour" => $parentsejour,
  404.                     'smsnotif' => $parentsejour->getSmsnotif(),
  405.                     'showpub' => $pubProd
  406.                 ]);
  407.             }
  408.             if ($sejour->getPaym() == 1) {
  409.                 if ($parentsejour->getPayment() == 0) {
  410.                     $this->session->set('rout''rout');
  411.                     $ses_id session_id();
  412.                     return $this->render('Parent/achatsejour.html.twig', ["sejour" => $sejour'images' => $AllAttachements"session_id" => $ses_id'ParentSejour' => $parentsejour]);
  413.                 }
  414.                 if ($parentsejour->getPayment() == 1) {
  415.                     $produits $this->typeProduiteService;
  416.                     $liste $produits->produitlistTypeConditionnement();
  417.                     $pubProd $user->getShowpubprod();
  418.                     return $this->render('Parent/DetailsSejour.html.twig', [
  419.                         "sejour" => $sejour,
  420.                         'listeattach' => $AllAttachements,
  421.                         'attachementsCount' => $attachementsCount,
  422.                         'prod' => $liste,
  423.                         'nbImages' => $nbImages,
  424.                         'albumAcc' =>  $albumAcc,
  425.                         'positions' => $positions,
  426.                         'messages' => $messages,
  427.                         'like' => $listeattachlikephoto,
  428.                         "parentsejour" => $parentsejour,
  429.                         'smsnotif' => $parentsejour->getSmsnotif(),
  430.                         'showpub' => $pubProd
  431.                     ]);
  432.                 }
  433.             }
  434.         }
  435.     }
  436.     /**
  437.      * @Route("/Parent/MesFavoris_Accueil", name="MesFavoris_Accueil")
  438.      */
  439.     public function MesFavoris_Accueil(Request $requestLoggerInterface $loggerInterface): Response
  440.     {
  441.         $session $this->session;
  442.         $session->set('pageMenu''MesFavoris');
  443.         /** @var \App\Entity\User $user */
  444.         $user $this->getUser();
  445.         $userId $user->getId();
  446.         $code $request->get("codeSejour");
  447.         $SEjourService $this->sejourService;
  448.         if (isset($code)) {
  449.             $sejour $this->em->getRepository(Sejour::class)->findOneBy(['codeSejour' => $code]);
  450.             if ($sejour == null) {
  451.                 $sejour $this->em->getRepository(Sejour::class)->USeOldCodes($code);
  452.                 if ($sejour == null) {
  453.                     $this->session->set('rout''code');
  454.                     return $this->render('Parent/EntrerVotreCodeSejour.html.twig', ['user' => $user"defaultval" => 1'smsnotif' => $user->getSmsnotif()]);
  455.                 }
  456.             } else {
  457.                 $this->session->set('Sejour'$sejour->getId());
  458.             }
  459.         }
  460.         if ($session->has('paymentmoniteco') || $session->get("Sejour") != "" || $session->get("Sejour") != null) {
  461.             $code $session->get("Sejour");
  462.             $sejour $this->em->getRepository(Sejour::class)->find($code);
  463.         } else {
  464.             $code $request->get("codeSejour");
  465.             $sejour $this->em->getRepository(Sejour::class)->findOneBy(['codeSejour' => $code]);
  466.         }
  467.         if ($sejour == null) {
  468.             $sejour $this->em->getRepository(Sejour::class)->USeOldCodes($code);
  469.         }
  470.         if ($sejour == null) {
  471.             $this->session->set('rout''code');
  472.             return $this->render('Parent/EntrerVotreCodeSejour.html.twig', ['user' => $user"defaultval" => 1'smsnotif' => $user->getSmsnotif()]);
  473.         }
  474.         $idSejour $sejour->getId();
  475.         $this->session->set('Sejour'$idSejour);
  476.         $dateCreationArch = clone $sejour->getDateFinCode();
  477.         $em $this->em;
  478.         $idAcc $sejour->getIdAcommp();
  479.         $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  480.         $livreSej $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  481.         if ($albumAcc == null) {
  482.             $albumAcc $em->getRepository(Produit::class)->findOneBy(['iduser' => 1'statut' => "Album_sejour"'idsjour' => $sejour]);
  483.         }
  484.         if ($dateCreationArch <= new \DateTime()) {
  485.             return $this->render('Parent/SejourDepassee.html.twig');
  486.         }
  487.         $AllAttachements $SEjourService->getCombinedattachSejour($idSejour'photoVideo');
  488.         $nbImages count($AllAttachements);
  489.         $messages $SEjourService->getCombinedattachSejour($idSejour'message');
  490.         $positions $SEjourService->getsejourposition($idSejour);
  491.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  492.         $parentsejour $SEjourService->getparentsejour($userId$idSejour);
  493.         if ($parentsejour == NULL) {
  494.             $parentsejour $SEjourService->inserparentsejour($userId$idSejour);
  495.         }
  496.         if ($AllAttachements == null && $messages == null) {
  497.             $this->session->set('rout''rout');
  498.             return $this->render('Parent/Aucunphoto.html.twig', [
  499.                 "sejour" => $sejour,
  500.                 "parentsejour" => $parentsejour
  501.             ]);
  502.         } else {
  503.             $attachementsCount $AllAttachements['total'];
  504.             unset($AllAttachements['total']);
  505.             if ($sejour->getPaym() == 0) {
  506.                 $produits $this->typeProduiteService;
  507.                 $liste $produits->produitlistTypeConditionnement();
  508.                 $pubProd $user->getShowpubprod();
  509.                 $em $this->em;
  510.                 $idAcc $sejour->getIdAcommp();
  511.                 $label "Livre_sejour" $sejour->getCodeSejour();
  512.                 $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  513.                 $livreSej $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  514.                 if ($albumAcc == null) {
  515.                     $albumAcc $em->getRepository(Produit::class)->findOneBy(['iduser' => 1'statut' => "Album_sejour"'idsjour' => $sejour]);
  516.                 }
  517.                 if ($livreSej == null) {
  518.                     $livreSejour $em->getRepository(Produit::class)->findOneBy(['statut' => "Livre_sejour"'idsjour' => $sejour'labele' => $label'version' => "Livre_Admin"]);
  519.                 }
  520.                 return $this->render('Parent/DetailsSejour.html.twig', [
  521.                     "sejour" => $sejour,
  522.                     "livreSejour" => $livreSejour,
  523.                     "sejour" => $sejour,
  524.                     'listeattach' => $AllAttachements,
  525.                     'attachementsCount' => $attachementsCount,
  526.                     'prod' => $liste,
  527.                     'nbImages' => $nbImages,
  528.                     'positions' => $positions,
  529.                     'messages' => $messages,
  530.                     'like' => $listeattachlikephoto,
  531.                     "parentsejour" => $parentsejour,
  532.                     'smsnotif' => $parentsejour->getSmsnotif(),
  533.                     'showpub' => $pubProd,
  534.                     'albumAcc' => $albumAcc,
  535.                 ]);
  536.             }
  537.             if ($sejour->getPaym() == 1) {
  538.                 if ($parentsejour->getPayment() == 0) {
  539.                     $this->session->set('rout''rout');
  540.                     $ses_id session_id();
  541.                     return $this->render('Parent/achatsejour.html.twig', ["sejour" => $sejour'images' => $AllAttachements"session_id" => $ses_id'ParentSejour' => $parentsejour]);
  542.                 }
  543.                 if ($parentsejour->getPayment() == 1) {
  544.                     $produits $this->typeProduiteService;
  545.                     $liste $produits->produitlistTypeConditionnement();
  546.                     $pubProd $user->getShowpubprod();
  547.                     return $this->render('Parent/DetailsSejour.html.twig', [
  548.                         "sejour" => $sejour,
  549.                         'listeattach' => $AllAttachements,
  550.                         'attachementsCount' => $attachementsCount,
  551.                         'prod' => $liste,
  552.                         'nbImages' => $nbImages,
  553.                         'positions' => $positions,
  554.                         'messages' => $messages,
  555.                         'like' => $listeattachlikephoto,
  556.                         "parentsejour" => $parentsejour,
  557.                         'smsnotif' => $parentsejour->getSmsnotif(),
  558.                         'showpub' => $pubProd
  559.                     ]);
  560.                 }
  561.             }
  562.         }
  563.     }
  564.     /**
  565.      * @Route("/Parent/DetailsSejour", name="DetailsSejour")
  566.      */
  567.     public function ModifierSejour()
  568.     {
  569.         $SEjourService $this->sejourService;
  570.         $sejour $SEjourService->getsejour(3);
  571.         $listeattach $SEjourService->getatachmentsejour(3);
  572.         $positions $SEjourService->getsejourposition(3);
  573.         $messages $SEjourService->getsejourmessage(3);
  574.         //dd($messages);
  575.         $produits $this->typeProduiteService;
  576.         $liste $produits->produitlistTypeConditionnement();
  577.         return $this->render('Parent/DetailsSejour.html.twig', [
  578.             'prod' => $liste,
  579.             'sejour' => $sejour,
  580.             'listeattach' => $listeattach,
  581.             'positions' => $positions,
  582.             'messages' => $messages,
  583.         ]);
  584.     }
  585.     /**
  586.      * @Route("/Parent/listefavorie", name="listefavorie")
  587.      */
  588.     public function listefavorie()
  589.     {
  590.         $SEjourService $this->sejourService;
  591.         /** @var \App\Entity\User $user */
  592.         $user $this->getUser();
  593.         $userId $user->getId();
  594.         $session $this->session;
  595.         $session->set('pageMenu''');
  596.         $idSejour $session->get("Sejour");
  597.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  598.         dd($listeattachlikephoto);
  599.         return ('yoopii');
  600.     }
  601.     /**
  602.      * @Route("/Parent/Store", name="boutique5sur5")
  603.      */
  604.     public function boutique5sur5()
  605.     {
  606.         $SEjourService $this->sejourService;
  607.         /** @var \App\Entity\User $userId */
  608.         $userId $this->getUser();
  609.         $userId $userId->getId();
  610.         $session $this->session;
  611.         $session->set('pageMenu''boutique5su5');
  612.         $idSejour $session->get("Sejour");
  613.         $sejour $SEjourService->getsejourpourparent($idSejour);
  614.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  615.         $listeattach $SEjourService->getatachmentsejour($idSejour);
  616.         $messages $SEjourService->getsejourmessage($idSejour);
  617.         $nbImages count($listeattach);
  618.         $nbmessages count($messages);
  619.         $produit $this->typeProduiteService;
  620.         $liste $produit->produitlistTypeConditionnement();
  621.         $idAcc $sejour->getIdAcommp();
  622.         $em $this->em;
  623.         $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  624.         $nbLikes count($listeattachlikephoto);
  625.         // dd($liste);
  626.         return $this->render('Parent/boutique_5sur5.html.twig', [
  627.             "sejour" => $sejour,
  628.             'like' => $listeattachlikephoto,
  629.             'produit' => $liste,
  630.             'albumAcc' => $albumAcc,
  631.             'nbImages' => $nbImages,
  632.             'nbmessages' => $nbmessages,
  633.             'nbLikes' => $nbLikes
  634.         ]);
  635.     }
  636.     /*public function maSelection()
  637.     {
  638.         $SEjourService = $this->sejourService;
  639.         $user = $this->getUser();        
  640.         $userId = $user->getId();
  641.         $user = $this->getUser();
  642.         $session = $this->session;
  643.         $session->set('pageMenu', '');
  644.         $idSejour = $session->get("Sejour");
  645.         $sejour = $SEjourService->getsejourpourparent($idSejour);
  646.         $listeattachlikephoto = $SEjourService->getlikephotosejour($userId, $idSejour);
  647.         $produit = $this->typeProduiteService;
  648.         $liste = $produit->produitlistTypeConditionnement();
  649.         $idAcc = $sejour->getIdAcommp();
  650.         $em = $this->em;
  651.         $albumAcc = $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour, 'iduser' => $idAcc, 'statut' => 'saved'], ['id' => 'DESC']);
  652.         // dd($liste);
  653.         return $this->render('Parent/VoirMaSelection.html.twig', [
  654.             "sejour" => $sejour,
  655.             'like' => $listeattachlikephoto, 'produit' => $liste, 'albumAcc' => $albumAcc
  656.         ]);
  657.     }*/
  658.     /**
  659.      * @Route("/Parent/MaSelection", name="maSelection")
  660.      */
  661.     public function maSelection()
  662.     {
  663.         //Yosra
  664.         $nbLikes 0;
  665.         $SEjourService $this->sejourService;
  666.         $session $this->session;
  667.         $session->set('pageMenu''Meselection');
  668.         $idSejour $session->get("Sejour");
  669.         /** @var \App\Entity\User $user */
  670.         $user $this->getUser();
  671.         $iduser $user->getId();
  672.         $SEjourService $this->sejourService;
  673.         $SEjourService->inserparentsejourPayenet($iduser$idSejour);
  674.         $sejour $SEjourService->getsejour($idSejour);
  675.         $positions $SEjourService->getsejourposition($idSejour);
  676.         //$messages = $SEjourService->getsejourmessage($idSejour);
  677.         $messages $SEjourService->getCombinedattachSejour($idSejour'message');
  678.         $parentsejour $SEjourService->getparentsejour($iduser$idSejour);
  679.         $listeattachlikephoto $SEjourService->getlikephotosejour($iduser$idSejour);
  680.         $nbLikes count($listeattachlikephoto);
  681.         /* $listeattach = $SEjourService->getatachmentsejour($idSejour);
  682.         $listeVideo = $SEjourService->getVideosejour($idSejour);
  683.         $AllAttachements = array_merge_recursive($listeattach, $listeVideo); */
  684.         $AllAttachements $SEjourService->getCombinedattachSejour($idSejour'photoVideo');
  685.         $attachementsCount $AllAttachements['total'];
  686.         unset($AllAttachements['total']);
  687.         $produits $this->typeProduiteService;
  688.         $liste $produits->produitlistTypeConditionnement();
  689.         $pubProd $user->getShowpubprod();
  690.         return $this->render('Parent/DetailsSejour.html.twig', [
  691.             "sejour" => $sejour,
  692.             "listeattach" => $AllAttachements,
  693.             'attachementsCount' => $attachementsCount,
  694.             'positions' => $positions,
  695.             'messages' => $messages,
  696.             'likes' => $listeattachlikephoto,
  697.             'like' => $listeattachlikephoto,
  698.             'nblikes' => $nbLikes,
  699.             'nbImages' =>   $attachementsCount,
  700.             "parentsejour" => $parentsejour,
  701.             'prod' => $liste,
  702.             'smsnotif' => $parentsejour->getSmsnotif(),
  703.             'showpub' => $pubProd
  704.         ]);
  705.     }
  706.     /**
  707.      * @Route("/Parent/MesPhotosPerso", name="mesPhotosperso")
  708.      */
  709.     public function mesPhotosperso()
  710.     {  //Yosra
  711.         $SEjourService $this->sejourService;
  712.         $session $this->session;
  713.         $session->set('pageMenu''Meselection');
  714.         $idSejour $session->get("Sejour");
  715.         /** @var \App\Entity\User $user */
  716.         $user $this->getUser();
  717.         $iduser $user->getId();
  718.         $SEjourService $this->sejourService;
  719.         $sejour $SEjourService->getsejour($idSejour);
  720.         $positions $SEjourService->getsejourposition($idSejour);
  721.         $messages $SEjourService->getsejourmessage($idSejour);
  722.         $parentsejour $SEjourService->getparentsejour($iduser$idSejour);
  723.         $listeattachlikephoto $this->em->getRepository(SejourAttachment::class)->findBy(['idParent' => $iduser'statut' => "private"'idSejour' => $sejour]);
  724.         //$listeattach = $SEjourService->getatachmentsejour($idSejour);
  725.         $listeattach $SEjourService->getCombinedattachSejour($idSejour'photo');
  726.         $listeVideo $SEjourService->getVideosejour($idSejour);
  727.         $AllAttachements array_merge_recursive($listeattach$listeVideo);
  728.         $attachementsCount count($listeattach);
  729.         $nbImages count($listeattachlikephoto);
  730.         $produits $this->typeProduiteService;
  731.         $liste $produits->produitlistTypeConditionnement();
  732.         return $this->render('Parent/MesPhotosPerso.html.twig', [
  733.             "sejour" => $sejour,
  734.             'attachementsCount' => $attachementsCount,
  735.             'listeattach' => $AllAttachements,
  736.             'positions' => $positions,
  737.             'nbImages' => $nbImages,
  738.             'messages' => $messages,
  739.             'likes' => $listeattachlikephoto,
  740.             "parentsejour" => $parentsejour,
  741.             'prod' => $liste,
  742.             'smsnotif' => $parentsejour->getSmsnotif()
  743.         ]);
  744.     }
  745.       /**
  746.      * @Route("/Parent/achatBoiteVocale", name="achatBoiteVocale")
  747.      */
  748.     public function achatBoiteVocale()
  749.     {
  750.         $this->session->set('rout''rout');
  751.         $session $this->session;
  752.         /** @var \App\Entity\User $user */
  753.         $user $this->getUser();
  754.         $iduser $user->getId();
  755.         $idSejour $session->get("Sejour");
  756.         $ses_id session_id();
  757.         $SEjourService $this->sejourService;
  758.         $sejour $this->em->getRepository(Sejour::class)->find($idSejour);
  759.         $parentsejour $SEjourService->getparentsejour($iduser$idSejour);
  760.         $AllAttachements $SEjourService->getCombinedattachSejour($idSejour'photoVideo');
  761.         return $this->render('Parent/achatBoiteVocale.html.twig', ["sejour" => $sejour'images' => $AllAttachements"session_id" => $ses_id'ParentSejour' => $parentsejour]);
  762.     }
  763.     /**
  764.      * @Route("/Parent/achatsejour", name="achatsejour")
  765.      */
  766.     public function achatsejour()
  767.     {
  768.         $this->session->set('rout''rout');
  769.         $session $this->session;
  770.         /** @var \App\Entity\User $user */
  771.         $user $this->getUser();
  772.         $iduser $user->getId();
  773.         $idSejour $session->get("Sejour");
  774.         $ses_id session_id();
  775.         $SEjourService $this->sejourService;
  776.         $sejour $this->em->getRepository(Sejour::class)->find($idSejour);
  777.         $parentsejour $SEjourService->getparentsejour($iduser$idSejour);
  778.         $AllAttachements $SEjourService->getCombinedattachSejour($idSejour'photoVideo');
  779.         return $this->render('Parent/achatsejour.html.twig', ["sejour" => $sejour'images' => $AllAttachements"session_id" => $ses_id'ParentSejour' => $parentsejour]);
  780.     }
  781.     /**
  782.      * @Route("/Parent/CodeSejour", name="CodeSejour")
  783.      */
  784.     public function CodeSejour()
  785.     {
  786.         /** @var \App\Entity\User $user */
  787.         $user $this->getUser();
  788.         $userId $user->getId();
  789.         $this->session->set('rout''code');
  790.         return $this->render('Parent/EntrerVotreCodeSejour.html.twig', ['user' => $user"defaultval" => 0'smsnotif' => $user->getSmsnotif()]);
  791.     }
  792.     /** @Route("/Parent/produits", name="produit_parent")
  793.      */
  794.     public function produitsparent()
  795.     {
  796.         $SEjourService $this->sejourService;
  797.         $produitparent $this->typeProduiteService;
  798.         /** @var \App\Entity\User $user */
  799.         $user $this->getUser();
  800.         $userId $user->getId();
  801.         $session $this->session;
  802.         $session->set('pageMenu''');
  803.         $idSejour $session->get("Sejour");
  804.         $listproduit $produitparent->produitparent();
  805.         return ('yoopii');
  806.     }
  807.     /**
  808.      * @Route("/Parent/AucunePhoto", name="AucunePhoto")
  809.      * */
  810.     public function premiercnx()
  811.     {
  812.         $this->session->set('rout''rout');
  813.         return $this->render('Parent/Aucunphoto.html.twig');
  814.     }
  815.     /**
  816.      * @Route("/Parent/notif", name="notif_parent",methods={"POST","GET"})
  817.      */
  818.     public function notif_parent(Request $request)
  819.     {
  820.         $UserService $this->userService;
  821.         $session $this->session;
  822.         $session->set('pageMenu''');
  823.         $idSejour $session->get("Sejour");
  824.         // $sejour = $sejourservice->getsejourpourparent($idSejour);
  825.         /** @var \App\Entity\User $user */
  826.         $user $this->getUser();
  827.         $iduser $user->getId();
  828.         $sms $request->get("sms");
  829.         $mail $request->get('mail');
  830.         $refaverti $request->get('refaverti');
  831.         //$ville = $request->get("nonnotif");
  832.         $parentsejour $UserService->notifparentsejour($mail$sms$idSejour$iduser$refaverti);
  833.         return new JsonResponse('done');
  834.     }
  835.     /**
  836.      * @Route("/Parent/passerconnxion", name="notif_parenpasserconnxion",methods={"POST","GET"})
  837.      */
  838.     public function passerconnxion(Request $request)
  839.     {
  840.         $UserService $this->userService;
  841.         $session $this->session;
  842.         $session->set('pageMenu''');
  843.         $idSejour $session->get("Sejour");
  844.         // $sejour = $sejourservice->getsejourpourparent($idSejour);
  845.         /** @var \App\Entity\User $user */
  846.         $user $this->getUser();
  847.         $iduser $user->getId();
  848.         $SEjourService $this->sejourService;
  849.         $setparentsejour $SEjourService->inserparentsejourPayenet($iduser$idSejour);
  850.         $sejour $SEjourService->getsejour($idSejour);
  851.         $positions $SEjourService->getsejourposition($idSejour);
  852.         $messages $SEjourService->getsejourmessage($idSejour);
  853.         $parentsejour $SEjourService->getparentsejour($iduser$idSejour);
  854.         $listeattachlikephoto $SEjourService->getlikephotosejour($iduser$idSejour);
  855.         $listeattach $SEjourService->getatachmentsejour($idSejour);
  856.         if (sizeof($sejour->getAttachements()) == 0) {
  857.             return new JsonResponse('0');
  858.         } else {
  859.             return new JsonResponse('1');
  860.         }
  861.     }
  862.     /**
  863.      * @Route("/Parent/sejourParent", name="sejourParent_5sur5")
  864.      * */
  865.     public function sejourParent()
  866.     {
  867.         $SEjourService $this->sejourService;
  868.         $UserService $this->userService;
  869.         $session $this->session;
  870.         $session->set('pageMenu''');
  871.         $idSejour $session->get("Sejour");
  872.         // $sejour = $sejourservice->getsejourpourparent($idSejour);
  873.         /** @var \App\Entity\User $user */
  874.         $user $this->getUser();
  875.         $iduser $user->getId();
  876.         $SEjourService $this->sejourService;
  877.         $setparentsejour $SEjourService->inserparentsejourPayenet($iduser$idSejour);
  878.         $sejour $SEjourService->getsejour($idSejour);
  879.         $positions $SEjourService->getsejourposition($idSejour);
  880.         $messages $SEjourService->getsejourmessage($idSejour);
  881.         $parentsejour $SEjourService->getparentsejour($iduser$idSejour);
  882.         $listeattachlikephoto $SEjourService->getlikephotosejour($iduser$idSejour);
  883.         $listeattach $SEjourService->getatachmentsejour($idSejour);
  884.         $nbImages count($listeattach);
  885.         $listeVideo $SEjourService->getVideosejour($idSejour);
  886.         $AllAttachements array_merge_recursive($listeattach$listeVideo);
  887.         $produits $this->typeProduiteService;
  888.         $liste $produits->produitlistTypeConditionnement();
  889.         $pubProd $user->getShowpubprod();
  890.         return $this->render('Parent/DetailsSejour.html.twig', [
  891.             "sejour" => $sejour,
  892.             'listeattach' => $AllAttachements,
  893.             'positions' => $positions,
  894.             'nbImages' => $nbImages,
  895.             'messages' => $messages,
  896.             'like' => $listeattachlikephoto,
  897.             "parentsejour" => $parentsejour,
  898.             'prod' => $liste,
  899.             'smsnotif' => $parentsejour->getSmsnotif(),
  900.             'showpub' => $pubProd
  901.         ]);
  902.     }
  903.     /**
  904.      * @Route("/Parent/sejourVide", name="sejourvideee")
  905.      * */
  906.     public function sejourvide()
  907.     {
  908.         $this->session->set('rout''code');
  909.         $SEjourService $this->sejourService;
  910.         $UserService $this->userService;
  911.         $session $this->session;
  912.         $session->set('pageMenu''');
  913.         $idSejour $session->get("Sejour");
  914.         // $sejour = $sejourservice->getsejourpourparent($idSejour);
  915.         /** @var \App\Entity\User $user */
  916.         $user $this->getUser();
  917.         $iduser $user->getId();
  918.         $SEjourService $this->sejourService;
  919.         $setparentsejour $SEjourService->inserparentsejourPayenet($iduser$idSejour);
  920.         $sejour $SEjourService->getsejour($idSejour);
  921.         $positions $SEjourService->getsejourposition($idSejour);
  922.         $messages $SEjourService->getsejourmessage($idSejour);
  923.         $parentsejour $SEjourService->getparentsejour($iduser$idSejour);
  924.         $listeattachlikephoto $SEjourService->getlikephotosejour($iduser$idSejour);
  925.         $listeattach $SEjourService->getatachmentsejour($idSejour);
  926.         return $this->render('Parent/Aucunphoto.html.twig', [
  927.             "sejour" => $sejour,
  928.             "parentsejour" => $parentsejour
  929.         ]);
  930.     }
  931.     /**
  932.      * @Route("Parent/EditContenuPage", name="EditContenuPage")
  933.      */
  934.     public function EditContenuPageParent()
  935.     {
  936.         $em $this->em;
  937.         $Albumproduct $em->getRepository(Produit::class)->findBy(['idConditionnement' => 4]);
  938.         foreach ($Albumproduct as $album) {
  939.             $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $album]);
  940.             foreach ($AllPages as $p) {
  941.                 $arrayexploded $p->getCouleurbordure();
  942.                 $arrayexploded1 str_replace("font-size""fontSize"$arrayexploded);
  943.                 $p->setCouleurbordure($arrayexploded1);
  944.                 $em->getManager()->persist($p);
  945.                 $em->getManager()->flush();
  946.             }
  947.         }
  948.         return new Response('ok');
  949.     }
  950.     /**
  951.      * @Route("Parent/AjoutAlbum", name="EditionAlbum")
  952.      */
  953.     public function EditionAlbumParent()
  954.     {
  955.         $SEjourService $this->sejourService;
  956.         $em $this->em;
  957.         /** @var \App\Entity\User $user */
  958.         $user $this->getUser();
  959.         $userId $user->getId();
  960.         $session $this->session;
  961.         $session->set('pageMenu''AlbumSejour');
  962.         $idSejour $session->get("Sejour");
  963.         $clipart null;
  964.         $random true;
  965.         $sejour $SEjourService->getsejourpourparent($idSejour);
  966.         $idAcc $sejour->getIdAcommp();
  967.         $part $sejour->getIdPartenaire();
  968.         $nompart $part->getUsername();
  969.         $logopart $part->getLogourl();
  970.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  971.         $nbLikes count($listeattachlikephoto);
  972.         $listeattach $SEjourService->getCombinedattachSejour($idSejour'photo');
  973.         $listerandom $listeattach;
  974.         $nbPhoto count($listeattach);
  975.         $AllPagesAcc null;
  976.         $Albumproduct $em->getRepository(Produit::class)->findOneBy(['labele' => 'random']);
  977.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  978.         $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  979.         if ($albumAcc) {
  980.             $AllPagesAcc $em->getRepository(Page::class)->findBy(['idproduit' => $albumAcc]);
  981.         }
  982.         $allpagesResult = array();
  983.         $tabacc = array();
  984.         $tabacc1 = array();
  985.         if ($random == true) {
  986.             foreach ($AllPages as $p) {
  987.                 $arrayexploded preg_split('[randomid|randompath]'$p->getCouleurbordure());
  988.                 $rr "";
  989.                 for ($i 0$i sizeof($arrayexploded); $i $i 2) {
  990.                     if ($i sizeof($arrayexploded)) {
  991.                         if (sizeof($listerandom) == 0) {
  992.                             //$listerandom = $SEjourService->getatachmentsejour($idSejour);
  993.                             $listerandom $SEjourService->getCombinedattachSejour($idSejour'photo');
  994.                         }
  995.                         if ($nbLikes != 0) {
  996.                             $listerandom $SEjourService->getlikephotosejour($userId$idSejour);
  997.                             $arrayRsRandom $this->random_function($listerandom);
  998.                         }
  999.                         if ($nbLikes == 0) {
  1000.                             $arrayRsRandom $this->random_functionNolikes($listerandom);
  1001.                         }
  1002.                         array_push($tabacc$arrayRsRandom['idelem']);
  1003.                         $rr $rr $arrayexploded[$i] . $arrayRsRandom['idelem'] . $arrayexploded[$i 1] . $arrayRsRandom['pathelem'];
  1004.                         unset($listerandom[$arrayRsRandom['elem']]);
  1005.                     } else {
  1006.                         $rr $rr $arrayexploded[$i];
  1007.                     }
  1008.                     $listerandom $listerandom;
  1009.                 }
  1010.                 $resultFinal $rr;
  1011.                 $p->setCouleurbordure($resultFinal);
  1012.                 array_push($allpagesResult$p);
  1013.             }
  1014.             $AllPages $allpagesResult;
  1015.         }
  1016.         $tabacc1 array_count_values($tabacc);
  1017.         if ($nbLikes  == 0) {
  1018.             return $this->render('Parent/NewAlbumLikes.html.twig', ["listeattach" => $listeattach"tabacc" => $tabacc1"nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'like' => $listeattachlikephoto'cliparts' => $clipart'Album' => $Albumproduct'AllPages' => $AllPages'albumAcc' => $albumAcc'AllPagesAcc' => $AllPagesAcc'random' => $random'listeattach' => $listeattach'nbLikes' => $nbLikes'nbPhoto' => $nbPhoto]);
  1019.         }
  1020.         if ($nbLikes  != 0) {
  1021.             return $this->render('Parent/NewAlbumLikes.html.twig', ["tabacc" => $tabacc1"nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'like' => $listeattachlikephoto'cliparts' => $clipart'Album' => $Albumproduct'AllPages' => $AllPages'albumAcc' => $albumAcc'AllPagesAcc' => $AllPagesAcc'random' => $random'listeattach' => $listeattach'nbLikes' => $nbLikes'nbPhoto' => $nbPhoto]);
  1022.         }
  1023.     }
  1024.     /**
  1025.      * @Route("Parent/AjoutPochettePhotos_Sejour/{nbr}", name="AjoutPochettePhotos_Sejour")
  1026.      */
  1027.     public function AjoutPochettePhotosParent_Sejour($nbr)
  1028.     {
  1029.         $SEjourService $this->sejourService;
  1030.         $userId $this->getUser()->getId();
  1031.         $user $this->getUser();
  1032.         $session $this->get('session');
  1033.         $session->set('pageMenu''');
  1034.         $idSejour $session->get("Sejour");
  1035.         $produitcondition $session->get("produit");
  1036.         $produit $session->get("produittype");
  1037.         $sejour $SEjourService->getsejourpourparent($idSejour);
  1038.         $em $this->getDoctrine()->getManager();
  1039.         $clipart $em->getRepository(Clipart::class)->findAll();
  1040.         $listeattach $SEjourService->getCombinedattachSejour($idSejour'photo');
  1041.         $listerandom =  $listeattach;
  1042.         $AllPagesAcc null;
  1043.         //        $random = false;
  1044.         //        $Albumproduct = $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour, 'iduser' => $userId], ['id' => 'DESC']);
  1045.         //        if ($Albumproduct == null || $Albumproduct == "") {
  1046.         $Albumproduct $em->getRepository(Produit::class)->findOneBy(['labele' => 'RandomPochette' $nbr]);
  1047.         $random true;
  1048.         //        }
  1049.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  1050.         $idAcc $sejour->getIdAcommp();
  1051.         $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  1052.         $part $sejour->getIdPartenaire();
  1053.         //$part = $em->getRepository(Etablisment::class)->findOneBy(['id' => $idpart->getId()]);
  1054.         //dd($part);
  1055.         $nompart $part->getUsername();
  1056.         $logopart $part->getLogourl();
  1057.         // dd($Albumproduct);  
  1058.         if ($albumAcc != null and $albumAcc != "") {
  1059.             $AllPagesAcc $em->getRepository(Page::class)->findBy(['idproduit' => $albumAcc]);
  1060.         }
  1061.         //        dd($albumAcc);
  1062.         $allpagesResult = array();
  1063.         $j 0;
  1064.         if ($random == true) {
  1065.             foreach ($AllPages as $p) {
  1066.                 $arrayexploded preg_split('[randomid|randompath]'$p->getCouleurbordure());
  1067.                 //                var_dump($arrayexploded);
  1068.                 $rr "";
  1069.                 $elemPath "";
  1070.                 $elemId "";
  1071.                 for ($i 0$i sizeof($arrayexploded); $i $i 2) {
  1072.                     if ($i sizeof($arrayexploded)) {
  1073.                         if (sizeof($listerandom) == 0) {
  1074.                             $listerandom =  $listeattach;
  1075.                         }
  1076.                         $arrayRsRandom $this->random_functionPhotoNolIKES($listerandom$j);
  1077.                         $rr $rr $arrayexploded[$i] . $arrayRsRandom['idelem'] . $arrayexploded[$i 1] . $arrayRsRandom['pathelem'];
  1078.                         unset($listerandom[$arrayRsRandom['elem']]);
  1079.                     } else {
  1080.                         $rr $rr $arrayexploded[$i];
  1081.                     }
  1082.                     $listerandom $listerandom;
  1083.                 }
  1084.                 $resultFinal $rr;
  1085.                 $p->setCouleurbordure($resultFinal);
  1086.                 array_push($allpagesResult$p);
  1087.                 if ($j sizeof($listeattach) - 1) {
  1088.                     $j $j 1;
  1089.                 } else {
  1090.                     $j 0;
  1091.                 }
  1092.             }
  1093.             $AllPages $allpagesResult;
  1094.         }
  1095.         // die();
  1096.         $nbAttach count($listeattach);
  1097.         return $this->render('Parent/PochettePhotos.html.twig', ["nbr" => $nbr"nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'cliparts' => $clipart'Album' => $Albumproduct'AllPages' => $AllPages'albumAcc' => $albumAcc'AllPagesAcc' => $AllPagesAcc'random' => $random'photosSejour' => $listeattach'nbAttach' => $nbAttach]);
  1098.     }
  1099.     /**
  1100.      * @Route("Parent/AjoutPochettePhotos_Fav/{nbr}", name="AjoutPochettePhotos_Favoris")
  1101.      */
  1102.     public function EnregistrerPochettePhoto($nbr)
  1103.     {
  1104.         $SEjourService $this->sejourService;
  1105.         $user $this->getUser();
  1106.         $userId $this->getUser()->getId();
  1107.         $session $this->get('session');
  1108.         $session->set('pageMenu''');
  1109.         $idSejour $session->get("Sejour");
  1110.         $produitcondition $session->get("produit");
  1111.         $produit $session->get("produittype");
  1112.         $sejour $SEjourService->getsejourpourparent($idSejour);
  1113.         $em $this->getDoctrine()->getManager();
  1114.         $clipart $em->getRepository(Clipart::class)->findAll();
  1115.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  1116.         $listerandom $listeattachlikephoto;
  1117.         $Albumproduct $em->getRepository(Produit::class)->findOneBy(['labele' => 'RandomPochette' $nbr]);
  1118.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  1119.         $allpagesResult = array();
  1120.         $j 0;
  1121.         foreach ($AllPages as $p) {
  1122.             $arrayexploded preg_split('[randomid|randompath]'$p->getCouleurbordure());
  1123.             //                var_dump($arrayexploded);
  1124.             $rr "";
  1125.             $elemPath "";
  1126.             $elemId "";
  1127.             for ($i 0$i sizeof($arrayexploded); $i $i 2) {
  1128.                 if ($i sizeof($arrayexploded)) {
  1129.                     if (sizeof($listerandom) == 0) {
  1130.                         $listerandom $listeattachlikephoto;
  1131.                     }
  1132.                     $arrayRsRandom $this->random_functionPhoto($listerandom);
  1133.                     $rr $rr $arrayexploded[$i] . $arrayRsRandom['idelem'] . $arrayexploded[$i 1] . $arrayRsRandom['pathelem'];
  1134.                     unset($listerandom[$arrayRsRandom['elem']]);
  1135.                 } else {
  1136.                     $rr $rr $arrayexploded[$i];
  1137.                 }
  1138.                 $listerandom $listerandom;
  1139.             }
  1140.             $resultFinal $rr;
  1141.             $p->setCouleurbordure($resultFinal);
  1142.             array_push($allpagesResult$p);
  1143.             if ($j sizeof($listeattachlikephoto) - 1) {
  1144.                 $j $j 1;
  1145.             } else {
  1146.                 $j 0;
  1147.             }
  1148.         }
  1149.         $AllPages $allpagesResult;
  1150.         // die();
  1151.         return new JsonResponse('done');
  1152.     }
  1153.     /**
  1154.      * @Route("Parent/AjoutPochettePhotos_Fav/{nbr}", name="AjoutPochettePhotos_Favoris")
  1155.      */
  1156.     public function AjoutPochettePhotosParent_Fav($nbr)
  1157.     {
  1158.         $SEjourService $this->sejourService;
  1159.         $user $this->getUser();
  1160.         $userId $this->getUser()->getId();
  1161.         $session $this->get('session');
  1162.         $session->set('pageMenu''');
  1163.         $idSejour $session->get("Sejour");
  1164.         $produitcondition $session->get("produit");
  1165.         $produit $session->get("produittype");
  1166.         $sejour $SEjourService->getsejourpourparent($idSejour);
  1167.         $em $this->getDoctrine()->getManager();
  1168.         $listeattachlikephoto $em->getRepository(Likephoto::class)->findBy(['idUser' =>  $userId'idSejour' =>  $idSejour]);
  1169.         foreach ($listeattachlikephoto as $photo) {
  1170.             $idattach $photo->getIdSejourAttchment();
  1171.             $SejattachPhoto  $photo->getIdSejourAttchment();
  1172.             $urlPhoto  =   $SejattachPhoto->getIdAttchment()->getPath();
  1173.             //$urlPhoto =   $attachPhoto->getPath();
  1174.             $new_url str_replace('upload/''upload/f_auto,q_auto,h_900/l_Logo5Sur5White_nh6tyk,o_10,fl_relative.tiled/',  $urlPhoto);
  1175.             $photosData[] = [
  1176.                 'id' => $photo->getId(),
  1177.                 'url' =>    $new_url,
  1178.                 'caption' => "",
  1179.             ];
  1180.         }
  1181.         $nbLikes count($listeattachlikephoto);
  1182.         // Convertir le tableau PHP en JSON
  1183.         $photosDataJSON json_encode($photosData);
  1184.         return $this->render('Parent/PochettePhotosLikes.html.twig', ["nbr" => $nbr"sejour" => $sejour,  "nbLikes" => $nbLikes'photosFav' =>    $photosDataJSON]);
  1185.     }
  1186.     /**
  1187.      * @Route("Parent/AjoutRetroPhotos_Fav/{nbr}", name="AjoutRetroPhotos_Favoris")
  1188.      */
  1189.     public function AjoutRetroPhotosParent_Fav($nbr)
  1190.     {
  1191.         $SEjourService $this->sejourService;
  1192.         $user $this->getUser();
  1193.         $userId $this->getUser()->getId();
  1194.         $session $this->get('session');
  1195.         $session->set('pageMenu''');
  1196.         $idSejour $session->get("Sejour");
  1197.         $produitcondition $session->get("produit");
  1198.         $produit $session->get("produittype");
  1199.         $sejour $SEjourService->getsejourpourparent($idSejour);
  1200.         $em $this->getDoctrine()->getManager();
  1201.         $listeattachlikephoto $em->getRepository(Likephoto::class)->findBy(['idUser' =>  $userId'idSejour' =>  $idSejour]);
  1202.         foreach ($listeattachlikephoto as $photo) {
  1203.             $idattach $photo->getIdSejourAttchment();
  1204.             $SejattachPhoto  $photo->getIdSejourAttchment();
  1205.             $urlPhoto  =   $SejattachPhoto->getIdAttchment()->getPath();
  1206.             //$urlPhoto =   $attachPhoto->getPath();
  1207.             $new_url str_replace('upload/''upload/f_auto,q_auto,h_900/l_Logo5Sur5White_nh6tyk,o_10,fl_relative.tiled/',  $urlPhoto);
  1208.             $photosData[] = [
  1209.                 'id' => $photo->getId(),
  1210.                 'url' =>    $new_url,
  1211.                 'caption' => "",
  1212.             ];
  1213.         }
  1214.         $nbLikes count($listeattachlikephoto);
  1215.         // Convertir le tableau PHP en JSON
  1216.         $photosDataJSON json_encode($photosData);
  1217.         return $this->render('Parent/RetroRefonte.html.twig', ["nbr" => $nbr"sejour" => $sejour,  "nbLikes" => $nbLikes'photosFav' =>    $photosDataJSON]);
  1218.     }
  1219.     function random_function($listerandom)
  1220.     {
  1221.         $elem array_rand($listerandom);
  1222.         $photo $listerandom[$elem];
  1223.         $idelem $photo->getIdSejourAttchment()->getIdAttchment()->getId();
  1224.         $pathelem $photo->getIdSejourAttchment()->getIdAttchment()->getPath();
  1225.         return array('pathelem' => $pathelem'idelem' => $idelem'elem' => $elem);
  1226.     }
  1227.     function random_functionNolikes($listerandom)
  1228.     {
  1229.         //dd(array_keys($listerandom));
  1230.         $elem array_rand($listerandom);
  1231.         $photo $listerandom[$elem];
  1232.         $idelem $photo["id"];
  1233.         $pathelem $photo["path"];
  1234.         return array('pathelem' => $pathelem'idelem' => $idelem'elem' => $elem);
  1235.     }
  1236.     function random_functionPhoto($listerandom)
  1237.     {
  1238.         $elem array_rand($listerandom);
  1239.         $photo $listerandom[$elem];
  1240.         $idelem $photo->getIdSejourAttchment()->getIdAttchment()->getId();
  1241.         $pathelem $photo->getIdSejourAttchment()->getIdAttchment()->getPath();
  1242.         return array('pathelem' => $pathelem'idelem' => $idelem'elem' => $elem);
  1243.     }
  1244.     function random_functionPhotosSejour($listerandom$elem)
  1245.     {
  1246.         $elem array_rand($listerandom);
  1247.         $photo $listerandom[$elem];
  1248.         $idelem $photo->getId();
  1249.         $pathelem $photo->getPath();
  1250.         return array('pathelem' => $pathelem'idelem' => $idelem'elem' => $elem);
  1251.     }
  1252.     function random_functionPhotoNolIKES($listerandom$elem)
  1253.     {
  1254.         $elem array_rand($listerandom);
  1255.         $photo $listerandom[$elem];
  1256.         $idelem $photo['id'];
  1257.         $pathelem $photo['path'];
  1258.         return array('pathelem' => $pathelem'idelem' => $idelem'elem' => $elem);
  1259.     }
  1260.     /**
  1261.      * @Route("Parent/LivrePhotos", name="LivrePhotos")
  1262.      */
  1263.     public function EditionLivrePhotosParent()
  1264.     {
  1265.         $SEjourService $this->sejourService;
  1266.         /** @var \App\Entity\User $user */
  1267.         $user $this->getUser();
  1268.         $userId $user->getId();
  1269.         $session $this->session;
  1270.         $session->set('pageMenu''');
  1271.         $idSejour $session->get("Sejour");
  1272.         $sejour $this->getDoctrine()->getRepository(Sejour::class)->findOneBy(['id' => $idSejour]);
  1273.         $em $this->em;
  1274.         $clipart null;
  1275.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  1276.         $nbLikes count($listeattachlikephoto);
  1277.         //$listerandom = $SEjourService->getatachmentsejour($idSejour);
  1278.         $listerandom $SEjourService->getCombinedattachSejour($idSejour'photo');
  1279.         $random true;
  1280.         $allpagesResult = array();
  1281.         $Albumproduct $em->getRepository(Produit::class)->findOneBy(['labele' => 'randomLivre']);
  1282.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  1283.         $part $sejour->getIdPartenaire();
  1284.         $nompart $part->getUsername();
  1285.         $logopart $part->getLogourl();
  1286.         $tabacc = array();
  1287.         $tabacc1 = array();
  1288.         foreach ($AllPages as $p) {
  1289.             $arrayexploded preg_split('[randomid|randompath]'$p->getCouleurbordure());
  1290.             $rr "";
  1291.             for ($i 0$i sizeof($arrayexploded); $i $i 2) {
  1292.                 if ($i sizeof($arrayexploded)) {
  1293.                     if (sizeof($listerandom) == 0) {
  1294.                         //$listerandom = $SEjourService->getatachmentsejour($idSejour);
  1295.                         $listerandom $SEjourService->getCombinedattachSejour($idSejour'photo');
  1296.                     }
  1297.                     if ($nbLikes != 0) {
  1298.                         $listerandom $SEjourService->getlikephotosejour($userId$idSejour);
  1299.                         $arrayRsRandom $this->random_function($listerandom);
  1300.                     }
  1301.                     if ($nbLikes == 0) {
  1302.                         $arrayRsRandom $this->random_functionNolikes($listerandom);
  1303.                     }
  1304.                     array_push($tabacc$arrayRsRandom['idelem']);
  1305.                     $rr $rr $arrayexploded[$i] . $arrayRsRandom['idelem'] . $arrayexploded[$i 1] . $arrayRsRandom['pathelem'];
  1306.                     unset($listerandom[$arrayRsRandom['elem']]);
  1307.                 } else {
  1308.                     $rr $rr $arrayexploded[$i];
  1309.                 }
  1310.                 $listerandom $listerandom;
  1311.             }
  1312.             $resultFinal $rr;
  1313.             $p->setCouleurbordure($resultFinal);
  1314.             array_push($allpagesResult$p);
  1315.         }
  1316.         $AllPages $allpagesResult;
  1317.         $tabacc1 array_count_values($tabacc);
  1318.         $listeattach $SEjourService->getCombinedattachSejour($idSejour'photo');
  1319.         $nbPhotos count($listeattach);
  1320.         $nbLike count($listeattachlikephoto);
  1321.         if ($nbLike == 0) {
  1322.             return $this->render('Parent/NewLivre.html.twig', ["tabacc" => $tabacc1"nompart" => $nompart"logopart" => $logopart"sejour" => $sejour,  'cliparts' => $clipart'Album' => $Albumproduct'AllPages' => $AllPages'random' => $random'listeattach' => $listeattach'nbLikes' => $nbLikes'nbPhotos' => $nbPhotos]);
  1323.         }
  1324.         if ($nbLike != 0) {
  1325.             return $this->render('Parent/NewLivreLikes.html.twig', ["tabacc" => $tabacc1"nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'like' => $listeattachlikephoto'cliparts' => $clipart'Album' => $Albumproduct'AllPages' => $AllPages'random' => $random'listeattach' => $listeattach'nbLikes' => $nbLikes'nbPhotos' => $nbPhotos]);
  1326.         }
  1327.     }
  1328.     /**
  1329.      * @Route("Parent/AjoutPochettePhotos/{nbr}", name="AjoutPochettePhotos")
  1330.      */
  1331.     public function AjoutPochettePhotosParent($nbr)
  1332.     {
  1333.         $SEjourService $this->sejourService;
  1334.         /** @var \App\Entity\User $user */
  1335.         $user $this->getUser();
  1336.         $userId $user->getId();
  1337.         $user $this->getUser();
  1338.         $session $this->session;
  1339.         $session->set('pageMenu''');
  1340.         $idSejour $session->get("Sejour");
  1341.         $sejour $SEjourService->getsejourpourparent($idSejour);
  1342.         $em $this->em;
  1343.         //$listeattach = $SEjourService->getatachmentsejour($idSejour);
  1344.         $listeattach $SEjourService->getCombinedattachSejour($idSejour'photo');
  1345.         $nbPhoto count($listeattach);
  1346.         $clipart $em->getRepository(Clipart::class)->findAll();
  1347.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  1348.         $nbLikes count($listeattachlikephoto);
  1349.         $listerandom  = array();
  1350.         $listerandom $listeattach;
  1351.         $AllPagesAcc null;
  1352.         $Albumproduct $em->getRepository(Produit::class)->findOneBy(['labele' => 'RandomPochette' $nbr]);
  1353.         $random true;
  1354.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  1355.         $idAcc $sejour->getIdAcommp();
  1356.         $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  1357.         $part $sejour->getIdPartenaire();
  1358.         $nompart $part->getUsername();
  1359.         $logopart $part->getLogourl();
  1360.         if ($albumAcc != null and $albumAcc != "") {
  1361.             $AllPagesAcc $em->getRepository(Page::class)->findBy(['idproduit' => $albumAcc]);
  1362.         }
  1363.         $allpagesResult = array();
  1364.         $j 0;
  1365.         if ($random == true) {
  1366.             foreach ($AllPages as $p) {
  1367.                 $arrayexploded preg_split('[randomid|randompath]'$p->getCouleurbordure());
  1368.                 $rr "";
  1369.                 for ($i 0$i sizeof($arrayexploded); $i $i 2) {
  1370.                     if ($i sizeof($arrayexploded)) {
  1371.                         if (sizeof($listerandom) == 0) {
  1372.                             //$listerandom = $SEjourService->getatachmentsejour($idSejour);
  1373.                             $listerandom $SEjourService->getCombinedattachSejour($idSejour'photo');
  1374.                         }
  1375.                         if ($nbLikes != 0) {
  1376.                             $listerandom $listeattachlikephoto;
  1377.                             $arrayRsRandom $this->random_functionPhoto($listerandom);
  1378.                         }
  1379.                         if ($nbLikes == 0) {
  1380.                             $arrayRsRandom $this->random_functionPhotoNolIKES($listerandom$j);
  1381.                         }
  1382.                         $rr $rr $arrayexploded[$i] . $arrayRsRandom['idelem'] . $arrayexploded[$i 1] . $arrayRsRandom['pathelem'];
  1383.                         unset($listerandom[$arrayRsRandom['elem']]);
  1384.                     } else {
  1385.                         $rr $rr $arrayexploded[$i];
  1386.                     }
  1387.                     $listerandom $listerandom;
  1388.                 }
  1389.                 $resultFinal $rr;
  1390.                 $p->setCouleurbordure($resultFinal);
  1391.                 array_push($allpagesResult$p);
  1392.                 if ($j sizeof($listeattachlikephoto) - 1) {
  1393.                     $j $j 1;
  1394.                 } else {
  1395.                     $j 0;
  1396.                 }
  1397.             }
  1398.             $AllPages $allpagesResult;
  1399.         }
  1400.         return $this->render('Parent/PochettePhotos.html.twig', ["nbr" => $nbr"nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'like' => $listeattachlikephoto'cliparts' => $clipart'Album' => $Albumproduct'AllPages' => $AllPages'albumAcc' => $albumAcc'AllPagesAcc' => $AllPagesAcc'random' => $random'listeattach' => $listeattach'nbPhoto' => $nbPhoto'Likes' => $nbLikes]);
  1401.     }
  1402.     /**
  1403.      * @Route("Parent/AjoutPhotosRetrosFavoris/{nbr}", name="AjoutPhotosRetros_Favoris")
  1404.      */
  1405.     public function AjoutPhotosRetrosParentFavoris($nbr)
  1406.     {
  1407.         $SEjourService $this->sejourService;
  1408.         /** @var \App\Entity\User $user */
  1409.         $user $this->getUser();
  1410.         $userId $user->getId();
  1411.         $session $this->session;
  1412.         $session->set('pageMenu''');
  1413.         $idSejour $session->get("Sejour");
  1414.         $sejour $SEjourService->getsejourpourparent($idSejour);
  1415.         $em $this->em;
  1416.         $clipart $em->getRepository(Clipart::class)->findAll();
  1417.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  1418.         $nbLikes count($listeattachlikephoto);
  1419.         //$listeattach = $SEjourService->getatachmentsejour($idSejour);
  1420.         $listeattach $SEjourService->getCombinedattachSejour($idSejour'photo');
  1421.         $listerandom =  $listeattach;
  1422.         $AllPagesAcc null;
  1423.         $Albumproduct $em->getRepository(Produit::class)->findOneBy(['labele' => 'RandomPochette' $nbr]);
  1424.         $random true;
  1425.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  1426.         $idAcc $sejour->getIdAcommp();
  1427.         $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  1428.         $part $sejour->getIdPartenaire();
  1429.         $nompart $part->getUsername();
  1430.         $logopart $part->getLogourl();
  1431.         if ($albumAcc != null and $albumAcc != "") {
  1432.             $AllPagesAcc $em->getRepository(Page::class)->findBy(['idproduit' => $albumAcc]);
  1433.         }
  1434.         $allpagesResult = array();
  1435.         $j 0;
  1436.         if ($random == true) {
  1437.             foreach ($AllPages as $p) {
  1438.                 $arrayexploded preg_split('[randomid|randompath]'$p->getCouleurbordure());
  1439.                 $rr "";
  1440.                 for ($i 0$i sizeof($arrayexploded); $i $i 2) {
  1441.                     if ($i sizeof($arrayexploded)) {
  1442.                         if (sizeof($listerandom) == 0) {
  1443.                             //$listerandom = $SEjourService->getatachmentsejour($idSejour);
  1444.                             $listerandom $SEjourService->getCombinedattachSejour($idSejour'photo');
  1445.                         }
  1446.                         if ($nbLikes != 0) {
  1447.                             $listerandom $SEjourService->getlikephotosejour($userId$idSejour);
  1448.                             $arrayRsRandom $this->random_functionPhoto($listerandom);
  1449.                         }
  1450.                         if ($nbLikes == 0) {
  1451.                             $arrayRsRandom $this->random_functionPhotoNolIKES($listerandom$j);
  1452.                         }
  1453.                         $rr $rr $arrayexploded[$i] . $arrayRsRandom['idelem'] . $arrayexploded[$i 1] . $arrayRsRandom['pathelem'];
  1454.                         unset($listerandom[$arrayRsRandom['elem']]);
  1455.                     } else {
  1456.                         $rr $rr $arrayexploded[$i];
  1457.                     }
  1458.                     $listerandom $listerandom;
  1459.                 }
  1460.                 $resultFinal $rr;
  1461.                 $p->setCouleurbordure($resultFinal);
  1462.                 array_push($allpagesResult$p);
  1463.                 if ($j sizeof($listeattachlikephoto) - 1) {
  1464.                     $j $j 1;
  1465.                 } else {
  1466.                     $j 0;
  1467.                 }
  1468.             }
  1469.             $AllPages $allpagesResult;
  1470.         }
  1471.         return $this->render('Parent/RetroRefonte.html.twig', ["nbr" => $nbr"nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'like' => $listeattachlikephoto'cliparts' => $clipart'Album' => $Albumproduct'AllPages' => $AllPages'albumAcc' => $albumAcc'AllPagesAcc' => $AllPagesAcc'random' => $random'listeattach' => $listeattach'nbLikes' => $nbLikes]);
  1472.     }
  1473.     /**
  1474.      * @Route("Parent/AjoutPhotosRetros/{nbr}", name="AjoutPhotosRetros")
  1475.      */
  1476.     public function AjoutPhotosRetrosParent($nbr)
  1477.     {
  1478.         $SEjourService $this->sejourService;
  1479.         /** @var \App\Entity\User $user */
  1480.         $user $this->getUser();
  1481.         $userId $user->getId();
  1482.         $session $this->session;
  1483.         $session->set('pageMenu''');
  1484.         $idSejour $session->get("Sejour");
  1485.         $sejour $SEjourService->getsejourpourparent($idSejour);
  1486.         $em $this->em;
  1487.         $clipart $em->getRepository(Clipart::class)->findAll();
  1488.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  1489.         $nbLikes count($listeattachlikephoto);
  1490.         //$listeattach = $SEjourService->getatachmentsejour($idSejour);
  1491.         $listeattach $SEjourService->getCombinedattachSejour($idSejour'photo');
  1492.         if ($nbLikes == 0) {
  1493.             $listerandom =  $listeattach;
  1494.         }
  1495.         if ($nbLikes != 0) {
  1496.             $listerandom =  $listeattachlikephoto;
  1497.         }
  1498.         $AllPagesAcc null;
  1499.         $Albumproduct $em->getRepository(Produit::class)->findOneBy(['labele' => 'RandomPochette' $nbr]);
  1500.         $random true;
  1501.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  1502.         $idAcc $sejour->getIdAcommp();
  1503.         $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  1504.         $part $sejour->getIdPartenaire();
  1505.         $nompart $part->getUsername();
  1506.         $logopart $part->getLogourl();
  1507.         if ($albumAcc != null and $albumAcc != "") {
  1508.             $AllPagesAcc $em->getRepository(Page::class)->findBy(['idproduit' => $albumAcc]);
  1509.         }
  1510.         $allpagesResult = array();
  1511.         $j 0;
  1512.         if ($random == true) {
  1513.             foreach ($AllPages as $p) {
  1514.                 $arrayexploded preg_split('[randomid|randompath]'$p->getCouleurbordure());
  1515.                 $rr "";
  1516.                 for ($i 0$i sizeof($arrayexploded); $i $i 2) {
  1517.                     if ($i sizeof($arrayexploded)) {
  1518.                         if ($nbLikes == 0) {
  1519.                             $arrayRsRandom $this->random_functionPhotoNolIKES($listerandom$j);
  1520.                         }
  1521.                         if ($nbLikes != 0) {
  1522.                             $arrayRsRandom $this->random_functionPhoto($listeattachlikephoto);
  1523.                         }
  1524.                         $rr $rr $arrayexploded[$i] . $arrayRsRandom['idelem'] . $arrayexploded[$i 1] . $arrayRsRandom['pathelem'];
  1525.                         unset($listerandom[$arrayRsRandom['elem']]);
  1526.                     } else {
  1527.                         $rr $rr $arrayexploded[$i];
  1528.                     }
  1529.                     $listerandom $listerandom;
  1530.                 }
  1531.                 $resultFinal $rr;
  1532.                 $p->setCouleurbordure($resultFinal);
  1533.                 array_push($allpagesResult$p);
  1534.                 if ($nbLikes == 0) {
  1535.                     if ($j sizeof($listeattachlikephoto) - 1) {
  1536.                         $j $j 1;
  1537.                     } else {
  1538.                         $j 0;
  1539.                     }
  1540.                 }
  1541.                 if ($nbLikes != 0) {
  1542.                     if ($j sizeof($listeattach) - 1) {
  1543.                         $j $j 1;
  1544.                     } else {
  1545.                         $j 0;
  1546.                     }
  1547.                 }
  1548.                 $AllPages $allpagesResult;
  1549.             }
  1550.         }
  1551.         if ($nbLikes == 0) {
  1552.             return $this->render('Parent/PochettePhotosLikes.html.twig', ["nbr" => $nbr"nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'like' => $listeattach'cliparts' => $clipart'Album' => $Albumproduct'AllPages' => $AllPages'albumAcc' => $albumAcc'AllPagesAcc' => $AllPagesAcc'random' => $random'listeattach' => $listeattach'nbLikes' => $nbLikes]);
  1553.         }
  1554.         if ($nbLikes != 0) {
  1555.             return $this->render('Parent/PochettePhotosLikes.html.twig ', ["nbr" => $nbr"nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'like' => $listeattachlikephoto'cliparts' => $clipart'Album' => $Albumproduct'AllPages' => $AllPages'albumAcc' => $albumAcc'AllPagesAcc' => $AllPagesAcc'random' => $random'listeattach' => $listeattach'nbLikes' => $nbLikes]);
  1556.         }
  1557.     }
  1558.     /**
  1559.      * @Route("Parent/CalendrierParent", name="CalendrierParent")
  1560.      */
  1561.     public function CalendrierParent()
  1562.     {
  1563.         $SEjourService $this->sejourService;
  1564.         /** @var \App\Entity\User $user */
  1565.         $user $this->getUser();
  1566.         $userId $user->getId();
  1567.         $user $this->getUser();
  1568.         $session $this->session;
  1569.         $session->set('pageMenu''');
  1570.         $idSejour $session->get("Sejour");
  1571.         $produitcondition $session->get("produit");
  1572.         $produit $session->get("produittype");
  1573.         $sejour $SEjourService->getsejourpourparent($idSejour);
  1574.         $em $this->em;
  1575.         $clipart $em->getRepository(Clipart::class)->findAll();
  1576.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  1577.         $listerandom $listeattachlikephoto;
  1578.         $AllPagesAcc null;
  1579.         $Albumproduct $em->getRepository(Produit::class)->findOneBy(['labele' => 'randomcalendrier']);
  1580.         $random true;
  1581.         //        }
  1582.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  1583.         $idAcc $sejour->getIdAcommp();
  1584.         $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  1585.         $part $sejour->getIdPartenaire();
  1586.         //$part = $em->getRepository(Etablisment::class)->findOneBy(['id' => $idpart->getId()]);
  1587.         //dd($part);
  1588.         $nompart $part->getUsername();
  1589.         $logopart $part->getLogourl();
  1590.         // dd($Albumproduct);  
  1591.         if ($albumAcc != null and $albumAcc != "") {
  1592.             $AllPagesAcc $em->getRepository(Page::class)->findBy(['idproduit' => $albumAcc]);
  1593.         }
  1594.         //        dd($albumAcc);
  1595.         $allpagesResult = array();
  1596.         $tabacc = array();
  1597.         $tabacc1 = array();
  1598.         if ($random == true) {
  1599.             foreach ($AllPages as $p) {
  1600.                 $arrayexploded preg_split('[randomid|randompath]'$p->getCouleurbordure());
  1601.                 //dd($arrayexploded);
  1602.                 $rr "";
  1603.                 $elemPath "";
  1604.                 $elemId "";
  1605.                 for ($i 0$i sizeof($arrayexploded); $i $i 2) {
  1606.                     if ($i sizeof($arrayexploded)) {
  1607.                         if (sizeof($listerandom) == 0) {
  1608.                             $listerandom $SEjourService->getlikephotosejour($userId$idSejour);
  1609.                         }
  1610.                         $arrayRsRandom $this->random_function($listerandom);
  1611.                         array_push($tabacc$arrayRsRandom['idelem']);
  1612.                         $rr $rr $arrayexploded[$i] . $arrayRsRandom['idelem'] . $arrayexploded[$i 1] . $arrayRsRandom['pathelem'];
  1613.                         unset($listerandom[$arrayRsRandom['elem']]);
  1614.                     } else {
  1615.                         $rr $rr $arrayexploded[$i];
  1616.                     }
  1617.                     $listerandom $listerandom;
  1618.                 }
  1619.                 $resultFinal $rr;
  1620.                 $p->setCouleurbordure($resultFinal);
  1621.                 array_push($allpagesResult$p);
  1622.             }
  1623.             $AllPages $allpagesResult;
  1624.         }
  1625.         $tabacc1 array_count_values($tabacc);
  1626.         return $this->render('Parent/Calendrier.html.twig', ["tabacc" => $tabacc1"nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'like' => $listeattachlikephoto'cliparts' => $clipart'Album' => $Albumproduct'AllPages' => $AllPages'albumAcc' => $albumAcc'AllPagesAcc' => $AllPagesAcc'random' => $random]);
  1627.     }
  1628.     /**
  1629.      * @Route("Parent/ListeSejour", name="ListeSejourParent")
  1630.      */
  1631.     public function ListeSejourParent()
  1632.     {
  1633.         return $this->render('Parent/AccueillParent.html.twig', []);
  1634.     }
  1635.     /**
  1636.      * @Route("/parent/couverture", name="choixCouverture")
  1637.      */
  1638.     public function sur5()
  1639.     {
  1640.         return $this->render('Parent/couverture.html.twig');
  1641.     }
  1642.     /**
  1643.      * @Route("/", name="footerparent")
  1644.      */
  1645.     public function footerparent(): Response
  1646.     {
  1647.         $produit $this->typeProduiteService;
  1648.         $liste $produit->produitlistType();
  1649.         // dd($liste);
  1650.         $session $this->session;
  1651.         $destination $session->get("destionation");
  1652.         $nbvocal 0;
  1653.         $nbSlection 0;
  1654.         $nbPhoto 0;
  1655.         $sejour null;
  1656.         $sejourservice $this->sejourService;
  1657.         $idSejour $session->get("Sejour");
  1658.         /** @var \App\Entity\User $user */
  1659.         $user $this->getUser();
  1660.         $userId $user->getId();
  1661.         $albumAcc null;
  1662.         $em $this->em;
  1663.         if ($idSejour != null) {
  1664.             $sejour $this->em->getRepository(Sejour::class)->find($idSejour);
  1665.             // Nb favoris 
  1666.             $listeattachlikephoto $sejourservice->getlikephotosejour($userId$idSejour);
  1667.             $nbSlection count($listeattachlikephoto);
  1668.             // Nb photos 
  1669.             $listeattach $sejourservice->getatachmentsejour($idSejour);
  1670.             $nbPhoto count($listeattach);
  1671.             // Nb messages vocaux 
  1672.             $messages $sejourservice->getsejourmessage($idSejour);
  1673.             $nbvocal count($messages);
  1674.             // Rechercher s'il y'a un album acompagnateur 
  1675.             $idAcc $sejour->getIdAcommp();
  1676.             $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  1677.         }
  1678.         return $this->render('Parent/footerParent.html.twig', [
  1679.             'destionation' =>  $destination,
  1680.             'nbvocal' =>  $nbvocal,
  1681.             'nbSlection' => $nbSlection,
  1682.             'nbPhotos' => $nbPhoto,
  1683.             'albumAcc' => $albumAcc,
  1684.         ]);
  1685.     }
  1686.     /**
  1687.      * @Route("/", name="heedear")
  1688.      */
  1689.     public function headerparenrt(): Response
  1690.     {
  1691.         $produit $this->typeProduiteService;
  1692.         $liste $produit->produitlistType();
  1693.         $nblikes 0;
  1694.         $nbmesssages 0;
  1695.         // dd($liste);
  1696.         $session $this->session;
  1697.         $panierSession $session->get("Panier");
  1698.         $destination $session->get("destionation");
  1699.         $nbvocal 0;
  1700.         $idSejour $session->get("Sejour");
  1701.         $sejour null;
  1702.         if ($idSejour != null) {
  1703.             $sejour $this->em->getRepository(Sejour::class)->find($idSejour);
  1704.         }
  1705.         $Products $session->get("Panier");
  1706.         $numSuivi false;
  1707.         if ($sejour != null) {
  1708.             $Products $session->get("Panier");
  1709.             if ($Products == Null) {
  1710.                 $Products = [];
  1711.             }
  1712.             $UserService $this->userService;
  1713.             /** @var \App\Entity\User $user */
  1714.             $user $this->getUser();
  1715.             $iduser $user->getId();
  1716.             $containsProduitType20 false;
  1717.             $sejour $this->em->getRepository(Sejour::class)->find($idSejour);
  1718.             $commandes $this->em->getRepository(Commande::class)->findBy(["idSejour" => $idSejour"idUser" => $iduser]);
  1719.             $sejourparent $this->em->getRepository(ParentSejour::class)->findOneBy(['idSejour' => $idSejour"idParent" => $iduser]);
  1720.             $payment $sejourparent->getPayment();
  1721.             // Check commands
  1722.             foreach ($commandes as $commande) {
  1723.                 $commandCondition $commande->getNumSuivi();
  1724.                 $status $commande->getStatut()->getId();
  1725.                 if ($commandCondition == && $status == 33) {
  1726.                     $containsProduitType20 true;
  1727.                     break; // No need to check further if condition is met
  1728.                 }
  1729.             }
  1730.             // Check panierSession if the condition is not met in commandes
  1731.             if (!$containsProduitType20 && is_array($panierSession) && !empty($panierSession)) {
  1732.                 foreach ($panierSession as $item) {
  1733.                     // Access the details of each item in the Panier
  1734.                     $condition $item['condition'];
  1735.                     $codesejour $item['codesejour'];
  1736.                     if ($condition == 16 && $codesejour == $sejour->getCodeSejour()) {
  1737.                         $containsProduitType20 true;
  1738.                         break; // No need to check further if condition is met
  1739.                     }
  1740.                 }
  1741.             }
  1742.             $sejourservice $this->sejourService;
  1743.             //$messages = $sejourservice->getsejourmessage($idSejour);
  1744.             $messages $sejourservice->getCombinedattachSejour($idSejour'message');
  1745.             $nbmessages count($messages);
  1746.             $listeattachlikephoto =  $sejourservice->getlikephotosejour($iduser$idSejour);
  1747.             $nblikes count($listeattachlikephoto);
  1748.             $em $this->em;
  1749.             $label "Livre_sejour" $sejour->getCodeSejour();
  1750.             $idAcc $sejour->getIdAcommp();
  1751.             $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'Album_sejour']);
  1752.             $livreSej $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'Livre_sejour']);
  1753.             if ($albumAcc == null) {
  1754.                 $albumAcc $em->getRepository(Produit::class)->findOneBy(['iduser' => 1'statut' => "Album_sejour"'idsjour' => $sejour]);
  1755.             }
  1756.             if ($livreSej == null) {
  1757.                 $livreSejour $em->getRepository(Produit::class)->findOneBy(['statut' => "Livre_sejour"'idsjour' => $sejour'labele' => $label'version' => "Livre_Admin"]);
  1758.             }
  1759.             $code_sejour =  $sejour->getCodeSejour();
  1760.             return $this->render('Parent/headerParent.html.twig', [
  1761.                 'produit' => $liste,
  1762.                 'sejour' => $sejour,
  1763.                 'livreSejour' => $livreSejour,
  1764.                 'Products' => $Products,
  1765.                 'destionation' =>  $destination,
  1766.                 'nbvocal' =>  $nbmessages,
  1767.                 'albumAcc' => $albumAcc,
  1768.                 'nbLikes' => $nblikes,
  1769.                 'code_sejour' => $code_sejour,
  1770.                 'payment' => $payment
  1771.             ]);
  1772.         }
  1773.         if ($sejour == null) {
  1774.             return $this->render('Parent/headerParent2.html.twig');
  1775.         }
  1776.     }
  1777.     /**
  1778.      * @Route("/Parent/disablepack", name="disablePack")
  1779.      */
  1780.     public function disableFreepack()
  1781.     {
  1782.         //this section is used to disale the freePackOffert
  1783.         $em $this->em;
  1784.         $session $this->session;
  1785.         /** @var \App\Entity\User $user */
  1786.         $user $this->getUser();
  1787.         $iduser $user->getId();
  1788.         $idSejour $session->get("Sejour");
  1789.         $SEjourService $this->sejourService;
  1790.         $listeattach $SEjourService->getCombinedattachSejour($idSejour'photo');
  1791.         $panierSession $session->get("Panier");
  1792.         $containsProduitType20 false;
  1793.         $nbrphoto count($listeattach);
  1794.         /** @var \App\Entity\User $user */
  1795.         $user $this->getUser();
  1796.         $iduser $user->getId();
  1797.         $containsProduitType20 false;
  1798.         $sejour $this->em->getRepository(Sejour::class)->find($idSejour);
  1799.         $commandes $this->em->getRepository(Commande::class)->findBy(["idSejour" => $idSejour"idUser" => $iduser]);
  1800.         // Check commands
  1801.         foreach ($commandes as $commande) {
  1802.             $commandCondition $commande->getNumSuivi();
  1803.             $status $commande->getStatut()->getId();
  1804.             // Check if Num Suivi is set one and if payment is completed
  1805.             if ($commandCondition == && $status == 33) {
  1806.                 $containsProduitType20 true;
  1807.                 break; // No need to check further if condition is met
  1808.             }
  1809.         }
  1810.         // Check panierSession if the condition is not met in commandes
  1811.         if (!$containsProduitType20 && is_array($panierSession) && !empty($panierSession)) {
  1812.             foreach ($panierSession as $item) {
  1813.                 // Access the details of each item in the Panier
  1814.                 $condition $item['condition'];
  1815.                 $codesejour $item['codesejour'];
  1816.                 if ($condition == 16 && $codesejour == $sejour->getCodeSejour()) {
  1817.                     $containsProduitType20 true;
  1818.                     break; // No need to check further if condition is met
  1819.                 }
  1820.             }
  1821.         }
  1822.         return new JsonResponse(['containsProduitType20' => $containsProduitType20'idSejour' => $nbrphoto]);
  1823.     }
  1824.     /**
  1825.      * @Route("/Parent/disablepackpanier", name="disablePackpanier")
  1826.      */
  1827.     public function disableFreepackpanier(): JsonResponse
  1828.     {
  1829.         //this section is used to disale the + in the panier for the packOffert
  1830.         $em $this->em;
  1831.         $disabledProductIds = [];
  1832.         $session $this->session;
  1833.         $panierSession $session->get("Panier");
  1834.         $ids = [];
  1835.         foreach ($panierSession as $item) {
  1836.             $ids[] = $item['id'];
  1837.         }
  1838.         if ($panierSession) {
  1839.             foreach ($ids as $id) {
  1840.                 $panierProduits $em->getRepository(PanierProduit::class)->findBy(['idProduit' => $id]);
  1841.                 foreach ($panierProduits as $panierProduit) {
  1842.                     $produit $panierProduit->getIdProduit();
  1843.                     $type $produit->getType();
  1844.                     // Check if the product type is 20 and add to disabledProductIds if true
  1845.                     if ($type && $type->getId() == 20) {
  1846.                         $disabledProductIds[] = $produit->getId();
  1847.                     }
  1848.                 }
  1849.             }
  1850.             return new JsonResponse(['disabledProductIds' => $disabledProductIds]);
  1851.         }
  1852.     }
  1853.     /**
  1854.      * @Route("/", name="heedear2")
  1855.      */
  1856.     public function headerparenrt2(): Response
  1857.     {
  1858.         $session $this->session;
  1859.         $produit $this->typeProduiteService;
  1860.         $nbvocal 0;
  1861.         $idSejour $session->get("Sejour");
  1862.         $liste $produit->produitlistType();
  1863.         $session $this->session;
  1864.         $destination $session->get("destionation");
  1865.         $Products $session->get("Panier");
  1866.         if ($Products == Null) {
  1867.             $Products = [];
  1868.         }
  1869.         return $this->render('Parent/headerParent2.html.twig', [
  1870.             'produit' => $liste,
  1871.             'Products' => $Products,
  1872.             'destionation' =>  $destination,
  1873.             'nbvocal' =>  $nbvocal
  1874.         ]);
  1875.     }
  1876.     /**
  1877.      * @Route("/Parent/ParametresParent", name="ParametresParent")
  1878.      */
  1879.     public function Parametreparent()
  1880.     {
  1881.         // $sejourservice = $this->sejourService;
  1882.         //$sejour = $sejourservice->getparentsejour($id, $this->getUser());
  1883.         ///$session = $this->session;
  1884.         //$session->set('moncompte', 'parametres');
  1885.         $user $this->getUser();
  1886.         $session $this->session;
  1887.         $idSejour $session->get("Sejour");
  1888.         $sejour $this->em->getRepository(Sejour::class)->find($idSejour);
  1889.         $ParentSejour $this->em->getRepository(ParentSejour::class)->findBy(['idSejour' => $sejour'idParent' => $user]);
  1890.         //ParentSejour
  1891.         //cablala
  1892.         //dd($ParentSejour[0]);
  1893.         //$listeattach = $sejourservice->getatachmentsejour($id);
  1894.         //$listeattachM = $sejourservice->getsejourmessage($id);
  1895.         return $this->render('Parent/Parentparametre.html.twig', [
  1896.             'user' => $user,
  1897.             'sejour' => $sejour,
  1898.             'ParentSejour' => $ParentSejour[0],
  1899.         ]);
  1900.     }
  1901.     /**
  1902.      * @Route("/Parent/Accueil5sur5/ajouteradresslirison", name="ajouteradress_livrson",methods={"POST"})
  1903.      */
  1904.     public function ajouteradresslivr(Request $request)
  1905.     {
  1906.         $UserService $this->userService;
  1907.         //dd($this->getUser()->getId());
  1908.         /** @var \App\Entity\User $user */
  1909.         $user $this->getUser();
  1910.         $iduser $user->getId();
  1911.         $prenom $request->get("prenom");
  1912.         $nom $request->get("nom");
  1913.         $organism $request->get("organism");
  1914.         $num $request->get("num");
  1915.         $rue $request->get('ruevoi');
  1916.         $ville $request->get("villle");
  1917.         $pays $request->get("pays");
  1918.         $codepostal $request->get("codpostal");
  1919.         //adress facturation if exsist
  1920.         $prenomfacturation $request->get("prenomadressfacturation");
  1921.         $nomfacturation $request->get("nomadressfacturation");
  1922.         $organismfacturation $request->get("etablismadressfacturation");
  1923.         $numfacturation $request->get("numdressfacturation");
  1924.         $ruefacturation $request->get('rueadressfacturation');
  1925.         $villefacturation $request->get("villefacturation");
  1926.         $paysfacturation $request->get("payadressfacturation");
  1927.         $codepostalfacturation $request->get("codepostalfacturation");
  1928.         //modification userPArent
  1929.         $usernomAcommpa $request->get("usernom");
  1930.         $userprenomAcommpa $request->get("userprenom");
  1931.         $userfonctionAcommpa $request->get("userfonction");
  1932.         $useretablismentAcommpa $request->get("useretablisment");
  1933.         $useremailcommpa $request->get("useremail");
  1934.         $sejourthem $request->get("sejourthem");
  1935.         $adresssejour $request->get("sejouradresse");
  1936.         $id $request->get("id");
  1937.         $adress $UserService->setadresslivraison($num$rue$ville$pays$codepostal$iduser$prenom$nom$organism$prenomfacturation$nomfacturation$organismfacturation$numfacturation$ruefacturation$villefacturation$paysfacturation$codepostalfacturation$usernomAcommpa$userprenomAcommpa$userfonctionAcommpa$useretablismentAcommpa$useremailcommpa$sejourthem$adresssejour$id);
  1938.         return new JsonResponse('done');
  1939.     }
  1940.     /**
  1941.      * @Route("/Accueil5sur5/ajouteradressfacturation", name="ajouteradress_facturation",methods={"POST","GET"})
  1942.      */
  1943.     public function ajouteradressfacturation(Request $request)
  1944.     {
  1945.         $UserService $this->userService;
  1946.         /** @var \App\Entity\User $user */
  1947.         $user $this->getUser();
  1948.         $iduser $user->getId();
  1949.         $num $request->get("num");
  1950.         $rue $request->get('rue');
  1951.         $ville $request->get("ville");
  1952.         $pays $request->get("pays");
  1953.         $codepostal $request->get("codepostal");
  1954.         $adress $UserService->setadressfacturation($num$rue$ville$pays$codepostal$iduser);
  1955.         return new JsonResponse('done');
  1956.     }
  1957.     /**
  1958.      * @Route("/EntrezCode", name="EntrezCode")
  1959.      */
  1960.     public function EntrezCode(Request $request)
  1961.     {
  1962.         $email $request->get('email');
  1963.         $password $request->get('password');
  1964.         $this->session->set('rout''code');
  1965.         return $this->redirectToRoute('CodeSejour', ['email' => $email'password' => $password]);
  1966.     }
  1967.     /**
  1968.      * @Route("/DemandeCode", name="DemandeCode")
  1969.      */
  1970.     public function DemandeCode(Request $request)
  1971.     {
  1972.         $nomEnfant $request->get('nomEnfant');
  1973.         $prenomEnfant $request->get('prenomEnfant');
  1974.         $votreNom $request->get('votreNom');
  1975.         $votrePrenom $request->get('votrePrenom');
  1976.         $Mail $request->get('Mail');
  1977.         $votreLien $request->get('votreLien');
  1978.         $du $request->get('du');
  1979.         $au $request->get('au');
  1980.         $code $request->get('code');
  1981.         $ville $request->get('ville');
  1982.         $listeSejour $this->em->getRepository(Sejour::class)->listAcco($du$au$code$ville);
  1983.         $RefEmail $this->em->getRepository(Ref::class)->find(23);
  1984.         $Email $this->em->getRepository(Emailing::class)->findOneBy(array('typeemail' => $RefEmail'statut' => 9));
  1985.         foreach ($listeSejour as $accompagnateur) {
  1986.             $sendTo $accompagnateur->getIdAcommp()->getEmail();
  1987.             $message = (new \Swift_Message('Demande code séjour'))
  1988.                 ->setFrom('contact@5sur5sejour.com')
  1989.                 ->setTo($sendTo);
  1990.             //->setBcc("contact@5sur5sejour.com");
  1991.             $pathImage2 $Email->getIdImage2()->getPath();
  1992.             $pathImage1 $Email->getIdImage1()->getPath();
  1993.             $image1 $message->embed(Swift_Image::fromPath("$pathImage1"));
  1994.             $image2 $message->embed(Swift_Image::fromPath("$pathImage2"));
  1995.             $iconphoto $message->embed(Swift_Image::fromPath("https://media.5sur5sejour.com/upload/original/Groupe_419_pqx0dx._6656d07326a50.png"));
  1996.             $iconloca $message->embed(Swift_Image::fromPath("https://media.5sur5sejour.com/upload/original/Groupe_420_uynuqz._6656d10f4daaf.png"));
  1997.             $iconmsg $message->embed(Swift_Image::fromPath("https://media.5sur5sejour.com/upload/original/Groupe_418_wbyysk._6656d16240404.png"));
  1998.             $iconfooter $message->embed(Swift_Image::fromPath("https://media.5sur5sejour.com/upload/original/Picto5sur5_rapbfy._6656d1c1bb536.png"));
  1999.             $iMagesProduits $message->embed(Swift_Image::fromPath("https://media.5sur5sejour.com/upload/original/Picto5sur5_rapbfy._6656d1c1bb536.png"));
  2000.             $message->setBody(
  2001.                 $this->templating->render(
  2002.                     'emails/ParentDemandeCodeSejour.html.twig',
  2003.                     [
  2004.                         "nomAcco" => $accompagnateur->getIdAcommp()->getNom(),
  2005.                         "prenomAcco" => $accompagnateur->getIdAcommp()->getPrenom(),
  2006.                         "nomEnfant" => $nomEnfant,
  2007.                         "prenomEnfant" => $prenomEnfant,
  2008.                         "votreNom" => $votreNom,
  2009.                         "votrePrenom" => $votrePrenom,
  2010.                         "mail" => $Mail,
  2011.                         "votreLien" => $votreLien,
  2012.                         "image1" => $image1,
  2013.                         "image2" => $image2,
  2014.                         "iconfooter" => $iconfooter,
  2015.                         "iconphoto" => $iconphoto,
  2016.                         "iconloca" => $iconloca,
  2017.                         "iconmsg" => $iconmsg,
  2018.                         "du" => $du,
  2019.                         "au" => $au,
  2020.                         "code" => $code,
  2021.                         "ville" => $ville,
  2022.                     ]
  2023.                 ),
  2024.                 'text/html'
  2025.             );
  2026.             try {
  2027.                 $signMail $this->getParameter('signMail');
  2028.                 if ($signMail == 'yes') {
  2029.                     $domainName $this->getParameter('domaine');
  2030.                     $selector $this->getParameter('selector');
  2031.                     $PrivateKey file_get_contents($this->getParameter('pathDKIM'));
  2032.                     $signer = new \Swift_Signers_DKIMSigner($PrivateKey$domainName$selector);
  2033.                     $message->attachSigner($signer);
  2034.                 }
  2035.                 $this->mailer->send($message);
  2036.             } catch (\Swift_SwiftException $ex) {
  2037.                 $ex->getMessage();
  2038.             }
  2039.         }
  2040.         return new JsonResponse(count($listeSejour));
  2041.     }
  2042.     /**
  2043.      * @Route("/Parent/ChoixCouverture", name="ChoixCouvertureParent")
  2044.      */
  2045.     public function Couverture()
  2046.     {
  2047.         return $this->render('Parent/ChoixCouverture.html.twig', []);
  2048.     }
  2049.     /**
  2050.      * @Route("/Parent/couvertureAccompagnateur", name="couvertureAccompagnateur")
  2051.      */
  2052.     public function CouvertureAccompagnateur()
  2053.     {
  2054.         $user $this->getUser();
  2055.         $session $this->session;
  2056.         $idSejour $session->get("Sejour");
  2057.         $listeproduit $prod $this->em->getRepository(Produit::class)->findby(array('idsjour' => $idSejour));
  2058.         return $this->render('Parent/couvertureAccompagnateur.html.twig', []);
  2059.     }
  2060.     /**
  2061.      * @Route("/Parent/Projet", name="projet-Parent")
  2062.      */
  2063.     public function parentTWo()
  2064.     {
  2065.         $this->session->set('rout''rout');
  2066.         /** @var \App\Entity\User $user */
  2067.         $user $this->getUser();
  2068.         $session $this->session;
  2069.         $session->set('pageMenu''projets');
  2070.         $idSejour $session->get("Sejour");
  2071.         $listeproduit $this->em->getRepository(Produit::class)->findby(array('idsjour' => $idSejour'iduser' => $user->getId()), ['id' => 'DESC']);
  2072.         $sejour $this->em->getRepository(Sejour::class)->find($idSejour);
  2073.         $parentent_sejour $this->em->getRepository(ParentSejour::class)->findOneBy(["idParent" => $user->getId(), "idSejour" => $idSejour]);
  2074.         return $this->render('Parent/ProjetsParent.html.twig', ['sejour' => $sejour'parentent_sejour' => $parentent_sejour'listeproduit' => $listeproduit]);
  2075.     }
  2076.     /**
  2077.      * @Route("/Parent/MesProjets", name="MesProjets")
  2078.      */
  2079.     public function MesProjets()
  2080.     {
  2081.         return $this->render('Parent/MesProjetsSauvegardes.html.twig', []);
  2082.     }
  2083.     /**
  2084.      * @Route("/Parent/allSejourparent", name="SejourParent")
  2085.      */
  2086.     public function SejourAccompagnateur()
  2087.     {
  2088.         $sejourservice $this->sejourService;
  2089.         $session $this->session;
  2090.         $idSejour $session->get("Sejour");
  2091.         $session->set('rout''rout');
  2092.         /** @var \App\Entity\User $user */
  2093.         $user $this->getUser();
  2094.         $userId $user->getId();
  2095.         $listeSejour $prod $this->em->getRepository(ParentSejour::class)->findby(array('idParent' => $userId));
  2096.         return $this->render('Parent/Messejours.html.twig', ['listeSejour' => $listeSejour]);
  2097.     }
  2098.     /**
  2099.      * @Route("/Parent/Commander", name="Commander")
  2100.      */
  2101.     public function Commander()
  2102.     {
  2103.         $session $this->session;
  2104.         $idSejour $session->get("Sejour");
  2105.         $sejour $this->em->getRepository(Sejour::class)->find($idSejour);
  2106.         $user $this->getUser();
  2107.         $comande $session->get("comande");
  2108.         $panier $session->get("Panier");
  2109.         $nbrprodpromo 0;
  2110.         $nbralbum 0;
  2111.         $nbrlivre 0;
  2112.         $nbrphoto12 0;
  2113.         $nbrphoto24 0;
  2114.         $nbrphoto36 0;
  2115.         $nbrcal 0;
  2116.         $nbrretro12 0;
  2117.         $nbrretro24 0;
  2118.         $nbrretro36 0;
  2119.         $detailsprod = array();
  2120.         $prixalbum 0.0;
  2121.         $prixphoto12 0.0;
  2122.         $prixphoto24 0.0;
  2123.         $prixphoto36 0.0;
  2124.         $prixcal 0.0;
  2125.         $prixalbum 0.0;
  2126.         $prixretro12 0.0;
  2127.         $prixretro24 0.0;
  2128.         $prixretro36 0.0;
  2129.         $prodpanierpromo = array();
  2130.         $promo = array();
  2131.         foreach ($panier as $key => $p) {
  2132.             if ($p['condition'] != 11 && $p['condition'] != 6) {
  2133.                 $promo['condition'] = $p['condition'];
  2134.                 $nbrprodpromo $nbrprodpromo $p['qte'];
  2135.                 array_push($prodpanierpromo$promo);
  2136.                 if ($p['condition'] == 4) {
  2137.                     $nbralbum $nbralbum $p['qte'];
  2138.                     $prixalbum $p['mnt'];
  2139.                 } elseif ($p['condition'] == 1) {
  2140.                     $nbrphoto12 $nbrphoto12 $p['qte'];
  2141.                     $prixphoto12 $p['mnt'];
  2142.                 } elseif ($p['condition'] == 2) {
  2143.                     $nbrphoto24 $nbrphoto24 $p['qte'];
  2144.                     $prixphoto24 $p['mnt'];
  2145.                 } elseif ($p['condition'] == 3) {
  2146.                     $nbrphoto36 $nbrphoto36 $p['qte'];
  2147.                     $prixphoto36  $p['mnt'];
  2148.                 } elseif ($p['condition'] == 5) {
  2149.                     $nbrlivre $nbrlivre $p['qte'];
  2150.                     $prixlivre $p['mnt'];
  2151.                 } elseif ($p['condition'] == 7) {
  2152.                     $nbrcal $nbrcal $p['qte'];
  2153.                     $prixcal $p['mnt'];
  2154.                 } elseif ($p['condition'] == 8) {
  2155.                     $nbrretro36 $nbrretro36 $p['qte'];
  2156.                     $prixretro36 $p['mnt'];
  2157.                 } elseif ($p['condition'] == 9) {
  2158.                     $nbrretro12 $nbrretro12 $p['qte'];
  2159.                     $prixretro12 $p['mnt'];
  2160.                 } elseif ($p['condition'] == 10) {
  2161.                     $nbrretro24 $nbrretro24 $p['qte'];
  2162.                     $prixretro24 $p['mnt'];
  2163.                 }
  2164.             }
  2165.         }
  2166.         $detailsprod['album']['qt'] = $nbralbum;
  2167.         $detailsprod['album']['prix'] = $prixalbum;
  2168.         $detailsprod['photo12']['qt'] = $nbrphoto12;
  2169.         $detailsprod['photo12']['prix'] = $prixphoto12;
  2170.         $detailsprod['photo24']['qt'] = $nbrphoto24;
  2171.         $detailsprod['photo24']['prix'] = $prixphoto24;
  2172.         $detailsprod['photo36']['qt'] = $nbrphoto36;
  2173.         $detailsprod['photo36']['prix'] = $prixphoto36;
  2174.         $detailsprod['cal']['qt'] = $nbrcal;
  2175.         $detailsprod['cal']['prix'] = $prixcal;
  2176.         $detailsprod['livre']['qt'] = $nbrlivre;
  2177.         $detailsprod['livre']['prix'] = $prixalbum;
  2178.         $detailsprod['retro12']['qt'] = $nbrretro12;
  2179.         $detailsprod['retro12']['prix'] = $prixretro12;
  2180.         $detailsprod['retro24']['qt'] = $nbrretro24;
  2181.         $detailsprod['retro24']['prix'] = $prixretro24;
  2182.         $detailsprod['retro36']['qt'] = $nbrretro36;
  2183.         $detailsprod['retro36']['prix'] = $prixretro36;
  2184.         $Panier $session->get("Panier");
  2185.         return $this->render('Parent/commande.html.twig', ["detailsprod" => $detailsprod"nbrprodpromo" => $nbrprodpromo"prodpanierpromo" => $prodpanierpromo"user" => $user"sejour" => $sejour"x" => $panier'Panier' => $Panier]);
  2186.     }
  2187.     /**
  2188.      * @Route("/Parent/MonPanier", name="MonPanier")
  2189.      */
  2190.     public function MonPanier()
  2191.     {
  2192.         /** @var \App\Entity\User $user */
  2193.         $user $this->getUser();
  2194.         $session $this->session;
  2195.         $idSejour $session->get("Sejour");
  2196.         $sejour $this->em->getRepository(Sejour::class)->find($idSejour);
  2197.         $listeproduit $prod $this->em->getRepository(Produit::class)->findby(array('iduser' => $user->getId()));
  2198.         $parentent_sejour $this->em->getRepository(ParentSejour::class)->findOneBy(["idParent" => $user->getId(), "idSejour" => $idSejour]);
  2199.         $Panier $session->get("Panier");
  2200.         //dd($Panier);
  2201.         $prodpanier = array();
  2202.         $nbrprodpromo 0;
  2203.         $nbralbum 0;
  2204.         $nbrlivre 0;
  2205.         $nbrphoto12 0;
  2206.         $nbrphoto24 0;
  2207.         $nbrphoto36 0;
  2208.         $nbrcal 0;
  2209.         $nbrretro12 0;
  2210.         $nbrretro24 0;
  2211.         $nbrretro36 0;
  2212.         $detailsprod = array();
  2213.         $prixalbum 0.0;
  2214.         $prixphoto12 0.0;
  2215.         $prixphoto24 0.0;
  2216.         $prixphoto36 0.0;
  2217.         $prixcal 0.0;
  2218.         $prixalbum 0.0;
  2219.         $prixretro12 0.0;
  2220.         $prixretro24 0.0;
  2221.         $prixretro36 0.0;
  2222.         $prodpanierpromo = array();
  2223.         $promo = array();
  2224.         foreach ($Panier as $key => $p) {
  2225.             if ($p['condition'] != null) {
  2226.                 array_push($prodpanier$p['condition']);
  2227.             }
  2228.             if ($p['condition'] != 11 && $p['condition'] != 6) {
  2229.                 $promo['condition'] = $p['condition'];
  2230.                 $nbrprodpromo $nbrprodpromo $p['qte'];
  2231.                 array_push($prodpanierpromo$promo);
  2232.                 if ($p['condition'] == 4) {
  2233.                     $nbralbum $nbralbum $p['qte'];
  2234.                     $prixalbum $p['mnt'];
  2235.                 } elseif ($p['condition'] == 1) {
  2236.                     $nbrphoto12 $nbrphoto12 $p['qte'];
  2237.                     $prixphoto12 $p['mnt'];
  2238.                 } elseif ($p['condition'] == 2) {
  2239.                     $nbrphoto24 $nbrphoto24 $p['qte'];
  2240.                     $prixphoto24 $p['mnt'];
  2241.                 } elseif ($p['condition'] == 3) {
  2242.                     $nbrphoto36 $nbrphoto36 $p['qte'];
  2243.                     $prixphoto36  $p['mnt'];
  2244.                 } elseif ($p['condition'] == 5) {
  2245.                     $nbrlivre $nbrlivre $p['qte'];
  2246.                     $prixlivre $p['mnt'];
  2247.                 } elseif ($p['condition'] == 7) {
  2248.                     $nbrcal $nbrcal $p['qte'];
  2249.                     $prixcal $p['mnt'];
  2250.                 } elseif ($p['condition'] == 8) {
  2251.                     $nbrretro36 $nbrretro36 $p['qte'];
  2252.                     $prixretro36 $p['mnt'];
  2253.                 } elseif ($p['condition'] == 9) {
  2254.                     $nbrretro12 $nbrretro12 $p['qte'];
  2255.                     $prixretro12 $p['mnt'];
  2256.                 } elseif ($p['condition'] == 10) {
  2257.                     $nbrretro24 $nbrretro24 $p['qte'];
  2258.                     $prixretro24 $p['mnt'];
  2259.                 }
  2260.             }
  2261.         }
  2262.         $detailsprod['album']['qt'] = $nbralbum;
  2263.         $detailsprod['album']['prix'] = $prixalbum;
  2264.         $detailsprod['photo12']['qt'] = $nbrphoto12;
  2265.         $detailsprod['photo12']['prix'] = $prixphoto12;
  2266.         $detailsprod['photo24']['qt'] = $nbrphoto24;
  2267.         $detailsprod['photo24']['prix'] = $prixphoto24;
  2268.         $detailsprod['photo36']['qt'] = $nbrphoto36;
  2269.         $detailsprod['photo36']['prix'] = $prixphoto36;
  2270.         $detailsprod['cal']['qt'] = $nbrcal;
  2271.         $detailsprod['cal']['prix'] = $prixcal;
  2272.         $detailsprod['livre']['qt'] = $nbrlivre;
  2273.         $detailsprod['livre']['prix'] = $prixalbum;
  2274.         $detailsprod['retro12']['qt'] = $nbrretro12;
  2275.         $detailsprod['retro12']['prix'] = $prixretro12;
  2276.         $detailsprod['retro24']['qt'] = $nbrretro24;
  2277.         $detailsprod['retro24']['prix'] = $prixretro24;
  2278.         $detailsprod['retro36']['qt'] = $nbrretro36;
  2279.         $detailsprod['retro36']['prix'] = $prixretro36;
  2280.         $produit $this->typeProduiteService;
  2281.         $produitlist $produit->produitlistTypeConditionnement();
  2282.         //dd( $detailsprod);
  2283.         $this->session->set('rout''rout');
  2284.         return $this->render('Parent/monpanier.html.twig', ['detailsprod' => $detailsprod'nbrprodpromo' => $nbrprodpromo'prodpanierpromo' => $prodpanierpromo'prodpanier' => $prodpanier'parentent_sejour' => $parentent_sejour'user' => $user'Sejour' => $idSejour"sejour" => $sejour'listeproduit' => $listeproduit'Panier' => $Panier'produitlist' => $produitlist]);
  2285.     }
  2286.     /**
  2287.      * @Route("/Parent/mail", name="mail")
  2288.      */
  2289.     public function mail()
  2290.     {
  2291.         return $this->render('emails/Inscriptionparent.html.twig', []);
  2292.     }
  2293.     /**
  2294.      * @Route("/Parent/AlbummsavealbumParent", name="AlbummsavealbumParent")
  2295.      */
  2296.     public function Albummsavealbum(Request $request)
  2297.     {
  2298.         $session $this->session;
  2299.         $serviceuser $this->etablissementService;
  2300.         $page $request->get("pages");
  2301.         $sejour $request->get("sejour");
  2302.         $prodid $request->get('idProd');
  2303.         $nomprod $request->get('nomprod');
  2304.         $versionalbm $request->get('new');
  2305.         $user $this->getUser();
  2306.         $produittype $session->get("produit");
  2307.         $produit $session->get("produittype");
  2308.         /** @var \App\Entity\User $user */
  2309.         $user $this->getUser();
  2310.         $userEmail $user->getEmail();
  2311.         $Album $serviceuser->savealbumParent($page$user$sejour$prodid$produit$produittype$nomprod$versionalbm);
  2312.         //dd($etablissementDetail);
  2313.         $dateNow = new \Datetime();
  2314.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  2315.         // $this->EmailServie->MailRelancePanier($userEmail);
  2316.         return new response();
  2317.     }
  2318.     /**
  2319.      * @Route("/Parent/saveLivrePhotosParent", name="saveLivrePhotosParent")
  2320.      */
  2321.     public function saveLivrePhotos(Request $request)
  2322.     {
  2323.         $session $this->session;
  2324.         $serviceuser $this->etablissementService;
  2325.         $page $request->get("pages");
  2326.         $sejour $request->get("sejour");
  2327.         $prodid $request->get('idProd');
  2328.         $nomprod $request->get('nomprod');
  2329.         $versionalbm $request->get('new');
  2330.         $user $this->getUser();
  2331.         $produitcondition $session->get("produit");
  2332.         $produit $session->get("produittype");
  2333.         $produitcondss $session->get('produitconditionAlbum');
  2334.         $Album $serviceuser->savelivreParent($page$user$sejour$prodid$produitcondss$nomprod$versionalbm);
  2335.         //dd($etablissementDetail);
  2336.         //sendmail_parent
  2337.         $dateNow = new \Datetime();
  2338.         /** @var \App\Entity\User $user */
  2339.         $user $this->getUser();
  2340.         $userEmail $user->getEmail();
  2341.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  2342.         // $this->EmailServie->MailRelancePanier($userEmail);
  2343.         return new response('done');
  2344.     }
  2345.     /**
  2346.      * @Route("/Parent/SavePhotosPochette", name="SavePhotosPochetteParent")
  2347.      */
  2348.     public function SavePhotosPochetteParent(Request $request)
  2349.     {
  2350.         $session $this->session;
  2351.         $serviceuser $this->etablissementService;
  2352.         $page $request->get("pages");
  2353.         $sejour $request->get("sejour");
  2354.         $prodid $request->get('idProd');
  2355.         $nomprod $request->get('nomprod');
  2356.         $nbr $request->get('nbr');
  2357.         $user $this->getUser();
  2358.         $nbr strval($nbr);
  2359.         $produittype $session->get("produit");
  2360.         $produit $session->get("produittype");
  2361.         $Album $serviceuser->SavePhotosPochetteParent($page$user$sejour$prodid$produit$produittype$nbr$nomprod);
  2362.         //sendmailparent
  2363.         $dateNow = new \Datetime();
  2364.         /** @var \App\Entity\User $user */
  2365.         $user $this->getUser();
  2366.         $userEmail $user->getEmail();
  2367.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  2368.         //$this->EmailServie->MailRelancePanier($userEmail);
  2369.         return new response('done');
  2370.     }
  2371.     /**
  2372.      * @Route("/Parent/RetrosComandeSaveRetros", name="PochettePhotosComandeSave")
  2373.      */
  2374.     public function PochettePhotosComandeSave(Request $request)
  2375.     {
  2376.         $em $this->em;
  2377.         $session $this->session;
  2378.         $serviceuser $this->etablissementService;
  2379.         $page $request->get("pages");
  2380.         $sejour $request->get("sejour");
  2381.         $prodid $request->get('idProd');
  2382.         $nomprod $request->get('nomprod');
  2383.         $nbr $request->get('nbr');
  2384.         $user $this->getUser();
  2385.         $nbr strval($nbr);
  2386.         $produittype $session->get("produit");
  2387.         $produit $session->get("produittype");
  2388.         $Album $serviceuser->SavePhotosRetrosParents($page$user$sejour$prodid$produit$produittype$nbr$nomprod);
  2389.         $inser false;
  2390.         $Products $session->get("Panier");
  2391.         $produit $em->getRepository(Produit::class)->find($Album->getId());
  2392.         //Touhemi  03-07-2020 :Rechercher  si l'utilisateur a déja un panier avec statut créer ds la bd , sinon on écrit un panier
  2393.         $user $this->getUser();
  2394.         $typeref $em->getRepository(Typeref::class)->find(8);
  2395.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  2396.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  2397.         //fin
  2398.         if ($panierTrace == null) {
  2399.             $panierTrace = new Panier();
  2400.             $dateNow = new \Datetime();
  2401.             $panierTrace->setDateCreation($dateNow);
  2402.             $panierTrace->setCreerPar($user);
  2403.             $panierTrace->setStatut($statutPanier);
  2404.             $em->getManager()->persist($panierTrace);
  2405.             $em->getManager()->flush();
  2406.         }
  2407.         //Touhemi 03-07-2020 :s'il y a un produit avec (id user,id sejour, type produit et type conditionement) dans le panier , sinon on écrit un produit
  2408.         if ($Products == null) {
  2409.             $Products = [];
  2410.         }
  2411.         foreach ($Products as $key => $p) {
  2412.             if ($p['id'] == $produit->getId()) {
  2413.                 $inser true;
  2414.                 $Products[$key]['qte'] = $p['qte'] + 1;
  2415.                 $Products[$key]['mnt'] = $p['mnt'] + $produit->getIdConditionnement()->getMontantTTC();
  2416.             }
  2417.         }
  2418.         //Touhemi 03-07-2020 :Rechercher  si le produti existe déja ds panierProduit
  2419.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  2420.         if ($panierProduit == null) {
  2421.             $panierProduit = new PanierProduit();
  2422.             $panierProduit->setIdProduit($produit);
  2423.             $panierProduit->setIdPanier($panierTrace);
  2424.             $em->getManager()->persist($panierProduit);
  2425.             $em->getManager()->flush();
  2426.         }
  2427.         //fin
  2428.         //   Touhemi 03-07-2020 ajouter plus un au produit et modifier prixTotal
  2429.         $oldQte $panierProduit->getQuantite();
  2430.         $newQte $oldQte 1;
  2431.         $panierProduit->setQuantite($newQte);
  2432.         $oldTotal $panierProduit->getPrixTotal();
  2433.         $newTotal $oldTotal $produit->getIdConditionnement()->getMontantTTC();
  2434.         $panierProduit->setPrixTotal($newTotal);
  2435.         $em->getManager()->persist($panierProduit);
  2436.         $em->getManager()->flush();
  2437.         //fin
  2438.         if ($inser === false) {
  2439.             $p = [];
  2440.             $p["id"] = $produit->getId();
  2441.             $p["nom"] = $produit->getType()->getLabeletype();
  2442.             $p["ident"] = $produit->getLabele();
  2443.             $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  2444.             $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  2445.             $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  2446.             $p["condition"] = $produit->getIdConditionnement()->getId();
  2447.             $p["qte"] = 1;
  2448.             array_push($Products$p);
  2449.         }
  2450.         $session->set('Panier'$Products);
  2451.         //sendmail_parent
  2452.         $dateNow = new \Datetime();
  2453.         /** @var \App\Entity\User $user */
  2454.         $user $this->getUser();
  2455.         $userEmail $user->getEmail();
  2456.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  2457.         //$this->EmailServie->MailRelancePanier($userEmail);
  2458.         return new response('done');
  2459.     }
  2460.     //fonction pour pochett photo comande direct au panier 
  2461.     /**
  2462.      * @Route("/Parent/PochetcomdComandeSave", name="PochettePhotosComandeSave_pochet_panier")
  2463.      */
  2464.     public function PochettePhotosComandeSave_pochet_panier(Request $request)
  2465.     {
  2466.         $em $this->em;
  2467.         $session $this->session;
  2468.         $serviceuser $this->etablissementService;
  2469.         $page $request->get("pages");
  2470.         $sejour $request->get("sejour");
  2471.         $prodid $request->get('idProd');
  2472.         $nomprod $request->get('nomprod');
  2473.         $nbr $request->get('nbr');
  2474.         $user $this->getUser();
  2475.         $nbr strval($nbr);
  2476.         $produittype $session->get("produit");
  2477.         $produit $session->get("produittype");
  2478.         $Album $serviceuser->SavePhotosPochetteParent($page$user$sejour$prodid$produit$produittype$nbr$nomprod);
  2479.         $inser false;
  2480.         $Products $session->get("Panier");
  2481.         $produit $em->getRepository(Produit::class)->find($Album->getId());
  2482.         //Touhemi  03-07-2020 :Rechercher  si l'utilisateur a déja un panier avec statut créer ds la bd , sinon on écrit un panier
  2483.         $user $this->getUser();
  2484.         $typeref $em->getRepository(Typeref::class)->find(8);
  2485.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  2486.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  2487.         //fin
  2488.         if ($panierTrace == null) {
  2489.             $panierTrace = new Panier();
  2490.             $dateNow = new \Datetime();
  2491.             $panierTrace->setDateCreation($dateNow);
  2492.             $panierTrace->setCreerPar($user);
  2493.             $panierTrace->setStatut($statutPanier);
  2494.             $em->getManager()->persist($panierTrace);
  2495.             $em->getManager()->flush();
  2496.         }
  2497.         //Touhemi 03-07-2020 :s'il y a un produit avec (id user,id sejour, type produit et type conditionement) dans le panier , sinon on écrit un produit
  2498.         if ($Products == null) {
  2499.             $Products = [];
  2500.         }
  2501.         foreach ($Products as $key => $p) {
  2502.             if ($p['id'] == $produit->getId()) {
  2503.                 $inser true;
  2504.                 $Products[$key]['qte'] = $p['qte'] + 1;
  2505.                 $Products[$key]['mnt'] = $p['mnt'] + $produit->getIdConditionnement()->getMontantTTC();
  2506.             }
  2507.         }
  2508.         //Touhemi 03-07-2020 :Rechercher  si le produti existe déja ds panierProduit
  2509.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  2510.         if ($panierProduit == null) {
  2511.             $panierProduit = new PanierProduit();
  2512.             $panierProduit->setIdProduit($produit);
  2513.             $panierProduit->setIdPanier($panierTrace);
  2514.             $em->getManager()->persist($panierProduit);
  2515.             $em->getManager()->flush();
  2516.         }
  2517.         //fin
  2518.         //   Touhemi 03-07-2020 ajouter plus un au produit et modifier prixTotal
  2519.         $oldQte $panierProduit->getQuantite();
  2520.         $newQte $oldQte 1;
  2521.         $panierProduit->setQuantite($newQte);
  2522.         $oldTotal $panierProduit->getPrixTotal();
  2523.         $newTotal $oldTotal $produit->getIdConditionnement()->getMontantTTC();
  2524.         $panierProduit->setPrixTotal($newTotal);
  2525.         $em->getManager()->persist($panierProduit);
  2526.         $em->getManager()->flush();
  2527.         //fin
  2528.         if ($inser === false) {
  2529.             $p = [];
  2530.             $p["id"] = $produit->getId();
  2531.             $p["nom"] = $produit->getType()->getLabeletype();
  2532.             $p["ident"] = $produit->getLabele();
  2533.             $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  2534.             $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  2535.             $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  2536.             $p["condition"] = $produit->getIdConditionnement()->getId();
  2537.             $p["qte"] = 1;
  2538.             array_push($Products$p);
  2539.         }
  2540.         $session->set('Panier'$Products);
  2541.         //sendmail_parent
  2542.         $dateNow = new \Datetime();
  2543.         /** @var \App\Entity\User $user */
  2544.         $user $this->getUser();
  2545.         $userEmail $user->getEmail();
  2546.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  2547.         // $this->EmailServie->MailRelancePanier($userEmail);
  2548.         return new response('done');
  2549.     }
  2550.     //Nouvelle fonction ajout pochette
  2551.     /**
  2552.      * @Route("/Parent/TestcreateFilePhotosNew", name="TestcreateFilePhotosNew")
  2553.      */
  2554.     function TestcreateFilePhotosNew(Request $request)
  2555.     {
  2556.         $prdt $request->get("produit");
  2557.         $printerSer $this->printerService;
  2558.         $pages $this->em->getRepository(Page::class)->findBy(array("idproduit" => $prdt));
  2559.         $this->logger->notice('Generating File for Pack photos');
  2560.         $name =  $printerSer->CreerTcpPhotosPochette_Parent($prdt'NumCmd_963''Photo'$pages);
  2561.         dump($name);
  2562.         die();
  2563.         return ("ok");
  2564.     }
  2565.     //Nouvelle fonction ajout pochette
  2566.     /**
  2567.      * @Route("/Parent/AddPochetteAuPanier", name="AddPochetteAuPanier")
  2568.      */
  2569.     public function AddPochetteAuPanier(Request $request)
  2570.     {
  2571.         $em $this->em;
  2572.         $session $this->session;
  2573.         $serviceuser $this->etablissementService;
  2574.         $page $request->get("photos");
  2575.         $sejour $request->get("sejour");
  2576.         $nbr $request->get('nbr');
  2577.         $user $this->getUser();
  2578.         $nbr strval($nbr);
  2579.         //Enregistrement des infos de la pochette dans un produit et les photos dans des pages avec JSON
  2580.         $Pochette_photos $serviceuser->photosPochette_Nouvelle($page$user$sejour$nbr);
  2581.         $produit $em->getRepository(Produit::class)->find($Pochette_photos->getId());
  2582.         
  2583.       // $zipFileName = $this->printerService->CreerTcpPhotosPochette_Parent($Pochette_photos->getId(), "9999999", "pochette_photo");
  2584.   
  2585.       
  2586.       
  2587.         $inser false;
  2588.         $Products $session->get("Panier");
  2589.         $produit $em->getRepository(Produit::class)->find($Pochette_photos->getId());
  2590.         //Touhemi  03-07-2020 :Rechercher  si l'utilisateur a déja un panier avec statut créer ds la bd , sinon on écrit un panier
  2591.         $typeref $em->getRepository(Typeref::class)->find(8);
  2592.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  2593.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  2594.         //fin
  2595.         if ($panierTrace == null) {
  2596.             $panierTrace = new Panier();
  2597.             $dateNow = new \Datetime();
  2598.             $panierTrace->setDateCreation($dateNow);
  2599.             $panierTrace->setCreerPar($user);
  2600.             $panierTrace->setStatut($statutPanier);
  2601.             $em->getManager()->persist($panierTrace);
  2602.             $em->getManager()->flush();
  2603.         }
  2604.         //Touhemi 03-07-2020 :s'il y a un produit avec (id user,id sejour, type produit et type conditionement) dans le panier , sinon on écrit un produit
  2605.         if ($Products == null) {
  2606.             $Products = [];
  2607.         }
  2608.         foreach ($Products as $key => $p) {
  2609.             if ($p['id'] == $produit->getId()) {
  2610.                 $inser true;
  2611.                 $Products[$key]['qte'] = $p['qte'] + 1;
  2612.                 $Products[$key]['mnt'] = $p['mnt'] + $produit->getIdConditionnement()->getMontantTTC();
  2613.             }
  2614.         }
  2615.         //Touhemi 03-07-2020 :Rechercher  si le produti existe déja ds panierProduit
  2616.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  2617.         if ($panierProduit == null) {
  2618.             $panierProduit = new PanierProduit();
  2619.             $panierProduit->setIdProduit($produit);
  2620.             $panierProduit->setIdPanier($panierTrace);
  2621.             $em->getManager()->persist($panierProduit);
  2622.             $em->getManager()->flush();
  2623.         }
  2624.         //fin
  2625.       
  2626.         $oldQte $panierProduit->getQuantite();
  2627.         $newQte $oldQte 1;
  2628.         $panierProduit->setQuantite($newQte);
  2629.         $oldTotal $panierProduit->getPrixTotal();
  2630.         $newTotal $oldTotal $produit->getIdConditionnement()->getMontantTTC();
  2631.         $panierProduit->setPrixTotal($newTotal);
  2632.         $em->getManager()->persist($panierProduit);
  2633.         $em->getManager()->flush();
  2634.         // Test creation du fichier zip pdf pochette
  2635.      
  2636.         
  2637.         if ($inser === false) {
  2638.             $p = [];
  2639.             $p["id"] = $produit->getId();
  2640.             $p["nom"] = $produit->getType()->getLabeletype();
  2641.             $p["ident"] = $produit->getLabele();
  2642.             $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  2643.             $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  2644.             $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  2645.             $p["condition"] = $produit->getIdConditionnement()->getId();
  2646.             $p["qte"] = 1;
  2647.             array_push($Products$p);
  2648.         }
  2649.         $session->set('Panier'$Products);
  2650.         //sendmail_parent
  2651.         $dateNow = new \Datetime();
  2652.         /** @var \App\Entity\User $user */
  2653.         $user $this->getUser();
  2654.         $userEmail $user->getEmail();
  2655.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  2656.         // $this->EmailServie->MailRelancePanier($userEmail);
  2657.         //   $this->TestcreateFilePhotosNew($produit);
  2658.         return new response('done');
  2659.     }
  2660.   
  2661.     /**
  2662.      * @Route("/Parent/AddRetroAuPanier", name="AddRetroAuPanier", methods={"POST"})
  2663.      */
  2664.     public function AddRetroAuPanier(Request $request)
  2665.     {
  2666.         $em       $this->em;        // or getDoctrine()->getManager()
  2667.         $session  $this->session;
  2668.         $user $this->getUser();
  2669.         $service  $this->etablissementService// Same service that had photosPochette_Nouvelle
  2670.         $photos   $request->get('photos');     // base64 data, widths, heights, etc.
  2671.         $sejourId $request->get('sejour');
  2672.         $nbr      strval($request->get('nbr'));
  2673.         // 1) Let the service create the new "Retro" product + store pages
  2674.         //    We’ll define photosRetro_Nouvelle similar to photosPochette_Nouvelle
  2675.         $RetroProduit $service->photosRetro_Nouvelle($photos$user$sejourId$nbr);
  2676.         // 2) Same logic to insert that new product in the user’s Panier
  2677.         //    (Essentially the same as your AddPochetteAuPanier code)
  2678.         $inser false;
  2679.         $Products $session->get("Panier");
  2680.         if (!$Products) {
  2681.             $Products = [];
  2682.         }
  2683.         // The newly created product
  2684.         $produit $em->getRepository(Produit::class)->find($RetroProduit->getId());
  2685.         // A) Check if a "Panier" with status "creer" for this user exists,
  2686.         //    or create one if needed
  2687.         $typeref $em->getRepository(Typeref::class)->find(8);
  2688.         $statutPanier $em->getRepository(Ref::class)->findOneBy([
  2689.             "libiller" => "creer",
  2690.             "typeref" => $typeref
  2691.         ]);
  2692.         $panierTrace $em->getRepository(Panier::class)->findOneBy([
  2693.             "creerPar" => $user,
  2694.             "statut"   => $statutPanier
  2695.         ]);
  2696.         if (!$panierTrace) {
  2697.             $panierTrace = new Panier();
  2698.             $panierTrace->setDateCreation(new \DateTime());
  2699.             $panierTrace->setCreerPar($user);
  2700.             $panierTrace->setStatut($statutPanier);
  2701.             $em->getManager()->persist($panierTrace);
  2702.             $em->getManager()->flush();
  2703.         }
  2704.         // B) Check if this product already exists in $Products
  2705.         foreach ($Products as $key => $p) {
  2706.             if ($p['id'] == $produit->getId()) {
  2707.                 $inser true;
  2708.                 $Products[$key]['qte'] += 1;
  2709.                 $Products[$key]['mnt'] += $produit->getIdConditionnement()->getMontantTTC();
  2710.             }
  2711.         }
  2712.         // C) Check if it also exists in PanierProduit table
  2713.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy([
  2714.             "idProduit" => $produit,
  2715.             "idPanier"  => $panierTrace
  2716.         ]);
  2717.         if (!$panierProduit) {
  2718.             $panierProduit = new PanierProduit();
  2719.             $panierProduit->setIdProduit($produit);
  2720.             $panierProduit->setIdPanier($panierTrace);
  2721.             $em->getManager()->persist($panierProduit);
  2722.             $em->getManager()->flush();
  2723.         }
  2724.         // D) Increase quantity & total
  2725.         $oldQte $panierProduit->getQuantite();
  2726.         $panierProduit->setQuantite($oldQte 1);
  2727.         $oldTotal $panierProduit->getPrixTotal();
  2728.         $panierProduit->setPrixTotal($oldTotal $produit->getIdConditionnement()->getMontantTTC());
  2729.         $em->getManager()->persist($panierProduit);
  2730.         $em->getManager()->flush();
  2731.         // E) If not inserted in $Products above, push new array item
  2732.         if (!$inser) {
  2733.             $p = [
  2734.                 "id"         => $produit->getId(),
  2735.                 "nom"        => $produit->getType()->getLabeletype(),
  2736.                 "ident"      => $produit->getLabele(),
  2737.                 "codesejour" => $produit->getIdsjour()->getcodeSejour(),
  2738.                 "mnt"        => $produit->getIdConditionnement()->getMontantTTC(),
  2739.                 "path"       => $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath(),
  2740.                 "condition"  => $produit->getIdConditionnement()->getId(),
  2741.                 "qte"        => 1
  2742.             ];
  2743.             $Products[] = $p;
  2744.         }
  2745.         $session->set('Panier'$Products);
  2746.         /** @var \App\Entity\User $user */
  2747.         $user $this->getUser();
  2748.         $userEmail $user->getEmail();
  2749.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  2750.         return new Response('done');
  2751.     }
  2752.     /**
  2753.      * @Route("/Parent/SavePhotosRetros", name="SavePhotosRetrosParent")
  2754.      */
  2755.     public function SavePhotosRetrosParent(Request $request)
  2756.     {
  2757.         $em $this->em;
  2758.         $session $this->session;
  2759.         $serviceuser $this->etablissementService;
  2760.         $page $request->get("pages");
  2761.         $sejour $request->get("sejour");
  2762.         $prodid $request->get('idProd');
  2763.         $nomprod $request->get('nomprod');
  2764.         $nbr $request->get('nbr');
  2765.         $comandePanier $request->get('comandePanier');
  2766.         $user $this->getUser();
  2767.         $nbr strval($nbr);
  2768.         $produittype $session->get("produit");
  2769.         $produit $session->get("produittype");
  2770.         $Album $serviceuser->SavePhotosRetrosParents($page$user$sejour$prodid$produit$produittype$nbr$nomprod);
  2771.         //dd($etablissementDetail);
  2772.         if ($comandePanier == "comandePanier") {
  2773.             $inser false;
  2774.             $Products $session->get("Panier");
  2775.             $produit $this->em->getRepository(Produit::class)->find($Album->getId());
  2776.             //Touhemi  03-07-2020 :Rechercher  si l'utilisateur a déja un panier avec statut créer ds la bd , sinon on écrit un panier
  2777.             $user $this->getUser();
  2778.             $typeref $em->getRepository(Typeref::class)->find(8);
  2779.             $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  2780.             $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  2781.             //fin
  2782.             if ($panierTrace == null) {
  2783.                 $panierTrace = new Panier();
  2784.                 $dateNow = new \Datetime();
  2785.                 $panierTrace->setDateCreation($dateNow);
  2786.                 $panierTrace->setCreerPar($user);
  2787.                 $panierTrace->setStatut($statutPanier);
  2788.                 $em->getManager()->persist($panierTrace);
  2789.                 $em->getManager()->flush();
  2790.             }
  2791.             //Touhemi 03-07-2020 :s'il y a un produit avec (id user,id sejour, type produit et type conditionement) dans le panier , sinon on écrit un produit
  2792.             if ($Products == null) {
  2793.                 $Products = [];
  2794.             }
  2795.             foreach ($Products as $key => $p) {
  2796.                 if ($p['id'] == $produit->getId()) {
  2797.                     $inser true;
  2798.                     $Products[$key]['qte'] = $p['qte'] + 1;
  2799.                     $Products[$key]['mnt'] = $p['mnt'] + $produit->getIdConditionnement()->getMontantTTC();
  2800.                 }
  2801.             }
  2802.             //Touhemi 03-07-2020 :Rechercher  si le produti existe déja ds panierProduit
  2803.             $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  2804.             if ($panierProduit == null) {
  2805.                 $panierProduit = new PanierProduit();
  2806.                 $panierProduit->setIdProduit($produit);
  2807.                 $panierProduit->setIdPanier($panierTrace);
  2808.                 $em->getManager()->persist($panierProduit);
  2809.                 $em->getManager()->flush();
  2810.             }
  2811.             //fin
  2812.             //   Touhemi 03-07-2020 ajouter plus un au produit et modifier prixTotal
  2813.             $oldQte $panierProduit->getQuantite();
  2814.             $newQte $oldQte 1;
  2815.             $panierProduit->setQuantite($newQte);
  2816.             $oldTotal $panierProduit->getPrixTotal();
  2817.             $newTotal $oldTotal $produit->getIdConditionnement()->getMontantTTC();
  2818.             $panierProduit->setPrixTotal($newTotal);
  2819.             $em->getManager()->persist($panierProduit);
  2820.             $em->getManager()->flush();
  2821.             //fin
  2822.             if ($inser === false) {
  2823.                 $p = [];
  2824.                 $p["id"] = $produit->getId();
  2825.                 $p["nom"] = $produit->getType()->getLabeletype();
  2826.                 $p["ident"] = $produit->getLabele();
  2827.                 $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  2828.                 $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  2829.                 $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  2830.                 $p["condition"] = $produit->getIdConditionnement()->getId();
  2831.                 $p["qte"] = 1;
  2832.                 array_push($Products$p);
  2833.             }
  2834.             $session->set('Panier'$Products);
  2835.         }
  2836.         //sendmail_parent
  2837.         $dateNow = new \Datetime();
  2838.         /** @var \App\Entity\User $user */
  2839.         $user $this->getUser();
  2840.         $userEmail $user->getEmail();
  2841.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  2842.         // $this->EmailServie->MailRelancePanier($userEmail);
  2843.         return new response($Album->getId());
  2844.     }
  2845.     /**
  2846.      * @Route("/Parent/SaveCalendrierParent", name="SaveCalendrierParent")
  2847.      */
  2848.     public function SaveCalendrierParent(Request $request)
  2849.     {
  2850.         $session $this->session;
  2851.         $serviceuser $this->etablissementService;
  2852.         $page $request->get("pages");
  2853.         $sejour $request->get("sejour");
  2854.         $prodid $request->get('idProd');
  2855.         $nomprod $request->get('nomprod');
  2856.         $nbr $request->get('nbr');
  2857.         $user $this->getUser();
  2858.         $nbr strval($nbr);
  2859.         $produittype $session->get("produit");
  2860.         $produit $session->get("produittype");
  2861.         $Album $serviceuser->SaveCalendrierParent($page$user$sejour$prodid$produit$produittype$nbr$nomprod);
  2862.         //sendmail_parent
  2863.         $dateNow = new \Datetime();
  2864.         /** @var \App\Entity\User $user */
  2865.         $user $this->getUser();
  2866.         $userEmail $user->getEmail();
  2867.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  2868.         //$this->EmailServie->MailRelancePanier($userEmail);
  2869.         return new response('done');
  2870.     }
  2871.     /**
  2872.      * @Route("/Parent/SaveCommandeCalendrierParent", name="SaveCommandeCalendrierParent")
  2873.      */
  2874.     public function SaveCommandeCalendrierParent(Request $request)
  2875.     {
  2876.         $em $this->em;
  2877.         $session $this->session;
  2878.         $serviceuser $this->etablissementService;
  2879.         $page $request->get("pages");
  2880.         $sejour $request->get("sejour");
  2881.         $prodid $request->get('idProd');
  2882.         $nomprod $request->get('nomprod');
  2883.         $nbr $request->get('nbr');
  2884.         $user $this->getUser();
  2885.         $nbr strval($nbr);
  2886.         $produittype $session->get("produit");
  2887.         $produit $session->get("produittype");
  2888.         $Album $serviceuser->SaveCalendrierParent($page$user$sejour$prodid$produit$produittype$nbr$nomprod);
  2889.         $inser false;
  2890.         $Products $session->get("Panier");
  2891.         $produit $em->getRepository(Produit::class)->find($Album->getId());
  2892.         //Touhemi  03-07-2020 :Rechercher  si l'utilisateur a déja un panier avec statut créer ds la bd , sinon on écrit un panier
  2893.         $user $this->getUser();
  2894.         $typeref $em->getRepository(Typeref::class)->find(8);
  2895.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  2896.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  2897.         //fin
  2898.         if ($panierTrace == null) {
  2899.             $panierTrace = new Panier();
  2900.             $dateNow = new \Datetime();
  2901.             $panierTrace->setDateCreation($dateNow);
  2902.             $panierTrace->setCreerPar($user);
  2903.             $panierTrace->setStatut($statutPanier);
  2904.             $em->getManager()->persist($panierTrace);
  2905.             $em->getManager()->flush();
  2906.         }
  2907.         //Touhemi 03-07-2020 :s'il y a un produit avec (id user,id sejour, type produit et type conditionement) dans le panier , sinon on écrit un produit
  2908.         if ($Products == null) {
  2909.             $Products = [];
  2910.         }
  2911.         foreach ($Products as $key => $p) {
  2912.             if ($p['id'] == $produit->getId()) {
  2913.                 $inser true;
  2914.                 $Products[$key]['qte'] = $p['qte'] + 1;
  2915.                 $Products[$key]['mnt'] = $p['mnt'] + $produit->getIdConditionnement()->getMontantTTC();
  2916.             }
  2917.         }
  2918.         //Touhemi 03-07-2020 :Rechercher  si le produti existe déja ds panierProduit
  2919.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  2920.         if ($panierProduit == null) {
  2921.             $panierProduit = new PanierProduit();
  2922.             $panierProduit->setIdProduit($produit);
  2923.             $panierProduit->setIdPanier($panierTrace);
  2924.             $em->getManager()->persist($panierProduit);
  2925.             $em->getManager()->flush();
  2926.         }
  2927.         //fin
  2928.         //   Touhemi 03-07-2020 ajouter plus un au produit et modifier prixTotal
  2929.         $oldQte $panierProduit->getQuantite();
  2930.         $newQte $oldQte 1;
  2931.         $panierProduit->setQuantite($newQte);
  2932.         $oldTotal $panierProduit->getPrixTotal();
  2933.         $newTotal $oldTotal $produit->getIdConditionnement()->getMontantTTC();
  2934.         $panierProduit->setPrixTotal($newTotal);
  2935.         $em->getManager()->persist($panierProduit);
  2936.         $em->getManager()->flush();
  2937.         //fin
  2938.         if ($inser === false) {
  2939.             $p = [];
  2940.             $p["id"] = $produit->getId();
  2941.             $p["nom"] = $produit->getType()->getLabeletype();
  2942.             $p["ident"] = $produit->getLabele();
  2943.             $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  2944.             $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  2945.             $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  2946.             $p["condition"] = $produit->getIdConditionnement()->getId();
  2947.             $p["qte"] = 1;
  2948.             array_push($Products$p);
  2949.         }
  2950.         $session->set('Panier'$Products);
  2951.         //sendmail_parent
  2952.         $dateNow = new \Datetime();
  2953.         /** @var \App\Entity\User $user */
  2954.         $user $this->getUser();
  2955.         $userEmail $user->getEmail();
  2956.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  2957.         // $this->EmailServie->MailRelancePanier($userEmail);
  2958.         return new response('done');
  2959.     }
  2960.     /**
  2961.      * @Route("/Parent/SavePdfParent", name="SavePdfParent")
  2962.      */
  2963.     public function SavePdfParent(Request $request)
  2964.     {
  2965.         //        $blob = $request->get("blob");
  2966.         if (!empty($_POST['blob'])) {
  2967.             $data $_POST['blob'];
  2968.             $fname "test.pdf"// name the file
  2969.             $file fopen("pdf/" $fname'w'); // open the file path
  2970.             fwrite($file$data); //save data
  2971.             fclose($file);
  2972.         } else {
  2973.             echo "No Data Sent";
  2974.         }
  2975.         return new response('ok');
  2976.     }
  2977.     /**
  2978.      * @Route("/Parent/infosphp", name="infos")
  2979.      */
  2980.     public function infos()
  2981.     {
  2982.         echo phpinfo();
  2983.     }
  2984.     /**
  2985.      * @Route("/Parent/RetrosComandeSaveRetros", name="RetrosComandeSaveRetros")
  2986.      */
  2987.     public function RetrosComandeSaveRetros(Request $request)
  2988.     {
  2989.         $em $this->em;
  2990.         $session $this->session;
  2991.         $serviceuser $this->etablissementService;
  2992.         $page $request->get("pages");
  2993.         $sejour $request->get("sejour");
  2994.         $prodid $request->get('idProd');
  2995.         $nomprod $request->get('nomprod');
  2996.         $nbr $request->get('nbr');
  2997.         $user $this->getUser();
  2998.         $nbr strval($nbr);
  2999.         $produittype $session->get("produit");
  3000.         $produit $session->get("produittype");
  3001.         $Album $serviceuser->SavePhotosRetrosParents($page$user$sejour$prodid$produit$produittype$nbr$nomprod);
  3002.         $inser false;
  3003.         $Products $session->get("Panier");
  3004.         $produit $em->getRepository(Produit::class)->find($Album->getId());
  3005.         //Touhemi  03-07-2020 :Rechercher  si l'utilisateur a déja un panier avec statut créer ds la bd , sinon on écrit un panier
  3006.         $user $this->getUser();
  3007.         $typeref $em->getRepository(Typeref::class)->find(8);
  3008.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  3009.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  3010.         //fin
  3011.         if ($panierTrace == null) {
  3012.             $panierTrace = new Panier();
  3013.             $dateNow = new \Datetime();
  3014.             $panierTrace->setDateCreation($dateNow);
  3015.             $panierTrace->setCreerPar($user);
  3016.             $panierTrace->setStatut($statutPanier);
  3017.             $em->getManager()->persist($panierTrace);
  3018.             $em->getManager()->flush();
  3019.         }
  3020.         //Touhemi 03-07-2020 :s'il y a un produit avec (id user,id sejour, type produit et type conditionement) dans le panier , sinon on écrit un produit
  3021.         if ($Products == null) {
  3022.             $Products = [];
  3023.         }
  3024.         foreach ($Products as $key => $p) {
  3025.             if ($p['id'] == $produit->getId()) {
  3026.                 $inser true;
  3027.                 $Products[$key]['qte'] = $p['qte'] + 1;
  3028.                 $Products[$key]['mnt'] = $p['mnt'] + $produit->getIdConditionnement()->getMontantTTC();
  3029.             }
  3030.         }
  3031.         //Touhemi 03-07-2020 :Rechercher  si le produti existe déja ds panierProduit
  3032.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  3033.         if ($panierProduit == null) {
  3034.             $panierProduit = new PanierProduit();
  3035.             $panierProduit->setIdProduit($produit);
  3036.             $panierProduit->setIdPanier($panierTrace);
  3037.             $em->getManager()->persist($panierProduit);
  3038.             $em->getManager()->flush();
  3039.         }
  3040.         //fin
  3041.         //   Touhemi 03-07-2020 ajouter plus un au produit et modifier prixTotal
  3042.         $oldQte $panierProduit->getQuantite();
  3043.         $newQte $oldQte 1;
  3044.         $panierProduit->setQuantite($newQte);
  3045.         $oldTotal $panierProduit->getPrixTotal();
  3046.         $newTotal $oldTotal $produit->getIdConditionnement()->getMontantTTC();
  3047.         $panierProduit->setPrixTotal($newTotal);
  3048.         $em->getManager()->persist($panierProduit);
  3049.         $em->getManager()->flush();
  3050.         //fin
  3051.         if ($inser === false) {
  3052.             $p = [];
  3053.             $p["id"] = $produit->getId();
  3054.             $p["nom"] = $produit->getType()->getLabeletype();
  3055.             $p["ident"] = $produit->getLabele();
  3056.             $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  3057.             $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  3058.             $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  3059.             $p["condition"] = $produit->getIdConditionnement()->getId();
  3060.             $p["qte"] = 1;
  3061.             array_push($Products$p);
  3062.         }
  3063.         $session->set('Panier'$Products);
  3064.         return new response('done');
  3065.     }
  3066.     /**
  3067.      * @Route("/Parent/nbvisite", name="nbvisite",methods={"POST","GET"})
  3068.      */
  3069.     public function ajouternombrevisite(Request $request)
  3070.     {
  3071.         $SejourService $this->sejourService;
  3072.         $CarteService $this->carteService;
  3073.         $typevisite $request->get("typevisite");
  3074.         $idsejour $request->get("idsejour");
  3075.         $idattach $request->get("idattachement");
  3076.         if ($typevisite == "carte") {
  3077.             $nbvisite $CarteService->carteVisite($idsejour);
  3078.         } else {
  3079.             $nbvisite $SejourService->affectationnbvisiteattachement($idsejour$idattach);
  3080.         }
  3081.         return new JsonResponse('done');
  3082.     }
  3083.     /**
  3084.      * @Route("/Parent/ajouterauPanier_Parent", name="Ajouter_MonPanier")
  3085.      */
  3086.     public function Ajouter_MonPanier(Request $request)
  3087.     {
  3088.         $inser false;
  3089.         $session $this->session;
  3090.         $em $this->em;
  3091.         $Products $session->get("Panier");
  3092.         $id $request->get("id");
  3093.         //Touhemi :Rechercher  si l'utilisateur a déja un panier avec statut créer ds la bd , sinon on écrit un panier
  3094.         $user $this->getUser();
  3095.         $typeref $em->getRepository(Typeref::class)->find(8);
  3096.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  3097.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  3098.         //fin
  3099.         if ($panierTrace == null) {
  3100.             $panierTrace = new Panier();
  3101.             $dateNow = new \Datetime();
  3102.             $panierTrace->setDateCreation($dateNow);
  3103.             $panierTrace->setCreerPar($user);
  3104.             $panierTrace->setStatut($statutPanier);
  3105.             $em->getManager()->persist($panierTrace);
  3106.             $em->getManager()->flush();
  3107.         }
  3108.         $produit $this->em->getRepository(Produit::class)->find($id);
  3109.         if ($Products == null) {
  3110.             $Products = [];
  3111.         }
  3112.         //Touhemi :Rechercher  si le produti existe déja ds panierProduit
  3113.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  3114.         if ($panierProduit == null) {
  3115.             $panierProduit = new PanierProduit();
  3116.             $panierProduit->setIdProduit($produit);
  3117.             $panierProduit->setIdPanier($panierTrace);
  3118.             $em->getManager()->persist($panierProduit);
  3119.             $em->getManager()->flush();
  3120.         }
  3121.         //fin
  3122.         foreach ($Products as $key => $p) {
  3123.             if ($p['id'] == $produit->getId()) {
  3124.                 $inser true;
  3125.                 $Products[$key]['qte'] = $p['qte'] + 1;
  3126.             }
  3127.         }
  3128.         //Touhemi ajouter plus un au produit et modifier prixTotal
  3129.         $oldQte $panierProduit->getQuantite();
  3130.         $newQte $oldQte 1;
  3131.         $panierProduit->setQuantite($newQte);
  3132.         $oldTotal $panierProduit->getPrixTotal();
  3133.         $newTotal $oldTotal $produit->getIdConditionnement()->getMontantTTC();
  3134.         $panierProduit->setPrixTotal($newTotal);
  3135.         $this->em->getManager()->persist($panierProduit);
  3136.         $this->em->getManager()->flush();
  3137.         //fin
  3138.         if ($inser === false) {
  3139.             //get nessaisire element
  3140.             $p = [];
  3141.             $p["id"] = $produit->getId();
  3142.             $p["nom"] = $produit->getType()->getLabeletype();
  3143.             $p["ident"] = $produit->getLabele();
  3144.             $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  3145.             $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  3146.             $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  3147.             $p["condition"] = $produit->getIdConditionnement()->getId();
  3148.             $p["qte"] = 1;
  3149.             array_push($Products$p);
  3150.         }
  3151.         $session->set('Panier'$Products);
  3152.         return new JsonResponse('done');
  3153.     }
  3154.     /**
  3155.      * @Route("/Parent/Ajouter_Album_Parent", name="Ajouter_Album_Parent_Alb")
  3156.      */
  3157.     public function Ajouter_Album(Request $request)
  3158.     {
  3159.         $session $this->session;
  3160.         $id $request->get("id");
  3161.         $typeProdcondition $this->em->getRepository(TypeProduitConditionnement::class)->find($id);
  3162.         $typeprod $typeProdcondition->getIdTypeProduit()->getId();
  3163.         $session->set('produit'$id);
  3164.         $session->set('produitconditionAlbum'$id);
  3165.         $session->set('produittype'$typeprod);
  3166.         return new JsonResponse('done');
  3167.     }
  3168.     /**
  3169.      * @Route("/Parent/ComandeParent", name="ComandeParent")
  3170.      */
  3171.     public function comande_Parent(Request $request)
  3172.     {
  3173.         $session $this->session;
  3174.         // $comande = $request->get("p");
  3175.         $Panier $session->get("Panier");
  3176.         $session->set('comande'$Panier);
  3177.         return new JsonResponse('done');
  3178.     }
  3179.     /**
  3180.      * @Route("/Parent/Accueil5sur5/adresse_comande", name="adresse_comande",methods={"POST"})
  3181.      */
  3182.     public function adresse_comande(Request $request)
  3183.     {
  3184.         $UserService $this->userService;
  3185.         /** @var \App\Entity\User $user */
  3186.         $user $this->getUser();
  3187.         $iduser $user->getId();
  3188.         $idCommande $request->get("idCommande");
  3189.         $prenom $request->get("prenom");
  3190.         $nom $request->get("nom");
  3191.         $organism $request->get("organism");
  3192.         $rue $request->get('ruevoi');
  3193.         $ville $request->get("villle");
  3194.         $pays $request->get("pays");
  3195.         $codepostal $request->get("codpostal");
  3196.         //adress facturation if exsist
  3197.         $prenomfacturation $request->get("prenomadressfacturation");
  3198.         $nomfacturation $request->get("nomadressfacturation");
  3199.         $organismfacturation $request->get("etablismadressfacturation");
  3200.         $ruefacturation $request->get('rueadressfacturation');
  3201.         $villefacturation $request->get("villefacturation");
  3202.         $paysfacturation $request->get("payadressfacturation");
  3203.         $codepostalfacturation $request->get("codepostalfacturation");
  3204.         //modification userPArent
  3205.         $em $this->em;
  3206.         $adress $UserService->modifieradress_comande($rue$ville$pays$codepostal$iduser$prenom$nom$organism$prenomfacturation$nomfacturation$organismfacturation$ruefacturation$villefacturation$paysfacturation$codepostalfacturation);
  3207.         $commande $em->getRepository(Commande::class)->findOneBy(array("id" => $idCommande));
  3208.         $commande->setAdresslivraison($adress);
  3209.         $commande->setAddresseLivraison($ville);
  3210.         $commande->setAdressfactoration($adress);
  3211.         $em->getManager()->persist($commande);
  3212.         $em->getManager()->flush();
  3213.         return new JsonResponse('Adresse Enregitrée');
  3214.     }
  3215.     /**
  3216.      * @Route("/Parent/Accueil5sur5/codesecuriter", name="codesecuriter",methods={"POST"})
  3217.      */
  3218.     public function codesecuriter(Request $request)
  3219.     {
  3220.         $UserService $this->userService;
  3221.         /** @var \App\Entity\User $user */
  3222.         $user $this->getUser();
  3223.         $iduser $user->getId();
  3224.         $code1 $request->get("code1");
  3225.         $code2 $request->get("code2");
  3226.         $code3 $request->get("code3");
  3227.         $set1 $request->get("set");
  3228.         if ($set1 == 1) {
  3229.             if ($code1 == "") {
  3230.                 return new Response('erore');
  3231.             }
  3232.             $adress $UserService->codesecuriter($code1$iduser);
  3233.         }
  3234.         if ($set1 == 2) {
  3235.             if ($code2 == "") {
  3236.                 return new Response('erore');
  3237.             }
  3238.             $adress $UserService->codesecuriter($code2$iduser);
  3239.         }
  3240.         if ($set1 == 3) {
  3241.             if ($code3 == "") {
  3242.                 return new Response('erore');
  3243.             }
  3244.             $adress $UserService->codesecuriter($code3$iduser);
  3245.         }
  3246.         return new Response('done');
  3247.     }
  3248.     /**
  3249.      * @Route("/Parent/Accueil5sur5/suprimer_Album_panier", name="suprimer_Album_panier",methods={"POST"})
  3250.      */
  3251.     public function suprimer_Album_panier(Request $request)
  3252.     {
  3253.         $session $this->session;
  3254.         $Products $session->get("Panier");
  3255.         $id $request->get("p");
  3256.         foreach ($Products as $key => $p) {
  3257.             if ($p['id'] == $id) {
  3258.                 unset($Products[$key]);
  3259.             }
  3260.         }
  3261.         $session->set('Panier'$Products);
  3262.         $em $this->em;
  3263.         $user $this->getUser();
  3264.         $produit $em->getRepository(Produit::class)->find($id);
  3265.         $typeref $em->getRepository(Typeref::class)->find(8);
  3266.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  3267.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  3268.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  3269.         $em->getManager()->remove($panierProduit);
  3270.         $em->getManager()->flush();
  3271.         return new Response('done');
  3272.     }
  3273.     /**
  3274.      * @Route("/Parent/Accueil5sur5/additiondproduit_parent", name="additiondproduit_parent",methods={"POST"})
  3275.      */
  3276.     public function additiondproduit_parent(Request $request)
  3277.     {
  3278.         $session $this->session;
  3279.         $Products $session->get("Panier");
  3280.         $id $request->get("p");
  3281.         foreach ($Products as $key => $p) {
  3282.             if ($p['id'] == $id) {
  3283.                 $qte_dans_panier $Products[$key]['qte'];
  3284.                 $mnt_dans_panier $Products[$key]['mnt'] / $qte_dans_panier;
  3285.                 $Products[$key]['qte'] = $p['qte'] + 1;
  3286.                 // $Products[$key]['mnt']=$p['mnt']+$mnt_dans_panier;
  3287.             }
  3288.         }
  3289.         $session->set('Panier'$Products);
  3290.         //Touhemi addition au panier produit ds bd
  3291.         $em $this->em;
  3292.         $user $this->getUser();
  3293.         $produit $em->getRepository(Produit::class)->find($id);
  3294.         $typeref $em->getRepository(Typeref::class)->find(8);
  3295.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  3296.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  3297.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  3298.         if ($panierProduit != null) {
  3299.             $oldQte $panierProduit->getQuantite();
  3300.             $newQte $oldQte 1;
  3301.             $panierProduit->setQuantite($newQte);
  3302.             $oldTotal $panierProduit->getPrixTotal();
  3303.             $newTotal $oldTotal $produit->getIdConditionnement()->getMontantTTC();
  3304.             $panierProduit->setPrixTotal($newTotal);
  3305.             $em->getManager()->persist($panierProduit);
  3306.             $em->getManager()->flush();
  3307.         }
  3308.         return new Response('done');
  3309.     }
  3310.     /**
  3311.      * @Route("/Parent/Accueil5sur5/sousstractionproduit_parent", name="sousstractionproduit_parent",methods={"POST"})
  3312.      */
  3313.     public function sousstractionproduit_parent(Request $request)
  3314.     {
  3315.         $session $this->session;
  3316.         $Products $session->get("Panier");
  3317.         $id $request->get("p");
  3318.         foreach ($Products as $key => $p) {
  3319.             if ($p['id'] == $id) {
  3320.                 $qte_dans_panier $Products[$key]['qte'];
  3321.                 $mnt_dans_panier $Products[$key]['mnt'] / $qte_dans_panier;
  3322.                 $Products[$key]['qte'] = $p['qte'] - 1;
  3323.                 // $Products[$key]['mnt']=$p['mnt']-$mnt_dans_panier;
  3324.                 $set $Products[$key];
  3325.             }
  3326.             if ($Products[$key]['qte'] == 0) {
  3327.                 unset($Products[$key]);
  3328.             }
  3329.         }
  3330.         $session->set('Panier'$Products);
  3331.         $em $this->em;
  3332.         $user $this->getUser();
  3333.         $produit $em->getRepository(Produit::class)->find($id);
  3334.         $typeref $em->getRepository(Typeref::class)->find(8);
  3335.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  3336.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  3337.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  3338.         if ($panierProduit != null) {
  3339.             $oldQte $panierProduit->getQuantite();
  3340.             $newQte $oldQte 1;
  3341.             if ($newQte 0) {
  3342.                 $panierProduit->setQuantite($newQte);
  3343.                 $oldTotal $panierProduit->getPrixTotal();
  3344.                 $newTotal $oldTotal $produit->getIdConditionnement()->getMontantTTC();
  3345.                 $panierProduit->setPrixTotal($newTotal);
  3346.                 $em->getManager()->persist($panierProduit);
  3347.                 $em->getManager()->flush();
  3348.             }
  3349.             if ($newQte == 0) {
  3350.                 $em->getManager()->remove($panierProduit);
  3351.                 $em->getManager()->flush();
  3352.             }
  3353.         }
  3354.         return new Response('done');
  3355.     }
  3356.     /**
  3357.      * @Route("Parent/AjoutAlbum_parent/{idAlbm}", name="EditionAlbumfrompanier")
  3358.      */
  3359.     public function EditionAlbumParent_panier($idAlbm)
  3360.     {
  3361.         $SEjourService $this->sejourService;
  3362.         /** @var \App\Entity\User $user */
  3363.         $user $this->getUser();
  3364.         $userId $user->getId();
  3365.         $user $this->getUser();
  3366.         $session $this->session;
  3367.         $session->set('pageMenu''');
  3368.         $idSejour $session->get("Sejour");
  3369.         $produitcondition $session->get("produit");
  3370.         $produit $session->get("produittype");
  3371.         $sejour $SEjourService->getsejourpourparent($idSejour);
  3372.         $em $this->em;
  3373.         $clipart null;
  3374.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  3375.         $nbLikes 0;
  3376.         if ($listeattachlikephoto) {
  3377.             $nbLikes count($listeattachlikephoto);
  3378.         }
  3379.         $AllPages null;
  3380.         $Albumproduct null;
  3381.         $AllPagesAcc null;
  3382.         $random false;
  3383.         $Albumproduct $em->getRepository(Produit::class)->find($idAlbm);
  3384.         if ($Albumproduct == null || $Albumproduct == "") {
  3385.             $Albumproduct $em->getRepository(Produit::class)->findOneBy(['labele' => 'random']);
  3386.             $random true;
  3387.         }
  3388.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  3389.         $idAcc $sejour->getIdAcommp();
  3390.         $albumAcc null;
  3391.         $allpagesResult = array();
  3392.         $tabacc = array();
  3393.         $tabacc1 = array();
  3394.         foreach ($AllPages as $page) {
  3395.             $pageJ json_decode($page->getCouleurbordure());
  3396.             $pageDec json_decode($pageJ[0]);
  3397.             $attache json_decode($pageDec->attache);
  3398.             foreach ($attache as $att) {
  3399.                 $attachDec json_decode($att);
  3400.                 if (isset($attachDec->id) && json_decode($attachDec->id) !== null && $attachDec->id !== '') {
  3401.                     $idAttach json_decode($attachDec->id);
  3402.                     array_push($tabacc$idAttach);
  3403.                 }
  3404.             }
  3405.         }
  3406.         $tabacc1 array_count_values($tabacc);
  3407.         $part $sejour->getIdPartenaire();
  3408.         $nompart $part->getUsername();
  3409.         $logopart $part->getLogourl();
  3410.         $session->set('produit'$Albumproduct->gettype());
  3411.         $listeattach $SEjourService->getatachmentsejour($idSejour);
  3412.         $nbphoto count($listeattach);
  3413.         if ($Albumproduct->getVersion() === 'new') {
  3414.             if ($nbLikes != 0) {
  3415.                 return $this->render('Parent/NewAlbumLikes.html.twig', ["tabacc" => $tabacc1"nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'like' => $listeattachlikephoto'cliparts' => $clipart'Album' => $Albumproduct'AllPages' => $AllPages'albumAcc' => $albumAcc'AllPagesAcc' => $AllPagesAcc'random' => $random'listeattach' => $listeattach'nbLikes' => $nbLikes'nbPhoto' => $nbphoto]);
  3416.             }
  3417.             return $this->render('Parent/NewAlbumLikes.html.twig', ["listeattach" => $listeattach"tabacc" => $tabacc1"nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'like' => $listeattachlikephoto'cliparts' => $clipart'Album' => $Albumproduct'AllPages' => $AllPages'albumAcc' => $albumAcc'AllPagesAcc' => $AllPagesAcc'random' => $random'nbLikes' => $nbLikes'nbPhoto' => $nbphoto]);
  3418.         } else {
  3419.             return $this->render('Parent/NewAlbumLikes.html.twig', ["tabacc" => $tabacc1"listeattach" => $listeattach"nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'like' => $listeattachlikephoto'cliparts' => $clipart'Album' => $Albumproduct'AllPages' => $AllPages'albumAcc' => $albumAcc'AllPagesAcc' => $AllPagesAcc'random' => $random'nbLikes' => $nbLikes'nbPhoto' => $nbphoto]);
  3420.         }
  3421.     }
  3422.     /**
  3423.      * @Route("/Parent/Accueil5sur5/modifierLabel_produit_parent", name="modifierLabel_produit_parent",methods={"POST"})
  3424.      */
  3425.     public function modifierLabel_produit_parent(Request $request)
  3426.     {
  3427.         $SEjourService $this->sejourService;
  3428.         /** @var \App\Entity\User $user */
  3429.         $user $this->getUser();
  3430.         $userId $user->getId();
  3431.         $session $this->session;
  3432.         $idPrd $request->get("id");
  3433.         $description $request->get("description");
  3434.         $SEjourService->modif_lbel_Produit($idPrd$description);
  3435.         $Products $session->get("Panier");
  3436.         if ($Products != null) {
  3437.             foreach ($Products as $key => $p) {
  3438.                 if ($idPrd == $p['id']) {
  3439.                     $Products[$key]["ident"] = $description;
  3440.                 }
  3441.             }
  3442.         }
  3443.         $session->set('Panier'$Products);
  3444.         return new Response('done');
  3445.     }
  3446.     /**
  3447.      * @Route("/Parent/checkCodePromoParents", name="checkCodePromoParents")
  3448.      */
  3449.     public function checkCodePromoParents(Request $request)
  3450.     {
  3451.         $em $this->em;
  3452.         $SejourService $this->sejourService;
  3453.         $session $this->get('session');
  3454.         $code $request->get('code');
  3455.         $idUser $request->get('idUser');
  3456.         $user $em->getRepository(User::class)->findOneBy(['id' => $idUser]);
  3457.         $CodePromoUtilisse "";
  3458.         $totalpanier  $request->get('totalPanier');
  3459.         $infosPromo $SejourService->checkCodePromoPrents($code$user);
  3460.         $remise 0;
  3461.         $pourcentage 0;
  3462.         if (isset($infosPromo['remise'])) {
  3463.             $remise =  $infosPromo['remise'];
  3464.         }
  3465.         if (isset($infosPromo['pourcentage'])) {
  3466.             $pourcentage =  $infosPromo['pourcentage'];
  3467.         }
  3468.         $totalRemise $totalpanier $pourcentage;
  3469.         $totalRemise = ($totalRemise) / 100;
  3470.         $totalpanierNew $totalpanier $totalRemise;
  3471.         $tvaTotalRemise =   ($totalpanierNew 20) / 100;
  3472.         $user->setShowdetailsphotos("4");
  3473.         $em->getManager()->persist($user);
  3474.         $em->getManager()->flush();
  3475.         return new JsonResponse(array('message' =>  $infosPromo['test'], 'pourcentage' => intval($infosPromo['pourcentage']), 'remise' => $remise'totalDupanier' => $totalpanierNew'totalRemise' => $totalRemise"tvaTotalRemise" => $tvaTotalRemise"CodePromoUtilisse" => $CodePromoUtilisse), 200);
  3476.     }
  3477.     /**
  3478.      * @Route("/Parent/Accueil5sur5/ParentcomandeProduit", name="ParentcomandeProduit",methods={"POST"})
  3479.      */
  3480.     public function ParentcomandeProduit(Request $request)
  3481.     {
  3482.         $em $this->em;
  3483.         $comandeservice $this->commandeService;
  3484.         $sejourService $this->sejourService;
  3485.         /** @var \App\Entity\User $user */
  3486.         $user $this->getUser();
  3487.         $userId $user->getId();
  3488.         $session $this->session;
  3489.         $frais $request->get("fraiEnvoi");
  3490.         $Products $session->get("Panier");
  3491.         $totalepanier $request->get("totalepanier");
  3492.         $envoipost $request->get("envoipost");
  3493.         $remise $request->get("remise");
  3494.         $totalBlackFriday $request->get("totalBlackFriday");
  3495.         $session->set('envoipost'$envoipost);
  3496.         $containsProduitType20 false;
  3497.         $comand $comandeservice->addcomande_parent($Products$userId$frais$totalepanier$envoipost$remise$containsProduitType20);
  3498.         $codePromo $request->get('codePromo');
  3499.         $test $sejourService->checkCodePromo($codePromo);
  3500.         if (isset($test['test'])) {
  3501.             if ($test['test'] == true) {
  3502.                 $promotion $sejourService->findPromotionByCode($codePromo);
  3503.                 if ($promotion) {
  3504.                     $listeProduitsCommande $em->getRepository(ComandeProduit::class)->findBy(array('idComande' => $comand->getId()));
  3505.                     $pourcentage intval($promotion->getPourcentage());
  3506.                     if ($promotion->getNbreApplicable() == 1) {
  3507.                         foreach ($listeProduitsCommande as $cmdProduit) {
  3508.                             $cmdProduit->setPourcentage($pourcentage);
  3509.                             $em->getManager()->persist($cmdProduit);
  3510.                             $em->getManager()->flush();
  3511.                         }
  3512.                     } else {
  3513.                         foreach ($listeProduitsCommande as $cmdProduit) {
  3514.                             $qte $cmdProduit->getQuantiter();
  3515.                             for ($i 0$i $qte$i++) {
  3516.                                 $ligneCmdProd = new ComandeProduit();
  3517.                                 $ligneCmdProd->setQuantiter(1);
  3518.                                 $ligneCmdProd->setIdProduit($cmdProduit->getIdProduit());
  3519.                                 $ligneCmdProd->setIdComande($cmdProduit->getIdComande());
  3520.                                 $ligneCmdProd->setDate($cmdProduit->getDate());
  3521.                                 $em->getManager()->persist($ligneCmdProd);
  3522.                                 $em->getManager()->remove($cmdProduit);
  3523.                             }
  3524.                             $em->getManager()->flush();
  3525.                         }
  3526.                         $listeProduitsCommande $em->getRepository(ComandeProduit::class)->findBy(array('idComande' => $comand->getId()));
  3527.                         $qte 0;
  3528.                         $tabPrices = [];
  3529.                         foreach ($listeProduitsCommande as $cmdProduit) {
  3530.                             $ligne = array('idCmdProduit' => $cmdProduit->getId(), 'price' => $cmdProduit->getIdProduit()->getIdConditionnement()->getMontantTTC());
  3531.                             $qte += $cmdProduit->getQuantiter();
  3532.                             array_push($tabPrices$ligne);
  3533.                         }
  3534.                         $x intval($qte $promotion->getNbreApplicable());
  3535.                         $this->aasort($tabPrices"price");
  3536.                         $tabPricesPromo =   array_slice($tabPrices, -$x$xtrue);
  3537.                         foreach ($tabPricesPromo as $item) {
  3538.                             $cp $em->getRepository(ComandeProduit::class)->find($item['idCmdProduit']);
  3539.                             $cp->setPourcentage($pourcentage);
  3540.                             $em->getManager()->persist($cp);
  3541.                             $em->getManager()->flush();
  3542.                         }
  3543.                     }
  3544.                     $comand->setIdPromotion($promotion);
  3545.                 }
  3546.             }
  3547.         }
  3548.         $session->set('commandeActual'$comand->getId());
  3549.         return new Response($comand->getId());
  3550.     }
  3551.     function aasort(&$array$key)
  3552.     {
  3553.         $sorter = array();
  3554.         $ret = array();
  3555.         reset($array);
  3556.         foreach ($array as $ii => $va) {
  3557.             $sorter[$ii] = $va[$key];
  3558.         }
  3559.         arsort($sorter);
  3560.         foreach ($sorter as $ii => $va) {
  3561.             $ret[$ii] = $array[$ii];
  3562.         }
  3563.         $array $ret;
  3564.     }
  3565.     /**
  3566.      * @Route("Parent/LivreSejourParent", name="Livre_du_Sejour")
  3567.      */
  3568.     public function LivreSejourParent()
  3569.     {
  3570.         $SEjourService $this->sejourService;
  3571.         /** @var \App\Entity\User $user */
  3572.         $user $this->getUser();
  3573.         $userId $user->getId();
  3574.         $user $this->getUser();
  3575.         $session $this->session;
  3576.         $idSejour $session->get("Sejour");
  3577.         $session->set('LivreSejour''LivreSejour');
  3578.         $sejour $SEjourService->getsejourpourparent($idSejour);
  3579.         $em $this->em;
  3580.         $clipart null;
  3581.         $AllPages null;
  3582.         $AllPagesAcc null;
  3583.         $random false;
  3584.         $codeSejour $sejour->getCodeSejour();
  3585.         $nomprod "Livre_Sejour" $codeSejour;
  3586.         $sejour $em->getRepository(Sejour::class)->findOneBy(['id' => $idSejour]);
  3587.         $Albumproduct $em->getRepository(Produit::class)->findOneBy(['version' => 'Livre_Sejour_Admin''labele' => $nomprod'idsjour' => $idSejour]);
  3588.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  3589.         $tabacc = array();
  3590.         $tabacc1 = array();
  3591.         foreach ($AllPages as $page) {
  3592.             $pageJ json_decode($page->getCouleurbordure());
  3593.             $pageDec json_decode($pageJ[0]);
  3594.             $attache json_decode($pageDec->attache);
  3595.             foreach ($attache as $att) {
  3596.                 $attachDec json_decode($att);
  3597.                 if (isset($attachDec->id) && json_decode($attachDec->id) !== null && $attachDec->id !== '') {
  3598.                     $idAttach json_decode($attachDec->id);
  3599.                     array_push($tabacc$idAttach);
  3600.                 }
  3601.             }
  3602.         }
  3603.         $tabacc1 array_count_values($tabacc);
  3604.         $part $sejour->getIdPartenaire();
  3605.         $nompart $part->getUsername();
  3606.         $logopart $part->getLogourl();
  3607.         $listeattach $SEjourService->getatachmentsejour($idSejour);
  3608.         $nbPhoto count($listeattach);
  3609.         //  $session->set('produit', $Albumproduct->gettype());
  3610.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  3611.         $nbLikes count($listeattachlikephoto);
  3612.         return $this->render('Parent/LivreSejour.html.twig', ["tabacc" => $tabacc1"nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'like' => null'cliparts' => $clipart'Album' => $Albumproduct'AllPages' => $AllPages'random' => $random'listeattach' => $listeattach'nbLikes' => $nbLikes'nbPhotos' => $nbPhoto]);
  3613.     }
  3614.     /**
  3615.      * @Route("Parent/LivrePhotos_Parent/{idAlbm}", name="Editionlivrefrompanier")
  3616.      */
  3617.     public function EditionLivrePhotosParentparId($idAlbm)
  3618.     {
  3619.         $SEjourService $this->sejourService;
  3620.         /** @var \App\Entity\User $user */
  3621.         $user $this->getUser();
  3622.         $userId $user->getId();
  3623.         $user $this->getUser();
  3624.         $session $this->session;
  3625.         $session->set('pageMenu''');
  3626.         $idSejour $session->get("Sejour");
  3627.         $produit $session->get("produit");
  3628.        // $sejour = $SEjourService->getsejourpourparent($idSejour);
  3629.         $sejour $this->em->getRepository(Sejour::class)->findOneBy(["id" => $idSejour]);
  3630.         $em $this->em;
  3631.         $clipart null;
  3632.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  3633.         $nbLikes count($listeattachlikephoto);
  3634.         $AllPages null;
  3635.         $Albumproduct null;
  3636.         $AllPagesAcc null;
  3637.         $random false;
  3638.         $Albumproduct $em->getRepository(Produit::class)->find($idAlbm);
  3639.         if ($Albumproduct == null || $Albumproduct == "") {
  3640.             $Albumproduct $em->getRepository(Produit::class)->findOneBy(['labele' => 'random']);
  3641.             $random true;
  3642.         }
  3643.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  3644.         $idAcc $sejour->getIdAcommp();
  3645.         $albumAcc null;
  3646.         $allpagesResult = array();
  3647.         $tabacc = array();
  3648.         $tabacc1 = array();
  3649.         foreach ($AllPages as $page) {
  3650.             $pageJ json_decode($page->getCouleurbordure());
  3651.             $pageDec json_decode($pageJ[0]);
  3652.             $attache json_decode($pageDec->attache);
  3653.             foreach ($attache as $att) {
  3654.                 $attachDec json_decode($att);
  3655.                 if (isset($attachDec->id) && json_decode($attachDec->id) !== null && $attachDec->id !== '') {
  3656.                     $idAttach json_decode($attachDec->id);
  3657.                     array_push($tabacc$idAttach);
  3658.                 }
  3659.             }
  3660.         }
  3661.         $tabacc1 array_count_values($tabacc);
  3662.         $part $sejour->getIdPartenaire();
  3663.         $nompart $part->getUsername();
  3664.         $logopart $part->getLogourl();
  3665.         $listeattach $SEjourService->getatachmentsejour($idSejour);
  3666.         $nbPhoto count($listeattach);
  3667.         $session->set('produit'$Albumproduct->gettype());
  3668.         return $this->render('Parent/NewLivreLikes.html.twig', ["tabacc" => $tabacc1"nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'like' => $listeattachlikephoto'cliparts' => $clipart'Album' => $Albumproduct'AllPages' => $AllPages'random' => $random'listeattach' => $listeattach'nbPhotos' => $nbPhoto'nbLikes' => $nbLikes]);
  3669.     }
  3670.     /**
  3671.      * @Route("Parent/ModificationPochettePhotos/{nbr}/{id}", name="EditionPochettefrompanier")
  3672.      */
  3673.     public function EditionPochetteParentfrompanier($nbr$id)
  3674.     {
  3675.         $SEjourService $this->sejourService;
  3676.         /** @var \App\Entity\User $user */
  3677.         $user $this->getUser();
  3678.         $userId $user->getId();
  3679.         $user $this->getUser();
  3680.         $session $this->session;
  3681.         $session->set('pageMenu''');
  3682.         $idSejour $session->get("Sejour");
  3683.         $produitcondition $session->get("produit");
  3684.         $produit $session->get("produittype");
  3685.         $sejour $SEjourService->getsejourpourparent($idSejour);
  3686.         $em $this->em;
  3687.         $clipart $em->getRepository(Clipart::class)->findAll();
  3688.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  3689.         $listeattach $SEjourService->getatachmentsejour($idSejour);
  3690.         $nbLikes count($listeattachlikephoto);
  3691.         //Stella
  3692.         $AllPagesAcc null;
  3693.         $random false;
  3694.         $Albumproduct $em->getRepository(Produit::class)->findOneBy(['id' => $id]);
  3695.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  3696.         $idAcc $sejour->getIdAcommp();
  3697.         $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  3698.         $part $sejour->getIdPartenaire();
  3699.         $nompart $part->getUsername();
  3700.         $logopart $part->getLogourl();
  3701.         $nomProjet $Albumproduct->getLabele();
  3702.         $nbPhoto count($listeattach);
  3703.         $nbLikes count($listeattachlikephoto);
  3704.         if ($nbLikes $nbr) {
  3705.             return $this->render('Parent/PochettePhotosEdit.html.twig', ["nbr" => $nbr"nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'like' => $listeattachlikephoto'cliparts' => $clipart'Album' => $Albumproduct'AllPages' => $AllPages'albumAcc' => $Albumproduct'AllPagesAcc' => $AllPagesAcc'random' => $random'photosSejour' => $listeattach'nbLikes' => $nbLikes'nbAttach' => $nbPhoto'nomProjet' => $nomProjet]);
  3706.         }
  3707.         if ($nbLikes >= $nbr) {
  3708.             return $this->render('Parent/PochettePhotosEditLikes.html.twig', ["nbr" => $nbr"nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'like' => $listeattachlikephoto'cliparts' => $clipart'Album' => $Albumproduct'AllPages' => $AllPages'albumAcc' => $Albumproduct'AllPagesAcc' => $AllPagesAcc'random' => $random'photosSejour' => $listeattach'nbLikes' => $nbLikes'nbAttach' => $nbPhoto'nomProjet' => $nomProjet]);
  3709.         }
  3710.     }
  3711.     /**
  3712.      * @Route("Parent/ModificationCalendrier/{id}", name="EditionCalendrierParentfrompanier")
  3713.      */
  3714.     public function EditionCalendrierParentfrompanier($id)
  3715.     {
  3716.         $SEjourService $this->sejourService;
  3717.         /** @var \App\Entity\User $user */
  3718.         $user $this->getUser();
  3719.         $userId $user->getId();
  3720.         $user $this->getUser();
  3721.         $session $this->session;
  3722.         $session->set('pageMenu''');
  3723.         $idSejour $session->get("Sejour");
  3724.         $produitcondition $session->get("produit");
  3725.         $produit $session->get("produittype");
  3726.         $sejour $SEjourService->getsejourpourparent($idSejour);
  3727.         $em $this->em;
  3728.         $clipart $em->getRepository(Clipart::class)->findAll();
  3729.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  3730.         $random false;
  3731.         $Albumproduct $em->getRepository(Produit::class)->findOneBy(['id' => $id]);
  3732.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  3733.         $part $sejour->getIdPartenaire();
  3734.         $nompart $part->getUsername();
  3735.         $logopart $part->getLogourl();
  3736.         return $this->render('Parent/Calendrier.html.twig', ["nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'like' => $listeattachlikephoto'cliparts' => $clipart'Album' => $Albumproduct'AllPages' => $AllPages'random' => $random]);
  3737.     }
  3738.     /**
  3739.      * @Route("Parent/ModificationPhotosRetros/{nbr}/{id}", name="EditionRetrofrompanier")
  3740.      */
  3741.     public function EditionRetroParentfrompanier($nbr$id)
  3742.     {
  3743.         $SEjourService $this->sejourService;
  3744.         /** @var \App\Entity\User $user */
  3745.         $user $this->getUser();
  3746.         $userId $user->getId();
  3747.         $user $this->getUser();
  3748.         $session $this->session;
  3749.         $session->set('pageMenu''');
  3750.         $idSejour $session->get("Sejour");
  3751.         $produitcondition $session->get("produit");
  3752.         $produit $session->get("produittype");
  3753.         $sejour $SEjourService->getsejourpourparent($idSejour);
  3754.         $em $this->em;
  3755.         $clipart $em->getRepository(Clipart::class)->findAll();
  3756.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  3757.         $listerandom $listeattachlikephoto;
  3758.         $nbLikes count($listeattachlikephoto);
  3759.         $AllPagesAcc null;
  3760.         $random false;
  3761.         $Albumproduct $em->getRepository(Produit::class)->findOneBy(['id' => $id]);
  3762.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  3763.         $idAcc $sejour->getIdAcommp();
  3764.         $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  3765.         $part $sejour->getIdPartenaire();
  3766.         $nompart $part->getUsername();
  3767.         $logopart $part->getLogourl();
  3768.         //Liste des photos public
  3769.         $listeattach $SEjourService->getatachmentsejour($idSejour);
  3770.         $nbPhoto =  $listeattach;
  3771.         if ($nbLikes == 0) {
  3772.             return $this->render('Parent/PhotosRetros.html.twig', ["nbr" => $nbr" nbPhoto" => $nbPhoto"nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'like' => $listeattach'cliparts' => $clipart'Album' => $Albumproduct'AllPages' => $AllPages'albumAcc' => $albumAcc'AllPagesAcc' => $AllPagesAcc'random' => $random'listeattach' => $listeattach'nbLikes' => $nbLikes]);
  3773.         }
  3774.         if ($nbLikes != 0) {
  3775.             return $this->render('Parent/PhotosRetrosLikes.html.twig', ["nbr" => $nbr" nbPhoto" => $nbPhoto"nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'like' => $listeattachlikephoto'cliparts' => $clipart'Album' => $Albumproduct'AllPages' => $AllPages'albumAcc' => $albumAcc'AllPagesAcc' => $AllPagesAcc'random' => $random'listeattach' => $listeattach'nbLikes' => $nbLikes]);
  3776.         }
  3777.     }
  3778.     //CommanderalbumSejour
  3779.     /**
  3780.      * @Route("/Parent/CommanderalbumSejour", name="CommanderalbumSejour")
  3781.      */
  3782.     public function CommanderalbumSejour(Request $request)
  3783.     {
  3784.         $session $this->session;
  3785.         $serviceuser $this->etablissementService;
  3786.         $page $request->get("pages");
  3787.         $sejour $request->get("sejour");
  3788.         $prodid $request->get('idProd');
  3789.         $nomprod $request->get('nomprod');
  3790.         $versionalbm $request->get('new');
  3791.         $user $this->getUser();
  3792.         $em $this->em;
  3793.         //  $AlbumSejour  = $em->getRepository(Produit::class)->findOneBy(array("id" =>$prodid));
  3794.         $produit $session->get("produittype");
  3795.         $produitcondi $session->get("produit");
  3796.         $Album $serviceuser->saveCopyalbumParent($page$user$sejour$prodid$produit$produitcondi$nomprod$versionalbm);
  3797.         $inser false;
  3798.         $session $this->session;
  3799.         $Products $session->get("Panier");
  3800.         $produit $this->em->getRepository(Produit::class)->find($Album->getId());
  3801.         $user $this->getUser();
  3802.         $typeref $em->getRepository(Typeref::class)->find(8);
  3803.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  3804.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  3805.         //fin
  3806.         if ($panierTrace == null) {
  3807.             $panierTrace = new Panier();
  3808.             $dateNow = new \Datetime();
  3809.             $panierTrace->setDateCreation($dateNow);
  3810.             $panierTrace->setCreerPar($user);
  3811.             $panierTrace->setStatut($statutPanier);
  3812.             $em->getManager()->persist($panierTrace);
  3813.             $em->getManager()->flush();
  3814.         }
  3815.         if ($Products == null) {
  3816.             $Products = [];
  3817.         }
  3818.         foreach ($Products as $key => $p) {
  3819.             if ($p['id'] == $produit->getId()) {
  3820.                 $inser true;
  3821.                 $Products[$key]['qte'] = $p['qte'] + 1;
  3822.                 $Products[$key]['mnt'] = $p['mnt'] + $produit->getIdConditionnement()->getMontantTTC();
  3823.             }
  3824.         }
  3825.         //Touhemi :Rechercher  si le produti existe déja ds panierProduit
  3826.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $Album"idPanier" => $panierTrace));
  3827.         if ($panierProduit == null) {
  3828.             $panierProduit = new PanierProduit();
  3829.             $panierProduit->setIdProduit($Album);
  3830.             $panierProduit->setIdPanier($panierTrace);
  3831.             $em->getManager()->persist($panierProduit);
  3832.             $em->getManager()->flush();
  3833.         }
  3834.         //fin
  3835.         //Touhemi ajouter plus un au produit et modifier prixTotal
  3836.         $oldQte $panierProduit->getQuantite();
  3837.         $newQte $oldQte 1;
  3838.         $panierProduit->setQuantite($newQte);
  3839.         $oldTotal $panierProduit->getPrixTotal();
  3840.         $newTotal $oldTotal $Album->getIdConditionnement()->getMontantTTC();
  3841.         $panierProduit->setPrixTotal($newTotal);
  3842.         $this->em->getManager()->persist($panierProduit);
  3843.         $this->em->getManager()->flush();
  3844.         //fin
  3845.         if ($inser === false) {
  3846.             //get nessaisire element
  3847.             $p = [];
  3848.             $p["id"] = $produit->getId();
  3849.             $p["nom"] = $produit->getType()->getLabeletype();
  3850.             $p["ident"] = $produit->getLabele();
  3851.             $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  3852.             $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  3853.             $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  3854.             $p["condition"] = $produit->getIdConditionnement()->getId();
  3855.             $p["qte"] = 1;
  3856.             array_push($Products$p);
  3857.         }
  3858.         $session->set('Panier'$Products);
  3859.         //sendemail_parent
  3860.         $dateNow = new \Datetime();
  3861.         /** @var \App\Entity\User $user */
  3862.         $user $this->getUser();
  3863.         $userEmail $user->getEmail();
  3864.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  3865.         //$this->EmailServie->MailRelancePanier($userEmail);
  3866.         //dd($etablissementDetail);
  3867.         return new response('done');
  3868.     }
  3869.     /**
  3870.      * @Route("/Parent/AlbummsavealbumcomandeParent", name="AlbummsavealbumcomandeParent")
  3871.      */
  3872.     public function Albummcomandesavealbum(Request $request)
  3873.     {
  3874.         $session $this->session;
  3875.         $serviceuser $this->etablissementService;
  3876.         $page $request->get("pages");
  3877.         $sejour $request->get("sejour");
  3878.         $prodid $request->get('idProd');
  3879.         $nomprod $request->get('nomprod');
  3880.         $versionalbm $request->get('new');
  3881.         $user $this->getUser();
  3882.         $produit $session->get("produittype");
  3883.         $produitcondi $session->get("produit");
  3884.         $Album $serviceuser->savealbumParent($page$user$sejour$prodid$produit$produitcondi$nomprod$versionalbm);
  3885.         $inser false;
  3886.         $session $this->session;
  3887.         $Products $session->get("Panier");
  3888.         $produit $this->em->getRepository(Produit::class)->find($Album->getId());
  3889.         $em $this->em;
  3890.         $user $this->getUser();
  3891.         $typeref $em->getRepository(Typeref::class)->find(8);
  3892.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  3893.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  3894.         //fin
  3895.         if ($panierTrace == null) {
  3896.             $panierTrace = new Panier();
  3897.             $dateNow = new \Datetime();
  3898.             $panierTrace->setDateCreation($dateNow);
  3899.             $panierTrace->setCreerPar($user);
  3900.             $panierTrace->setStatut($statutPanier);
  3901.             $em->getManager()->persist($panierTrace);
  3902.             $em->getManager()->flush();
  3903.         }
  3904.         if ($Products == null) {
  3905.             $Products = [];
  3906.         }
  3907.         foreach ($Products as $key => $p) {
  3908.             if ($p['id'] == $produit->getId()) {
  3909.                 $inser true;
  3910.                 $Products[$key]['qte'] = $p['qte'] + 1;
  3911.                 $Products[$key]['mnt'] = $p['mnt'] + $produit->getIdConditionnement()->getMontantTTC();
  3912.             }
  3913.         }
  3914.         //Touhemi :Rechercher  si le produti existe déja ds panierProduit
  3915.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $Album"idPanier" => $panierTrace));
  3916.         if ($panierProduit == null) {
  3917.             $panierProduit = new PanierProduit();
  3918.             $panierProduit->setIdProduit($Album);
  3919.             $panierProduit->setIdPanier($panierTrace);
  3920.             $em->getManager()->persist($panierProduit);
  3921.             $em->getManager()->flush();
  3922.         }
  3923.         //fin
  3924.         //Touhemi ajouter plus un au produit et modifier prixTotal
  3925.         $oldQte $panierProduit->getQuantite();
  3926.         $newQte $oldQte 1;
  3927.         $panierProduit->setQuantite($newQte);
  3928.         $oldTotal $panierProduit->getPrixTotal();
  3929.         $newTotal $oldTotal $Album->getIdConditionnement()->getMontantTTC();
  3930.         $panierProduit->setPrixTotal($newTotal);
  3931.         $this->em->getManager()->persist($panierProduit);
  3932.         $this->em->getManager()->flush();
  3933.         //fin
  3934.         if ($inser === false) {
  3935.             //get nessaisire element
  3936.             $p = [];
  3937.             $p["id"] = $produit->getId();
  3938.             $p["nom"] = $produit->getType()->getLabeletype();
  3939.             $p["ident"] = $produit->getLabele();
  3940.             $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  3941.             $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  3942.             $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  3943.             $p["condition"] = $produit->getIdConditionnement()->getId();
  3944.             $p["qte"] = 1;
  3945.             array_push($Products$p);
  3946.         }
  3947.         $session->set('Panier'$Products);
  3948.         //sendemail_parent
  3949.         $dateNow = new \Datetime();
  3950.         /** @var \App\Entity\User $user */
  3951.         $user $this->getUser();
  3952.         $userEmail $user->getEmail();
  3953.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  3954.         //$this->EmailServie->MailRelancePanier($userEmail);
  3955.         //dd($etablissementDetail);
  3956.         return new response('done');
  3957.     }
  3958.     /**
  3959.      * @Route("/Parent/saveLivrePhotosParentPanier", name="saveLivrePhotosParentPanier")
  3960.      */
  3961.     public function saveLivrePhotospuisPanier(Request $request)
  3962.     {
  3963.         $em $this->em;
  3964.         $session $this->session;
  3965.         $produittype $session->get("produit");
  3966.         $produit $session->get("produittype");
  3967.         $serviceuser $this->etablissementService;
  3968.         $page $request->get("pages");
  3969.         $sejour $request->get("sejour");
  3970.         $prodid $request->get('idProd');
  3971.         $nomprod $request->get('nomprod');
  3972.         $versionalbm $request->get('new');
  3973.         $user $this->getUser();
  3974.         $Album $serviceuser->savelivreParent($page$user$sejour$prodid$produittype$nomprod$versionalbm);
  3975.         //dd($etablissementDetail);
  3976.         $inser false;
  3977.         $session $this->session;
  3978.         $Products $session->get("Panier");
  3979.         $produit $em->getRepository(Produit::class)->find($Album->getId());
  3980.         //Touhemi  03-07-2020 :Rechercher  si l'utilisateur a déja un panier avec statut créer ds la bd , sinon on écrit un panier
  3981.         $user $this->getUser();
  3982.         $typeref $em->getRepository(Typeref::class)->find(8);
  3983.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  3984.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  3985.         //fin
  3986.         if ($panierTrace == null) {
  3987.             $panierTrace = new Panier();
  3988.             $dateNow = new \Datetime();
  3989.             $panierTrace->setDateCreation($dateNow);
  3990.             $panierTrace->setCreerPar($user);
  3991.             $panierTrace->setStatut($statutPanier);
  3992.             $em->getManager()->persist($panierTrace);
  3993.             $em->getManager()->flush();
  3994.         }
  3995.         //Touhemi 03-07-2020 :s'il y a un produit avec (id user,id sejour, type produit et type conditionement) dans le panier , sinon on écrit un produit
  3996.         if ($Products == null) {
  3997.             $Products = [];
  3998.         }
  3999.         foreach ($Products as $key => $p) {
  4000.             if ($p['id'] == $produit->getId()) {
  4001.                 $inser true;
  4002.                 $Products[$key]['qte'] = $p['qte'] + 1;
  4003.                 // $Products[$key]['mnt'] = $p['mnt'] + $produit->getType()->getTraif();
  4004.             }
  4005.         }
  4006.         //Touhemi 03-07-2020 :Rechercher  si le produti existe déja ds panierProduit
  4007.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  4008.         if ($panierProduit == null) {
  4009.             $panierProduit = new PanierProduit();
  4010.             $panierProduit->setIdProduit($produit);
  4011.             $panierProduit->setIdPanier($panierTrace);
  4012.             $em->getManager()->persist($panierProduit);
  4013.             $em->getManager()->flush();
  4014.         }
  4015.         //fin
  4016.         //   Touhemi 02-07-2020 ajouter plus un au produit et modifier prixTotal
  4017.         $oldQte $panierProduit->getQuantite();
  4018.         $newQte $oldQte 1;
  4019.         $panierProduit->setQuantite($newQte);
  4020.         $oldTotal $panierProduit->getPrixTotal();
  4021.         $newTotal $oldTotal $produit->getIdConditionnement()->getMontantTTC();
  4022.         $panierProduit->setPrixTotal($newTotal);
  4023.         $em->getManager()->persist($panierProduit);
  4024.         $em->getManager()->flush();
  4025.         //fin
  4026.         if ($inser === false) {
  4027.             //get nessaisire element
  4028.             $p = [];
  4029.             $p["id"] = $produit->getId();
  4030.             $p["nom"] = $produit->getType()->getLabeletype();
  4031.             $p["ident"] = $produit->getLabele();
  4032.             $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  4033.             $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  4034.             $p["condition"] = $produit->getIdConditionnement()->getId();
  4035.             $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  4036.             $p["qte"] = 1;
  4037.             array_push($Products$p);
  4038.         }
  4039.         $session->set('Panier'$Products);
  4040.         //sendmail_patrent
  4041.         $dateNow = new \Datetime();
  4042.         /** @var \App\Entity\User $user */
  4043.         $user $this->getUser();
  4044.         $userEmail $user->getEmail();
  4045.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  4046.         // $this->EmailServie->MailRelancePanier($userEmail);
  4047.         return new response('done');
  4048.     }
  4049.     /**
  4050.      * @Route("parent/condcnx", name="connexionparentsejour",methods={"POST"})
  4051.      */
  4052.     public function condition(Request $request)
  4053.     {
  4054.         $UserService $this->userService;
  4055.         $id $request->get('id');
  4056.         $ParentSejour $UserService->conditioncnxparent($id);
  4057.         return new JsonResponse('done');
  4058.     }
  4059.     /**
  4060.      * @Route("/Parent/MaPropresPhotos", name="MaPropresPhotos")
  4061.      */
  4062.     public function MaPropresPhotos(Request $request)
  4063.     {
  4064.         $path $request->get("path");
  4065.         $type $request->get("type");
  4066.         $sejId $request->get("id");
  4067.         $dateSejour $request->get("date");
  4068.         $SejourServiceattachh $this->sejourService;
  4069.         $Userservicemail $this->userService;
  4070.         $sejourfind $SejourServiceattachh->sejoursansattach($sejId);
  4071.         //$sendmail = $Userservicemail->sendmailuserforfirstattach($sejId);
  4072.         $attachementservice $this->attachementService;
  4073.         foreach ($path as $key => $path) {
  4074.             $src $path['path'];
  4075.             $attachement $attachementservice->creationAttachementS($src$type$dateSejour);
  4076.             $sejourservice $this->sejourService;
  4077.             $sejAttach $sejourservice->monpropreattachement($sejId$attachement$this->getUser());
  4078.             if ((array_key_exists("latitude"$path)) && ($path['latitude'] != null)) {
  4079.                 $lat $path['latitude'];
  4080.                 $lng $path['longitude'];
  4081.                 $Cartervice $this->carteService;
  4082.                 $position $Cartervice->create_newPositionImage($this->getUser(), $lat$lng);
  4083.                 $Cartervice->affecterPosition($attachement$position);
  4084.                 $FindSejour $this->em->getRepository(Sejour::class)->find($sejId);
  4085.                 $FindSejour->setEtatAdresseCarte(true);
  4086.                 $this->em->getManager()->persist($FindSejour);
  4087.                 $this->em->getManager()->flush();
  4088.             }
  4089.             //Ajouter les photos aux favoris
  4090.             $Like $this->photosFavorisService;
  4091.             $Like->AddFavoris($this->getUser(), $attachement$sejId);
  4092.         }
  4093.         return new JsonResponse(["id" => $attachement->getId()]);;
  4094.     }
  4095.     /**
  4096.      * @Route("/Parent/Ajouter_photo_sejour", name="pathadddnewphotos")
  4097.      */
  4098.     public function pathaddnewphotos()
  4099.     {
  4100.         /** @var \App\Entity\User $user */
  4101.         $user $this->getUser();
  4102.         $userId $user->getId();
  4103.         $session $this->session;
  4104.         $idParent $session->get("Sejour");
  4105.         $idSejour $session->get("Sejour");
  4106.         $conxparent $this->sejourService;
  4107.         $sejour1 $conxparent->sejourParentcnx($idSejour$idParent);
  4108.         //dd($sejour1);
  4109.         $SEjourService $this->sejourService;
  4110.         $sejour $SEjourService->getsejour($idSejour);
  4111.         //  dd($sejour);
  4112.         //Liste des photos public
  4113.         $listeattach $SEjourService->getatachmentsejour($idSejour);
  4114.         //Liste des photos privé
  4115.         //        $listeattachPrivate = $SEjourService->getatachmentsejourparent($idSejour, $this->getUser()->getId());
  4116.         //        $AllPhotosParent = array_merge_recursive($listeattach, $listeattachPrivate);
  4117.         $listeVideo $SEjourService->getVideosejour($idSejour);
  4118.         $AllAttachements array_merge_recursive($listeattach$listeVideo);
  4119.         $nbImages count($listeattach);
  4120.         $positions $SEjourService->getsejourposition($idSejour);
  4121.         $messages $SEjourService->getsejourmessage($idSejour);
  4122.         $em $this->em;
  4123.         $parentsejour $SEjourService->getparentsejour($userId$idSejour);
  4124.         //dd($parentsejour);
  4125.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  4126.         $produits $this->typeProduiteService;
  4127.         $liste $produits->produitlistTypeConditionnement();
  4128.         $pubProd $user->getShowpubprod();
  4129.         $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  4130.         if ($albumAcc == null) {
  4131.             $albumAcc $em->getRepository(Produit::class)->findOneBy(['iduser' => 1'statut' => "Album_sejour"'idsjour' => $sejour]);
  4132.         }
  4133.         return $this->render('Parent/DetailsSejour.html.twig', [
  4134.             "sejour" => $sejour,
  4135.             'listeattach' => $AllAttachements,
  4136.             'nbImages' => $nbImages,
  4137.             'albumAcc' => $albumAcc,
  4138.             'positions' => $positions,
  4139.             'messages' => $messages,
  4140.             'like' => $listeattachlikephoto,
  4141.             "parentsejour" => $parentsejour,
  4142.             'prod' => $liste,
  4143.             'smsnotif' => $parentsejour->getSmsnotif(),
  4144.             'showpub' => $pubProd
  4145.         ]);
  4146.     }
  4147.     /**
  4148.      * @Route("/Parent/ajouterauPanier_Parent_coffret", name="comandercoffre")
  4149.      */
  4150.     public function Ajouter_MonPanier_Coffret()
  4151.     {
  4152.         $em $this->em;
  4153.         $inser false;
  4154.         $session $this->session;
  4155.         $idSejour $session->get("Sejour");
  4156.         $userId $this->getUser();
  4157.         /** @var \App\Entity\User $user */
  4158.         $user $this->getUser();
  4159.         $userIdCom $user->getId();
  4160.         $sejourobj $this->em->getRepository(Sejour::class)->find($idSejour);
  4161.         $prodct $this->em->getRepository(Typeproduit::class)->find(15);
  4162.         $version $this->em->getRepository(Produit::class)->SearchVersionproduit($userIdCom);
  4163.         $Conditionnement $this->em->getRepository(TypeProduitConditionnement::class)->find(6);
  4164.         $Products $session->get("Panier");
  4165.         //Touhemi  03-07-2020 :Rechercher  si l'utilisateur a déja un panier avec statut créer ds la bd , sinon on écrit un panier
  4166.         $user $this->getUser();
  4167.         $typeref $em->getRepository(Typeref::class)->find(8);
  4168.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  4169.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  4170.         //fin
  4171.         if ($panierTrace == null) {
  4172.             $panierTrace = new Panier();
  4173.             $dateNow = new \Datetime();
  4174.             $panierTrace->setDateCreation($dateNow);
  4175.             $panierTrace->setCreerPar($user);
  4176.             $panierTrace->setStatut($statutPanier);
  4177.             $em->getManager()->persist($panierTrace);
  4178.             $em->getManager()->flush();
  4179.         }
  4180.         //Touhemi 02-07-2020 :s'il y a un produit avec (id user,id sejour, type produit et type conditionement) dans le panier , sinon on écrit un produit
  4181.         $produit $em->getRepository(Produit::class)->findOneBy(array("type" => $prodct'idConditionnement' => $Conditionnement'idsjour' => $sejourobj'iduser' => $user));
  4182.         if ($produit == null) {
  4183.             $produit = new Produit;
  4184.             $produit->setLabele("Coffret cadeau");
  4185.             $produit->setIduser($userId);
  4186.             $produit->setIdsjour($sejourobj);
  4187.             $produit->setDate(new \DateTime());
  4188.             $produit->setIdConditionnement($Conditionnement);
  4189.             $produit->setType($prodct);
  4190.             $em->getManager()->persist($produit);
  4191.             $em->getManager()->flush();
  4192.         }
  4193.         if ($Products == null) {
  4194.             $Products = [];
  4195.         }
  4196.         foreach ($Products as $key => $p) {
  4197.             if ($p['id'] == $produit->getId()) {
  4198.                 $inser true;
  4199.                 $Products[$key]['qte'] = $p['qte'] + 1;
  4200.                 // $Products[$key]['mnt'] = $p['mnt'] + $produit->getType()->getTraif();
  4201.             }
  4202.         }
  4203.         //Touhemi 03-07-2020 :Rechercher  si le produti existe déja ds panierProduit
  4204.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  4205.         if ($panierProduit == null) {
  4206.             $panierProduit = new PanierProduit();
  4207.             $panierProduit->setIdProduit($produit);
  4208.             $panierProduit->setIdPanier($panierTrace);
  4209.             $em->getManager()->persist($panierProduit);
  4210.             $em->getManager()->flush();
  4211.         }
  4212.         //fin
  4213.         //   Touhemi 03-07-2020 ajouter plus un au produit et modifier prixTotal
  4214.         $oldQte $panierProduit->getQuantite();
  4215.         $newQte $oldQte 1;
  4216.         $panierProduit->setQuantite($newQte);
  4217.         $oldTotal $panierProduit->getPrixTotal();
  4218.         $newTotal $oldTotal $produit->getIdConditionnement()->getMontantTTC();
  4219.         $panierProduit->setPrixTotal($newTotal);
  4220.         $em->getManager()->persist($panierProduit);
  4221.         $em->getManager()->flush();
  4222.         //fin
  4223.         if ($inser === false) {
  4224.             //get nessaisire element
  4225.             $p = [];
  4226.             $p["id"] = $produit->getId();
  4227.             $p["nom"] = $produit->getType()->getLabeletype();
  4228.             $p["ident"] = $produit->getLabele();
  4229.             $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  4230.             $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  4231.             $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  4232.             $p["condition"] = $produit->getIdConditionnement()->getId();
  4233.             $p["qte"] = 1;
  4234.             array_push($Products$p);
  4235.         }
  4236.         //sendmailproduct_parent
  4237.         $dateNow = new \Datetime();
  4238.         /** @var \App\Entity\User $user */
  4239.         $user $this->getUser();
  4240.         $userEmail $user->getEmail();
  4241.         $userId $user->getId();
  4242.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  4243.         //$this->EmailServie->MailRelancePanier($userEmail);
  4244.         $listeproduit $prod $this->em->getRepository(Produit::class)->findby(array('iduser' => $userId));
  4245.         $session->set('Panier'$Products);
  4246.         $Panier $session->get("Panier");
  4247.         $produit $this->typeProduiteService;
  4248.         $produitlist $produit->produitlistTypeConditionnement();
  4249.         $this->session->set('rout''rout');
  4250.         $parentent_sejour $this->em->getRepository(ParentSejour::class)->findOneBy(["idParent" => $this->getUser(), "idSejour" => $sejourobj]);
  4251.         $prodpanier = array();
  4252.         $nbrprodpromo 0;
  4253.         $nbralbum 0;
  4254.         $nbrlivre 0;
  4255.         $nbrphoto12 0;
  4256.         $nbrphoto24 0;
  4257.         $nbrphoto36 0;
  4258.         $nbrcal 0;
  4259.         $nbrretro12 0;
  4260.         $nbrretro24 0;
  4261.         $nbrretro36 0;
  4262.         $detailsprod = array();
  4263.         $prixalbum 0.0;
  4264.         $prixphoto12 0.0;
  4265.         $prixphoto24 0.0;
  4266.         $prixphoto36 0.0;
  4267.         $prixcal 0.0;
  4268.         $prixalbum 0.0;
  4269.         $prixretro12 0.0;
  4270.         $prixretro24 0.0;
  4271.         $prixretro36 0.0;
  4272.         $prodpanierpromo = array();
  4273.         $promo = array();
  4274.         foreach ($Panier as $key => $p) {
  4275.             if ($p['condition'] != null) {
  4276.                 array_push($prodpanier$p['condition']);
  4277.             }
  4278.             if ($p['condition'] != 11 && $p['condition'] != 6) {
  4279.                 $promo['condition'] = $p['condition'];
  4280.                 $nbrprodpromo $nbrprodpromo $p['qte'];
  4281.                 array_push($prodpanierpromo$promo);
  4282.                 if ($p['condition'] == 4) {
  4283.                     $nbralbum $nbralbum $p['qte'];
  4284.                     $prixalbum $p['mnt'];
  4285.                 } elseif ($p['condition'] == 1) {
  4286.                     $nbrphoto12 $nbrphoto12 $p['qte'];
  4287.                     $prixphoto12 $p['mnt'];
  4288.                 } elseif ($p['condition'] == 2) {
  4289.                     $nbrphoto24 $nbrphoto24 $p['qte'];
  4290.                     $prixphoto24 $p['mnt'];
  4291.                 } elseif ($p['condition'] == 3) {
  4292.                     $nbrphoto36 $nbrphoto36 $p['qte'];
  4293.                     $prixphoto36  $p['mnt'];
  4294.                 } elseif ($p['condition'] == 5) {
  4295.                     $nbrlivre $nbrlivre $p['qte'];
  4296.                     $prixlivre $p['mnt'];
  4297.                 } elseif ($p['condition'] == 7) {
  4298.                     $nbrcal $nbrcal $p['qte'];
  4299.                     $prixcal $p['mnt'];
  4300.                 } elseif ($p['condition'] == 8) {
  4301.                     $nbrretro36 $nbrretro36 $p['qte'];
  4302.                     $prixretro36 $p['mnt'];
  4303.                 } elseif ($p['condition'] == 9) {
  4304.                     $nbrretro12 $nbrretro12 $p['qte'];
  4305.                     $prixretro12 $p['mnt'];
  4306.                 } elseif ($p['condition'] == 10) {
  4307.                     $nbrretro24 $nbrretro24 $p['qte'];
  4308.                     $prixretro24 $p['mnt'];
  4309.                 }
  4310.             }
  4311.         }
  4312.         $detailsprod['album']['qt'] = $nbralbum;
  4313.         $detailsprod['album']['prix'] = $prixalbum;
  4314.         $detailsprod['photo12']['qt'] = $nbrphoto12;
  4315.         $detailsprod['photo12']['prix'] = $prixphoto12;
  4316.         $detailsprod['photo24']['qt'] = $nbrphoto24;
  4317.         $detailsprod['photo24']['prix'] = $prixphoto24;
  4318.         $detailsprod['photo36']['qt'] = $nbrphoto36;
  4319.         $detailsprod['photo36']['prix'] = $prixphoto36;
  4320.         $detailsprod['cal']['qt'] = $nbrcal;
  4321.         $detailsprod['cal']['prix'] = $prixcal;
  4322.         $detailsprod['livre']['qt'] = $nbrlivre;
  4323.         $detailsprod['livre']['prix'] = $prixalbum;
  4324.         $detailsprod['retro12']['qt'] = $nbrretro12;
  4325.         $detailsprod['retro12']['prix'] = $prixretro12;
  4326.         $detailsprod['retro24']['qt'] = $nbrretro24;
  4327.         $detailsprod['retro24']['prix'] = $prixretro24;
  4328.         $detailsprod['retro36']['qt'] = $nbrretro36;
  4329.         $detailsprod['retro36']['prix'] = $prixretro36;
  4330.         return $this->render('Parent/monpanier.html.twig', ['detailsprod' => $detailsprod'nbrprodpromo' => $nbrprodpromo'prodpanierpromo' => $prodpanierpromo'prodpanier' => $prodpanier"parentent_sejour" => $parentent_sejour"sejour" => $sejourobj'user' => $this->getUser(), 'Sejour' => $idSejour'listeproduit' => $listeproduit'Panier' => $Panier'produitlist' => $produitlist]);
  4331.     }
  4332.     /**
  4333.      * @Route("/Parent/Boite_vocale", name="Boite_vocale")
  4334.      */
  4335.     public function Boite_Vocale()
  4336.     {
  4337.         /** @var \App\Entity\User $user */
  4338.         $user $this->getUser();
  4339.         $userId $user->getId();
  4340.         $session $this->session;
  4341.         $session->set('pageMenu''BoiteVocale');
  4342.         $idSejour $session->get("Sejour");
  4343.         $SEjourService $this->sejourService;
  4344.         $sejour $SEjourService->getsejour($idSejour);
  4345.         /*         $listeattach = $SEjourService->getatachmentsejour($idSejour);
  4346.         $listeVideo = $SEjourService->getVideosejour($idSejour);
  4347.         $AllAttachements = array_merge_recursive($listeattach, $listeVideo); */
  4348.         $AllAttachements $SEjourService->getCombinedattachSejour($idSejour'photoVideo');
  4349.         $attachementsCount $AllAttachements['total'];
  4350.         unset($AllAttachements['total']);
  4351.         $nbImages count($AllAttachements);
  4352.         $positions $SEjourService->getsejourposition($idSejour);
  4353.         $messages $SEjourService->getsejourmessage($idSejour);
  4354.         $parentsejour $SEjourService->getparentsejour($userId$idSejour);
  4355.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  4356.         // test if sejour est vide ou non 
  4357.         if (sizeof($sejour->getAttachements()) == 0) {
  4358.             $this->session->set('rout''rout');
  4359.             return $this->render('Parent/Aucunphoto.html.twig', [
  4360.                 "sejour" => $sejour,
  4361.                 "parentsejour" => $parentsejour
  4362.             ]);
  4363.         }
  4364.         if ($sejour->getPaym() == 1) {
  4365.             //findlinge
  4366.             $ParentSejour $this->em->getRepository(ParentSejour::class)->findOneBy(["idSejour" => $idSejour"idParent" => $user]);
  4367.             if ($ParentSejour->getPayment() == 0) {
  4368.                 $this->session->set('rout''rout');
  4369.                 $ses_id session_id();
  4370.                 return $this->render('Parent/achatsejour.html.twig', ["sejour" => $sejour'images' => $AllAttachements"session_id" => $ses_id'ParentSejour' => $ParentSejour]);
  4371.             }
  4372.             if ($ParentSejour->getPayment() == 1) {
  4373.                 $produits $this->typeProduiteService;
  4374.                 $liste $produits->produitlistTypeConditionnement();
  4375.                 $em $this->em;
  4376.                 $idAcc $sejour->getIdAcommp();
  4377.                 $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  4378.                 $pubProd $user->getShowpubprod();
  4379.                 $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  4380.                 if ($albumAcc == null) {
  4381.                     $albumAcc $em->getRepository(Produit::class)->findOneBy(['iduser' => 1'statut' => "Album_sejour"'idsjour' => $sejour]);
  4382.                 }
  4383.                 return $this->render('Parent/DetailsSejour.html.twig', [
  4384.                     "sejour" => $sejour,
  4385.                     'albumAcc' => $albumAcc,
  4386.                     'listeattach' => $AllAttachements,
  4387.                     'prod' => $liste,
  4388.                     'nbImages' => $nbImages,
  4389.                     'attachementsCount' => $attachementsCount,
  4390.                     'positions' => $positions,
  4391.                     'messages' => $messages,
  4392.                     'albumAcc' => $albumAcc,
  4393.                     'like' => $listeattachlikephoto,
  4394.                     "parentsejour" => $parentsejour,
  4395.                     'smsnotif' => $parentsejour->getSmsnotif(),
  4396.                     'showpub' => $pubProd
  4397.                 ]);
  4398.             }
  4399.         }
  4400.         $produits $this->typeProduiteService;
  4401.         $liste $produits->produitlistTypeConditionnement();
  4402.         $pubProd $user->getShowpubprod();
  4403.         $em $this->em;
  4404.         $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  4405.         if ($albumAcc == null) {
  4406.             $albumAcc $em->getRepository(Produit::class)->findOneBy(['iduser' => 1'statut' => "Album_sejour"'idsjour' => $sejour]);
  4407.         }
  4408.         return $this->render('Parent/DetailsSejour.html.twig', [
  4409.             "sejour" => $sejour,
  4410.             'albumAcc' => $albumAcc,
  4411.             'prod' => $liste,
  4412.             'listeattach' => $AllAttachements,
  4413.             'nbImages' => $nbImages,
  4414.             'attachementsCount' => $attachementsCount,
  4415.             'positions' => $positions,
  4416.             'messages' => $messages,
  4417.             'like' => $listeattachlikephoto,
  4418.             "parentsejour" => $parentsejour,
  4419.             'smsnotif' => $parentsejour->getSmsnotif(),
  4420.             'showpub' => $pubProd
  4421.         ]);
  4422.     }
  4423.     /**
  4424.      * @Route("/Parent/Mon_Sejour_parent", name="Mon_Sejour_parent")
  4425.      */
  4426.     public function Mon_Sejour_parent()
  4427.     {
  4428.         /** @var \App\Entity\User $user */
  4429.         $user $this->getUser();
  4430.         $userId $user->getId();
  4431.         $session $this->session;
  4432.         // $idParent=$this->getUser()->getId();
  4433.         $idSejour $session->get("Sejour");
  4434.         $session->set('pageMenu''Monsejour');
  4435.         $conxparent $this->sejourService;
  4436.         //$sejour1 = $conxparent->sejourParentcnx($idSejour,$idParent);
  4437.         //
  4438.         $SEjourService $this->sejourService;
  4439.         $sejour $SEjourService->getsejour($idSejour);
  4440.         $listeattach $SEjourService->getatachmentsejour($idSejour);
  4441.         //Liste des photos privé
  4442.         //        $listeattachPrivate = $SEjourService->getatachmentsejourparent($idSejour, $this->getUser()->getId());
  4443.         //        $AllPhotosParent = array_merge_recursive($listeattach, $listeattachPrivate);
  4444.         $listeVideo $SEjourService->getVideosejour($idSejour);
  4445.         $AllAttachements array_merge_recursive($listeattach$listeVideo);
  4446.         $nbImages count($listeattach);
  4447.         $positions $SEjourService->getsejourposition($idSejour);
  4448.         $messages $SEjourService->getsejourmessage($idSejour);
  4449.         $parentsejour $SEjourService->getparentsejour($userId$idSejour);
  4450.         //dd($parentsejour);
  4451.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  4452.         // test if sejour est vide ou non 
  4453.         if (sizeof($sejour->getAttachements()) == 0) {
  4454.             $this->session->set('rout''rout');
  4455.             return $this->render('Parent/Aucunphoto.html.twig', [
  4456.                 "sejour" => $sejour,
  4457.                 "parentsejour" => $parentsejour
  4458.             ]);
  4459.         }
  4460.         if ($sejour->getPaym() == 1) {
  4461.             /** @var \App\Entity\User $user */
  4462.             $user $this->getUser();
  4463.             $userid $user->getId();
  4464.             //findlinge
  4465.             $ParentSejour $this->em->getRepository(ParentSejour::class)->findOneBy(["idSejour" => $idSejour"idParent" => $userid]);
  4466.             if ($ParentSejour->getPayment() == 0) {
  4467.                 $this->session->set('rout''rout');
  4468.                 $ses_id session_id();
  4469.                 return $this->render('Parent/achatsejour.html.twig', ["sejour" => $sejour'images' => $listeattach"session_id" => $ses_id'ParentSejour' => $ParentSejour]);
  4470.             }
  4471.             if ($ParentSejour->getPayment() == 1) {
  4472.                 $produits $this->typeProduiteService;
  4473.                 $liste $produits->produitlistTypeConditionnement();
  4474.                 $pubProd $user->getShowpubprod();
  4475.                 return $this->render('Parent/DetailsSejour.html.twig', [
  4476.                     "sejour" => $sejour,
  4477.                     'listeattach' => $AllAttachements,
  4478.                     'prod' => $liste,
  4479.                     'nbImages' => $nbImages,
  4480.                     'positions' => $positions,
  4481.                     'messages' => $messages,
  4482.                     'like' => $listeattachlikephoto,
  4483.                     "parentsejour" => $parentsejour,
  4484.                     'smsnotif' => $parentsejour->getSmsnotif()
  4485.                 ]);
  4486.             }
  4487.         }
  4488.         //  dd($sejour);
  4489.         //Liste des photos public
  4490.         $produits $this->typeProduiteService;
  4491.         $liste $produits->produitlistTypeConditionnement();
  4492.         $pubProd $user->getShowpubprod();
  4493.         return $this->render('Parent/DetailsSejour.html.twig', [
  4494.             "sejour" => $sejour,
  4495.             'prod' => $liste,
  4496.             'listeattach' => $AllAttachements,
  4497.             'nbImages' => $nbImages,
  4498.             'positions' => $positions,
  4499.             'messages' => $messages,
  4500.             'like' => $listeattachlikephoto,
  4501.             "parentsejour" => $parentsejour,
  4502.             'smsnotif' => $parentsejour->getSmsnotif(),
  4503.             'showpub' => $pubProd
  4504.         ]);
  4505.     }
  4506.     /**
  4507.      * @Route("/Parent/Besoindaide", name="Besoindaide_Parent")
  4508.      */
  4509.     public function Besoindaide(): Response
  4510.     {
  4511.         $produit $this->typeProduiteService;
  4512.         $liste $produit->produitlistType();
  4513.         // dd($liste);
  4514.         return $this->render('Parent/footer/Besoindaide.html.twig', [
  4515.             'produit' => $liste,
  4516.         ]);
  4517.     }
  4518.     /**
  4519.      * @Route("/Parent/Besoindaide_5sur5", name="Besoindaide_5sur5")
  4520.      */
  4521.     public function Besoindaide_5sur5(): Response
  4522.     {
  4523.         $produit $this->typeProduiteService;
  4524.         $liste $produit->produitlistType();
  4525.         // dd($liste);
  4526.         $session $this->session;
  4527.         $idSejour $session->get("Sejour");
  4528.         $sejour null;
  4529.         if ($idSejour != null) {
  4530.             $sejour $this->em->getRepository(Sejour::class)->find($idSejour);
  4531.         }
  4532.         return $this->render('Parent/footer/5sur5Help.html.twig', [
  4533.             'produit' => $liste,
  4534.             'sejour' => $sejour
  4535.         ]);
  4536.     }
  4537.     /**
  4538.      * @Route("/Parent/Mentionlegale", name="Mentionlegale_Parent")
  4539.      */
  4540.     public function MentionlegaleParent()
  4541.     {
  4542.         return $this->render('Parent/footer/mentionlegal.html.twig', []);
  4543.     }
  4544.     /**
  4545.      * @Route("/Parent/Conditongeneral", name="Conditongeneral_Parent")
  4546.      */
  4547.     public function ConditongeneralParent()
  4548.     {
  4549.         return $this->render('Parent/footer/Condition.html.twig', []);
  4550.     }
  4551.     /**
  4552.      * @Route("/Parent/Politique", name="Politique_Parent")
  4553.      */
  4554.     public function PolitiqueParent()
  4555.     {
  4556.         return $this->render('Parent/footer/politique.html.twig', []);
  4557.     }
  4558.     /**
  4559.      * @Route("/Parent/Commande_groupee", name="Commande_groupee")
  4560.      * */
  4561.     public function  Commande_groupee()
  4562.     {
  4563.         $produit $this->typeProduiteService;
  4564.         $liste $produit->produitlistType();
  4565.         // dd($liste);
  4566.         return $this->render('Parent/footer/GroupeeCommande.html.twig', [
  4567.             'showArt' => 'ALL',
  4568.             'produit' => $liste
  4569.         ]);
  4570.     }
  4571.     /**
  4572.      * @Route("/Parent/partenaires", name="nosPartenaires")
  4573.      * */
  4574.     public function nosPartenaires()
  4575.     {
  4576.         return $this->render('Parent/footer/Partenaires.html.twig');
  4577.     }
  4578.     /**
  4579.      * @Route("/Parent/produits5sur5", name="produits5sur5")
  4580.      * */
  4581.     public function produits5sur5()
  4582.     {
  4583.         $produit $this->typeProduiteService;
  4584.         $liste $produit->produitlistType();
  4585.         // dd($liste);
  4586.         return $this->render('Parent/produitscinqsurcinq.html.twig', [
  4587.             'showArt' => 'ALL',
  4588.             'produit' => $liste
  4589.         ]);
  4590.     }
  4591.     /**
  4592.      * @Route("/Parent/Nous_Connaitre_5sur5", name="NousConnaitre")
  4593.      * */
  4594.     public function Nous_Connaitre_5sur5()
  4595.     {
  4596.         $produit $this->typeProduiteService;
  4597.         $liste $produit->produitlistType();
  4598.         // dd($liste);
  4599.         return $this->render('Parent/footer/5sur5.html.twig', [
  4600.             'produit' => $liste,
  4601.         ]);
  4602.     }
  4603.     /**
  4604.      * @Route("/Parent/ServiceClient", name="ServiceClient_Parent")
  4605.      * */
  4606.     public function ServiceClient()
  4607.     {
  4608.         $produit $this->typeProduiteService;
  4609.         $liste $produit->produitlistType();
  4610.         // dd($liste);
  4611.         return $this->render('Parent/footer/ServiceClient.html.twig', [
  4612.             'produit' => $liste,
  4613.         ]);
  4614.     }
  4615.     /**
  4616.      * @Route("/Parent/delateSession_parents", name="delateSession_parent")
  4617.      * */
  4618.     public function delateSession_parents()
  4619.     {
  4620.         $session $this->session;
  4621.         $em $this->em;
  4622.         $Products = [];
  4623.         if ($session->get("paymentmoniteco") == "succses") {
  4624.             $Products = [];
  4625.             $session->set('Panier'$Products);
  4626.             $user $this->getUser();
  4627.             $typeref $em->getRepository(Typeref::class)->find(8);
  4628.             $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  4629.             $payer $em->getRepository(Ref::class)->findOneBy(array("libiller" => "payer""typeref" => $typeref));
  4630.             $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  4631.             if ($panierTrace) {
  4632.                 $panierTrace->setStatut($payer);
  4633.                 $em->getManager()->persist($panierTrace);
  4634.                 $em->getManager()->flush();
  4635.             }
  4636.         }
  4637.         $this->session->remove('paymentmoniteco');
  4638.         $this->session->remove('montanttotalcomande');
  4639.         $this->session->remove('Panierlength');
  4640.         $this->session->remove('envoipost');
  4641.         return new Response('done');
  4642.     }
  4643.     /**
  4644.      * @Route("/Parent/chargement_form_conn_up2pay", name="chargement_form_conn_up2pay")
  4645.      */
  4646.     function chargeFormup2payAction(Request $request)
  4647.     {
  4648.         $session $this->session;
  4649.         $em $this->container->get('doctrine')->getManager();
  4650.         $idSejour $session->get("Sejour");
  4651.         /** @var \App\Entity\User $user */
  4652.         $user $this->getUser();
  4653.         $user $user->getId();
  4654.         $comande $this->em->getRepository(ParentSejour::class)->findOneBy(["idSejour" => $idSejour"idParent" => $user]);
  4655.         $firstName $comande->getIdParent()->getNom();
  4656.         if ($firstName == null || $firstName == '') {
  4657.             $firstName "john";
  4658.         }
  4659.         $lastName $comande->getIdParent()->getPrenom();
  4660.         if ($lastName == null || $lastName == '') {
  4661.             $lastName "Doe";
  4662.         }
  4663.         $addressLine1 "3 rue de l'église";
  4664.         $city "Ostheim";
  4665.         $postalCode "68150";
  4666.         $pbx_site '6062073';                              //variable de test 9999999
  4667.         $pbx_rang '001';                                    //variable de test 95
  4668.         $pbx_identifiant '38027616';                      //variable de test 123456789
  4669.         $pbx_cmd 'REFCN' $comande->getId();
  4670.         $pbx_effectue $this->generateUrl("moneticoAcceptUrl_parentcnxx", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  4671.         $pbx_annule $this->generateUrl("moneticoExceptionUrl_parentcnxx", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  4672.         $pbx_refuse $this->generateUrl("moneticoExceptionUrl_parentcnxx", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  4673.         // Paramétrage de l'url de retour back office site (notification de paiement IPN) :
  4674.         $pbx_repondre_a "";
  4675.         //$pbx_repondre_a = $this->generateUrl("moneticoAcceptUrl_parentcnxx", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  4676.         $mail  $comande->getIdParent()->getEmail();
  4677.         $pbx_porteur $mail;                    //variable de test test@test.fr
  4678.         // Paramétrage des données retournées via l'IPN :
  4679.         $pbx_retour 'Mt:M;Ref:R;Auto:A;Erreur:E';
  4680.         // On récupére la date au format ISO-8601 :
  4681.         $dateTime date("c");
  4682.         //$montant = $comande->getMontantrth() . "EUR";
  4683.         $pbx_total $comande->getIdSejour()->getPrixcnxparent();
  4684.         $pbx_total = (int)((string)($pbx_total 100));
  4685.         // Suppression des points ou virgules dans le montant                        
  4686.         $pbx_total str_replace(","""$pbx_total);
  4687.         $pbx_total str_replace("."""$pbx_total);
  4688.         // Nombre de produit envoyé dans PBX_SHOPPINGCART :
  4689.         $pbx_nb_produit '1';                                    //variable de test 5
  4690.         // Construction de PBX_SHOPPINGCART :
  4691.         $pbx_shoppingcart "<?xml version=\"1.0\" encoding=\"utf-8\"?><shoppingcart><total><totalQuantity>" $pbx_nb_produit "</totalQuantity></total></shoppingcart>";
  4692.         // Choix de l'authentification dans PBX_SOUHAITAUTHENT
  4693.         $pbx_souhaitauthent '01';        //variable de test authentification 3DS (1 par défaut, 2 pour exemption 3DS)
  4694.         // Valeurs envoyes dans PBX_BILLING :
  4695.         $pbx_prenom_fact $firstName;                                                             //variable de test Jean-Marie
  4696.         $pbx_nom_fact $lastName;                                                                 //variable de test Thomson
  4697.         $pbx_adresse1_fact $addressLine1;                                                         //variable de test 1 rue de Paris
  4698.         $pbx_adresse2_fact '';                                                                 //variable de test <vide>
  4699.         $pbx_zipcode_fact $postalCode;                                                         //variable de test 75001
  4700.         $pbx_city_fact $city;                                     //variable de test Paris
  4701.         $pbx_country_fact '250';        //variable de test 250 (pour la France)
  4702.         // Construction de PBX_BILLING :
  4703.         $pbx_billing "<?xml version=\"1.0\" encoding=\"utf-8\"?><Billing><Address><FirstName>" $pbx_prenom_fact "</FirstName>" .
  4704.             "<LastName>" $pbx_nom_fact "</LastName><Address1>" $pbx_adresse1_fact "</Address1>" .
  4705.             "<Address2>" $pbx_adresse2_fact "</Address2><ZipCode>" $pbx_zipcode_fact "</ZipCode>" .
  4706.             "<City>" $pbx_city_fact "</City><CountryCode>" $pbx_country_fact "</CountryCode>" .
  4707.             "</Address></Billing>";
  4708.         // Recette (paiements de test)  :
  4709.         //$urletrans ="https://recette-tpeweb.e-transactions.fr/php/";
  4710.         // Production (paiements réels) :
  4711.         // URL principale :
  4712.         $urletrans "https://tpeweb.e-transactions.fr/php/";
  4713.         // URL secondaire :
  4714.         // $urletrans ="https://tpeweb1.e-transactions.fr/php/";
  4715.         // $hmackey = 'A5FD6D11DA2B9C4112201B4D797EC2B32B877C09A0CF56CE8007D91ACBA9A6D9E026149A7E8441D39A9F52C61E0D250ACC6DEC6815EA02621AEE525576CF4DAE';
  4716.         $hmackey 'A5FD6D11DA2B9C4112201B4D797EC2B32B877C09A0CF56CE8007D91ACBA9A6D9E026149A7E8441D39A9F52C61E0D250ACC6DEC6815EA02621AEE525576CF4DAE';
  4717.         $pbx_prenom_fact strtoupper($pbx_prenom_fact);
  4718.         $pbx_nom_fact strtoupper($pbx_nom_fact);
  4719.         $pbx_adresse1_fact strtoupper($pbx_adresse1_fact);
  4720.         $pbx_adresse2_fact strtoupper($pbx_adresse2_fact);
  4721.         $pbx_city_fact strtoupper($pbx_city_fact);
  4722.         $pbx_country_fact strtoupper($pbx_country_fact);
  4723.         // --------------- TRAITEMENT DES VARIABLES ---------------
  4724.         // On crée la chaéne a hacher sans URLencodage
  4725.         $msg "PBX_SITE=" $pbx_site .
  4726.             "&PBX_RANG=" $pbx_rang .
  4727.             "&PBX_IDENTIFIANT=" $pbx_identifiant .
  4728.             "&PBX_SOURCE=RWD" .
  4729.             "&PBX_TOTAL=" $pbx_total .
  4730.             "&PBX_DEVISE=978" .
  4731.             "&PBX_CMD=" $pbx_cmd .
  4732.             "&PBX_PORTEUR=" $pbx_porteur .
  4733.             "&PBX_REPONDRE_A=" $pbx_repondre_a .
  4734.             "&PBX_RETOUR=" $pbx_retour .
  4735.             "&PBX_EFFECTUE=" $pbx_effectue .
  4736.             "&PBX_ANNULE=" $pbx_annule .
  4737.             "&PBX_REFUSE=" $pbx_refuse .
  4738.             "&PBX_HASH=SHA512" .
  4739.             "&PBX_TIME=" $dateTime .
  4740.             "&PBX_SHOPPINGCART=" $pbx_shoppingcart .
  4741.             "&PBX_BILLING=" $pbx_billing .
  4742.             "&PBX_SOUHAITAUTHENT=" $pbx_souhaitauthent;
  4743.         $binKey pack("H*"$hmackey);
  4744.         $hmac strtoupper(hash_hmac('sha512'$msg$binKey));
  4745.         return new JsonResponse(array(
  4746.             'urletrans' => $urletrans,
  4747.             'pbx_site' => $pbx_site,
  4748.             'pbx_rang' => $pbx_rang,
  4749.             'pbx_identifiant' => $pbx_identifiant,
  4750.             'pbx_total' => $pbx_total,
  4751.             'pbx_cmd' => $pbx_cmd,
  4752.             'pbx_porteur' => $pbx_porteur,
  4753.             'pbx_repondre_a' => $pbx_repondre_a,
  4754.             'pbx_retour' => $pbx_retour,
  4755.             'pbx_effectue' => $pbx_effectue,
  4756.             'pbx_annule' => $pbx_annule,
  4757.             'pbx_refuse' => $pbx_refuse,
  4758.             'dateTime' => $dateTime,
  4759.             'pbx_shoppingcart' => $pbx_shoppingcart,
  4760.             'pbx_billing' => $pbx_billing,
  4761.             'pbx_souhaitauthent' => $pbx_souhaitauthent,
  4762.             'hmac' => $hmac
  4763.         ));
  4764.         // return new JsonResponse(array('TITLE'=>$title,'ACCEPTURL'=>$ACCEPTURL,'DECLINEURL'=>$DECLINEURL,'EXCEPTIONURL'=>$EXCEPTIONURL,'CANCELURL'=>$CANCELURL,'orderID'=>$orderID,'PSPID'=>$PSPID,'CURRENCY'=>$CURRENCY,'LANGUAGE'=>$LANGUAGE,'PrixOgone'=>$PrixOgone,'shastring'=>$shastring));
  4765.     }
  4766.     /**
  4767.      * @Route("/Parent/chargement_form_connx", name="chargement_form__Connx")
  4768.      */
  4769.     function chargeFormOgoneAction_Connx(Request $request)
  4770.     {
  4771.         $session $this->session;
  4772.         $em $this->container->get('doctrine')->getManager();
  4773.         $idSejour $session->get("Sejour");
  4774.         /** @var \App\Entity\User $user */
  4775.         $user $this->getUser();
  4776.         $user $user->getId();
  4777.         $comande $this->em->getRepository(ParentSejour::class)->findOneBy(["idSejour" => $idSejour"idParent" => $user]);
  4778.         $firstName $comande->getIdParent()->getNom();
  4779.         if ($firstName == null || $firstName == '') {
  4780.             $firstName "john";
  4781.         }
  4782.         $lastName $comande->getIdParent()->getPrenom();
  4783.         if ($lastName == null || $lastName == '') {
  4784.             $lastName "Doe";
  4785.         }
  4786.         $addressLine1 "3 rue de l'église";
  4787.         $city $city "Ostheim";
  4788.         $postalCode "68150";
  4789.         //      $postalCode= trim ($postalCode) ;
  4790.         $country "FR";
  4791.         $contexte = array("billing" => array("firstName" => $firstName"lastName" => $lastName"addressLine1" => $addressLine1"city" => $city"postalCode" => $postalCode"country" => $country));
  4792.         //param de payement
  4793.         $contexte_commande base64_encode(json_encode($contexte));
  4794.         $PayementService $this->container->get("App\Service\PayementService");
  4795.         $version $this->getParameter('version'); //done
  4796.         $TPE $this->getParameter('TPE'); //done
  4797.         $dateTime $dateNow = new \DateTime();
  4798.         $date $dateTime->format("d/m/Y:H:i:s");
  4799.         //"05/05/2019:11:55:23" ;
  4800.         $montant $comande->getIdSejour()->getPrixcnxparent() . "EUR";
  4801.         $reference 'REFCN' $comande->getId();
  4802.         $url_retour_ok $this->generateUrl("moneticoAcceptUrl_parentcnxx", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  4803.         $url_retour_err $this->generateUrl("moneticoExceptionUrl_parentcnxx", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  4804.         $desactivemoyenpaiement "paypal";
  4805.         $lgue "FR"//done
  4806.         $societe "5sur5sejou"//done
  4807.         $textelibre "5sur5sejour"//
  4808.         $mail $this->getUser(); //
  4809.         $SHAIN $this->getParameter('shain');
  4810.         $param = array(
  4811.             'version' => $version,
  4812.             'TPE' => $TPE,
  4813.             'date' => $date,
  4814.             'montant' => $montant,
  4815.             'reference' => $reference,
  4816.             'url_retour_ok' => $url_retour_ok,
  4817.             'url_retour_err' => $url_retour_err,
  4818.             'lgue' => $lgue,
  4819.             'societe' => $societe,
  4820.             'contexte_commande' => $contexte_commande,
  4821.             'texte-libre' => $textelibre,
  4822.             'mail' => $mail,
  4823.             'desactivemoyenpaiement' => $desactivemoyenpaiement
  4824.         );
  4825.         $MAC $PayementService->monetico_hash_parameters('sha1'$param$SHAIN);
  4826.         //utf8_encode
  4827.         return new JsonResponse(array(
  4828.             'version' => $version,
  4829.             'TPE' => $TPE,
  4830.             'date' => $date,
  4831.             'montant' => $montant,
  4832.             'reference' => $reference,
  4833.             'MAC' => $MAC,
  4834.             'url_retour_ok' => utf8_encode($url_retour_ok),
  4835.             'url_retour_err' => utf8_encode($url_retour_err),
  4836.             'lgue' => $lgue,
  4837.             'societe' => $societe,
  4838.             'contexte_commande' => utf8_encode($contexte_commande),
  4839.             'textelibre' => utf8_encode($textelibre),
  4840.             'mail' => $mail,
  4841.             'desactivemoyenpaiement' => $desactivemoyenpaiement
  4842.         ));
  4843.         // return new JsonResponse(array('TITLE'=>$title,'ACCEPTURL'=>$ACCEPTURL,'DECLINEURL'=>$DECLINEURL,'EXCEPTIONURL'=>$EXCEPTIONURL,'CANCELURL'=>$CANCELURL,'orderID'=>$orderID,'PSPID'=>$PSPID,'CURRENCY'=>$CURRENCY,'LANGUAGE'=>$LANGUAGE,'PrixOgone'=>$PrixOgone,'shastring'=>$shastring));
  4844.     }
  4845.     /**
  4846.      * @Route("/Parent/chargement_form_connx_paypal", name="chargement_form__Connx_PayPal")
  4847.      */
  4848.     function chargeFormOgoneAction_Connx_PayPal(Request $request)
  4849.     {
  4850.         $session $this->session;
  4851.         $em $this->container->get('doctrine')->getManager();
  4852.         $idSejour $session->get("Sejour");
  4853.         /** @var \App\Entity\User $user */
  4854.         $user $this->getUser();
  4855.         $user $user->getId();
  4856.         $comande $this->em->getRepository(ParentSejour::class)->findOneBy(["idSejour" => $idSejour"idParent" => $user]);
  4857.         $firstName $comande->getIdParent()->getNom();
  4858.         if ($firstName == null || $firstName == '') {
  4859.             $firstName "john";
  4860.         }
  4861.         $lastName $comande->getIdParent()->getPrenom();
  4862.         if ($lastName == null || $lastName == '') {
  4863.             $lastName "Doe";
  4864.         }
  4865.         $addressLine1 "3 rue de l'église";
  4866.         $city $city "Ostheim";
  4867.         $postalCode "68150";
  4868.         //      $postalCode= trim ($postalCode) ;
  4869.         $country "FR";
  4870.         $contexte = array("billing" => array("firstName" => $firstName"lastName" => $lastName"addressLine1" => $addressLine1"city" => $city"postalCode" => $postalCode"country" => $country));
  4871.         $protocole "paypal";
  4872.         //param de payement
  4873.         $contexte_commande base64_encode(json_encode($contexte));
  4874.         $PayementService $this->container->get("App\Service\PayementService");
  4875.         $version $this->getParameter('version'); //done
  4876.         $TPE $this->getParameter('TPE'); //done
  4877.         $dateTime $dateNow = new \DateTime();
  4878.         $date $dateTime->format("d/m/Y:H:i:s");
  4879.         //"05/05/2019:11:55:23" ;
  4880.         $montant $comande->getIdSejour()->getPrixcnxparent() . "EUR";
  4881.         $reference 'REFCN' $comande->getId();
  4882.         $url_retour_ok $this->generateUrl("moneticoAcceptUrl_parentcnxx", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  4883.         $url_retour_err $this->generateUrl("moneticoExceptionUrl_parentcnxx", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  4884.         $lgue "FR"//done
  4885.         $societe "5sur5sejou"//done
  4886.         $textelibre "5sur5sejour"//
  4887.         $mail $this->getUser(); //
  4888.         $SHAIN $this->getParameter('shain');
  4889.         $param = array(
  4890.             'version' => $version,
  4891.             'TPE' => $TPE,
  4892.             'date' => $date,
  4893.             'montant' => $montant,
  4894.             'reference' => $reference,
  4895.             'url_retour_ok' => $url_retour_ok,
  4896.             'url_retour_err' => $url_retour_err,
  4897.             'lgue' => $lgue,
  4898.             'societe' => $societe,
  4899.             'contexte_commande' => $contexte_commande,
  4900.             'texte-libre' => $textelibre,
  4901.             'mail' => $mail,
  4902.             'protocole' => $protocole
  4903.         );
  4904.         $MAC $PayementService->monetico_hash_parameters('sha1'$param$SHAIN);
  4905.         //utf8_encode
  4906.         return new JsonResponse(array(
  4907.             'version' => $version,
  4908.             'TPE' => $TPE,
  4909.             'date' => $date,
  4910.             'montant' => $montant,
  4911.             'reference' => $reference,
  4912.             'MAC' => $MAC,
  4913.             'url_retour_ok' => utf8_encode($url_retour_ok),
  4914.             'url_retour_err' => utf8_encode($url_retour_err),
  4915.             'lgue' => $lgue,
  4916.             'societe' => $societe,
  4917.             'contexte_commande' => utf8_encode($contexte_commande),
  4918.             'textelibre' => utf8_encode($textelibre),
  4919.             'mail' => $mail,
  4920.             'protocole' => $protocole
  4921.         ));
  4922.         // return new JsonResponse(array('TITLE'=>$title,'ACCEPTURL'=>$ACCEPTURL,'DECLINEURL'=>$DECLINEURL,'EXCEPTIONURL'=>$EXCEPTIONURL,'CANCELURL'=>$CANCELURL,'orderID'=>$orderID,'PSPID'=>$PSPID,'CURRENCY'=>$CURRENCY,'LANGUAGE'=>$LANGUAGE,'PrixOgone'=>$PrixOgone,'shastring'=>$shastring));
  4923.     }
  4924.     /**
  4925.      * @Route("/Parent/SupprimerCommande", name="Supprimer_CommandeParent")
  4926.      */
  4927.     function RemoveCommandeParent(Request $request)
  4928.     {
  4929.         $CommandeService $this->commandeService;
  4930.         $idCmd $request->get('id');
  4931.         $result $CommandeService->CommandeCloture($idCmd);
  4932.         return new Response($result);
  4933.     }
  4934.     /**
  4935.      * @Route("/Parent/accept_url_parentcnxx/{id}", name="moneticoAcceptUrl_parentcnxx")
  4936.      */
  4937.     function moneticoAcceptUrl_parent($id)
  4938.     {
  4939.         $em $this->container->get('doctrine')->getManager();
  4940.         $comande $this->em->getRepository(ParentSejour::class)->find($id);
  4941.         if ($comande->getPayment() != 1) {
  4942.             $typ $this->em->getRepository(Typeproduit::class)->find(1);
  4943.             $condit $this->em->getRepository(TypeProduitConditionnement::class)->find(11);
  4944.             $produit = new Produit();
  4945.             $produit->setIdConditionnement($condit);
  4946.             $produit->setType($typ);
  4947.             $produit->setDate(new \DateTime());
  4948.             $produit->setLabele("Connexion");
  4949.             $produit->setIduser($this->getUser());
  4950.             $sats $this->em->getRepository(Ref::class)->find(33);
  4951.             //$ComandeService = $this->container->get("App\Service\ComandeService");
  4952.             $ComandeService $this->commandeService;
  4953.             $comande->setPayment(1);
  4954.             $this->em->getManager()->persist($comande);
  4955.             $this->em->getManager()->flush();
  4956.             $produit->setIdsjour($comande->getIdSejour());
  4957.             $this->em->getManager()->persist($produit);
  4958.             $this->em->getManager()->flush();
  4959.             $bytes random_int(10009999);
  4960.             $pass bin2hex($bytes);
  4961.             //generate Num facture
  4962.             $dateSJoue = new \Datetime();
  4963.             $annes $dateSJoue->format('y');
  4964.             $moi $dateSJoue->format('m');
  4965.             $val $this->em->getRepository(Commande::class)->serachNombreFacture();
  4966.             $val $val 1;
  4967.             $valx sprintf('%04d'$val);
  4968.             $valx1 "20" $annes $moi $valx;
  4969.             $cmdpaym = new Commande();
  4970.             $cmdpaym->setMontantrth($comande->getIdSejour()->getPrixcnxparent());
  4971.             $cmdpaym->setNumComande($pass);
  4972.             $cmdpaym->getIdSejour($pass);
  4973.             $cmdpaym->setNumfacture($valx1);
  4974.             $cmdpaym->setDateCreateCommande(new \DateTime());
  4975.             $cmdpaym->setDateFacture(new \DateTime());
  4976.             $cmdpaym->setStatut($sats);
  4977.             $cmdpaym->setIdSejour($comande->getIdSejour());
  4978.             $cmdpaym->setIdUser($this->getUser());
  4979.             $this->em->getManager()->persist($cmdpaym);
  4980.             $this->em->getManager()->flush();
  4981.             $cmdpaym->setNumfacture(substr($cmdpaym->getNumfacture(), '0'6) . $cmdpaym->getId());
  4982.             $this->em->getManager()->persist($cmdpaym);
  4983.             $this->em->getManager()->flush();
  4984.             $cpmd = new ComandeProduit();
  4985.             $cpmd->setIdComande($cmdpaym);
  4986.             $cpmd->setIdProduit($produit);
  4987.             $cpmd->setQuantiter(1);
  4988.             $cpmd->setDate(new \DateTime());
  4989.             //stille reversment par prod
  4990.             $this->em->getManager()->persist($cpmd);
  4991.             $this->em->getManager()->flush();
  4992.             $pdfOptions = new Options();
  4993.             $pdfOptions->set('isRemoteEnabled'TRUE);
  4994.             $pdfOptions->set('defaultFont''Arial');
  4995.             // Instantiate Dompdf with our options
  4996.             $dompdf = new Dompdf($pdfOptions);
  4997.             $dompdf->set_option('isRemoteEnabled'TRUE);
  4998.             // Retrieve the HTML generated in our twig file
  4999.             $html $this->renderView('Admin/pdfFactureparent.html.twig', [
  5000.                 "Commande" => $cmdpaym,
  5001.             ]);
  5002.             // Load HTML to Dompdf
  5003.             $dompdf->loadHtml($html);
  5004.             // (Optional) Setup the paper size and orientation 'portrait' or 'portrait'
  5005.             $dompdf->setPaper('A4''portrait');
  5006.             // Render the HTML as PDF
  5007.             $dompdf->render();
  5008.             // Store PDF Binary Data
  5009.             $output $dompdf->output();
  5010.             // In this case, we want to write the file in the public directory
  5011.             $publicDirectory $this->getParameter('kernel.project_dir') . '/public/backupFacture/';
  5012.             // e.g /var/www/project/public/mypdf.pdf
  5013.             $pdfFilepath $publicDirectory "Facture" $cmdpaym->getId() . '-' $cmdpaym->getNumComande() . ".pdf";
  5014.             // Write file to the desired path
  5015.             file_put_contents($pdfFilepath$output);
  5016.         }
  5017.         $jetonService = new JetonService($this->em);
  5018.         if ($jetonService->checkUserFiveConnexion($comande->getIdSejour()->getIdAcommp(), $comande->getIdSejour())) {
  5019.             $jetonService->newJetonForUser($comande->getIdSejour()->getIdAcommp());
  5020.         }
  5021.         $session $this->session;
  5022.         $session->set('paymentmoniteco''succses');
  5023.         $resulat $session->get("paymentmoniteco");
  5024.         //dd($montanttotalcomande);
  5025.         return $this->redirectToRoute('AccueilParent');
  5026.     }
  5027.     /**
  5028.      * @Route("/Parent/accept_url_parentcnxxVirgo/{id}", name="moneticoAcceptUrl_parentcnxxVirgo")
  5029.      */
  5030.     function moneticoAcceptUrl_parentVirgo($id)
  5031.     {
  5032.         $em $this->container->get('doctrine')->getManager();
  5033.         $comande $this->em->getRepository(ParentSejour::class)->find($id);
  5034.         if ($comande->getPayment() != 1) {
  5035.             $typ $this->em->getRepository(Typeproduit::class)->find(1);
  5036.             $condit $this->em->getRepository(TypeProduitConditionnement::class)->find(11);
  5037.             $produit = new Produit();
  5038.             $produit->setIdConditionnement($condit);
  5039.             $produit->setType($typ);
  5040.             $produit->setLabele("Connexion");
  5041.             $produit->setIduser($this->getUser());
  5042.             $produit->setDate(new \DateTime());
  5043.             $sats $this->em->getRepository(Ref::class)->find(33);
  5044.             $ComandeService $this->container->get("App\Service\ComandeService");
  5045.             $comande->setPayment(1);
  5046.             $this->em->getManager()->persist($comande);
  5047.             $this->em->getManager()->flush();
  5048.             $produit->setIdsjour($comande->getIdSejour());
  5049.             $this->em->getManager()->persist($produit);
  5050.             $this->em->getManager()->flush();
  5051.             $bytes random_int(10009999);
  5052.             $pass bin2hex($bytes);
  5053.             //generate Num facture
  5054.             $dateSJoue = new \Datetime();
  5055.             $annes $dateSJoue->format('y');
  5056.             $moi $dateSJoue->format('m');
  5057.             $val $this->em->getRepository(Commande::class)->serachNombreFacture();
  5058.             $val $val 1;
  5059.             $valx sprintf('%04d'$val);
  5060.             $valx1 "20" $annes $moi $valx;
  5061.             $cmdpaym = new Commande();
  5062.             $cmdpaym->setMontantrth($comande->getIdSejour()->getPrixcnxparent());
  5063.             $cmdpaym->setNumComande($pass);
  5064.             $cmdpaym->getIdSejour($pass);
  5065.             $cmdpaym->setNumfacture($valx1);
  5066.             $cmdpaym->setDateFacture(new \DateTime());
  5067.             $cmdpaym->setDateCreateCommande(new \DateTime());
  5068.             $cmdpaym->setStatut($sats);
  5069.             $cmdpaym->setPaymentType("Mobile");
  5070.             $cmdpaym->setIdSejour($comande->getIdSejour());
  5071.             $cmdpaym->setIdUser($this->getUser());
  5072.             $this->em->getManager()->persist($cmdpaym);
  5073.             $this->em->getManager()->flush();
  5074.             $cmdpaym->setNumfacture(substr($cmdpaym->getNumfacture(), '0'6) . $cmdpaym->getId());
  5075.             $this->em->getManager()->persist($cmdpaym);
  5076.             $this->em->getManager()->flush();
  5077.             $cpmd = new ComandeProduit();
  5078.             $cpmd->setIdComande($cmdpaym);
  5079.             $cpmd->setIdProduit($produit);
  5080.             $cpmd->setQuantiter(1);
  5081.             $cpmd->setDate(new \DateTime());
  5082.             //stille reversment par prod
  5083.             $this->em->getManager()->persist($cpmd);
  5084.             $this->em->getManager()->flush();
  5085.             $pdfOptions = new Options();
  5086.             $pdfOptions->set('isRemoteEnabled'TRUE);
  5087.             $pdfOptions->set('defaultFont''Arial');
  5088.             // Instantiate Dompdf with our options
  5089.             $dompdf = new Dompdf($pdfOptions);
  5090.             $dompdf->set_option('isRemoteEnabled'TRUE);
  5091.             // Retrieve the HTML generated in our twig file
  5092.             $html $this->renderView('Admin/pdfFactureparent.html.twig', [
  5093.                 "Commande" => $cmdpaym,
  5094.             ]);
  5095.             // Load HTML to Dompdf
  5096.             $dompdf->loadHtml($html);
  5097.             // (Optional) Setup the paper size and orientation 'portrait' or 'portrait'
  5098.             $dompdf->setPaper('A4''portrait');
  5099.             // Render the HTML as PDF
  5100.             $dompdf->render();
  5101.             // Store PDF Binary Data
  5102.             $output $dompdf->output();
  5103.             // In this case, we want to write the file in the public directory
  5104.             $publicDirectory $this->getParameter('kernel.project_dir') . '/public/backupFacture/';
  5105.             // e.g /var/www/project/public/mypdf.pdf
  5106.             $pdfFilepath $publicDirectory "Facture" $cmdpaym->getId() . '-' $cmdpaym->getNumComande() . ".pdf";
  5107.             // Write file to the desired path
  5108.             file_put_contents($pdfFilepath$output);
  5109.         }
  5110.         $jetonService = new JetonService($this->em);
  5111.         if ($jetonService->checkUserFiveConnexion($comande->getIdSejour()->getIdAcommp(), $comande->getIdSejour())) {
  5112.             $jetonService->newJetonForUser($comande->getIdSejour()->getIdAcommp());
  5113.         }
  5114.         $session $this->session;
  5115.         $session->set('paymentmoniteco''succses');
  5116.         $resulat $session->get("paymentmoniteco");
  5117.         //dd($montanttotalcomande);
  5118.         return $this->redirectToRoute('AccueilParent');
  5119.     }
  5120.     /**
  5121.      * @Route("/error_url_parentcnxx/{id}", name="moneticoExceptionUrl_parentcnxx")
  5122.      */
  5123.     function moneticoExceptionUrl_parentcnxx($id)
  5124.     {
  5125.         $em $this->container->get('doctrine')->getManager();
  5126.         $comande $this->em->getRepository(ParentSejour::class)->find($id);
  5127.         $session $this->session;
  5128.         $session->set('paymentmoniteco''echec');
  5129.         $comande->setPayment(0);
  5130.         $this->em->getManager()->persist($comande);
  5131.         $this->em->getManager()->flush();
  5132.         $resulat $session->get("paymentmoniteco");
  5133.         //dd($montanttotalcomande);
  5134.         return $this->redirectToRoute('AccueilParent');
  5135.     }
  5136.     /**
  5137.      * @Route("/Parent/SuiviCommande", name="SuiviCommande")
  5138.      * */
  5139.     public function SuiviCommande()
  5140.     {
  5141.         // dd($liste);
  5142.         $user $this->getUser();
  5143.         $session $this->session;
  5144.         $idSejour $session->get("Sejour");
  5145.         $sejour $this->em->getRepository(Sejour::class)->find($idSejour);
  5146.         $ParentSejour $this->em->getRepository(ParentSejour::class)->findBy(['idSejour' => $sejour'idParent' => $user]);
  5147.         //ParentSejour
  5148.         //cablala
  5149.         //dd($ParentSejour[0]);
  5150.         //$listeattach = $sejourservice->getatachmentsejour($id);
  5151.         //$listeattachM = $sejourservice->getsejourmessage($id);
  5152.         return $this->render('Parent/suivicommande.html.twig', [
  5153.             'user' => $user,
  5154.             'sejour' => $sejour,
  5155.             'ParentSejour' => $ParentSejour[0],
  5156.         ]);
  5157.     }
  5158.     /**
  5159.      * @Route("/Parent/SuiviCommandeparent", name="SuiviCommandeparent")
  5160.      * */
  5161.     public function SuiviCommandeparent()
  5162.     {
  5163.         // dd($liste);
  5164.         $user $this->getUser();
  5165.         //dd($user);
  5166.         $cmdservice $this->commandeService;
  5167.         $session $this->session;
  5168.         $idSejour $session->get("Sejour");
  5169.         $sejour $this->em->getRepository(Sejour::class)->find($idSejour);
  5170.         $listeCmd $cmdservice->listerCommandeParent($user);
  5171.         return $this->render('Parent/suivicommande.html.twig', [
  5172.             'user' => $user,
  5173.             'sejour' => $sejour,
  5174.             'listeCmd' => $listeCmd
  5175.         ]);
  5176.     }
  5177.     private function envoieMailPackNumerique($nameZip,$email,$commande)
  5178.     {
  5179.         // Utiliser directement le numéro de commande comme identifiant de téléchargement
  5180.         $downloadLink =  $nameZip ;
  5181.         
  5182.       
  5183.         $this->emailsCmdService->MailPackPhotosNumerique(
  5184.             $email,
  5185.             $downloadLink,
  5186.             $commande->getId(),
  5187.         
  5188.         );
  5189.         // Marquer comme envoyé
  5190.         $commande->setEnvoi(1);
  5191.         $this->em->getManager()->persist($commande);
  5192.         $this->em->getManager()->flush();
  5193.         $this->logger->info("Email sent for order: ");
  5194.         return true;
  5195.     }
  5196.    
  5197.  /**
  5198.  * @Route("/Parent/telechargerPack/{idCommande}", name="telechargerPack")
  5199.  */
  5200. public function TelechagerPackNumerique($idCommande): Response
  5201. {
  5202.     $this->logger->info("Tentative de téléchargement du pack pour la commande numérique ID: {$idCommande}");
  5203.     
  5204.     // Récupérer la commande numérique
  5205.     $commandeNumerique $this->em->getRepository(CommandeNumerique::class)->find($idCommande);
  5206.    
  5207.     // Vérifier si la commande existe
  5208.     if (!$commandeNumerique) {
  5209.         $this->logger->error("Commande numérique introuvable - ID: {$idCommande}");
  5210.         return new JsonResponse(["message" => "Commande introuvable"], 404);
  5211.     }
  5212.     
  5213.     // Récupérer les informations associées
  5214.     $commande $commandeNumerique->getIdCommande();
  5215.     $idcommande $commande->getId();
  5216.     $user $commande->getIdUser();
  5217.      $iduser $user->getId();
  5218.     $sejour $commande->getIdSejour();
  5219.     
  5220.     $this->logger->info("Commande numérique {$commandeNumerique->getId()} trouvée, commande parent ID: {$idcommande}, utilisateur: {$user->getEmail()},ETAT: {$commandeNumerique->getEtat()}");
  5221.     $idCmdNumerique $commandeNumerique->getId();
  5222.     // Vérifier si le lien de téléchargement existe
  5223.     $refcmdnum $commandeNumerique->getLinkdownload();
  5224.    
  5225.     $this->logger->info("Lien de téléchargement: {$refcmdnum}");
  5226.     if (!$refcmdnum) {
  5227.         // Envoyer un email d'alerte à l'administrateur
  5228.         $email = (new Email())
  5229.             ->from('noreply@5sur5sejour.com')
  5230.             ->to('yousra.tlich@gmail.com')
  5231.             ->subject('ALERTE - Lien de téléchargement corrompu')
  5232.             ->text(
  5233.                 "Le lien de téléchargement est corrompu pour la commande suivante:\n" .
  5234.                 "ID Commande Numérique: " $idCmdNumerique "\n" .
  5235.                 "ID Commande: " $idcommande "\n" .
  5236.                 "Utilisateur: " $user->getEmail() . "\n" .
  5237.                 "Séjour: " $sejour->getLibelleSejour() . "\n" .
  5238.                 "Date: " . (new \DateTime())->format('Y-m-d H:i:s')
  5239.             );
  5240.         
  5241.         $this->symfonyMailer->send($email);
  5242.         $this->logger->error("Lien de téléchargement corrompu pour la commande numérique {$idCommande}");
  5243.         
  5244.         return new JsonResponse(["message" => "Lien de téléchargement non disponible"], 404);
  5245.     }
  5246.     
  5247.     $this->logger->info("Lien de téléchargement trouvé pour la commande numérique {$idCommande}{$refcmdnum}");
  5248.     
  5249.     // Vérifier que l'utilisateur et le séjour existent
  5250.     if (!$user || !$sejour) {
  5251.         $this->logger->error("Utilisateur ou séjour manquant pour la commande numérique {$idCommande}");
  5252.         return new JsonResponse(['message' => 'Lien invalide - utilisateur ou séjour manquant'], 400);
  5253.     }
  5254.     
  5255.     // Vérifier l'état de la commande
  5256.     if ($commandeNumerique->getEtat() === 1) {
  5257.         // Construire le chemin du fichier
  5258.         $filePath $this->getParameter('kernel.project_dir') . '/public/ParentPhotosNumerique/' $refcmdnum '.zip';
  5259.         
  5260.         // Vérifier si le fichier existe
  5261.         if (file_exists($filePath)) {
  5262.             $this->logger->info("Fichier trouvé, téléchargement démarré pour la commande numérique {$idCmdNumerique}");
  5263.             return $this->file($filePath$refcmdnum '.zip'ResponseHeaderBag::DISPOSITION_ATTACHMENT);
  5264.         } else {
  5265.             // Envoyer un email d'alerte pour fichier manquant
  5266.             $email = (new Email())
  5267.                 ->from('noreply@5sur5sejour.com')
  5268.                 ->to('yousra.tlich@gmail.com')
  5269.                 ->subject('ALERTE - Fichier ZIP manquant')
  5270.                 ->text(
  5271.                     "Le fichier ZIP est manquant pour la commande suivante:\n" .
  5272.                     "ID Commande Numérique: " $idCommande "\n" .
  5273.                     "ID Commande: " $idcommande "\n" .
  5274.                     "Lien de téléchargement: " $refcmdnum "\n" .
  5275.                     "Chemin attendu: " $filePath "\n" .
  5276.                     "Date: " . (new \DateTime())->format('Y-m-d H:i:s')
  5277.                 );
  5278.             
  5279.             $this->symfonyMailer->send($email);
  5280.             $this->logger->error("Fichier ZIP manquant pour la commande numérique {$idCommande} - chemin: {$filePath}");
  5281.             
  5282.             return new JsonResponse(['message' => 'Fichier non trouvé'], 404);
  5283.         }
  5284.     } 
  5285.     
  5286.     elseif ($commandeNumerique->getEtat() == 2) {
  5287.         $this->logger->warning("Tentative de téléchargement d'une commande déjà livrée - ID: {$idCommande}");
  5288.         return new JsonResponse(['message' => 'Commande déjà livrée'], 400);
  5289.     } else {
  5290.         $this->logger->warning("État de commande invalide pour la commande numérique {$idCmdNumerique} - état: {$commandeNumerique->getEtat()}");
  5291.         return new JsonResponse(['message' => 'Commande invalide'], 400);
  5292.     }
  5293. }
  5294.     /**
  5295.      * @Route("/Parent/disableTelecharge/{idCommande}" , name="disableTelecharge" )
  5296.      */
  5297.     public function disableTelecharge($idCommande)
  5298.     {
  5299.         $commandenumerique $this->em->getRepository(CommandeNumerique::class)->findOneBy(['id' => $idCommande]);
  5300.        $commandenumerique->setEtat(2);
  5301.         $commandenumerique->setDateTelechargement(new \DateTime());
  5302.         $this->em->getManager()->persist($commandenumerique);
  5303.         $this->em->getManager()->flush();
  5304.         return "ok";
  5305.     }
  5306.     /**
  5307.      * @Route("/Accompagnateur/pdffacturetest/{id}", name="pdffacturetest")
  5308.      */
  5309.     public function pdffactureAccomptest($id)
  5310.     {
  5311.         $em $this->em;
  5312.         $cmd $em->getRepository(Commande::class)->find($id);
  5313.         return $this->render('Parent/pdfFactureParent.html.twig', [
  5314.             "comande" => $cmd,
  5315.         ]);
  5316.     }
  5317.     /**
  5318.      * @Route("/Parent/pdffacture/{id}", name="pdffacture")
  5319.      */
  5320.     public function pdffacture($id)
  5321.     {
  5322.         $user $this->getUser();
  5323.         $cmd $this->em->getRepository(Commande::class)->find($id);
  5324.         //   $result=   $this->EmailServie->MailCommandeSuivieParent($user->getEmail(),$cmd );
  5325.         // Configure Dompdf according to your needs
  5326.         $pdfOptions = new Options();
  5327.         $pdfOptions->set('isRemoteEnabled'TRUE);
  5328.         $pdfOptions->set('defaultFont''Arial');
  5329.         // Instantiate Dompdf with our options
  5330.         $dompdf = new Dompdf($pdfOptions);
  5331.         $dompdf->set_option('isRemoteEnabled'TRUE);
  5332.         // Retrieve the HTML generated in our twig file
  5333.         $html $this->renderView('Parent/pdfFactureParent.html.twig', [
  5334.             "comande" => $cmd,
  5335.         ]);
  5336.         // Load HTML to Dompdf
  5337.         $dompdf->loadHtml($html);
  5338.         // (Optional) Setup the paper size and orientation 'portrait' or 'portrait'
  5339.         $dompdf->setPaper('A4''portrait');
  5340.         // Render the HTML as PDF
  5341.         $dompdf->render();
  5342.         // Output the generated PDF to Browser (force download)
  5343.         $dompdf->stream("facture.pdf", [
  5344.             "Attachment" => true
  5345.         ]);
  5346.         return new Response('yoopi');
  5347.     }
  5348.     /**
  5349.      * @Route("/Parent/testPDF/{idPrdt}", name="TcPdf")
  5350.      */
  5351.     public function TcPdf($idPrdt)
  5352.     {
  5353.         ini_set("max_execution_time", -1);
  5354.         $pageLayout = array(2115);
  5355.         $pdf $this->get("white_october.tcpdf")->create('L''CM'$pageLayouttrue'UTF-8'false);
  5356.         // set document information
  5357.         $pdf->SetCreator(PDF_CREATOR);
  5358.         $pdf->SetAuthor('Nicola Asuni');
  5359.         $pdf->SetTitle('TCPDF Example 009');
  5360.         $pdf->SetSubject('TCPDF Tutorial');
  5361.         $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
  5362.         $pdf->SetSubject('TCPDF Tutorial');
  5363.         $pdf->setPrintHeader(false);
  5364.         $pdf->setPrintFooter(false);
  5365.         // set image scale factor
  5366.         $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
  5367.         //        $pdf->AddPage();
  5368.         $pdf->setJPEGQuality(100);
  5369.         $horizontal_alignments = array('L''C''R');
  5370.         $vertical_alignments = array('T''M''B');
  5371.         //var_dump($pdf->getPageWidth());
  5372.         //var_dump($pdf->getPageHeight());die();
  5373.         $em $this->em;
  5374.         $Album $em->getRepository(Produit::class)->findOneBy(['id' => $idPrdt]);
  5375.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Album]);
  5376.         //dd($AllPages);
  5377.         //        $fP=[];
  5378.         //        array_push($fP,$AllPages[0]);
  5379.         //dd($AllPages);
  5380.         foreach ($AllPages as $p) {
  5381.             $pdf->AddPage();
  5382.             $pdf->setJPEGQuality(100);
  5383.             $contenu json_decode(json_decode($p->getCouleurbordure())[0]);
  5384.             $nbatach $contenu->nbrAttc;
  5385.             $nbatach intval(str_replace('"'''$nbatach));
  5386.             $color =  $contenu->color;
  5387.             // $color="rgb(255,255,255)";
  5388.             $color str_replace('"rgb('''$color);
  5389.             $color str_replace(')"'''$color);
  5390.             $color explode(","$color);
  5391.             $colorp = array(intval($color[0]), intval($color[1]), intval($color[2]));
  5392.             $tabtxt json_decode($contenu->txt);
  5393.             $tabphoto json_decode($contenu->attache);
  5394.             //
  5395.             //dd($tabtxt);
  5396.             //         dd($tabtxt);
  5397.             //dd($tabphoto);
  5398.             $tabClips json_decode($contenu->clips);
  5399.             // dd($tabClips);
  5400.             $x 0.6;
  5401.             $y 0.8;
  5402.             $w 19.8;
  5403.             $h 13.4;
  5404.             // get the current page break margin
  5405.             $bMargin $pdf->getBreakMargin();
  5406.             // get current auto-page-break mode
  5407.             $auto_page_break $pdf->getAutoPageBreak();
  5408.             // disable auto-page-break
  5409.             $pdf->SetAutoPageBreak(false0);
  5410.             // test all combinations of alignments
  5411.             $fitbox $horizontal_alignments[1] . ' ';
  5412.             $fitbox[1] = $vertical_alignments[1];
  5413.             $pdf->Rect(002115'F', array(), $colorp);
  5414.             //    sizeof($tabphoto)
  5415.             for ($i 0$i sizeof($tabphoto); $i++) {
  5416.                 $photo json_decode($tabphoto[$i]);
  5417.                 //les coordonnées de l'image réel:
  5418.                 $hght $photo->height;
  5419.                 $top $photo->top;
  5420.                 $left $photo->left;
  5421.                 $width $photo->width;
  5422.                 $ordre $photo->ordre;
  5423.                 $zoom $photo->zoom;
  5424.                 $path $photo->path;
  5425.                 $hght floatval(str_replace('cm'''$hght));
  5426.                 $top floatval(str_replace('cm'''$top));
  5427.                 $left floatval(str_replace('cm'''$left));
  5428.                 $width floatval(str_replace('cm'''$width));
  5429.                 //les coordonnées dropzone:
  5430.                 $heightOriginal $photo->height;
  5431.                 $widthOriginal $photo->width;
  5432.                 $top $photo->top;
  5433.                 $left $photo->left;
  5434.                 $heightOriginal floatval(str_replace('cm'''$heightOriginal));
  5435.                 $widthOriginal floatval(str_replace('cm'''$widthOriginal));
  5436.                 $top floatval(str_replace('cm'''$top));
  5437.                 $left floatval(str_replace('cm'''$left));
  5438.                 $heightOriginal $heightOriginal 37.7952755906;
  5439.                 $widthOriginal $widthOriginal 37.7952755906;
  5440.                 $topOriginal $top 37.7952755906;
  5441.                 $leftOriginal $left 37.7952755906;
  5442.                 $heightCrop $photo->heightCrop;
  5443.                 $topCrop $photo->topCrop;
  5444.                 $leftCrop $photo->leftCrop;
  5445.                 $widthCrop $photo->widthCrop;
  5446.                 $path $photo->path;
  5447.                 $heightCrop floatval(str_replace('cm'''$heightCrop));
  5448.                 $topCrop floatval(str_replace('cm'''$topCrop));
  5449.                 $leftCrop floatval(str_replace('cm'''$leftCrop));
  5450.                 $widthCrop floatval(str_replace('cm'''$widthCrop));
  5451.                 $widthCropPX $widthCrop 37.7952755906;
  5452.                 $heightCropPX $heightCrop 37.7952755906;
  5453.                 $topCropPX $topCrop 37.7952755906;
  5454.                 $leftCropPX $leftCrop 37.7952755906;
  5455.                 // var_dump("original widh: ".$widthCrop." "."original height : ".$heightCrop);
  5456.                 // var_dump("original left: ".$topCrop." "."original top : ".$leftCrop);
  5457.                 // var_dump("//00");
  5458.                 // var_dump("multip 37 widh: ".$widthCropPX." "."multip 37 height : ".$heightCropPX);
  5459.                 // var_dump("multip 37 top: ".$topCropPX." "."multip 37 left : ".$leftCropPX);
  5460.                 //Calculer position des images selon nombres images par page:
  5461.                 $positionX 0;
  5462.                 $positionY 0;
  5463.                 $widthImg 0;
  5464.                 $heightImg 0;
  5465.                 if ($nbatach == 1) {
  5466.                     $positionX 1.5;
  5467.                     $positionY 1.5;
  5468.                     $widthImg 18;
  5469.                     $heightImg 12;
  5470.                 } elseif ($nbatach == 2) {
  5471.                     if ($ordre == 1) {
  5472.                         $positionX 1.5;
  5473.                         $positionY 1.5;
  5474.                         $widthImg 8.7;
  5475.                         $heightImg 12;
  5476.                     }
  5477.                     if ($ordre == 2) {
  5478.                         $positionX 10.8;
  5479.                         $positionY 1.5;
  5480.                         $widthImg 8.7;
  5481.                         $heightImg 12;
  5482.                     }
  5483.                 } elseif ($nbatach == 3) {
  5484.                     if ($ordre == 1) {
  5485.                         $positionX 1.5;
  5486.                         $positionY 1.5;
  5487.                         $widthImg 8.7;
  5488.                         $heightImg 12;
  5489.                     }
  5490.                     if ($ordre == 2) {
  5491.                         $positionX 10.8;
  5492.                         $positionY 1.5;
  5493.                         $widthImg 8.7;
  5494.                         $heightImg 5.7;
  5495.                     }
  5496.                     if ($ordre == 3) {
  5497.                         $positionX 10.8;
  5498.                         $positionY 7.8;
  5499.                         $widthImg 8.7;
  5500.                         $heightImg 5.7;
  5501.                     }
  5502.                 } elseif ($nbatach == 4) {
  5503.                     if ($ordre == 1) {
  5504.                         $positionX 1.5;
  5505.                         $positionY 1.5;
  5506.                         $widthImg 8.7;
  5507.                         $heightImg 5.7;
  5508.                     }
  5509.                     if ($ordre == 2) {
  5510.                         $positionX 1.5;
  5511.                         $positionY 7.8;
  5512.                         $widthImg 8.7;
  5513.                         $heightImg 5.7;
  5514.                     }
  5515.                     if ($ordre == 3) {
  5516.                         $positionX 10.8;
  5517.                         $positionY 1.5;
  5518.                         $widthImg 8.7;
  5519.                         $heightImg 5.7;
  5520.                     }
  5521.                     if ($ordre == 4) {
  5522.                         $positionX 10.8;
  5523.                         $positionY 7.8;
  5524.                         $widthImg 8.7;
  5525.                         $heightImg 5.7;
  5526.                     }
  5527.                 } elseif ($nbatach == 5) {
  5528.                     if ($ordre == 1) {
  5529.                         $positionX 1.5;
  5530.                         $positionY 1.5;
  5531.                         $widthImg 18;
  5532.                         $heightImg 8;
  5533.                     }
  5534.                     if ($ordre == 2) {
  5535.                         $positionX 1.5;
  5536.                         $positionY 10.1;
  5537.                         $widthImg 4.05;
  5538.                         $heightImg 3.4;
  5539.                     }
  5540.                     if ($ordre == 3) {
  5541.                         $positionX 6.15;
  5542.                         $positionY 10.1;
  5543.                         $widthImg 4.05;
  5544.                         $heightImg 3.4;
  5545.                     }
  5546.                     if ($ordre == 4) {
  5547.                         $positionX 10.8;
  5548.                         $positionY 10.1;
  5549.                         $widthImg 4.05;
  5550.                         $heightImg 3.4;
  5551.                     }
  5552.                     if ($ordre == 5) {
  5553.                         $positionX 15.45;
  5554.                         $positionY 10.1;
  5555.                         $widthImg 4.05;
  5556.                         $heightImg 3.4;
  5557.                     }
  5558.                 } elseif ($nbatach == 6) {
  5559.                     if ($ordre == 1) {
  5560.                         $positionX 1.5;
  5561.                         $positionY 1.5;
  5562.                         $widthImg 5.53;
  5563.                         $heightImg 3.6;
  5564.                     }
  5565.                     if ($ordre == 2) {
  5566.                         $positionX 1.5;
  5567.                         $positionY 5.7;
  5568.                         $widthImg 5.53;
  5569.                         $heightImg 3.6;
  5570.                     }
  5571.                     if ($ordre == 3) {
  5572.                         $positionX 1.5;
  5573.                         $positionY 9.9;
  5574.                         $widthImg 5.53;
  5575.                         $heightImg 3.6;
  5576.                     }
  5577.                     if ($ordre == 4) {
  5578.                         $positionX 7.63;
  5579.                         $positionY 1.5;
  5580.                         $widthImg 5.53;
  5581.                         $heightImg 3.6;
  5582.                     }
  5583.                     if ($ordre == 5) {
  5584.                         $positionX 7.63;
  5585.                         $positionY 5.7;
  5586.                         $widthImg 5.53;
  5587.                         $heightImg 3.6;
  5588.                     }
  5589.                     if ($ordre == 6) {
  5590.                         $positionX 7.63;
  5591.                         $positionY 9.9;
  5592.                         $widthImg 5.53;
  5593.                         $heightImg 3.6;
  5594.                     }
  5595.                 } elseif ($nbatach == 12) {
  5596.                     if ($ordre == 1) {
  5597.                         $positionX 1.5;
  5598.                         $positionY 1.5;
  5599.                         $widthImg 4.05;
  5600.                         $heightImg 3.6;
  5601.                     }
  5602.                     if ($ordre == 2) {
  5603.                         $positionX 1.5;
  5604.                         $positionY 5.7;
  5605.                         $widthImg 4.05;
  5606.                         $heightImg 3.6;
  5607.                     }
  5608.                     if ($ordre == 3) {
  5609.                         $positionX 1.5;
  5610.                         $positionY 9.9;
  5611.                         $widthImg 4.05;
  5612.                         $heightImg 3.6;
  5613.                     }
  5614.                     if ($ordre == 4) {
  5615.                         $positionX 6.15;
  5616.                         $positionY 1.5;
  5617.                         $widthImg 4.05;
  5618.                         $heightImg 3.6;
  5619.                     }
  5620.                     if ($ordre == 5) {
  5621.                         $positionX 6.15;
  5622.                         $positionY 5.7;
  5623.                         $widthImg 4.05;
  5624.                         $heightImg 3.6;
  5625.                     }
  5626.                     if ($ordre == 6) {
  5627.                         $positionX 6.15;
  5628.                         $positionY 9.9;
  5629.                         $widthImg 4.05;
  5630.                         $heightImg 3.6;
  5631.                     }
  5632.                     if ($ordre == 7) {
  5633.                         $positionX 10.8;
  5634.                         $positionY 1.5;
  5635.                         $widthImg 4.05;
  5636.                         $heightImg 3.6;
  5637.                     }
  5638.                     if ($ordre == 8) {
  5639.                         $positionX 10.8;
  5640.                         $positionY 5.7;
  5641.                         $widthImg 4.05;
  5642.                         $heightImg 3.6;
  5643.                     }
  5644.                     if ($ordre == 9) {
  5645.                         $positionX 10.8;
  5646.                         $positionY 9.9;
  5647.                         $widthImg 4.05;
  5648.                         $heightImg 3.6;
  5649.                     }
  5650.                     if ($ordre == 10) {
  5651.                         $positionX 15.45;
  5652.                         $positionY 1.5;
  5653.                         $widthImg 4.05;
  5654.                         $heightImg 3.6;
  5655.                     }
  5656.                     if ($ordre == 11) {
  5657.                         $positionX 15.45;
  5658.                         $positionY 5.7;
  5659.                         $widthImg 4.05;
  5660.                         $heightImg 3.6;
  5661.                     }
  5662.                     if ($ordre == 12) {
  5663.                         $positionX 15.45;
  5664.                         $positionY 9.9;
  5665.                         $widthImg 4.05;
  5666.                         $heightImg 3.6;
  5667.                     }
  5668.                 }
  5669.                 //Recarder l'image :
  5670.                 // $path=str_replace( 'upload/', 'upload/ar_1.1'.',c_crop/q_auto:good/',$path);<
  5671.                 //                $path=str_replace( 'upload/', 'upload/ar_1,c_crop,x_'.round($left*37.7952755906).',y_'.round($top*37.7952755906).',w_'.round($widthCropPX).',h_'.round($heightCropPX).',g_north_east/',$path);
  5672.                 $pathArray explode("/"$path);
  5673.                 $idsArray explode("."$pathArray[sizeof($pathArray) - 1]);
  5674.                 $idImage "";
  5675.                 foreach ($idsArray as $key => $elem) {
  5676.                     if ($key != (sizeof($idsArray) - 1)) {
  5677.                         $idImage $idImage $elem;
  5678.                     }
  5679.                 }
  5680.                 //   $cloudinaryWidht=$widthOriginal;
  5681.                 // $cloudinaryHeight=$widthOriginal;
  5682.                 $idImage 'newprod/' $idImage;
  5683.                 //var_dump($idImage);
  5684.                 Unirest\Request::auth('263346742199243''jYw-jg0FOJGv89-o5Wo0Fa3rQWU');
  5685.                 $headers = array('Accept' => 'application/json');
  5686.                 $data = array("public_ids" => array($idImage));
  5687.                 $body Unirest\Request\Body::form($data);
  5688.                 Unirest\Request::verifyPeer(false);
  5689.                 $url 'https://api.cloudinary.com/v1_1/apss-factory/resources/image/upload/' $idImage;
  5690.                 // $resultMetadata=  \Cloudinary::Api.resources_by_ids([$idImage]);
  5691.                 //  var_dump($url);
  5692.                 //https://media.5sur5sejour.com/api/upload/a_exif/original/
  5693.                 $resultMetadata Unirest\Request::post($url$headers$body);
  5694.                 if (isset(json_decode($resultMetadata->raw_body)->width)) {
  5695.                     $cloudinaryWidht json_decode($resultMetadata->raw_body)->width;
  5696.                     $cloudinaryHeight json_decode($resultMetadata->raw_body)->height;
  5697.                 } else {
  5698.                     $cloudinaryWidht $widthOriginal;
  5699.                     $cloudinaryHeight $heightOriginal;
  5700.                 }
  5701.                 $ratiohight $cloudinaryWidht $widthOriginal;
  5702.                 $ratioHight $cloudinaryHeight $heightOriginal;
  5703.                 //$cloudinaryHeight=$cloudinaryHeight*$zoom;
  5704.                 //$cloudinaryWidht=$cloudinaryWidht*$zoom;
  5705.                 var_dump($cloudinaryWidht);
  5706.                 var_dump($cloudinaryHeight);
  5707.                 var_dump($ratioHight);
  5708.                 var_dump($zoom);
  5709.                 var_dump($leftOriginal);
  5710.                 var_dump('x_' round(abs($leftOriginal $zoom) * $ratioHight));
  5711.                 var_dump('y_' round(abs($topOriginal $zoom) * $ratiohight));
  5712.                 var_dump('w_' round(($widthCropPX $zoom) * $ratioHight));
  5713.                 var_dump('h_' round(($heightCropPX $zoom) * $ratiohight));
  5714.                 //var_dump($path);i
  5715.                 $path str_replace('upload/''upload/w_' round($cloudinaryWidht) . ',h_' round($cloudinaryHeight) . ',c_scale/x_' round(abs($leftOriginal $zoom) * $ratioHight) . ',y_' round(abs($topOriginal $zoom) * $ratiohight) . ',w_' round(($widthCropPX $zoom) * $ratioHight) . ',h_' round(($heightCropPX $zoom) * $ratiohight) . ',c_crop/'$path);
  5716.                 //var_dump($path);i
  5717.                 //                $path=str_replace( 'upload/', 'upload/w_'.round($widthOriginal).',h_'.round($heightOriginal).'/x_'.round(abs($leftOriginal)).',y_'.round(abs($topOriginal)).',w_'.round($widthCropPX).',h_'.round($heightCropPX).',c_crop/',$path);
  5718.                 //var_dump($path);
  5719.                 $path str_replace("l_Logo5Sur5White_nh6tyk,o_10,fl_relative.tiled,"''$path);
  5720.                 //  var_dump("//00");
  5721.                 //  var_dump("avant 1.4 widh: ".round($widthCropPX)." "."avant 1.4 height : ".round($heightCropPX));
  5722.                 //  var_dump("avant 1.4 top: ".round(abs($top*37.7952755906))." avant 1.4 final left : ".round(abs($left*37.7952755906)));
  5723.                 //    var_dump("//00");
  5724.                 //   var_dump("final widh: ".round($widthCropPX*1.4)." "."final height : ".round($heightCropPX*1.4));
  5725.                 //  var_dump("final top: ".round(abs($top*37.7952755906*1.4))." "."final left : ".round(abs($left*37.7952755906*1.4)));
  5726.                 var_dump($zoom);
  5727.                 var_dump($path);
  5728.                 // $path="https://res.cloudinary.com/apss-factory/image/upload/w_691,h_356,c_crop/a_exif/v1587482806/newprod/crepes-au-chocolat_re9wvk.jpg";
  5729.                 $pdf->Image($path$positionX$positionY$widthImg$heightImg'JPG'''''false1000''falsefalse0falsefalsefalse);
  5730.                 //                $pdf->Rect($positionX,$positionY ,$widthImg, $heightImg, 'F', array(), array(264,200,67));
  5731.                 //
  5732.             }
  5733.             //    $pdf->Image('https://demo.appsfactor.fr/images/ClipArt_SVG/Etoilerose.svg',3,  2, 19, 13, 'SVG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
  5734.             for ($i 0$i sizeof($tabtxt); $i++) {
  5735.                 $txt json_decode($tabtxt[$i]);
  5736.                 $fontSize floatval(str_replace('px'''$txt->fontSize)) * 0.75;
  5737.                 //$txt->rotation
  5738.                 $check explode(','$txt->fontFamily);
  5739.                 if (sizeof($check) > 1) {
  5740.                     //default
  5741.                     if (($check[0] == "-apple-system") && ($txt->fontWeight == 400)) {
  5742.                         $finalFont "helvetica";
  5743.                         $weight '';
  5744.                     }
  5745.                     //classique
  5746.                     if (($check[0] == "Georgia") && ($txt->fontWeight == 400)) {
  5747.                         $finalFont "times";
  5748.                         $weight '';
  5749.                     }
  5750.                     //creative
  5751.                     if (($check[0] == "-apple-system") && ($txt->fontWeight == 700)) {
  5752.                         $finalFont "helveticaB";
  5753.                         $weight '';
  5754.                     }
  5755.                     // manuscrite
  5756.                     if (($check[0] == "Comic Sans") && ($txt->fontWeight == 400)) {
  5757.                         $finalFont "Courier";
  5758.                         $weight '';
  5759.                     }
  5760.                     //c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.woff2
  5761.                 } else {
  5762.                     //baton
  5763.                     if (($txt->fontFamily == 'Impact') && ($txt->fontWeight == 400)) {
  5764.                         $finalFont "helveticaB";
  5765.                         $weight 'B';
  5766.                     }
  5767.                 }
  5768.                 $pdf->SetFont($finalFont$weight$fontSize);
  5769.                 $leftTxt $txt->left;
  5770.                 $topTxt $txt->top;
  5771.                 $heightClips $txt->height;
  5772.                 $widthClips $txt->width;
  5773.                 $heightTxt floatval(str_replace('cm'''$heightClips));
  5774.                 $topTxt floatval(str_replace('cm'''$topTxt));
  5775.                 $leftTxt floatval(str_replace('cm'''$leftTxt));
  5776.                 $widthTxt floatval(str_replace('cm'''$widthClips));
  5777.                 $pdf->SetXY($leftTxt$topTxttrue);
  5778.                 //                    var_dump($leftTxt);
  5779.                 //                  var_dump($topTxt);
  5780.                 // var_dump(floatval(str_replace('rad','',$txt->rotation))*57,2958);
  5781.                 //                var_dump("text");
  5782.                 $pdf->StartTransform();
  5783.                 var_dump($txt->rotation);
  5784.                 var_dump(str_replace('rad'''$txt->rotation));
  5785.                 var_dump(floatval(str_replace('rad'''$txt->rotation)) * 57.2958);
  5786.                 $pdf->Rotate((floatval(str_replace('rad'''$txt->rotation)) * 57.2958) * -1$leftTxt + ($widthTxt 2), $topTxt + ($heightTxt 2));
  5787.                 // $pdf->Rotate(45);
  5788.                 //   $pdf->Text($leftTxt, $topTxt, $txt->contenu);
  5789.                 //$pdf->SetTextColor(200);
  5790.                 //$pdf->Text($leftTxt, $topTxt, $txt->contenu);
  5791.                 // $pdf->MultiCell($leftTxt, $topTxt,  $txt->contenu, 0, $ln=0, 'C', 0, '', 0, false, 'C', 'C');
  5792.                 $pdf->Write(str_replace('cm'''$txt->height), trim($txt->contenu));
  5793.                 // $pdf->writeHTML("<p>".$txt->contenu."</p>", true, false, false, false, '');
  5794.                 $pdf->StopTransform();
  5795.             }
  5796.             //Positionner text
  5797.             //            $pdf->ImageSVG("C:\\Users\\AppsFactor12\\Desktop\\5sur5\\5sur5Sejour\\public\\images\\ClipArt_SVG\\Etoilerose.svg",100,200,500, 500, '', '', '', 0, false);
  5798.             //Positionner clipart
  5799.             //            dd($tabClips);
  5800.             for ($i 0$i sizeof($tabClips); $i++) {
  5801.                 $Clips json_decode($tabClips[$i]);
  5802.                 $heightClips $Clips->height;
  5803.                 $topClips $Clips->top;
  5804.                 $leftClips $Clips->left;
  5805.                 $widthClips $Clips->width;
  5806.                 $path $Clips->path;
  5807.                 $pathClips str_replace('"'''$path);
  5808.                 $heightClips floatval(str_replace('cm'''$heightClips));
  5809.                 $topClips floatval(str_replace('cm'''$topClips));
  5810.                 $leftClips floatval(str_replace('cm'''$leftClips));
  5811.                 $widthClips floatval(str_replace('cm'''$widthClips));
  5812.                 $heightClipsPX round($heightClips 37.7952755906);
  5813.                 $widthClipsPX round($widthClips 37.7952755906);
  5814.                 ////                $positionXclips = $positionX + $leftClips;
  5815.                 ////                $positionYclips = $positionY + $topClips;
  5816.                 //
  5817.                 //$pdf->ImageSVG("images/ClipArt_SVG/Ete4.svg",$leftClips,$topClips,$widthClips, $heightClips);
  5818.                 //https://res.cloudinary.com/apss-factory/image/private/s--EdExAzx8--/v1588758453/GlobeFooter_c4duua.svg
  5819.                 // https://res.cloudinary.com/apss-factory/image/upload/v1588764528/Groupe_113_pcjyj4.png
  5820.                 var_dump($pathClips);
  5821.                 $pdf->StartTransform();
  5822.                 $pdf->Rotate((floatval(str_replace('rad'''$Clips->rotation)) * 57.2958) * -1$leftClips + ($widthClips 2), $topClips + ($heightClips 2));
  5823.                 $pdf->Image($this->newPAthCLipart($pathClips$heightClipsPX$widthClipsPX), $leftClips,  $topClips$widthClips$heightClips''''''false300);
  5824.                 $pdf->StopTransform();
  5825.             }
  5826.         }
  5827.         // echo '</pre>';
  5828.         //return new response("yezi");
  5829.         $projectRoot $this->getParameter('kernel.project_dir');
  5830.         $pdf->Output($projectRoot '/public/pdfDocs/example_' $idPrdt '.pdf''F');
  5831.         return new response("yezi");
  5832.         //return $pdf->Output('example_009.pdf', 'I');
  5833.     }
  5834.     /**
  5835.      * @Route("/Parent/testPDFphoto/{idPrdt}", name="TcPdfphoto")
  5836.      */
  5837.     public function TcPdfPhoto($idPrdt)
  5838.     {
  5839.         ini_set("max_execution_time", -1);
  5840.         $pageLayout = array(1510);
  5841.         $pdf $this->get("white_october.tcpdf")->create('L''CM'$pageLayouttrue'UTF-8'false);
  5842.         // set document information
  5843.         $pdf->SetCreator(PDF_CREATOR);
  5844.         $pdf->SetAuthor('Nicola Asuni');
  5845.         $pdf->SetTitle('TCPDF Example 009');
  5846.         $pdf->SetSubject('TCPDF Tutorial');
  5847.         $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
  5848.         $pdf->SetSubject('TCPDF Tutorial');
  5849.         $pdf->setPrintHeader(false);
  5850.         $pdf->setPrintFooter(false);
  5851.         // set image scale factor
  5852.         $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
  5853.         //        $pdf->AddPage();
  5854.         $pdf->setJPEGQuality(100);
  5855.         $horizontal_alignments = array('L''C''R');
  5856.         $vertical_alignments = array('T''M''B');
  5857.         //var_dump($pdf->getPageWidth());
  5858.         //var_dump($pdf->getPageHeight());die();
  5859.         $em $this->em;
  5860.         $Album $em->getRepository(Produit::class)->findOneBy(['id' => $idPrdt]);
  5861.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Album]);
  5862.         //dd($AllPages);
  5863.         //        $fP=[];
  5864.         //        array_push($fP,$AllPages[0]);
  5865.         //dd($AllPages);
  5866.         foreach ($AllPages as $p) {
  5867.             $pdf->AddPage();
  5868.             $pdf->setJPEGQuality(100);
  5869.             $contenu json_decode(json_decode($p->getCouleurbordure())[0]);
  5870.             $nbatach $contenu->nbrAttc;
  5871.             $nbatach intval(str_replace('"'''$nbatach));
  5872.             $color =  $contenu->color;
  5873.             // $color="rgb(255,255,255)";
  5874.             $tabphoto json_decode($contenu->attache);
  5875.             //
  5876.             //dd($tabtxt);
  5877.             //         dd($tabtxt);
  5878.             //dd($tabphoto);
  5879.             // dd($tabClips);
  5880.             // get the current page break margin
  5881.             $bMargin $pdf->getBreakMargin();
  5882.             // get current auto-page-break mode
  5883.             $auto_page_break $pdf->getAutoPageBreak();
  5884.             // disable auto-page-break
  5885.             $pdf->SetAutoPageBreak(false0);
  5886.             // test all combinations of alignments
  5887.             $fitbox $horizontal_alignments[1] . ' ';
  5888.             $fitbox[1] = $vertical_alignments[1];
  5889.             //    sizeof($tabphoto)
  5890.             for ($i 0$i sizeof($tabphoto); $i++) {
  5891.                 $photo json_decode($tabphoto[$i]);
  5892.                 //les coordonnées de l'image réel:
  5893.                 $hght $photo->height;
  5894.                 $top $photo->top;
  5895.                 $left $photo->left;
  5896.                 $width $photo->width;
  5897.                 $ordre $photo->ordre;
  5898.                 $zoom $photo->zoom;
  5899.                 $path $photo->path;
  5900.                 $hght floatval(str_replace('cm'''$hght));
  5901.                 $top floatval(str_replace('cm'''$top));
  5902.                 $left floatval(str_replace('cm'''$left));
  5903.                 $width floatval(str_replace('cm'''$width));
  5904.                 //les coordonnées dropzone:
  5905.                 $heightOriginal $photo->height;
  5906.                 $widthOriginal $photo->width;
  5907.                 $top $photo->top;
  5908.                 $left $photo->left;
  5909.                 $heightOriginal floatval(str_replace('cm'''$heightOriginal));
  5910.                 $widthOriginal floatval(str_replace('cm'''$widthOriginal));
  5911.                 $top floatval(str_replace('cm'''$top));
  5912.                 $left floatval(str_replace('cm'''$left));
  5913.                 $heightOriginal $heightOriginal 37.7952755906;
  5914.                 $widthOriginal $widthOriginal 37.7952755906;
  5915.                 $topOriginal $top 37.7952755906;
  5916.                 $leftOriginal $left 37.7952755906;
  5917.                 $heightCrop $photo->heightCrop;
  5918.                 $topCrop $photo->topCrop;
  5919.                 $leftCrop $photo->leftCrop;
  5920.                 $widthCrop $photo->widthCrop;
  5921.                 $path $photo->path;
  5922.                 $heightCrop floatval(str_replace('cm'''$heightCrop));
  5923.                 $topCrop floatval(str_replace('cm'''$topCrop));
  5924.                 $leftCrop floatval(str_replace('cm'''$leftCrop));
  5925.                 $widthCrop floatval(str_replace('cm'''$widthCrop));
  5926.                 $widthCropPX $widthCrop 37.7952755906;
  5927.                 $heightCropPX $heightCrop 37.7952755906;
  5928.                 $topCropPX $topCrop 37.7952755906;
  5929.                 $leftCropPX $leftCrop 37.7952755906;
  5930.                 // var_dump("original widh: ".$widthCrop." "."original height : ".$heightCrop);
  5931.                 // var_dump("original left: ".$topCrop." "."original top : ".$leftCrop);
  5932.                 // var_dump("//00");
  5933.                 // var_dump("multip 37 widh: ".$widthCropPX." "."multip 37 height : ".$heightCropPX);
  5934.                 // var_dump("multip 37 top: ".$topCropPX." "."multip 37 left : ".$leftCropPX);
  5935.                 //Calculer position des images selon nombres images par page:
  5936.                 $positionX 0;
  5937.                 $positionY 0;
  5938.                 $widthImg 0;
  5939.                 $heightImg 0;
  5940.                 if ($nbatach == 1) {
  5941.                     $positionX 0.3;
  5942.                     $positionY 0.3;
  5943.                     $widthImg 14.4;
  5944.                     $heightImg 9.4;
  5945.                 }
  5946.                 //Recarder l'image :
  5947.                 // $path=str_replace( 'upload/', 'upload/ar_1.1'.',c_crop/q_auto:good/',$path);<
  5948.                 //                $path=str_replace( 'upload/', 'upload/ar_1,c_crop,x_'.round($left*37.7952755906).',y_'.round($top*37.7952755906).',w_'.round($widthCropPX).',h_'.round($heightCropPX).',g_north_east/',$path);
  5949.                 $pathArray explode("/"$path);
  5950.                 $idsArray explode("."$pathArray[sizeof($pathArray) - 1]);
  5951.                 $idImage "";
  5952.                 foreach ($idsArray as $key => $elem) {
  5953.                     if ($key != (sizeof($idsArray) - 1)) {
  5954.                         $idImage $idImage $elem;
  5955.                     }
  5956.                 }
  5957.                 //   $cloudinaryWidht=$widthOriginal;
  5958.                 // $cloudinaryHeight=$widthOriginal;
  5959.                 $idImage 'newprod/' $idImage;
  5960.                 //var_dump($idImage);
  5961.                 Unirest\Request::auth('263346742199243''jYw-jg0FOJGv89-o5Wo0Fa3rQWU');
  5962.                 $headers = array('Accept' => 'application/json');
  5963.                 $data = array("public_ids" => array($idImage));
  5964.                 $body Unirest\Request\Body::form($data);
  5965.                 Unirest\Request::verifyPeer(false);
  5966.                 $url 'https://api.cloudinary.com/v1_1/apss-factory/resources/image/upload/' $idImage;
  5967.                 // $resultMetadata=  \Cloudinary::Api.resources_by_ids([$idImage]);
  5968.                 //  var_dump($url);
  5969.                 $resultMetadata Unirest\Request::post($url$headers$body);
  5970.                 if (isset(json_decode($resultMetadata->raw_body)->width)) {
  5971.                     $cloudinaryWidht json_decode($resultMetadata->raw_body)->width;
  5972.                     $cloudinaryHeight json_decode($resultMetadata->raw_body)->height;
  5973.                 } else {
  5974.                     $cloudinaryWidht $widthOriginal;
  5975.                     $cloudinaryHeight $heightOriginal;
  5976.                 }
  5977.                 $ratiohight $cloudinaryWidht $widthOriginal;
  5978.                 $ratioHight $cloudinaryHeight $heightOriginal;
  5979.                 //$cloudinaryHeight=$cloudinaryHeight*$zoom;
  5980.                 //$cloudinaryWidht=$cloudinaryWidht*$zoom;
  5981.                 $zoom 1;
  5982.                 var_dump($cloudinaryWidht);
  5983.                 var_dump($cloudinaryHeight);
  5984.                 var_dump($ratioHight);
  5985.                 var_dump($zoom);
  5986.                 var_dump($leftOriginal);
  5987.                 var_dump('x_' round(abs($leftOriginal $zoom) * $ratioHight));
  5988.                 var_dump('y_' round(abs($topOriginal $zoom) * $ratiohight));
  5989.                 var_dump('w_' round(($widthCropPX $zoom) * $ratioHight));
  5990.                 var_dump('h_' round(($heightCropPX $zoom) * $ratiohight));
  5991.                 //var_dump($path);i
  5992.                 $path str_replace('upload/''upload/w_' round($cloudinaryWidht) . ',h_' round($cloudinaryHeight) . ',c_scale/x_' round(abs($leftOriginal $zoom) * $ratioHight) . ',y_' round(abs($topOriginal $zoom) * $ratiohight) . ',w_' round(($widthCropPX $zoom) * $ratioHight) . ',h_' round(($heightCropPX $zoom) * $ratiohight) . ',c_crop/'$path);
  5993.                 //var_dump($path);i
  5994.                 //                $path=str_replace( 'upload/', 'upload/w_'.round($widthOriginal).',h_'.round($heightOriginal).'/x_'.round(abs($leftOriginal)).',y_'.round(abs($topOriginal)).',w_'.round($widthCropPX).',h_'.round($heightCropPX).',c_crop/',$path);
  5995.                 //var_dump($path);
  5996.                 $path str_replace("l_Logo5Sur5White_nh6tyk,o_10,fl_relative.tiled,"''$path);
  5997.                 //  var_dump("//00");
  5998.                 //  var_dump("avant 1.4 widh: ".round($widthCropPX)." "."avant 1.4 height : ".round($heightCropPX));
  5999.                 //  var_dump("avant 1.4 top: ".round(abs($top*37.7952755906))." avant 1.4 final left : ".round(abs($left*37.7952755906)));
  6000.                 //    var_dump("//00");
  6001.                 //   var_dump("final widh: ".round($widthCropPX*1.4)." "."final height : ".round($heightCropPX*1.4));
  6002.                 //  var_dump("final top: ".round(abs($top*37.7952755906*1.4))." "."final left : ".round(abs($left*37.7952755906*1.4)));
  6003.                 var_dump($zoom);
  6004.                 var_dump($path);
  6005.                 // $path="https://res.cloudinary.com/apss-factory/image/upload/w_691,h_356,c_crop/a_exif/v1587482806/newprod/crepes-au-chocolat_re9wvk.jpg";
  6006.                 $pdf->Image($path$positionX$positionY$widthImg$heightImg'JPG'''''false1000''falsefalse0falsefalsefalse);
  6007.                 //                $pdf->Rect($positionX,$positionY ,$widthImg, $heightImg, 'F', array(), array(264,200,67));
  6008.                 //
  6009.             }
  6010.             //    $pdf->Image('https://demo.appsfactor.fr/images/ClipArt_SVG/Etoilerose.svg',3,  2, 19, 13, 'SVG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
  6011.             //Positionner text
  6012.             //            $pdf->ImageSVG("C:\\Users\\AppsFactor12\\Desktop\\5sur5\\5sur5Sejour\\public\\images\\ClipArt_SVG\\Etoilerose.svg",100,200,500, 500, '', '', '', 0, false);
  6013.             //Positionner clipart
  6014.             //            dd($tabClips);
  6015.         }
  6016.         // echo '</pre>';
  6017.         //return new response("yezi");
  6018.         $projectRoot $this->getParameter('kernel.project_dir');
  6019.         $pdf->Output($projectRoot '/public/pdfDocs/example_' $idPrdt '.pdf''F');
  6020.         return new response("yezi");
  6021.         //return $pdf->Output('example_009.pdf', 'I');
  6022.     }
  6023.     /**
  6024.      * @Route("/Parent/testPDFphotoR/{idPrdt}", name="TcPdfphotoR")
  6025.      */
  6026.     public function TcPdfPhotoR($idPrdt)
  6027.     {
  6028.         ini_set("max_execution_time", -1);
  6029.         $pageLayout = array(910);
  6030.         $pdf $this->get("white_october.tcpdf")->create('P''CM'$pageLayouttrue'UTF-8'false);
  6031.         // set document information
  6032.         $pdf->SetCreator(PDF_CREATOR);
  6033.         $pdf->SetAuthor('Nicola Asuni');
  6034.         $pdf->SetTitle('TCPDF Example 009');
  6035.         $pdf->SetSubject('TCPDF Tutorial');
  6036.         $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
  6037.         $pdf->SetSubject('TCPDF Tutorial');
  6038.         $pdf->setPrintHeader(false);
  6039.         $pdf->setPrintFooter(false);
  6040.         // set image scale factor
  6041.         $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
  6042.         //        $pdf->AddPage();
  6043.         $pdf->setJPEGQuality(100);
  6044.         $horizontal_alignments = array('L''C''R');
  6045.         $vertical_alignments = array('T''M''B');
  6046.         //var_dump($pdf->getPageWidth());
  6047.         //var_dump($pdf->getPageHeight());die();
  6048.         $em $this->em;
  6049.         $Album $em->getRepository(Produit::class)->findOneBy(['id' => $idPrdt]);
  6050.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Album]);
  6051.         //dd($AllPages);
  6052.         //        $fP=[];
  6053.         //        array_push($fP,$AllPages[0]);
  6054.         //dd($AllPages);
  6055.         foreach ($AllPages as $p) {
  6056.             $pdf->AddPage();
  6057.             $pdf->setJPEGQuality(100);
  6058.             $contenu json_decode(json_decode($p->getCouleurbordure())[0]);
  6059.             $nbatach $contenu->nbrAttc;
  6060.             $nbatach intval(str_replace('"'''$nbatach));
  6061.             $color =  $contenu->color;
  6062.             // $color="rgb(255,255,255)";
  6063.             $tabphoto json_decode($contenu->attache);
  6064.             //
  6065.             //dd($tabtxt);
  6066.             //         dd($tabtxt);
  6067.             //dd($tabphoto);
  6068.             // dd($tabClips);
  6069.             // get the current page break margin
  6070.             $bMargin $pdf->getBreakMargin();
  6071.             // get current auto-page-break mode
  6072.             $auto_page_break $pdf->getAutoPageBreak();
  6073.             // disable auto-page-break
  6074.             $pdf->SetAutoPageBreak(false0);
  6075.             // test all combinations of alignments
  6076.             $fitbox $horizontal_alignments[1] . ' ';
  6077.             $fitbox[1] = $vertical_alignments[1];
  6078.             //    sizeof($tabphoto)
  6079.             for ($i 0$i sizeof($tabphoto); $i++) {
  6080.                 $photo json_decode($tabphoto[$i]);
  6081.                 //les coordonnées de l'image réel:
  6082.                 $hght $photo->height;
  6083.                 $top $photo->top;
  6084.                 $left $photo->left;
  6085.                 $width $photo->width;
  6086.                 $ordre $photo->ordre;
  6087.                 $zoom $photo->zoom;
  6088.                 $path $photo->path;
  6089.                 $hght floatval(str_replace('cm'''$hght));
  6090.                 $top floatval(str_replace('cm'''$top));
  6091.                 $left floatval(str_replace('cm'''$left));
  6092.                 $width floatval(str_replace('cm'''$width));
  6093.                 //les coordonnées dropzone:
  6094.                 $heightOriginal $photo->height;
  6095.                 $widthOriginal $photo->width;
  6096.                 $top $photo->top;
  6097.                 $left $photo->left;
  6098.                 $heightOriginal floatval(str_replace('cm'''$heightOriginal));
  6099.                 $widthOriginal floatval(str_replace('cm'''$widthOriginal));
  6100.                 $top floatval(str_replace('cm'''$top));
  6101.                 $left floatval(str_replace('cm'''$left));
  6102.                 $heightOriginal $heightOriginal 37.7952755906;
  6103.                 $widthOriginal $widthOriginal 37.7952755906;
  6104.                 $topOriginal $top 37.7952755906;
  6105.                 $leftOriginal $left 37.7952755906;
  6106.                 $heightCrop $photo->heightCrop;
  6107.                 $topCrop $photo->topCrop;
  6108.                 $leftCrop $photo->leftCrop;
  6109.                 $widthCrop $photo->widthCrop;
  6110.                 $path $photo->path;
  6111.                 $heightCrop floatval(str_replace('cm'''$heightCrop));
  6112.                 $topCrop floatval(str_replace('cm'''$topCrop));
  6113.                 $leftCrop floatval(str_replace('cm'''$leftCrop));
  6114.                 $widthCrop floatval(str_replace('cm'''$widthCrop));
  6115.                 $widthCropPX $widthCrop 37.7952755906;
  6116.                 $heightCropPX $heightCrop 37.7952755906;
  6117.                 $topCropPX $topCrop 37.7952755906;
  6118.                 $leftCropPX $leftCrop 37.7952755906;
  6119.                 // var_dump("original widh: ".$widthCrop." "."original height : ".$heightCrop);
  6120.                 // var_dump("original left: ".$topCrop." "."original top : ".$leftCrop);
  6121.                 // var_dump("//00");
  6122.                 // var_dump("multip 37 widh: ".$widthCropPX." "."multip 37 height : ".$heightCropPX);
  6123.                 // var_dump("multip 37 top: ".$topCropPX." "."multip 37 left : ".$leftCropPX);
  6124.                 //Calculer position des images selon nombres images par page:
  6125.                 $positionX 0;
  6126.                 $positionY 0;
  6127.                 $widthImg 0;
  6128.                 $heightImg 0;
  6129.                 $positionX 0.55;
  6130.                 $positionY 0.5;
  6131.                 $widthImg 7.9;
  6132.                 $heightImg 6.9;
  6133.                 //Recarder l'image :
  6134.                 // $path=str_replace( 'upload/', 'upload/ar_1.1'.',c_crop/q_auto:good/',$path);<
  6135.                 //                $path=str_replace( 'upload/', 'upload/ar_1,c_crop,x_'.round($left*37.7952755906).',y_'.round($top*37.7952755906).',w_'.round($widthCropPX).',h_'.round($heightCropPX).',g_north_east/',$path);
  6136.                 $pathArray explode("/"$path);
  6137.                 $idsArray explode("."$pathArray[sizeof($pathArray) - 1]);
  6138.                 $idImage "";
  6139.                 foreach ($idsArray as $key => $elem) {
  6140.                     if ($key != (sizeof($idsArray) - 1)) {
  6141.                         $idImage $idImage $elem;
  6142.                     }
  6143.                 }
  6144.                 //   $cloudinaryWidht=$widthOriginal;
  6145.                 // $cloudinaryHeight=$widthOriginal;
  6146.                 $idImage 'newprod/' $idImage;
  6147.                 //var_dump($idImage);
  6148.                 Unirest\Request::auth('263346742199243''jYw-jg0FOJGv89-o5Wo0Fa3rQWU');
  6149.                 $headers = array('Accept' => 'application/json');
  6150.                 $data = array("public_ids" => array($idImage));
  6151.                 $body Unirest\Request\Body::form($data);
  6152.                 Unirest\Request::verifyPeer(false);
  6153.                 $url 'https://api.cloudinary.com/v1_1/apss-factory/resources/image/upload/' $idImage;
  6154.                 // $resultMetadata=  \Cloudinary::Api.resources_by_ids([$idImage]);
  6155.                 //  var_dump($url);
  6156.                 $resultMetadata Unirest\Request::post($url$headers$body);
  6157.                 if (isset(json_decode($resultMetadata->raw_body)->width)) {
  6158.                     $cloudinaryWidht json_decode($resultMetadata->raw_body)->width;
  6159.                     $cloudinaryHeight json_decode($resultMetadata->raw_body)->height;
  6160.                 } else {
  6161.                     $cloudinaryWidht $widthOriginal;
  6162.                     $cloudinaryHeight $heightOriginal;
  6163.                 }
  6164.                 $ratiohight $cloudinaryWidht $widthOriginal;
  6165.                 $ratioHight $cloudinaryHeight $heightOriginal;
  6166.                 //$cloudinaryHeight=$cloudinaryHeight*$zoom;
  6167.                 //$cloudinaryWidht=$cloudinaryWidht*$zoom;
  6168.                 $zoom 1;
  6169.                 var_dump($cloudinaryWidht);
  6170.                 var_dump($cloudinaryHeight);
  6171.                 var_dump($ratioHight);
  6172.                 var_dump($zoom);
  6173.                 var_dump($leftOriginal);
  6174.                 var_dump('x_' round(abs($leftOriginal $zoom) * $ratioHight));
  6175.                 var_dump('y_' round(abs($topOriginal $zoom) * $ratiohight));
  6176.                 var_dump('w_' round(($widthCropPX $zoom) * $ratioHight));
  6177.                 var_dump('h_' round(($heightCropPX $zoom) * $ratiohight));
  6178.                 //var_dump($path);i
  6179.                 $path str_replace('upload/''upload/w_' round($cloudinaryWidht) . ',h_' round($cloudinaryHeight) . ',c_scale/x_' round(abs($leftOriginal $zoom) * $ratioHight) . ',y_' round(abs($topOriginal $zoom) * $ratiohight) . ',w_' round(($widthCropPX $zoom) * $ratioHight) . ',h_' round(($heightCropPX $zoom) * $ratiohight) . ',c_crop/'$path);
  6180.                 //var_dump($path);i
  6181.                 //                $path=str_replace( 'upload/', 'upload/w_'.round($widthOriginal).',h_'.round($heightOriginal).'/x_'.round(abs($leftOriginal)).',y_'.round(abs($topOriginal)).',w_'.round($widthCropPX).',h_'.round($heightCropPX).',c_crop/',$path);
  6182.                 //var_dump($path);
  6183.                 $path str_replace("l_Logo5Sur5White_nh6tyk,o_10,fl_relative.tiled,"''$path);
  6184.                 //  var_dump("//00");
  6185.                 //  var_dump("avant 1.4 widh: ".round($widthCropPX)." "."avant 1.4 height : ".round($heightCropPX));
  6186.                 //  var_dump("avant 1.4 top: ".round(abs($top*37.7952755906))." avant 1.4 final left : ".round(abs($left*37.7952755906)));
  6187.                 //    var_dump("//00");
  6188.                 //   var_dump("final widh: ".round($widthCropPX*1.4)." "."final height : ".round($heightCropPX*1.4));
  6189.                 //  var_dump("final top: ".round(abs($top*37.7952755906*1.4))." "."final left : ".round(abs($left*37.7952755906*1.4)));
  6190.                 var_dump($zoom);
  6191.                 var_dump($path);
  6192.                 // $path="https://res.cloudinary.com/apss-factory/image/upload/w_691,h_356,c_crop/a_exif/v1587482806/newprod/crepes-au-chocolat_re9wvk.jpg";
  6193.                 $pdf->Image($path$positionX$positionY$widthImg$heightImg'JPG'''''false1000''falsefalse0falsefalsefalse);
  6194.                 //                $pdf->Rect($positionX,$positionY ,$widthImg, $heightImg, 'F', array(), array(264,200,67));
  6195.                 //
  6196.             }
  6197.             //    $pdf->Image('https://demo.appsfactor.fr/images/ClipArt_SVG/Etoilerose.svg',3,  2, 19, 13, 'SVG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
  6198.             //Positionner text
  6199.             //            $pdf->ImageSVG("C:\\Users\\AppsFactor12\\Desktop\\5sur5\\5sur5Sejour\\public\\images\\ClipArt_SVG\\Etoilerose.svg",100,200,500, 500, '', '', '', 0, false);
  6200.             //Positionner clipart
  6201.             //            dd($tabClips);
  6202.         }
  6203.         // echo '</pre>';
  6204.         //return new response("yezi");
  6205.         $projectRoot $this->getParameter('kernel.project_dir');
  6206.         $pdf->Output($projectRoot '/public/pdfDocs/example_' $idPrdt '.pdf''F');
  6207.         return new response("yezi");
  6208.         //return $pdf->Output('example_009.pdf', 'I');
  6209.     }
  6210.     /**
  6211.      * @Route("/Parent/testPDFCal/{idPrdt}", name="TcPdfCal")
  6212.      */
  6213.     public function TcPdfCalendrier($idPrdt)
  6214.     {
  6215.         ini_set("max_execution_time", -1);
  6216.         $pageLayout = array(2115);
  6217.         $pdf $this->get("white_october.tcpdf")->create('L''CM'$pageLayouttrue'UTF-8'false);
  6218.         // set document information
  6219.         $pdf->SetCreator(PDF_CREATOR);
  6220.         $pdf->SetAuthor('Nicola Asuni');
  6221.         $pdf->SetTitle('TCPDF Example 009');
  6222.         $pdf->SetSubject('TCPDF Tutorial');
  6223.         $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
  6224.         $pdf->SetSubject('TCPDF Tutorial');
  6225.         $pdf->setPrintHeader(false);
  6226.         $pdf->setPrintFooter(false);
  6227.         // set image scale factor
  6228.         $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
  6229.         //        $pdf->AddPage();
  6230.         $pdf->setJPEGQuality(100);
  6231.         $horizontal_alignments = array('L''C''R');
  6232.         $vertical_alignments = array('T''M''B');
  6233.         //var_dump($pdf->getPageWidth());
  6234.         //var_dump($pdf->getPageHeight());die();
  6235.         $em $this->em;
  6236.         $Album $em->getRepository(Produit::class)->findOneBy(['id' => $idPrdt]);
  6237.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Album]);
  6238.         //dd($AllPages);
  6239.         //        $fP=[];
  6240.         //        array_push($fP,$AllPages[0]);
  6241.         //dd($AllPages);
  6242.         foreach ($AllPages as $key => $p) {
  6243.             $pdf->AddPage();
  6244.             $pdf->setJPEGQuality(100);
  6245.             $contenu json_decode(json_decode($p->getCouleurbordure())[0]);
  6246.             $nbatachS $contenu->nbrAttc;
  6247.             $nbatach intval(str_replace('"'''$nbatachS));
  6248.             if (strpos($nbatachS"H")) {
  6249.                 $nbatach $nbatach 'H';
  6250.             }
  6251.             $tabtxt json_decode($contenu->txt);
  6252.             $tabphoto json_decode($contenu->attache);
  6253.             //
  6254.             //dd($tabtxt);
  6255.             //         dd($tabtxt);
  6256.             //dd($tabphoto);
  6257.             $tabClips json_decode($contenu->clips);
  6258.             // dd($tabClips);
  6259.             $x 0.6;
  6260.             $y 0.8;
  6261.             $w 19.8;
  6262.             $h 13.4;
  6263.             // get the current page break margin
  6264.             $bMargin $pdf->getBreakMargin();
  6265.             // get current auto-page-break mode
  6266.             $auto_page_break $pdf->getAutoPageBreak();
  6267.             // disable auto-page-break
  6268.             $pdf->SetAutoPageBreak(false0);
  6269.             // test all combinations of alignments
  6270.             $fitbox $horizontal_alignments[1] . ' ';
  6271.             $fitbox[1] = $vertical_alignments[1];
  6272.             //    sizeof($tabphoto)
  6273.             for ($i 0$i sizeof($tabphoto); $i++) {
  6274.                 $photo json_decode($tabphoto[$i]);
  6275.                 //les coordonnées de l'image réel:
  6276.                 $hght $photo->height;
  6277.                 $top $photo->top;
  6278.                 $left $photo->left;
  6279.                 $width $photo->width;
  6280.                 $ordre $photo->ordre;
  6281.                 $zoom $photo->zoom;
  6282.                 $path $photo->path;
  6283.                 $hght floatval(str_replace('cm'''$hght));
  6284.                 $top floatval(str_replace('cm'''$top));
  6285.                 $left floatval(str_replace('cm'''$left));
  6286.                 $width floatval(str_replace('cm'''$width));
  6287.                 //les coordonnées dropzone:
  6288.                 $heightOriginal $photo->height;
  6289.                 $widthOriginal $photo->width;
  6290.                 $top $photo->top;
  6291.                 $left $photo->left;
  6292.                 $heightOriginal floatval(str_replace('cm'''$heightOriginal));
  6293.                 $widthOriginal floatval(str_replace('cm'''$widthOriginal));
  6294.                 $top floatval(str_replace('cm'''$top));
  6295.                 $left floatval(str_replace('cm'''$left));
  6296.                 $heightOriginal $heightOriginal 37.7952755906;
  6297.                 $widthOriginal $widthOriginal 37.7952755906;
  6298.                 $topOriginal $top 37.7952755906;
  6299.                 $leftOriginal $left 37.7952755906;
  6300.                 $heightCrop $photo->heightCrop;
  6301.                 $topCrop $photo->topCrop;
  6302.                 $leftCrop $photo->leftCrop;
  6303.                 $widthCrop $photo->widthCrop;
  6304.                 $path $photo->path;
  6305.                 $heightCrop floatval(str_replace('cm'''$heightCrop));
  6306.                 $topCrop floatval(str_replace('cm'''$topCrop));
  6307.                 $leftCrop floatval(str_replace('cm'''$leftCrop));
  6308.                 $widthCrop floatval(str_replace('cm'''$widthCrop));
  6309.                 $widthCropPX $widthCrop 37.7952755906;
  6310.                 $heightCropPX $heightCrop 37.7952755906;
  6311.                 $topCropPX $topCrop 37.7952755906;
  6312.                 $leftCropPX $leftCrop 37.7952755906;
  6313.                 // var_dump("original widh: ".$widthCrop." "."original height : ".$heightCrop);
  6314.                 // var_dump("original left: ".$topCrop." "."original top : ".$leftCrop);
  6315.                 // var_dump("//00");
  6316.                 // var_dump("multip 37 widh: ".$widthCropPX." "."multip 37 height : ".$heightCropPX);
  6317.                 // var_dump("multip 37 top: ".$topCropPX." "."multip 37 left : ".$leftCropPX);
  6318.                 //Calculer position des images selon nombres images par page:
  6319.                 $positionX 0;
  6320.                 $positionY 0;
  6321.                 $widthImg 0;
  6322.                 $heightImg 0;
  6323.                 var_dump('nbr_attach ' $nbatach);
  6324.                 if ($nbatach == 1) {
  6325.                     if ($key == 0) {
  6326.                         $positionX 1.5;
  6327.                         $positionY 1.5;
  6328.                         $widthImg 18;
  6329.                         $heightImg 10;
  6330.                     } else {
  6331.                         $positionX 1.5;
  6332.                         $positionY 1.5;
  6333.                         $widthImg 8.7;
  6334.                         $heightImg 12;
  6335.                     }
  6336.                 } elseif (($nbatach == 2) && ($nbatach == '2V')) {
  6337.                     if ($ordre == 1) {
  6338.                         $positionX 1.5;
  6339.                         $positionY 1.5;
  6340.                         $widthImg 4.05;
  6341.                         $heightImg 12;
  6342.                     }
  6343.                     if ($ordre == 2) {
  6344.                         $positionX 6.15;
  6345.                         $positionY 1.5;
  6346.                         $widthImg 4.05;
  6347.                         $heightImg 12;
  6348.                     }
  6349.                 } elseif ($nbatach == '2H') {
  6350.                     if ($ordre == 1) {
  6351.                         $positionX 1.5;
  6352.                         $positionY 1.5;
  6353.                         $widthImg 8.7;
  6354.                         $heightImg 5.7;
  6355.                     }
  6356.                     if ($ordre == 2) {
  6357.                         $positionX 1.5;
  6358.                         $positionY 7.8;
  6359.                         $widthImg 8.7;
  6360.                         $heightImg 5.7;
  6361.                     }
  6362.                 } elseif (($nbatach == 3) && ($nbatach == "3V")) {
  6363.                     if ($ordre == 1) {
  6364.                         $positionX 1.5;
  6365.                         $positionY 1.5;
  6366.                         $widthImg 4.05;
  6367.                         $heightImg 12;
  6368.                     }
  6369.                     if ($ordre == 2) {
  6370.                         $positionX 6.15;
  6371.                         $positionY =  1.5;
  6372.                         $widthImg 4.05;
  6373.                         $heightImg 5.7;
  6374.                     }
  6375.                     if ($ordre == 3) {
  6376.                         $positionX =  6.15;
  6377.                         $positionY 7.8;
  6378.                         $widthImg 4.05;
  6379.                         $heightImg 5.7;
  6380.                     }
  6381.                 } elseif ($nbatach == '3H') {
  6382.                     if ($ordre == 1) {
  6383.                         $positionX 1.5;
  6384.                         $positionY 1.5;
  6385.                         $widthImg 8.7;
  6386.                         $heightImg 5.7;
  6387.                     }
  6388.                     if ($ordre == 2) {
  6389.                         $positionX 1.5;
  6390.                         $positionY 7.8;
  6391.                         $widthImg 4.05;
  6392.                         $heightImg 5.7;
  6393.                     }
  6394.                     if ($ordre == 3) {
  6395.                         $positionX 6.15;
  6396.                         $positionY 7.8;
  6397.                         $widthImg 4.05;
  6398.                         $heightImg 5.7;
  6399.                     }
  6400.                 } elseif ($nbatach == 4) {
  6401.                     if ($ordre == 1) {
  6402.                         $positionX 1.5;
  6403.                         $positionY 1.5;
  6404.                         $widthImg 4.05;
  6405.                         $heightImg 5.7;
  6406.                     }
  6407.                     if ($ordre == 2) {
  6408.                         $positionX 1.5;
  6409.                         $positionY 7.8;
  6410.                         $widthImg 4.05;
  6411.                         $heightImg 5.7;
  6412.                     }
  6413.                     if ($ordre == 3) {
  6414.                         $positionX 6.15;
  6415.                         $positionY =  1.5;
  6416.                         $widthImg 4.05;
  6417.                         $heightImg 5.7;
  6418.                     }
  6419.                     if ($ordre == 4) {
  6420.                         $positionX =  6.15;
  6421.                         $positionY 7.8;
  6422.                         $widthImg 4.05;
  6423.                         $heightImg 5.7;
  6424.                     }
  6425.                 }
  6426.                 //nop
  6427.                 elseif ($nbatach == 5) {
  6428.                     if ($ordre == 1) {
  6429.                         $positionX 1.5;
  6430.                         $positionY 1.5;
  6431.                         $widthImg 18;
  6432.                         $heightImg 8;
  6433.                     }
  6434.                     if ($ordre == 2) {
  6435.                         $positionX 1.5;
  6436.                         $positionY 10.5;
  6437.                         $widthImg 3.75;
  6438.                         $heightImg 3;
  6439.                     }
  6440.                     if ($ordre == 3) {
  6441.                         $positionX 6.25;
  6442.                         $positionY 10.5;
  6443.                         $widthImg 3.75;
  6444.                         $heightImg 3;
  6445.                     }
  6446.                     if ($ordre == 4) {
  6447.                         $positionX 11;
  6448.                         $positionY 10.5;
  6449.                         $widthImg 3.75;
  6450.                         $heightImg 3;
  6451.                     }
  6452.                     if ($ordre == 5) {
  6453.                         $positionX 15.75;
  6454.                         $positionY 10.5;
  6455.                         $widthImg 3.75;
  6456.                         $heightImg 3;
  6457.                     }
  6458.                 } elseif ($nbatach == 6) {
  6459.                     if ($ordre == 1) {
  6460.                         $positionX 1.5;
  6461.                         $positionY 1.5;
  6462.                         $widthImg 4.05;
  6463.                         $heightImg 3.6;
  6464.                     }
  6465.                     if ($ordre == 2) {
  6466.                         $positionX 1.5;
  6467.                         $positionY 5.7;
  6468.                         $widthImg 4.05;
  6469.                         $heightImg 3.6;
  6470.                     }
  6471.                     if ($ordre == 3) {
  6472.                         $positionX 1.5;
  6473.                         $positionY 9.9;
  6474.                         $widthImg 4.05;
  6475.                         $heightImg 3.6;
  6476.                     }
  6477.                     if ($ordre == 4) {
  6478.                         $positionX =  6.15;
  6479.                         $positionY 1.5;
  6480.                         $widthImg 4.05;
  6481.                         $heightImg 3.6;
  6482.                     }
  6483.                     if ($ordre == 5) {
  6484.                         $positionX =  6.15;
  6485.                         $positionY 5.7;
  6486.                         $widthImg 4.05;
  6487.                         $heightImg 3.6;
  6488.                     }
  6489.                     if ($ordre == 6) {
  6490.                         $positionX =  6.15;
  6491.                         $positionY 9.9;
  6492.                         $widthImg 4.05;
  6493.                         $heightImg 3.6;
  6494.                     }
  6495.                 }
  6496.                 //nop
  6497.                 elseif ($nbatach == 12) {
  6498.                     if ($ordre == 1) {
  6499.                         $positionX 1.5;
  6500.                         $positionY 1.5;
  6501.                         $widthImg 3.75;
  6502.                         $heightImg 3.33;
  6503.                     }
  6504.                     if ($ordre == 2) {
  6505.                         $positionX 1.5;
  6506.                         $positionY 5.83;
  6507.                         $widthImg 3.75;
  6508.                         $heightImg 3.33;
  6509.                     }
  6510.                     if ($ordre == 3) {
  6511.                         $positionX 1.5;
  6512.                         $positionY 10.16;
  6513.                         $widthImg 3.75;
  6514.                         $heightImg 3.33;
  6515.                     }
  6516.                     if ($ordre == 4) {
  6517.                         $positionX 6.25;
  6518.                         $positionY 1.5;
  6519.                         $widthImg 3.75;
  6520.                         $heightImg 3.33;
  6521.                     }
  6522.                     if ($ordre == 5) {
  6523.                         $positionX 6.25;
  6524.                         $positionY 5.83;
  6525.                         $widthImg 3.75;
  6526.                         $heightImg 3.33;
  6527.                     }
  6528.                     if ($ordre == 6) {
  6529.                         $positionX 6.25;
  6530.                         $positionY 10.16;
  6531.                         $widthImg 3.75;
  6532.                         $heightImg 3.33;
  6533.                     }
  6534.                     if ($ordre == 7) {
  6535.                         $positionX 11;
  6536.                         $positionY 1.5;
  6537.                         $widthImg 3.75;
  6538.                         $heightImg 3.33;
  6539.                     }
  6540.                     if ($ordre == 8) {
  6541.                         $positionX 11;
  6542.                         $positionY 5.83;
  6543.                         $widthImg 3.75;
  6544.                         $heightImg 3.33;
  6545.                     }
  6546.                     if ($ordre == 9) {
  6547.                         $positionX 11;
  6548.                         $positionY 10.16;
  6549.                         $widthImg 3.75;
  6550.                         $heightImg 3.33;
  6551.                     }
  6552.                     if ($ordre == 10) {
  6553.                         $positionX 15.75;
  6554.                         $positionY 1.5;
  6555.                         $widthImg 3.75;
  6556.                         $heightImg 3.33;
  6557.                     }
  6558.                     if ($ordre == 11) {
  6559.                         $positionX 15.75;
  6560.                         $positionY 5.83;
  6561.                         $widthImg 3.75;
  6562.                         $heightImg 3.33;
  6563.                     }
  6564.                     if ($ordre == 12) {
  6565.                         $positionX 15.75;
  6566.                         $positionY 10.16;
  6567.                         $widthImg 3.75;
  6568.                         $heightImg 3.33;
  6569.                     }
  6570.                 } elseif ($nbatach == 15) {
  6571.                     if ($ordre == 1) {
  6572.                         $positionX 1.5;
  6573.                         $positionY 1.5;
  6574.                         $widthImg 2.5;
  6575.                         $heightImg 1.92;
  6576.                     }
  6577.                     if ($ordre == 2) {
  6578.                         $positionX 1.5;
  6579.                         $positionY 4.2;
  6580.                         $widthImg 2.5;
  6581.                         $heightImg 1.92;
  6582.                     }
  6583.                     if ($ordre == 3) {
  6584.                         $positionX 1.5;
  6585.                         $positionY 6.54;
  6586.                         $widthImg 2.5;
  6587.                         $heightImg 1.92;
  6588.                     }
  6589.                     if ($ordre == 4) {
  6590.                         $positionX 1.5;
  6591.                         $positionY 9.06;
  6592.                         $widthImg 2.5;
  6593.                         $heightImg =  1.92;
  6594.                     }
  6595.                     if ($ordre == 5) {
  6596.                         $positionX 1.5;
  6597.                         $positionY 11.58;
  6598.                         $widthImg 2.5;
  6599.                         $heightImg =  1.92;
  6600.                     }
  6601.                     if ($ordre == 6) {
  6602.                         $positionX 4.6;
  6603.                         $positionY 1.5;
  6604.                         $widthImg 2.5;
  6605.                         $heightImg 1.92;
  6606.                     }
  6607.                     if ($ordre == 7) {
  6608.                         $positionX 4.6;
  6609.                         $positionY 4.2;
  6610.                         $widthImg 2.5;
  6611.                         $heightImg =  1.92;
  6612.                     }
  6613.                     if ($ordre == 8) {
  6614.                         $positionX 4.6;
  6615.                         $positionY 6.54;
  6616.                         $widthImg 2.5;
  6617.                         $heightImg =  1.92;
  6618.                     }
  6619.                     if ($ordre == 9) {
  6620.                         $positionX 4.6;
  6621.                         $positionY 9.06;
  6622.                         $widthImg 2.5;
  6623.                         $heightImg =  1.92;
  6624.                     }
  6625.                     if ($ordre == 10) {
  6626.                         $positionX 4.6;
  6627.                         $positionY 11.58;
  6628.                         $widthImg 2.5;
  6629.                         $heightImg =  1.92;
  6630.                     }
  6631.                     if ($ordre == 11) {
  6632.                         $positionX 7.7;
  6633.                         $positionY 1.5;
  6634.                         $widthImg 2.5;
  6635.                         $heightImg =  1.92;
  6636.                     }
  6637.                     if ($ordre == 12) {
  6638.                         $positionX 7.7;
  6639.                         $positionY 4.2;
  6640.                         $widthImg 2.5;
  6641.                         $heightImg 1.92;
  6642.                     }
  6643.                     if ($ordre == 13) {
  6644.                         $positionX 7.7;
  6645.                         $positionY 6.54;
  6646.                         $widthImg 2.5;
  6647.                         $heightImg =  1.92;
  6648.                     }
  6649.                     if ($ordre == 14) {
  6650.                         $positionX 7.7;
  6651.                         $positionY 9.06;
  6652.                         $widthImg 2.5;
  6653.                         $heightImg =  1.92;
  6654.                     }
  6655.                     if ($ordre == 15) {
  6656.                         $positionX 7.7;
  6657.                         $positionY 11.58;
  6658.                         $widthImg 2.5;
  6659.                         $heightImg =  1.92;
  6660.                     }
  6661.                 }
  6662.                 if (($i == sizeof($tabphoto) - 1) && ($key != 0)) {
  6663.                     $path 'https://demo.appsfactor.fr/' $path;
  6664.                     $positionX 10.8;
  6665.                     $positionY 1.5;
  6666.                     $widthImg 8.7;
  6667.                     $heightImg 12;
  6668.                     $pdf->Image($path$positionX$positionY$widthImg$heightImg'JPG'''''false1000''falsefalse0falsefalsefalse);
  6669.                 } else {
  6670.                     //Recarder l'image :
  6671.                     // $path=str_replace( 'upload/', 'upload/ar_1.1'.',c_crop/q_auto:good/',$path);<
  6672.                     //                $path=str_replace( 'upload/', 'upload/ar_1,c_crop,x_'.round($left*37.7952755906).',y_'.round($top*37.7952755906).',w_'.round($widthCropPX).',h_'.round($heightCropPX).',g_north_east/',$path);
  6673.                     $pathArray explode("/"$path);
  6674.                     $idsArray explode("."$pathArray[sizeof($pathArray) - 1]);
  6675.                     $idImage "";
  6676.                     foreach ($idsArray as $key2 => $elem) {
  6677.                         if ($key2 != (sizeof($idsArray) - 1)) {
  6678.                             $idImage $idImage $elem;
  6679.                         }
  6680.                     }
  6681.                     //   $cloudinaryWidht=$widthOriginal;
  6682.                     // $cloudinaryHeight=$widthOriginal;
  6683.                     $idImage 'newprod/' $idImage;
  6684.                     //var_dump($idImage);
  6685.                     Unirest\Request::auth('263346742199243''jYw-jg0FOJGv89-o5Wo0Fa3rQWU');
  6686.                     $headers = array('Accept' => 'application/json');
  6687.                     $data = array("public_ids" => array($idImage));
  6688.                     $body Unirest\Request\Body::form($data);
  6689.                     Unirest\Request::verifyPeer(false);
  6690.                     $url 'https://api.cloudinary.com/v1_1/apss-factory/resources/image/upload/' $idImage;
  6691.                     // $resultMetadata=  \Cloudinary::Api.resources_by_ids([$idImage]);
  6692.                     //  var_dump($url);
  6693.                     $resultMetadata Unirest\Request::post($url$headers$body);
  6694.                     var_dump($resultMetadata);
  6695.                     if (isset(json_decode($resultMetadata->raw_body)->width)) {
  6696.                         $cloudinaryWidht json_decode($resultMetadata->raw_body)->width;
  6697.                         $cloudinaryHeight json_decode($resultMetadata->raw_body)->height;
  6698.                     } else {
  6699.                         $cloudinaryWidht $widthOriginal;
  6700.                         $cloudinaryHeight $heightOriginal;
  6701.                     }
  6702.                     $ratiohight $cloudinaryWidht $widthOriginal;
  6703.                     $ratioHight $cloudinaryHeight $heightOriginal;
  6704.                     //$cloudinaryHeight=$cloudinaryHeight*$zoom;
  6705.                     //$cloudinaryWidht=$cloudinaryWidht*$zoom;
  6706.                     var_dump($cloudinaryWidht);
  6707.                     var_dump($cloudinaryHeight);
  6708.                     var_dump($ratioHight);
  6709.                     var_dump($zoom);
  6710.                     $zoom 1;
  6711.                     var_dump($leftOriginal);
  6712.                     var_dump('x_' round(abs($leftOriginal $zoom) * $ratioHight));
  6713.                     var_dump('y_' round(abs($topOriginal $zoom) * $ratiohight));
  6714.                     var_dump('w_' round(($widthCropPX $zoom) * $ratioHight));
  6715.                     var_dump('h_' round(($heightCropPX $zoom) * $ratiohight));
  6716.                     //var_dump($path);i
  6717.                     $path str_replace('upload/''upload/w_' round($cloudinaryWidht) . ',h_' round($cloudinaryHeight) . ',c_scale/x_' round(abs($leftOriginal $zoom) * $ratioHight) . ',y_' round(abs($topOriginal $zoom) * $ratiohight) . ',w_' round(($widthCropPX $zoom) * $ratioHight) . ',h_' round(($heightCropPX $zoom) * $ratiohight) . ',c_crop/'$path);
  6718.                     //var_dump($path);i
  6719.                     //                $path=str_replace( 'upload/', 'upload/w_'.round($widthOriginal).',h_'.round($heightOriginal).'/x_'.round(abs($leftOriginal)).',y_'.round(abs($topOriginal)).',w_'.round($widthCropPX).',h_'.round($heightCropPX).',c_crop/',$path);
  6720.                     //var_dump($path);
  6721.                     $path str_replace("l_Logo5Sur5White_nh6tyk,o_10,fl_relative.tiled,"''$path);
  6722.                     //  var_dump("//00");
  6723.                     //  var_dump("avant 1.4 widh: ".round($widthCropPX)." "."avant 1.4 height : ".round($heightCropPX));
  6724.                     //  var_dump("avant 1.4 top: ".round(abs($top*37.7952755906))." avant 1.4 final left : ".round(abs($left*37.7952755906)));
  6725.                     //    var_dump("//00");
  6726.                     //   var_dump("final widh: ".round($widthCropPX*1.4)." "."final height : ".round($heightCropPX*1.4));
  6727.                     //  var_dump("final top: ".round(abs($top*37.7952755906*1.4))." "."final left : ".round(abs($left*37.7952755906*1.4)));
  6728.                     var_dump($zoom);
  6729.                     var_dump($path);
  6730.                     // $path="https://res.cloudinary.com/apss-factory/image/upload/w_691,h_356,c_crop/a_exif/v1587482806/newprod/crepes-au-chocolat_re9wvk.jpg";
  6731.                     $pdf->Image($path$positionX$positionY$widthImg$heightImg'JPG'''''false1000''falsefalse0falsefalsefalse);
  6732.                     //                $pdf->Rect($positionX,$positionY ,$widthImg, $heightImg, 'F', array(), array(264,200,67));
  6733.                     //
  6734.                 }
  6735.             }
  6736.             //    $pdf->Image('https://demo.appsfactor.fr/images/ClipArt_SVG/Etoilerose.svg',3,  2, 19, 13, 'SVG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
  6737.             for ($i 0$i sizeof($tabtxt); $i++) {
  6738.                 $txt json_decode($tabtxt[$i]);
  6739.                 $fontSize floatval(str_replace('px'''$txt->fontSize)) * 0.75;
  6740.                 //$txt->rotation
  6741.                 $check explode(','$txt->fontFamily);
  6742.                 if (sizeof($check) > 1) {
  6743.                     //default
  6744.                     if (($check[0] == "-apple-system") && ($txt->fontWeight == 400)) {
  6745.                         $finalFont "helvetica";
  6746.                         $weight '';
  6747.                     }
  6748.                     //classique
  6749.                     if (($check[0] == "Georgia") && ($txt->fontWeight == 400)) {
  6750.                         $finalFont "times";
  6751.                         $weight '';
  6752.                     }
  6753.                     //creative
  6754.                     if (($check[0] == "-apple-system") && ($txt->fontWeight == 700)) {
  6755.                         $finalFont "helveticaB";
  6756.                         $weight '';
  6757.                     }
  6758.                     // manuscrite
  6759.                     if (($check[0] == "Comic Sans") && ($txt->fontWeight == 400)) {
  6760.                         $finalFont "Courier";
  6761.                         $weight '';
  6762.                     }
  6763.                     //c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.woff2
  6764.                 } else {
  6765.                     //baton
  6766.                     if (($txt->fontFamily == 'Impact') && ($txt->fontWeight == 400)) {
  6767.                         $finalFont "helveticaB";
  6768.                         $weight 'B';
  6769.                     }
  6770.                 }
  6771.                 $pdf->SetFont($finalFont$weight$fontSize);
  6772.                 $leftTxt $txt->left;
  6773.                 $topTxt $txt->top;
  6774.                 $heightClips $txt->height;
  6775.                 $widthClips $txt->width;
  6776.                 $heightTxt floatval(str_replace('cm'''$heightClips));
  6777.                 $topTxt floatval(str_replace('cm'''$topTxt));
  6778.                 $leftTxt floatval(str_replace('cm'''$leftTxt));
  6779.                 $widthTxt floatval(str_replace('cm'''$widthClips));
  6780.                 if ($key == 0) {
  6781.                     $heightTxt 2;
  6782.                     $widthTxt 7;
  6783.                     $leftTxt = (21) - ($widthTxt 2);
  6784.                     $topTxt 11.8;
  6785.                     $pdf->SetXY(0$topTxttrue);
  6786.                     $pdf->Cell(210trim($txt->contenu), 00'C'0''0);
  6787.                 } else {
  6788.                     $heightTxt 2;
  6789.                     $widthTxt 7;
  6790.                     $leftTxt = (21) - ($widthTxt 2);
  6791.                     $topTxt 11.8;
  6792.                     $pdf->SetXY(13.612.4true);
  6793.                     $pdf->Cell(60trim($txt->contenu), 00'L'0''0);
  6794.                 }
  6795.                 //                    var_dump($leftTxt);
  6796.                 //                  var_dump($topTxt);
  6797.                 // var_dump(floatval(str_replace('rad','',$txt->rotation))*57,2958);
  6798.                 //                var_dump("text");
  6799.                 //$pdf->StartTransform();
  6800.                 //$txt->rotation=0;
  6801.                 //var_dump($txt->rotation);
  6802.                 //var_dump(str_replace('rad','',$txt->rotation));
  6803.                 //var_dump(floatval(str_replace('rad','',$txt->rotation))*57.2958);
  6804.                 // $pdf->Rotate((floatval(str_replace('rad','',$txt->rotation))*57.2958)*-1,$leftTxt+($widthTxt/2),$topTxt+($heightTxt/2));
  6805.                 // $pdf->Rotate(45);
  6806.                 //   $pdf->Text($leftTxt, $topTxt, $txt->contenu);
  6807.                 //$pdf->SetTextColor(200);
  6808.                 //$pdf->Text($leftTxt, $topTxt, $txt->contenu);
  6809.                 // $pdf->MultiCell($leftTxt, $topTxt,  $txt->contenu, 0, $ln=0, 'C', 0, '', 0, false, 'C', 'C');
  6810.                 //                $pdf->Write(str_replace('cm','',$txt->height),trim($txt->contenu));
  6811.                 // $pdf->writeHTML("<p>".$txt->contenu."</p>", true, false, false, false, '');
  6812.                 //$pdf->StopTransform();
  6813.             }
  6814.             //Positionner text
  6815.             //            $pdf->ImageSVG("C:\\Users\\AppsFactor12\\Desktop\\5sur5\\5sur5Sejour\\public\\images\\ClipArt_SVG\\Etoilerose.svg",100,200,500, 500, '', '', '', 0, false);
  6816.             //Positionner clipart
  6817.             //            dd($tabClips);
  6818.             for ($i 0$i sizeof($tabClips); $i++) {
  6819.                 $Clips json_decode($tabClips[$i]);
  6820.                 $heightClips $Clips->height;
  6821.                 $topClips $Clips->top;
  6822.                 $leftClips $Clips->left;
  6823.                 $widthClips $Clips->width;
  6824.                 $path $Clips->path;
  6825.                 $pathClips str_replace('"'''$path);
  6826.                 $heightClips floatval(str_replace('cm'''$heightClips));
  6827.                 $topClips floatval(str_replace('cm'''$topClips));
  6828.                 $leftClips floatval(str_replace('cm'''$leftClips));
  6829.                 $widthClips floatval(str_replace('cm'''$widthClips));
  6830.                 $heightClipsPX round($heightClips 37.7952755906);
  6831.                 $widthClipsPX round($widthClips 37.7952755906);
  6832.                 ////                $positionXclips = $positionX + $leftClips;
  6833.                 ////                $positionYclips = $positionY + $topClips;
  6834.                 //
  6835.                 //$pdf->ImageSVG("images/ClipArt_SVG/Ete4.svg",$leftClips,$topClips,$widthClips, $heightClips);
  6836.                 //https://res.cloudinary.com/apss-factory/image/private/s--EdExAzx8--/v1588758453/GlobeFooter_c4duua.svg
  6837.                 // https://res.cloudinary.com/apss-factory/image/upload/v1588764528/Groupe_113_pcjyj4.png
  6838.                 var_dump($pathClips);
  6839.                 $pdf->StartTransform();
  6840.                 $pdf->Rotate((floatval(str_replace('rad'''$Clips->rotation)) * 57.2958) * -1$leftClips + ($widthClips 2), $topClips + ($heightClips 2));
  6841.                 $pdf->Image($this->newPAthCLipart($pathClips$heightClipsPX$widthClipsPX), $leftClips,  $topClips$widthClips$heightClips''''''false300);
  6842.                 $pdf->StopTransform();
  6843.             }
  6844.         }
  6845.         // echo '</pre>';
  6846.         //return new response("yezi");
  6847.         $projectRoot $this->getParameter('kernel.project_dir');
  6848.         $pdf->Output($projectRoot '/public/pdfDocs/example_' $idPrdt '.pdf''F');
  6849.         return new response("yezi");
  6850.         //return $pdf->Output('example_009.pdf', 'I');
  6851.     }
  6852.     function newPAthCLipart($url$heigh$width)
  6853.     {
  6854.         $allImage = [
  6855.             'Eclaire.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143379/newprod/clipart/Eclaire_pr0ecu.png',
  6856.             'ARcenciel.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143391/newprod/clipart/ARcenciel_grkyap.png',
  6857.             'Drapeaux.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143377/newprod/clipart/Drapeaux_zqo8v3.png',
  6858.             'Annif.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143391/newprod/clipart/Annif_ihvyoo.png',
  6859.             'Basquettes.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143377/newprod/clipart/Basquettes_znjd41.png',
  6860.             'Foot.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143382/newprod/clipart/Foot_az6bct.png',
  6861.             'Hello.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143383/newprod/clipart/Hello_njqifl.png',
  6862.             'Love.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143386/newprod/clipart/Love_q39usk.png',
  6863.             'LICORNE.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143385/newprod/clipart/LICORNE_hpomru.png',
  6864.             'Noeud.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143388/newprod/clipart/Noeud_mw5a4j.png',
  6865.             'Etoilerose.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143380/newprod/clipart/Etoilerose_ewrzff.png',
  6866.             'Ete4.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143379/newprod/clipart/Ete4_pdxadk.png',
  6867.             'Ete6.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143380/newprod/clipart/Ete6_a3xgpd.png',
  6868.             'Ete9.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143380/newprod/clipart/Ete9_s4vllm.png',
  6869.             'Hiver1.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143384/newprod/clipart/Hiver1_fekrjz.png',
  6870.             'Hiver2.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143384/newprod/clipart/Hiver2_e9iygg.png',
  6871.             'Noel2.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143387/newprod/clipart/Noel2_eqvdzr.png',
  6872.             'Hiver.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143383/newprod/clipart/Hiver_et04e1.png',
  6873.             'Sapin.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143390/newprod/clipart/Sapin_qjkxz6.png',
  6874.             'Chaussetet.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143377/newprod/clipart/Chaussetet_xfpt6t.png',
  6875.             'Cloches.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143377/newprod/clipart/Cloches_x2v3eo.png',
  6876.             'Like.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143387/newprod/clipart/Like_ynxb2u.png',
  6877.             'coeurlike.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143379/newprod/clipart/coeurlike_ferv9y.png',
  6878.             'Fetedesmeres.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/w_' $width '/upload/v1589143383/newprod/clipart/Fetedesmeres_ud9vac.png',
  6879.             'Fetedesperes.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/w_' $width '/upload/v1589143384/newprod/clipart/Fetedesperes_mltjmo.png',
  6880.             'OOPS.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143389/newprod/clipart/OOPS_gj9p1c.png',
  6881.             'OOPS_1.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143389/newprod/clipart/OOPS_1_r9a7l6.png',
  6882.             'WoW.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143393/newprod/clipart/WoW_ljlqjm.png',
  6883.             'Nuage.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143387/newprod/clipart/Nuage_fgomd0.png',
  6884.             'Pingouin.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143389/newprod/clipart/Pingouin_ogxb6e.png',
  6885.             'Renard.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143378/newprod/clipart/Chouette_mc1ik2.png',
  6886.             'Chouette.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143390/newprod/clipart/Renard_mlhrxt.png'
  6887.         ];
  6888.         //http://127.0.0.1:8000/images/ClipArt_SVG/LICORNE.svg
  6889.         $arryUrls explode('/'$url);
  6890.         return ($allImage[$arryUrls[sizeof($arryUrls) - 1]]);
  6891.     }
  6892.     /**
  6893.      * @Route("/Parent/TcPdfCalcul/{idPrdt}", name="TcPdfCalc")
  6894.      */
  6895.     public function TcPdfCalcule($idPrdt)
  6896.     {
  6897.         echo '<pre>';
  6898.         ini_set("max_execution_time", -1);
  6899.         $pageLayout = array(2115);
  6900.         $pdf $this->get("white_october.tcpdf")->create('L''CM'$pageLayouttrue'UTF-8'false);
  6901.         // set document information
  6902.         $pdf->SetCreator(PDF_CREATOR);
  6903.         $pdf->SetAuthor('Nicola Asuni');
  6904.         $pdf->SetTitle('TCPDF Example 009');
  6905.         $pdf->SetSubject('TCPDF Tutorial');
  6906.         $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
  6907.         $pdf->SetSubject('TCPDF Tutorial');
  6908.         $pdf->setPrintHeader(false);
  6909.         $pdf->setPrintFooter(false);
  6910.         // set image scale factor
  6911.         $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
  6912.         //        $pdf->AddPage();
  6913.         $pdf->setJPEGQuality(100);
  6914.         $horizontal_alignments = array('L''C''R');
  6915.         $vertical_alignments = array('T''M''B');
  6916.         //var_dump($pdf->getPageWidth());
  6917.         //var_dump($pdf->getPageHeight());die();
  6918.         $em $this->em;
  6919.         $Album $em->getRepository(Produit::class)->findOneBy(['id' => $idPrdt]);
  6920.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Album]);
  6921.         //dd($AllPages);
  6922.         //        $fP=[];
  6923.         //        array_push($fP,$AllPages[0]);
  6924.         //dd($AllPages);
  6925.         foreach ($AllPages as $p) {
  6926.             $pdf->AddPage();
  6927.             $pdf->setJPEGQuality(100);
  6928.             $contenu json_decode(json_decode($p->getCouleurbordure())[0]);
  6929.             $nbatach $contenu->nbrAttc;
  6930.             $nbatach intval(str_replace('"'''$nbatach));
  6931.             $color =  $contenu->color;
  6932.             // $color="rgb(255,255,255)";
  6933.             $color str_replace('"rgb('''$color);
  6934.             $color str_replace(')"'''$color);
  6935.             $color explode(","$color);
  6936.             $colorp = array(intval($color[0]), intval($color[1]), intval($color[2]));
  6937.             $tabtxt json_decode($contenu->txt);
  6938.             $tabphoto json_decode($contenu->attache);
  6939.             //
  6940.             //dd($tabtxt);
  6941.             //         dd($tabtxt);
  6942.             //dd($tabphoto);
  6943.             $tabClips json_decode($contenu->clips);
  6944.             // dd($tabClips);
  6945.             $x 0.6;
  6946.             $y 0.8;
  6947.             $w 19.8;
  6948.             $h 13.4;
  6949.             // get the current page break margin
  6950.             $bMargin $pdf->getBreakMargin();
  6951.             // get current auto-page-break mode
  6952.             $auto_page_break $pdf->getAutoPageBreak();
  6953.             // disable auto-page-break
  6954.             $pdf->SetAutoPageBreak(false0);
  6955.             // test all combinations of alignments
  6956.             $fitbox $horizontal_alignments[1] . ' ';
  6957.             $fitbox[1] = $vertical_alignments[1];
  6958.             $pdf->Rect(002115'F', array(), $colorp);
  6959.             //    sizeof($tabphoto)
  6960.             for ($i 0$i sizeof($tabphoto); $i++) {
  6961.                 $photo json_decode($tabphoto[$i]);
  6962.                 //les coordonnées de l'image réel:
  6963.                 $hght $photo->height;
  6964.                 $top $photo->top;
  6965.                 $left $photo->left;
  6966.                 $width $photo->width;
  6967.                 $ordre $photo->ordre;
  6968.                 $zoom $photo->zoom;
  6969.                 $path $photo->path;
  6970.                 $hght floatval(str_replace('cm'''$hght));
  6971.                 $top floatval(str_replace('cm'''$top));
  6972.                 $left floatval(str_replace('cm'''$left));
  6973.                 $width floatval(str_replace('cm'''$width));
  6974.                 //les coordonnées dropzone:
  6975.                 $heightOriginal $photo->height;
  6976.                 $widthOriginal $photo->width;
  6977.                 $top $photo->top;
  6978.                 $left $photo->left;
  6979.                 $heightOriginal floatval(str_replace('cm'''$heightOriginal));
  6980.                 $widthOriginal floatval(str_replace('cm'''$widthOriginal));
  6981.                 $top floatval(str_replace('cm'''$top));
  6982.                 $left floatval(str_replace('cm'''$left));
  6983.                 $heightOriginal $heightOriginal 37.7952755906;
  6984.                 $widthOriginal $widthOriginal 37.7952755906;
  6985.                 $topOriginal $top 37.7952755906;
  6986.                 $leftOriginal $left 37.7952755906;
  6987.                 $heightCrop $photo->heightCrop;
  6988.                 $topCrop $photo->topCrop;
  6989.                 $leftCrop $photo->leftCrop;
  6990.                 $widthCrop $photo->widthCrop;
  6991.                 $path $photo->path;
  6992.                 $heightCrop floatval(str_replace('cm'''$heightCrop));
  6993.                 $topCrop floatval(str_replace('cm'''$topCrop));
  6994.                 $leftCrop floatval(str_replace('cm'''$leftCrop));
  6995.                 $widthCrop floatval(str_replace('cm'''$widthCrop));
  6996.                 $widthCropPX $widthCrop 37.7952755906;
  6997.                 $heightCropPX $heightCrop 37.7952755906;
  6998.                 $topCropPX $topCrop 37.7952755906;
  6999.                 $leftCropPX $leftCrop 37.7952755906;
  7000.                 var_dump("original widh: " $widthCrop " " "original height : " $heightCrop);
  7001.                 var_dump("original left: " $topCrop " " "original top : " $leftCrop);
  7002.                 var_dump("//00");
  7003.                 var_dump("multip 37 widh: " $widthCropPX " " "multip 37 height : " $heightCropPX);
  7004.                 var_dump("multip 37 top: " $topOriginal " " "multip 37 left : " $leftOriginal);
  7005.                 //Calculer position des images selon nombres images par page:
  7006.                 $positionX 0;
  7007.                 $positionY 0;
  7008.                 $widthImg 0;
  7009.                 $heightImg 0;
  7010.                 if ($nbatach == 1) {
  7011.                     $positionX 1.5;
  7012.                     $positionY 1.5;
  7013.                     $widthImg 18;
  7014.                     $heightImg 12;
  7015.                 } elseif ($nbatach == 2) {
  7016.                     if ($ordre == 1) {
  7017.                         $positionX 1.5;
  7018.                         $positionY 1.5;
  7019.                         $widthImg 8.5;
  7020.                         $heightImg 12;
  7021.                     }
  7022.                     if ($ordre == 2) {
  7023.                         $positionX 11;
  7024.                         $positionY 1.5;
  7025.                         $widthImg 8.5;
  7026.                         $heightImg 12;
  7027.                     }
  7028.                 } elseif ($nbatach == 3) {
  7029.                     if ($ordre == 1) {
  7030.                         $positionX 1.5;
  7031.                         $positionY 1.5;
  7032.                         $widthImg 8.5;
  7033.                         $heightImg 12;
  7034.                     }
  7035.                     if ($ordre == 2) {
  7036.                         $positionX 11;
  7037.                         $positionY 1.5;
  7038.                         $widthImg 8.5;
  7039.                         $heightImg 5.5;
  7040.                     }
  7041.                     if ($ordre == 3) {
  7042.                         $positionX 11;
  7043.                         $positionY 8;
  7044.                         $widthImg 8.5;
  7045.                         $heightImg 5.5;
  7046.                     }
  7047.                 } elseif ($nbatach == 4) {
  7048.                     if ($ordre == 1) {
  7049.                         $positionX 1.5;
  7050.                         $positionY 1.5;
  7051.                         $widthImg 8.5;
  7052.                         $heightImg 5.5;
  7053.                     }
  7054.                     if ($ordre == 2) {
  7055.                         $positionX 1.5;
  7056.                         $positionY 8;
  7057.                         $widthImg 8.5;
  7058.                         $heightImg 5.5;
  7059.                     }
  7060.                     if ($ordre == 3) {
  7061.                         $positionX 11;
  7062.                         $positionY 1.5;
  7063.                         $widthImg 8.5;
  7064.                         $heightImg 5.5;
  7065.                     }
  7066.                     if ($ordre == 4) {
  7067.                         $positionX 11;
  7068.                         $positionY 8;
  7069.                         $widthImg 8.5;
  7070.                         $heightImg 5.5;
  7071.                     }
  7072.                 } elseif ($nbatach == 5) {
  7073.                     if ($ordre == 1) {
  7074.                         $positionX 1.5;
  7075.                         $positionY 1.5;
  7076.                         $widthImg 18;
  7077.                         $heightImg 8;
  7078.                     }
  7079.                     if ($ordre == 2) {
  7080.                         $positionX 1.5;
  7081.                         $positionY 10.5;
  7082.                         $widthImg 3.75;
  7083.                         $heightImg 4;
  7084.                     }
  7085.                     if ($ordre == 3) {
  7086.                         $positionX 6.25;
  7087.                         $positionY 10.5;
  7088.                         $widthImg 3.75;
  7089.                         $heightImg 4;
  7090.                     }
  7091.                     if ($ordre == 4) {
  7092.                         $positionX 11;
  7093.                         $positionY 10.5;
  7094.                         $widthImg 3.75;
  7095.                         $heightImg 4;
  7096.                     }
  7097.                     if ($ordre == 5) {
  7098.                         $positionX 15.75;
  7099.                         $positionY 10.5;
  7100.                         $widthImg 3.75;
  7101.                         $heightImg 4;
  7102.                     }
  7103.                 } elseif ($nbatach == 6) {
  7104.                     if ($ordre == 1) {
  7105.                         $positionX 1.5;
  7106.                         $positionY 1.5;
  7107.                         $widthImg 5.33;
  7108.                         $heightImg 3.33;
  7109.                     }
  7110.                     if ($ordre == 2) {
  7111.                         $positionX 1.5;
  7112.                         $positionY 5.83;
  7113.                         $widthImg == 5.33;
  7114.                         $heightImg 3.33;
  7115.                     }
  7116.                     if ($ordre == 3) {
  7117.                         $positionX 1.5;
  7118.                         $positionY 10.16;
  7119.                         $widthImg 5.33;
  7120.                         $heightImg 3.33;
  7121.                     }
  7122.                     if ($ordre == 4) {
  7123.                         $positionX 7.83;
  7124.                         $positionY 1.5;
  7125.                         $widthImg == 5.33;
  7126.                         $heightImg 3.33;
  7127.                     }
  7128.                     if ($ordre == 5) {
  7129.                         $positionX 7.83;
  7130.                         $positionY 5.83;
  7131.                         $widthImg == 5.33;
  7132.                         $heightImg 3.33;
  7133.                     }
  7134.                     if ($ordre == 6) {
  7135.                         $positionX 7.83;
  7136.                         $positionY 10.16;
  7137.                         $widthImg == 5.33;
  7138.                         $heightImg 3.33;
  7139.                     }
  7140.                 } elseif ($nbatach == 12) {
  7141.                     if ($ordre == 1) {
  7142.                         $positionX 1.5;
  7143.                         $positionY 1.5;
  7144.                         $widthImg 3.75;
  7145.                         $heightImg 3.33;
  7146.                     }
  7147.                     if ($ordre == 2) {
  7148.                         $positionX 1.5;
  7149.                         $positionY 5.83;
  7150.                         $widthImg 3.75;
  7151.                         $heightImg 3.33;
  7152.                     }
  7153.                     if ($ordre == 3) {
  7154.                         $positionX 1.5;
  7155.                         $positionY 10.16;
  7156.                         $widthImg 3.75;
  7157.                         $heightImg 3.33;
  7158.                     }
  7159.                     if ($ordre == 4) {
  7160.                         $positionX 6.25;
  7161.                         $positionY 1.5;
  7162.                         $widthImg 3.75;
  7163.                         $heightImg 3.33;
  7164.                     }
  7165.                     if ($ordre == 5) {
  7166.                         $positionX 6.25;
  7167.                         $positionY 5.83;
  7168.                         $widthImg 3.75;
  7169.                         $heightImg 3.33;
  7170.                     }
  7171.                     if ($ordre == 6) {
  7172.                         $positionX 6.25;
  7173.                         $positionY 10.16;
  7174.                         $widthImg 3.75;
  7175.                         $heightImg 3.33;
  7176.                     }
  7177.                     if ($ordre == 7) {
  7178.                         $positionX 11;
  7179.                         $positionY 1.5;
  7180.                         $widthImg 3.75;
  7181.                         $heightImg 3.33;
  7182.                     }
  7183.                     if ($ordre == 8) {
  7184.                         $positionX 11;
  7185.                         $positionY 5.83;
  7186.                         $widthImg 3.75;
  7187.                         $heightImg 3.33;
  7188.                     }
  7189.                     if ($ordre == 9) {
  7190.                         $positionX 11;
  7191.                         $positionY 10.16;
  7192.                         $widthImg 3.75;
  7193.                         $heightImg 3.33;
  7194.                     }
  7195.                     if ($ordre == 10) {
  7196.                         $positionX 15.75;
  7197.                         $positionY 1.5;
  7198.                         $widthImg 3.75;
  7199.                         $heightImg 3.33;
  7200.                     }
  7201.                     if ($ordre == 11) {
  7202.                         $positionX 15.75;
  7203.                         $positionY 5.83;
  7204.                         $widthImg 3.75;
  7205.                         $heightImg 3.33;
  7206.                     }
  7207.                     if ($ordre == 12) {
  7208.                         $positionX 15.75;
  7209.                         $positionY 10.16;
  7210.                         $widthImg 3.75;
  7211.                         $heightImg 3.33;
  7212.                     }
  7213.                 }
  7214.                 //Recarder l'image :
  7215.                 // $path=str_replace( 'upload/', 'upload/ar_1.1'.',c_crop/q_auto:good/',$path);<
  7216.                 //                $path=str_replace( 'upload/', 'upload/ar_1,c_crop,x_'.round($left*37.7952755906).',y_'.round($top*37.7952755906).',w_'.round($widthCropPX).',h_'.round($heightCropPX).',g_north_east/',$path);
  7217.                 $path str_replace("l_Logo5Sur5White_nh6tyk,o_10,fl_relative.tiled,"''$path);
  7218.                 //var_dump($api);
  7219.                 $pathArray explode("/"$path);
  7220.                 $idsArray explode("."$pathArray[sizeof($pathArray) - 1]);
  7221.                 $idImage "";
  7222.                 foreach ($idsArray as $key2 => $elem) {
  7223.                     if ($key2 != (sizeof($idsArray) - 1)) {
  7224.                         $idImage $idImage $elem;
  7225.                     }
  7226.                 }
  7227.                 $idImage 'newprod/' $idImage;
  7228.                 var_dump($idImage);
  7229.                 Unirest\Request::auth('263346742199243''jYw-jg0FOJGv89-o5Wo0Fa3rQWU');
  7230.                 $headers = array('Accept' => 'application/json');
  7231.                 $data = array("public_ids" => array($idImage));
  7232.                 $body Unirest\Request\Body::form($data);
  7233.                 Unirest\Request::verifyPeer(false);
  7234.                 $url 'https://api.cloudinary.com/v1_1/apss-factory/resources/image/upload/' $idImage;
  7235.                 // $resultMetadata=  \Cloudinary::Api.resources_by_ids([$idImage]);
  7236.                 var_dump($url);
  7237.                 $resultMetadata Unirest\Request::post($url$headers$body);
  7238.                 var_dump($resultMetadata->raw_body);
  7239.                 if (isset(json_decode($resultMetadata->raw_body)->width)) {
  7240.                     $cloudinaryWidht json_decode($resultMetadata->raw_body)->width;
  7241.                     $cloudinaryHeight json_decode($resultMetadata->raw_body)->height;
  7242.                 } else {
  7243.                     $cloudinaryWidht $widthOriginal;
  7244.                     $cloudinaryHeight $heightOriginal;
  7245.                 }
  7246.                 $ratiohight $cloudinaryWidht $widthOriginal;
  7247.                 $ratioHight $cloudinaryHeight $heightOriginal;
  7248.                 $path str_replace('upload/''upload/w_' round($cloudinaryWidht) . ',h_' round($cloudinaryHeight) . '/x_' round(abs($leftOriginal $ratioHight) / $zoom) . ',y_' round(abs($topOriginal $ratiohight) / $zoom) . ',w_' round(($widthCropPX $ratioHight) / $zoom) . ',h_' round(($heightCropPX $ratiohight) / $zoom) . ',c_crop/'$path);
  7249.                 //var_dump($path);i
  7250.                 var_dump("//00");
  7251.                 var_dump("avant 1.4 widh: " round($widthCropPX) . " " "avant 1.4 height : " round($heightCropPX));
  7252.                 var_dump("avant 1.4 top: " round(abs($top 37.7952755906)) . " avant 1.4 final left : " round(abs($left 37.7952755906)));
  7253.                 var_dump("//00");
  7254.                 var_dump("final widh: " round($widthCropPX 1.4) . " " "final height : " round($heightCropPX 1.4));
  7255.                 var_dump("final top: " round(abs($top 37.7952755906 1.4)) . " " "final left : " round(abs($left 37.7952755906 1.4)));
  7256.                 var_dump("//00");
  7257.                 var_dump($path);
  7258.                 // $path="https://res.cloudinary.com/apss-factory/image/upload/w_691,h_356,c_crop/a_exif/v1587482806/newprod/crepes-au-chocolat_re9wvk.jpg";
  7259.                 $pdf->Image($path$positionX$positionY$widthImg$heightImg'JPG'''''false300''falsefalse0$fitboxfalsefalse);
  7260.                 //                $pdf->Rect($positionX,$positionY ,$widthImg, $heightImg, 'F', array(), array(264,200,67));
  7261.                 //
  7262.                 $pdf->SetY(-6);
  7263.                 // Set font
  7264.                 $pdf->SetFont('helvetica''I'8);
  7265.                 // Page number
  7266.                 $pdf->Cell(010'Page ' $pdf->getAliasNumPage() . '/' $pdf->getAliasNbPages(), 0false'C'0''0false'T''M');
  7267.                 $pdf->SetFont('helvetica''B'8);
  7268.                 $pdf->SetXY(11);
  7269.             }
  7270.             //    $pdf->Image('https://demo.appsfactor.fr/images/ClipArt_SVG/Etoilerose.svg',3,  2, 19, 13, 'SVG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
  7271.             for ($i 0$i sizeof($tabtxt); $i++) {
  7272.                 $txt json_decode($tabtxt[$i]);
  7273.                 $pdf->SetFont('helvetica''B'$txt->fontSize);
  7274.                 $leftTxt $txt->left;
  7275.                 $topTxt $txt->top;
  7276.                 //                $heightClips = floatval(str_replace('cm', '', $heightClips));
  7277.                 $topTxt floatval(str_replace('cm'''$topTxt));
  7278.                 $leftTxt floatval(str_replace('cm'''$leftTxt));
  7279.                 //                $widthClips = floatval(str_replace('cm', '', $widthClips));
  7280.                 $pdf->SetXY($leftTxt 1.2$topTxt 1);
  7281.                 $pdf->Write(0$txt->contenu''0'L'true0falsefalse0);
  7282.             }
  7283.             //Positionner text
  7284.             //            $pdf->ImageSVG("C:\\Users\\AppsFactor12\\Desktop\\5sur5\\5sur5Sejour\\public\\images\\ClipArt_SVG\\Etoilerose.svg",100,200,500, 500, '', '', '', 0, false);
  7285.             //Positionner clipart
  7286.             //            dd($tabClips);
  7287.             //            for($i=0;$i <sizeof($tabClips);$i++) {
  7288.             //                $Clips = json_decode($tabClips[$i]);
  7289.             //                $heightClips = $Clips->height;
  7290.             //                $topClips = $Clips->top;
  7291.             //                $leftClips = $Clips->left;
  7292.             //                $widthClips = $Clips->width;
  7293.             //                $path = $Clips->path;
  7294.             //                $pathClips = str_replace('http://127.0.0.1:8000/', 'https://demo.appsfactor.fr/', $path);
  7295.             //
  7296.             //                $heightClips = floatval(str_replace('cm', '', $heightClips));
  7297.             //                $topClips = floatval(str_replace('cm', '', $topClips));
  7298.             //                $leftClips = floatval(str_replace('cm', '', $leftClips));
  7299.             //                $widthClips = floatval(str_replace('cm', '', $widthClips));
  7300.             //
  7301.             ////                $positionXclips = $positionX + $leftClips;
  7302.             ////                $positionYclips = $positionY + $topClips;
  7303.             //
  7304.             //              $pdf->ImageSVG("images/ClipArt_SVG/Etoilerose.svg",100,200,500, 500, '', '', '', 0, false);
  7305.             //
  7306.             ////                $pdf->Image($path,$leftClips,  $topClips, $widthClips, $heightClips, 'SVG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
  7307.             //
  7308.             //            }
  7309.         }
  7310.         echo '</pre>';
  7311.         return new response("yezi");
  7312.         //  return $pdf->Output('example_009.pdf', 'I');
  7313.     }
  7314.     /**
  7315.      * @Route("/Parent/suprimerproduitAcompa", name="suprimerproduitAcompa_parent")
  7316.      */
  7317.     public function suprimerproduitAcompa(Request $request)
  7318.     {
  7319.         $em $this->em;
  7320.         $user $this->getUser();
  7321.         $p $request->get("p");
  7322.         $Album $em->getRepository(Produit::class)->find($p);
  7323.         $Album->setDelated(1);
  7324.         $em->getManager()->persist($Album);
  7325.         $em->getManager()->flush();
  7326.         return new Response('yoopi');
  7327.     }
  7328.     /**
  7329.      * @Route("/Parent/saveDiaporamaParent", name="saveDiaporamaParent")
  7330.      */
  7331.     public function saveDiaporamaParent()
  7332.     {
  7333.         $session $this->session;
  7334.         $idSejour $session->get("Sejour");
  7335.         /** @var \App\Entity\User $userId */
  7336.         $userId $this->getUser();
  7337.         $sejourobj $this->em->getRepository(Sejour::class)->find($idSejour);
  7338.         $prodct $this->em->getRepository(Typeproduit::class)->find(19);
  7339.         $produit $this->em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $userId->getId()]);
  7340.         if ($produit !== null && $produit !== "") {
  7341.             $produit->setLabele("Diaporama");
  7342.             $produit->setIduser($userId);
  7343.             $produit->setIdsjour($sejourobj);
  7344.             $produit->setType($prodct);
  7345.         } else {
  7346.             $produit = new Produit;
  7347.             $produit->setLabele("Diaporama");
  7348.             $produit->setIduser($userId);
  7349.             $produit->setIdsjour($sejourobj);
  7350.             $produit->setType($prodct);
  7351.             $produit->setDate(new \DateTime());
  7352.         }
  7353.         $this->em->getManager()->persist($produit);
  7354.         $this->em->getManager()->flush();
  7355.         return new Response('disporama saved');
  7356.     }
  7357.     /**
  7358.      * @Route("/Parent/appActiveAcompt/{id}", name="appActiveAcompt")
  7359.      */
  7360.     public function ActiveAcounnt($id)
  7361.     {
  7362.         $user $this->em->getRepository(User::class)->find($id);
  7363.         $user->setActivatemail(1);
  7364.         $this->em->getManager()->persist($user);
  7365.         $this->em->getManager()->flush();
  7366.         
  7367.         // AUTO-LOGIN DIRECT (même implémentation que les accompagnateurs)
  7368.         $providerKey 'main_Parent'// your firewall name
  7369.         $token = new UsernamePasswordToken($usernull$providerKey$user->getRoles());
  7370.         $this->container->get('security.token_storage')->setToken($token);
  7371.         
  7372.         return $this->redirectToRoute('CodeSejour');
  7373.     }
  7374.     /**
  7375.      * @Route("/Parent/Album_du_Sejour", name="Album_du_Sejour")
  7376.      */
  7377.     function ActiverSessionAlbum()
  7378.     {
  7379.         $SEjourService $this->sejourService;
  7380.         /** @var \App\Entity\User $user */
  7381.         $user $this->getUser();
  7382.         $userId $user->getId();
  7383.         $session $this->session;
  7384.         $session->set('pageMenu''');
  7385.         $idSejour $session->get("Sejour");
  7386.         $sejour $SEjourService->getsejourpourparent($idSejour);
  7387.         $em $this->em;
  7388.         $AllPages null;
  7389.         $random false;
  7390.         $idAcc $sejour->getIdAcommp();
  7391.           $Albumproduct $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'Album_sejour']);
  7392.         if ($Albumproduct == null) {
  7393.             $Albumproduct $this->em->getRepository(Produit::class)->findOneBy(['iduser' => 1'statut' => "Album_sejour"'idsjour' => $sejour]);
  7394.         }
  7395.         if ($Albumproduct != null and $Albumproduct != "") {
  7396.             $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  7397.         }
  7398.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  7399.         $nbLikes count($listeattachlikephoto);
  7400.         $part $sejour->getIdPartenaire();
  7401.         $nompart $part->getUsername();
  7402.         $logopart $part->getLogourl();
  7403.         $session->set('produit'$Albumproduct->gettype());
  7404.         return $this->render('Parent/AlbumSejour.html.twig', ["nompart" => $nompart"logopart" => $logopart"sejour" => $sejour,  'cliparts' => null'Album' => $Albumproduct'AllPages' => $AllPages'albumAcc' => null'AllPagesAcc' => null'random' => $random'nbLikes' => $nbLikes]);
  7405.     }
  7406.     /**
  7407.      * @Route("/Parent/Editer_Album_du_Sejour", name="Editer_Album_du_Sejour")
  7408.      */
  7409.     function EditerSessionAlbum()
  7410.     {
  7411.         $SEjourService $this->sejourService;
  7412.         /** @var \App\Entity\User $user */
  7413.         $user $this->getUser();
  7414.         $userId $user->getId();
  7415.         $session $this->session;
  7416.         $session->set('pageMenu''');
  7417.         $idSejour $session->get("Sejour");
  7418.         $sejour $SEjourService->getsejourpourparent($idSejour);
  7419.         $em $this->em;
  7420.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  7421.         $nbLikes count($listeattachlikephoto);
  7422.         $AllPages null;
  7423.         $random false;
  7424.         $idAcc $sejour->getIdAcommp();
  7425.           $Albumproduct $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'Album_sejour']);
  7426.         if ($Albumproduct == null) {
  7427.             $Albumproduct $this->em->getRepository(Produit::class)->findOneBy(['iduser' => 1'statut' => "Album_sejour"'idsjour' => $sejour]);
  7428.         }
  7429.         if ($Albumproduct != null and $Albumproduct != "") {
  7430.             $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  7431.         }
  7432.         $allpagesResult = array();
  7433.         $tabacc = array();
  7434.         $tabacc1 = array();
  7435.         foreach ($AllPages as $page) {
  7436.             $pageJ json_decode($page->getCouleurbordure());
  7437.             $pageDec json_decode($pageJ[0]);
  7438.             $attache json_decode($pageDec->attache);
  7439.             if (isset($attache[0])) {
  7440.                 $attachDec json_decode($attache[0]);
  7441.             }
  7442.             //var_dump($attachDec);
  7443.             //var_dump(json_decode($attachDec->id));
  7444.             if (isset($attachDec->id) && json_decode($attachDec->id) !== null && $attachDec->id !== '') {
  7445.                 $idAttach json_decode($attachDec->id);
  7446.                 array_push($tabacc$idAttach);
  7447.             }
  7448.         }
  7449.         $tabacc1 array_count_values($tabacc);
  7450.         $part $sejour->getIdPartenaire();
  7451.         $nompart $part->getUsername();
  7452.         $logopart $part->getLogourl();
  7453.         $session->set('produit'$Albumproduct->gettype());
  7454.         $listeattach $SEjourService->getatachmentsejour($idSejour);
  7455.         $nbPhoto count($listeattach);
  7456.         return $this->render('Parent/NewAlbumLikes.html.twig', ["listeattach" => $listeattach"tabacc" => $tabacc1"nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'like' => $listeattachlikephoto'cliparts' => null'Album' => $Albumproduct'AllPages' => $AllPages'albumAcc' => null'AllPagesAcc' => null'random' => $random'nbLikes' => $nbLikes'nbPhoto' => $nbPhoto]);
  7457.     }
  7458.     /**
  7459.      * @Route("/Parent/Editer_Livre_du_Sejour", name="Editer_Livre_du_Sejour")
  7460.      */
  7461.     function EditerSessionLivre()
  7462.     {
  7463.         $SEjourService $this->sejourService;
  7464.         /** @var \App\Entity\User $user */
  7465.         $user $this->getUser();
  7466.         $userId $user->getId();
  7467.         $session $this->session;
  7468.         $session->set('pageMenu''');
  7469.         $idSejour $session->get("Sejour");
  7470.         $sejour $SEjourService->getsejourpourparent($idSejour);
  7471.         $em $this->em;
  7472.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  7473.         $nbLikes count($listeattachlikephoto);
  7474.         $AllPages null;
  7475.         $random false;
  7476.         $idAcc $sejour->getIdAcommp();
  7477.         $Albumproduct $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  7478.         if ($Albumproduct == null) {
  7479.             $Albumproduct $em->getRepository(Produit::class)->findOneBy(['version' => 'Livre_Sejour_Admin''idsjour' =>   $idSejour]);
  7480.         }
  7481.         if ($Albumproduct == null) {
  7482.             $Albumproduct $em->getRepository(Produit::class)->findOneBy(['labele' => 'randomLivre']);
  7483.         }
  7484.         if ($Albumproduct != null and $Albumproduct != "") {
  7485.             $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  7486.         }
  7487.         $allpagesResult = array();
  7488.         $tabacc = array();
  7489.         $tabacc1 = array();
  7490.         foreach ($AllPages as $page) {
  7491.             $pageJ json_decode($page->getCouleurbordure());
  7492.             $pageDec json_decode($pageJ[0]);
  7493.             $attache json_decode($pageDec->attache);
  7494.             if (isset($attache[0])) {
  7495.                 $attachDec json_decode($attache[0]);
  7496.             }
  7497.             //var_dump($attachDec);
  7498.             //var_dump(json_decode($attachDec->id));
  7499.             if (isset($attachDec->id) && json_decode($attachDec->id) !== null && $attachDec->id !== '') {
  7500.                 $idAttach json_decode($attachDec->id);
  7501.                 array_push($tabacc$idAttach);
  7502.             }
  7503.         }
  7504.         $tabacc1 array_count_values($tabacc);
  7505.         $part $sejour->getIdPartenaire();
  7506.         $nompart $part->getUsername();
  7507.         $logopart $part->getLogourl();
  7508.         $session->set('produit'$Albumproduct->gettype());
  7509.         $listeattach $SEjourService->getatachmentsejour($idSejour);
  7510.         $nbPhoto count($listeattach);
  7511.         return $this->render('Parent/NewLivreLikes.html.twig', ["listeattach" => $listeattach"tabacc" => $tabacc1"nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'like' => $listeattachlikephoto'cliparts' => null'Album' => $Albumproduct'AllPages' => $AllPages'albumAcc' => null'AllPagesAcc' => null'random' => $random'nbLikes' => $nbLikes'nbPhoto' => $nbPhoto]);
  7512.     }
  7513.     /**
  7514.      * @Route("/Parent/DesactiverSessionAlbum", name="DesactiverSessionAlbum")
  7515.      */
  7516.     function DesactiverSessionAlbum()
  7517.     {
  7518.         $session $this->session;
  7519.         $session->remove('sessionalbm');
  7520.         return new Response('session removed');
  7521.     }
  7522.     /**
  7523.      * @Route("/Parent/Mon_Compte_Activer", name="Mon_Compte_Activer")
  7524.      */
  7525.     public function Mon_Compte_Activer(Request $request)
  7526.     {
  7527.         $em $this->em;
  7528.         return $this->render('Parent/activeMoncompte.html.twig');
  7529.     }
  7530.     /**
  7531.      * @Route("/Parent/swuitchSejour/{id}", name="swuitchSejour")
  7532.      */
  7533.     public function swuitchSejour($id)
  7534.     {
  7535.         $em $this->em;
  7536.         $sejourobj $this->em->getRepository(Sejour::class)->find($id);
  7537.         $this->session->set('Sejour'$sejourobj->getId());
  7538.         return $this->redirectToRoute('AccueilParent');
  7539.     }
  7540.     /**
  7541.      * @Route("/migrationCloudinary", name="migrationCloudinary")
  7542.      */
  7543.     public function cloudinaryMigration()
  7544.     {
  7545.         $em $this->em;
  7546.         //        $path="https://res.cloudinary.com/apss-factory/image/upload/a_exif/v1588979564/newprod/JUEGOS-EN-LA-PLAYA5_dnvgj8.jpg";
  7547.         $attachement = [
  7548.             'Eclaire.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143379/newprod/clipart/Eclaire_pr0ecu.svg',
  7549.             'ARcenciel.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143391/newprod/clipart/ARcenciel_grkyap.svg',
  7550.             'Drapeaux.svg' => 'https://res.cloudinary.com/apss-factory/image/uploadv/1589143377/newprod/clipart/Drapeaux_zqo8v3.svg',
  7551.             'Annif.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143391/newprod/clipart/Annif_ihvyoo.svg',
  7552.             'Basquettes.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143377/newprod/clipart/Basquettes_znjd41.svg',
  7553.             'Foot.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143382/newprod/clipart/Foot_az6bct.svg',
  7554.             'Hello.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143383/newprod/clipart/Hello_njqifl.svg',
  7555.             'Love.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143386/newprod/clipart/Love_q39usk.svg',
  7556.             'LICORNE.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143385/newprod/clipart/LICORNE_hpomru.svg',
  7557.             'Noeud.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143388/newprod/clipart/Noeud_mw5a4j.svg',
  7558.             'Etoilerose.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143380/newprod/clipart/Etoilerose_ewrzff.svg',
  7559.             'Ete4.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143379/newprod/clipart/Ete4_pdxadk.svg',
  7560.             'Ete6.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143380/newprod/clipart/Ete6_a3xgpd.svg',
  7561.             'Ete9.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143380/newprod/clipart/Ete9_s4vllm.svg',
  7562.             'Hiver1.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143384/newprod/clipart/Hiver1_fekrjz.svg',
  7563.             'Hiver2.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143384/newprod/clipart/Hiver2_e9iygg.svg',
  7564.             'Noel2.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143387/newprod/clipart/Noel2_eqvdzr.svg',
  7565.             'Hiver.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143383/newprod/clipart/Hiver_et04e1.svg',
  7566.             'Sapin.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143390/newprod/clipart/Sapin_qjkxz6.svg',
  7567.             'Chaussetet.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143377/newprod/clipart/Chaussetet_xfpt6t.svg',
  7568.             'Cloches.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143377/newprod/clipart/Cloches_x2v3eo.svg',
  7569.             'Like.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143387/newprod/clipart/Like_ynxb2u.svg',
  7570.             'coeurlike.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143379/newprod/clipart/coeurlike_ferv9y.svg',
  7571.             'Fetedesmeres.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143383/newprod/clipart/Fetedesmeres_ud9vac.svg',
  7572.             'Fetedesperes.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143384/newprod/clipart/Fetedesperes_mltjmo.svg',
  7573.             'OOPS.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143389/newprod/clipart/OOPS_gj9p1c.svg',
  7574.             'OOPS_1.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143389/newprod/clipart/OOPS_1_r9a7l6.svg',
  7575.             'WoW.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143393/newprod/clipart/WoW_ljlqjm.svg',
  7576.             'Nuage.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143387/newprod/clipart/Nuage_fgomd0.svg',
  7577.             'Pingouin.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143389/newprod/clipart/Pingouin_ogxb6e.svg',
  7578.             'Renard.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143378/newprod/clipart/Chouette_mc1ik2.svg',
  7579.             'Chouette.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143390/newprod/clipart/Renard_mlhrxt.svg'
  7580.         ];
  7581.         foreach ($attachement as $at) {
  7582.             $exif false;
  7583.             $path $at;
  7584.             $pathArray explode("/"$path);
  7585.             $idsArray explode("."$pathArray[sizeof($pathArray) - 1]);
  7586.             $idImage "";
  7587.             foreach ($idsArray as $key2 => $elem) {
  7588.                 if ($key2 != (sizeof($idsArray) - 1)) {
  7589.                     $idImage $idImage $elem;
  7590.                 }
  7591.             }
  7592.             $idImage 'clipart/' $idImage;
  7593.             \Cloudinary::config(array(
  7594.                 "cloud_name" => "af5sur5sejour",
  7595.                 "api_key" => "263346742199243",
  7596.                 "api_secret" => "jYw-jg0FOJGv89-o5Wo0Fa3rQWU",
  7597.                 "secure" => true
  7598.             ));
  7599.             Unirest\Request::auth('263346742199243''jYw-jg0FOJGv89-o5Wo0Fa3rQWU');
  7600.             Unirest\Request::verifyPeer(false);
  7601.             $url 'https://api.cloudinary.com/v1_1/af5sur5sejour/image/upload';
  7602.             $headers = array('Accept' => 'application/json');
  7603.             $data = array("file" => $path"public_id" => $idImage"upload_preset" => 'ml_default');
  7604.             $body Unirest\Request\Body::form($data);
  7605.             $resultMetadata Unirest\Request::post($url$headers$body);
  7606.             var_dump($resultMetadata);
  7607.             if (isset(json_decode($resultMetadata->raw_body)->secure_url)) {
  7608.                 var_dump(json_decode($resultMetadata->raw_body)->secure_url);
  7609.             }
  7610.         }
  7611.         $em->getManager()->flush();
  7612.         return new response("done");
  7613.     }
  7614.     /**
  7615.      * @Route("/Parent/virgoPAss", name="virgopass")
  7616.      */
  7617.     public function virgopass()
  7618.     {
  7619.         return $this->render('Parent/virgo.html.twig');
  7620.     }
  7621.     /**
  7622.      * @Route("/Parent/interfaceUpdatePassorwdParent", name="interfaceUpdatePassorwdParent")
  7623.      */
  7624.     public function interfaceUpdatePassorwdParent(Request $request)
  7625.     {
  7626.         $user $this->getUser();
  7627.         return $this->render('Parent/interfaceUpdatePassorwdParent.html.twig', ["userToSetPassword" => $user]);
  7628.     }
  7629.     /**
  7630.      * @Route("/Parent/updatePassorwdParent", name="updatePassorwd_parent")
  7631.      */
  7632.     public function updatePassorwdParent(Request $request)
  7633.     {
  7634.         $em $this->em;
  7635.         $serviceuser $this->userService;
  7636.         $id $request->get("userID");
  7637.         $password $request->get("password");
  7638.         $result $serviceuser->ModifierPwdParent($id$password);
  7639.         return new Response('pwd modifié');
  7640.     }
  7641.     /**
  7642.      * @Route("/Parent/sauthentifierAuto/{token}/{idUser}/{userHash}",name="sauthentifierAuto")
  7643.      */
  7644.     function sauthentifierAuto($token$idUser$userHash)
  7645.     {
  7646.         $parent $this->em->getRepository(User::class)->find($idUser);
  7647.         if ((hash("sha256"$parent->getUsername() . $parent->getId()) == $userHash)) {
  7648.             $providerKey 'main_Parent'// your firewall name
  7649.             $token = new UsernamePasswordToken($parentnull$providerKey$parent->getRoles());
  7650.             $this->container->get('security.token_storage')->setToken($token);
  7651.             return $this->redirectToRoute("CodeSejour");
  7652.         } else {
  7653.             return $this->redirectToRoute("app_back_Parent");
  7654.         }
  7655.     }
  7656.     /**
  7657.      * @Route("/loginAutotoAlbumAcco/{token}/{idUser}/{userHash}/{albumAcco}",name="loginAutotoAlbumAcco")
  7658.      */
  7659.     function loginAutotoAlbumAcco($token$idUser$userHash$albumAcco)
  7660.     {
  7661.         $parent $this->em->getRepository(User::class)->find($idUser);
  7662.         if ((hash("sha256"$parent->getUsername() . $parent->getId()) == $userHash)) {
  7663.             //            return $this->render('security/DemandePasswordParentv.html.twig', ["userToSetPassword" => $use
  7664.             //dd('im herge');             
  7665.             $providerKey 'main_Parent'// your firewall name
  7666.             $token = new UsernamePasswordToken($parentnull$providerKey$parent->getRoles());
  7667.             //dd($token);  
  7668.             $this->container->get('security.token_storage')->setToken($token);
  7669.             $session $this->session;
  7670.             $produit $this->em->getRepository(Produit::class)->find($albumAcco);
  7671.             // dd($produit->getIdsjour()->getId());    
  7672.             $session->set("Sejour"$produit->getIdsjour()->getId());
  7673.             return $this->redirectToRoute("ActiverSessionAlbum");
  7674.         } else {
  7675.             return $this->redirectToRoute("app_back_Parent");
  7676.         }
  7677.     }
  7678.     /**
  7679.      * @Route("/Parent/respondNotifSms",name="respondNotifSms")
  7680.      */
  7681.     function respondNotifSms(Request $request)
  7682.     {
  7683.         $resp $request->get("resp");
  7684.         /** @var \App\Entity\User $user */
  7685.         $user $this->getUser();
  7686.         $user->setSmsnotif($resp);
  7687.         $this->em->getManager()->persist($user);
  7688.         $parentsejour $this->em->getRepository(ParentSejour::class)->findBy(['idParent' => $user]);
  7689.         foreach ($parentsejour as $sejr) {
  7690.             $sejr->setSmsnotif($resp);
  7691.             if (strpos($sejr->getIdSejour()->getCodeSejour(), "EF") !== false) {
  7692.                 $sejr->setSmsnotif(0);
  7693.             }
  7694.             $this->em->getManager()->persist($sejr);
  7695.         }
  7696.         $this->em->getManager()->flush();
  7697.         return new Response('smsnotifmodifié');
  7698.     }
  7699.     /**
  7700.      * @Route("/Parent/CheckRandomNotice",name="CheckRandomNotice")
  7701.      */
  7702.     function CheckRandomNotice(Request $request)
  7703.     {
  7704.         $val $request->get("val");
  7705.         /** @var \App\Entity\User $user */
  7706.         $user $this->getUser();
  7707.         $parent $this->em->getRepository(User::class)->find($user->getId());
  7708.         $parent->setRandomnotice($val);
  7709.         $this->em->getManager()->persist($parent);
  7710.         $this->em->getManager()->flush();
  7711.         return new Response('ok');
  7712.     }
  7713.     /**
  7714.      * @Route("/Parent/CheckalbumNotif",name="CheckalbumNotif")
  7715.      */
  7716.     function CheckalbumNotif(Request $request)
  7717.     {
  7718.         $val $request->get("val");
  7719.         /** @var \App\Entity\User $user */
  7720.         $user $this->getUser();
  7721.         $parent $this->em->getRepository(User::class)->find($user->getId());
  7722.         $parent->setShowdetailsalbum($val);
  7723.         $this->em->getManager()->persist($parent);
  7724.         $this->em->getManager()->flush();
  7725.         return new Response('ok');
  7726.     }
  7727.     /**
  7728.      * @Route("/Parent/ChecklivreNotif",name="ChecklivreNotif")
  7729.      */
  7730.     function ChecklivreNotif(Request $request)
  7731.     {
  7732.         $val $request->get("val");
  7733.         /** @var \App\Entity\User $user */
  7734.         $user $this->getUser();
  7735.         $parent $this->em->getRepository(User::class)->find($user->getId());
  7736.         $parent->setShowdetailslivre($val);
  7737.         $this->em->getManager()->persist($parent);
  7738.         $this->em->getManager()->flush();
  7739.         return new Response('ok');
  7740.     }
  7741.     /**
  7742.      * @Route("/Parent/CheckphotosNotif",name="CheckphotosNotif")
  7743.      */
  7744.     function CheckphotosNotif(Request $request)
  7745.     {
  7746.         $val $request->get("val");
  7747.         /** @var \App\Entity\User $user */
  7748.         $user $this->getUser();
  7749.         $parent $this->em->getRepository(User::class)->find($user->getId());
  7750.         $parent->setShowdetailsphotos($val);
  7751.         $this->em->getManager()->persist($parent);
  7752.         $this->em->getManager()->flush();
  7753.         return new Response('ok');
  7754.     }
  7755.     /**
  7756.      * @Route("/Parent/CheckcalNotif",name="CheckcalNotif")
  7757.      */
  7758.     function CheckcalNotif(Request $request)
  7759.     {
  7760.         $val $request->get("val");
  7761.         /** @var \App\Entity\User $user */
  7762.         $user $this->getUser();
  7763.         $parent $this->em->getRepository(User::class)->find($user->getId());
  7764.         $parent->setShowdetailscal($val);
  7765.         $this->em->getManager()->persist($parent);
  7766.         $this->em->getManager()->flush();
  7767.         return new Response('ok');
  7768.     }
  7769.     /**
  7770.      * @Route("/Parent/CheckretrosNotif",name="CheckretrosNotif")
  7771.      */
  7772.     function CheckretrosNotif(Request $request)
  7773.     {
  7774.         $val $request->get("val");
  7775.         /** @var \App\Entity\User $user */
  7776.         $user $this->getUser();
  7777.         $parent $this->em->getRepository(User::class)->find($user->getId());
  7778.         $parent->setShowdetailsretros($val);
  7779.         $this->em->getManager()->persist($parent);
  7780.         $this->em->getManager()->flush();
  7781.         return new Response('ok');
  7782.     }
  7783.     /**
  7784.      * @Route("/Parent/hidePubProd",name="hidePubProd")
  7785.      */
  7786.     function hidePubProd(Request $request)
  7787.     {
  7788.         $val $request->get("val");
  7789.         /** @var \App\Entity\User $user */
  7790.         $user $this->getUser();
  7791.         $parent $this->em->getRepository(User::class)->find($user->getId());
  7792.         $parent->setShowpubprod('false');
  7793.         $this->em->getManager()->persist($parent);
  7794.         $this->em->getManager()->flush();
  7795.         return new Response('ok');
  7796.     }
  7797.     /**
  7798.      * @Route("/Parent/PackPhotosNumerique_Modifier/{nbr}/{id}", name="PackPhotosNumerique_Modifier")
  7799.      */
  7800.     public function PackPhotosNumerique_Modifier($nbr$id)
  7801.     {
  7802.         $SEjourService $this->sejourService;
  7803.         /** @var \App\Entity\User $user */
  7804.         $user $this->getUser();
  7805.         $userId $user->getId();
  7806.         $user $this->getUser();
  7807.         $session $this->session;
  7808.         $session->set('pageMenu''');
  7809.         $idSejour $session->get("Sejour");
  7810.         $produitcondition $session->get("produit");
  7811.         $produit $session->get("produittype");
  7812.         $sejour $SEjourService->getsejourpourparent($idSejour);
  7813.         $em $this->em;
  7814.         $clipart $em->getRepository(Clipart::class)->findAll();
  7815.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  7816.         $listeattach $SEjourService->getatachmentsejour($idSejour);
  7817.         $nbLikes count($listeattachlikephoto);
  7818.         //Stella
  7819.         $AllPagesAcc null;
  7820.         $random false;
  7821.         $Albumproduct $em->getRepository(Produit::class)->findOneBy(['id' => $id]);
  7822.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  7823.         $idAcc $sejour->getIdAcommp();
  7824.         $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  7825.         $part $sejour->getIdPartenaire();
  7826.         $nompart $part->getUsername();
  7827.         $logopart $part->getLogourl();
  7828.         $nbPhoto count($listeattach);
  7829.         // die();
  7830.         if ($nbLikes == 0) {
  7831.             return $this->render('Parent/PackPhotosNumerique.html.twig', ["nbr" => $nbr"nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'like' => $listeattach'cliparts' => $clipart'Album' => $Albumproduct'AllPages' => $AllPages'albumAcc' => $albumAcc'AllPagesAcc' => $AllPagesAcc'random' => $random]);
  7832.         }
  7833.         if ($nbLikes != 0) {
  7834.             return $this->render('Parent/PackPhotosNumerique_Favoris.html.twig', ["nbr" => $nbr"nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'like' => $listeattachlikephoto'cliparts' => $clipart'Album' => $Albumproduct'AllPages' => $AllPages'albumAcc' => $albumAcc'AllPagesAcc' => $AllPagesAcc'random' => $random]);
  7835.         }
  7836.     }
  7837.     /**
  7838.      * @Route("Parent/PackPhotosNumerique_Favoris/{nbr}", name="PackPhotosNumerique_Favoris")
  7839.      */
  7840.     public function PackPhotosNumerique_Favoris($nbr)
  7841.     {
  7842.         $SEjourService $this->sejourService;
  7843.         $user $this->getUser();
  7844.         $userId $this->getUser()->getId();
  7845.         $session $this->get('session');
  7846.         $session->set('pageMenu''');
  7847.         $idSejour $session->get("Sejour");
  7848.         $produitcondition $session->get("produit");
  7849.         $produit $session->get("produittype");
  7850.         $sejour $SEjourService->getsejourpourparent($idSejour);
  7851.         $em $this->getDoctrine()->getManager();
  7852.         $listeattachlikephoto $em->getRepository(Likephoto::class)->findBy(['idUser' =>  $userId'idSejour' =>  $idSejour]);
  7853.         foreach ($listeattachlikephoto as $photo) {
  7854.             $idattach $photo->getIdSejourAttchment();
  7855.             $SejattachPhoto  $photo->getIdSejourAttchment();
  7856.             $urlPhoto  =   $SejattachPhoto->getIdAttchment()->getPath();
  7857.             //$urlPhoto =   $attachPhoto->getPath();
  7858.             $new_url str_replace('upload/''upload/f_auto,q_auto,h_900/l_Logo5Sur5White_nh6tyk,o_10,fl_relative.tiled/',  $urlPhoto);
  7859.             $photosData[] = [
  7860.                 'id' => $photo->getId(),
  7861.                 'url' =>    $new_url,
  7862.                 'caption' => "",
  7863.             ];
  7864.         }
  7865.         $nbLikes count($listeattachlikephoto);
  7866.         // Convertir le tableau PHP en JSON
  7867.         $photosDataJSON json_encode($photosData);
  7868.         return $this->render('Parent/PackPhotosNumerique_Favoris.html.twig', [
  7869.             "nbr" => $nbr,
  7870.             "sejour" => $sejour,
  7871.             "nbLikes" => $nbLikes,
  7872.             'photosFav' =>    $photosDataJSON
  7873.         ]);
  7874.     }
  7875.     /**
  7876.      * @Route("Parent/PackPhotosNumerique_Offert/{nbr}", name="PackPhotosNumerique_Offert")
  7877.      */
  7878.     public function PackPhotosNumerique_Offert($nbr)
  7879.     {
  7880.         $SEjourService $this->sejourService;
  7881.         $user $this->getUser();
  7882.         $userId $this->getUser()->getId();
  7883.         $session $this->get('session');
  7884.         $session->set('pageMenu''');
  7885.         $idSejour $session->get("Sejour");
  7886.         $produitcondition $session->get("produit");
  7887.         $produit $session->get("produittype");
  7888.         $sejour $SEjourService->getsejourpourparent($idSejour);
  7889.         $em $this->getDoctrine()->getManager();
  7890.         $listeattachlikephoto $em->getRepository(Likephoto::class)->findBy(['idUser' => $userId'idSejour' => $idSejour]);
  7891.         foreach ($listeattachlikephoto as $photo) {
  7892.             $idattach $photo->getIdSejourAttchment();
  7893.             $SejattachPhoto $photo->getIdSejourAttchment();
  7894.             $urlPhoto $SejattachPhoto->getIdAttchment()->getPath();
  7895.             //$urlPhoto = $attachPhoto->getPath();
  7896.             $new_url str_replace('upload/''upload/f_auto,q_auto,h_900/l_Logo5Sur5White_nh6tyk,o_10,fl_relative.tiled/'$urlPhoto);
  7897.             $photosData[] = [
  7898.                 'id' => $photo->getId(),
  7899.                 'url' => $new_url,
  7900.                 'caption' => "",
  7901.             ];
  7902.         }
  7903.         $nbLikes count($listeattachlikephoto);
  7904.         // Convertir le tableau PHP en JSON
  7905.         $photosDataJSON json_encode($photosData);
  7906.         return $this->render('Parent/PackPhotosNumerique_Favoris.html.twig', [
  7907.             "nbr" => $nbr,
  7908.             "sejour" => $sejour,
  7909.             "nbLikes" => $nbLikes,
  7910.             'photosFav' => $photosDataJSON
  7911.         ]);
  7912.     }
  7913.     /**
  7914.      * @Route("Parent/AjoutPackPhotosNum/{nbr}", name="AjoutPackPhotosNum")
  7915.      */
  7916.     public function AjoutPackPhotosNumParent($nbr)
  7917.     {
  7918.         $SEjourService $this->sejourService;
  7919.         /** @var \App\Entity\User $user */
  7920.         $user $this->getUser();
  7921.         $userId $user->getId();
  7922.         $user $this->getUser();
  7923.         $session $this->session;
  7924.         $session->set('pageMenu''');
  7925.         $idSejour $session->get("Sejour");
  7926.         $sejour $SEjourService->getsejourpourparent($idSejour);
  7927.         $em $this->em;
  7928.         $clipart $em->getRepository(Clipart::class)->findAll();
  7929.         //  $listeattachlikephoto = $SEjourService->getlikephotosejour($userId, $idSejour);
  7930.         //$listerandom =  $SEjourService->getatachmentsejour($idSejour);
  7931.         $listeattach $SEjourService->getCombinedattachSejour($idSejour'photo');
  7932.         $listerandom =  $listeattach;
  7933.         $AllPagesAcc null;
  7934.         $Albumproduct $em->getRepository(Produit::class)->findOneBy(['labele' => 'RandomPackPhotosNum' $nbr]);
  7935.         $random true;
  7936.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  7937.         $idAcc $sejour->getIdAcommp();
  7938.         $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  7939.         $part $sejour->getIdPartenaire();
  7940.         $nompart $part->getUsername();
  7941.         $logopart $part->getLogourl();
  7942.         if ($albumAcc != null and $albumAcc != "") {
  7943.             $AllPagesAcc $em->getRepository(Page::class)->findBy(['idproduit' => $albumAcc]);
  7944.         }
  7945.         $allpagesResult = array();
  7946.         $j 0;
  7947.         if ($random == true) {
  7948.             foreach ($AllPages as $p) {
  7949.                 $arrayexploded preg_split('[randomid|randompath]'$p->getCouleurbordure());
  7950.                 $rr "";
  7951.                 for ($i 0$i sizeof($arrayexploded); $i $i 2) {
  7952.                     if ($i sizeof($arrayexploded)) {
  7953.                         if (sizeof($listerandom) == 0) {
  7954.                             //$listerandom = $SEjourService->getatachmentsejour($idSejour);
  7955.                             $listerandom $SEjourService->getCombinedattachSejour($idSejour'photo');
  7956.                         }
  7957.                         $arrayRsRandom $this->random_functionNolikes($listerandom);
  7958.                         $rr $rr $arrayexploded[$i] . $arrayRsRandom['idelem'] . $arrayexploded[$i 1] . $arrayRsRandom['pathelem'];
  7959.                         unset($listerandom[$arrayRsRandom['elem']]);
  7960.                     } else {
  7961.                         $rr $rr $arrayexploded[$i];
  7962.                     }
  7963.                     $listerandom $listerandom;
  7964.                 }
  7965.                 $resultFinal $rr;
  7966.                 $p->setCouleurbordure($resultFinal);
  7967.                 array_push($allpagesResult$p);
  7968.                 if ($j sizeof($listeattach) - 1) {
  7969.                     $j $j 1;
  7970.                 } else {
  7971.                     $j 0;
  7972.                 }
  7973.             }
  7974.             $AllPages $allpagesResult;
  7975.         }
  7976.         return $this->render('Parent/PackPhotosNumerique.html.twig', ["nbr" => $nbr"nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'like' => $listeattach'cliparts' => $clipart'Album' => $Albumproduct'AllPages' => $AllPages'albumAcc' => $albumAcc'AllPagesAcc' => $AllPagesAcc'random' => $random'listeattach' => $listeattach]);
  7977.     }
  7978.     /**
  7979.      * @Route("/Parent/SavePackPhotosNumerique", name="SavePackPhotosNumeriqueParent")
  7980.      */
  7981.     public function SavePackPhotosNumeriqueParent(Request $request)
  7982.     {
  7983.         $session $this->session;
  7984.         $serviceuser $this->etablissementService;
  7985.         $page $request->get("pages");
  7986.         $sejour $request->get("sejour");
  7987.         $prodid $request->get('idProd');
  7988.         $nomprod $request->get('nomprod');
  7989.         $nbr $request->get('nbr');
  7990.         $user $this->getUser();
  7991.         $nbr strval($nbr);
  7992.         $produittype $session->get("produit");
  7993.         $produit $session->get("produittype");
  7994.         //  $Album = $serviceuser->SavePhotosPochetteParent($page, $user, $sejour, $prodid, $produit, $produittype, $nbr,$nomprod);
  7995.         $refPackNum null;
  7996.         if ($sejour) {
  7997.             $refPackNum $this->generateRefPackPhotosNum($sejour$user);
  7998.         }
  7999.         $Album $serviceuser->SavePackPhotosNumerique($page$user$sejour$prodid$produit$produittype$nbr$nomprod$refPackNum);
  8000.         //sendmailparent
  8001.         $dateNow = new \Datetime();
  8002.         /** @var \App\Entity\User $user */
  8003.         $user $this->getUser();
  8004.         $userEmail $user->getEmail();
  8005.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  8006.         //$this->EmailServie->MailRelancePanier($userEmail);
  8007.         return new response('done');
  8008.     }
  8009. /**
  8010.  * @Route("/Parent/CommandeDirecteAddPackNumeriqueAuPanier", name="CommandeDirecteAddPackNumeriqueAuPanier")
  8011.  */
  8012. public function CommandeDirecteAddPackNumeriqueAuPanier(Request $request)
  8013. {
  8014.     $em $this->em->getManager();
  8015.     $session $this->session;
  8016.     $this->logger->info('Début CommandeDirecteAddPackNumeriqueAuPanier');
  8017.     $serviceuser $this->etablissementService;
  8018.     $photos $request->get("photos");
  8019.     $sejour $request->get("sejour");
  8020.     $nbr $request->get('nbr');
  8021.     $user $this->getUser();
  8022.     $nbr strval($nbr);
  8023.     $nomprod "Pack Photos Numerique - " $nbr;
  8024.     
  8025.     // Créer le produit pack photos
  8026.     $packPhotos $serviceuser->SavePackPhotosNumerique($photos$user$sejour$nbr$nomprod);
  8027.     $product $em->getRepository(Produit::class)->find($packPhotos->getId());
  8028.   
  8029.     // Récupérer ou créer le panier
  8030.     $typeref $em->getRepository(Typeref::class)->find(8);
  8031.     $statutPanier $em->getRepository(Ref::class)->findOneBy(["libiller" => "creer""typeref" => $typeref]);
  8032.     $panierTrace $em->getRepository(Panier::class)->findOneBy(["creerPar" => $user"statut" => $statutPanier]);
  8033.     if ($panierTrace === null) {
  8034.         $panierTrace = new Panier();
  8035.         $panierTrace->setDateCreation(new \DateTime());
  8036.         $panierTrace->setCreerPar($user);
  8037.         $panierTrace->setStatut($statutPanier);
  8038.         $em->persist($panierTrace);
  8039.         $em->flush();
  8040.     }
  8041.     $this->logger->info('Panier récupéré', ['panier_id' => $panierTrace $panierTrace->getId() : 'null']);
  8042.     // Récupérer les produits du panier en session
  8043.     $Products $session->get("Panier", []);
  8044.     $inser false;
  8045.     
  8046.     // Vérifier si le panier est vide (pas de produits en session)
  8047.     if(count($Products) == 0) {
  8048.         // Créer directement une commande et une commande numérique
  8049.         $commande = new Commande();
  8050.         $commande->setDateCreation(new \DateTime());
  8051.         $commande->setCreerPar($user);
  8052.         $commande->setStatut($statutPanier);
  8053.         $commande->setTyperef($typeref);
  8054.         $commande->setMontantTTC($product->getIdConditionnement()->getMontantTTC());
  8055.         $commande->setIdsjour($sejour);
  8056.         $commande->setIdpanier($panierTrace->getId());
  8057.         $commande->setNumComande($this->generateUniqueOrderNumber());
  8058.         $em->persist($commande);
  8059.         $em->flush();
  8060.         
  8061.         $commandeNumerique = new CommandeNumerique();
  8062.         $commandeNumerique->setDateCreation(new \DateTime());
  8063.         $commandeNumerique->setCreerPar($user);
  8064.         $commandeNumerique->setIdCommande($commande);
  8065.         $commandeNumerique->setStatut($statutPanier);
  8066.         $commandeNumerique->setLinkdownload($product->getId());
  8067.         $commandeNumerique->setEtat(0); // État en attente de paiement
  8068.         $em->persist($commandeNumerique);
  8069.         $em->flush();
  8070.         
  8071.         // Ajouter le produit au panier en session pour le paiement
  8072.         $p = [
  8073.             "id" => $product->getId(),
  8074.             "nom" => $product->getType()->getLabeletype(),
  8075.             "ident" => $product->getLabele(),
  8076.             "codesejour" => $product->getIdsjour()->getcodeSejour(),
  8077.             "mnt" => $product->getIdConditionnement()->getMontantTTC(),
  8078.             "path" => $product->getType()->getAttachements()[0]->getIdAttachement()->getPath(),
  8079.             "condition" => $product->getIdConditionnement()->getId(),
  8080.             "qte" => 1
  8081.         ];
  8082.         array_push($Products$p);
  8083.         $session->set('Panier'$Products);
  8084.         
  8085.         // Ajouter le produit au panier en base de données
  8086.         $panierProduit = new PanierProduit();
  8087.         $panierProduit->setIdProduit($product);
  8088.         $panierProduit->setIdPanier($panierTrace);
  8089.         $panierProduit->setQuantite(1);
  8090.         $panierProduit->setPrixTotal($product->getIdConditionnement()->getMontantTTC());
  8091.         $em->persist($panierProduit);
  8092.         $em->flush();
  8093.         
  8094.         // Rediriger vers la page de paiement
  8095.         return $this->redirectToRoute('paiement_commande_directe', [
  8096.             'id' => $commande->getId()
  8097.         ]);
  8098.     } else {
  8099.         // Il y a déjà des produits dans le panier
  8100.         // Ajouter le produit au panier existant
  8101.         
  8102.         // Vérifier si le produit existe déjà dans le panier en session
  8103.         foreach ($Products as $key => $p) {
  8104.             if ($p['id'] === $product->getId()) {
  8105.                 $inser true;
  8106.                 $Products[$key]['qte'] += 1;
  8107.                 $Products[$key]['mnt'] += $product->getIdConditionnement()->getMontantTTC();
  8108.             }
  8109.         }
  8110.         // Vérifier si le produit existe dans PanierProduit en base de données
  8111.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(["idProduit" => $product"idPanier" => $panierTrace]);
  8112.         if ($panierProduit === null) {
  8113.             $panierProduit = new PanierProduit();
  8114.             $panierProduit->setIdProduit($product);
  8115.             $panierProduit->setIdPanier($panierTrace);
  8116.             $panierProduit->setQuantite(1);
  8117.             $panierProduit->setPrixTotal($product->getIdConditionnement()->getMontantTTC());
  8118.             $em->persist($panierProduit);
  8119.             $em->flush();
  8120.         } else {
  8121.             // Mettre à jour la quantité et le prix total
  8122.             $panierProduit->setQuantite($panierProduit->getQuantite() + 1);
  8123.             $panierProduit->setPrixTotal($panierProduit->getPrixTotal() + $product->getIdConditionnement()->getMontantTTC());
  8124.             $em->persist($panierProduit);
  8125.             $em->flush();
  8126.         }
  8127.         // Si le produit n'est pas déjà dans le panier en session, l'ajouter
  8128.         if (!$inser) {
  8129.             $p = [
  8130.                 "id" => $product->getId(),
  8131.                 "nom" => $product->getType()->getLabeletype(),
  8132.                 "ident" => $product->getLabele(),
  8133.                 "codesejour" => $product->getIdsjour()->getcodeSejour(),
  8134.                 "mnt" => $product->getIdConditionnement()->getMontantTTC(),
  8135.                 "path" => $product->getType()->getAttachements()[0]->getIdAttachement()->getPath(),
  8136.                 "condition" => $product->getIdConditionnement()->getId(),
  8137.                 "qte" => 1
  8138.             ];
  8139.             array_push($Products$p);
  8140.         }
  8141.         // Mettre à jour le panier en session
  8142.         $session->set('Panier'$Products);
  8143.         
  8144.         // Ajouter un message flash pour informer l'utilisateur
  8145.         $this->addFlash('success''Le pack photos a été ajouté à votre panier.');
  8146.         
  8147.         // Rediriger vers le panier
  8148.         $this->logger->info('Redirection vers le panier');
  8149.         return new Response('done');
  8150.     }
  8151. }
  8152. /**
  8153.  * Génère un numéro de commande unique
  8154.  */
  8155. private function generateUniqueOrderNumber()
  8156. {
  8157.     // Générer un numéro de commande basé sur la date et un nombre aléatoire
  8158.     return date('YmdHis') . rand(10009999);
  8159. }
  8160. /**
  8161.  * @Route("/Parent/confirmation-pack-photos/{id}", name="confirmation_pack_photos")
  8162.  */
  8163. public function confirmationPackPhotos($id): Response
  8164. {
  8165.     $commandeNumerique $this->em->getRepository(CommandeNumerique::class)->find($id);
  8166.     
  8167.     if (!$commandeNumerique) {
  8168.         throw $this->createNotFoundException('Commande numérique introuvable');
  8169.     }
  8170.     
  8171.     $commande $commandeNumerique->getIdCommande();
  8172.     $user $commande->getCreerPar();
  8173.     $sejour $commande->getIdsjour();
  8174.     
  8175.     return $this->render('Parent/confirmation_pack_photos.html.twig', [
  8176.         'commandeNumerique' => $commandeNumerique,
  8177.         'commande' => $commande,
  8178.         'user' => $user,
  8179.         'sejour' => $sejour,
  8180.         'downloadUrl' => $this->generateUrl('telechargerPack', ['idCommande' => $commandeNumerique->getId()])
  8181.     ]);
  8182. }
  8183.     /**
  8184.      * @Route("/Parent/SavePackPhotosNumeriqueComandeSave_panier", name="SavePackPhotosNumeriqueComandeSave_panier")
  8185.      */
  8186.     public function AddPackNumeriqueAuPanier(Request $request)
  8187.     {
  8188.         $em $this->em->getManager();
  8189.         $session $this->session;
  8190.         $serviceuser $this->etablissementService;
  8191.         $photos $request->get("photos");
  8192.         $sejour $request->get("sejour");
  8193.         $nbr $request->get('nbr');
  8194.         $user $this->getUser();
  8195.         $nbr strval($nbr);
  8196.         $nomprod "Pack Photos Numerique - " $nbr;
  8197.         //test de la fonction envoieMailPackNumerique
  8198.      
  8199.         $packPhotos $serviceuser->SavePackPhotosNumerique($photos$user$sejour$nbr$nomprod);
  8200.         $product $em->getRepository(Produit::class)->find($packPhotos->getId());
  8201.       // ---  Test pour envoyer le mail pak numerique ---// 
  8202.       //   $this->emailsCmdService->envoieMailPackNumerique($packPhotos->getId());
  8203.       
  8204.         // $this->printerService->PackPhotosNumerique($packPhotos->getId(),20);
  8205.         $typeref $em->getRepository(Typeref::class)->find(8);
  8206.         $statutPanier $em->getRepository(Ref::class)->findOneBy(["libiller" => "creer""typeref" => $typeref]);
  8207.         $panierTrace $em->getRepository(Panier::class)->findOneBy(["creerPar" => $user"statut" => $statutPanier]);
  8208.         if ($panierTrace === null) {
  8209.             $panierTrace = new Panier();
  8210.             $panierTrace->setDateCreation(new \DateTime());
  8211.             $panierTrace->setCreerPar($user);
  8212.             $panierTrace->setStatut($statutPanier);
  8213.             $em->persist($panierTrace);
  8214.             $em->flush();
  8215.         }
  8216.         // Add product to cart session
  8217.         $Products $session->get("Panier", []);
  8218.         $inser false;
  8219.         foreach ($Products as $key => $p) {
  8220.             if ($p['id'] === $product->getId()) {
  8221.                 $inser true;
  8222.                 $Products[$key]['qte'] += 1;
  8223.                 $Products[$key]['mnt'] += $product->getIdConditionnement()->getMontantTTC();
  8224.             }
  8225.         }
  8226.         // Check if product exists in PanierProduit
  8227.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(["idProduit" => $product"idPanier" => $panierTrace]);
  8228.         if ($panierProduit === null) {
  8229.             $panierProduit = new PanierProduit();
  8230.             $panierProduit->setIdProduit($product);
  8231.             $panierProduit->setIdPanier($panierTrace);
  8232.             $panierProduit->setQuantite(1);
  8233.             $panierProduit->setPrixTotal($product->getIdConditionnement()->getMontantTTC());
  8234.             $em->persist($panierProduit);
  8235.             $em->flush();
  8236.         } else {
  8237.             // Update existing product quantity and total price
  8238.             $panierProduit->setQuantite($panierProduit->getQuantite() + 1);
  8239.             $panierProduit->setPrixTotal($panierProduit->getPrixTotal() + $product->getIdConditionnement()->getMontantTTC());
  8240.             $em->persist($panierProduit);
  8241.             $em->flush();
  8242.         }
  8243.         if (!$inser) {
  8244.             $p = [
  8245.                 "id" => $product->getId(),
  8246.                 "nom" => $product->getType()->getLabeletype(),
  8247.                 "ident" => $product->getLabele(),
  8248.                 "codesejour" => $product->getIdsjour()->getcodeSejour(),
  8249.                 "mnt" => $product->getIdConditionnement()->getMontantTTC(),
  8250.                 "path" => $product->getType()->getAttachements()[0]->getIdAttachement()->getPath(),
  8251.                 "condition" => $product->getIdConditionnement()->getId(),
  8252.                 "qte" => 1
  8253.             ];
  8254.             array_push($Products$p);
  8255.         }
  8256.         $session->set('Panier'$Products);
  8257.         // Send reminder email
  8258.         /** @var \App\Entity\User $user */
  8259.         $userEmail $user->getEmail();
  8260.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  8261.     
  8262.         return new Response('done');
  8263.     }
  8264.     /* public function SavePackPhotosNumeriqueComandeSave_panier(PrinterService $PrinterService, Request $request)
  8265.     {
  8266.         $em = $this->em;
  8267.         var_dump("Debut Creation du pack numerique ");
  8268.         $session = $this->session;
  8269.         $serviceuser = $this->etablissementService;
  8270.         $attachements = $request->get('attachements');
  8271.         $page = $request->get("pages");
  8272.         $sejour = $request->get("sejour");
  8273.         $prodid = $request->get('idProd');
  8274.         var_dump($prodid);
  8275.         $nomprod = $request->get('nomprod');
  8276.         $nbr = $request->get('nbr');
  8277.         $user = $this->getUser();
  8278.         $nbr = strval($nbr);
  8279.         $produittype = $session->get("produit");
  8280.         $produit = $session->get("produittype");
  8281.         if ($sejour !== null) {
  8282.             $refPackNum = $this->generateRefPackPhotosNum($sejour, $user);
  8283.             $Album = $serviceuser->SavePackPhotosNumerique($page, $user, $sejour, $prodid, $produit, $produittype, $nbr, $nomprod, $refPackNum);
  8284.             $produit = $em->getRepository(Produit::class)->find($Album->getId());
  8285.             $serviceuser->commandepackphotoNum($attachements, $sejour, $user, $Album);
  8286.             //   $PrinterService->PackPhotosNumerique($sejour,$refPackNum,$Album);
  8287.             $inser = false;
  8288.             $Products = $session->get("Panier");
  8289.             //Touhemi  03-07-2020 :Rechercher  si l'utilisateur a déja un panier avec statut créer ds la bd , sinon on écrit un panier
  8290.             $user = $this->getUser();
  8291.             $typeref = $em->getRepository(Typeref::class)->find(8);
  8292.             $statutPanier = $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer", "typeref" => $typeref));
  8293.             $panierTrace = $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user, "statut" => $statutPanier));
  8294.             //fin
  8295.             if ($panierTrace == null) {
  8296.                 $panierTrace = new Panier();
  8297.                 $dateNow = new \Datetime();
  8298.                 $panierTrace->setDateCreation($dateNow);
  8299.                 $panierTrace->setCreerPar($user);
  8300.                 $panierTrace->setStatut($statutPanier);
  8301.                 $em->getManager()->persist($panierTrace);
  8302.                 $em->getManager()->flush();
  8303.             }
  8304.             //Touhemi 03-07-2020 :s'il y a un produit avec (id user,id sejour, type produit et type conditionement) dans le panier , sinon on écrit un produit
  8305.             if ($Products == null) {
  8306.                 $Products = [];
  8307.             }
  8308.             if ($Products != null) {
  8309.                 foreach ($Products as $key => $p) {
  8310.                     if ($p['id'] == $produit->getId()) {
  8311.                         $inser = true;
  8312.                         $Products[$key]['qte'] = $p['qte'] + 1;
  8313.                         $Products[$key]['mnt'] = $p['mnt'] + $produit->getIdConditionnement()->getMontantTTC();
  8314.                     }
  8315.                 }
  8316.             }
  8317.             //Touhemi 03-07-2020 :Rechercher  si le produti existe déja ds panierProduit
  8318.             $panierProduit = $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit, "idPanier" => $panierTrace));
  8319.             if ($panierProduit == null) {
  8320.                 $panierProduit = new PanierProduit();
  8321.                 $panierProduit->setIdProduit($produit);
  8322.                 $panierProduit->setIdPanier($panierTrace);
  8323.                 $em->getManager()->persist($panierProduit);
  8324.                 $em->getManager()->flush();
  8325.             }
  8326.             //fin
  8327.             //   Touhemi 03-07-2020 ajouter plus un au produit et modifier prixTotal
  8328.             $oldQte = $panierProduit->getQuantite();
  8329.             $newQte = $oldQte + 1;
  8330.             $panierProduit->setQuantite($newQte);
  8331.             $oldTotal = $panierProduit->getPrixTotal();
  8332.             $newTotal = $oldTotal + $produit->getIdConditionnement()->getMontantTTC();
  8333.             $panierProduit->setPrixTotal($newTotal);
  8334.             $em->getManager()->persist($panierProduit);
  8335.             $em->getManager()->flush();
  8336.             //fin
  8337.             if ($inser === false) {
  8338.                 $p = [];
  8339.                 $p["id"] = $produit->getId();
  8340.                 $p["nom"] = $produit->getType()->getLabeletype();
  8341.                 $p["ident"] = $produit->getLabele();
  8342.                 $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  8343.                 $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  8344.                 $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  8345.                 $p["condition"] = $produit->getIdConditionnement()->getId();
  8346.                 $p["qte"] = 1;
  8347.                 array_push($Products, $p);
  8348.             }
  8349.             $session->set('Panier', $Products);
  8350.             //sendmail_parent
  8351.             $dateNow = new \Datetime();
  8352.             $user = $this->getUser();
  8353.             $userEmail = $user->getEmail();
  8354.             $this->EmailServie->SaveMailRelancePanier($userEmail);
  8355.             // $this->EmailServie->MailRelancePanier($userEmail);
  8356.         }
  8357.         return new response('done');
  8358.     }
  8359. */
  8360.     /**
  8361.      * @Route("/Parent/SavePackPhotosNumeriqueComandeSave_panierfree", name="SavePackPhotosNumeriqueComandeSave_panierfree")
  8362.      */
  8363.     public function SavePackPhotosNumeriqueComandeSave_panierfree(PrinterService $PrinterServiceRequest $request)
  8364.     {
  8365.         $em $this->em;
  8366.         var_dump("Debut Creation du pack numerique ");
  8367.         $session $this->session;
  8368.         $serviceuser $this->etablissementService;
  8369.         $attachements $request->get('attachements');
  8370.         $page $request->get("pages");
  8371.         $sejour $request->get("sejour");
  8372.         $prodid $request->get('idProd');
  8373.         var_dump($prodid);
  8374.         $nomprod $request->get('nomprod');
  8375.         $nbr $request->get('nbr');
  8376.         $user $this->getUser();
  8377.         $nbr strval($nbr);
  8378.         $produittype $session->get("produit");
  8379.         $produit $session->get("produittype");
  8380.         if ($sejour !== null) {
  8381.             $refPackNum $this->generateRefPackPhotosNum($sejour$user);
  8382.             $Album $serviceuser->SavePackPhotosNumeriquefree($page$user$sejour$prodid$produit$produittype$nbr$nomprod$refPackNum);
  8383.             $produit $em->getRepository(Produit::class)->find($Album->getId());
  8384.             $serviceuser->commandepackphotoNum($attachements$sejour$user$Album);
  8385.             //   $PrinterService->PackPhotosNumerique($sejour,$refPackNum,$Album);
  8386.             $inser false;
  8387.             $Products $session->get("Panier");
  8388.             //Touhemi  03-07-2020 :Rechercher  si l'utilisateur a déja un panier avec statut créer ds la bd , sinon on écrit un panier
  8389.             $user $this->getUser();
  8390.             $typeref $em->getRepository(Typeref::class)->find(8);
  8391.             $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  8392.             $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  8393.             //fin
  8394.             if ($panierTrace == null) {
  8395.                 $panierTrace = new Panier();
  8396.                 $dateNow = new \Datetime();
  8397.                 $panierTrace->setDateCreation($dateNow);
  8398.                 $panierTrace->setCreerPar($user);
  8399.                 $panierTrace->setStatut($statutPanier);
  8400.                 $em->getManager()->persist($panierTrace);
  8401.                 $em->getManager()->flush();
  8402.             }
  8403.             //Touhemi 03-07-2020 :s'il y a un produit avec (id user,id sejour, type produit et type conditionement) dans le panier , sinon on écrit un produit
  8404.             if ($Products == null) {
  8405.                 $Products = [];
  8406.             }
  8407.             if ($Products != null) {
  8408.                 foreach ($Products as $key => $p) {
  8409.                     if ($p['id'] == $produit->getId()) {
  8410.                         $inser true;
  8411.                         $Products[$key]['qte'] = $p['qte'] + 1;
  8412.                         $Products[$key]['mnt'] = $p['mnt'] + $produit->getIdConditionnement()->getMontantTTC();
  8413.                     }
  8414.                 }
  8415.             }
  8416.             //Touhemi 03-07-2020 :Rechercher  si le produti existe déja ds panierProduit
  8417.             $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  8418.             if ($panierProduit == null) {
  8419.                 $panierProduit = new PanierProduit();
  8420.                 $panierProduit->setIdProduit($produit);
  8421.                 $panierProduit->setIdPanier($panierTrace);
  8422.                 $em->getManager()->persist($panierProduit);
  8423.                 $em->getManager()->flush();
  8424.             }
  8425.             //fin
  8426.             //   Touhemi 03-07-2020 ajouter plus un au produit et modifier prixTotal
  8427.             $oldQte $panierProduit->getQuantite();
  8428.             $newQte $oldQte 1;
  8429.             $panierProduit->setQuantite($newQte);
  8430.             $oldTotal $panierProduit->getPrixTotal();
  8431.             $newTotal $oldTotal $produit->getIdConditionnement()->getMontantTTC();
  8432.             $panierProduit->setPrixTotal($newTotal);
  8433.             $em->getManager()->persist($panierProduit);
  8434.             $em->getManager()->flush();
  8435.             //fin
  8436.             if ($inser === false) {
  8437.                 $p = [];
  8438.                 $p["id"] = $produit->getId();
  8439.                 $p["nom"] = $produit->getType()->getLabeletype();
  8440.                 $p["ident"] = $produit->getLabele();
  8441.                 $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  8442.                 $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  8443.                 $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  8444.                 $p["condition"] = $produit->getIdConditionnement()->getId();
  8445.                 $p["qte"] = 1;
  8446.                 array_push($Products$p);
  8447.             }
  8448.             $session->set('Panier'$Products);
  8449.             //sendmail_parent
  8450.             $dateNow = new \Datetime();
  8451.             /** @var \App\Entity\User $user */
  8452.             $user $this->getUser();
  8453.             $userEmail $user->getEmail();
  8454.             $this->EmailServie->SaveMailRelancePanier($userEmail);
  8455.             // $this->EmailServie->MailRelancePanier($userEmail);
  8456.         }
  8457.         return new response('done');
  8458.     }
  8459.     function generateRefPackPhotosNum($idsejour$user)
  8460.     {
  8461.         //photonum_code_sejour_idparent_random;
  8462.         $em $this->em;
  8463.         $date = new \Datetime();
  8464.         $Milliseconde $date->format('dmYhis');
  8465.         $sejour $this->em->getRepository(Sejour::class)->find($idsejour);
  8466.         $ref "photonum_" $sejour->getCodeSejour() . "_" $user->getId() . "_" $Milliseconde;
  8467.         return $ref;
  8468.     }
  8469.     /**
  8470.      * @Route("/downloadpackphotonum/{refcmdnum}", name="downloadpackphotonum",methods={"GET"})
  8471.      */
  8472.     public function downloadpackphotonumAction($refcmdnum)
  8473.     {
  8474.         $tab explode("_"$refcmdnum);
  8475.         if (sizeof($tab) == 4) {
  8476.             $codesejour $tab[1];
  8477.             $iduser $tab[2];
  8478.             $sejour $this->em->getRepository(Sejour::class)->findOneBy(array('codeSejour' => $codesejour));
  8479.             $user $this->em->getRepository(User::class)->find(intval($iduser));
  8480.             if ($user && $sejour) {
  8481.                 $commandenumerique $this->em->getRepository(CommandeNumerique::class)->findOneBy(array('linkdownload' => $refcmdnum));
  8482.                 if ($commandenumerique) {
  8483.                     if ($commandenumerique->getEtat() === 1) {
  8484.                         $commandenumerique->setEtat(2);
  8485.                         $commandenumerique->setDateTelechargement(new \DateTime());
  8486.                         $this->em->getManager()->persist($commandenumerique);
  8487.                         $this->em->getManager()->flush();
  8488.                         $response = new BinaryFileResponse($this->getParameter('kernel.project_dir') . '/public/ParentPhotosNumerique/' $refcmdnum '/' $refcmdnum '.zip');
  8489.                         $response->headers->set('Content-Type'"application/zip");
  8490.                         // Set content disposition inline of the file
  8491.                         $response->setContentDisposition(
  8492.                             ResponseHeaderBag::DISPOSITION_ATTACHMENT,
  8493.                             $refcmdnum '.zip'
  8494.                         );
  8495.                         return $response;
  8496.                     } elseif ($commandenumerique->getEtat() == 2) {
  8497.                         return new JsonResponse(array('message' => 'commande déjà livrée'), 400);
  8498.                     } else {
  8499.                         return new JsonResponse(array('message' => 'commande invalide'), 400);
  8500.                     }
  8501.                 } else {
  8502.                     return new JsonResponse(array('message' => 'commande introuvable'), 400);
  8503.                 }
  8504.             }
  8505.         } else {
  8506.             return new JsonResponse(array('message' => 'lien invalide'), 400);
  8507.         }
  8508.     }
  8509.     /**
  8510.      * @Route("/Parent/showpub" , name="showpub")
  8511.      */
  8512.     public function showpub()
  8513.     {
  8514.         /** @var User $user */
  8515.         $user $this->getUser();
  8516.         if (!$user) {
  8517.             return new JsonResponse(['status' => 'error''message' => 'User not found'], 400);
  8518.         }
  8519.         // Set showpubprod to true
  8520.         $user->setShowpubprod(1);
  8521.         // Save the changes to the database
  8522.         $this->em->getManager()->persist($user);
  8523.         $this->em->getManager()->flush();
  8524.         // Return a success response
  8525.         return new JsonResponse(['status' => 'success']);
  8526.     }
  8527.     /**
  8528.      * @Route("/Parent/Mentionslegales", name="mentionlegale")
  8529.      */
  8530.     public function Mentionslegales()
  8531.     {
  8532.         return $this->render('Parent/footer/mentionlegal.html.twig', []);
  8533.     }
  8534.     /**
  8535.      * @Route("/Parent/Conditongeneral", name="Conditongeneral")
  8536.      */
  8537.     public function Conditongeneral()
  8538.     {
  8539.         return $this->render('Parent/footer/Condition.html.twig', []);
  8540.     }
  8541. }