src/Controller/EspaceParentController.php line 5417

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 $SEjourService->getsejourpourparent($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.             $nbmesssages count($messages);
  1745.             $listeattachlikephoto =  $sejourservice->getlikephotosejour($iduser$idSejour);
  1746.             $nblikes count($listeattachlikephoto);
  1747.             $em $this->em;
  1748.             $label "Livre_sejour" $sejour->getCodeSejour();
  1749.             $idAcc $sejour->getIdAcommp();
  1750.             $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'Album_sejour']);
  1751.             $livreSej $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'Livre_sejour']);
  1752.             if ($albumAcc == null) {
  1753.                 $albumAcc $em->getRepository(Produit::class)->findOneBy(['iduser' => 1'statut' => "Album_sejour"'idsjour' => $sejour]);
  1754.             }
  1755.             if ($livreSej == null) {
  1756.                 $livreSejour $em->getRepository(Produit::class)->findOneBy(['statut' => "Livre_sejour"'idsjour' => $sejour'labele' => $label'version' => "Livre_Admin"]);
  1757.             }
  1758.             $code_sejour =  $sejour->getCodeSejour();
  1759.             return $this->render('Parent/headerParent.html.twig', [
  1760.                 'produit' => $liste,
  1761.                 'sejour' => $sejour,
  1762.                 'livreSejour' => $livreSejour,
  1763.                 'Products' => $Products,
  1764.                 'destionation' =>  $destination,
  1765.                 'nbvocal' =>  $nbmesssages,
  1766.                 'albumAcc' => $albumAcc,
  1767.                 'nbLikes' => $nblikes,
  1768.                 'code_sejour' => $code_sejour,
  1769.                 'payment' => $payment
  1770.             ]);
  1771.         }
  1772.         if ($sejour == null) {
  1773.             return $this->render('Parent/headerParent2.html.twig');
  1774.         }
  1775.     }
  1776.     /**
  1777.      * @Route("/Parent/disablepack", name="disablePack")
  1778.      */
  1779.     public function disableFreepack()
  1780.     {
  1781.         //this section is used to disale the freePackOffert
  1782.         $em $this->em;
  1783.         $session $this->session;
  1784.         /** @var \App\Entity\User $user */
  1785.         $user $this->getUser();
  1786.         $iduser $user->getId();
  1787.         $idSejour $session->get("Sejour");
  1788.         $SEjourService $this->sejourService;
  1789.         $listeattach $SEjourService->getCombinedattachSejour($idSejour'photo');
  1790.         $panierSession $session->get("Panier");
  1791.         $containsProduitType20 false;
  1792.         $nbrphoto count($listeattach);
  1793.         /** @var \App\Entity\User $user */
  1794.         $user $this->getUser();
  1795.         $iduser $user->getId();
  1796.         $containsProduitType20 false;
  1797.         $sejour $this->em->getRepository(Sejour::class)->find($idSejour);
  1798.         $commandes $this->em->getRepository(Commande::class)->findBy(["idSejour" => $idSejour"idUser" => $iduser]);
  1799.         // Check commands
  1800.         foreach ($commandes as $commande) {
  1801.             $commandCondition $commande->getNumSuivi();
  1802.             $status $commande->getStatut()->getId();
  1803.             // Check if Num Suivi is set one and if payment is completed
  1804.             if ($commandCondition == && $status == 33) {
  1805.                 $containsProduitType20 true;
  1806.                 break; // No need to check further if condition is met
  1807.             }
  1808.         }
  1809.         // Check panierSession if the condition is not met in commandes
  1810.         if (!$containsProduitType20 && is_array($panierSession) && !empty($panierSession)) {
  1811.             foreach ($panierSession as $item) {
  1812.                 // Access the details of each item in the Panier
  1813.                 $condition $item['condition'];
  1814.                 $codesejour $item['codesejour'];
  1815.                 if ($condition == 16 && $codesejour == $sejour->getCodeSejour()) {
  1816.                     $containsProduitType20 true;
  1817.                     break; // No need to check further if condition is met
  1818.                 }
  1819.             }
  1820.         }
  1821.         return new JsonResponse(['containsProduitType20' => $containsProduitType20'idSejour' => $nbrphoto]);
  1822.     }
  1823.     /**
  1824.      * @Route("/Parent/disablepackpanier", name="disablePackpanier")
  1825.      */
  1826.     public function disableFreepackpanier(): JsonResponse
  1827.     {
  1828.         //this section is used to disale the + in the panier for the packOffert
  1829.         $em $this->em;
  1830.         $disabledProductIds = [];
  1831.         $session $this->session;
  1832.         $panierSession $session->get("Panier");
  1833.         $ids = [];
  1834.         foreach ($panierSession as $item) {
  1835.             $ids[] = $item['id'];
  1836.         }
  1837.         if ($panierSession) {
  1838.             foreach ($ids as $id) {
  1839.                 $panierProduits $em->getRepository(PanierProduit::class)->findBy(['idProduit' => $id]);
  1840.                 foreach ($panierProduits as $panierProduit) {
  1841.                     $produit $panierProduit->getIdProduit();
  1842.                     $type $produit->getType();
  1843.                     // Check if the product type is 20 and add to disabledProductIds if true
  1844.                     if ($type && $type->getId() == 20) {
  1845.                         $disabledProductIds[] = $produit->getId();
  1846.                     }
  1847.                 }
  1848.             }
  1849.             return new JsonResponse(['disabledProductIds' => $disabledProductIds]);
  1850.         }
  1851.     }
  1852.     /**
  1853.      * @Route("/", name="heedear2")
  1854.      */
  1855.     public function headerparenrt2(): Response
  1856.     {
  1857.         $session $this->session;
  1858.         $produit $this->typeProduiteService;
  1859.         $nbvocal 0;
  1860.         $idSejour $session->get("Sejour");
  1861.         $liste $produit->produitlistType();
  1862.         $session $this->session;
  1863.         $destination $session->get("destionation");
  1864.         $Products $session->get("Panier");
  1865.         if ($Products == Null) {
  1866.             $Products = [];
  1867.         }
  1868.         return $this->render('Parent/headerParent2.html.twig', [
  1869.             'produit' => $liste,
  1870.             'Products' => $Products,
  1871.             'destionation' =>  $destination,
  1872.             'nbvocal' =>  $nbvocal
  1873.         ]);
  1874.     }
  1875.     /**
  1876.      * @Route("/Parent/ParametresParent", name="ParametresParent")
  1877.      */
  1878.     public function Parametreparent()
  1879.     {
  1880.         // $sejourservice = $this->sejourService;
  1881.         //$sejour = $sejourservice->getparentsejour($id, $this->getUser());
  1882.         ///$session = $this->session;
  1883.         //$session->set('moncompte', 'parametres');
  1884.         $user $this->getUser();
  1885.         $session $this->session;
  1886.         $idSejour $session->get("Sejour");
  1887.         $sejour $this->em->getRepository(Sejour::class)->find($idSejour);
  1888.         $ParentSejour $this->em->getRepository(ParentSejour::class)->findBy(['idSejour' => $sejour'idParent' => $user]);
  1889.         //ParentSejour
  1890.         //cablala
  1891.         //dd($ParentSejour[0]);
  1892.         //$listeattach = $sejourservice->getatachmentsejour($id);
  1893.         //$listeattachM = $sejourservice->getsejourmessage($id);
  1894.         return $this->render('Parent/Parentparametre.html.twig', [
  1895.             'user' => $user,
  1896.             'sejour' => $sejour,
  1897.             'ParentSejour' => $ParentSejour[0],
  1898.         ]);
  1899.     }
  1900.     /**
  1901.      * @Route("/Parent/Accueil5sur5/ajouteradresslirison", name="ajouteradress_livrson",methods={"POST"})
  1902.      */
  1903.     public function ajouteradresslivr(Request $request)
  1904.     {
  1905.         $UserService $this->userService;
  1906.         //dd($this->getUser()->getId());
  1907.         /** @var \App\Entity\User $user */
  1908.         $user $this->getUser();
  1909.         $iduser $user->getId();
  1910.         $prenom $request->get("prenom");
  1911.         $nom $request->get("nom");
  1912.         $organism $request->get("organism");
  1913.         $num $request->get("num");
  1914.         $rue $request->get('ruevoi');
  1915.         $ville $request->get("villle");
  1916.         $pays $request->get("pays");
  1917.         $codepostal $request->get("codpostal");
  1918.         //adress facturation if exsist
  1919.         $prenomfacturation $request->get("prenomadressfacturation");
  1920.         $nomfacturation $request->get("nomadressfacturation");
  1921.         $organismfacturation $request->get("etablismadressfacturation");
  1922.         $numfacturation $request->get("numdressfacturation");
  1923.         $ruefacturation $request->get('rueadressfacturation');
  1924.         $villefacturation $request->get("villefacturation");
  1925.         $paysfacturation $request->get("payadressfacturation");
  1926.         $codepostalfacturation $request->get("codepostalfacturation");
  1927.         //modification userPArent
  1928.         $usernomAcommpa $request->get("usernom");
  1929.         $userprenomAcommpa $request->get("userprenom");
  1930.         $userfonctionAcommpa $request->get("userfonction");
  1931.         $useretablismentAcommpa $request->get("useretablisment");
  1932.         $useremailcommpa $request->get("useremail");
  1933.         $sejourthem $request->get("sejourthem");
  1934.         $adresssejour $request->get("sejouradresse");
  1935.         $id $request->get("id");
  1936.         $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);
  1937.         return new JsonResponse('done');
  1938.     }
  1939.     /**
  1940.      * @Route("/Accueil5sur5/ajouteradressfacturation", name="ajouteradress_facturation",methods={"POST","GET"})
  1941.      */
  1942.     public function ajouteradressfacturation(Request $request)
  1943.     {
  1944.         $UserService $this->userService;
  1945.         /** @var \App\Entity\User $user */
  1946.         $user $this->getUser();
  1947.         $iduser $user->getId();
  1948.         $num $request->get("num");
  1949.         $rue $request->get('rue');
  1950.         $ville $request->get("ville");
  1951.         $pays $request->get("pays");
  1952.         $codepostal $request->get("codepostal");
  1953.         $adress $UserService->setadressfacturation($num$rue$ville$pays$codepostal$iduser);
  1954.         return new JsonResponse('done');
  1955.     }
  1956.     /**
  1957.      * @Route("/EntrezCode", name="EntrezCode")
  1958.      */
  1959.     public function EntrezCode(Request $request)
  1960.     {
  1961.         $email $request->get('email');
  1962.         $password $request->get('password');
  1963.         $this->session->set('rout''code');
  1964.         return $this->redirectToRoute('CodeSejour', ['email' => $email'password' => $password]);
  1965.     }
  1966.     /**
  1967.      * @Route("/DemandeCode", name="DemandeCode")
  1968.      */
  1969.     public function DemandeCode(Request $request)
  1970.     {
  1971.         $nomEnfant $request->get('nomEnfant');
  1972.         $prenomEnfant $request->get('prenomEnfant');
  1973.         $votreNom $request->get('votreNom');
  1974.         $votrePrenom $request->get('votrePrenom');
  1975.         $Mail $request->get('Mail');
  1976.         $votreLien $request->get('votreLien');
  1977.         $du $request->get('du');
  1978.         $au $request->get('au');
  1979.         $code $request->get('code');
  1980.         $ville $request->get('ville');
  1981.         $listeSejour $this->em->getRepository(Sejour::class)->listAcco($du$au$code$ville);
  1982.         $RefEmail $this->em->getRepository(Ref::class)->find(23);
  1983.         $Email $this->em->getRepository(Emailing::class)->findOneBy(array('typeemail' => $RefEmail'statut' => 9));
  1984.         foreach ($listeSejour as $accompagnateur) {
  1985.             $sendTo $accompagnateur->getIdAcommp()->getEmail();
  1986.             $message = (new \Swift_Message('Demande code séjour'))
  1987.                 ->setFrom('contact@5sur5sejour.com')
  1988.                 ->setTo($sendTo);
  1989.             //->setBcc("contact@5sur5sejour.com");
  1990.             $pathImage2 $Email->getIdImage2()->getPath();
  1991.             $pathImage1 $Email->getIdImage1()->getPath();
  1992.             $image1 $message->embed(Swift_Image::fromPath("$pathImage1"));
  1993.             $image2 $message->embed(Swift_Image::fromPath("$pathImage2"));
  1994.             $iconphoto $message->embed(Swift_Image::fromPath("https://media.5sur5sejour.com/upload/original/Groupe_419_pqx0dx._6656d07326a50.png"));
  1995.             $iconloca $message->embed(Swift_Image::fromPath("https://media.5sur5sejour.com/upload/original/Groupe_420_uynuqz._6656d10f4daaf.png"));
  1996.             $iconmsg $message->embed(Swift_Image::fromPath("https://media.5sur5sejour.com/upload/original/Groupe_418_wbyysk._6656d16240404.png"));
  1997.             $iconfooter $message->embed(Swift_Image::fromPath("https://media.5sur5sejour.com/upload/original/Picto5sur5_rapbfy._6656d1c1bb536.png"));
  1998.             $iMagesProduits $message->embed(Swift_Image::fromPath("https://media.5sur5sejour.com/upload/original/Picto5sur5_rapbfy._6656d1c1bb536.png"));
  1999.             $message->setBody(
  2000.                 $this->templating->render(
  2001.                     'emails/ParentDemandeCodeSejour.html.twig',
  2002.                     [
  2003.                         "nomAcco" => $accompagnateur->getIdAcommp()->getNom(),
  2004.                         "prenomAcco" => $accompagnateur->getIdAcommp()->getPrenom(),
  2005.                         "nomEnfant" => $nomEnfant,
  2006.                         "prenomEnfant" => $prenomEnfant,
  2007.                         "votreNom" => $votreNom,
  2008.                         "votrePrenom" => $votrePrenom,
  2009.                         "mail" => $Mail,
  2010.                         "votreLien" => $votreLien,
  2011.                         "image1" => $image1,
  2012.                         "image2" => $image2,
  2013.                         "iconfooter" => $iconfooter,
  2014.                         "iconphoto" => $iconphoto,
  2015.                         "iconloca" => $iconloca,
  2016.                         "iconmsg" => $iconmsg,
  2017.                         "du" => $du,
  2018.                         "au" => $au,
  2019.                         "code" => $code,
  2020.                         "ville" => $ville,
  2021.                     ]
  2022.                 ),
  2023.                 'text/html'
  2024.             );
  2025.             try {
  2026.                 $signMail $this->getParameter('signMail');
  2027.                 if ($signMail == 'yes') {
  2028.                     $domainName $this->getParameter('domaine');
  2029.                     $selector $this->getParameter('selector');
  2030.                     $PrivateKey file_get_contents($this->getParameter('pathDKIM'));
  2031.                     $signer = new \Swift_Signers_DKIMSigner($PrivateKey$domainName$selector);
  2032.                     $message->attachSigner($signer);
  2033.                 }
  2034.                 $this->mailer->send($message);
  2035.             } catch (\Swift_SwiftException $ex) {
  2036.                 $ex->getMessage();
  2037.             }
  2038.         }
  2039.         return new JsonResponse(count($listeSejour));
  2040.     }
  2041.     /**
  2042.      * @Route("/Parent/ChoixCouverture", name="ChoixCouvertureParent")
  2043.      */
  2044.     public function Couverture()
  2045.     {
  2046.         return $this->render('Parent/ChoixCouverture.html.twig', []);
  2047.     }
  2048.     /**
  2049.      * @Route("/Parent/couvertureAccompagnateur", name="couvertureAccompagnateur")
  2050.      */
  2051.     public function CouvertureAccompagnateur()
  2052.     {
  2053.         $user $this->getUser();
  2054.         $session $this->session;
  2055.         $idSejour $session->get("Sejour");
  2056.         $listeproduit $prod $this->em->getRepository(Produit::class)->findby(array('idsjour' => $idSejour));
  2057.         return $this->render('Parent/couvertureAccompagnateur.html.twig', []);
  2058.     }
  2059.     /**
  2060.      * @Route("/Parent/Projet", name="projet-Parent")
  2061.      */
  2062.     public function parentTWo()
  2063.     {
  2064.         $this->session->set('rout''rout');
  2065.         /** @var \App\Entity\User $user */
  2066.         $user $this->getUser();
  2067.         $session $this->session;
  2068.         $session->set('pageMenu''projets');
  2069.         $idSejour $session->get("Sejour");
  2070.         $listeproduit $this->em->getRepository(Produit::class)->findby(array('idsjour' => $idSejour'iduser' => $user->getId()), ['id' => 'DESC']);
  2071.         $sejour $this->em->getRepository(Sejour::class)->find($idSejour);
  2072.         $parentent_sejour $this->em->getRepository(ParentSejour::class)->findOneBy(["idParent" => $user->getId(), "idSejour" => $idSejour]);
  2073.         return $this->render('Parent/ProjetsParent.html.twig', ['sejour' => $sejour'parentent_sejour' => $parentent_sejour'listeproduit' => $listeproduit]);
  2074.     }
  2075.     /**
  2076.      * @Route("/Parent/MesProjets", name="MesProjets")
  2077.      */
  2078.     public function MesProjets()
  2079.     {
  2080.         return $this->render('Parent/MesProjetsSauvegardes.html.twig', []);
  2081.     }
  2082.     /**
  2083.      * @Route("/Parent/allSejourparent", name="SejourParent")
  2084.      */
  2085.     public function SejourAccompagnateur()
  2086.     {
  2087.         $sejourservice $this->sejourService;
  2088.         $session $this->session;
  2089.         $idSejour $session->get("Sejour");
  2090.         $session->set('rout''rout');
  2091.         /** @var \App\Entity\User $user */
  2092.         $user $this->getUser();
  2093.         $userId $user->getId();
  2094.         $listeSejour $prod $this->em->getRepository(ParentSejour::class)->findby(array('idParent' => $userId));
  2095.         return $this->render('Parent/Messejours.html.twig', ['listeSejour' => $listeSejour]);
  2096.     }
  2097.     /**
  2098.      * @Route("/Parent/Commander", name="Commander")
  2099.      */
  2100.     public function Commander()
  2101.     {
  2102.         $session $this->session;
  2103.         $idSejour $session->get("Sejour");
  2104.         $sejour $this->em->getRepository(Sejour::class)->find($idSejour);
  2105.         $user $this->getUser();
  2106.         $comande $session->get("comande");
  2107.         $panier $session->get("Panier");
  2108.         $nbrprodpromo 0;
  2109.         $nbralbum 0;
  2110.         $nbrlivre 0;
  2111.         $nbrphoto12 0;
  2112.         $nbrphoto24 0;
  2113.         $nbrphoto36 0;
  2114.         $nbrcal 0;
  2115.         $nbrretro12 0;
  2116.         $nbrretro24 0;
  2117.         $nbrretro36 0;
  2118.         $detailsprod = array();
  2119.         $prixalbum 0.0;
  2120.         $prixphoto12 0.0;
  2121.         $prixphoto24 0.0;
  2122.         $prixphoto36 0.0;
  2123.         $prixcal 0.0;
  2124.         $prixalbum 0.0;
  2125.         $prixretro12 0.0;
  2126.         $prixretro24 0.0;
  2127.         $prixretro36 0.0;
  2128.         $prodpanierpromo = array();
  2129.         $promo = array();
  2130.         foreach ($panier as $key => $p) {
  2131.             if ($p['condition'] != 11 && $p['condition'] != 6) {
  2132.                 $promo['condition'] = $p['condition'];
  2133.                 $nbrprodpromo $nbrprodpromo $p['qte'];
  2134.                 array_push($prodpanierpromo$promo);
  2135.                 if ($p['condition'] == 4) {
  2136.                     $nbralbum $nbralbum $p['qte'];
  2137.                     $prixalbum $p['mnt'];
  2138.                 } elseif ($p['condition'] == 1) {
  2139.                     $nbrphoto12 $nbrphoto12 $p['qte'];
  2140.                     $prixphoto12 $p['mnt'];
  2141.                 } elseif ($p['condition'] == 2) {
  2142.                     $nbrphoto24 $nbrphoto24 $p['qte'];
  2143.                     $prixphoto24 $p['mnt'];
  2144.                 } elseif ($p['condition'] == 3) {
  2145.                     $nbrphoto36 $nbrphoto36 $p['qte'];
  2146.                     $prixphoto36  $p['mnt'];
  2147.                 } elseif ($p['condition'] == 5) {
  2148.                     $nbrlivre $nbrlivre $p['qte'];
  2149.                     $prixlivre $p['mnt'];
  2150.                 } elseif ($p['condition'] == 7) {
  2151.                     $nbrcal $nbrcal $p['qte'];
  2152.                     $prixcal $p['mnt'];
  2153.                 } elseif ($p['condition'] == 8) {
  2154.                     $nbrretro36 $nbrretro36 $p['qte'];
  2155.                     $prixretro36 $p['mnt'];
  2156.                 } elseif ($p['condition'] == 9) {
  2157.                     $nbrretro12 $nbrretro12 $p['qte'];
  2158.                     $prixretro12 $p['mnt'];
  2159.                 } elseif ($p['condition'] == 10) {
  2160.                     $nbrretro24 $nbrretro24 $p['qte'];
  2161.                     $prixretro24 $p['mnt'];
  2162.                 }
  2163.             }
  2164.         }
  2165.         $detailsprod['album']['qt'] = $nbralbum;
  2166.         $detailsprod['album']['prix'] = $prixalbum;
  2167.         $detailsprod['photo12']['qt'] = $nbrphoto12;
  2168.         $detailsprod['photo12']['prix'] = $prixphoto12;
  2169.         $detailsprod['photo24']['qt'] = $nbrphoto24;
  2170.         $detailsprod['photo24']['prix'] = $prixphoto24;
  2171.         $detailsprod['photo36']['qt'] = $nbrphoto36;
  2172.         $detailsprod['photo36']['prix'] = $prixphoto36;
  2173.         $detailsprod['cal']['qt'] = $nbrcal;
  2174.         $detailsprod['cal']['prix'] = $prixcal;
  2175.         $detailsprod['livre']['qt'] = $nbrlivre;
  2176.         $detailsprod['livre']['prix'] = $prixalbum;
  2177.         $detailsprod['retro12']['qt'] = $nbrretro12;
  2178.         $detailsprod['retro12']['prix'] = $prixretro12;
  2179.         $detailsprod['retro24']['qt'] = $nbrretro24;
  2180.         $detailsprod['retro24']['prix'] = $prixretro24;
  2181.         $detailsprod['retro36']['qt'] = $nbrretro36;
  2182.         $detailsprod['retro36']['prix'] = $prixretro36;
  2183.         $Panier $session->get("Panier");
  2184.         return $this->render('Parent/commande.html.twig', ["detailsprod" => $detailsprod"nbrprodpromo" => $nbrprodpromo"prodpanierpromo" => $prodpanierpromo"user" => $user"sejour" => $sejour"x" => $panier'Panier' => $Panier]);
  2185.     }
  2186.     /**
  2187.      * @Route("/Parent/MonPanier", name="MonPanier")
  2188.      */
  2189.     public function MonPanier()
  2190.     {
  2191.         /** @var \App\Entity\User $user */
  2192.         $user $this->getUser();
  2193.         $session $this->session;
  2194.         $idSejour $session->get("Sejour");
  2195.         $sejour $this->em->getRepository(Sejour::class)->find($idSejour);
  2196.         $listeproduit $prod $this->em->getRepository(Produit::class)->findby(array('iduser' => $user->getId()));
  2197.         $parentent_sejour $this->em->getRepository(ParentSejour::class)->findOneBy(["idParent" => $user->getId(), "idSejour" => $idSejour]);
  2198.         $Panier $session->get("Panier");
  2199.         //dd($Panier);
  2200.         $prodpanier = array();
  2201.         $nbrprodpromo 0;
  2202.         $nbralbum 0;
  2203.         $nbrlivre 0;
  2204.         $nbrphoto12 0;
  2205.         $nbrphoto24 0;
  2206.         $nbrphoto36 0;
  2207.         $nbrcal 0;
  2208.         $nbrretro12 0;
  2209.         $nbrretro24 0;
  2210.         $nbrretro36 0;
  2211.         $detailsprod = array();
  2212.         $prixalbum 0.0;
  2213.         $prixphoto12 0.0;
  2214.         $prixphoto24 0.0;
  2215.         $prixphoto36 0.0;
  2216.         $prixcal 0.0;
  2217.         $prixalbum 0.0;
  2218.         $prixretro12 0.0;
  2219.         $prixretro24 0.0;
  2220.         $prixretro36 0.0;
  2221.         $prodpanierpromo = array();
  2222.         $promo = array();
  2223.         foreach ($Panier as $key => $p) {
  2224.             if ($p['condition'] != null) {
  2225.                 array_push($prodpanier$p['condition']);
  2226.             }
  2227.             if ($p['condition'] != 11 && $p['condition'] != 6) {
  2228.                 $promo['condition'] = $p['condition'];
  2229.                 $nbrprodpromo $nbrprodpromo $p['qte'];
  2230.                 array_push($prodpanierpromo$promo);
  2231.                 if ($p['condition'] == 4) {
  2232.                     $nbralbum $nbralbum $p['qte'];
  2233.                     $prixalbum $p['mnt'];
  2234.                 } elseif ($p['condition'] == 1) {
  2235.                     $nbrphoto12 $nbrphoto12 $p['qte'];
  2236.                     $prixphoto12 $p['mnt'];
  2237.                 } elseif ($p['condition'] == 2) {
  2238.                     $nbrphoto24 $nbrphoto24 $p['qte'];
  2239.                     $prixphoto24 $p['mnt'];
  2240.                 } elseif ($p['condition'] == 3) {
  2241.                     $nbrphoto36 $nbrphoto36 $p['qte'];
  2242.                     $prixphoto36  $p['mnt'];
  2243.                 } elseif ($p['condition'] == 5) {
  2244.                     $nbrlivre $nbrlivre $p['qte'];
  2245.                     $prixlivre $p['mnt'];
  2246.                 } elseif ($p['condition'] == 7) {
  2247.                     $nbrcal $nbrcal $p['qte'];
  2248.                     $prixcal $p['mnt'];
  2249.                 } elseif ($p['condition'] == 8) {
  2250.                     $nbrretro36 $nbrretro36 $p['qte'];
  2251.                     $prixretro36 $p['mnt'];
  2252.                 } elseif ($p['condition'] == 9) {
  2253.                     $nbrretro12 $nbrretro12 $p['qte'];
  2254.                     $prixretro12 $p['mnt'];
  2255.                 } elseif ($p['condition'] == 10) {
  2256.                     $nbrretro24 $nbrretro24 $p['qte'];
  2257.                     $prixretro24 $p['mnt'];
  2258.                 }
  2259.             }
  2260.         }
  2261.         $detailsprod['album']['qt'] = $nbralbum;
  2262.         $detailsprod['album']['prix'] = $prixalbum;
  2263.         $detailsprod['photo12']['qt'] = $nbrphoto12;
  2264.         $detailsprod['photo12']['prix'] = $prixphoto12;
  2265.         $detailsprod['photo24']['qt'] = $nbrphoto24;
  2266.         $detailsprod['photo24']['prix'] = $prixphoto24;
  2267.         $detailsprod['photo36']['qt'] = $nbrphoto36;
  2268.         $detailsprod['photo36']['prix'] = $prixphoto36;
  2269.         $detailsprod['cal']['qt'] = $nbrcal;
  2270.         $detailsprod['cal']['prix'] = $prixcal;
  2271.         $detailsprod['livre']['qt'] = $nbrlivre;
  2272.         $detailsprod['livre']['prix'] = $prixalbum;
  2273.         $detailsprod['retro12']['qt'] = $nbrretro12;
  2274.         $detailsprod['retro12']['prix'] = $prixretro12;
  2275.         $detailsprod['retro24']['qt'] = $nbrretro24;
  2276.         $detailsprod['retro24']['prix'] = $prixretro24;
  2277.         $detailsprod['retro36']['qt'] = $nbrretro36;
  2278.         $detailsprod['retro36']['prix'] = $prixretro36;
  2279.         $produit $this->typeProduiteService;
  2280.         $produitlist $produit->produitlistTypeConditionnement();
  2281.         //dd( $detailsprod);
  2282.         $this->session->set('rout''rout');
  2283.         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]);
  2284.     }
  2285.     /**
  2286.      * @Route("/Parent/mail", name="mail")
  2287.      */
  2288.     public function mail()
  2289.     {
  2290.         return $this->render('emails/Inscriptionparent.html.twig', []);
  2291.     }
  2292.     /**
  2293.      * @Route("/Parent/AlbummsavealbumParent", name="AlbummsavealbumParent")
  2294.      */
  2295.     public function Albummsavealbum(Request $request)
  2296.     {
  2297.         $session $this->session;
  2298.         $serviceuser $this->etablissementService;
  2299.         $page $request->get("pages");
  2300.         $sejour $request->get("sejour");
  2301.         $prodid $request->get('idProd');
  2302.         $nomprod $request->get('nomprod');
  2303.         $versionalbm $request->get('new');
  2304.         $user $this->getUser();
  2305.         $produittype $session->get("produit");
  2306.         $produit $session->get("produittype");
  2307.         /** @var \App\Entity\User $user */
  2308.         $user $this->getUser();
  2309.         $userEmail $user->getEmail();
  2310.         $Album $serviceuser->savealbumParent($page$user$sejour$prodid$produit$produittype$nomprod$versionalbm);
  2311.         //dd($etablissementDetail);
  2312.         $dateNow = new \Datetime();
  2313.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  2314.         // $this->EmailServie->MailRelancePanier($userEmail);
  2315.         return new response();
  2316.     }
  2317.     /**
  2318.      * @Route("/Parent/saveLivrePhotosParent", name="saveLivrePhotosParent")
  2319.      */
  2320.     public function saveLivrePhotos(Request $request)
  2321.     {
  2322.         $session $this->session;
  2323.         $serviceuser $this->etablissementService;
  2324.         $page $request->get("pages");
  2325.         $sejour $request->get("sejour");
  2326.         $prodid $request->get('idProd');
  2327.         $nomprod $request->get('nomprod');
  2328.         $versionalbm $request->get('new');
  2329.         $user $this->getUser();
  2330.         $produitcondition $session->get("produit");
  2331.         $produit $session->get("produittype");
  2332.         $produitcondss $session->get('produitconditionAlbum');
  2333.         $Album $serviceuser->savelivreParent($page$user$sejour$prodid$produitcondss$nomprod$versionalbm);
  2334.         //dd($etablissementDetail);
  2335.         //sendmail_parent
  2336.         $dateNow = new \Datetime();
  2337.         /** @var \App\Entity\User $user */
  2338.         $user $this->getUser();
  2339.         $userEmail $user->getEmail();
  2340.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  2341.         // $this->EmailServie->MailRelancePanier($userEmail);
  2342.         return new response('done');
  2343.     }
  2344.     /**
  2345.      * @Route("/Parent/SavePhotosPochette", name="SavePhotosPochetteParent")
  2346.      */
  2347.     public function SavePhotosPochetteParent(Request $request)
  2348.     {
  2349.         $session $this->session;
  2350.         $serviceuser $this->etablissementService;
  2351.         $page $request->get("pages");
  2352.         $sejour $request->get("sejour");
  2353.         $prodid $request->get('idProd');
  2354.         $nomprod $request->get('nomprod');
  2355.         $nbr $request->get('nbr');
  2356.         $user $this->getUser();
  2357.         $nbr strval($nbr);
  2358.         $produittype $session->get("produit");
  2359.         $produit $session->get("produittype");
  2360.         $Album $serviceuser->SavePhotosPochetteParent($page$user$sejour$prodid$produit$produittype$nbr$nomprod);
  2361.         //sendmailparent
  2362.         $dateNow = new \Datetime();
  2363.         /** @var \App\Entity\User $user */
  2364.         $user $this->getUser();
  2365.         $userEmail $user->getEmail();
  2366.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  2367.         //$this->EmailServie->MailRelancePanier($userEmail);
  2368.         return new response('done');
  2369.     }
  2370.     /**
  2371.      * @Route("/Parent/RetrosComandeSaveRetros", name="PochettePhotosComandeSave")
  2372.      */
  2373.     public function PochettePhotosComandeSave(Request $request)
  2374.     {
  2375.         $em $this->em;
  2376.         $session $this->session;
  2377.         $serviceuser $this->etablissementService;
  2378.         $page $request->get("pages");
  2379.         $sejour $request->get("sejour");
  2380.         $prodid $request->get('idProd');
  2381.         $nomprod $request->get('nomprod');
  2382.         $nbr $request->get('nbr');
  2383.         $user $this->getUser();
  2384.         $nbr strval($nbr);
  2385.         $produittype $session->get("produit");
  2386.         $produit $session->get("produittype");
  2387.         $Album $serviceuser->SavePhotosRetrosParents($page$user$sejour$prodid$produit$produittype$nbr$nomprod);
  2388.         $inser false;
  2389.         $Products $session->get("Panier");
  2390.         $produit $em->getRepository(Produit::class)->find($Album->getId());
  2391.         //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
  2392.         $user $this->getUser();
  2393.         $typeref $em->getRepository(Typeref::class)->find(8);
  2394.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  2395.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  2396.         //fin
  2397.         if ($panierTrace == null) {
  2398.             $panierTrace = new Panier();
  2399.             $dateNow = new \Datetime();
  2400.             $panierTrace->setDateCreation($dateNow);
  2401.             $panierTrace->setCreerPar($user);
  2402.             $panierTrace->setStatut($statutPanier);
  2403.             $em->getManager()->persist($panierTrace);
  2404.             $em->getManager()->flush();
  2405.         }
  2406.         //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
  2407.         if ($Products == null) {
  2408.             $Products = [];
  2409.         }
  2410.         foreach ($Products as $key => $p) {
  2411.             if ($p['id'] == $produit->getId()) {
  2412.                 $inser true;
  2413.                 $Products[$key]['qte'] = $p['qte'] + 1;
  2414.                 $Products[$key]['mnt'] = $p['mnt'] + $produit->getIdConditionnement()->getMontantTTC();
  2415.             }
  2416.         }
  2417.         //Touhemi 03-07-2020 :Rechercher  si le produti existe déja ds panierProduit
  2418.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  2419.         if ($panierProduit == null) {
  2420.             $panierProduit = new PanierProduit();
  2421.             $panierProduit->setIdProduit($produit);
  2422.             $panierProduit->setIdPanier($panierTrace);
  2423.             $em->getManager()->persist($panierProduit);
  2424.             $em->getManager()->flush();
  2425.         }
  2426.         //fin
  2427.         //   Touhemi 03-07-2020 ajouter plus un au produit et modifier prixTotal
  2428.         $oldQte $panierProduit->getQuantite();
  2429.         $newQte $oldQte 1;
  2430.         $panierProduit->setQuantite($newQte);
  2431.         $oldTotal $panierProduit->getPrixTotal();
  2432.         $newTotal $oldTotal $produit->getIdConditionnement()->getMontantTTC();
  2433.         $panierProduit->setPrixTotal($newTotal);
  2434.         $em->getManager()->persist($panierProduit);
  2435.         $em->getManager()->flush();
  2436.         //fin
  2437.         if ($inser === false) {
  2438.             $p = [];
  2439.             $p["id"] = $produit->getId();
  2440.             $p["nom"] = $produit->getType()->getLabeletype();
  2441.             $p["ident"] = $produit->getLabele();
  2442.             $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  2443.             $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  2444.             $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  2445.             $p["condition"] = $produit->getIdConditionnement()->getId();
  2446.             $p["qte"] = 1;
  2447.             array_push($Products$p);
  2448.         }
  2449.         $session->set('Panier'$Products);
  2450.         //sendmail_parent
  2451.         $dateNow = new \Datetime();
  2452.         /** @var \App\Entity\User $user */
  2453.         $user $this->getUser();
  2454.         $userEmail $user->getEmail();
  2455.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  2456.         //$this->EmailServie->MailRelancePanier($userEmail);
  2457.         return new response('done');
  2458.     }
  2459.     //fonction pour pochett photo comande direct au panier 
  2460.     /**
  2461.      * @Route("/Parent/PochetcomdComandeSave", name="PochettePhotosComandeSave_pochet_panier")
  2462.      */
  2463.     public function PochettePhotosComandeSave_pochet_panier(Request $request)
  2464.     {
  2465.         $em $this->em;
  2466.         $session $this->session;
  2467.         $serviceuser $this->etablissementService;
  2468.         $page $request->get("pages");
  2469.         $sejour $request->get("sejour");
  2470.         $prodid $request->get('idProd');
  2471.         $nomprod $request->get('nomprod');
  2472.         $nbr $request->get('nbr');
  2473.         $user $this->getUser();
  2474.         $nbr strval($nbr);
  2475.         $produittype $session->get("produit");
  2476.         $produit $session->get("produittype");
  2477.         $Album $serviceuser->SavePhotosPochetteParent($page$user$sejour$prodid$produit$produittype$nbr$nomprod);
  2478.         $inser false;
  2479.         $Products $session->get("Panier");
  2480.         $produit $em->getRepository(Produit::class)->find($Album->getId());
  2481.         //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
  2482.         $user $this->getUser();
  2483.         $typeref $em->getRepository(Typeref::class)->find(8);
  2484.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  2485.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  2486.         //fin
  2487.         if ($panierTrace == null) {
  2488.             $panierTrace = new Panier();
  2489.             $dateNow = new \Datetime();
  2490.             $panierTrace->setDateCreation($dateNow);
  2491.             $panierTrace->setCreerPar($user);
  2492.             $panierTrace->setStatut($statutPanier);
  2493.             $em->getManager()->persist($panierTrace);
  2494.             $em->getManager()->flush();
  2495.         }
  2496.         //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
  2497.         if ($Products == null) {
  2498.             $Products = [];
  2499.         }
  2500.         foreach ($Products as $key => $p) {
  2501.             if ($p['id'] == $produit->getId()) {
  2502.                 $inser true;
  2503.                 $Products[$key]['qte'] = $p['qte'] + 1;
  2504.                 $Products[$key]['mnt'] = $p['mnt'] + $produit->getIdConditionnement()->getMontantTTC();
  2505.             }
  2506.         }
  2507.         //Touhemi 03-07-2020 :Rechercher  si le produti existe déja ds panierProduit
  2508.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  2509.         if ($panierProduit == null) {
  2510.             $panierProduit = new PanierProduit();
  2511.             $panierProduit->setIdProduit($produit);
  2512.             $panierProduit->setIdPanier($panierTrace);
  2513.             $em->getManager()->persist($panierProduit);
  2514.             $em->getManager()->flush();
  2515.         }
  2516.         //fin
  2517.         //   Touhemi 03-07-2020 ajouter plus un au produit et modifier prixTotal
  2518.         $oldQte $panierProduit->getQuantite();
  2519.         $newQte $oldQte 1;
  2520.         $panierProduit->setQuantite($newQte);
  2521.         $oldTotal $panierProduit->getPrixTotal();
  2522.         $newTotal $oldTotal $produit->getIdConditionnement()->getMontantTTC();
  2523.         $panierProduit->setPrixTotal($newTotal);
  2524.         $em->getManager()->persist($panierProduit);
  2525.         $em->getManager()->flush();
  2526.         //fin
  2527.         if ($inser === false) {
  2528.             $p = [];
  2529.             $p["id"] = $produit->getId();
  2530.             $p["nom"] = $produit->getType()->getLabeletype();
  2531.             $p["ident"] = $produit->getLabele();
  2532.             $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  2533.             $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  2534.             $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  2535.             $p["condition"] = $produit->getIdConditionnement()->getId();
  2536.             $p["qte"] = 1;
  2537.             array_push($Products$p);
  2538.         }
  2539.         $session->set('Panier'$Products);
  2540.         //sendmail_parent
  2541.         $dateNow = new \Datetime();
  2542.         /** @var \App\Entity\User $user */
  2543.         $user $this->getUser();
  2544.         $userEmail $user->getEmail();
  2545.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  2546.         // $this->EmailServie->MailRelancePanier($userEmail);
  2547.         return new response('done');
  2548.     }
  2549.     //Nouvelle fonction ajout pochette
  2550.     /**
  2551.      * @Route("/Parent/TestcreateFilePhotosNew", name="TestcreateFilePhotosNew")
  2552.      */
  2553.     function TestcreateFilePhotosNew(Request $request)
  2554.     {
  2555.         $prdt $request->get("produit");
  2556.         $printerSer $this->printerService;
  2557.         $pages $this->em->getRepository(Page::class)->findBy(array("idproduit" => $prdt));
  2558.         $this->logger->notice('Generating File for Pack photos');
  2559.         $name =  $printerSer->CreerTcpPhotosPochette_Parent($prdt'NumCmd_963''Photo'$pages);
  2560.         dump($name);
  2561.         die();
  2562.         return ("ok");
  2563.     }
  2564.     //Nouvelle fonction ajout pochette
  2565.     /**
  2566.      * @Route("/Parent/AddPochetteAuPanier", name="AddPochetteAuPanier")
  2567.      */
  2568.     public function AddPochetteAuPanier(Request $request)
  2569.     {
  2570.         $em $this->em;
  2571.         $session $this->session;
  2572.         $serviceuser $this->etablissementService;
  2573.         $page $request->get("photos");
  2574.         $sejour $request->get("sejour");
  2575.         $nbr $request->get('nbr');
  2576.         $user $this->getUser();
  2577.         $nbr strval($nbr);
  2578.         //Enregistrement des infos de la pochette dans un produit et les photos dans des pages avec JSON
  2579.         $Pochette_photos $serviceuser->photosPochette_Nouvelle($page$user$sejour$nbr);
  2580.         $produit $em->getRepository(Produit::class)->find($Pochette_photos->getId());
  2581.         
  2582.       // $zipFileName = $this->printerService->CreerTcpPhotosPochette_Parent($Pochette_photos->getId(), "9999999", "pochette_photo");
  2583.   
  2584.       
  2585.       
  2586.         $inser false;
  2587.         $Products $session->get("Panier");
  2588.         $produit $em->getRepository(Produit::class)->find($Pochette_photos->getId());
  2589.         //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
  2590.         $typeref $em->getRepository(Typeref::class)->find(8);
  2591.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  2592.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  2593.         //fin
  2594.         if ($panierTrace == null) {
  2595.             $panierTrace = new Panier();
  2596.             $dateNow = new \Datetime();
  2597.             $panierTrace->setDateCreation($dateNow);
  2598.             $panierTrace->setCreerPar($user);
  2599.             $panierTrace->setStatut($statutPanier);
  2600.             $em->getManager()->persist($panierTrace);
  2601.             $em->getManager()->flush();
  2602.         }
  2603.         //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
  2604.         if ($Products == null) {
  2605.             $Products = [];
  2606.         }
  2607.         foreach ($Products as $key => $p) {
  2608.             if ($p['id'] == $produit->getId()) {
  2609.                 $inser true;
  2610.                 $Products[$key]['qte'] = $p['qte'] + 1;
  2611.                 $Products[$key]['mnt'] = $p['mnt'] + $produit->getIdConditionnement()->getMontantTTC();
  2612.             }
  2613.         }
  2614.         //Touhemi 03-07-2020 :Rechercher  si le produti existe déja ds panierProduit
  2615.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  2616.         if ($panierProduit == null) {
  2617.             $panierProduit = new PanierProduit();
  2618.             $panierProduit->setIdProduit($produit);
  2619.             $panierProduit->setIdPanier($panierTrace);
  2620.             $em->getManager()->persist($panierProduit);
  2621.             $em->getManager()->flush();
  2622.         }
  2623.         //fin
  2624.       
  2625.         $oldQte $panierProduit->getQuantite();
  2626.         $newQte $oldQte 1;
  2627.         $panierProduit->setQuantite($newQte);
  2628.         $oldTotal $panierProduit->getPrixTotal();
  2629.         $newTotal $oldTotal $produit->getIdConditionnement()->getMontantTTC();
  2630.         $panierProduit->setPrixTotal($newTotal);
  2631.         $em->getManager()->persist($panierProduit);
  2632.         $em->getManager()->flush();
  2633.         // Test creation du fichier zip pdf pochette
  2634.      
  2635.         
  2636.         if ($inser === false) {
  2637.             $p = [];
  2638.             $p["id"] = $produit->getId();
  2639.             $p["nom"] = $produit->getType()->getLabeletype();
  2640.             $p["ident"] = $produit->getLabele();
  2641.             $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  2642.             $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  2643.             $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  2644.             $p["condition"] = $produit->getIdConditionnement()->getId();
  2645.             $p["qte"] = 1;
  2646.             array_push($Products$p);
  2647.         }
  2648.         $session->set('Panier'$Products);
  2649.         //sendmail_parent
  2650.         $dateNow = new \Datetime();
  2651.         /** @var \App\Entity\User $user */
  2652.         $user $this->getUser();
  2653.         $userEmail $user->getEmail();
  2654.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  2655.         // $this->EmailServie->MailRelancePanier($userEmail);
  2656.         //   $this->TestcreateFilePhotosNew($produit);
  2657.         return new response('done');
  2658.     }
  2659.   
  2660.     /**
  2661.      * @Route("/Parent/AddRetroAuPanier", name="AddRetroAuPanier", methods={"POST"})
  2662.      */
  2663.     public function AddRetroAuPanier(Request $request)
  2664.     {
  2665.         $em       $this->em;        // or getDoctrine()->getManager()
  2666.         $session  $this->session;
  2667.         $user $this->getUser();
  2668.         $service  $this->etablissementService// Same service that had photosPochette_Nouvelle
  2669.         $photos   $request->get('photos');     // base64 data, widths, heights, etc.
  2670.         $sejourId $request->get('sejour');
  2671.         $nbr      strval($request->get('nbr'));
  2672.         // 1) Let the service create the new "Retro" product + store pages
  2673.         //    We’ll define photosRetro_Nouvelle similar to photosPochette_Nouvelle
  2674.         $RetroProduit $service->photosRetro_Nouvelle($photos$user$sejourId$nbr);
  2675.         // 2) Same logic to insert that new product in the user’s Panier
  2676.         //    (Essentially the same as your AddPochetteAuPanier code)
  2677.         $inser false;
  2678.         $Products $session->get("Panier");
  2679.         if (!$Products) {
  2680.             $Products = [];
  2681.         }
  2682.         // The newly created product
  2683.         $produit $em->getRepository(Produit::class)->find($RetroProduit->getId());
  2684.         // A) Check if a "Panier" with status "creer" for this user exists,
  2685.         //    or create one if needed
  2686.         $typeref $em->getRepository(Typeref::class)->find(8);
  2687.         $statutPanier $em->getRepository(Ref::class)->findOneBy([
  2688.             "libiller" => "creer",
  2689.             "typeref" => $typeref
  2690.         ]);
  2691.         $panierTrace $em->getRepository(Panier::class)->findOneBy([
  2692.             "creerPar" => $user,
  2693.             "statut"   => $statutPanier
  2694.         ]);
  2695.         if (!$panierTrace) {
  2696.             $panierTrace = new Panier();
  2697.             $panierTrace->setDateCreation(new \DateTime());
  2698.             $panierTrace->setCreerPar($user);
  2699.             $panierTrace->setStatut($statutPanier);
  2700.             $em->getManager()->persist($panierTrace);
  2701.             $em->getManager()->flush();
  2702.         }
  2703.         // B) Check if this product already exists in $Products
  2704.         foreach ($Products as $key => $p) {
  2705.             if ($p['id'] == $produit->getId()) {
  2706.                 $inser true;
  2707.                 $Products[$key]['qte'] += 1;
  2708.                 $Products[$key]['mnt'] += $produit->getIdConditionnement()->getMontantTTC();
  2709.             }
  2710.         }
  2711.         // C) Check if it also exists in PanierProduit table
  2712.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy([
  2713.             "idProduit" => $produit,
  2714.             "idPanier"  => $panierTrace
  2715.         ]);
  2716.         if (!$panierProduit) {
  2717.             $panierProduit = new PanierProduit();
  2718.             $panierProduit->setIdProduit($produit);
  2719.             $panierProduit->setIdPanier($panierTrace);
  2720.             $em->getManager()->persist($panierProduit);
  2721.             $em->getManager()->flush();
  2722.         }
  2723.         // D) Increase quantity & total
  2724.         $oldQte $panierProduit->getQuantite();
  2725.         $panierProduit->setQuantite($oldQte 1);
  2726.         $oldTotal $panierProduit->getPrixTotal();
  2727.         $panierProduit->setPrixTotal($oldTotal $produit->getIdConditionnement()->getMontantTTC());
  2728.         $em->getManager()->persist($panierProduit);
  2729.         $em->getManager()->flush();
  2730.         // E) If not inserted in $Products above, push new array item
  2731.         if (!$inser) {
  2732.             $p = [
  2733.                 "id"         => $produit->getId(),
  2734.                 "nom"        => $produit->getType()->getLabeletype(),
  2735.                 "ident"      => $produit->getLabele(),
  2736.                 "codesejour" => $produit->getIdsjour()->getcodeSejour(),
  2737.                 "mnt"        => $produit->getIdConditionnement()->getMontantTTC(),
  2738.                 "path"       => $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath(),
  2739.                 "condition"  => $produit->getIdConditionnement()->getId(),
  2740.                 "qte"        => 1
  2741.             ];
  2742.             $Products[] = $p;
  2743.         }
  2744.         $session->set('Panier'$Products);
  2745.         /** @var \App\Entity\User $user */
  2746.         $user $this->getUser();
  2747.         $userEmail $user->getEmail();
  2748.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  2749.         return new Response('done');
  2750.     }
  2751.     /**
  2752.      * @Route("/Parent/SavePhotosRetros", name="SavePhotosRetrosParent")
  2753.      */
  2754.     public function SavePhotosRetrosParent(Request $request)
  2755.     {
  2756.         $em $this->em;
  2757.         $session $this->session;
  2758.         $serviceuser $this->etablissementService;
  2759.         $page $request->get("pages");
  2760.         $sejour $request->get("sejour");
  2761.         $prodid $request->get('idProd');
  2762.         $nomprod $request->get('nomprod');
  2763.         $nbr $request->get('nbr');
  2764.         $comandePanier $request->get('comandePanier');
  2765.         $user $this->getUser();
  2766.         $nbr strval($nbr);
  2767.         $produittype $session->get("produit");
  2768.         $produit $session->get("produittype");
  2769.         $Album $serviceuser->SavePhotosRetrosParents($page$user$sejour$prodid$produit$produittype$nbr$nomprod);
  2770.         //dd($etablissementDetail);
  2771.         if ($comandePanier == "comandePanier") {
  2772.             $inser false;
  2773.             $Products $session->get("Panier");
  2774.             $produit $this->em->getRepository(Produit::class)->find($Album->getId());
  2775.             //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
  2776.             $user $this->getUser();
  2777.             $typeref $em->getRepository(Typeref::class)->find(8);
  2778.             $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  2779.             $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  2780.             //fin
  2781.             if ($panierTrace == null) {
  2782.                 $panierTrace = new Panier();
  2783.                 $dateNow = new \Datetime();
  2784.                 $panierTrace->setDateCreation($dateNow);
  2785.                 $panierTrace->setCreerPar($user);
  2786.                 $panierTrace->setStatut($statutPanier);
  2787.                 $em->getManager()->persist($panierTrace);
  2788.                 $em->getManager()->flush();
  2789.             }
  2790.             //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
  2791.             if ($Products == null) {
  2792.                 $Products = [];
  2793.             }
  2794.             foreach ($Products as $key => $p) {
  2795.                 if ($p['id'] == $produit->getId()) {
  2796.                     $inser true;
  2797.                     $Products[$key]['qte'] = $p['qte'] + 1;
  2798.                     $Products[$key]['mnt'] = $p['mnt'] + $produit->getIdConditionnement()->getMontantTTC();
  2799.                 }
  2800.             }
  2801.             //Touhemi 03-07-2020 :Rechercher  si le produti existe déja ds panierProduit
  2802.             $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  2803.             if ($panierProduit == null) {
  2804.                 $panierProduit = new PanierProduit();
  2805.                 $panierProduit->setIdProduit($produit);
  2806.                 $panierProduit->setIdPanier($panierTrace);
  2807.                 $em->getManager()->persist($panierProduit);
  2808.                 $em->getManager()->flush();
  2809.             }
  2810.             //fin
  2811.             //   Touhemi 03-07-2020 ajouter plus un au produit et modifier prixTotal
  2812.             $oldQte $panierProduit->getQuantite();
  2813.             $newQte $oldQte 1;
  2814.             $panierProduit->setQuantite($newQte);
  2815.             $oldTotal $panierProduit->getPrixTotal();
  2816.             $newTotal $oldTotal $produit->getIdConditionnement()->getMontantTTC();
  2817.             $panierProduit->setPrixTotal($newTotal);
  2818.             $em->getManager()->persist($panierProduit);
  2819.             $em->getManager()->flush();
  2820.             //fin
  2821.             if ($inser === false) {
  2822.                 $p = [];
  2823.                 $p["id"] = $produit->getId();
  2824.                 $p["nom"] = $produit->getType()->getLabeletype();
  2825.                 $p["ident"] = $produit->getLabele();
  2826.                 $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  2827.                 $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  2828.                 $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  2829.                 $p["condition"] = $produit->getIdConditionnement()->getId();
  2830.                 $p["qte"] = 1;
  2831.                 array_push($Products$p);
  2832.             }
  2833.             $session->set('Panier'$Products);
  2834.         }
  2835.         //sendmail_parent
  2836.         $dateNow = new \Datetime();
  2837.         /** @var \App\Entity\User $user */
  2838.         $user $this->getUser();
  2839.         $userEmail $user->getEmail();
  2840.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  2841.         // $this->EmailServie->MailRelancePanier($userEmail);
  2842.         return new response($Album->getId());
  2843.     }
  2844.     /**
  2845.      * @Route("/Parent/SaveCalendrierParent", name="SaveCalendrierParent")
  2846.      */
  2847.     public function SaveCalendrierParent(Request $request)
  2848.     {
  2849.         $session $this->session;
  2850.         $serviceuser $this->etablissementService;
  2851.         $page $request->get("pages");
  2852.         $sejour $request->get("sejour");
  2853.         $prodid $request->get('idProd');
  2854.         $nomprod $request->get('nomprod');
  2855.         $nbr $request->get('nbr');
  2856.         $user $this->getUser();
  2857.         $nbr strval($nbr);
  2858.         $produittype $session->get("produit");
  2859.         $produit $session->get("produittype");
  2860.         $Album $serviceuser->SaveCalendrierParent($page$user$sejour$prodid$produit$produittype$nbr$nomprod);
  2861.         //sendmail_parent
  2862.         $dateNow = new \Datetime();
  2863.         /** @var \App\Entity\User $user */
  2864.         $user $this->getUser();
  2865.         $userEmail $user->getEmail();
  2866.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  2867.         //$this->EmailServie->MailRelancePanier($userEmail);
  2868.         return new response('done');
  2869.     }
  2870.     /**
  2871.      * @Route("/Parent/SaveCommandeCalendrierParent", name="SaveCommandeCalendrierParent")
  2872.      */
  2873.     public function SaveCommandeCalendrierParent(Request $request)
  2874.     {
  2875.         $em $this->em;
  2876.         $session $this->session;
  2877.         $serviceuser $this->etablissementService;
  2878.         $page $request->get("pages");
  2879.         $sejour $request->get("sejour");
  2880.         $prodid $request->get('idProd');
  2881.         $nomprod $request->get('nomprod');
  2882.         $nbr $request->get('nbr');
  2883.         $user $this->getUser();
  2884.         $nbr strval($nbr);
  2885.         $produittype $session->get("produit");
  2886.         $produit $session->get("produittype");
  2887.         $Album $serviceuser->SaveCalendrierParent($page$user$sejour$prodid$produit$produittype$nbr$nomprod);
  2888.         $inser false;
  2889.         $Products $session->get("Panier");
  2890.         $produit $em->getRepository(Produit::class)->find($Album->getId());
  2891.         //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
  2892.         $user $this->getUser();
  2893.         $typeref $em->getRepository(Typeref::class)->find(8);
  2894.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  2895.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  2896.         //fin
  2897.         if ($panierTrace == null) {
  2898.             $panierTrace = new Panier();
  2899.             $dateNow = new \Datetime();
  2900.             $panierTrace->setDateCreation($dateNow);
  2901.             $panierTrace->setCreerPar($user);
  2902.             $panierTrace->setStatut($statutPanier);
  2903.             $em->getManager()->persist($panierTrace);
  2904.             $em->getManager()->flush();
  2905.         }
  2906.         //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
  2907.         if ($Products == null) {
  2908.             $Products = [];
  2909.         }
  2910.         foreach ($Products as $key => $p) {
  2911.             if ($p['id'] == $produit->getId()) {
  2912.                 $inser true;
  2913.                 $Products[$key]['qte'] = $p['qte'] + 1;
  2914.                 $Products[$key]['mnt'] = $p['mnt'] + $produit->getIdConditionnement()->getMontantTTC();
  2915.             }
  2916.         }
  2917.         //Touhemi 03-07-2020 :Rechercher  si le produti existe déja ds panierProduit
  2918.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  2919.         if ($panierProduit == null) {
  2920.             $panierProduit = new PanierProduit();
  2921.             $panierProduit->setIdProduit($produit);
  2922.             $panierProduit->setIdPanier($panierTrace);
  2923.             $em->getManager()->persist($panierProduit);
  2924.             $em->getManager()->flush();
  2925.         }
  2926.         //fin
  2927.         //   Touhemi 03-07-2020 ajouter plus un au produit et modifier prixTotal
  2928.         $oldQte $panierProduit->getQuantite();
  2929.         $newQte $oldQte 1;
  2930.         $panierProduit->setQuantite($newQte);
  2931.         $oldTotal $panierProduit->getPrixTotal();
  2932.         $newTotal $oldTotal $produit->getIdConditionnement()->getMontantTTC();
  2933.         $panierProduit->setPrixTotal($newTotal);
  2934.         $em->getManager()->persist($panierProduit);
  2935.         $em->getManager()->flush();
  2936.         //fin
  2937.         if ($inser === false) {
  2938.             $p = [];
  2939.             $p["id"] = $produit->getId();
  2940.             $p["nom"] = $produit->getType()->getLabeletype();
  2941.             $p["ident"] = $produit->getLabele();
  2942.             $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  2943.             $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  2944.             $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  2945.             $p["condition"] = $produit->getIdConditionnement()->getId();
  2946.             $p["qte"] = 1;
  2947.             array_push($Products$p);
  2948.         }
  2949.         $session->set('Panier'$Products);
  2950.         //sendmail_parent
  2951.         $dateNow = new \Datetime();
  2952.         /** @var \App\Entity\User $user */
  2953.         $user $this->getUser();
  2954.         $userEmail $user->getEmail();
  2955.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  2956.         // $this->EmailServie->MailRelancePanier($userEmail);
  2957.         return new response('done');
  2958.     }
  2959.     /**
  2960.      * @Route("/Parent/SavePdfParent", name="SavePdfParent")
  2961.      */
  2962.     public function SavePdfParent(Request $request)
  2963.     {
  2964.         //        $blob = $request->get("blob");
  2965.         if (!empty($_POST['blob'])) {
  2966.             $data $_POST['blob'];
  2967.             $fname "test.pdf"// name the file
  2968.             $file fopen("pdf/" $fname'w'); // open the file path
  2969.             fwrite($file$data); //save data
  2970.             fclose($file);
  2971.         } else {
  2972.             echo "No Data Sent";
  2973.         }
  2974.         return new response('ok');
  2975.     }
  2976.     /**
  2977.      * @Route("/Parent/infosphp", name="infos")
  2978.      */
  2979.     public function infos()
  2980.     {
  2981.         echo phpinfo();
  2982.     }
  2983.     /**
  2984.      * @Route("/Parent/RetrosComandeSaveRetros", name="RetrosComandeSaveRetros")
  2985.      */
  2986.     public function RetrosComandeSaveRetros(Request $request)
  2987.     {
  2988.         $em $this->em;
  2989.         $session $this->session;
  2990.         $serviceuser $this->etablissementService;
  2991.         $page $request->get("pages");
  2992.         $sejour $request->get("sejour");
  2993.         $prodid $request->get('idProd');
  2994.         $nomprod $request->get('nomprod');
  2995.         $nbr $request->get('nbr');
  2996.         $user $this->getUser();
  2997.         $nbr strval($nbr);
  2998.         $produittype $session->get("produit");
  2999.         $produit $session->get("produittype");
  3000.         $Album $serviceuser->SavePhotosRetrosParents($page$user$sejour$prodid$produit$produittype$nbr$nomprod);
  3001.         $inser false;
  3002.         $Products $session->get("Panier");
  3003.         $produit $em->getRepository(Produit::class)->find($Album->getId());
  3004.         //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
  3005.         $user $this->getUser();
  3006.         $typeref $em->getRepository(Typeref::class)->find(8);
  3007.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  3008.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  3009.         //fin
  3010.         if ($panierTrace == null) {
  3011.             $panierTrace = new Panier();
  3012.             $dateNow = new \Datetime();
  3013.             $panierTrace->setDateCreation($dateNow);
  3014.             $panierTrace->setCreerPar($user);
  3015.             $panierTrace->setStatut($statutPanier);
  3016.             $em->getManager()->persist($panierTrace);
  3017.             $em->getManager()->flush();
  3018.         }
  3019.         //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
  3020.         if ($Products == null) {
  3021.             $Products = [];
  3022.         }
  3023.         foreach ($Products as $key => $p) {
  3024.             if ($p['id'] == $produit->getId()) {
  3025.                 $inser true;
  3026.                 $Products[$key]['qte'] = $p['qte'] + 1;
  3027.                 $Products[$key]['mnt'] = $p['mnt'] + $produit->getIdConditionnement()->getMontantTTC();
  3028.             }
  3029.         }
  3030.         //Touhemi 03-07-2020 :Rechercher  si le produti existe déja ds panierProduit
  3031.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  3032.         if ($panierProduit == null) {
  3033.             $panierProduit = new PanierProduit();
  3034.             $panierProduit->setIdProduit($produit);
  3035.             $panierProduit->setIdPanier($panierTrace);
  3036.             $em->getManager()->persist($panierProduit);
  3037.             $em->getManager()->flush();
  3038.         }
  3039.         //fin
  3040.         //   Touhemi 03-07-2020 ajouter plus un au produit et modifier prixTotal
  3041.         $oldQte $panierProduit->getQuantite();
  3042.         $newQte $oldQte 1;
  3043.         $panierProduit->setQuantite($newQte);
  3044.         $oldTotal $panierProduit->getPrixTotal();
  3045.         $newTotal $oldTotal $produit->getIdConditionnement()->getMontantTTC();
  3046.         $panierProduit->setPrixTotal($newTotal);
  3047.         $em->getManager()->persist($panierProduit);
  3048.         $em->getManager()->flush();
  3049.         //fin
  3050.         if ($inser === false) {
  3051.             $p = [];
  3052.             $p["id"] = $produit->getId();
  3053.             $p["nom"] = $produit->getType()->getLabeletype();
  3054.             $p["ident"] = $produit->getLabele();
  3055.             $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  3056.             $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  3057.             $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  3058.             $p["condition"] = $produit->getIdConditionnement()->getId();
  3059.             $p["qte"] = 1;
  3060.             array_push($Products$p);
  3061.         }
  3062.         $session->set('Panier'$Products);
  3063.         return new response('done');
  3064.     }
  3065.     /**
  3066.      * @Route("/Parent/nbvisite", name="nbvisite",methods={"POST","GET"})
  3067.      */
  3068.     public function ajouternombrevisite(Request $request)
  3069.     {
  3070.         $SejourService $this->sejourService;
  3071.         $CarteService $this->carteService;
  3072.         $typevisite $request->get("typevisite");
  3073.         $idsejour $request->get("idsejour");
  3074.         $idattach $request->get("idattachement");
  3075.         if ($typevisite == "carte") {
  3076.             $nbvisite $CarteService->carteVisite($idsejour);
  3077.         } else {
  3078.             $nbvisite $SejourService->affectationnbvisiteattachement($idsejour$idattach);
  3079.         }
  3080.         return new JsonResponse('done');
  3081.     }
  3082.     /**
  3083.      * @Route("/Parent/ajouterauPanier_Parent", name="Ajouter_MonPanier")
  3084.      */
  3085.     public function Ajouter_MonPanier(Request $request)
  3086.     {
  3087.         $inser false;
  3088.         $session $this->session;
  3089.         $em $this->em;
  3090.         $Products $session->get("Panier");
  3091.         $id $request->get("id");
  3092.         //Touhemi :Rechercher  si l'utilisateur a déja un panier avec statut créer ds la bd , sinon on écrit un panier
  3093.         $user $this->getUser();
  3094.         $typeref $em->getRepository(Typeref::class)->find(8);
  3095.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  3096.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  3097.         //fin
  3098.         if ($panierTrace == null) {
  3099.             $panierTrace = new Panier();
  3100.             $dateNow = new \Datetime();
  3101.             $panierTrace->setDateCreation($dateNow);
  3102.             $panierTrace->setCreerPar($user);
  3103.             $panierTrace->setStatut($statutPanier);
  3104.             $em->getManager()->persist($panierTrace);
  3105.             $em->getManager()->flush();
  3106.         }
  3107.         $produit $this->em->getRepository(Produit::class)->find($id);
  3108.         if ($Products == null) {
  3109.             $Products = [];
  3110.         }
  3111.         //Touhemi :Rechercher  si le produti existe déja ds panierProduit
  3112.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  3113.         if ($panierProduit == null) {
  3114.             $panierProduit = new PanierProduit();
  3115.             $panierProduit->setIdProduit($produit);
  3116.             $panierProduit->setIdPanier($panierTrace);
  3117.             $em->getManager()->persist($panierProduit);
  3118.             $em->getManager()->flush();
  3119.         }
  3120.         //fin
  3121.         foreach ($Products as $key => $p) {
  3122.             if ($p['id'] == $produit->getId()) {
  3123.                 $inser true;
  3124.                 $Products[$key]['qte'] = $p['qte'] + 1;
  3125.             }
  3126.         }
  3127.         //Touhemi ajouter plus un au produit et modifier prixTotal
  3128.         $oldQte $panierProduit->getQuantite();
  3129.         $newQte $oldQte 1;
  3130.         $panierProduit->setQuantite($newQte);
  3131.         $oldTotal $panierProduit->getPrixTotal();
  3132.         $newTotal $oldTotal $produit->getIdConditionnement()->getMontantTTC();
  3133.         $panierProduit->setPrixTotal($newTotal);
  3134.         $this->em->getManager()->persist($panierProduit);
  3135.         $this->em->getManager()->flush();
  3136.         //fin
  3137.         if ($inser === false) {
  3138.             //get nessaisire element
  3139.             $p = [];
  3140.             $p["id"] = $produit->getId();
  3141.             $p["nom"] = $produit->getType()->getLabeletype();
  3142.             $p["ident"] = $produit->getLabele();
  3143.             $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  3144.             $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  3145.             $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  3146.             $p["condition"] = $produit->getIdConditionnement()->getId();
  3147.             $p["qte"] = 1;
  3148.             array_push($Products$p);
  3149.         }
  3150.         $session->set('Panier'$Products);
  3151.         return new JsonResponse('done');
  3152.     }
  3153.     /**
  3154.      * @Route("/Parent/Ajouter_Album_Parent", name="Ajouter_Album_Parent_Alb")
  3155.      */
  3156.     public function Ajouter_Album(Request $request)
  3157.     {
  3158.         $session $this->session;
  3159.         $id $request->get("id");
  3160.         $typeProdcondition $this->em->getRepository(TypeProduitConditionnement::class)->find($id);
  3161.         $typeprod $typeProdcondition->getIdTypeProduit()->getId();
  3162.         $session->set('produit'$id);
  3163.         $session->set('produitconditionAlbum'$id);
  3164.         $session->set('produittype'$typeprod);
  3165.         return new JsonResponse('done');
  3166.     }
  3167.     /**
  3168.      * @Route("/Parent/ComandeParent", name="ComandeParent")
  3169.      */
  3170.     public function comande_Parent(Request $request)
  3171.     {
  3172.         $session $this->session;
  3173.         // $comande = $request->get("p");
  3174.         $Panier $session->get("Panier");
  3175.         $session->set('comande'$Panier);
  3176.         return new JsonResponse('done');
  3177.     }
  3178.     /**
  3179.      * @Route("/Parent/Accueil5sur5/adresse_comande", name="adresse_comande",methods={"POST"})
  3180.      */
  3181.     public function adresse_comande(Request $request)
  3182.     {
  3183.         $UserService $this->userService;
  3184.         /** @var \App\Entity\User $user */
  3185.         $user $this->getUser();
  3186.         $iduser $user->getId();
  3187.         $idCommande $request->get("idCommande");
  3188.         $prenom $request->get("prenom");
  3189.         $nom $request->get("nom");
  3190.         $organism $request->get("organism");
  3191.         $rue $request->get('ruevoi');
  3192.         $ville $request->get("villle");
  3193.         $pays $request->get("pays");
  3194.         $codepostal $request->get("codpostal");
  3195.         //adress facturation if exsist
  3196.         $prenomfacturation $request->get("prenomadressfacturation");
  3197.         $nomfacturation $request->get("nomadressfacturation");
  3198.         $organismfacturation $request->get("etablismadressfacturation");
  3199.         $ruefacturation $request->get('rueadressfacturation');
  3200.         $villefacturation $request->get("villefacturation");
  3201.         $paysfacturation $request->get("payadressfacturation");
  3202.         $codepostalfacturation $request->get("codepostalfacturation");
  3203.         //modification userPArent
  3204.         $em $this->em;
  3205.         $adress $UserService->modifieradress_comande($rue$ville$pays$codepostal$iduser$prenom$nom$organism$prenomfacturation$nomfacturation$organismfacturation$ruefacturation$villefacturation$paysfacturation$codepostalfacturation);
  3206.         $commande $em->getRepository(Commande::class)->findOneBy(array("id" => $idCommande));
  3207.         $commande->setAdresslivraison($adress);
  3208.         $commande->setAddresseLivraison($ville);
  3209.         $commande->setAdressfactoration($adress);
  3210.         $em->getManager()->persist($commande);
  3211.         $em->getManager()->flush();
  3212.         return new JsonResponse('Adresse Enregitrée');
  3213.     }
  3214.     /**
  3215.      * @Route("/Parent/Accueil5sur5/codesecuriter", name="codesecuriter",methods={"POST"})
  3216.      */
  3217.     public function codesecuriter(Request $request)
  3218.     {
  3219.         $UserService $this->userService;
  3220.         /** @var \App\Entity\User $user */
  3221.         $user $this->getUser();
  3222.         $iduser $user->getId();
  3223.         $code1 $request->get("code1");
  3224.         $code2 $request->get("code2");
  3225.         $code3 $request->get("code3");
  3226.         $set1 $request->get("set");
  3227.         if ($set1 == 1) {
  3228.             if ($code1 == "") {
  3229.                 return new Response('erore');
  3230.             }
  3231.             $adress $UserService->codesecuriter($code1$iduser);
  3232.         }
  3233.         if ($set1 == 2) {
  3234.             if ($code2 == "") {
  3235.                 return new Response('erore');
  3236.             }
  3237.             $adress $UserService->codesecuriter($code2$iduser);
  3238.         }
  3239.         if ($set1 == 3) {
  3240.             if ($code3 == "") {
  3241.                 return new Response('erore');
  3242.             }
  3243.             $adress $UserService->codesecuriter($code3$iduser);
  3244.         }
  3245.         return new Response('done');
  3246.     }
  3247.     /**
  3248.      * @Route("/Parent/Accueil5sur5/suprimer_Album_panier", name="suprimer_Album_panier",methods={"POST"})
  3249.      */
  3250.     public function suprimer_Album_panier(Request $request)
  3251.     {
  3252.         $session $this->session;
  3253.         $Products $session->get("Panier");
  3254.         $id $request->get("p");
  3255.         foreach ($Products as $key => $p) {
  3256.             if ($p['id'] == $id) {
  3257.                 unset($Products[$key]);
  3258.             }
  3259.         }
  3260.         $session->set('Panier'$Products);
  3261.         $em $this->em;
  3262.         $user $this->getUser();
  3263.         $produit $em->getRepository(Produit::class)->find($id);
  3264.         $typeref $em->getRepository(Typeref::class)->find(8);
  3265.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  3266.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  3267.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  3268.         $em->getManager()->remove($panierProduit);
  3269.         $em->getManager()->flush();
  3270.         return new Response('done');
  3271.     }
  3272.     /**
  3273.      * @Route("/Parent/Accueil5sur5/additiondproduit_parent", name="additiondproduit_parent",methods={"POST"})
  3274.      */
  3275.     public function additiondproduit_parent(Request $request)
  3276.     {
  3277.         $session $this->session;
  3278.         $Products $session->get("Panier");
  3279.         $id $request->get("p");
  3280.         foreach ($Products as $key => $p) {
  3281.             if ($p['id'] == $id) {
  3282.                 $qte_dans_panier $Products[$key]['qte'];
  3283.                 $mnt_dans_panier $Products[$key]['mnt'] / $qte_dans_panier;
  3284.                 $Products[$key]['qte'] = $p['qte'] + 1;
  3285.                 // $Products[$key]['mnt']=$p['mnt']+$mnt_dans_panier;
  3286.             }
  3287.         }
  3288.         $session->set('Panier'$Products);
  3289.         //Touhemi addition au panier produit ds bd
  3290.         $em $this->em;
  3291.         $user $this->getUser();
  3292.         $produit $em->getRepository(Produit::class)->find($id);
  3293.         $typeref $em->getRepository(Typeref::class)->find(8);
  3294.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  3295.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  3296.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  3297.         if ($panierProduit != null) {
  3298.             $oldQte $panierProduit->getQuantite();
  3299.             $newQte $oldQte 1;
  3300.             $panierProduit->setQuantite($newQte);
  3301.             $oldTotal $panierProduit->getPrixTotal();
  3302.             $newTotal $oldTotal $produit->getIdConditionnement()->getMontantTTC();
  3303.             $panierProduit->setPrixTotal($newTotal);
  3304.             $em->getManager()->persist($panierProduit);
  3305.             $em->getManager()->flush();
  3306.         }
  3307.         return new Response('done');
  3308.     }
  3309.     /**
  3310.      * @Route("/Parent/Accueil5sur5/sousstractionproduit_parent", name="sousstractionproduit_parent",methods={"POST"})
  3311.      */
  3312.     public function sousstractionproduit_parent(Request $request)
  3313.     {
  3314.         $session $this->session;
  3315.         $Products $session->get("Panier");
  3316.         $id $request->get("p");
  3317.         foreach ($Products as $key => $p) {
  3318.             if ($p['id'] == $id) {
  3319.                 $qte_dans_panier $Products[$key]['qte'];
  3320.                 $mnt_dans_panier $Products[$key]['mnt'] / $qte_dans_panier;
  3321.                 $Products[$key]['qte'] = $p['qte'] - 1;
  3322.                 // $Products[$key]['mnt']=$p['mnt']-$mnt_dans_panier;
  3323.                 $set $Products[$key];
  3324.             }
  3325.             if ($Products[$key]['qte'] == 0) {
  3326.                 unset($Products[$key]);
  3327.             }
  3328.         }
  3329.         $session->set('Panier'$Products);
  3330.         $em $this->em;
  3331.         $user $this->getUser();
  3332.         $produit $em->getRepository(Produit::class)->find($id);
  3333.         $typeref $em->getRepository(Typeref::class)->find(8);
  3334.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  3335.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  3336.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  3337.         if ($panierProduit != null) {
  3338.             $oldQte $panierProduit->getQuantite();
  3339.             $newQte $oldQte 1;
  3340.             if ($newQte 0) {
  3341.                 $panierProduit->setQuantite($newQte);
  3342.                 $oldTotal $panierProduit->getPrixTotal();
  3343.                 $newTotal $oldTotal $produit->getIdConditionnement()->getMontantTTC();
  3344.                 $panierProduit->setPrixTotal($newTotal);
  3345.                 $em->getManager()->persist($panierProduit);
  3346.                 $em->getManager()->flush();
  3347.             }
  3348.             if ($newQte == 0) {
  3349.                 $em->getManager()->remove($panierProduit);
  3350.                 $em->getManager()->flush();
  3351.             }
  3352.         }
  3353.         return new Response('done');
  3354.     }
  3355.     /**
  3356.      * @Route("Parent/AjoutAlbum_parent/{idAlbm}", name="EditionAlbumfrompanier")
  3357.      */
  3358.     public function EditionAlbumParent_panier($idAlbm)
  3359.     {
  3360.         $SEjourService $this->sejourService;
  3361.         /** @var \App\Entity\User $user */
  3362.         $user $this->getUser();
  3363.         $userId $user->getId();
  3364.         $user $this->getUser();
  3365.         $session $this->session;
  3366.         $session->set('pageMenu''');
  3367.         $idSejour $session->get("Sejour");
  3368.         $produitcondition $session->get("produit");
  3369.         $produit $session->get("produittype");
  3370.         $sejour $SEjourService->getsejourpourparent($idSejour);
  3371.         $em $this->em;
  3372.         $clipart null;
  3373.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  3374.         $nbLikes 0;
  3375.         if ($listeattachlikephoto) {
  3376.             $nbLikes count($listeattachlikephoto);
  3377.         }
  3378.         $AllPages null;
  3379.         $Albumproduct null;
  3380.         $AllPagesAcc null;
  3381.         $random false;
  3382.         $Albumproduct $em->getRepository(Produit::class)->find($idAlbm);
  3383.         if ($Albumproduct == null || $Albumproduct == "") {
  3384.             $Albumproduct $em->getRepository(Produit::class)->findOneBy(['labele' => 'random']);
  3385.             $random true;
  3386.         }
  3387.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  3388.         $idAcc $sejour->getIdAcommp();
  3389.         $albumAcc null;
  3390.         $allpagesResult = array();
  3391.         $tabacc = array();
  3392.         $tabacc1 = array();
  3393.         foreach ($AllPages as $page) {
  3394.             $pageJ json_decode($page->getCouleurbordure());
  3395.             $pageDec json_decode($pageJ[0]);
  3396.             $attache json_decode($pageDec->attache);
  3397.             foreach ($attache as $att) {
  3398.                 $attachDec json_decode($att);
  3399.                 if (isset($attachDec->id) && json_decode($attachDec->id) !== null && $attachDec->id !== '') {
  3400.                     $idAttach json_decode($attachDec->id);
  3401.                     array_push($tabacc$idAttach);
  3402.                 }
  3403.             }
  3404.         }
  3405.         $tabacc1 array_count_values($tabacc);
  3406.         $part $sejour->getIdPartenaire();
  3407.         $nompart $part->getUsername();
  3408.         $logopart $part->getLogourl();
  3409.         $session->set('produit'$Albumproduct->gettype());
  3410.         $listeattach $SEjourService->getatachmentsejour($idSejour);
  3411.         $nbphoto count($listeattach);
  3412.         if ($Albumproduct->getVersion() === 'new') {
  3413.             if ($nbLikes != 0) {
  3414.                 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]);
  3415.             }
  3416.             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]);
  3417.         } else {
  3418.             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]);
  3419.         }
  3420.     }
  3421.     /**
  3422.      * @Route("/Parent/Accueil5sur5/modifierLabel_produit_parent", name="modifierLabel_produit_parent",methods={"POST"})
  3423.      */
  3424.     public function modifierLabel_produit_parent(Request $request)
  3425.     {
  3426.         $SEjourService $this->sejourService;
  3427.         /** @var \App\Entity\User $user */
  3428.         $user $this->getUser();
  3429.         $userId $user->getId();
  3430.         $session $this->session;
  3431.         $idPrd $request->get("id");
  3432.         $description $request->get("description");
  3433.         $SEjourService->modif_lbel_Produit($idPrd$description);
  3434.         $Products $session->get("Panier");
  3435.         if ($Products != null) {
  3436.             foreach ($Products as $key => $p) {
  3437.                 if ($idPrd == $p['id']) {
  3438.                     $Products[$key]["ident"] = $description;
  3439.                 }
  3440.             }
  3441.         }
  3442.         $session->set('Panier'$Products);
  3443.         return new Response('done');
  3444.     }
  3445.     /**
  3446.      * @Route("/Parent/checkCodePromoParents", name="checkCodePromoParents")
  3447.      */
  3448.     public function checkCodePromoParents(Request $request)
  3449.     {
  3450.         $em $this->em;
  3451.         $SejourService $this->sejourService;
  3452.         $session $this->get('session');
  3453.         $code $request->get('code');
  3454.         $idUser $request->get('idUser');
  3455.         $user $em->getRepository(User::class)->findOneBy(['id' => $idUser]);
  3456.         $CodePromoUtilisse "";
  3457.         $totalpanier  $request->get('totalPanier');
  3458.         $infosPromo $SejourService->checkCodePromoPrents($code$user);
  3459.         $remise 0;
  3460.         $pourcentage 0;
  3461.         if (isset($infosPromo['remise'])) {
  3462.             $remise =  $infosPromo['remise'];
  3463.         }
  3464.         if (isset($infosPromo['pourcentage'])) {
  3465.             $pourcentage =  $infosPromo['pourcentage'];
  3466.         }
  3467.         $totalRemise $totalpanier $pourcentage;
  3468.         $totalRemise = ($totalRemise) / 100;
  3469.         $totalpanierNew $totalpanier $totalRemise;
  3470.         $tvaTotalRemise =   ($totalpanierNew 20) / 100;
  3471.         $user->setShowdetailsphotos("4");
  3472.         $em->getManager()->persist($user);
  3473.         $em->getManager()->flush();
  3474.         return new JsonResponse(array('message' =>  $infosPromo['test'], 'pourcentage' => intval($infosPromo['pourcentage']), 'remise' => $remise'totalDupanier' => $totalpanierNew'totalRemise' => $totalRemise"tvaTotalRemise" => $tvaTotalRemise"CodePromoUtilisse" => $CodePromoUtilisse), 200);
  3475.     }
  3476.     /**
  3477.      * @Route("/Parent/Accueil5sur5/ParentcomandeProduit", name="ParentcomandeProduit",methods={"POST"})
  3478.      */
  3479.     public function ParentcomandeProduit(Request $request)
  3480.     {
  3481.         $em $this->em;
  3482.         $comandeservice $this->commandeService;
  3483.         $sejourService $this->sejourService;
  3484.         /** @var \App\Entity\User $user */
  3485.         $user $this->getUser();
  3486.         $userId $user->getId();
  3487.         $session $this->session;
  3488.         $frais $request->get("fraiEnvoi");
  3489.         $Products $session->get("Panier");
  3490.         $totalepanier $request->get("totalepanier");
  3491.         $envoipost $request->get("envoipost");
  3492.         $remise $request->get("remise");
  3493.         $totalBlackFriday $request->get("totalBlackFriday");
  3494.         $session->set('envoipost'$envoipost);
  3495.         $containsProduitType20 false;
  3496.         $comand $comandeservice->addcomande_parent($Products$userId$frais$totalepanier$envoipost$remise$containsProduitType20);
  3497.         $codePromo $request->get('codePromo');
  3498.         $test $sejourService->checkCodePromo($codePromo);
  3499.         if (isset($test['test'])) {
  3500.             if ($test['test'] == true) {
  3501.                 $promotion $sejourService->findPromotionByCode($codePromo);
  3502.                 if ($promotion) {
  3503.                     $listeProduitsCommande $em->getRepository(ComandeProduit::class)->findBy(array('idComande' => $comand->getId()));
  3504.                     $pourcentage intval($promotion->getPourcentage());
  3505.                     if ($promotion->getNbreApplicable() == 1) {
  3506.                         foreach ($listeProduitsCommande as $cmdProduit) {
  3507.                             $cmdProduit->setPourcentage($pourcentage);
  3508.                             $em->getManager()->persist($cmdProduit);
  3509.                             $em->getManager()->flush();
  3510.                         }
  3511.                     } else {
  3512.                         foreach ($listeProduitsCommande as $cmdProduit) {
  3513.                             $qte $cmdProduit->getQuantiter();
  3514.                             for ($i 0$i $qte$i++) {
  3515.                                 $ligneCmdProd = new ComandeProduit();
  3516.                                 $ligneCmdProd->setQuantiter(1);
  3517.                                 $ligneCmdProd->setIdProduit($cmdProduit->getIdProduit());
  3518.                                 $ligneCmdProd->setIdComande($cmdProduit->getIdComande());
  3519.                                 $ligneCmdProd->setDate($cmdProduit->getDate());
  3520.                                 $em->getManager()->persist($ligneCmdProd);
  3521.                                 $em->getManager()->remove($cmdProduit);
  3522.                             }
  3523.                             $em->getManager()->flush();
  3524.                         }
  3525.                         $listeProduitsCommande $em->getRepository(ComandeProduit::class)->findBy(array('idComande' => $comand->getId()));
  3526.                         $qte 0;
  3527.                         $tabPrices = [];
  3528.                         foreach ($listeProduitsCommande as $cmdProduit) {
  3529.                             $ligne = array('idCmdProduit' => $cmdProduit->getId(), 'price' => $cmdProduit->getIdProduit()->getIdConditionnement()->getMontantTTC());
  3530.                             $qte += $cmdProduit->getQuantiter();
  3531.                             array_push($tabPrices$ligne);
  3532.                         }
  3533.                         $x intval($qte $promotion->getNbreApplicable());
  3534.                         $this->aasort($tabPrices"price");
  3535.                         $tabPricesPromo =   array_slice($tabPrices, -$x$xtrue);
  3536.                         foreach ($tabPricesPromo as $item) {
  3537.                             $cp $em->getRepository(ComandeProduit::class)->find($item['idCmdProduit']);
  3538.                             $cp->setPourcentage($pourcentage);
  3539.                             $em->getManager()->persist($cp);
  3540.                             $em->getManager()->flush();
  3541.                         }
  3542.                     }
  3543.                     $comand->setIdPromotion($promotion);
  3544.                 }
  3545.             }
  3546.         }
  3547.         $session->set('commandeActual'$comand->getId());
  3548.         return new Response($comand->getId());
  3549.     }
  3550.     function aasort(&$array$key)
  3551.     {
  3552.         $sorter = array();
  3553.         $ret = array();
  3554.         reset($array);
  3555.         foreach ($array as $ii => $va) {
  3556.             $sorter[$ii] = $va[$key];
  3557.         }
  3558.         arsort($sorter);
  3559.         foreach ($sorter as $ii => $va) {
  3560.             $ret[$ii] = $array[$ii];
  3561.         }
  3562.         $array $ret;
  3563.     }
  3564.     /**
  3565.      * @Route("Parent/LivreSejourParent", name="Livre_du_Sejour")
  3566.      */
  3567.     public function LivreSejourParent()
  3568.     {
  3569.         $SEjourService $this->sejourService;
  3570.         /** @var \App\Entity\User $user */
  3571.         $user $this->getUser();
  3572.         $userId $user->getId();
  3573.         $user $this->getUser();
  3574.         $session $this->session;
  3575.         $idSejour $session->get("Sejour");
  3576.         $session->set('LivreSejour''LivreSejour');
  3577.         $sejour $SEjourService->getsejourpourparent($idSejour);
  3578.         $em $this->em;
  3579.         $clipart null;
  3580.         $AllPages null;
  3581.         $AllPagesAcc null;
  3582.         $random false;
  3583.         $codeSejour $sejour->getCodeSejour();
  3584.         $nomprod "Livre_Sejour" $codeSejour;
  3585.         $sejour $em->getRepository(Sejour::class)->findOneBy(['id' => $idSejour]);
  3586.         $Albumproduct $em->getRepository(Produit::class)->findOneBy(['version' => 'Livre_Sejour_Admin''labele' => $nomprod'idsjour' => $idSejour]);
  3587.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  3588.         $tabacc = array();
  3589.         $tabacc1 = array();
  3590.         foreach ($AllPages as $page) {
  3591.             $pageJ json_decode($page->getCouleurbordure());
  3592.             $pageDec json_decode($pageJ[0]);
  3593.             $attache json_decode($pageDec->attache);
  3594.             foreach ($attache as $att) {
  3595.                 $attachDec json_decode($att);
  3596.                 if (isset($attachDec->id) && json_decode($attachDec->id) !== null && $attachDec->id !== '') {
  3597.                     $idAttach json_decode($attachDec->id);
  3598.                     array_push($tabacc$idAttach);
  3599.                 }
  3600.             }
  3601.         }
  3602.         $tabacc1 array_count_values($tabacc);
  3603.         $part $sejour->getIdPartenaire();
  3604.         $nompart $part->getUsername();
  3605.         $logopart $part->getLogourl();
  3606.         $listeattach $SEjourService->getatachmentsejour($idSejour);
  3607.         $nbPhoto count($listeattach);
  3608.         //  $session->set('produit', $Albumproduct->gettype());
  3609.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  3610.         $nbLikes count($listeattachlikephoto);
  3611.         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]);
  3612.     }
  3613.     /**
  3614.      * @Route("Parent/LivrePhotos_Parent/{idAlbm}", name="Editionlivrefrompanier")
  3615.      */
  3616.     public function EditionLivrePhotosParentparId($idAlbm)
  3617.     {
  3618.         $SEjourService $this->sejourService;
  3619.         /** @var \App\Entity\User $user */
  3620.         $user $this->getUser();
  3621.         $userId $user->getId();
  3622.         $user $this->getUser();
  3623.         $session $this->session;
  3624.         $session->set('pageMenu''');
  3625.         $idSejour $session->get("Sejour");
  3626.         $produit $session->get("produit");
  3627.         $sejour $SEjourService->getsejourpourparent($idSejour);
  3628.         $em $this->em;
  3629.         $clipart null;
  3630.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  3631.         $nbLikes count($listeattachlikephoto);
  3632.         $AllPages null;
  3633.         $Albumproduct null;
  3634.         $AllPagesAcc null;
  3635.         $random false;
  3636.         $Albumproduct $em->getRepository(Produit::class)->find($idAlbm);
  3637.         if ($Albumproduct == null || $Albumproduct == "") {
  3638.             $Albumproduct $em->getRepository(Produit::class)->findOneBy(['labele' => 'random']);
  3639.             $random true;
  3640.         }
  3641.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  3642.         $idAcc $sejour->getIdAcommp();
  3643.         $albumAcc null;
  3644.         $allpagesResult = array();
  3645.         $tabacc = array();
  3646.         $tabacc1 = array();
  3647.         foreach ($AllPages as $page) {
  3648.             $pageJ json_decode($page->getCouleurbordure());
  3649.             $pageDec json_decode($pageJ[0]);
  3650.             $attache json_decode($pageDec->attache);
  3651.             foreach ($attache as $att) {
  3652.                 $attachDec json_decode($att);
  3653.                 if (isset($attachDec->id) && json_decode($attachDec->id) !== null && $attachDec->id !== '') {
  3654.                     $idAttach json_decode($attachDec->id);
  3655.                     array_push($tabacc$idAttach);
  3656.                 }
  3657.             }
  3658.         }
  3659.         $tabacc1 array_count_values($tabacc);
  3660.         $part $sejour->getIdPartenaire();
  3661.         $nompart $part->getUsername();
  3662.         $logopart $part->getLogourl();
  3663.         $listeattach $SEjourService->getatachmentsejour($idSejour);
  3664.         $nbPhoto count($listeattach);
  3665.         $session->set('produit'$Albumproduct->gettype());
  3666.         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]);
  3667.     }
  3668.     /**
  3669.      * @Route("Parent/ModificationPochettePhotos/{nbr}/{id}", name="EditionPochettefrompanier")
  3670.      */
  3671.     public function EditionPochetteParentfrompanier($nbr$id)
  3672.     {
  3673.         $SEjourService $this->sejourService;
  3674.         /** @var \App\Entity\User $user */
  3675.         $user $this->getUser();
  3676.         $userId $user->getId();
  3677.         $user $this->getUser();
  3678.         $session $this->session;
  3679.         $session->set('pageMenu''');
  3680.         $idSejour $session->get("Sejour");
  3681.         $produitcondition $session->get("produit");
  3682.         $produit $session->get("produittype");
  3683.         $sejour $SEjourService->getsejourpourparent($idSejour);
  3684.         $em $this->em;
  3685.         $clipart $em->getRepository(Clipart::class)->findAll();
  3686.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  3687.         $listeattach $SEjourService->getatachmentsejour($idSejour);
  3688.         $nbLikes count($listeattachlikephoto);
  3689.         //Stella
  3690.         $AllPagesAcc null;
  3691.         $random false;
  3692.         $Albumproduct $em->getRepository(Produit::class)->findOneBy(['id' => $id]);
  3693.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  3694.         $idAcc $sejour->getIdAcommp();
  3695.         $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  3696.         $part $sejour->getIdPartenaire();
  3697.         $nompart $part->getUsername();
  3698.         $logopart $part->getLogourl();
  3699.         $nomProjet $Albumproduct->getLabele();
  3700.         $nbPhoto count($listeattach);
  3701.         $nbLikes count($listeattachlikephoto);
  3702.         if ($nbLikes $nbr) {
  3703.             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]);
  3704.         }
  3705.         if ($nbLikes >= $nbr) {
  3706.             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]);
  3707.         }
  3708.     }
  3709.     /**
  3710.      * @Route("Parent/ModificationCalendrier/{id}", name="EditionCalendrierParentfrompanier")
  3711.      */
  3712.     public function EditionCalendrierParentfrompanier($id)
  3713.     {
  3714.         $SEjourService $this->sejourService;
  3715.         /** @var \App\Entity\User $user */
  3716.         $user $this->getUser();
  3717.         $userId $user->getId();
  3718.         $user $this->getUser();
  3719.         $session $this->session;
  3720.         $session->set('pageMenu''');
  3721.         $idSejour $session->get("Sejour");
  3722.         $produitcondition $session->get("produit");
  3723.         $produit $session->get("produittype");
  3724.         $sejour $SEjourService->getsejourpourparent($idSejour);
  3725.         $em $this->em;
  3726.         $clipart $em->getRepository(Clipart::class)->findAll();
  3727.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  3728.         $random false;
  3729.         $Albumproduct $em->getRepository(Produit::class)->findOneBy(['id' => $id]);
  3730.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  3731.         $part $sejour->getIdPartenaire();
  3732.         $nompart $part->getUsername();
  3733.         $logopart $part->getLogourl();
  3734.         return $this->render('Parent/Calendrier.html.twig', ["nompart" => $nompart"logopart" => $logopart"sejour" => $sejour'like' => $listeattachlikephoto'cliparts' => $clipart'Album' => $Albumproduct'AllPages' => $AllPages'random' => $random]);
  3735.     }
  3736.     /**
  3737.      * @Route("Parent/ModificationPhotosRetros/{nbr}/{id}", name="EditionRetrofrompanier")
  3738.      */
  3739.     public function EditionRetroParentfrompanier($nbr$id)
  3740.     {
  3741.         $SEjourService $this->sejourService;
  3742.         /** @var \App\Entity\User $user */
  3743.         $user $this->getUser();
  3744.         $userId $user->getId();
  3745.         $user $this->getUser();
  3746.         $session $this->session;
  3747.         $session->set('pageMenu''');
  3748.         $idSejour $session->get("Sejour");
  3749.         $produitcondition $session->get("produit");
  3750.         $produit $session->get("produittype");
  3751.         $sejour $SEjourService->getsejourpourparent($idSejour);
  3752.         $em $this->em;
  3753.         $clipart $em->getRepository(Clipart::class)->findAll();
  3754.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  3755.         $listerandom $listeattachlikephoto;
  3756.         $nbLikes count($listeattachlikephoto);
  3757.         $AllPagesAcc null;
  3758.         $random false;
  3759.         $Albumproduct $em->getRepository(Produit::class)->findOneBy(['id' => $id]);
  3760.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  3761.         $idAcc $sejour->getIdAcommp();
  3762.         $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  3763.         $part $sejour->getIdPartenaire();
  3764.         $nompart $part->getUsername();
  3765.         $logopart $part->getLogourl();
  3766.         //Liste des photos public
  3767.         $listeattach $SEjourService->getatachmentsejour($idSejour);
  3768.         $nbPhoto =  $listeattach;
  3769.         if ($nbLikes == 0) {
  3770.             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]);
  3771.         }
  3772.         if ($nbLikes != 0) {
  3773.             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]);
  3774.         }
  3775.     }
  3776.     //CommanderalbumSejour
  3777.     /**
  3778.      * @Route("/Parent/CommanderalbumSejour", name="CommanderalbumSejour")
  3779.      */
  3780.     public function CommanderalbumSejour(Request $request)
  3781.     {
  3782.         $session $this->session;
  3783.         $serviceuser $this->etablissementService;
  3784.         $page $request->get("pages");
  3785.         $sejour $request->get("sejour");
  3786.         $prodid $request->get('idProd');
  3787.         $nomprod $request->get('nomprod');
  3788.         $versionalbm $request->get('new');
  3789.         $user $this->getUser();
  3790.         $em $this->em;
  3791.         //  $AlbumSejour  = $em->getRepository(Produit::class)->findOneBy(array("id" =>$prodid));
  3792.         $produit $session->get("produittype");
  3793.         $produitcondi $session->get("produit");
  3794.         $Album $serviceuser->saveCopyalbumParent($page$user$sejour$prodid$produit$produitcondi$nomprod$versionalbm);
  3795.         $inser false;
  3796.         $session $this->session;
  3797.         $Products $session->get("Panier");
  3798.         $produit $this->em->getRepository(Produit::class)->find($Album->getId());
  3799.         $user $this->getUser();
  3800.         $typeref $em->getRepository(Typeref::class)->find(8);
  3801.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  3802.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  3803.         //fin
  3804.         if ($panierTrace == null) {
  3805.             $panierTrace = new Panier();
  3806.             $dateNow = new \Datetime();
  3807.             $panierTrace->setDateCreation($dateNow);
  3808.             $panierTrace->setCreerPar($user);
  3809.             $panierTrace->setStatut($statutPanier);
  3810.             $em->getManager()->persist($panierTrace);
  3811.             $em->getManager()->flush();
  3812.         }
  3813.         if ($Products == null) {
  3814.             $Products = [];
  3815.         }
  3816.         foreach ($Products as $key => $p) {
  3817.             if ($p['id'] == $produit->getId()) {
  3818.                 $inser true;
  3819.                 $Products[$key]['qte'] = $p['qte'] + 1;
  3820.                 $Products[$key]['mnt'] = $p['mnt'] + $produit->getIdConditionnement()->getMontantTTC();
  3821.             }
  3822.         }
  3823.         //Touhemi :Rechercher  si le produti existe déja ds panierProduit
  3824.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $Album"idPanier" => $panierTrace));
  3825.         if ($panierProduit == null) {
  3826.             $panierProduit = new PanierProduit();
  3827.             $panierProduit->setIdProduit($Album);
  3828.             $panierProduit->setIdPanier($panierTrace);
  3829.             $em->getManager()->persist($panierProduit);
  3830.             $em->getManager()->flush();
  3831.         }
  3832.         //fin
  3833.         //Touhemi ajouter plus un au produit et modifier prixTotal
  3834.         $oldQte $panierProduit->getQuantite();
  3835.         $newQte $oldQte 1;
  3836.         $panierProduit->setQuantite($newQte);
  3837.         $oldTotal $panierProduit->getPrixTotal();
  3838.         $newTotal $oldTotal $Album->getIdConditionnement()->getMontantTTC();
  3839.         $panierProduit->setPrixTotal($newTotal);
  3840.         $this->em->getManager()->persist($panierProduit);
  3841.         $this->em->getManager()->flush();
  3842.         //fin
  3843.         if ($inser === false) {
  3844.             //get nessaisire element
  3845.             $p = [];
  3846.             $p["id"] = $produit->getId();
  3847.             $p["nom"] = $produit->getType()->getLabeletype();
  3848.             $p["ident"] = $produit->getLabele();
  3849.             $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  3850.             $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  3851.             $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  3852.             $p["condition"] = $produit->getIdConditionnement()->getId();
  3853.             $p["qte"] = 1;
  3854.             array_push($Products$p);
  3855.         }
  3856.         $session->set('Panier'$Products);
  3857.         //sendemail_parent
  3858.         $dateNow = new \Datetime();
  3859.         /** @var \App\Entity\User $user */
  3860.         $user $this->getUser();
  3861.         $userEmail $user->getEmail();
  3862.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  3863.         //$this->EmailServie->MailRelancePanier($userEmail);
  3864.         //dd($etablissementDetail);
  3865.         return new response('done');
  3866.     }
  3867.     /**
  3868.      * @Route("/Parent/AlbummsavealbumcomandeParent", name="AlbummsavealbumcomandeParent")
  3869.      */
  3870.     public function Albummcomandesavealbum(Request $request)
  3871.     {
  3872.         $session $this->session;
  3873.         $serviceuser $this->etablissementService;
  3874.         $page $request->get("pages");
  3875.         $sejour $request->get("sejour");
  3876.         $prodid $request->get('idProd');
  3877.         $nomprod $request->get('nomprod');
  3878.         $versionalbm $request->get('new');
  3879.         $user $this->getUser();
  3880.         $produit $session->get("produittype");
  3881.         $produitcondi $session->get("produit");
  3882.         $Album $serviceuser->savealbumParent($page$user$sejour$prodid$produit$produitcondi$nomprod$versionalbm);
  3883.         $inser false;
  3884.         $session $this->session;
  3885.         $Products $session->get("Panier");
  3886.         $produit $this->em->getRepository(Produit::class)->find($Album->getId());
  3887.         $em $this->em;
  3888.         $user $this->getUser();
  3889.         $typeref $em->getRepository(Typeref::class)->find(8);
  3890.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  3891.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  3892.         //fin
  3893.         if ($panierTrace == null) {
  3894.             $panierTrace = new Panier();
  3895.             $dateNow = new \Datetime();
  3896.             $panierTrace->setDateCreation($dateNow);
  3897.             $panierTrace->setCreerPar($user);
  3898.             $panierTrace->setStatut($statutPanier);
  3899.             $em->getManager()->persist($panierTrace);
  3900.             $em->getManager()->flush();
  3901.         }
  3902.         if ($Products == null) {
  3903.             $Products = [];
  3904.         }
  3905.         foreach ($Products as $key => $p) {
  3906.             if ($p['id'] == $produit->getId()) {
  3907.                 $inser true;
  3908.                 $Products[$key]['qte'] = $p['qte'] + 1;
  3909.                 $Products[$key]['mnt'] = $p['mnt'] + $produit->getIdConditionnement()->getMontantTTC();
  3910.             }
  3911.         }
  3912.         //Touhemi :Rechercher  si le produti existe déja ds panierProduit
  3913.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $Album"idPanier" => $panierTrace));
  3914.         if ($panierProduit == null) {
  3915.             $panierProduit = new PanierProduit();
  3916.             $panierProduit->setIdProduit($Album);
  3917.             $panierProduit->setIdPanier($panierTrace);
  3918.             $em->getManager()->persist($panierProduit);
  3919.             $em->getManager()->flush();
  3920.         }
  3921.         //fin
  3922.         //Touhemi ajouter plus un au produit et modifier prixTotal
  3923.         $oldQte $panierProduit->getQuantite();
  3924.         $newQte $oldQte 1;
  3925.         $panierProduit->setQuantite($newQte);
  3926.         $oldTotal $panierProduit->getPrixTotal();
  3927.         $newTotal $oldTotal $Album->getIdConditionnement()->getMontantTTC();
  3928.         $panierProduit->setPrixTotal($newTotal);
  3929.         $this->em->getManager()->persist($panierProduit);
  3930.         $this->em->getManager()->flush();
  3931.         //fin
  3932.         if ($inser === false) {
  3933.             //get nessaisire element
  3934.             $p = [];
  3935.             $p["id"] = $produit->getId();
  3936.             $p["nom"] = $produit->getType()->getLabeletype();
  3937.             $p["ident"] = $produit->getLabele();
  3938.             $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  3939.             $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  3940.             $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  3941.             $p["condition"] = $produit->getIdConditionnement()->getId();
  3942.             $p["qte"] = 1;
  3943.             array_push($Products$p);
  3944.         }
  3945.         $session->set('Panier'$Products);
  3946.         //sendemail_parent
  3947.         $dateNow = new \Datetime();
  3948.         /** @var \App\Entity\User $user */
  3949.         $user $this->getUser();
  3950.         $userEmail $user->getEmail();
  3951.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  3952.         //$this->EmailServie->MailRelancePanier($userEmail);
  3953.         //dd($etablissementDetail);
  3954.         return new response('done');
  3955.     }
  3956.     /**
  3957.      * @Route("/Parent/saveLivrePhotosParentPanier", name="saveLivrePhotosParentPanier")
  3958.      */
  3959.     public function saveLivrePhotospuisPanier(Request $request)
  3960.     {
  3961.         $em $this->em;
  3962.         $session $this->session;
  3963.         $produittype $session->get("produit");
  3964.         $produit $session->get("produittype");
  3965.         $serviceuser $this->etablissementService;
  3966.         $page $request->get("pages");
  3967.         $sejour $request->get("sejour");
  3968.         $prodid $request->get('idProd');
  3969.         $nomprod $request->get('nomprod');
  3970.         $versionalbm $request->get('new');
  3971.         $user $this->getUser();
  3972.         $Album $serviceuser->savelivreParent($page$user$sejour$prodid$produittype$nomprod$versionalbm);
  3973.         //dd($etablissementDetail);
  3974.         $inser false;
  3975.         $session $this->session;
  3976.         $Products $session->get("Panier");
  3977.         $produit $em->getRepository(Produit::class)->find($Album->getId());
  3978.         //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
  3979.         $user $this->getUser();
  3980.         $typeref $em->getRepository(Typeref::class)->find(8);
  3981.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  3982.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  3983.         //fin
  3984.         if ($panierTrace == null) {
  3985.             $panierTrace = new Panier();
  3986.             $dateNow = new \Datetime();
  3987.             $panierTrace->setDateCreation($dateNow);
  3988.             $panierTrace->setCreerPar($user);
  3989.             $panierTrace->setStatut($statutPanier);
  3990.             $em->getManager()->persist($panierTrace);
  3991.             $em->getManager()->flush();
  3992.         }
  3993.         //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
  3994.         if ($Products == null) {
  3995.             $Products = [];
  3996.         }
  3997.         foreach ($Products as $key => $p) {
  3998.             if ($p['id'] == $produit->getId()) {
  3999.                 $inser true;
  4000.                 $Products[$key]['qte'] = $p['qte'] + 1;
  4001.                 // $Products[$key]['mnt'] = $p['mnt'] + $produit->getType()->getTraif();
  4002.             }
  4003.         }
  4004.         //Touhemi 03-07-2020 :Rechercher  si le produti existe déja ds panierProduit
  4005.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  4006.         if ($panierProduit == null) {
  4007.             $panierProduit = new PanierProduit();
  4008.             $panierProduit->setIdProduit($produit);
  4009.             $panierProduit->setIdPanier($panierTrace);
  4010.             $em->getManager()->persist($panierProduit);
  4011.             $em->getManager()->flush();
  4012.         }
  4013.         //fin
  4014.         //   Touhemi 02-07-2020 ajouter plus un au produit et modifier prixTotal
  4015.         $oldQte $panierProduit->getQuantite();
  4016.         $newQte $oldQte 1;
  4017.         $panierProduit->setQuantite($newQte);
  4018.         $oldTotal $panierProduit->getPrixTotal();
  4019.         $newTotal $oldTotal $produit->getIdConditionnement()->getMontantTTC();
  4020.         $panierProduit->setPrixTotal($newTotal);
  4021.         $em->getManager()->persist($panierProduit);
  4022.         $em->getManager()->flush();
  4023.         //fin
  4024.         if ($inser === false) {
  4025.             //get nessaisire element
  4026.             $p = [];
  4027.             $p["id"] = $produit->getId();
  4028.             $p["nom"] = $produit->getType()->getLabeletype();
  4029.             $p["ident"] = $produit->getLabele();
  4030.             $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  4031.             $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  4032.             $p["condition"] = $produit->getIdConditionnement()->getId();
  4033.             $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  4034.             $p["qte"] = 1;
  4035.             array_push($Products$p);
  4036.         }
  4037.         $session->set('Panier'$Products);
  4038.         //sendmail_patrent
  4039.         $dateNow = new \Datetime();
  4040.         /** @var \App\Entity\User $user */
  4041.         $user $this->getUser();
  4042.         $userEmail $user->getEmail();
  4043.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  4044.         // $this->EmailServie->MailRelancePanier($userEmail);
  4045.         return new response('done');
  4046.     }
  4047.     /**
  4048.      * @Route("parent/condcnx", name="connexionparentsejour",methods={"POST"})
  4049.      */
  4050.     public function condition(Request $request)
  4051.     {
  4052.         $UserService $this->userService;
  4053.         $id $request->get('id');
  4054.         $ParentSejour $UserService->conditioncnxparent($id);
  4055.         return new JsonResponse('done');
  4056.     }
  4057.     /**
  4058.      * @Route("/Parent/MaPropresPhotos", name="MaPropresPhotos")
  4059.      */
  4060.     public function MaPropresPhotos(Request $request)
  4061.     {
  4062.         $path $request->get("path");
  4063.         $type $request->get("type");
  4064.         $sejId $request->get("id");
  4065.         $dateSejour $request->get("date");
  4066.         $SejourServiceattachh $this->sejourService;
  4067.         $Userservicemail $this->userService;
  4068.         $sejourfind $SejourServiceattachh->sejoursansattach($sejId);
  4069.         //$sendmail = $Userservicemail->sendmailuserforfirstattach($sejId);
  4070.         $attachementservice $this->attachementService;
  4071.         foreach ($path as $key => $path) {
  4072.             $src $path['path'];
  4073.             $attachement $attachementservice->creationAttachementS($src$type$dateSejour);
  4074.             $sejourservice $this->sejourService;
  4075.             $sejAttach $sejourservice->monpropreattachement($sejId$attachement$this->getUser());
  4076.             if ((array_key_exists("latitude"$path)) && ($path['latitude'] != null)) {
  4077.                 $lat $path['latitude'];
  4078.                 $lng $path['longitude'];
  4079.                 $Cartervice $this->carteService;
  4080.                 $position $Cartervice->create_newPositionImage($this->getUser(), $lat$lng);
  4081.                 $Cartervice->affecterPosition($attachement$position);
  4082.                 $FindSejour $this->em->getRepository(Sejour::class)->find($sejId);
  4083.                 $FindSejour->setEtatAdresseCarte(true);
  4084.                 $this->em->getManager()->persist($FindSejour);
  4085.                 $this->em->getManager()->flush();
  4086.             }
  4087.             //Ajouter les photos aux favoris
  4088.             $Like $this->photosFavorisService;
  4089.             $Like->AddFavoris($this->getUser(), $attachement$sejId);
  4090.         }
  4091.         return new JsonResponse(["id" => $attachement->getId()]);;
  4092.     }
  4093.     /**
  4094.      * @Route("/Parent/Ajouter_photo_sejour", name="pathadddnewphotos")
  4095.      */
  4096.     public function pathaddnewphotos()
  4097.     {
  4098.         /** @var \App\Entity\User $user */
  4099.         $user $this->getUser();
  4100.         $userId $user->getId();
  4101.         $session $this->session;
  4102.         $idParent $session->get("Sejour");
  4103.         $idSejour $session->get("Sejour");
  4104.         $conxparent $this->sejourService;
  4105.         $sejour1 $conxparent->sejourParentcnx($idSejour$idParent);
  4106.         //dd($sejour1);
  4107.         $SEjourService $this->sejourService;
  4108.         $sejour $SEjourService->getsejour($idSejour);
  4109.         //  dd($sejour);
  4110.         //Liste des photos public
  4111.         $listeattach $SEjourService->getatachmentsejour($idSejour);
  4112.         //Liste des photos privé
  4113.         //        $listeattachPrivate = $SEjourService->getatachmentsejourparent($idSejour, $this->getUser()->getId());
  4114.         //        $AllPhotosParent = array_merge_recursive($listeattach, $listeattachPrivate);
  4115.         $listeVideo $SEjourService->getVideosejour($idSejour);
  4116.         $AllAttachements array_merge_recursive($listeattach$listeVideo);
  4117.         $nbImages count($listeattach);
  4118.         $positions $SEjourService->getsejourposition($idSejour);
  4119.         $messages $SEjourService->getsejourmessage($idSejour);
  4120.         $em $this->em;
  4121.         $parentsejour $SEjourService->getparentsejour($userId$idSejour);
  4122.         //dd($parentsejour);
  4123.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  4124.         $produits $this->typeProduiteService;
  4125.         $liste $produits->produitlistTypeConditionnement();
  4126.         $pubProd $user->getShowpubprod();
  4127.         $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  4128.         if ($albumAcc == null) {
  4129.             $albumAcc $em->getRepository(Produit::class)->findOneBy(['iduser' => 1'statut' => "Album_sejour"'idsjour' => $sejour]);
  4130.         }
  4131.         return $this->render('Parent/DetailsSejour.html.twig', [
  4132.             "sejour" => $sejour,
  4133.             'listeattach' => $AllAttachements,
  4134.             'nbImages' => $nbImages,
  4135.             'albumAcc' => $albumAcc,
  4136.             'positions' => $positions,
  4137.             'messages' => $messages,
  4138.             'like' => $listeattachlikephoto,
  4139.             "parentsejour" => $parentsejour,
  4140.             'prod' => $liste,
  4141.             'smsnotif' => $parentsejour->getSmsnotif(),
  4142.             'showpub' => $pubProd
  4143.         ]);
  4144.     }
  4145.     /**
  4146.      * @Route("/Parent/ajouterauPanier_Parent_coffret", name="comandercoffre")
  4147.      */
  4148.     public function Ajouter_MonPanier_Coffret()
  4149.     {
  4150.         $em $this->em;
  4151.         $inser false;
  4152.         $session $this->session;
  4153.         $idSejour $session->get("Sejour");
  4154.         $userId $this->getUser();
  4155.         /** @var \App\Entity\User $user */
  4156.         $user $this->getUser();
  4157.         $userIdCom $user->getId();
  4158.         $sejourobj $this->em->getRepository(Sejour::class)->find($idSejour);
  4159.         $prodct $this->em->getRepository(Typeproduit::class)->find(15);
  4160.         $version $this->em->getRepository(Produit::class)->SearchVersionproduit($userIdCom);
  4161.         $Conditionnement $this->em->getRepository(TypeProduitConditionnement::class)->find(6);
  4162.         $Products $session->get("Panier");
  4163.         //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
  4164.         $user $this->getUser();
  4165.         $typeref $em->getRepository(Typeref::class)->find(8);
  4166.         $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  4167.         $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  4168.         //fin
  4169.         if ($panierTrace == null) {
  4170.             $panierTrace = new Panier();
  4171.             $dateNow = new \Datetime();
  4172.             $panierTrace->setDateCreation($dateNow);
  4173.             $panierTrace->setCreerPar($user);
  4174.             $panierTrace->setStatut($statutPanier);
  4175.             $em->getManager()->persist($panierTrace);
  4176.             $em->getManager()->flush();
  4177.         }
  4178.         //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
  4179.         $produit $em->getRepository(Produit::class)->findOneBy(array("type" => $prodct'idConditionnement' => $Conditionnement'idsjour' => $sejourobj'iduser' => $user));
  4180.         if ($produit == null) {
  4181.             $produit = new Produit;
  4182.             $produit->setLabele("Coffret cadeau");
  4183.             $produit->setIduser($userId);
  4184.             $produit->setIdsjour($sejourobj);
  4185.             $produit->setDate(new \DateTime());
  4186.             $produit->setIdConditionnement($Conditionnement);
  4187.             $produit->setType($prodct);
  4188.             $em->getManager()->persist($produit);
  4189.             $em->getManager()->flush();
  4190.         }
  4191.         if ($Products == null) {
  4192.             $Products = [];
  4193.         }
  4194.         foreach ($Products as $key => $p) {
  4195.             if ($p['id'] == $produit->getId()) {
  4196.                 $inser true;
  4197.                 $Products[$key]['qte'] = $p['qte'] + 1;
  4198.                 // $Products[$key]['mnt'] = $p['mnt'] + $produit->getType()->getTraif();
  4199.             }
  4200.         }
  4201.         //Touhemi 03-07-2020 :Rechercher  si le produti existe déja ds panierProduit
  4202.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  4203.         if ($panierProduit == null) {
  4204.             $panierProduit = new PanierProduit();
  4205.             $panierProduit->setIdProduit($produit);
  4206.             $panierProduit->setIdPanier($panierTrace);
  4207.             $em->getManager()->persist($panierProduit);
  4208.             $em->getManager()->flush();
  4209.         }
  4210.         //fin
  4211.         //   Touhemi 03-07-2020 ajouter plus un au produit et modifier prixTotal
  4212.         $oldQte $panierProduit->getQuantite();
  4213.         $newQte $oldQte 1;
  4214.         $panierProduit->setQuantite($newQte);
  4215.         $oldTotal $panierProduit->getPrixTotal();
  4216.         $newTotal $oldTotal $produit->getIdConditionnement()->getMontantTTC();
  4217.         $panierProduit->setPrixTotal($newTotal);
  4218.         $em->getManager()->persist($panierProduit);
  4219.         $em->getManager()->flush();
  4220.         //fin
  4221.         if ($inser === false) {
  4222.             //get nessaisire element
  4223.             $p = [];
  4224.             $p["id"] = $produit->getId();
  4225.             $p["nom"] = $produit->getType()->getLabeletype();
  4226.             $p["ident"] = $produit->getLabele();
  4227.             $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  4228.             $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  4229.             $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  4230.             $p["condition"] = $produit->getIdConditionnement()->getId();
  4231.             $p["qte"] = 1;
  4232.             array_push($Products$p);
  4233.         }
  4234.         //sendmailproduct_parent
  4235.         $dateNow = new \Datetime();
  4236.         /** @var \App\Entity\User $user */
  4237.         $user $this->getUser();
  4238.         $userEmail $user->getEmail();
  4239.         $userId $user->getId();
  4240.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  4241.         //$this->EmailServie->MailRelancePanier($userEmail);
  4242.         $listeproduit $prod $this->em->getRepository(Produit::class)->findby(array('iduser' => $userId));
  4243.         $session->set('Panier'$Products);
  4244.         $Panier $session->get("Panier");
  4245.         $produit $this->typeProduiteService;
  4246.         $produitlist $produit->produitlistTypeConditionnement();
  4247.         $this->session->set('rout''rout');
  4248.         $parentent_sejour $this->em->getRepository(ParentSejour::class)->findOneBy(["idParent" => $this->getUser(), "idSejour" => $sejourobj]);
  4249.         $prodpanier = array();
  4250.         $nbrprodpromo 0;
  4251.         $nbralbum 0;
  4252.         $nbrlivre 0;
  4253.         $nbrphoto12 0;
  4254.         $nbrphoto24 0;
  4255.         $nbrphoto36 0;
  4256.         $nbrcal 0;
  4257.         $nbrretro12 0;
  4258.         $nbrretro24 0;
  4259.         $nbrretro36 0;
  4260.         $detailsprod = array();
  4261.         $prixalbum 0.0;
  4262.         $prixphoto12 0.0;
  4263.         $prixphoto24 0.0;
  4264.         $prixphoto36 0.0;
  4265.         $prixcal 0.0;
  4266.         $prixalbum 0.0;
  4267.         $prixretro12 0.0;
  4268.         $prixretro24 0.0;
  4269.         $prixretro36 0.0;
  4270.         $prodpanierpromo = array();
  4271.         $promo = array();
  4272.         foreach ($Panier as $key => $p) {
  4273.             if ($p['condition'] != null) {
  4274.                 array_push($prodpanier$p['condition']);
  4275.             }
  4276.             if ($p['condition'] != 11 && $p['condition'] != 6) {
  4277.                 $promo['condition'] = $p['condition'];
  4278.                 $nbrprodpromo $nbrprodpromo $p['qte'];
  4279.                 array_push($prodpanierpromo$promo);
  4280.                 if ($p['condition'] == 4) {
  4281.                     $nbralbum $nbralbum $p['qte'];
  4282.                     $prixalbum $p['mnt'];
  4283.                 } elseif ($p['condition'] == 1) {
  4284.                     $nbrphoto12 $nbrphoto12 $p['qte'];
  4285.                     $prixphoto12 $p['mnt'];
  4286.                 } elseif ($p['condition'] == 2) {
  4287.                     $nbrphoto24 $nbrphoto24 $p['qte'];
  4288.                     $prixphoto24 $p['mnt'];
  4289.                 } elseif ($p['condition'] == 3) {
  4290.                     $nbrphoto36 $nbrphoto36 $p['qte'];
  4291.                     $prixphoto36  $p['mnt'];
  4292.                 } elseif ($p['condition'] == 5) {
  4293.                     $nbrlivre $nbrlivre $p['qte'];
  4294.                     $prixlivre $p['mnt'];
  4295.                 } elseif ($p['condition'] == 7) {
  4296.                     $nbrcal $nbrcal $p['qte'];
  4297.                     $prixcal $p['mnt'];
  4298.                 } elseif ($p['condition'] == 8) {
  4299.                     $nbrretro36 $nbrretro36 $p['qte'];
  4300.                     $prixretro36 $p['mnt'];
  4301.                 } elseif ($p['condition'] == 9) {
  4302.                     $nbrretro12 $nbrretro12 $p['qte'];
  4303.                     $prixretro12 $p['mnt'];
  4304.                 } elseif ($p['condition'] == 10) {
  4305.                     $nbrretro24 $nbrretro24 $p['qte'];
  4306.                     $prixretro24 $p['mnt'];
  4307.                 }
  4308.             }
  4309.         }
  4310.         $detailsprod['album']['qt'] = $nbralbum;
  4311.         $detailsprod['album']['prix'] = $prixalbum;
  4312.         $detailsprod['photo12']['qt'] = $nbrphoto12;
  4313.         $detailsprod['photo12']['prix'] = $prixphoto12;
  4314.         $detailsprod['photo24']['qt'] = $nbrphoto24;
  4315.         $detailsprod['photo24']['prix'] = $prixphoto24;
  4316.         $detailsprod['photo36']['qt'] = $nbrphoto36;
  4317.         $detailsprod['photo36']['prix'] = $prixphoto36;
  4318.         $detailsprod['cal']['qt'] = $nbrcal;
  4319.         $detailsprod['cal']['prix'] = $prixcal;
  4320.         $detailsprod['livre']['qt'] = $nbrlivre;
  4321.         $detailsprod['livre']['prix'] = $prixalbum;
  4322.         $detailsprod['retro12']['qt'] = $nbrretro12;
  4323.         $detailsprod['retro12']['prix'] = $prixretro12;
  4324.         $detailsprod['retro24']['qt'] = $nbrretro24;
  4325.         $detailsprod['retro24']['prix'] = $prixretro24;
  4326.         $detailsprod['retro36']['qt'] = $nbrretro36;
  4327.         $detailsprod['retro36']['prix'] = $prixretro36;
  4328.         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]);
  4329.     }
  4330.     /**
  4331.      * @Route("/Parent/Boite_vocale", name="Boite_vocale")
  4332.      */
  4333.     public function Boite_Vocale()
  4334.     {
  4335.         /** @var \App\Entity\User $user */
  4336.         $user $this->getUser();
  4337.         $userId $user->getId();
  4338.         $session $this->session;
  4339.         $session->set('pageMenu''BoiteVocale');
  4340.         $idSejour $session->get("Sejour");
  4341.         $SEjourService $this->sejourService;
  4342.         $sejour $SEjourService->getsejour($idSejour);
  4343.         /*         $listeattach = $SEjourService->getatachmentsejour($idSejour);
  4344.         $listeVideo = $SEjourService->getVideosejour($idSejour);
  4345.         $AllAttachements = array_merge_recursive($listeattach, $listeVideo); */
  4346.         $AllAttachements $SEjourService->getCombinedattachSejour($idSejour'photoVideo');
  4347.         $attachementsCount $AllAttachements['total'];
  4348.         unset($AllAttachements['total']);
  4349.         $nbImages count($AllAttachements);
  4350.         $positions $SEjourService->getsejourposition($idSejour);
  4351.         $messages $SEjourService->getsejourmessage($idSejour);
  4352.         $parentsejour $SEjourService->getparentsejour($userId$idSejour);
  4353.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  4354.         // test if sejour est vide ou non 
  4355.         if (sizeof($sejour->getAttachements()) == 0) {
  4356.             $this->session->set('rout''rout');
  4357.             return $this->render('Parent/Aucunphoto.html.twig', [
  4358.                 "sejour" => $sejour,
  4359.                 "parentsejour" => $parentsejour
  4360.             ]);
  4361.         }
  4362.         if ($sejour->getPaym() == 1) {
  4363.             //findlinge
  4364.             $ParentSejour $this->em->getRepository(ParentSejour::class)->findOneBy(["idSejour" => $idSejour"idParent" => $user]);
  4365.             if ($ParentSejour->getPayment() == 0) {
  4366.                 $this->session->set('rout''rout');
  4367.                 $ses_id session_id();
  4368.                 return $this->render('Parent/achatsejour.html.twig', ["sejour" => $sejour'images' => $AllAttachements"session_id" => $ses_id'ParentSejour' => $ParentSejour]);
  4369.             }
  4370.             if ($ParentSejour->getPayment() == 1) {
  4371.                 $produits $this->typeProduiteService;
  4372.                 $liste $produits->produitlistTypeConditionnement();
  4373.                 $em $this->em;
  4374.                 $idAcc $sejour->getIdAcommp();
  4375.                 $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  4376.                 $pubProd $user->getShowpubprod();
  4377.                 $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  4378.                 if ($albumAcc == null) {
  4379.                     $albumAcc $em->getRepository(Produit::class)->findOneBy(['iduser' => 1'statut' => "Album_sejour"'idsjour' => $sejour]);
  4380.                 }
  4381.                 return $this->render('Parent/DetailsSejour.html.twig', [
  4382.                     "sejour" => $sejour,
  4383.                     'albumAcc' => $albumAcc,
  4384.                     'listeattach' => $AllAttachements,
  4385.                     'prod' => $liste,
  4386.                     'nbImages' => $nbImages,
  4387.                     'attachementsCount' => $attachementsCount,
  4388.                     'positions' => $positions,
  4389.                     'messages' => $messages,
  4390.                     'albumAcc' => $albumAcc,
  4391.                     'like' => $listeattachlikephoto,
  4392.                     "parentsejour" => $parentsejour,
  4393.                     'smsnotif' => $parentsejour->getSmsnotif(),
  4394.                     'showpub' => $pubProd
  4395.                 ]);
  4396.             }
  4397.         }
  4398.         $produits $this->typeProduiteService;
  4399.         $liste $produits->produitlistTypeConditionnement();
  4400.         $pubProd $user->getShowpubprod();
  4401.         $em $this->em;
  4402.         $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  4403.         if ($albumAcc == null) {
  4404.             $albumAcc $em->getRepository(Produit::class)->findOneBy(['iduser' => 1'statut' => "Album_sejour"'idsjour' => $sejour]);
  4405.         }
  4406.         return $this->render('Parent/DetailsSejour.html.twig', [
  4407.             "sejour" => $sejour,
  4408.             'albumAcc' => $albumAcc,
  4409.             'prod' => $liste,
  4410.             'listeattach' => $AllAttachements,
  4411.             'nbImages' => $nbImages,
  4412.             'attachementsCount' => $attachementsCount,
  4413.             'positions' => $positions,
  4414.             'messages' => $messages,
  4415.             'like' => $listeattachlikephoto,
  4416.             "parentsejour" => $parentsejour,
  4417.             'smsnotif' => $parentsejour->getSmsnotif(),
  4418.             'showpub' => $pubProd
  4419.         ]);
  4420.     }
  4421.     /**
  4422.      * @Route("/Parent/Mon_Sejour_parent", name="Mon_Sejour_parent")
  4423.      */
  4424.     public function Mon_Sejour_parent()
  4425.     {
  4426.         /** @var \App\Entity\User $user */
  4427.         $user $this->getUser();
  4428.         $userId $user->getId();
  4429.         $session $this->session;
  4430.         // $idParent=$this->getUser()->getId();
  4431.         $idSejour $session->get("Sejour");
  4432.         $session->set('pageMenu''Monsejour');
  4433.         $conxparent $this->sejourService;
  4434.         //$sejour1 = $conxparent->sejourParentcnx($idSejour,$idParent);
  4435.         //
  4436.         $SEjourService $this->sejourService;
  4437.         $sejour $SEjourService->getsejour($idSejour);
  4438.         $listeattach $SEjourService->getatachmentsejour($idSejour);
  4439.         //Liste des photos privé
  4440.         //        $listeattachPrivate = $SEjourService->getatachmentsejourparent($idSejour, $this->getUser()->getId());
  4441.         //        $AllPhotosParent = array_merge_recursive($listeattach, $listeattachPrivate);
  4442.         $listeVideo $SEjourService->getVideosejour($idSejour);
  4443.         $AllAttachements array_merge_recursive($listeattach$listeVideo);
  4444.         $nbImages count($listeattach);
  4445.         $positions $SEjourService->getsejourposition($idSejour);
  4446.         $messages $SEjourService->getsejourmessage($idSejour);
  4447.         $parentsejour $SEjourService->getparentsejour($userId$idSejour);
  4448.         //dd($parentsejour);
  4449.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  4450.         // test if sejour est vide ou non 
  4451.         if (sizeof($sejour->getAttachements()) == 0) {
  4452.             $this->session->set('rout''rout');
  4453.             return $this->render('Parent/Aucunphoto.html.twig', [
  4454.                 "sejour" => $sejour,
  4455.                 "parentsejour" => $parentsejour
  4456.             ]);
  4457.         }
  4458.         if ($sejour->getPaym() == 1) {
  4459.             /** @var \App\Entity\User $user */
  4460.             $user $this->getUser();
  4461.             $userid $user->getId();
  4462.             //findlinge
  4463.             $ParentSejour $this->em->getRepository(ParentSejour::class)->findOneBy(["idSejour" => $idSejour"idParent" => $userid]);
  4464.             if ($ParentSejour->getPayment() == 0) {
  4465.                 $this->session->set('rout''rout');
  4466.                 $ses_id session_id();
  4467.                 return $this->render('Parent/achatsejour.html.twig', ["sejour" => $sejour'images' => $listeattach"session_id" => $ses_id'ParentSejour' => $ParentSejour]);
  4468.             }
  4469.             if ($ParentSejour->getPayment() == 1) {
  4470.                 $produits $this->typeProduiteService;
  4471.                 $liste $produits->produitlistTypeConditionnement();
  4472.                 $pubProd $user->getShowpubprod();
  4473.                 return $this->render('Parent/DetailsSejour.html.twig', [
  4474.                     "sejour" => $sejour,
  4475.                     'listeattach' => $AllAttachements,
  4476.                     'prod' => $liste,
  4477.                     'nbImages' => $nbImages,
  4478.                     'positions' => $positions,
  4479.                     'messages' => $messages,
  4480.                     'like' => $listeattachlikephoto,
  4481.                     "parentsejour" => $parentsejour,
  4482.                     'smsnotif' => $parentsejour->getSmsnotif()
  4483.                 ]);
  4484.             }
  4485.         }
  4486.         //  dd($sejour);
  4487.         //Liste des photos public
  4488.         $produits $this->typeProduiteService;
  4489.         $liste $produits->produitlistTypeConditionnement();
  4490.         $pubProd $user->getShowpubprod();
  4491.         return $this->render('Parent/DetailsSejour.html.twig', [
  4492.             "sejour" => $sejour,
  4493.             'prod' => $liste,
  4494.             'listeattach' => $AllAttachements,
  4495.             'nbImages' => $nbImages,
  4496.             'positions' => $positions,
  4497.             'messages' => $messages,
  4498.             'like' => $listeattachlikephoto,
  4499.             "parentsejour" => $parentsejour,
  4500.             'smsnotif' => $parentsejour->getSmsnotif(),
  4501.             'showpub' => $pubProd
  4502.         ]);
  4503.     }
  4504.     /**
  4505.      * @Route("/Parent/Besoindaide", name="Besoindaide_Parent")
  4506.      */
  4507.     public function Besoindaide(): Response
  4508.     {
  4509.         $produit $this->typeProduiteService;
  4510.         $liste $produit->produitlistType();
  4511.         // dd($liste);
  4512.         return $this->render('Parent/footer/Besoindaide.html.twig', [
  4513.             'produit' => $liste,
  4514.         ]);
  4515.     }
  4516.     /**
  4517.      * @Route("/Parent/Besoindaide_5sur5", name="Besoindaide_5sur5")
  4518.      */
  4519.     public function Besoindaide_5sur5(): Response
  4520.     {
  4521.         $produit $this->typeProduiteService;
  4522.         $liste $produit->produitlistType();
  4523.         // dd($liste);
  4524.         $session $this->session;
  4525.         $idSejour $session->get("Sejour");
  4526.         $sejour null;
  4527.         if ($idSejour != null) {
  4528.             $sejour $this->em->getRepository(Sejour::class)->find($idSejour);
  4529.         }
  4530.         return $this->render('Parent/footer/5sur5Help.html.twig', [
  4531.             'produit' => $liste,
  4532.             'sejour' => $sejour
  4533.         ]);
  4534.     }
  4535.     /**
  4536.      * @Route("/Parent/Mentionlegale", name="Mentionlegale_Parent")
  4537.      */
  4538.     public function MentionlegaleParent()
  4539.     {
  4540.         return $this->render('Parent/footer/mentionlegal.html.twig', []);
  4541.     }
  4542.     /**
  4543.      * @Route("/Parent/Conditongeneral", name="Conditongeneral_Parent")
  4544.      */
  4545.     public function ConditongeneralParent()
  4546.     {
  4547.         return $this->render('Parent/footer/Condition.html.twig', []);
  4548.     }
  4549.     /**
  4550.      * @Route("/Parent/Politique", name="Politique_Parent")
  4551.      */
  4552.     public function PolitiqueParent()
  4553.     {
  4554.         return $this->render('Parent/footer/politique.html.twig', []);
  4555.     }
  4556.     /**
  4557.      * @Route("/Parent/Commande_groupee", name="Commande_groupee")
  4558.      * */
  4559.     public function  Commande_groupee()
  4560.     {
  4561.         $produit $this->typeProduiteService;
  4562.         $liste $produit->produitlistType();
  4563.         // dd($liste);
  4564.         return $this->render('Parent/footer/GroupeeCommande.html.twig', [
  4565.             'showArt' => 'ALL',
  4566.             'produit' => $liste
  4567.         ]);
  4568.     }
  4569.     /**
  4570.      * @Route("/Parent/partenaires", name="nosPartenaires")
  4571.      * */
  4572.     public function nosPartenaires()
  4573.     {
  4574.         return $this->render('Parent/footer/Partenaires.html.twig');
  4575.     }
  4576.     /**
  4577.      * @Route("/Parent/produits5sur5", name="produits5sur5")
  4578.      * */
  4579.     public function produits5sur5()
  4580.     {
  4581.         $produit $this->typeProduiteService;
  4582.         $liste $produit->produitlistType();
  4583.         // dd($liste);
  4584.         return $this->render('Parent/produitscinqsurcinq.html.twig', [
  4585.             'showArt' => 'ALL',
  4586.             'produit' => $liste
  4587.         ]);
  4588.     }
  4589.     /**
  4590.      * @Route("/Parent/Nous_Connaitre_5sur5", name="NousConnaitre")
  4591.      * */
  4592.     public function Nous_Connaitre_5sur5()
  4593.     {
  4594.         $produit $this->typeProduiteService;
  4595.         $liste $produit->produitlistType();
  4596.         // dd($liste);
  4597.         return $this->render('Parent/footer/5sur5.html.twig', [
  4598.             'produit' => $liste,
  4599.         ]);
  4600.     }
  4601.     /**
  4602.      * @Route("/Parent/ServiceClient", name="ServiceClient_Parent")
  4603.      * */
  4604.     public function ServiceClient()
  4605.     {
  4606.         $produit $this->typeProduiteService;
  4607.         $liste $produit->produitlistType();
  4608.         // dd($liste);
  4609.         return $this->render('Parent/footer/ServiceClient.html.twig', [
  4610.             'produit' => $liste,
  4611.         ]);
  4612.     }
  4613.     /**
  4614.      * @Route("/Parent/delateSession_parents", name="delateSession_parent")
  4615.      * */
  4616.     public function delateSession_parents()
  4617.     {
  4618.         $session $this->session;
  4619.         $em $this->em;
  4620.         $Products = [];
  4621.         if ($session->get("paymentmoniteco") == "succses") {
  4622.             $Products = [];
  4623.             $session->set('Panier'$Products);
  4624.             $user $this->getUser();
  4625.             $typeref $em->getRepository(Typeref::class)->find(8);
  4626.             $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  4627.             $payer $em->getRepository(Ref::class)->findOneBy(array("libiller" => "payer""typeref" => $typeref));
  4628.             $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  4629.             if ($panierTrace) {
  4630.                 $panierTrace->setStatut($payer);
  4631.                 $em->getManager()->persist($panierTrace);
  4632.                 $em->getManager()->flush();
  4633.             }
  4634.         }
  4635.         $this->session->remove('paymentmoniteco');
  4636.         $this->session->remove('montanttotalcomande');
  4637.         $this->session->remove('Panierlength');
  4638.         $this->session->remove('envoipost');
  4639.         return new Response('done');
  4640.     }
  4641.     /**
  4642.      * @Route("/Parent/chargement_form_conn_up2pay", name="chargement_form_conn_up2pay")
  4643.      */
  4644.     function chargeFormup2payAction(Request $request)
  4645.     {
  4646.         $session $this->session;
  4647.         $em $this->container->get('doctrine')->getManager();
  4648.         $idSejour $session->get("Sejour");
  4649.         /** @var \App\Entity\User $user */
  4650.         $user $this->getUser();
  4651.         $user $user->getId();
  4652.         $comande $this->em->getRepository(ParentSejour::class)->findOneBy(["idSejour" => $idSejour"idParent" => $user]);
  4653.         $firstName $comande->getIdParent()->getNom();
  4654.         if ($firstName == null || $firstName == '') {
  4655.             $firstName "john";
  4656.         }
  4657.         $lastName $comande->getIdParent()->getPrenom();
  4658.         if ($lastName == null || $lastName == '') {
  4659.             $lastName "Doe";
  4660.         }
  4661.         $addressLine1 "3 rue de l'église";
  4662.         $city "Ostheim";
  4663.         $postalCode "68150";
  4664.         $pbx_site '6062073';                              //variable de test 9999999
  4665.         $pbx_rang '001';                                    //variable de test 95
  4666.         $pbx_identifiant '38027616';                      //variable de test 123456789
  4667.         $pbx_cmd 'REFCN' $comande->getId();
  4668.         $pbx_effectue $this->generateUrl("moneticoAcceptUrl_parentcnxx", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  4669.         $pbx_annule $this->generateUrl("moneticoExceptionUrl_parentcnxx", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  4670.         $pbx_refuse $this->generateUrl("moneticoExceptionUrl_parentcnxx", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  4671.         // Paramétrage de l'url de retour back office site (notification de paiement IPN) :
  4672.         $pbx_repondre_a "";
  4673.         //$pbx_repondre_a = $this->generateUrl("moneticoAcceptUrl_parentcnxx", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  4674.         $mail  $comande->getIdParent()->getEmail();
  4675.         $pbx_porteur $mail;                    //variable de test test@test.fr
  4676.         // Paramétrage des données retournées via l'IPN :
  4677.         $pbx_retour 'Mt:M;Ref:R;Auto:A;Erreur:E';
  4678.         // On récupére la date au format ISO-8601 :
  4679.         $dateTime date("c");
  4680.         //$montant = $comande->getMontantrth() . "EUR";
  4681.         $pbx_total $comande->getIdSejour()->getPrixcnxparent();
  4682.         $pbx_total = (int)((string)($pbx_total 100));
  4683.         // Suppression des points ou virgules dans le montant                        
  4684.         $pbx_total str_replace(","""$pbx_total);
  4685.         $pbx_total str_replace("."""$pbx_total);
  4686.         // Nombre de produit envoyé dans PBX_SHOPPINGCART :
  4687.         $pbx_nb_produit '1';                                    //variable de test 5
  4688.         // Construction de PBX_SHOPPINGCART :
  4689.         $pbx_shoppingcart "<?xml version=\"1.0\" encoding=\"utf-8\"?><shoppingcart><total><totalQuantity>" $pbx_nb_produit "</totalQuantity></total></shoppingcart>";
  4690.         // Choix de l'authentification dans PBX_SOUHAITAUTHENT
  4691.         $pbx_souhaitauthent '01';        //variable de test authentification 3DS (1 par défaut, 2 pour exemption 3DS)
  4692.         // Valeurs envoyes dans PBX_BILLING :
  4693.         $pbx_prenom_fact $firstName;                                                             //variable de test Jean-Marie
  4694.         $pbx_nom_fact $lastName;                                                                 //variable de test Thomson
  4695.         $pbx_adresse1_fact $addressLine1;                                                         //variable de test 1 rue de Paris
  4696.         $pbx_adresse2_fact '';                                                                 //variable de test <vide>
  4697.         $pbx_zipcode_fact $postalCode;                                                         //variable de test 75001
  4698.         $pbx_city_fact $city;                                     //variable de test Paris
  4699.         $pbx_country_fact '250';        //variable de test 250 (pour la France)
  4700.         // Construction de PBX_BILLING :
  4701.         $pbx_billing "<?xml version=\"1.0\" encoding=\"utf-8\"?><Billing><Address><FirstName>" $pbx_prenom_fact "</FirstName>" .
  4702.             "<LastName>" $pbx_nom_fact "</LastName><Address1>" $pbx_adresse1_fact "</Address1>" .
  4703.             "<Address2>" $pbx_adresse2_fact "</Address2><ZipCode>" $pbx_zipcode_fact "</ZipCode>" .
  4704.             "<City>" $pbx_city_fact "</City><CountryCode>" $pbx_country_fact "</CountryCode>" .
  4705.             "</Address></Billing>";
  4706.         // Recette (paiements de test)  :
  4707.         //$urletrans ="https://recette-tpeweb.e-transactions.fr/php/";
  4708.         // Production (paiements réels) :
  4709.         // URL principale :
  4710.         $urletrans "https://tpeweb.e-transactions.fr/php/";
  4711.         // URL secondaire :
  4712.         // $urletrans ="https://tpeweb1.e-transactions.fr/php/";
  4713.         // $hmackey = 'A5FD6D11DA2B9C4112201B4D797EC2B32B877C09A0CF56CE8007D91ACBA9A6D9E026149A7E8441D39A9F52C61E0D250ACC6DEC6815EA02621AEE525576CF4DAE';
  4714.         $hmackey 'A5FD6D11DA2B9C4112201B4D797EC2B32B877C09A0CF56CE8007D91ACBA9A6D9E026149A7E8441D39A9F52C61E0D250ACC6DEC6815EA02621AEE525576CF4DAE';
  4715.         $pbx_prenom_fact strtoupper($pbx_prenom_fact);
  4716.         $pbx_nom_fact strtoupper($pbx_nom_fact);
  4717.         $pbx_adresse1_fact strtoupper($pbx_adresse1_fact);
  4718.         $pbx_adresse2_fact strtoupper($pbx_adresse2_fact);
  4719.         $pbx_city_fact strtoupper($pbx_city_fact);
  4720.         $pbx_country_fact strtoupper($pbx_country_fact);
  4721.         // --------------- TRAITEMENT DES VARIABLES ---------------
  4722.         // On crée la chaéne a hacher sans URLencodage
  4723.         $msg "PBX_SITE=" $pbx_site .
  4724.             "&PBX_RANG=" $pbx_rang .
  4725.             "&PBX_IDENTIFIANT=" $pbx_identifiant .
  4726.             "&PBX_SOURCE=RWD" .
  4727.             "&PBX_TOTAL=" $pbx_total .
  4728.             "&PBX_DEVISE=978" .
  4729.             "&PBX_CMD=" $pbx_cmd .
  4730.             "&PBX_PORTEUR=" $pbx_porteur .
  4731.             "&PBX_REPONDRE_A=" $pbx_repondre_a .
  4732.             "&PBX_RETOUR=" $pbx_retour .
  4733.             "&PBX_EFFECTUE=" $pbx_effectue .
  4734.             "&PBX_ANNULE=" $pbx_annule .
  4735.             "&PBX_REFUSE=" $pbx_refuse .
  4736.             "&PBX_HASH=SHA512" .
  4737.             "&PBX_TIME=" $dateTime .
  4738.             "&PBX_SHOPPINGCART=" $pbx_shoppingcart .
  4739.             "&PBX_BILLING=" $pbx_billing .
  4740.             "&PBX_SOUHAITAUTHENT=" $pbx_souhaitauthent;
  4741.         $binKey pack("H*"$hmackey);
  4742.         $hmac strtoupper(hash_hmac('sha512'$msg$binKey));
  4743.         return new JsonResponse(array(
  4744.             'urletrans' => $urletrans,
  4745.             'pbx_site' => $pbx_site,
  4746.             'pbx_rang' => $pbx_rang,
  4747.             'pbx_identifiant' => $pbx_identifiant,
  4748.             'pbx_total' => $pbx_total,
  4749.             'pbx_cmd' => $pbx_cmd,
  4750.             'pbx_porteur' => $pbx_porteur,
  4751.             'pbx_repondre_a' => $pbx_repondre_a,
  4752.             'pbx_retour' => $pbx_retour,
  4753.             'pbx_effectue' => $pbx_effectue,
  4754.             'pbx_annule' => $pbx_annule,
  4755.             'pbx_refuse' => $pbx_refuse,
  4756.             'dateTime' => $dateTime,
  4757.             'pbx_shoppingcart' => $pbx_shoppingcart,
  4758.             'pbx_billing' => $pbx_billing,
  4759.             'pbx_souhaitauthent' => $pbx_souhaitauthent,
  4760.             'hmac' => $hmac
  4761.         ));
  4762.         // 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));
  4763.     }
  4764.     /**
  4765.      * @Route("/Parent/chargement_form_connx", name="chargement_form__Connx")
  4766.      */
  4767.     function chargeFormOgoneAction_Connx(Request $request)
  4768.     {
  4769.         $session $this->session;
  4770.         $em $this->container->get('doctrine')->getManager();
  4771.         $idSejour $session->get("Sejour");
  4772.         /** @var \App\Entity\User $user */
  4773.         $user $this->getUser();
  4774.         $user $user->getId();
  4775.         $comande $this->em->getRepository(ParentSejour::class)->findOneBy(["idSejour" => $idSejour"idParent" => $user]);
  4776.         $firstName $comande->getIdParent()->getNom();
  4777.         if ($firstName == null || $firstName == '') {
  4778.             $firstName "john";
  4779.         }
  4780.         $lastName $comande->getIdParent()->getPrenom();
  4781.         if ($lastName == null || $lastName == '') {
  4782.             $lastName "Doe";
  4783.         }
  4784.         $addressLine1 "3 rue de l'église";
  4785.         $city $city "Ostheim";
  4786.         $postalCode "68150";
  4787.         //      $postalCode= trim ($postalCode) ;
  4788.         $country "FR";
  4789.         $contexte = array("billing" => array("firstName" => $firstName"lastName" => $lastName"addressLine1" => $addressLine1"city" => $city"postalCode" => $postalCode"country" => $country));
  4790.         //param de payement
  4791.         $contexte_commande base64_encode(json_encode($contexte));
  4792.         $PayementService $this->container->get("App\Service\PayementService");
  4793.         $version $this->getParameter('version'); //done
  4794.         $TPE $this->getParameter('TPE'); //done
  4795.         $dateTime $dateNow = new \DateTime();
  4796.         $date $dateTime->format("d/m/Y:H:i:s");
  4797.         //"05/05/2019:11:55:23" ;
  4798.         $montant $comande->getIdSejour()->getPrixcnxparent() . "EUR";
  4799.         $reference 'REFCN' $comande->getId();
  4800.         $url_retour_ok $this->generateUrl("moneticoAcceptUrl_parentcnxx", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  4801.         $url_retour_err $this->generateUrl("moneticoExceptionUrl_parentcnxx", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  4802.         $desactivemoyenpaiement "paypal";
  4803.         $lgue "FR"//done
  4804.         $societe "5sur5sejou"//done
  4805.         $textelibre "5sur5sejour"//
  4806.         $mail $this->getUser(); //
  4807.         $SHAIN $this->getParameter('shain');
  4808.         $param = array(
  4809.             'version' => $version,
  4810.             'TPE' => $TPE,
  4811.             'date' => $date,
  4812.             'montant' => $montant,
  4813.             'reference' => $reference,
  4814.             'url_retour_ok' => $url_retour_ok,
  4815.             'url_retour_err' => $url_retour_err,
  4816.             'lgue' => $lgue,
  4817.             'societe' => $societe,
  4818.             'contexte_commande' => $contexte_commande,
  4819.             'texte-libre' => $textelibre,
  4820.             'mail' => $mail,
  4821.             'desactivemoyenpaiement' => $desactivemoyenpaiement
  4822.         );
  4823.         $MAC $PayementService->monetico_hash_parameters('sha1'$param$SHAIN);
  4824.         //utf8_encode
  4825.         return new JsonResponse(array(
  4826.             'version' => $version,
  4827.             'TPE' => $TPE,
  4828.             'date' => $date,
  4829.             'montant' => $montant,
  4830.             'reference' => $reference,
  4831.             'MAC' => $MAC,
  4832.             'url_retour_ok' => utf8_encode($url_retour_ok),
  4833.             'url_retour_err' => utf8_encode($url_retour_err),
  4834.             'lgue' => $lgue,
  4835.             'societe' => $societe,
  4836.             'contexte_commande' => utf8_encode($contexte_commande),
  4837.             'textelibre' => utf8_encode($textelibre),
  4838.             'mail' => $mail,
  4839.             'desactivemoyenpaiement' => $desactivemoyenpaiement
  4840.         ));
  4841.         // 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));
  4842.     }
  4843.     /**
  4844.      * @Route("/Parent/chargement_form_connx_paypal", name="chargement_form__Connx_PayPal")
  4845.      */
  4846.     function chargeFormOgoneAction_Connx_PayPal(Request $request)
  4847.     {
  4848.         $session $this->session;
  4849.         $em $this->container->get('doctrine')->getManager();
  4850.         $idSejour $session->get("Sejour");
  4851.         /** @var \App\Entity\User $user */
  4852.         $user $this->getUser();
  4853.         $user $user->getId();
  4854.         $comande $this->em->getRepository(ParentSejour::class)->findOneBy(["idSejour" => $idSejour"idParent" => $user]);
  4855.         $firstName $comande->getIdParent()->getNom();
  4856.         if ($firstName == null || $firstName == '') {
  4857.             $firstName "john";
  4858.         }
  4859.         $lastName $comande->getIdParent()->getPrenom();
  4860.         if ($lastName == null || $lastName == '') {
  4861.             $lastName "Doe";
  4862.         }
  4863.         $addressLine1 "3 rue de l'église";
  4864.         $city $city "Ostheim";
  4865.         $postalCode "68150";
  4866.         //      $postalCode= trim ($postalCode) ;
  4867.         $country "FR";
  4868.         $contexte = array("billing" => array("firstName" => $firstName"lastName" => $lastName"addressLine1" => $addressLine1"city" => $city"postalCode" => $postalCode"country" => $country));
  4869.         $protocole "paypal";
  4870.         //param de payement
  4871.         $contexte_commande base64_encode(json_encode($contexte));
  4872.         $PayementService $this->container->get("App\Service\PayementService");
  4873.         $version $this->getParameter('version'); //done
  4874.         $TPE $this->getParameter('TPE'); //done
  4875.         $dateTime $dateNow = new \DateTime();
  4876.         $date $dateTime->format("d/m/Y:H:i:s");
  4877.         //"05/05/2019:11:55:23" ;
  4878.         $montant $comande->getIdSejour()->getPrixcnxparent() . "EUR";
  4879.         $reference 'REFCN' $comande->getId();
  4880.         $url_retour_ok $this->generateUrl("moneticoAcceptUrl_parentcnxx", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  4881.         $url_retour_err $this->generateUrl("moneticoExceptionUrl_parentcnxx", array('id' => $comande->getId()), UrlGeneratorInterface::ABSOLUTE_URL);
  4882.         $lgue "FR"//done
  4883.         $societe "5sur5sejou"//done
  4884.         $textelibre "5sur5sejour"//
  4885.         $mail $this->getUser(); //
  4886.         $SHAIN $this->getParameter('shain');
  4887.         $param = array(
  4888.             'version' => $version,
  4889.             'TPE' => $TPE,
  4890.             'date' => $date,
  4891.             'montant' => $montant,
  4892.             'reference' => $reference,
  4893.             'url_retour_ok' => $url_retour_ok,
  4894.             'url_retour_err' => $url_retour_err,
  4895.             'lgue' => $lgue,
  4896.             'societe' => $societe,
  4897.             'contexte_commande' => $contexte_commande,
  4898.             'texte-libre' => $textelibre,
  4899.             'mail' => $mail,
  4900.             'protocole' => $protocole
  4901.         );
  4902.         $MAC $PayementService->monetico_hash_parameters('sha1'$param$SHAIN);
  4903.         //utf8_encode
  4904.         return new JsonResponse(array(
  4905.             'version' => $version,
  4906.             'TPE' => $TPE,
  4907.             'date' => $date,
  4908.             'montant' => $montant,
  4909.             'reference' => $reference,
  4910.             'MAC' => $MAC,
  4911.             'url_retour_ok' => utf8_encode($url_retour_ok),
  4912.             'url_retour_err' => utf8_encode($url_retour_err),
  4913.             'lgue' => $lgue,
  4914.             'societe' => $societe,
  4915.             'contexte_commande' => utf8_encode($contexte_commande),
  4916.             'textelibre' => utf8_encode($textelibre),
  4917.             'mail' => $mail,
  4918.             'protocole' => $protocole
  4919.         ));
  4920.         // 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));
  4921.     }
  4922.     /**
  4923.      * @Route("/Parent/SupprimerCommande", name="Supprimer_CommandeParent")
  4924.      */
  4925.     function RemoveCommandeParent(Request $request)
  4926.     {
  4927.         $CommandeService $this->commandeService;
  4928.         $idCmd $request->get('id');
  4929.         $result $CommandeService->CommandeCloture($idCmd);
  4930.         return new Response($result);
  4931.     }
  4932.     /**
  4933.      * @Route("/Parent/accept_url_parentcnxx/{id}", name="moneticoAcceptUrl_parentcnxx")
  4934.      */
  4935.     function moneticoAcceptUrl_parent($id)
  4936.     {
  4937.         $em $this->container->get('doctrine')->getManager();
  4938.         $comande $this->em->getRepository(ParentSejour::class)->find($id);
  4939.         if ($comande->getPayment() != 1) {
  4940.             $typ $this->em->getRepository(Typeproduit::class)->find(1);
  4941.             $condit $this->em->getRepository(TypeProduitConditionnement::class)->find(11);
  4942.             $produit = new Produit();
  4943.             $produit->setIdConditionnement($condit);
  4944.             $produit->setType($typ);
  4945.             $produit->setDate(new \DateTime());
  4946.             $produit->setLabele("Connexion");
  4947.             $produit->setIduser($this->getUser());
  4948.             $sats $this->em->getRepository(Ref::class)->find(33);
  4949.             //$ComandeService = $this->container->get("App\Service\ComandeService");
  4950.             $ComandeService $this->commandeService;
  4951.             $comande->setPayment(1);
  4952.             $this->em->getManager()->persist($comande);
  4953.             $this->em->getManager()->flush();
  4954.             $produit->setIdsjour($comande->getIdSejour());
  4955.             $this->em->getManager()->persist($produit);
  4956.             $this->em->getManager()->flush();
  4957.             $bytes random_int(10009999);
  4958.             $pass bin2hex($bytes);
  4959.             //generate Num facture
  4960.             $dateSJoue = new \Datetime();
  4961.             $annes $dateSJoue->format('y');
  4962.             $moi $dateSJoue->format('m');
  4963.             $val $this->em->getRepository(Commande::class)->serachNombreFacture();
  4964.             $val $val 1;
  4965.             $valx sprintf('%04d'$val);
  4966.             $valx1 "20" $annes $moi $valx;
  4967.             $cmdpaym = new Commande();
  4968.             $cmdpaym->setMontantrth($comande->getIdSejour()->getPrixcnxparent());
  4969.             $cmdpaym->setNumComande($pass);
  4970.             $cmdpaym->getIdSejour($pass);
  4971.             $cmdpaym->setNumfacture($valx1);
  4972.             $cmdpaym->setDateCreateCommande(new \DateTime());
  4973.             $cmdpaym->setDateFacture(new \DateTime());
  4974.             $cmdpaym->setStatut($sats);
  4975.             $cmdpaym->setIdSejour($comande->getIdSejour());
  4976.             $cmdpaym->setIdUser($this->getUser());
  4977.             $this->em->getManager()->persist($cmdpaym);
  4978.             $this->em->getManager()->flush();
  4979.             $cmdpaym->setNumfacture(substr($cmdpaym->getNumfacture(), '0'6) . $cmdpaym->getId());
  4980.             $this->em->getManager()->persist($cmdpaym);
  4981.             $this->em->getManager()->flush();
  4982.             $cpmd = new ComandeProduit();
  4983.             $cpmd->setIdComande($cmdpaym);
  4984.             $cpmd->setIdProduit($produit);
  4985.             $cpmd->setQuantiter(1);
  4986.             $cpmd->setDate(new \DateTime());
  4987.             //stille reversment par prod
  4988.             $this->em->getManager()->persist($cpmd);
  4989.             $this->em->getManager()->flush();
  4990.             $pdfOptions = new Options();
  4991.             $pdfOptions->set('isRemoteEnabled'TRUE);
  4992.             $pdfOptions->set('defaultFont''Arial');
  4993.             // Instantiate Dompdf with our options
  4994.             $dompdf = new Dompdf($pdfOptions);
  4995.             $dompdf->set_option('isRemoteEnabled'TRUE);
  4996.             // Retrieve the HTML generated in our twig file
  4997.             $html $this->renderView('Admin/pdfFactureparent.html.twig', [
  4998.                 "Commande" => $cmdpaym,
  4999.             ]);
  5000.             // Load HTML to Dompdf
  5001.             $dompdf->loadHtml($html);
  5002.             // (Optional) Setup the paper size and orientation 'portrait' or 'portrait'
  5003.             $dompdf->setPaper('A4''portrait');
  5004.             // Render the HTML as PDF
  5005.             $dompdf->render();
  5006.             // Store PDF Binary Data
  5007.             $output $dompdf->output();
  5008.             // In this case, we want to write the file in the public directory
  5009.             $publicDirectory $this->getParameter('kernel.project_dir') . '/public/backupFacture/';
  5010.             // e.g /var/www/project/public/mypdf.pdf
  5011.             $pdfFilepath $publicDirectory "Facture" $cmdpaym->getId() . '-' $cmdpaym->getNumComande() . ".pdf";
  5012.             // Write file to the desired path
  5013.             file_put_contents($pdfFilepath$output);
  5014.         }
  5015.         $jetonService = new JetonService($this->em);
  5016.         if ($jetonService->checkUserFiveConnexion($comande->getIdSejour()->getIdAcommp(), $comande->getIdSejour())) {
  5017.             $jetonService->newJetonForUser($comande->getIdSejour()->getIdAcommp());
  5018.         }
  5019.         $session $this->session;
  5020.         $session->set('paymentmoniteco''succses');
  5021.         $resulat $session->get("paymentmoniteco");
  5022.         //dd($montanttotalcomande);
  5023.         return $this->redirectToRoute('AccueilParent');
  5024.     }
  5025.     /**
  5026.      * @Route("/Parent/accept_url_parentcnxxVirgo/{id}", name="moneticoAcceptUrl_parentcnxxVirgo")
  5027.      */
  5028.     function moneticoAcceptUrl_parentVirgo($id)
  5029.     {
  5030.         $em $this->container->get('doctrine')->getManager();
  5031.         $comande $this->em->getRepository(ParentSejour::class)->find($id);
  5032.         if ($comande->getPayment() != 1) {
  5033.             $typ $this->em->getRepository(Typeproduit::class)->find(1);
  5034.             $condit $this->em->getRepository(TypeProduitConditionnement::class)->find(11);
  5035.             $produit = new Produit();
  5036.             $produit->setIdConditionnement($condit);
  5037.             $produit->setType($typ);
  5038.             $produit->setLabele("Connexion");
  5039.             $produit->setIduser($this->getUser());
  5040.             $produit->setDate(new \DateTime());
  5041.             $sats $this->em->getRepository(Ref::class)->find(33);
  5042.             $ComandeService $this->container->get("App\Service\ComandeService");
  5043.             $comande->setPayment(1);
  5044.             $this->em->getManager()->persist($comande);
  5045.             $this->em->getManager()->flush();
  5046.             $produit->setIdsjour($comande->getIdSejour());
  5047.             $this->em->getManager()->persist($produit);
  5048.             $this->em->getManager()->flush();
  5049.             $bytes random_int(10009999);
  5050.             $pass bin2hex($bytes);
  5051.             //generate Num facture
  5052.             $dateSJoue = new \Datetime();
  5053.             $annes $dateSJoue->format('y');
  5054.             $moi $dateSJoue->format('m');
  5055.             $val $this->em->getRepository(Commande::class)->serachNombreFacture();
  5056.             $val $val 1;
  5057.             $valx sprintf('%04d'$val);
  5058.             $valx1 "20" $annes $moi $valx;
  5059.             $cmdpaym = new Commande();
  5060.             $cmdpaym->setMontantrth($comande->getIdSejour()->getPrixcnxparent());
  5061.             $cmdpaym->setNumComande($pass);
  5062.             $cmdpaym->getIdSejour($pass);
  5063.             $cmdpaym->setNumfacture($valx1);
  5064.             $cmdpaym->setDateFacture(new \DateTime());
  5065.             $cmdpaym->setDateCreateCommande(new \DateTime());
  5066.             $cmdpaym->setStatut($sats);
  5067.             $cmdpaym->setPaymentType("Mobile");
  5068.             $cmdpaym->setIdSejour($comande->getIdSejour());
  5069.             $cmdpaym->setIdUser($this->getUser());
  5070.             $this->em->getManager()->persist($cmdpaym);
  5071.             $this->em->getManager()->flush();
  5072.             $cmdpaym->setNumfacture(substr($cmdpaym->getNumfacture(), '0'6) . $cmdpaym->getId());
  5073.             $this->em->getManager()->persist($cmdpaym);
  5074.             $this->em->getManager()->flush();
  5075.             $cpmd = new ComandeProduit();
  5076.             $cpmd->setIdComande($cmdpaym);
  5077.             $cpmd->setIdProduit($produit);
  5078.             $cpmd->setQuantiter(1);
  5079.             $cpmd->setDate(new \DateTime());
  5080.             //stille reversment par prod
  5081.             $this->em->getManager()->persist($cpmd);
  5082.             $this->em->getManager()->flush();
  5083.             $pdfOptions = new Options();
  5084.             $pdfOptions->set('isRemoteEnabled'TRUE);
  5085.             $pdfOptions->set('defaultFont''Arial');
  5086.             // Instantiate Dompdf with our options
  5087.             $dompdf = new Dompdf($pdfOptions);
  5088.             $dompdf->set_option('isRemoteEnabled'TRUE);
  5089.             // Retrieve the HTML generated in our twig file
  5090.             $html $this->renderView('Admin/pdfFactureparent.html.twig', [
  5091.                 "Commande" => $cmdpaym,
  5092.             ]);
  5093.             // Load HTML to Dompdf
  5094.             $dompdf->loadHtml($html);
  5095.             // (Optional) Setup the paper size and orientation 'portrait' or 'portrait'
  5096.             $dompdf->setPaper('A4''portrait');
  5097.             // Render the HTML as PDF
  5098.             $dompdf->render();
  5099.             // Store PDF Binary Data
  5100.             $output $dompdf->output();
  5101.             // In this case, we want to write the file in the public directory
  5102.             $publicDirectory $this->getParameter('kernel.project_dir') . '/public/backupFacture/';
  5103.             // e.g /var/www/project/public/mypdf.pdf
  5104.             $pdfFilepath $publicDirectory "Facture" $cmdpaym->getId() . '-' $cmdpaym->getNumComande() . ".pdf";
  5105.             // Write file to the desired path
  5106.             file_put_contents($pdfFilepath$output);
  5107.         }
  5108.         $jetonService = new JetonService($this->em);
  5109.         if ($jetonService->checkUserFiveConnexion($comande->getIdSejour()->getIdAcommp(), $comande->getIdSejour())) {
  5110.             $jetonService->newJetonForUser($comande->getIdSejour()->getIdAcommp());
  5111.         }
  5112.         $session $this->session;
  5113.         $session->set('paymentmoniteco''succses');
  5114.         $resulat $session->get("paymentmoniteco");
  5115.         //dd($montanttotalcomande);
  5116.         return $this->redirectToRoute('AccueilParent');
  5117.     }
  5118.     /**
  5119.      * @Route("/error_url_parentcnxx/{id}", name="moneticoExceptionUrl_parentcnxx")
  5120.      */
  5121.     function moneticoExceptionUrl_parentcnxx($id)
  5122.     {
  5123.         $em $this->container->get('doctrine')->getManager();
  5124.         $comande $this->em->getRepository(ParentSejour::class)->find($id);
  5125.         $session $this->session;
  5126.         $session->set('paymentmoniteco''echec');
  5127.         $comande->setPayment(0);
  5128.         $this->em->getManager()->persist($comande);
  5129.         $this->em->getManager()->flush();
  5130.         $resulat $session->get("paymentmoniteco");
  5131.         //dd($montanttotalcomande);
  5132.         return $this->redirectToRoute('AccueilParent');
  5133.     }
  5134.     /**
  5135.      * @Route("/Parent/SuiviCommande", name="SuiviCommande")
  5136.      * */
  5137.     public function SuiviCommande()
  5138.     {
  5139.         // dd($liste);
  5140.         $user $this->getUser();
  5141.         $session $this->session;
  5142.         $idSejour $session->get("Sejour");
  5143.         $sejour $this->em->getRepository(Sejour::class)->find($idSejour);
  5144.         $ParentSejour $this->em->getRepository(ParentSejour::class)->findBy(['idSejour' => $sejour'idParent' => $user]);
  5145.         //ParentSejour
  5146.         //cablala
  5147.         //dd($ParentSejour[0]);
  5148.         //$listeattach = $sejourservice->getatachmentsejour($id);
  5149.         //$listeattachM = $sejourservice->getsejourmessage($id);
  5150.         return $this->render('Parent/suivicommande.html.twig', [
  5151.             'user' => $user,
  5152.             'sejour' => $sejour,
  5153.             'ParentSejour' => $ParentSejour[0],
  5154.         ]);
  5155.     }
  5156.     /**
  5157.      * @Route("/Parent/SuiviCommandeparent", name="SuiviCommandeparent")
  5158.      * */
  5159.     public function SuiviCommandeparent()
  5160.     {
  5161.         // dd($liste);
  5162.         $user $this->getUser();
  5163.         //dd($user);
  5164.         $cmdservice $this->commandeService;
  5165.         $session $this->session;
  5166.         $idSejour $session->get("Sejour");
  5167.         $sejour $this->em->getRepository(Sejour::class)->find($idSejour);
  5168.         $listeCmd $cmdservice->listerCommandeParent($user);
  5169.         return $this->render('Parent/suivicommande.html.twig', [
  5170.             'user' => $user,
  5171.             'sejour' => $sejour,
  5172.             'listeCmd' => $listeCmd
  5173.         ]);
  5174.     }
  5175.     private function envoieMailPackNumerique($nameZip,$email,$commande)
  5176.     {
  5177.         // Utiliser directement le numéro de commande comme identifiant de téléchargement
  5178.         $downloadLink =  $nameZip ;
  5179.         
  5180.       
  5181.         $this->emailsCmdService->MailPackPhotosNumerique(
  5182.             $email,
  5183.             $downloadLink,
  5184.             $commande->getId(),
  5185.         
  5186.         );
  5187.         // Marquer comme envoyé
  5188.         $commande->setEnvoi(1);
  5189.         $this->em->getManager()->persist($commande);
  5190.         $this->em->getManager()->flush();
  5191.         $this->logger->info("Email sent for order: ");
  5192.         return true;
  5193.     }
  5194.    
  5195.  /**
  5196.  * @Route("/Parent/telechargerPack/{idCommande}", name="telechargerPack")
  5197.  */
  5198. public function TelechagerPackNumerique($idCommande): Response
  5199. {
  5200.     $this->logger->info("Tentative de téléchargement du pack pour la commande numérique ID: {$idCommande}");
  5201.     
  5202.     // Récupérer la commande numérique
  5203.     $commandeNumerique $this->em->getRepository(CommandeNumerique::class)->find($idCommande);
  5204.    
  5205.     // Vérifier si la commande existe
  5206.     if (!$commandeNumerique) {
  5207.         $this->logger->error("Commande numérique introuvable - ID: {$idCommande}");
  5208.         return new JsonResponse(["message" => "Commande introuvable"], 404);
  5209.     }
  5210.     
  5211.     // Récupérer les informations associées
  5212.     $commande $commandeNumerique->getIdCommande();
  5213.     $idcommande $commande->getId();
  5214.     $user $commande->getIdUser();
  5215.      $iduser $user->getId();
  5216.     $sejour $commande->getIdSejour();
  5217.     
  5218.     $this->logger->info("Commande numérique {$commandeNumerique->getId()} trouvée, commande parent ID: {$idcommande}, utilisateur: {$user->getEmail()},ETAT: {$commandeNumerique->getEtat()}");
  5219.     $idCmdNumerique $commandeNumerique->getId();
  5220.     // Vérifier si le lien de téléchargement existe
  5221.     $refcmdnum $commandeNumerique->getLinkdownload();
  5222.    
  5223.     $this->logger->info("Lien de téléchargement: {$refcmdnum}");
  5224.     if (!$refcmdnum) {
  5225.         // Envoyer un email d'alerte à l'administrateur
  5226.         $email = (new Email())
  5227.             ->from('noreply@5sur5sejour.com')
  5228.             ->to('yousra.tlich@gmail.com')
  5229.             ->subject('ALERTE - Lien de téléchargement corrompu')
  5230.             ->text(
  5231.                 "Le lien de téléchargement est corrompu pour la commande suivante:\n" .
  5232.                 "ID Commande Numérique: " $idCmdNumerique "\n" .
  5233.                 "ID Commande: " $idcommande "\n" .
  5234.                 "Utilisateur: " $user->getEmail() . "\n" .
  5235.                 "Séjour: " $sejour->getLibelleSejour() . "\n" .
  5236.                 "Date: " . (new \DateTime())->format('Y-m-d H:i:s')
  5237.             );
  5238.         
  5239.         $this->symfonyMailer->send($email);
  5240.         $this->logger->error("Lien de téléchargement corrompu pour la commande numérique {$idCommande}");
  5241.         
  5242.         return new JsonResponse(["message" => "Lien de téléchargement non disponible"], 404);
  5243.     }
  5244.     
  5245.     $this->logger->info("Lien de téléchargement trouvé pour la commande numérique {$idCommande}{$refcmdnum}");
  5246.     
  5247.     // Vérifier que l'utilisateur et le séjour existent
  5248.     if (!$user || !$sejour) {
  5249.         $this->logger->error("Utilisateur ou séjour manquant pour la commande numérique {$idCommande}");
  5250.         return new JsonResponse(['message' => 'Lien invalide - utilisateur ou séjour manquant'], 400);
  5251.     }
  5252.     
  5253.     // Vérifier l'état de la commande
  5254.     if ($commandeNumerique->getEtat() === 1) {
  5255.         // Construire le chemin du fichier
  5256.         $filePath $this->getParameter('kernel.project_dir') . '/public/ParentPhotosNumerique/' $refcmdnum '.zip';
  5257.         
  5258.         // Vérifier si le fichier existe
  5259.         if (file_exists($filePath)) {
  5260.             $this->logger->info("Fichier trouvé, téléchargement démarré pour la commande numérique {$idCmdNumerique}");
  5261.             return $this->file($filePath$refcmdnum '.zip'ResponseHeaderBag::DISPOSITION_ATTACHMENT);
  5262.         } else {
  5263.             // Envoyer un email d'alerte pour fichier manquant
  5264.             $email = (new Email())
  5265.                 ->from('noreply@5sur5sejour.com')
  5266.                 ->to('yousra.tlich@gmail.com')
  5267.                 ->subject('ALERTE - Fichier ZIP manquant')
  5268.                 ->text(
  5269.                     "Le fichier ZIP est manquant pour la commande suivante:\n" .
  5270.                     "ID Commande Numérique: " $idCommande "\n" .
  5271.                     "ID Commande: " $idcommande "\n" .
  5272.                     "Lien de téléchargement: " $refcmdnum "\n" .
  5273.                     "Chemin attendu: " $filePath "\n" .
  5274.                     "Date: " . (new \DateTime())->format('Y-m-d H:i:s')
  5275.                 );
  5276.             
  5277.             $this->symfonyMailer->send($email);
  5278.             $this->logger->error("Fichier ZIP manquant pour la commande numérique {$idCommande} - chemin: {$filePath}");
  5279.             
  5280.             return new JsonResponse(['message' => 'Fichier non trouvé'], 404);
  5281.         }
  5282.     } 
  5283.     
  5284.     elseif ($commandeNumerique->getEtat() == 2) {
  5285.         $this->logger->warning("Tentative de téléchargement d'une commande déjà livrée - ID: {$idCommande}");
  5286.         return new JsonResponse(['message' => 'Commande déjà livrée'], 400);
  5287.     } else {
  5288.         $this->logger->warning("État de commande invalide pour la commande numérique {$idCmdNumerique} - état: {$commandeNumerique->getEtat()}");
  5289.         return new JsonResponse(['message' => 'Commande invalide'], 400);
  5290.     }
  5291. }
  5292.     /**
  5293.      * @Route("/Parent/disableTelecharge/{idCommande}" , name="disableTelecharge" )
  5294.      */
  5295.     public function disableTelecharge($idCommande)
  5296.     {
  5297.         $commandenumerique $this->em->getRepository(CommandeNumerique::class)->findOneBy(['id' => $idCommande]);
  5298.        $commandenumerique->setEtat(2);
  5299.         $commandenumerique->setDateTelechargement(new \DateTime());
  5300.         $this->em->getManager()->persist($commandenumerique);
  5301.         $this->em->getManager()->flush();
  5302.         return "ok";
  5303.     }
  5304.     /**
  5305.      * @Route("/Accompagnateur/pdffacturetest/{id}", name="pdffacturetest")
  5306.      */
  5307.     public function pdffactureAccomptest($id)
  5308.     {
  5309.         $em $this->em;
  5310.         $cmd $em->getRepository(Commande::class)->find($id);
  5311.         return $this->render('Parent/pdfFactureParent.html.twig', [
  5312.             "comande" => $cmd,
  5313.         ]);
  5314.     }
  5315.     /**
  5316.      * @Route("/Parent/pdffacture/{id}", name="pdffacture")
  5317.      */
  5318.     public function pdffacture($id)
  5319.     {
  5320.         $user $this->getUser();
  5321.         $cmd $this->em->getRepository(Commande::class)->find($id);
  5322.         //   $result=   $this->EmailServie->MailCommandeSuivieParent($user->getEmail(),$cmd );
  5323.         // Configure Dompdf according to your needs
  5324.         $pdfOptions = new Options();
  5325.         $pdfOptions->set('isRemoteEnabled'TRUE);
  5326.         $pdfOptions->set('defaultFont''Arial');
  5327.         // Instantiate Dompdf with our options
  5328.         $dompdf = new Dompdf($pdfOptions);
  5329.         $dompdf->set_option('isRemoteEnabled'TRUE);
  5330.         // Retrieve the HTML generated in our twig file
  5331.         $html $this->renderView('Parent/pdfFactureParent.html.twig', [
  5332.             "comande" => $cmd,
  5333.         ]);
  5334.         // Load HTML to Dompdf
  5335.         $dompdf->loadHtml($html);
  5336.         // (Optional) Setup the paper size and orientation 'portrait' or 'portrait'
  5337.         $dompdf->setPaper('A4''portrait');
  5338.         // Render the HTML as PDF
  5339.         $dompdf->render();
  5340.         // Output the generated PDF to Browser (force download)
  5341.         $dompdf->stream("facture.pdf", [
  5342.             "Attachment" => true
  5343.         ]);
  5344.         return new Response('yoopi');
  5345.     }
  5346.     /**
  5347.      * @Route("/Parent/testPDF/{idPrdt}", name="TcPdf")
  5348.      */
  5349.     public function TcPdf($idPrdt)
  5350.     {
  5351.         ini_set("max_execution_time", -1);
  5352.         $pageLayout = array(2115);
  5353.         $pdf $this->get("white_october.tcpdf")->create('L''CM'$pageLayouttrue'UTF-8'false);
  5354.         // set document information
  5355.         $pdf->SetCreator(PDF_CREATOR);
  5356.         $pdf->SetAuthor('Nicola Asuni');
  5357.         $pdf->SetTitle('TCPDF Example 009');
  5358.         $pdf->SetSubject('TCPDF Tutorial');
  5359.         $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
  5360.         $pdf->SetSubject('TCPDF Tutorial');
  5361.         $pdf->setPrintHeader(false);
  5362.         $pdf->setPrintFooter(false);
  5363.         // set image scale factor
  5364.         $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
  5365.         //        $pdf->AddPage();
  5366.         $pdf->setJPEGQuality(100);
  5367.         $horizontal_alignments = array('L''C''R');
  5368.         $vertical_alignments = array('T''M''B');
  5369.         //var_dump($pdf->getPageWidth());
  5370.         //var_dump($pdf->getPageHeight());die();
  5371.         $em $this->em;
  5372.         $Album $em->getRepository(Produit::class)->findOneBy(['id' => $idPrdt]);
  5373.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Album]);
  5374.         //dd($AllPages);
  5375.         //        $fP=[];
  5376.         //        array_push($fP,$AllPages[0]);
  5377.         //dd($AllPages);
  5378.         foreach ($AllPages as $p) {
  5379.             $pdf->AddPage();
  5380.             $pdf->setJPEGQuality(100);
  5381.             $contenu json_decode(json_decode($p->getCouleurbordure())[0]);
  5382.             $nbatach $contenu->nbrAttc;
  5383.             $nbatach intval(str_replace('"'''$nbatach));
  5384.             $color =  $contenu->color;
  5385.             // $color="rgb(255,255,255)";
  5386.             $color str_replace('"rgb('''$color);
  5387.             $color str_replace(')"'''$color);
  5388.             $color explode(","$color);
  5389.             $colorp = array(intval($color[0]), intval($color[1]), intval($color[2]));
  5390.             $tabtxt json_decode($contenu->txt);
  5391.             $tabphoto json_decode($contenu->attache);
  5392.             //
  5393.             //dd($tabtxt);
  5394.             //         dd($tabtxt);
  5395.             //dd($tabphoto);
  5396.             $tabClips json_decode($contenu->clips);
  5397.             // dd($tabClips);
  5398.             $x 0.6;
  5399.             $y 0.8;
  5400.             $w 19.8;
  5401.             $h 13.4;
  5402.             // get the current page break margin
  5403.             $bMargin $pdf->getBreakMargin();
  5404.             // get current auto-page-break mode
  5405.             $auto_page_break $pdf->getAutoPageBreak();
  5406.             // disable auto-page-break
  5407.             $pdf->SetAutoPageBreak(false0);
  5408.             // test all combinations of alignments
  5409.             $fitbox $horizontal_alignments[1] . ' ';
  5410.             $fitbox[1] = $vertical_alignments[1];
  5411.             $pdf->Rect(002115'F', array(), $colorp);
  5412.             //    sizeof($tabphoto)
  5413.             for ($i 0$i sizeof($tabphoto); $i++) {
  5414.                 $photo json_decode($tabphoto[$i]);
  5415.                 //les coordonnées de l'image réel:
  5416.                 $hght $photo->height;
  5417.                 $top $photo->top;
  5418.                 $left $photo->left;
  5419.                 $width $photo->width;
  5420.                 $ordre $photo->ordre;
  5421.                 $zoom $photo->zoom;
  5422.                 $path $photo->path;
  5423.                 $hght floatval(str_replace('cm'''$hght));
  5424.                 $top floatval(str_replace('cm'''$top));
  5425.                 $left floatval(str_replace('cm'''$left));
  5426.                 $width floatval(str_replace('cm'''$width));
  5427.                 //les coordonnées dropzone:
  5428.                 $heightOriginal $photo->height;
  5429.                 $widthOriginal $photo->width;
  5430.                 $top $photo->top;
  5431.                 $left $photo->left;
  5432.                 $heightOriginal floatval(str_replace('cm'''$heightOriginal));
  5433.                 $widthOriginal floatval(str_replace('cm'''$widthOriginal));
  5434.                 $top floatval(str_replace('cm'''$top));
  5435.                 $left floatval(str_replace('cm'''$left));
  5436.                 $heightOriginal $heightOriginal 37.7952755906;
  5437.                 $widthOriginal $widthOriginal 37.7952755906;
  5438.                 $topOriginal $top 37.7952755906;
  5439.                 $leftOriginal $left 37.7952755906;
  5440.                 $heightCrop $photo->heightCrop;
  5441.                 $topCrop $photo->topCrop;
  5442.                 $leftCrop $photo->leftCrop;
  5443.                 $widthCrop $photo->widthCrop;
  5444.                 $path $photo->path;
  5445.                 $heightCrop floatval(str_replace('cm'''$heightCrop));
  5446.                 $topCrop floatval(str_replace('cm'''$topCrop));
  5447.                 $leftCrop floatval(str_replace('cm'''$leftCrop));
  5448.                 $widthCrop floatval(str_replace('cm'''$widthCrop));
  5449.                 $widthCropPX $widthCrop 37.7952755906;
  5450.                 $heightCropPX $heightCrop 37.7952755906;
  5451.                 $topCropPX $topCrop 37.7952755906;
  5452.                 $leftCropPX $leftCrop 37.7952755906;
  5453.                 // var_dump("original widh: ".$widthCrop." "."original height : ".$heightCrop);
  5454.                 // var_dump("original left: ".$topCrop." "."original top : ".$leftCrop);
  5455.                 // var_dump("//00");
  5456.                 // var_dump("multip 37 widh: ".$widthCropPX." "."multip 37 height : ".$heightCropPX);
  5457.                 // var_dump("multip 37 top: ".$topCropPX." "."multip 37 left : ".$leftCropPX);
  5458.                 //Calculer position des images selon nombres images par page:
  5459.                 $positionX 0;
  5460.                 $positionY 0;
  5461.                 $widthImg 0;
  5462.                 $heightImg 0;
  5463.                 if ($nbatach == 1) {
  5464.                     $positionX 1.5;
  5465.                     $positionY 1.5;
  5466.                     $widthImg 18;
  5467.                     $heightImg 12;
  5468.                 } elseif ($nbatach == 2) {
  5469.                     if ($ordre == 1) {
  5470.                         $positionX 1.5;
  5471.                         $positionY 1.5;
  5472.                         $widthImg 8.7;
  5473.                         $heightImg 12;
  5474.                     }
  5475.                     if ($ordre == 2) {
  5476.                         $positionX 10.8;
  5477.                         $positionY 1.5;
  5478.                         $widthImg 8.7;
  5479.                         $heightImg 12;
  5480.                     }
  5481.                 } elseif ($nbatach == 3) {
  5482.                     if ($ordre == 1) {
  5483.                         $positionX 1.5;
  5484.                         $positionY 1.5;
  5485.                         $widthImg 8.7;
  5486.                         $heightImg 12;
  5487.                     }
  5488.                     if ($ordre == 2) {
  5489.                         $positionX 10.8;
  5490.                         $positionY 1.5;
  5491.                         $widthImg 8.7;
  5492.                         $heightImg 5.7;
  5493.                     }
  5494.                     if ($ordre == 3) {
  5495.                         $positionX 10.8;
  5496.                         $positionY 7.8;
  5497.                         $widthImg 8.7;
  5498.                         $heightImg 5.7;
  5499.                     }
  5500.                 } elseif ($nbatach == 4) {
  5501.                     if ($ordre == 1) {
  5502.                         $positionX 1.5;
  5503.                         $positionY 1.5;
  5504.                         $widthImg 8.7;
  5505.                         $heightImg 5.7;
  5506.                     }
  5507.                     if ($ordre == 2) {
  5508.                         $positionX 1.5;
  5509.                         $positionY 7.8;
  5510.                         $widthImg 8.7;
  5511.                         $heightImg 5.7;
  5512.                     }
  5513.                     if ($ordre == 3) {
  5514.                         $positionX 10.8;
  5515.                         $positionY 1.5;
  5516.                         $widthImg 8.7;
  5517.                         $heightImg 5.7;
  5518.                     }
  5519.                     if ($ordre == 4) {
  5520.                         $positionX 10.8;
  5521.                         $positionY 7.8;
  5522.                         $widthImg 8.7;
  5523.                         $heightImg 5.7;
  5524.                     }
  5525.                 } elseif ($nbatach == 5) {
  5526.                     if ($ordre == 1) {
  5527.                         $positionX 1.5;
  5528.                         $positionY 1.5;
  5529.                         $widthImg 18;
  5530.                         $heightImg 8;
  5531.                     }
  5532.                     if ($ordre == 2) {
  5533.                         $positionX 1.5;
  5534.                         $positionY 10.1;
  5535.                         $widthImg 4.05;
  5536.                         $heightImg 3.4;
  5537.                     }
  5538.                     if ($ordre == 3) {
  5539.                         $positionX 6.15;
  5540.                         $positionY 10.1;
  5541.                         $widthImg 4.05;
  5542.                         $heightImg 3.4;
  5543.                     }
  5544.                     if ($ordre == 4) {
  5545.                         $positionX 10.8;
  5546.                         $positionY 10.1;
  5547.                         $widthImg 4.05;
  5548.                         $heightImg 3.4;
  5549.                     }
  5550.                     if ($ordre == 5) {
  5551.                         $positionX 15.45;
  5552.                         $positionY 10.1;
  5553.                         $widthImg 4.05;
  5554.                         $heightImg 3.4;
  5555.                     }
  5556.                 } elseif ($nbatach == 6) {
  5557.                     if ($ordre == 1) {
  5558.                         $positionX 1.5;
  5559.                         $positionY 1.5;
  5560.                         $widthImg 5.53;
  5561.                         $heightImg 3.6;
  5562.                     }
  5563.                     if ($ordre == 2) {
  5564.                         $positionX 1.5;
  5565.                         $positionY 5.7;
  5566.                         $widthImg 5.53;
  5567.                         $heightImg 3.6;
  5568.                     }
  5569.                     if ($ordre == 3) {
  5570.                         $positionX 1.5;
  5571.                         $positionY 9.9;
  5572.                         $widthImg 5.53;
  5573.                         $heightImg 3.6;
  5574.                     }
  5575.                     if ($ordre == 4) {
  5576.                         $positionX 7.63;
  5577.                         $positionY 1.5;
  5578.                         $widthImg 5.53;
  5579.                         $heightImg 3.6;
  5580.                     }
  5581.                     if ($ordre == 5) {
  5582.                         $positionX 7.63;
  5583.                         $positionY 5.7;
  5584.                         $widthImg 5.53;
  5585.                         $heightImg 3.6;
  5586.                     }
  5587.                     if ($ordre == 6) {
  5588.                         $positionX 7.63;
  5589.                         $positionY 9.9;
  5590.                         $widthImg 5.53;
  5591.                         $heightImg 3.6;
  5592.                     }
  5593.                 } elseif ($nbatach == 12) {
  5594.                     if ($ordre == 1) {
  5595.                         $positionX 1.5;
  5596.                         $positionY 1.5;
  5597.                         $widthImg 4.05;
  5598.                         $heightImg 3.6;
  5599.                     }
  5600.                     if ($ordre == 2) {
  5601.                         $positionX 1.5;
  5602.                         $positionY 5.7;
  5603.                         $widthImg 4.05;
  5604.                         $heightImg 3.6;
  5605.                     }
  5606.                     if ($ordre == 3) {
  5607.                         $positionX 1.5;
  5608.                         $positionY 9.9;
  5609.                         $widthImg 4.05;
  5610.                         $heightImg 3.6;
  5611.                     }
  5612.                     if ($ordre == 4) {
  5613.                         $positionX 6.15;
  5614.                         $positionY 1.5;
  5615.                         $widthImg 4.05;
  5616.                         $heightImg 3.6;
  5617.                     }
  5618.                     if ($ordre == 5) {
  5619.                         $positionX 6.15;
  5620.                         $positionY 5.7;
  5621.                         $widthImg 4.05;
  5622.                         $heightImg 3.6;
  5623.                     }
  5624.                     if ($ordre == 6) {
  5625.                         $positionX 6.15;
  5626.                         $positionY 9.9;
  5627.                         $widthImg 4.05;
  5628.                         $heightImg 3.6;
  5629.                     }
  5630.                     if ($ordre == 7) {
  5631.                         $positionX 10.8;
  5632.                         $positionY 1.5;
  5633.                         $widthImg 4.05;
  5634.                         $heightImg 3.6;
  5635.                     }
  5636.                     if ($ordre == 8) {
  5637.                         $positionX 10.8;
  5638.                         $positionY 5.7;
  5639.                         $widthImg 4.05;
  5640.                         $heightImg 3.6;
  5641.                     }
  5642.                     if ($ordre == 9) {
  5643.                         $positionX 10.8;
  5644.                         $positionY 9.9;
  5645.                         $widthImg 4.05;
  5646.                         $heightImg 3.6;
  5647.                     }
  5648.                     if ($ordre == 10) {
  5649.                         $positionX 15.45;
  5650.                         $positionY 1.5;
  5651.                         $widthImg 4.05;
  5652.                         $heightImg 3.6;
  5653.                     }
  5654.                     if ($ordre == 11) {
  5655.                         $positionX 15.45;
  5656.                         $positionY 5.7;
  5657.                         $widthImg 4.05;
  5658.                         $heightImg 3.6;
  5659.                     }
  5660.                     if ($ordre == 12) {
  5661.                         $positionX 15.45;
  5662.                         $positionY 9.9;
  5663.                         $widthImg 4.05;
  5664.                         $heightImg 3.6;
  5665.                     }
  5666.                 }
  5667.                 //Recarder l'image :
  5668.                 // $path=str_replace( 'upload/', 'upload/ar_1.1'.',c_crop/q_auto:good/',$path);<
  5669.                 //                $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);
  5670.                 $pathArray explode("/"$path);
  5671.                 $idsArray explode("."$pathArray[sizeof($pathArray) - 1]);
  5672.                 $idImage "";
  5673.                 foreach ($idsArray as $key => $elem) {
  5674.                     if ($key != (sizeof($idsArray) - 1)) {
  5675.                         $idImage $idImage $elem;
  5676.                     }
  5677.                 }
  5678.                 //   $cloudinaryWidht=$widthOriginal;
  5679.                 // $cloudinaryHeight=$widthOriginal;
  5680.                 $idImage 'newprod/' $idImage;
  5681.                 //var_dump($idImage);
  5682.                 Unirest\Request::auth('263346742199243''jYw-jg0FOJGv89-o5Wo0Fa3rQWU');
  5683.                 $headers = array('Accept' => 'application/json');
  5684.                 $data = array("public_ids" => array($idImage));
  5685.                 $body Unirest\Request\Body::form($data);
  5686.                 Unirest\Request::verifyPeer(false);
  5687.                 $url 'https://api.cloudinary.com/v1_1/apss-factory/resources/image/upload/' $idImage;
  5688.                 // $resultMetadata=  \Cloudinary::Api.resources_by_ids([$idImage]);
  5689.                 //  var_dump($url);
  5690.                 //https://media.5sur5sejour.com/api/upload/a_exif/original/
  5691.                 $resultMetadata Unirest\Request::post($url$headers$body);
  5692.                 if (isset(json_decode($resultMetadata->raw_body)->width)) {
  5693.                     $cloudinaryWidht json_decode($resultMetadata->raw_body)->width;
  5694.                     $cloudinaryHeight json_decode($resultMetadata->raw_body)->height;
  5695.                 } else {
  5696.                     $cloudinaryWidht $widthOriginal;
  5697.                     $cloudinaryHeight $heightOriginal;
  5698.                 }
  5699.                 $ratiohight $cloudinaryWidht $widthOriginal;
  5700.                 $ratioHight $cloudinaryHeight $heightOriginal;
  5701.                 //$cloudinaryHeight=$cloudinaryHeight*$zoom;
  5702.                 //$cloudinaryWidht=$cloudinaryWidht*$zoom;
  5703.                 var_dump($cloudinaryWidht);
  5704.                 var_dump($cloudinaryHeight);
  5705.                 var_dump($ratioHight);
  5706.                 var_dump($zoom);
  5707.                 var_dump($leftOriginal);
  5708.                 var_dump('x_' round(abs($leftOriginal $zoom) * $ratioHight));
  5709.                 var_dump('y_' round(abs($topOriginal $zoom) * $ratiohight));
  5710.                 var_dump('w_' round(($widthCropPX $zoom) * $ratioHight));
  5711.                 var_dump('h_' round(($heightCropPX $zoom) * $ratiohight));
  5712.                 //var_dump($path);i
  5713.                 $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);
  5714.                 //var_dump($path);i
  5715.                 //                $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);
  5716.                 //var_dump($path);
  5717.                 $path str_replace("l_Logo5Sur5White_nh6tyk,o_10,fl_relative.tiled,"''$path);
  5718.                 //  var_dump("//00");
  5719.                 //  var_dump("avant 1.4 widh: ".round($widthCropPX)." "."avant 1.4 height : ".round($heightCropPX));
  5720.                 //  var_dump("avant 1.4 top: ".round(abs($top*37.7952755906))." avant 1.4 final left : ".round(abs($left*37.7952755906)));
  5721.                 //    var_dump("//00");
  5722.                 //   var_dump("final widh: ".round($widthCropPX*1.4)." "."final height : ".round($heightCropPX*1.4));
  5723.                 //  var_dump("final top: ".round(abs($top*37.7952755906*1.4))." "."final left : ".round(abs($left*37.7952755906*1.4)));
  5724.                 var_dump($zoom);
  5725.                 var_dump($path);
  5726.                 // $path="https://res.cloudinary.com/apss-factory/image/upload/w_691,h_356,c_crop/a_exif/v1587482806/newprod/crepes-au-chocolat_re9wvk.jpg";
  5727.                 $pdf->Image($path$positionX$positionY$widthImg$heightImg'JPG'''''false1000''falsefalse0falsefalsefalse);
  5728.                 //                $pdf->Rect($positionX,$positionY ,$widthImg, $heightImg, 'F', array(), array(264,200,67));
  5729.                 //
  5730.             }
  5731.             //    $pdf->Image('https://demo.appsfactor.fr/images/ClipArt_SVG/Etoilerose.svg',3,  2, 19, 13, 'SVG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
  5732.             for ($i 0$i sizeof($tabtxt); $i++) {
  5733.                 $txt json_decode($tabtxt[$i]);
  5734.                 $fontSize floatval(str_replace('px'''$txt->fontSize)) * 0.75;
  5735.                 //$txt->rotation
  5736.                 $check explode(','$txt->fontFamily);
  5737.                 if (sizeof($check) > 1) {
  5738.                     //default
  5739.                     if (($check[0] == "-apple-system") && ($txt->fontWeight == 400)) {
  5740.                         $finalFont "helvetica";
  5741.                         $weight '';
  5742.                     }
  5743.                     //classique
  5744.                     if (($check[0] == "Georgia") && ($txt->fontWeight == 400)) {
  5745.                         $finalFont "times";
  5746.                         $weight '';
  5747.                     }
  5748.                     //creative
  5749.                     if (($check[0] == "-apple-system") && ($txt->fontWeight == 700)) {
  5750.                         $finalFont "helveticaB";
  5751.                         $weight '';
  5752.                     }
  5753.                     // manuscrite
  5754.                     if (($check[0] == "Comic Sans") && ($txt->fontWeight == 400)) {
  5755.                         $finalFont "Courier";
  5756.                         $weight '';
  5757.                     }
  5758.                     //c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.woff2
  5759.                 } else {
  5760.                     //baton
  5761.                     if (($txt->fontFamily == 'Impact') && ($txt->fontWeight == 400)) {
  5762.                         $finalFont "helveticaB";
  5763.                         $weight 'B';
  5764.                     }
  5765.                 }
  5766.                 $pdf->SetFont($finalFont$weight$fontSize);
  5767.                 $leftTxt $txt->left;
  5768.                 $topTxt $txt->top;
  5769.                 $heightClips $txt->height;
  5770.                 $widthClips $txt->width;
  5771.                 $heightTxt floatval(str_replace('cm'''$heightClips));
  5772.                 $topTxt floatval(str_replace('cm'''$topTxt));
  5773.                 $leftTxt floatval(str_replace('cm'''$leftTxt));
  5774.                 $widthTxt floatval(str_replace('cm'''$widthClips));
  5775.                 $pdf->SetXY($leftTxt$topTxttrue);
  5776.                 //                    var_dump($leftTxt);
  5777.                 //                  var_dump($topTxt);
  5778.                 // var_dump(floatval(str_replace('rad','',$txt->rotation))*57,2958);
  5779.                 //                var_dump("text");
  5780.                 $pdf->StartTransform();
  5781.                 var_dump($txt->rotation);
  5782.                 var_dump(str_replace('rad'''$txt->rotation));
  5783.                 var_dump(floatval(str_replace('rad'''$txt->rotation)) * 57.2958);
  5784.                 $pdf->Rotate((floatval(str_replace('rad'''$txt->rotation)) * 57.2958) * -1$leftTxt + ($widthTxt 2), $topTxt + ($heightTxt 2));
  5785.                 // $pdf->Rotate(45);
  5786.                 //   $pdf->Text($leftTxt, $topTxt, $txt->contenu);
  5787.                 //$pdf->SetTextColor(200);
  5788.                 //$pdf->Text($leftTxt, $topTxt, $txt->contenu);
  5789.                 // $pdf->MultiCell($leftTxt, $topTxt,  $txt->contenu, 0, $ln=0, 'C', 0, '', 0, false, 'C', 'C');
  5790.                 $pdf->Write(str_replace('cm'''$txt->height), trim($txt->contenu));
  5791.                 // $pdf->writeHTML("<p>".$txt->contenu."</p>", true, false, false, false, '');
  5792.                 $pdf->StopTransform();
  5793.             }
  5794.             //Positionner text
  5795.             //            $pdf->ImageSVG("C:\\Users\\AppsFactor12\\Desktop\\5sur5\\5sur5Sejour\\public\\images\\ClipArt_SVG\\Etoilerose.svg",100,200,500, 500, '', '', '', 0, false);
  5796.             //Positionner clipart
  5797.             //            dd($tabClips);
  5798.             for ($i 0$i sizeof($tabClips); $i++) {
  5799.                 $Clips json_decode($tabClips[$i]);
  5800.                 $heightClips $Clips->height;
  5801.                 $topClips $Clips->top;
  5802.                 $leftClips $Clips->left;
  5803.                 $widthClips $Clips->width;
  5804.                 $path $Clips->path;
  5805.                 $pathClips str_replace('"'''$path);
  5806.                 $heightClips floatval(str_replace('cm'''$heightClips));
  5807.                 $topClips floatval(str_replace('cm'''$topClips));
  5808.                 $leftClips floatval(str_replace('cm'''$leftClips));
  5809.                 $widthClips floatval(str_replace('cm'''$widthClips));
  5810.                 $heightClipsPX round($heightClips 37.7952755906);
  5811.                 $widthClipsPX round($widthClips 37.7952755906);
  5812.                 ////                $positionXclips = $positionX + $leftClips;
  5813.                 ////                $positionYclips = $positionY + $topClips;
  5814.                 //
  5815.                 //$pdf->ImageSVG("images/ClipArt_SVG/Ete4.svg",$leftClips,$topClips,$widthClips, $heightClips);
  5816.                 //https://res.cloudinary.com/apss-factory/image/private/s--EdExAzx8--/v1588758453/GlobeFooter_c4duua.svg
  5817.                 // https://res.cloudinary.com/apss-factory/image/upload/v1588764528/Groupe_113_pcjyj4.png
  5818.                 var_dump($pathClips);
  5819.                 $pdf->StartTransform();
  5820.                 $pdf->Rotate((floatval(str_replace('rad'''$Clips->rotation)) * 57.2958) * -1$leftClips + ($widthClips 2), $topClips + ($heightClips 2));
  5821.                 $pdf->Image($this->newPAthCLipart($pathClips$heightClipsPX$widthClipsPX), $leftClips,  $topClips$widthClips$heightClips''''''false300);
  5822.                 $pdf->StopTransform();
  5823.             }
  5824.         }
  5825.         // echo '</pre>';
  5826.         //return new response("yezi");
  5827.         $projectRoot $this->getParameter('kernel.project_dir');
  5828.         $pdf->Output($projectRoot '/public/pdfDocs/example_' $idPrdt '.pdf''F');
  5829.         return new response("yezi");
  5830.         //return $pdf->Output('example_009.pdf', 'I');
  5831.     }
  5832.     /**
  5833.      * @Route("/Parent/testPDFphoto/{idPrdt}", name="TcPdfphoto")
  5834.      */
  5835.     public function TcPdfPhoto($idPrdt)
  5836.     {
  5837.         ini_set("max_execution_time", -1);
  5838.         $pageLayout = array(1510);
  5839.         $pdf $this->get("white_october.tcpdf")->create('L''CM'$pageLayouttrue'UTF-8'false);
  5840.         // set document information
  5841.         $pdf->SetCreator(PDF_CREATOR);
  5842.         $pdf->SetAuthor('Nicola Asuni');
  5843.         $pdf->SetTitle('TCPDF Example 009');
  5844.         $pdf->SetSubject('TCPDF Tutorial');
  5845.         $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
  5846.         $pdf->SetSubject('TCPDF Tutorial');
  5847.         $pdf->setPrintHeader(false);
  5848.         $pdf->setPrintFooter(false);
  5849.         // set image scale factor
  5850.         $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
  5851.         //        $pdf->AddPage();
  5852.         $pdf->setJPEGQuality(100);
  5853.         $horizontal_alignments = array('L''C''R');
  5854.         $vertical_alignments = array('T''M''B');
  5855.         //var_dump($pdf->getPageWidth());
  5856.         //var_dump($pdf->getPageHeight());die();
  5857.         $em $this->em;
  5858.         $Album $em->getRepository(Produit::class)->findOneBy(['id' => $idPrdt]);
  5859.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Album]);
  5860.         //dd($AllPages);
  5861.         //        $fP=[];
  5862.         //        array_push($fP,$AllPages[0]);
  5863.         //dd($AllPages);
  5864.         foreach ($AllPages as $p) {
  5865.             $pdf->AddPage();
  5866.             $pdf->setJPEGQuality(100);
  5867.             $contenu json_decode(json_decode($p->getCouleurbordure())[0]);
  5868.             $nbatach $contenu->nbrAttc;
  5869.             $nbatach intval(str_replace('"'''$nbatach));
  5870.             $color =  $contenu->color;
  5871.             // $color="rgb(255,255,255)";
  5872.             $tabphoto json_decode($contenu->attache);
  5873.             //
  5874.             //dd($tabtxt);
  5875.             //         dd($tabtxt);
  5876.             //dd($tabphoto);
  5877.             // dd($tabClips);
  5878.             // get the current page break margin
  5879.             $bMargin $pdf->getBreakMargin();
  5880.             // get current auto-page-break mode
  5881.             $auto_page_break $pdf->getAutoPageBreak();
  5882.             // disable auto-page-break
  5883.             $pdf->SetAutoPageBreak(false0);
  5884.             // test all combinations of alignments
  5885.             $fitbox $horizontal_alignments[1] . ' ';
  5886.             $fitbox[1] = $vertical_alignments[1];
  5887.             //    sizeof($tabphoto)
  5888.             for ($i 0$i sizeof($tabphoto); $i++) {
  5889.                 $photo json_decode($tabphoto[$i]);
  5890.                 //les coordonnées de l'image réel:
  5891.                 $hght $photo->height;
  5892.                 $top $photo->top;
  5893.                 $left $photo->left;
  5894.                 $width $photo->width;
  5895.                 $ordre $photo->ordre;
  5896.                 $zoom $photo->zoom;
  5897.                 $path $photo->path;
  5898.                 $hght floatval(str_replace('cm'''$hght));
  5899.                 $top floatval(str_replace('cm'''$top));
  5900.                 $left floatval(str_replace('cm'''$left));
  5901.                 $width floatval(str_replace('cm'''$width));
  5902.                 //les coordonnées dropzone:
  5903.                 $heightOriginal $photo->height;
  5904.                 $widthOriginal $photo->width;
  5905.                 $top $photo->top;
  5906.                 $left $photo->left;
  5907.                 $heightOriginal floatval(str_replace('cm'''$heightOriginal));
  5908.                 $widthOriginal floatval(str_replace('cm'''$widthOriginal));
  5909.                 $top floatval(str_replace('cm'''$top));
  5910.                 $left floatval(str_replace('cm'''$left));
  5911.                 $heightOriginal $heightOriginal 37.7952755906;
  5912.                 $widthOriginal $widthOriginal 37.7952755906;
  5913.                 $topOriginal $top 37.7952755906;
  5914.                 $leftOriginal $left 37.7952755906;
  5915.                 $heightCrop $photo->heightCrop;
  5916.                 $topCrop $photo->topCrop;
  5917.                 $leftCrop $photo->leftCrop;
  5918.                 $widthCrop $photo->widthCrop;
  5919.                 $path $photo->path;
  5920.                 $heightCrop floatval(str_replace('cm'''$heightCrop));
  5921.                 $topCrop floatval(str_replace('cm'''$topCrop));
  5922.                 $leftCrop floatval(str_replace('cm'''$leftCrop));
  5923.                 $widthCrop floatval(str_replace('cm'''$widthCrop));
  5924.                 $widthCropPX $widthCrop 37.7952755906;
  5925.                 $heightCropPX $heightCrop 37.7952755906;
  5926.                 $topCropPX $topCrop 37.7952755906;
  5927.                 $leftCropPX $leftCrop 37.7952755906;
  5928.                 // var_dump("original widh: ".$widthCrop." "."original height : ".$heightCrop);
  5929.                 // var_dump("original left: ".$topCrop." "."original top : ".$leftCrop);
  5930.                 // var_dump("//00");
  5931.                 // var_dump("multip 37 widh: ".$widthCropPX." "."multip 37 height : ".$heightCropPX);
  5932.                 // var_dump("multip 37 top: ".$topCropPX." "."multip 37 left : ".$leftCropPX);
  5933.                 //Calculer position des images selon nombres images par page:
  5934.                 $positionX 0;
  5935.                 $positionY 0;
  5936.                 $widthImg 0;
  5937.                 $heightImg 0;
  5938.                 if ($nbatach == 1) {
  5939.                     $positionX 0.3;
  5940.                     $positionY 0.3;
  5941.                     $widthImg 14.4;
  5942.                     $heightImg 9.4;
  5943.                 }
  5944.                 //Recarder l'image :
  5945.                 // $path=str_replace( 'upload/', 'upload/ar_1.1'.',c_crop/q_auto:good/',$path);<
  5946.                 //                $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);
  5947.                 $pathArray explode("/"$path);
  5948.                 $idsArray explode("."$pathArray[sizeof($pathArray) - 1]);
  5949.                 $idImage "";
  5950.                 foreach ($idsArray as $key => $elem) {
  5951.                     if ($key != (sizeof($idsArray) - 1)) {
  5952.                         $idImage $idImage $elem;
  5953.                     }
  5954.                 }
  5955.                 //   $cloudinaryWidht=$widthOriginal;
  5956.                 // $cloudinaryHeight=$widthOriginal;
  5957.                 $idImage 'newprod/' $idImage;
  5958.                 //var_dump($idImage);
  5959.                 Unirest\Request::auth('263346742199243''jYw-jg0FOJGv89-o5Wo0Fa3rQWU');
  5960.                 $headers = array('Accept' => 'application/json');
  5961.                 $data = array("public_ids" => array($idImage));
  5962.                 $body Unirest\Request\Body::form($data);
  5963.                 Unirest\Request::verifyPeer(false);
  5964.                 $url 'https://api.cloudinary.com/v1_1/apss-factory/resources/image/upload/' $idImage;
  5965.                 // $resultMetadata=  \Cloudinary::Api.resources_by_ids([$idImage]);
  5966.                 //  var_dump($url);
  5967.                 $resultMetadata Unirest\Request::post($url$headers$body);
  5968.                 if (isset(json_decode($resultMetadata->raw_body)->width)) {
  5969.                     $cloudinaryWidht json_decode($resultMetadata->raw_body)->width;
  5970.                     $cloudinaryHeight json_decode($resultMetadata->raw_body)->height;
  5971.                 } else {
  5972.                     $cloudinaryWidht $widthOriginal;
  5973.                     $cloudinaryHeight $heightOriginal;
  5974.                 }
  5975.                 $ratiohight $cloudinaryWidht $widthOriginal;
  5976.                 $ratioHight $cloudinaryHeight $heightOriginal;
  5977.                 //$cloudinaryHeight=$cloudinaryHeight*$zoom;
  5978.                 //$cloudinaryWidht=$cloudinaryWidht*$zoom;
  5979.                 $zoom 1;
  5980.                 var_dump($cloudinaryWidht);
  5981.                 var_dump($cloudinaryHeight);
  5982.                 var_dump($ratioHight);
  5983.                 var_dump($zoom);
  5984.                 var_dump($leftOriginal);
  5985.                 var_dump('x_' round(abs($leftOriginal $zoom) * $ratioHight));
  5986.                 var_dump('y_' round(abs($topOriginal $zoom) * $ratiohight));
  5987.                 var_dump('w_' round(($widthCropPX $zoom) * $ratioHight));
  5988.                 var_dump('h_' round(($heightCropPX $zoom) * $ratiohight));
  5989.                 //var_dump($path);i
  5990.                 $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);
  5991.                 //var_dump($path);i
  5992.                 //                $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);
  5993.                 //var_dump($path);
  5994.                 $path str_replace("l_Logo5Sur5White_nh6tyk,o_10,fl_relative.tiled,"''$path);
  5995.                 //  var_dump("//00");
  5996.                 //  var_dump("avant 1.4 widh: ".round($widthCropPX)." "."avant 1.4 height : ".round($heightCropPX));
  5997.                 //  var_dump("avant 1.4 top: ".round(abs($top*37.7952755906))." avant 1.4 final left : ".round(abs($left*37.7952755906)));
  5998.                 //    var_dump("//00");
  5999.                 //   var_dump("final widh: ".round($widthCropPX*1.4)." "."final height : ".round($heightCropPX*1.4));
  6000.                 //  var_dump("final top: ".round(abs($top*37.7952755906*1.4))." "."final left : ".round(abs($left*37.7952755906*1.4)));
  6001.                 var_dump($zoom);
  6002.                 var_dump($path);
  6003.                 // $path="https://res.cloudinary.com/apss-factory/image/upload/w_691,h_356,c_crop/a_exif/v1587482806/newprod/crepes-au-chocolat_re9wvk.jpg";
  6004.                 $pdf->Image($path$positionX$positionY$widthImg$heightImg'JPG'''''false1000''falsefalse0falsefalsefalse);
  6005.                 //                $pdf->Rect($positionX,$positionY ,$widthImg, $heightImg, 'F', array(), array(264,200,67));
  6006.                 //
  6007.             }
  6008.             //    $pdf->Image('https://demo.appsfactor.fr/images/ClipArt_SVG/Etoilerose.svg',3,  2, 19, 13, 'SVG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
  6009.             //Positionner text
  6010.             //            $pdf->ImageSVG("C:\\Users\\AppsFactor12\\Desktop\\5sur5\\5sur5Sejour\\public\\images\\ClipArt_SVG\\Etoilerose.svg",100,200,500, 500, '', '', '', 0, false);
  6011.             //Positionner clipart
  6012.             //            dd($tabClips);
  6013.         }
  6014.         // echo '</pre>';
  6015.         //return new response("yezi");
  6016.         $projectRoot $this->getParameter('kernel.project_dir');
  6017.         $pdf->Output($projectRoot '/public/pdfDocs/example_' $idPrdt '.pdf''F');
  6018.         return new response("yezi");
  6019.         //return $pdf->Output('example_009.pdf', 'I');
  6020.     }
  6021.     /**
  6022.      * @Route("/Parent/testPDFphotoR/{idPrdt}", name="TcPdfphotoR")
  6023.      */
  6024.     public function TcPdfPhotoR($idPrdt)
  6025.     {
  6026.         ini_set("max_execution_time", -1);
  6027.         $pageLayout = array(910);
  6028.         $pdf $this->get("white_october.tcpdf")->create('P''CM'$pageLayouttrue'UTF-8'false);
  6029.         // set document information
  6030.         $pdf->SetCreator(PDF_CREATOR);
  6031.         $pdf->SetAuthor('Nicola Asuni');
  6032.         $pdf->SetTitle('TCPDF Example 009');
  6033.         $pdf->SetSubject('TCPDF Tutorial');
  6034.         $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
  6035.         $pdf->SetSubject('TCPDF Tutorial');
  6036.         $pdf->setPrintHeader(false);
  6037.         $pdf->setPrintFooter(false);
  6038.         // set image scale factor
  6039.         $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
  6040.         //        $pdf->AddPage();
  6041.         $pdf->setJPEGQuality(100);
  6042.         $horizontal_alignments = array('L''C''R');
  6043.         $vertical_alignments = array('T''M''B');
  6044.         //var_dump($pdf->getPageWidth());
  6045.         //var_dump($pdf->getPageHeight());die();
  6046.         $em $this->em;
  6047.         $Album $em->getRepository(Produit::class)->findOneBy(['id' => $idPrdt]);
  6048.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Album]);
  6049.         //dd($AllPages);
  6050.         //        $fP=[];
  6051.         //        array_push($fP,$AllPages[0]);
  6052.         //dd($AllPages);
  6053.         foreach ($AllPages as $p) {
  6054.             $pdf->AddPage();
  6055.             $pdf->setJPEGQuality(100);
  6056.             $contenu json_decode(json_decode($p->getCouleurbordure())[0]);
  6057.             $nbatach $contenu->nbrAttc;
  6058.             $nbatach intval(str_replace('"'''$nbatach));
  6059.             $color =  $contenu->color;
  6060.             // $color="rgb(255,255,255)";
  6061.             $tabphoto json_decode($contenu->attache);
  6062.             //
  6063.             //dd($tabtxt);
  6064.             //         dd($tabtxt);
  6065.             //dd($tabphoto);
  6066.             // dd($tabClips);
  6067.             // get the current page break margin
  6068.             $bMargin $pdf->getBreakMargin();
  6069.             // get current auto-page-break mode
  6070.             $auto_page_break $pdf->getAutoPageBreak();
  6071.             // disable auto-page-break
  6072.             $pdf->SetAutoPageBreak(false0);
  6073.             // test all combinations of alignments
  6074.             $fitbox $horizontal_alignments[1] . ' ';
  6075.             $fitbox[1] = $vertical_alignments[1];
  6076.             //    sizeof($tabphoto)
  6077.             for ($i 0$i sizeof($tabphoto); $i++) {
  6078.                 $photo json_decode($tabphoto[$i]);
  6079.                 //les coordonnées de l'image réel:
  6080.                 $hght $photo->height;
  6081.                 $top $photo->top;
  6082.                 $left $photo->left;
  6083.                 $width $photo->width;
  6084.                 $ordre $photo->ordre;
  6085.                 $zoom $photo->zoom;
  6086.                 $path $photo->path;
  6087.                 $hght floatval(str_replace('cm'''$hght));
  6088.                 $top floatval(str_replace('cm'''$top));
  6089.                 $left floatval(str_replace('cm'''$left));
  6090.                 $width floatval(str_replace('cm'''$width));
  6091.                 //les coordonnées dropzone:
  6092.                 $heightOriginal $photo->height;
  6093.                 $widthOriginal $photo->width;
  6094.                 $top $photo->top;
  6095.                 $left $photo->left;
  6096.                 $heightOriginal floatval(str_replace('cm'''$heightOriginal));
  6097.                 $widthOriginal floatval(str_replace('cm'''$widthOriginal));
  6098.                 $top floatval(str_replace('cm'''$top));
  6099.                 $left floatval(str_replace('cm'''$left));
  6100.                 $heightOriginal $heightOriginal 37.7952755906;
  6101.                 $widthOriginal $widthOriginal 37.7952755906;
  6102.                 $topOriginal $top 37.7952755906;
  6103.                 $leftOriginal $left 37.7952755906;
  6104.                 $heightCrop $photo->heightCrop;
  6105.                 $topCrop $photo->topCrop;
  6106.                 $leftCrop $photo->leftCrop;
  6107.                 $widthCrop $photo->widthCrop;
  6108.                 $path $photo->path;
  6109.                 $heightCrop floatval(str_replace('cm'''$heightCrop));
  6110.                 $topCrop floatval(str_replace('cm'''$topCrop));
  6111.                 $leftCrop floatval(str_replace('cm'''$leftCrop));
  6112.                 $widthCrop floatval(str_replace('cm'''$widthCrop));
  6113.                 $widthCropPX $widthCrop 37.7952755906;
  6114.                 $heightCropPX $heightCrop 37.7952755906;
  6115.                 $topCropPX $topCrop 37.7952755906;
  6116.                 $leftCropPX $leftCrop 37.7952755906;
  6117.                 // var_dump("original widh: ".$widthCrop." "."original height : ".$heightCrop);
  6118.                 // var_dump("original left: ".$topCrop." "."original top : ".$leftCrop);
  6119.                 // var_dump("//00");
  6120.                 // var_dump("multip 37 widh: ".$widthCropPX." "."multip 37 height : ".$heightCropPX);
  6121.                 // var_dump("multip 37 top: ".$topCropPX." "."multip 37 left : ".$leftCropPX);
  6122.                 //Calculer position des images selon nombres images par page:
  6123.                 $positionX 0;
  6124.                 $positionY 0;
  6125.                 $widthImg 0;
  6126.                 $heightImg 0;
  6127.                 $positionX 0.55;
  6128.                 $positionY 0.5;
  6129.                 $widthImg 7.9;
  6130.                 $heightImg 6.9;
  6131.                 //Recarder l'image :
  6132.                 // $path=str_replace( 'upload/', 'upload/ar_1.1'.',c_crop/q_auto:good/',$path);<
  6133.                 //                $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);
  6134.                 $pathArray explode("/"$path);
  6135.                 $idsArray explode("."$pathArray[sizeof($pathArray) - 1]);
  6136.                 $idImage "";
  6137.                 foreach ($idsArray as $key => $elem) {
  6138.                     if ($key != (sizeof($idsArray) - 1)) {
  6139.                         $idImage $idImage $elem;
  6140.                     }
  6141.                 }
  6142.                 //   $cloudinaryWidht=$widthOriginal;
  6143.                 // $cloudinaryHeight=$widthOriginal;
  6144.                 $idImage 'newprod/' $idImage;
  6145.                 //var_dump($idImage);
  6146.                 Unirest\Request::auth('263346742199243''jYw-jg0FOJGv89-o5Wo0Fa3rQWU');
  6147.                 $headers = array('Accept' => 'application/json');
  6148.                 $data = array("public_ids" => array($idImage));
  6149.                 $body Unirest\Request\Body::form($data);
  6150.                 Unirest\Request::verifyPeer(false);
  6151.                 $url 'https://api.cloudinary.com/v1_1/apss-factory/resources/image/upload/' $idImage;
  6152.                 // $resultMetadata=  \Cloudinary::Api.resources_by_ids([$idImage]);
  6153.                 //  var_dump($url);
  6154.                 $resultMetadata Unirest\Request::post($url$headers$body);
  6155.                 if (isset(json_decode($resultMetadata->raw_body)->width)) {
  6156.                     $cloudinaryWidht json_decode($resultMetadata->raw_body)->width;
  6157.                     $cloudinaryHeight json_decode($resultMetadata->raw_body)->height;
  6158.                 } else {
  6159.                     $cloudinaryWidht $widthOriginal;
  6160.                     $cloudinaryHeight $heightOriginal;
  6161.                 }
  6162.                 $ratiohight $cloudinaryWidht $widthOriginal;
  6163.                 $ratioHight $cloudinaryHeight $heightOriginal;
  6164.                 //$cloudinaryHeight=$cloudinaryHeight*$zoom;
  6165.                 //$cloudinaryWidht=$cloudinaryWidht*$zoom;
  6166.                 $zoom 1;
  6167.                 var_dump($cloudinaryWidht);
  6168.                 var_dump($cloudinaryHeight);
  6169.                 var_dump($ratioHight);
  6170.                 var_dump($zoom);
  6171.                 var_dump($leftOriginal);
  6172.                 var_dump('x_' round(abs($leftOriginal $zoom) * $ratioHight));
  6173.                 var_dump('y_' round(abs($topOriginal $zoom) * $ratiohight));
  6174.                 var_dump('w_' round(($widthCropPX $zoom) * $ratioHight));
  6175.                 var_dump('h_' round(($heightCropPX $zoom) * $ratiohight));
  6176.                 //var_dump($path);i
  6177.                 $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);
  6178.                 //var_dump($path);i
  6179.                 //                $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);
  6180.                 //var_dump($path);
  6181.                 $path str_replace("l_Logo5Sur5White_nh6tyk,o_10,fl_relative.tiled,"''$path);
  6182.                 //  var_dump("//00");
  6183.                 //  var_dump("avant 1.4 widh: ".round($widthCropPX)." "."avant 1.4 height : ".round($heightCropPX));
  6184.                 //  var_dump("avant 1.4 top: ".round(abs($top*37.7952755906))." avant 1.4 final left : ".round(abs($left*37.7952755906)));
  6185.                 //    var_dump("//00");
  6186.                 //   var_dump("final widh: ".round($widthCropPX*1.4)." "."final height : ".round($heightCropPX*1.4));
  6187.                 //  var_dump("final top: ".round(abs($top*37.7952755906*1.4))." "."final left : ".round(abs($left*37.7952755906*1.4)));
  6188.                 var_dump($zoom);
  6189.                 var_dump($path);
  6190.                 // $path="https://res.cloudinary.com/apss-factory/image/upload/w_691,h_356,c_crop/a_exif/v1587482806/newprod/crepes-au-chocolat_re9wvk.jpg";
  6191.                 $pdf->Image($path$positionX$positionY$widthImg$heightImg'JPG'''''false1000''falsefalse0falsefalsefalse);
  6192.                 //                $pdf->Rect($positionX,$positionY ,$widthImg, $heightImg, 'F', array(), array(264,200,67));
  6193.                 //
  6194.             }
  6195.             //    $pdf->Image('https://demo.appsfactor.fr/images/ClipArt_SVG/Etoilerose.svg',3,  2, 19, 13, 'SVG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
  6196.             //Positionner text
  6197.             //            $pdf->ImageSVG("C:\\Users\\AppsFactor12\\Desktop\\5sur5\\5sur5Sejour\\public\\images\\ClipArt_SVG\\Etoilerose.svg",100,200,500, 500, '', '', '', 0, false);
  6198.             //Positionner clipart
  6199.             //            dd($tabClips);
  6200.         }
  6201.         // echo '</pre>';
  6202.         //return new response("yezi");
  6203.         $projectRoot $this->getParameter('kernel.project_dir');
  6204.         $pdf->Output($projectRoot '/public/pdfDocs/example_' $idPrdt '.pdf''F');
  6205.         return new response("yezi");
  6206.         //return $pdf->Output('example_009.pdf', 'I');
  6207.     }
  6208.     /**
  6209.      * @Route("/Parent/testPDFCal/{idPrdt}", name="TcPdfCal")
  6210.      */
  6211.     public function TcPdfCalendrier($idPrdt)
  6212.     {
  6213.         ini_set("max_execution_time", -1);
  6214.         $pageLayout = array(2115);
  6215.         $pdf $this->get("white_october.tcpdf")->create('L''CM'$pageLayouttrue'UTF-8'false);
  6216.         // set document information
  6217.         $pdf->SetCreator(PDF_CREATOR);
  6218.         $pdf->SetAuthor('Nicola Asuni');
  6219.         $pdf->SetTitle('TCPDF Example 009');
  6220.         $pdf->SetSubject('TCPDF Tutorial');
  6221.         $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
  6222.         $pdf->SetSubject('TCPDF Tutorial');
  6223.         $pdf->setPrintHeader(false);
  6224.         $pdf->setPrintFooter(false);
  6225.         // set image scale factor
  6226.         $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
  6227.         //        $pdf->AddPage();
  6228.         $pdf->setJPEGQuality(100);
  6229.         $horizontal_alignments = array('L''C''R');
  6230.         $vertical_alignments = array('T''M''B');
  6231.         //var_dump($pdf->getPageWidth());
  6232.         //var_dump($pdf->getPageHeight());die();
  6233.         $em $this->em;
  6234.         $Album $em->getRepository(Produit::class)->findOneBy(['id' => $idPrdt]);
  6235.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Album]);
  6236.         //dd($AllPages);
  6237.         //        $fP=[];
  6238.         //        array_push($fP,$AllPages[0]);
  6239.         //dd($AllPages);
  6240.         foreach ($AllPages as $key => $p) {
  6241.             $pdf->AddPage();
  6242.             $pdf->setJPEGQuality(100);
  6243.             $contenu json_decode(json_decode($p->getCouleurbordure())[0]);
  6244.             $nbatachS $contenu->nbrAttc;
  6245.             $nbatach intval(str_replace('"'''$nbatachS));
  6246.             if (strpos($nbatachS"H")) {
  6247.                 $nbatach $nbatach 'H';
  6248.             }
  6249.             $tabtxt json_decode($contenu->txt);
  6250.             $tabphoto json_decode($contenu->attache);
  6251.             //
  6252.             //dd($tabtxt);
  6253.             //         dd($tabtxt);
  6254.             //dd($tabphoto);
  6255.             $tabClips json_decode($contenu->clips);
  6256.             // dd($tabClips);
  6257.             $x 0.6;
  6258.             $y 0.8;
  6259.             $w 19.8;
  6260.             $h 13.4;
  6261.             // get the current page break margin
  6262.             $bMargin $pdf->getBreakMargin();
  6263.             // get current auto-page-break mode
  6264.             $auto_page_break $pdf->getAutoPageBreak();
  6265.             // disable auto-page-break
  6266.             $pdf->SetAutoPageBreak(false0);
  6267.             // test all combinations of alignments
  6268.             $fitbox $horizontal_alignments[1] . ' ';
  6269.             $fitbox[1] = $vertical_alignments[1];
  6270.             //    sizeof($tabphoto)
  6271.             for ($i 0$i sizeof($tabphoto); $i++) {
  6272.                 $photo json_decode($tabphoto[$i]);
  6273.                 //les coordonnées de l'image réel:
  6274.                 $hght $photo->height;
  6275.                 $top $photo->top;
  6276.                 $left $photo->left;
  6277.                 $width $photo->width;
  6278.                 $ordre $photo->ordre;
  6279.                 $zoom $photo->zoom;
  6280.                 $path $photo->path;
  6281.                 $hght floatval(str_replace('cm'''$hght));
  6282.                 $top floatval(str_replace('cm'''$top));
  6283.                 $left floatval(str_replace('cm'''$left));
  6284.                 $width floatval(str_replace('cm'''$width));
  6285.                 //les coordonnées dropzone:
  6286.                 $heightOriginal $photo->height;
  6287.                 $widthOriginal $photo->width;
  6288.                 $top $photo->top;
  6289.                 $left $photo->left;
  6290.                 $heightOriginal floatval(str_replace('cm'''$heightOriginal));
  6291.                 $widthOriginal floatval(str_replace('cm'''$widthOriginal));
  6292.                 $top floatval(str_replace('cm'''$top));
  6293.                 $left floatval(str_replace('cm'''$left));
  6294.                 $heightOriginal $heightOriginal 37.7952755906;
  6295.                 $widthOriginal $widthOriginal 37.7952755906;
  6296.                 $topOriginal $top 37.7952755906;
  6297.                 $leftOriginal $left 37.7952755906;
  6298.                 $heightCrop $photo->heightCrop;
  6299.                 $topCrop $photo->topCrop;
  6300.                 $leftCrop $photo->leftCrop;
  6301.                 $widthCrop $photo->widthCrop;
  6302.                 $path $photo->path;
  6303.                 $heightCrop floatval(str_replace('cm'''$heightCrop));
  6304.                 $topCrop floatval(str_replace('cm'''$topCrop));
  6305.                 $leftCrop floatval(str_replace('cm'''$leftCrop));
  6306.                 $widthCrop floatval(str_replace('cm'''$widthCrop));
  6307.                 $widthCropPX $widthCrop 37.7952755906;
  6308.                 $heightCropPX $heightCrop 37.7952755906;
  6309.                 $topCropPX $topCrop 37.7952755906;
  6310.                 $leftCropPX $leftCrop 37.7952755906;
  6311.                 // var_dump("original widh: ".$widthCrop." "."original height : ".$heightCrop);
  6312.                 // var_dump("original left: ".$topCrop." "."original top : ".$leftCrop);
  6313.                 // var_dump("//00");
  6314.                 // var_dump("multip 37 widh: ".$widthCropPX." "."multip 37 height : ".$heightCropPX);
  6315.                 // var_dump("multip 37 top: ".$topCropPX." "."multip 37 left : ".$leftCropPX);
  6316.                 //Calculer position des images selon nombres images par page:
  6317.                 $positionX 0;
  6318.                 $positionY 0;
  6319.                 $widthImg 0;
  6320.                 $heightImg 0;
  6321.                 var_dump('nbr_attach ' $nbatach);
  6322.                 if ($nbatach == 1) {
  6323.                     if ($key == 0) {
  6324.                         $positionX 1.5;
  6325.                         $positionY 1.5;
  6326.                         $widthImg 18;
  6327.                         $heightImg 10;
  6328.                     } else {
  6329.                         $positionX 1.5;
  6330.                         $positionY 1.5;
  6331.                         $widthImg 8.7;
  6332.                         $heightImg 12;
  6333.                     }
  6334.                 } elseif (($nbatach == 2) && ($nbatach == '2V')) {
  6335.                     if ($ordre == 1) {
  6336.                         $positionX 1.5;
  6337.                         $positionY 1.5;
  6338.                         $widthImg 4.05;
  6339.                         $heightImg 12;
  6340.                     }
  6341.                     if ($ordre == 2) {
  6342.                         $positionX 6.15;
  6343.                         $positionY 1.5;
  6344.                         $widthImg 4.05;
  6345.                         $heightImg 12;
  6346.                     }
  6347.                 } elseif ($nbatach == '2H') {
  6348.                     if ($ordre == 1) {
  6349.                         $positionX 1.5;
  6350.                         $positionY 1.5;
  6351.                         $widthImg 8.7;
  6352.                         $heightImg 5.7;
  6353.                     }
  6354.                     if ($ordre == 2) {
  6355.                         $positionX 1.5;
  6356.                         $positionY 7.8;
  6357.                         $widthImg 8.7;
  6358.                         $heightImg 5.7;
  6359.                     }
  6360.                 } elseif (($nbatach == 3) && ($nbatach == "3V")) {
  6361.                     if ($ordre == 1) {
  6362.                         $positionX 1.5;
  6363.                         $positionY 1.5;
  6364.                         $widthImg 4.05;
  6365.                         $heightImg 12;
  6366.                     }
  6367.                     if ($ordre == 2) {
  6368.                         $positionX 6.15;
  6369.                         $positionY =  1.5;
  6370.                         $widthImg 4.05;
  6371.                         $heightImg 5.7;
  6372.                     }
  6373.                     if ($ordre == 3) {
  6374.                         $positionX =  6.15;
  6375.                         $positionY 7.8;
  6376.                         $widthImg 4.05;
  6377.                         $heightImg 5.7;
  6378.                     }
  6379.                 } elseif ($nbatach == '3H') {
  6380.                     if ($ordre == 1) {
  6381.                         $positionX 1.5;
  6382.                         $positionY 1.5;
  6383.                         $widthImg 8.7;
  6384.                         $heightImg 5.7;
  6385.                     }
  6386.                     if ($ordre == 2) {
  6387.                         $positionX 1.5;
  6388.                         $positionY 7.8;
  6389.                         $widthImg 4.05;
  6390.                         $heightImg 5.7;
  6391.                     }
  6392.                     if ($ordre == 3) {
  6393.                         $positionX 6.15;
  6394.                         $positionY 7.8;
  6395.                         $widthImg 4.05;
  6396.                         $heightImg 5.7;
  6397.                     }
  6398.                 } elseif ($nbatach == 4) {
  6399.                     if ($ordre == 1) {
  6400.                         $positionX 1.5;
  6401.                         $positionY 1.5;
  6402.                         $widthImg 4.05;
  6403.                         $heightImg 5.7;
  6404.                     }
  6405.                     if ($ordre == 2) {
  6406.                         $positionX 1.5;
  6407.                         $positionY 7.8;
  6408.                         $widthImg 4.05;
  6409.                         $heightImg 5.7;
  6410.                     }
  6411.                     if ($ordre == 3) {
  6412.                         $positionX 6.15;
  6413.                         $positionY =  1.5;
  6414.                         $widthImg 4.05;
  6415.                         $heightImg 5.7;
  6416.                     }
  6417.                     if ($ordre == 4) {
  6418.                         $positionX =  6.15;
  6419.                         $positionY 7.8;
  6420.                         $widthImg 4.05;
  6421.                         $heightImg 5.7;
  6422.                     }
  6423.                 }
  6424.                 //nop
  6425.                 elseif ($nbatach == 5) {
  6426.                     if ($ordre == 1) {
  6427.                         $positionX 1.5;
  6428.                         $positionY 1.5;
  6429.                         $widthImg 18;
  6430.                         $heightImg 8;
  6431.                     }
  6432.                     if ($ordre == 2) {
  6433.                         $positionX 1.5;
  6434.                         $positionY 10.5;
  6435.                         $widthImg 3.75;
  6436.                         $heightImg 3;
  6437.                     }
  6438.                     if ($ordre == 3) {
  6439.                         $positionX 6.25;
  6440.                         $positionY 10.5;
  6441.                         $widthImg 3.75;
  6442.                         $heightImg 3;
  6443.                     }
  6444.                     if ($ordre == 4) {
  6445.                         $positionX 11;
  6446.                         $positionY 10.5;
  6447.                         $widthImg 3.75;
  6448.                         $heightImg 3;
  6449.                     }
  6450.                     if ($ordre == 5) {
  6451.                         $positionX 15.75;
  6452.                         $positionY 10.5;
  6453.                         $widthImg 3.75;
  6454.                         $heightImg 3;
  6455.                     }
  6456.                 } elseif ($nbatach == 6) {
  6457.                     if ($ordre == 1) {
  6458.                         $positionX 1.5;
  6459.                         $positionY 1.5;
  6460.                         $widthImg 4.05;
  6461.                         $heightImg 3.6;
  6462.                     }
  6463.                     if ($ordre == 2) {
  6464.                         $positionX 1.5;
  6465.                         $positionY 5.7;
  6466.                         $widthImg 4.05;
  6467.                         $heightImg 3.6;
  6468.                     }
  6469.                     if ($ordre == 3) {
  6470.                         $positionX 1.5;
  6471.                         $positionY 9.9;
  6472.                         $widthImg 4.05;
  6473.                         $heightImg 3.6;
  6474.                     }
  6475.                     if ($ordre == 4) {
  6476.                         $positionX =  6.15;
  6477.                         $positionY 1.5;
  6478.                         $widthImg 4.05;
  6479.                         $heightImg 3.6;
  6480.                     }
  6481.                     if ($ordre == 5) {
  6482.                         $positionX =  6.15;
  6483.                         $positionY 5.7;
  6484.                         $widthImg 4.05;
  6485.                         $heightImg 3.6;
  6486.                     }
  6487.                     if ($ordre == 6) {
  6488.                         $positionX =  6.15;
  6489.                         $positionY 9.9;
  6490.                         $widthImg 4.05;
  6491.                         $heightImg 3.6;
  6492.                     }
  6493.                 }
  6494.                 //nop
  6495.                 elseif ($nbatach == 12) {
  6496.                     if ($ordre == 1) {
  6497.                         $positionX 1.5;
  6498.                         $positionY 1.5;
  6499.                         $widthImg 3.75;
  6500.                         $heightImg 3.33;
  6501.                     }
  6502.                     if ($ordre == 2) {
  6503.                         $positionX 1.5;
  6504.                         $positionY 5.83;
  6505.                         $widthImg 3.75;
  6506.                         $heightImg 3.33;
  6507.                     }
  6508.                     if ($ordre == 3) {
  6509.                         $positionX 1.5;
  6510.                         $positionY 10.16;
  6511.                         $widthImg 3.75;
  6512.                         $heightImg 3.33;
  6513.                     }
  6514.                     if ($ordre == 4) {
  6515.                         $positionX 6.25;
  6516.                         $positionY 1.5;
  6517.                         $widthImg 3.75;
  6518.                         $heightImg 3.33;
  6519.                     }
  6520.                     if ($ordre == 5) {
  6521.                         $positionX 6.25;
  6522.                         $positionY 5.83;
  6523.                         $widthImg 3.75;
  6524.                         $heightImg 3.33;
  6525.                     }
  6526.                     if ($ordre == 6) {
  6527.                         $positionX 6.25;
  6528.                         $positionY 10.16;
  6529.                         $widthImg 3.75;
  6530.                         $heightImg 3.33;
  6531.                     }
  6532.                     if ($ordre == 7) {
  6533.                         $positionX 11;
  6534.                         $positionY 1.5;
  6535.                         $widthImg 3.75;
  6536.                         $heightImg 3.33;
  6537.                     }
  6538.                     if ($ordre == 8) {
  6539.                         $positionX 11;
  6540.                         $positionY 5.83;
  6541.                         $widthImg 3.75;
  6542.                         $heightImg 3.33;
  6543.                     }
  6544.                     if ($ordre == 9) {
  6545.                         $positionX 11;
  6546.                         $positionY 10.16;
  6547.                         $widthImg 3.75;
  6548.                         $heightImg 3.33;
  6549.                     }
  6550.                     if ($ordre == 10) {
  6551.                         $positionX 15.75;
  6552.                         $positionY 1.5;
  6553.                         $widthImg 3.75;
  6554.                         $heightImg 3.33;
  6555.                     }
  6556.                     if ($ordre == 11) {
  6557.                         $positionX 15.75;
  6558.                         $positionY 5.83;
  6559.                         $widthImg 3.75;
  6560.                         $heightImg 3.33;
  6561.                     }
  6562.                     if ($ordre == 12) {
  6563.                         $positionX 15.75;
  6564.                         $positionY 10.16;
  6565.                         $widthImg 3.75;
  6566.                         $heightImg 3.33;
  6567.                     }
  6568.                 } elseif ($nbatach == 15) {
  6569.                     if ($ordre == 1) {
  6570.                         $positionX 1.5;
  6571.                         $positionY 1.5;
  6572.                         $widthImg 2.5;
  6573.                         $heightImg 1.92;
  6574.                     }
  6575.                     if ($ordre == 2) {
  6576.                         $positionX 1.5;
  6577.                         $positionY 4.2;
  6578.                         $widthImg 2.5;
  6579.                         $heightImg 1.92;
  6580.                     }
  6581.                     if ($ordre == 3) {
  6582.                         $positionX 1.5;
  6583.                         $positionY 6.54;
  6584.                         $widthImg 2.5;
  6585.                         $heightImg 1.92;
  6586.                     }
  6587.                     if ($ordre == 4) {
  6588.                         $positionX 1.5;
  6589.                         $positionY 9.06;
  6590.                         $widthImg 2.5;
  6591.                         $heightImg =  1.92;
  6592.                     }
  6593.                     if ($ordre == 5) {
  6594.                         $positionX 1.5;
  6595.                         $positionY 11.58;
  6596.                         $widthImg 2.5;
  6597.                         $heightImg =  1.92;
  6598.                     }
  6599.                     if ($ordre == 6) {
  6600.                         $positionX 4.6;
  6601.                         $positionY 1.5;
  6602.                         $widthImg 2.5;
  6603.                         $heightImg 1.92;
  6604.                     }
  6605.                     if ($ordre == 7) {
  6606.                         $positionX 4.6;
  6607.                         $positionY 4.2;
  6608.                         $widthImg 2.5;
  6609.                         $heightImg =  1.92;
  6610.                     }
  6611.                     if ($ordre == 8) {
  6612.                         $positionX 4.6;
  6613.                         $positionY 6.54;
  6614.                         $widthImg 2.5;
  6615.                         $heightImg =  1.92;
  6616.                     }
  6617.                     if ($ordre == 9) {
  6618.                         $positionX 4.6;
  6619.                         $positionY 9.06;
  6620.                         $widthImg 2.5;
  6621.                         $heightImg =  1.92;
  6622.                     }
  6623.                     if ($ordre == 10) {
  6624.                         $positionX 4.6;
  6625.                         $positionY 11.58;
  6626.                         $widthImg 2.5;
  6627.                         $heightImg =  1.92;
  6628.                     }
  6629.                     if ($ordre == 11) {
  6630.                         $positionX 7.7;
  6631.                         $positionY 1.5;
  6632.                         $widthImg 2.5;
  6633.                         $heightImg =  1.92;
  6634.                     }
  6635.                     if ($ordre == 12) {
  6636.                         $positionX 7.7;
  6637.                         $positionY 4.2;
  6638.                         $widthImg 2.5;
  6639.                         $heightImg 1.92;
  6640.                     }
  6641.                     if ($ordre == 13) {
  6642.                         $positionX 7.7;
  6643.                         $positionY 6.54;
  6644.                         $widthImg 2.5;
  6645.                         $heightImg =  1.92;
  6646.                     }
  6647.                     if ($ordre == 14) {
  6648.                         $positionX 7.7;
  6649.                         $positionY 9.06;
  6650.                         $widthImg 2.5;
  6651.                         $heightImg =  1.92;
  6652.                     }
  6653.                     if ($ordre == 15) {
  6654.                         $positionX 7.7;
  6655.                         $positionY 11.58;
  6656.                         $widthImg 2.5;
  6657.                         $heightImg =  1.92;
  6658.                     }
  6659.                 }
  6660.                 if (($i == sizeof($tabphoto) - 1) && ($key != 0)) {
  6661.                     $path 'https://demo.appsfactor.fr/' $path;
  6662.                     $positionX 10.8;
  6663.                     $positionY 1.5;
  6664.                     $widthImg 8.7;
  6665.                     $heightImg 12;
  6666.                     $pdf->Image($path$positionX$positionY$widthImg$heightImg'JPG'''''false1000''falsefalse0falsefalsefalse);
  6667.                 } else {
  6668.                     //Recarder l'image :
  6669.                     // $path=str_replace( 'upload/', 'upload/ar_1.1'.',c_crop/q_auto:good/',$path);<
  6670.                     //                $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);
  6671.                     $pathArray explode("/"$path);
  6672.                     $idsArray explode("."$pathArray[sizeof($pathArray) - 1]);
  6673.                     $idImage "";
  6674.                     foreach ($idsArray as $key2 => $elem) {
  6675.                         if ($key2 != (sizeof($idsArray) - 1)) {
  6676.                             $idImage $idImage $elem;
  6677.                         }
  6678.                     }
  6679.                     //   $cloudinaryWidht=$widthOriginal;
  6680.                     // $cloudinaryHeight=$widthOriginal;
  6681.                     $idImage 'newprod/' $idImage;
  6682.                     //var_dump($idImage);
  6683.                     Unirest\Request::auth('263346742199243''jYw-jg0FOJGv89-o5Wo0Fa3rQWU');
  6684.                     $headers = array('Accept' => 'application/json');
  6685.                     $data = array("public_ids" => array($idImage));
  6686.                     $body Unirest\Request\Body::form($data);
  6687.                     Unirest\Request::verifyPeer(false);
  6688.                     $url 'https://api.cloudinary.com/v1_1/apss-factory/resources/image/upload/' $idImage;
  6689.                     // $resultMetadata=  \Cloudinary::Api.resources_by_ids([$idImage]);
  6690.                     //  var_dump($url);
  6691.                     $resultMetadata Unirest\Request::post($url$headers$body);
  6692.                     var_dump($resultMetadata);
  6693.                     if (isset(json_decode($resultMetadata->raw_body)->width)) {
  6694.                         $cloudinaryWidht json_decode($resultMetadata->raw_body)->width;
  6695.                         $cloudinaryHeight json_decode($resultMetadata->raw_body)->height;
  6696.                     } else {
  6697.                         $cloudinaryWidht $widthOriginal;
  6698.                         $cloudinaryHeight $heightOriginal;
  6699.                     }
  6700.                     $ratiohight $cloudinaryWidht $widthOriginal;
  6701.                     $ratioHight $cloudinaryHeight $heightOriginal;
  6702.                     //$cloudinaryHeight=$cloudinaryHeight*$zoom;
  6703.                     //$cloudinaryWidht=$cloudinaryWidht*$zoom;
  6704.                     var_dump($cloudinaryWidht);
  6705.                     var_dump($cloudinaryHeight);
  6706.                     var_dump($ratioHight);
  6707.                     var_dump($zoom);
  6708.                     $zoom 1;
  6709.                     var_dump($leftOriginal);
  6710.                     var_dump('x_' round(abs($leftOriginal $zoom) * $ratioHight));
  6711.                     var_dump('y_' round(abs($topOriginal $zoom) * $ratiohight));
  6712.                     var_dump('w_' round(($widthCropPX $zoom) * $ratioHight));
  6713.                     var_dump('h_' round(($heightCropPX $zoom) * $ratiohight));
  6714.                     //var_dump($path);i
  6715.                     $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);
  6716.                     //var_dump($path);i
  6717.                     //                $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);
  6718.                     //var_dump($path);
  6719.                     $path str_replace("l_Logo5Sur5White_nh6tyk,o_10,fl_relative.tiled,"''$path);
  6720.                     //  var_dump("//00");
  6721.                     //  var_dump("avant 1.4 widh: ".round($widthCropPX)." "."avant 1.4 height : ".round($heightCropPX));
  6722.                     //  var_dump("avant 1.4 top: ".round(abs($top*37.7952755906))." avant 1.4 final left : ".round(abs($left*37.7952755906)));
  6723.                     //    var_dump("//00");
  6724.                     //   var_dump("final widh: ".round($widthCropPX*1.4)." "."final height : ".round($heightCropPX*1.4));
  6725.                     //  var_dump("final top: ".round(abs($top*37.7952755906*1.4))." "."final left : ".round(abs($left*37.7952755906*1.4)));
  6726.                     var_dump($zoom);
  6727.                     var_dump($path);
  6728.                     // $path="https://res.cloudinary.com/apss-factory/image/upload/w_691,h_356,c_crop/a_exif/v1587482806/newprod/crepes-au-chocolat_re9wvk.jpg";
  6729.                     $pdf->Image($path$positionX$positionY$widthImg$heightImg'JPG'''''false1000''falsefalse0falsefalsefalse);
  6730.                     //                $pdf->Rect($positionX,$positionY ,$widthImg, $heightImg, 'F', array(), array(264,200,67));
  6731.                     //
  6732.                 }
  6733.             }
  6734.             //    $pdf->Image('https://demo.appsfactor.fr/images/ClipArt_SVG/Etoilerose.svg',3,  2, 19, 13, 'SVG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
  6735.             for ($i 0$i sizeof($tabtxt); $i++) {
  6736.                 $txt json_decode($tabtxt[$i]);
  6737.                 $fontSize floatval(str_replace('px'''$txt->fontSize)) * 0.75;
  6738.                 //$txt->rotation
  6739.                 $check explode(','$txt->fontFamily);
  6740.                 if (sizeof($check) > 1) {
  6741.                     //default
  6742.                     if (($check[0] == "-apple-system") && ($txt->fontWeight == 400)) {
  6743.                         $finalFont "helvetica";
  6744.                         $weight '';
  6745.                     }
  6746.                     //classique
  6747.                     if (($check[0] == "Georgia") && ($txt->fontWeight == 400)) {
  6748.                         $finalFont "times";
  6749.                         $weight '';
  6750.                     }
  6751.                     //creative
  6752.                     if (($check[0] == "-apple-system") && ($txt->fontWeight == 700)) {
  6753.                         $finalFont "helveticaB";
  6754.                         $weight '';
  6755.                     }
  6756.                     // manuscrite
  6757.                     if (($check[0] == "Comic Sans") && ($txt->fontWeight == 400)) {
  6758.                         $finalFont "Courier";
  6759.                         $weight '';
  6760.                     }
  6761.                     //c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.woff2
  6762.                 } else {
  6763.                     //baton
  6764.                     if (($txt->fontFamily == 'Impact') && ($txt->fontWeight == 400)) {
  6765.                         $finalFont "helveticaB";
  6766.                         $weight 'B';
  6767.                     }
  6768.                 }
  6769.                 $pdf->SetFont($finalFont$weight$fontSize);
  6770.                 $leftTxt $txt->left;
  6771.                 $topTxt $txt->top;
  6772.                 $heightClips $txt->height;
  6773.                 $widthClips $txt->width;
  6774.                 $heightTxt floatval(str_replace('cm'''$heightClips));
  6775.                 $topTxt floatval(str_replace('cm'''$topTxt));
  6776.                 $leftTxt floatval(str_replace('cm'''$leftTxt));
  6777.                 $widthTxt floatval(str_replace('cm'''$widthClips));
  6778.                 if ($key == 0) {
  6779.                     $heightTxt 2;
  6780.                     $widthTxt 7;
  6781.                     $leftTxt = (21) - ($widthTxt 2);
  6782.                     $topTxt 11.8;
  6783.                     $pdf->SetXY(0$topTxttrue);
  6784.                     $pdf->Cell(210trim($txt->contenu), 00'C'0''0);
  6785.                 } else {
  6786.                     $heightTxt 2;
  6787.                     $widthTxt 7;
  6788.                     $leftTxt = (21) - ($widthTxt 2);
  6789.                     $topTxt 11.8;
  6790.                     $pdf->SetXY(13.612.4true);
  6791.                     $pdf->Cell(60trim($txt->contenu), 00'L'0''0);
  6792.                 }
  6793.                 //                    var_dump($leftTxt);
  6794.                 //                  var_dump($topTxt);
  6795.                 // var_dump(floatval(str_replace('rad','',$txt->rotation))*57,2958);
  6796.                 //                var_dump("text");
  6797.                 //$pdf->StartTransform();
  6798.                 //$txt->rotation=0;
  6799.                 //var_dump($txt->rotation);
  6800.                 //var_dump(str_replace('rad','',$txt->rotation));
  6801.                 //var_dump(floatval(str_replace('rad','',$txt->rotation))*57.2958);
  6802.                 // $pdf->Rotate((floatval(str_replace('rad','',$txt->rotation))*57.2958)*-1,$leftTxt+($widthTxt/2),$topTxt+($heightTxt/2));
  6803.                 // $pdf->Rotate(45);
  6804.                 //   $pdf->Text($leftTxt, $topTxt, $txt->contenu);
  6805.                 //$pdf->SetTextColor(200);
  6806.                 //$pdf->Text($leftTxt, $topTxt, $txt->contenu);
  6807.                 // $pdf->MultiCell($leftTxt, $topTxt,  $txt->contenu, 0, $ln=0, 'C', 0, '', 0, false, 'C', 'C');
  6808.                 //                $pdf->Write(str_replace('cm','',$txt->height),trim($txt->contenu));
  6809.                 // $pdf->writeHTML("<p>".$txt->contenu."</p>", true, false, false, false, '');
  6810.                 //$pdf->StopTransform();
  6811.             }
  6812.             //Positionner text
  6813.             //            $pdf->ImageSVG("C:\\Users\\AppsFactor12\\Desktop\\5sur5\\5sur5Sejour\\public\\images\\ClipArt_SVG\\Etoilerose.svg",100,200,500, 500, '', '', '', 0, false);
  6814.             //Positionner clipart
  6815.             //            dd($tabClips);
  6816.             for ($i 0$i sizeof($tabClips); $i++) {
  6817.                 $Clips json_decode($tabClips[$i]);
  6818.                 $heightClips $Clips->height;
  6819.                 $topClips $Clips->top;
  6820.                 $leftClips $Clips->left;
  6821.                 $widthClips $Clips->width;
  6822.                 $path $Clips->path;
  6823.                 $pathClips str_replace('"'''$path);
  6824.                 $heightClips floatval(str_replace('cm'''$heightClips));
  6825.                 $topClips floatval(str_replace('cm'''$topClips));
  6826.                 $leftClips floatval(str_replace('cm'''$leftClips));
  6827.                 $widthClips floatval(str_replace('cm'''$widthClips));
  6828.                 $heightClipsPX round($heightClips 37.7952755906);
  6829.                 $widthClipsPX round($widthClips 37.7952755906);
  6830.                 ////                $positionXclips = $positionX + $leftClips;
  6831.                 ////                $positionYclips = $positionY + $topClips;
  6832.                 //
  6833.                 //$pdf->ImageSVG("images/ClipArt_SVG/Ete4.svg",$leftClips,$topClips,$widthClips, $heightClips);
  6834.                 //https://res.cloudinary.com/apss-factory/image/private/s--EdExAzx8--/v1588758453/GlobeFooter_c4duua.svg
  6835.                 // https://res.cloudinary.com/apss-factory/image/upload/v1588764528/Groupe_113_pcjyj4.png
  6836.                 var_dump($pathClips);
  6837.                 $pdf->StartTransform();
  6838.                 $pdf->Rotate((floatval(str_replace('rad'''$Clips->rotation)) * 57.2958) * -1$leftClips + ($widthClips 2), $topClips + ($heightClips 2));
  6839.                 $pdf->Image($this->newPAthCLipart($pathClips$heightClipsPX$widthClipsPX), $leftClips,  $topClips$widthClips$heightClips''''''false300);
  6840.                 $pdf->StopTransform();
  6841.             }
  6842.         }
  6843.         // echo '</pre>';
  6844.         //return new response("yezi");
  6845.         $projectRoot $this->getParameter('kernel.project_dir');
  6846.         $pdf->Output($projectRoot '/public/pdfDocs/example_' $idPrdt '.pdf''F');
  6847.         return new response("yezi");
  6848.         //return $pdf->Output('example_009.pdf', 'I');
  6849.     }
  6850.     function newPAthCLipart($url$heigh$width)
  6851.     {
  6852.         $allImage = [
  6853.             'Eclaire.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143379/newprod/clipart/Eclaire_pr0ecu.png',
  6854.             'ARcenciel.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143391/newprod/clipart/ARcenciel_grkyap.png',
  6855.             'Drapeaux.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143377/newprod/clipart/Drapeaux_zqo8v3.png',
  6856.             'Annif.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143391/newprod/clipart/Annif_ihvyoo.png',
  6857.             'Basquettes.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143377/newprod/clipart/Basquettes_znjd41.png',
  6858.             'Foot.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143382/newprod/clipart/Foot_az6bct.png',
  6859.             'Hello.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143383/newprod/clipart/Hello_njqifl.png',
  6860.             'Love.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143386/newprod/clipart/Love_q39usk.png',
  6861.             'LICORNE.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143385/newprod/clipart/LICORNE_hpomru.png',
  6862.             'Noeud.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143388/newprod/clipart/Noeud_mw5a4j.png',
  6863.             'Etoilerose.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143380/newprod/clipart/Etoilerose_ewrzff.png',
  6864.             'Ete4.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143379/newprod/clipart/Ete4_pdxadk.png',
  6865.             'Ete6.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143380/newprod/clipart/Ete6_a3xgpd.png',
  6866.             'Ete9.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143380/newprod/clipart/Ete9_s4vllm.png',
  6867.             'Hiver1.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143384/newprod/clipart/Hiver1_fekrjz.png',
  6868.             'Hiver2.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143384/newprod/clipart/Hiver2_e9iygg.png',
  6869.             'Noel2.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143387/newprod/clipart/Noel2_eqvdzr.png',
  6870.             'Hiver.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143383/newprod/clipart/Hiver_et04e1.png',
  6871.             'Sapin.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143390/newprod/clipart/Sapin_qjkxz6.png',
  6872.             'Chaussetet.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143377/newprod/clipart/Chaussetet_xfpt6t.png',
  6873.             'Cloches.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143377/newprod/clipart/Cloches_x2v3eo.png',
  6874.             'Like.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143387/newprod/clipart/Like_ynxb2u.png',
  6875.             'coeurlike.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143379/newprod/clipart/coeurlike_ferv9y.png',
  6876.             'Fetedesmeres.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/w_' $width '/upload/v1589143383/newprod/clipart/Fetedesmeres_ud9vac.png',
  6877.             'Fetedesperes.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/w_' $width '/upload/v1589143384/newprod/clipart/Fetedesperes_mltjmo.png',
  6878.             'OOPS.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143389/newprod/clipart/OOPS_gj9p1c.png',
  6879.             'OOPS_1.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143389/newprod/clipart/OOPS_1_r9a7l6.png',
  6880.             'WoW.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143393/newprod/clipart/WoW_ljlqjm.png',
  6881.             'Nuage.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143387/newprod/clipart/Nuage_fgomd0.png',
  6882.             'Pingouin.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143389/newprod/clipart/Pingouin_ogxb6e.png',
  6883.             'Renard.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143378/newprod/clipart/Chouette_mc1ik2.png',
  6884.             'Chouette.svg' => 'https://res.cloudinary.com/af5sur5sejour/image/upload/w_' $width '/v1589143390/newprod/clipart/Renard_mlhrxt.png'
  6885.         ];
  6886.         //http://127.0.0.1:8000/images/ClipArt_SVG/LICORNE.svg
  6887.         $arryUrls explode('/'$url);
  6888.         return ($allImage[$arryUrls[sizeof($arryUrls) - 1]]);
  6889.     }
  6890.     /**
  6891.      * @Route("/Parent/TcPdfCalcul/{idPrdt}", name="TcPdfCalc")
  6892.      */
  6893.     public function TcPdfCalcule($idPrdt)
  6894.     {
  6895.         echo '<pre>';
  6896.         ini_set("max_execution_time", -1);
  6897.         $pageLayout = array(2115);
  6898.         $pdf $this->get("white_october.tcpdf")->create('L''CM'$pageLayouttrue'UTF-8'false);
  6899.         // set document information
  6900.         $pdf->SetCreator(PDF_CREATOR);
  6901.         $pdf->SetAuthor('Nicola Asuni');
  6902.         $pdf->SetTitle('TCPDF Example 009');
  6903.         $pdf->SetSubject('TCPDF Tutorial');
  6904.         $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
  6905.         $pdf->SetSubject('TCPDF Tutorial');
  6906.         $pdf->setPrintHeader(false);
  6907.         $pdf->setPrintFooter(false);
  6908.         // set image scale factor
  6909.         $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
  6910.         //        $pdf->AddPage();
  6911.         $pdf->setJPEGQuality(100);
  6912.         $horizontal_alignments = array('L''C''R');
  6913.         $vertical_alignments = array('T''M''B');
  6914.         //var_dump($pdf->getPageWidth());
  6915.         //var_dump($pdf->getPageHeight());die();
  6916.         $em $this->em;
  6917.         $Album $em->getRepository(Produit::class)->findOneBy(['id' => $idPrdt]);
  6918.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Album]);
  6919.         //dd($AllPages);
  6920.         //        $fP=[];
  6921.         //        array_push($fP,$AllPages[0]);
  6922.         //dd($AllPages);
  6923.         foreach ($AllPages as $p) {
  6924.             $pdf->AddPage();
  6925.             $pdf->setJPEGQuality(100);
  6926.             $contenu json_decode(json_decode($p->getCouleurbordure())[0]);
  6927.             $nbatach $contenu->nbrAttc;
  6928.             $nbatach intval(str_replace('"'''$nbatach));
  6929.             $color =  $contenu->color;
  6930.             // $color="rgb(255,255,255)";
  6931.             $color str_replace('"rgb('''$color);
  6932.             $color str_replace(')"'''$color);
  6933.             $color explode(","$color);
  6934.             $colorp = array(intval($color[0]), intval($color[1]), intval($color[2]));
  6935.             $tabtxt json_decode($contenu->txt);
  6936.             $tabphoto json_decode($contenu->attache);
  6937.             //
  6938.             //dd($tabtxt);
  6939.             //         dd($tabtxt);
  6940.             //dd($tabphoto);
  6941.             $tabClips json_decode($contenu->clips);
  6942.             // dd($tabClips);
  6943.             $x 0.6;
  6944.             $y 0.8;
  6945.             $w 19.8;
  6946.             $h 13.4;
  6947.             // get the current page break margin
  6948.             $bMargin $pdf->getBreakMargin();
  6949.             // get current auto-page-break mode
  6950.             $auto_page_break $pdf->getAutoPageBreak();
  6951.             // disable auto-page-break
  6952.             $pdf->SetAutoPageBreak(false0);
  6953.             // test all combinations of alignments
  6954.             $fitbox $horizontal_alignments[1] . ' ';
  6955.             $fitbox[1] = $vertical_alignments[1];
  6956.             $pdf->Rect(002115'F', array(), $colorp);
  6957.             //    sizeof($tabphoto)
  6958.             for ($i 0$i sizeof($tabphoto); $i++) {
  6959.                 $photo json_decode($tabphoto[$i]);
  6960.                 //les coordonnées de l'image réel:
  6961.                 $hght $photo->height;
  6962.                 $top $photo->top;
  6963.                 $left $photo->left;
  6964.                 $width $photo->width;
  6965.                 $ordre $photo->ordre;
  6966.                 $zoom $photo->zoom;
  6967.                 $path $photo->path;
  6968.                 $hght floatval(str_replace('cm'''$hght));
  6969.                 $top floatval(str_replace('cm'''$top));
  6970.                 $left floatval(str_replace('cm'''$left));
  6971.                 $width floatval(str_replace('cm'''$width));
  6972.                 //les coordonnées dropzone:
  6973.                 $heightOriginal $photo->height;
  6974.                 $widthOriginal $photo->width;
  6975.                 $top $photo->top;
  6976.                 $left $photo->left;
  6977.                 $heightOriginal floatval(str_replace('cm'''$heightOriginal));
  6978.                 $widthOriginal floatval(str_replace('cm'''$widthOriginal));
  6979.                 $top floatval(str_replace('cm'''$top));
  6980.                 $left floatval(str_replace('cm'''$left));
  6981.                 $heightOriginal $heightOriginal 37.7952755906;
  6982.                 $widthOriginal $widthOriginal 37.7952755906;
  6983.                 $topOriginal $top 37.7952755906;
  6984.                 $leftOriginal $left 37.7952755906;
  6985.                 $heightCrop $photo->heightCrop;
  6986.                 $topCrop $photo->topCrop;
  6987.                 $leftCrop $photo->leftCrop;
  6988.                 $widthCrop $photo->widthCrop;
  6989.                 $path $photo->path;
  6990.                 $heightCrop floatval(str_replace('cm'''$heightCrop));
  6991.                 $topCrop floatval(str_replace('cm'''$topCrop));
  6992.                 $leftCrop floatval(str_replace('cm'''$leftCrop));
  6993.                 $widthCrop floatval(str_replace('cm'''$widthCrop));
  6994.                 $widthCropPX $widthCrop 37.7952755906;
  6995.                 $heightCropPX $heightCrop 37.7952755906;
  6996.                 $topCropPX $topCrop 37.7952755906;
  6997.                 $leftCropPX $leftCrop 37.7952755906;
  6998.                 var_dump("original widh: " $widthCrop " " "original height : " $heightCrop);
  6999.                 var_dump("original left: " $topCrop " " "original top : " $leftCrop);
  7000.                 var_dump("//00");
  7001.                 var_dump("multip 37 widh: " $widthCropPX " " "multip 37 height : " $heightCropPX);
  7002.                 var_dump("multip 37 top: " $topOriginal " " "multip 37 left : " $leftOriginal);
  7003.                 //Calculer position des images selon nombres images par page:
  7004.                 $positionX 0;
  7005.                 $positionY 0;
  7006.                 $widthImg 0;
  7007.                 $heightImg 0;
  7008.                 if ($nbatach == 1) {
  7009.                     $positionX 1.5;
  7010.                     $positionY 1.5;
  7011.                     $widthImg 18;
  7012.                     $heightImg 12;
  7013.                 } elseif ($nbatach == 2) {
  7014.                     if ($ordre == 1) {
  7015.                         $positionX 1.5;
  7016.                         $positionY 1.5;
  7017.                         $widthImg 8.5;
  7018.                         $heightImg 12;
  7019.                     }
  7020.                     if ($ordre == 2) {
  7021.                         $positionX 11;
  7022.                         $positionY 1.5;
  7023.                         $widthImg 8.5;
  7024.                         $heightImg 12;
  7025.                     }
  7026.                 } elseif ($nbatach == 3) {
  7027.                     if ($ordre == 1) {
  7028.                         $positionX 1.5;
  7029.                         $positionY 1.5;
  7030.                         $widthImg 8.5;
  7031.                         $heightImg 12;
  7032.                     }
  7033.                     if ($ordre == 2) {
  7034.                         $positionX 11;
  7035.                         $positionY 1.5;
  7036.                         $widthImg 8.5;
  7037.                         $heightImg 5.5;
  7038.                     }
  7039.                     if ($ordre == 3) {
  7040.                         $positionX 11;
  7041.                         $positionY 8;
  7042.                         $widthImg 8.5;
  7043.                         $heightImg 5.5;
  7044.                     }
  7045.                 } elseif ($nbatach == 4) {
  7046.                     if ($ordre == 1) {
  7047.                         $positionX 1.5;
  7048.                         $positionY 1.5;
  7049.                         $widthImg 8.5;
  7050.                         $heightImg 5.5;
  7051.                     }
  7052.                     if ($ordre == 2) {
  7053.                         $positionX 1.5;
  7054.                         $positionY 8;
  7055.                         $widthImg 8.5;
  7056.                         $heightImg 5.5;
  7057.                     }
  7058.                     if ($ordre == 3) {
  7059.                         $positionX 11;
  7060.                         $positionY 1.5;
  7061.                         $widthImg 8.5;
  7062.                         $heightImg 5.5;
  7063.                     }
  7064.                     if ($ordre == 4) {
  7065.                         $positionX 11;
  7066.                         $positionY 8;
  7067.                         $widthImg 8.5;
  7068.                         $heightImg 5.5;
  7069.                     }
  7070.                 } elseif ($nbatach == 5) {
  7071.                     if ($ordre == 1) {
  7072.                         $positionX 1.5;
  7073.                         $positionY 1.5;
  7074.                         $widthImg 18;
  7075.                         $heightImg 8;
  7076.                     }
  7077.                     if ($ordre == 2) {
  7078.                         $positionX 1.5;
  7079.                         $positionY 10.5;
  7080.                         $widthImg 3.75;
  7081.                         $heightImg 4;
  7082.                     }
  7083.                     if ($ordre == 3) {
  7084.                         $positionX 6.25;
  7085.                         $positionY 10.5;
  7086.                         $widthImg 3.75;
  7087.                         $heightImg 4;
  7088.                     }
  7089.                     if ($ordre == 4) {
  7090.                         $positionX 11;
  7091.                         $positionY 10.5;
  7092.                         $widthImg 3.75;
  7093.                         $heightImg 4;
  7094.                     }
  7095.                     if ($ordre == 5) {
  7096.                         $positionX 15.75;
  7097.                         $positionY 10.5;
  7098.                         $widthImg 3.75;
  7099.                         $heightImg 4;
  7100.                     }
  7101.                 } elseif ($nbatach == 6) {
  7102.                     if ($ordre == 1) {
  7103.                         $positionX 1.5;
  7104.                         $positionY 1.5;
  7105.                         $widthImg 5.33;
  7106.                         $heightImg 3.33;
  7107.                     }
  7108.                     if ($ordre == 2) {
  7109.                         $positionX 1.5;
  7110.                         $positionY 5.83;
  7111.                         $widthImg == 5.33;
  7112.                         $heightImg 3.33;
  7113.                     }
  7114.                     if ($ordre == 3) {
  7115.                         $positionX 1.5;
  7116.                         $positionY 10.16;
  7117.                         $widthImg 5.33;
  7118.                         $heightImg 3.33;
  7119.                     }
  7120.                     if ($ordre == 4) {
  7121.                         $positionX 7.83;
  7122.                         $positionY 1.5;
  7123.                         $widthImg == 5.33;
  7124.                         $heightImg 3.33;
  7125.                     }
  7126.                     if ($ordre == 5) {
  7127.                         $positionX 7.83;
  7128.                         $positionY 5.83;
  7129.                         $widthImg == 5.33;
  7130.                         $heightImg 3.33;
  7131.                     }
  7132.                     if ($ordre == 6) {
  7133.                         $positionX 7.83;
  7134.                         $positionY 10.16;
  7135.                         $widthImg == 5.33;
  7136.                         $heightImg 3.33;
  7137.                     }
  7138.                 } elseif ($nbatach == 12) {
  7139.                     if ($ordre == 1) {
  7140.                         $positionX 1.5;
  7141.                         $positionY 1.5;
  7142.                         $widthImg 3.75;
  7143.                         $heightImg 3.33;
  7144.                     }
  7145.                     if ($ordre == 2) {
  7146.                         $positionX 1.5;
  7147.                         $positionY 5.83;
  7148.                         $widthImg 3.75;
  7149.                         $heightImg 3.33;
  7150.                     }
  7151.                     if ($ordre == 3) {
  7152.                         $positionX 1.5;
  7153.                         $positionY 10.16;
  7154.                         $widthImg 3.75;
  7155.                         $heightImg 3.33;
  7156.                     }
  7157.                     if ($ordre == 4) {
  7158.                         $positionX 6.25;
  7159.                         $positionY 1.5;
  7160.                         $widthImg 3.75;
  7161.                         $heightImg 3.33;
  7162.                     }
  7163.                     if ($ordre == 5) {
  7164.                         $positionX 6.25;
  7165.                         $positionY 5.83;
  7166.                         $widthImg 3.75;
  7167.                         $heightImg 3.33;
  7168.                     }
  7169.                     if ($ordre == 6) {
  7170.                         $positionX 6.25;
  7171.                         $positionY 10.16;
  7172.                         $widthImg 3.75;
  7173.                         $heightImg 3.33;
  7174.                     }
  7175.                     if ($ordre == 7) {
  7176.                         $positionX 11;
  7177.                         $positionY 1.5;
  7178.                         $widthImg 3.75;
  7179.                         $heightImg 3.33;
  7180.                     }
  7181.                     if ($ordre == 8) {
  7182.                         $positionX 11;
  7183.                         $positionY 5.83;
  7184.                         $widthImg 3.75;
  7185.                         $heightImg 3.33;
  7186.                     }
  7187.                     if ($ordre == 9) {
  7188.                         $positionX 11;
  7189.                         $positionY 10.16;
  7190.                         $widthImg 3.75;
  7191.                         $heightImg 3.33;
  7192.                     }
  7193.                     if ($ordre == 10) {
  7194.                         $positionX 15.75;
  7195.                         $positionY 1.5;
  7196.                         $widthImg 3.75;
  7197.                         $heightImg 3.33;
  7198.                     }
  7199.                     if ($ordre == 11) {
  7200.                         $positionX 15.75;
  7201.                         $positionY 5.83;
  7202.                         $widthImg 3.75;
  7203.                         $heightImg 3.33;
  7204.                     }
  7205.                     if ($ordre == 12) {
  7206.                         $positionX 15.75;
  7207.                         $positionY 10.16;
  7208.                         $widthImg 3.75;
  7209.                         $heightImg 3.33;
  7210.                     }
  7211.                 }
  7212.                 //Recarder l'image :
  7213.                 // $path=str_replace( 'upload/', 'upload/ar_1.1'.',c_crop/q_auto:good/',$path);<
  7214.                 //                $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);
  7215.                 $path str_replace("l_Logo5Sur5White_nh6tyk,o_10,fl_relative.tiled,"''$path);
  7216.                 //var_dump($api);
  7217.                 $pathArray explode("/"$path);
  7218.                 $idsArray explode("."$pathArray[sizeof($pathArray) - 1]);
  7219.                 $idImage "";
  7220.                 foreach ($idsArray as $key2 => $elem) {
  7221.                     if ($key2 != (sizeof($idsArray) - 1)) {
  7222.                         $idImage $idImage $elem;
  7223.                     }
  7224.                 }
  7225.                 $idImage 'newprod/' $idImage;
  7226.                 var_dump($idImage);
  7227.                 Unirest\Request::auth('263346742199243''jYw-jg0FOJGv89-o5Wo0Fa3rQWU');
  7228.                 $headers = array('Accept' => 'application/json');
  7229.                 $data = array("public_ids" => array($idImage));
  7230.                 $body Unirest\Request\Body::form($data);
  7231.                 Unirest\Request::verifyPeer(false);
  7232.                 $url 'https://api.cloudinary.com/v1_1/apss-factory/resources/image/upload/' $idImage;
  7233.                 // $resultMetadata=  \Cloudinary::Api.resources_by_ids([$idImage]);
  7234.                 var_dump($url);
  7235.                 $resultMetadata Unirest\Request::post($url$headers$body);
  7236.                 var_dump($resultMetadata->raw_body);
  7237.                 if (isset(json_decode($resultMetadata->raw_body)->width)) {
  7238.                     $cloudinaryWidht json_decode($resultMetadata->raw_body)->width;
  7239.                     $cloudinaryHeight json_decode($resultMetadata->raw_body)->height;
  7240.                 } else {
  7241.                     $cloudinaryWidht $widthOriginal;
  7242.                     $cloudinaryHeight $heightOriginal;
  7243.                 }
  7244.                 $ratiohight $cloudinaryWidht $widthOriginal;
  7245.                 $ratioHight $cloudinaryHeight $heightOriginal;
  7246.                 $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);
  7247.                 //var_dump($path);i
  7248.                 var_dump("//00");
  7249.                 var_dump("avant 1.4 widh: " round($widthCropPX) . " " "avant 1.4 height : " round($heightCropPX));
  7250.                 var_dump("avant 1.4 top: " round(abs($top 37.7952755906)) . " avant 1.4 final left : " round(abs($left 37.7952755906)));
  7251.                 var_dump("//00");
  7252.                 var_dump("final widh: " round($widthCropPX 1.4) . " " "final height : " round($heightCropPX 1.4));
  7253.                 var_dump("final top: " round(abs($top 37.7952755906 1.4)) . " " "final left : " round(abs($left 37.7952755906 1.4)));
  7254.                 var_dump("//00");
  7255.                 var_dump($path);
  7256.                 // $path="https://res.cloudinary.com/apss-factory/image/upload/w_691,h_356,c_crop/a_exif/v1587482806/newprod/crepes-au-chocolat_re9wvk.jpg";
  7257.                 $pdf->Image($path$positionX$positionY$widthImg$heightImg'JPG'''''false300''falsefalse0$fitboxfalsefalse);
  7258.                 //                $pdf->Rect($positionX,$positionY ,$widthImg, $heightImg, 'F', array(), array(264,200,67));
  7259.                 //
  7260.                 $pdf->SetY(-6);
  7261.                 // Set font
  7262.                 $pdf->SetFont('helvetica''I'8);
  7263.                 // Page number
  7264.                 $pdf->Cell(010'Page ' $pdf->getAliasNumPage() . '/' $pdf->getAliasNbPages(), 0false'C'0''0false'T''M');
  7265.                 $pdf->SetFont('helvetica''B'8);
  7266.                 $pdf->SetXY(11);
  7267.             }
  7268.             //    $pdf->Image('https://demo.appsfactor.fr/images/ClipArt_SVG/Etoilerose.svg',3,  2, 19, 13, 'SVG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
  7269.             for ($i 0$i sizeof($tabtxt); $i++) {
  7270.                 $txt json_decode($tabtxt[$i]);
  7271.                 $pdf->SetFont('helvetica''B'$txt->fontSize);
  7272.                 $leftTxt $txt->left;
  7273.                 $topTxt $txt->top;
  7274.                 //                $heightClips = floatval(str_replace('cm', '', $heightClips));
  7275.                 $topTxt floatval(str_replace('cm'''$topTxt));
  7276.                 $leftTxt floatval(str_replace('cm'''$leftTxt));
  7277.                 //                $widthClips = floatval(str_replace('cm', '', $widthClips));
  7278.                 $pdf->SetXY($leftTxt 1.2$topTxt 1);
  7279.                 $pdf->Write(0$txt->contenu''0'L'true0falsefalse0);
  7280.             }
  7281.             //Positionner text
  7282.             //            $pdf->ImageSVG("C:\\Users\\AppsFactor12\\Desktop\\5sur5\\5sur5Sejour\\public\\images\\ClipArt_SVG\\Etoilerose.svg",100,200,500, 500, '', '', '', 0, false);
  7283.             //Positionner clipart
  7284.             //            dd($tabClips);
  7285.             //            for($i=0;$i <sizeof($tabClips);$i++) {
  7286.             //                $Clips = json_decode($tabClips[$i]);
  7287.             //                $heightClips = $Clips->height;
  7288.             //                $topClips = $Clips->top;
  7289.             //                $leftClips = $Clips->left;
  7290.             //                $widthClips = $Clips->width;
  7291.             //                $path = $Clips->path;
  7292.             //                $pathClips = str_replace('http://127.0.0.1:8000/', 'https://demo.appsfactor.fr/', $path);
  7293.             //
  7294.             //                $heightClips = floatval(str_replace('cm', '', $heightClips));
  7295.             //                $topClips = floatval(str_replace('cm', '', $topClips));
  7296.             //                $leftClips = floatval(str_replace('cm', '', $leftClips));
  7297.             //                $widthClips = floatval(str_replace('cm', '', $widthClips));
  7298.             //
  7299.             ////                $positionXclips = $positionX + $leftClips;
  7300.             ////                $positionYclips = $positionY + $topClips;
  7301.             //
  7302.             //              $pdf->ImageSVG("images/ClipArt_SVG/Etoilerose.svg",100,200,500, 500, '', '', '', 0, false);
  7303.             //
  7304.             ////                $pdf->Image($path,$leftClips,  $topClips, $widthClips, $heightClips, 'SVG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
  7305.             //
  7306.             //            }
  7307.         }
  7308.         echo '</pre>';
  7309.         return new response("yezi");
  7310.         //  return $pdf->Output('example_009.pdf', 'I');
  7311.     }
  7312.     /**
  7313.      * @Route("/Parent/suprimerproduitAcompa", name="suprimerproduitAcompa_parent")
  7314.      */
  7315.     public function suprimerproduitAcompa(Request $request)
  7316.     {
  7317.         $em $this->em;
  7318.         $user $this->getUser();
  7319.         $p $request->get("p");
  7320.         $Album $em->getRepository(Produit::class)->find($p);
  7321.         $Album->setDelated(1);
  7322.         $em->getManager()->persist($Album);
  7323.         $em->getManager()->flush();
  7324.         return new Response('yoopi');
  7325.     }
  7326.     /**
  7327.      * @Route("/Parent/saveDiaporamaParent", name="saveDiaporamaParent")
  7328.      */
  7329.     public function saveDiaporamaParent()
  7330.     {
  7331.         $session $this->session;
  7332.         $idSejour $session->get("Sejour");
  7333.         /** @var \App\Entity\User $userId */
  7334.         $userId $this->getUser();
  7335.         $sejourobj $this->em->getRepository(Sejour::class)->find($idSejour);
  7336.         $prodct $this->em->getRepository(Typeproduit::class)->find(19);
  7337.         $produit $this->em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $userId->getId()]);
  7338.         if ($produit !== null && $produit !== "") {
  7339.             $produit->setLabele("Diaporama");
  7340.             $produit->setIduser($userId);
  7341.             $produit->setIdsjour($sejourobj);
  7342.             $produit->setType($prodct);
  7343.         } else {
  7344.             $produit = new Produit;
  7345.             $produit->setLabele("Diaporama");
  7346.             $produit->setIduser($userId);
  7347.             $produit->setIdsjour($sejourobj);
  7348.             $produit->setType($prodct);
  7349.             $produit->setDate(new \DateTime());
  7350.         }
  7351.         $this->em->getManager()->persist($produit);
  7352.         $this->em->getManager()->flush();
  7353.         return new Response('disporama saved');
  7354.     }
  7355.     /**
  7356.      * @Route("/Parent/appActiveAcompt/{id}", name="appActiveAcompt")
  7357.      */
  7358.     public function ActiveAcounnt($id)
  7359.     {
  7360.         $user $this->em->getRepository(User::class)->find($id);
  7361.         $user->setActivatemail(1);
  7362.         $this->em->getManager()->persist($user);
  7363.         $this->em->getManager()->flush();
  7364.         $encript hash("sha256"$user->getUsername() . $user->getId());
  7365.         $url_newPass $this->get('router')->generate('sauthentifierAuto', array("token" => str_replace("."""$user->getEmail()), 'idUser' => $user->getId(), 'userHash' => $encript), UrlGeneratorInterface::ABSOLUTE_URL);
  7366.         return $this->redirect($url_newPass);
  7367.         //        return $this->redirectToRoute('sauthentifierAuto', array("token" => str_replace(".", "", $user->getEmail()),'idUser'=>$user->getId(), 'userHash' => $encript), UrlGeneratorInterface::ABSOLUTE_URL);
  7368.     }
  7369.     /**
  7370.      * @Route("/Parent/Album_du_Sejour", name="Album_du_Sejour")
  7371.      */
  7372.     function ActiverSessionAlbum()
  7373.     {
  7374.         $SEjourService $this->sejourService;
  7375.         /** @var \App\Entity\User $user */
  7376.         $user $this->getUser();
  7377.         $userId $user->getId();
  7378.         $session $this->session;
  7379.         $session->set('pageMenu''');
  7380.         $idSejour $session->get("Sejour");
  7381.         $sejour $SEjourService->getsejourpourparent($idSejour);
  7382.         $em $this->em;
  7383.         $AllPages null;
  7384.         $random false;
  7385.         $idAcc $sejour->getIdAcommp();
  7386.           $Albumproduct $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'Album_sejour']);
  7387.         if ($Albumproduct == null) {
  7388.             $Albumproduct $this->em->getRepository(Produit::class)->findOneBy(['iduser' => 1'statut' => "Album_sejour"'idsjour' => $sejour]);
  7389.         }
  7390.         if ($Albumproduct != null and $Albumproduct != "") {
  7391.             $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  7392.         }
  7393.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  7394.         $nbLikes count($listeattachlikephoto);
  7395.         $part $sejour->getIdPartenaire();
  7396.         $nompart $part->getUsername();
  7397.         $logopart $part->getLogourl();
  7398.         $session->set('produit'$Albumproduct->gettype());
  7399.         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]);
  7400.     }
  7401.     /**
  7402.      * @Route("/Parent/Editer_Album_du_Sejour", name="Editer_Album_du_Sejour")
  7403.      */
  7404.     function EditerSessionAlbum()
  7405.     {
  7406.         $SEjourService $this->sejourService;
  7407.         /** @var \App\Entity\User $user */
  7408.         $user $this->getUser();
  7409.         $userId $user->getId();
  7410.         $session $this->session;
  7411.         $session->set('pageMenu''');
  7412.         $idSejour $session->get("Sejour");
  7413.         $sejour $SEjourService->getsejourpourparent($idSejour);
  7414.         $em $this->em;
  7415.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  7416.         $nbLikes count($listeattachlikephoto);
  7417.         $AllPages null;
  7418.         $random false;
  7419.         $idAcc $sejour->getIdAcommp();
  7420.           $Albumproduct $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'Album_sejour']);
  7421.         if ($Albumproduct == null) {
  7422.             $Albumproduct $this->em->getRepository(Produit::class)->findOneBy(['iduser' => 1'statut' => "Album_sejour"'idsjour' => $sejour]);
  7423.         }
  7424.         if ($Albumproduct != null and $Albumproduct != "") {
  7425.             $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  7426.         }
  7427.         $allpagesResult = array();
  7428.         $tabacc = array();
  7429.         $tabacc1 = array();
  7430.         foreach ($AllPages as $page) {
  7431.             $pageJ json_decode($page->getCouleurbordure());
  7432.             $pageDec json_decode($pageJ[0]);
  7433.             $attache json_decode($pageDec->attache);
  7434.             if (isset($attache[0])) {
  7435.                 $attachDec json_decode($attache[0]);
  7436.             }
  7437.             //var_dump($attachDec);
  7438.             //var_dump(json_decode($attachDec->id));
  7439.             if (isset($attachDec->id) && json_decode($attachDec->id) !== null && $attachDec->id !== '') {
  7440.                 $idAttach json_decode($attachDec->id);
  7441.                 array_push($tabacc$idAttach);
  7442.             }
  7443.         }
  7444.         $tabacc1 array_count_values($tabacc);
  7445.         $part $sejour->getIdPartenaire();
  7446.         $nompart $part->getUsername();
  7447.         $logopart $part->getLogourl();
  7448.         $session->set('produit'$Albumproduct->gettype());
  7449.         $listeattach $SEjourService->getatachmentsejour($idSejour);
  7450.         $nbPhoto count($listeattach);
  7451.         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]);
  7452.     }
  7453.     /**
  7454.      * @Route("/Parent/Editer_Livre_du_Sejour", name="Editer_Livre_du_Sejour")
  7455.      */
  7456.     function EditerSessionLivre()
  7457.     {
  7458.         $SEjourService $this->sejourService;
  7459.         /** @var \App\Entity\User $user */
  7460.         $user $this->getUser();
  7461.         $userId $user->getId();
  7462.         $session $this->session;
  7463.         $session->set('pageMenu''');
  7464.         $idSejour $session->get("Sejour");
  7465.         $sejour $SEjourService->getsejourpourparent($idSejour);
  7466.         $em $this->em;
  7467.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  7468.         $nbLikes count($listeattachlikephoto);
  7469.         $AllPages null;
  7470.         $random false;
  7471.         $idAcc $sejour->getIdAcommp();
  7472.         $Albumproduct $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  7473.         if ($Albumproduct == null) {
  7474.             $Albumproduct $em->getRepository(Produit::class)->findOneBy(['version' => 'Livre_Sejour_Admin''idsjour' =>   $idSejour]);
  7475.         }
  7476.         if ($Albumproduct == null) {
  7477.             $Albumproduct $em->getRepository(Produit::class)->findOneBy(['labele' => 'randomLivre']);
  7478.         }
  7479.         if ($Albumproduct != null and $Albumproduct != "") {
  7480.             $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  7481.         }
  7482.         $allpagesResult = array();
  7483.         $tabacc = array();
  7484.         $tabacc1 = array();
  7485.         foreach ($AllPages as $page) {
  7486.             $pageJ json_decode($page->getCouleurbordure());
  7487.             $pageDec json_decode($pageJ[0]);
  7488.             $attache json_decode($pageDec->attache);
  7489.             if (isset($attache[0])) {
  7490.                 $attachDec json_decode($attache[0]);
  7491.             }
  7492.             //var_dump($attachDec);
  7493.             //var_dump(json_decode($attachDec->id));
  7494.             if (isset($attachDec->id) && json_decode($attachDec->id) !== null && $attachDec->id !== '') {
  7495.                 $idAttach json_decode($attachDec->id);
  7496.                 array_push($tabacc$idAttach);
  7497.             }
  7498.         }
  7499.         $tabacc1 array_count_values($tabacc);
  7500.         $part $sejour->getIdPartenaire();
  7501.         $nompart $part->getUsername();
  7502.         $logopart $part->getLogourl();
  7503.         $session->set('produit'$Albumproduct->gettype());
  7504.         $listeattach $SEjourService->getatachmentsejour($idSejour);
  7505.         $nbPhoto count($listeattach);
  7506.         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]);
  7507.     }
  7508.     /**
  7509.      * @Route("/Parent/DesactiverSessionAlbum", name="DesactiverSessionAlbum")
  7510.      */
  7511.     function DesactiverSessionAlbum()
  7512.     {
  7513.         $session $this->session;
  7514.         $session->remove('sessionalbm');
  7515.         return new Response('session removed');
  7516.     }
  7517.     /**
  7518.      * @Route("/Parent/Mon_Compte_Activer", name="Mon_Compte_Activer")
  7519.      */
  7520.     public function Mon_Compte_Activer(Request $request)
  7521.     {
  7522.         $em $this->em;
  7523.         return $this->render('Parent/activeMoncompte.html.twig');
  7524.     }
  7525.     /**
  7526.      * @Route("/Parent/swuitchSejour/{id}", name="swuitchSejour")
  7527.      */
  7528.     public function swuitchSejour($id)
  7529.     {
  7530.         $em $this->em;
  7531.         $sejourobj $this->em->getRepository(Sejour::class)->find($id);
  7532.         $this->session->set('Sejour'$sejourobj->getId());
  7533.         return $this->redirectToRoute('AccueilParent');
  7534.     }
  7535.     /**
  7536.      * @Route("/migrationCloudinary", name="migrationCloudinary")
  7537.      */
  7538.     public function cloudinaryMigration()
  7539.     {
  7540.         $em $this->em;
  7541.         //        $path="https://res.cloudinary.com/apss-factory/image/upload/a_exif/v1588979564/newprod/JUEGOS-EN-LA-PLAYA5_dnvgj8.jpg";
  7542.         $attachement = [
  7543.             'Eclaire.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143379/newprod/clipart/Eclaire_pr0ecu.svg',
  7544.             'ARcenciel.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143391/newprod/clipart/ARcenciel_grkyap.svg',
  7545.             'Drapeaux.svg' => 'https://res.cloudinary.com/apss-factory/image/uploadv/1589143377/newprod/clipart/Drapeaux_zqo8v3.svg',
  7546.             'Annif.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143391/newprod/clipart/Annif_ihvyoo.svg',
  7547.             'Basquettes.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143377/newprod/clipart/Basquettes_znjd41.svg',
  7548.             'Foot.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143382/newprod/clipart/Foot_az6bct.svg',
  7549.             'Hello.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143383/newprod/clipart/Hello_njqifl.svg',
  7550.             'Love.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143386/newprod/clipart/Love_q39usk.svg',
  7551.             'LICORNE.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143385/newprod/clipart/LICORNE_hpomru.svg',
  7552.             'Noeud.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143388/newprod/clipart/Noeud_mw5a4j.svg',
  7553.             'Etoilerose.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143380/newprod/clipart/Etoilerose_ewrzff.svg',
  7554.             'Ete4.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143379/newprod/clipart/Ete4_pdxadk.svg',
  7555.             'Ete6.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143380/newprod/clipart/Ete6_a3xgpd.svg',
  7556.             'Ete9.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143380/newprod/clipart/Ete9_s4vllm.svg',
  7557.             'Hiver1.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143384/newprod/clipart/Hiver1_fekrjz.svg',
  7558.             'Hiver2.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143384/newprod/clipart/Hiver2_e9iygg.svg',
  7559.             'Noel2.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143387/newprod/clipart/Noel2_eqvdzr.svg',
  7560.             'Hiver.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143383/newprod/clipart/Hiver_et04e1.svg',
  7561.             'Sapin.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143390/newprod/clipart/Sapin_qjkxz6.svg',
  7562.             'Chaussetet.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143377/newprod/clipart/Chaussetet_xfpt6t.svg',
  7563.             'Cloches.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143377/newprod/clipart/Cloches_x2v3eo.svg',
  7564.             'Like.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143387/newprod/clipart/Like_ynxb2u.svg',
  7565.             'coeurlike.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143379/newprod/clipart/coeurlike_ferv9y.svg',
  7566.             'Fetedesmeres.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143383/newprod/clipart/Fetedesmeres_ud9vac.svg',
  7567.             'Fetedesperes.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143384/newprod/clipart/Fetedesperes_mltjmo.svg',
  7568.             'OOPS.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143389/newprod/clipart/OOPS_gj9p1c.svg',
  7569.             'OOPS_1.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143389/newprod/clipart/OOPS_1_r9a7l6.svg',
  7570.             'WoW.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143393/newprod/clipart/WoW_ljlqjm.svg',
  7571.             'Nuage.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143387/newprod/clipart/Nuage_fgomd0.svg',
  7572.             'Pingouin.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143389/newprod/clipart/Pingouin_ogxb6e.svg',
  7573.             'Renard.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143378/newprod/clipart/Chouette_mc1ik2.svg',
  7574.             'Chouette.svg' => 'https://res.cloudinary.com/apss-factory/image/upload/v1589143390/newprod/clipart/Renard_mlhrxt.svg'
  7575.         ];
  7576.         foreach ($attachement as $at) {
  7577.             $exif false;
  7578.             $path $at;
  7579.             $pathArray explode("/"$path);
  7580.             $idsArray explode("."$pathArray[sizeof($pathArray) - 1]);
  7581.             $idImage "";
  7582.             foreach ($idsArray as $key2 => $elem) {
  7583.                 if ($key2 != (sizeof($idsArray) - 1)) {
  7584.                     $idImage $idImage $elem;
  7585.                 }
  7586.             }
  7587.             $idImage 'clipart/' $idImage;
  7588.             \Cloudinary::config(array(
  7589.                 "cloud_name" => "af5sur5sejour",
  7590.                 "api_key" => "263346742199243",
  7591.                 "api_secret" => "jYw-jg0FOJGv89-o5Wo0Fa3rQWU",
  7592.                 "secure" => true
  7593.             ));
  7594.             Unirest\Request::auth('263346742199243''jYw-jg0FOJGv89-o5Wo0Fa3rQWU');
  7595.             Unirest\Request::verifyPeer(false);
  7596.             $url 'https://api.cloudinary.com/v1_1/af5sur5sejour/image/upload';
  7597.             $headers = array('Accept' => 'application/json');
  7598.             $data = array("file" => $path"public_id" => $idImage"upload_preset" => 'ml_default');
  7599.             $body Unirest\Request\Body::form($data);
  7600.             $resultMetadata Unirest\Request::post($url$headers$body);
  7601.             var_dump($resultMetadata);
  7602.             if (isset(json_decode($resultMetadata->raw_body)->secure_url)) {
  7603.                 var_dump(json_decode($resultMetadata->raw_body)->secure_url);
  7604.             }
  7605.         }
  7606.         $em->getManager()->flush();
  7607.         return new response("done");
  7608.     }
  7609.     /**
  7610.      * @Route("/Parent/virgoPAss", name="virgopass")
  7611.      */
  7612.     public function virgopass()
  7613.     {
  7614.         return $this->render('Parent/virgo.html.twig');
  7615.     }
  7616.     /**
  7617.      * @Route("/Parent/interfaceUpdatePassorwdParent", name="interfaceUpdatePassorwdParent")
  7618.      */
  7619.     public function interfaceUpdatePassorwdParent(Request $request)
  7620.     {
  7621.         $user $this->getUser();
  7622.         return $this->render('Parent/interfaceUpdatePassorwdParent.html.twig', ["userToSetPassword" => $user]);
  7623.     }
  7624.     /**
  7625.      * @Route("/Parent/updatePassorwdParent", name="updatePassorwd_parent")
  7626.      */
  7627.     public function updatePassorwdParent(Request $request)
  7628.     {
  7629.         $em $this->em;
  7630.         $serviceuser $this->userService;
  7631.         $id $request->get("userID");
  7632.         $password $request->get("password");
  7633.         $result $serviceuser->ModifierPwdParent($id$password);
  7634.         return new Response('pwd modifié');
  7635.     }
  7636.     /**
  7637.      * @Route("/Parent/sauthentifierAuto/{token}/{idUser}/{userHash}",name="sauthentifierAuto")
  7638.      */
  7639.     function sauthentifierAuto($token$idUser$userHash)
  7640.     {
  7641.         $parent $this->em->getRepository(User::class)->find($idUser);
  7642.         if ((hash("sha256"$parent->getUsername() . $parent->getId()) == $userHash)) {
  7643.             $providerKey 'main_Parent'// your firewall name
  7644.             $token = new UsernamePasswordToken($parentnull$providerKey$parent->getRoles());
  7645.             $this->container->get('security.token_storage')->setToken($token);
  7646.             return $this->redirectToRoute("CodeSejour");
  7647.         } else {
  7648.             return $this->redirectToRoute("app_back_Parent");
  7649.         }
  7650.     }
  7651.     /**
  7652.      * @Route("/loginAutotoAlbumAcco/{token}/{idUser}/{userHash}/{albumAcco}",name="loginAutotoAlbumAcco")
  7653.      */
  7654.     function loginAutotoAlbumAcco($token$idUser$userHash$albumAcco)
  7655.     {
  7656.         $parent $this->em->getRepository(User::class)->find($idUser);
  7657.         if ((hash("sha256"$parent->getUsername() . $parent->getId()) == $userHash)) {
  7658.             //            return $this->render('security/DemandePasswordParentv.html.twig', ["userToSetPassword" => $use
  7659.             //dd('im herge');             
  7660.             $providerKey 'main_Parent'// your firewall name
  7661.             $token = new UsernamePasswordToken($parentnull$providerKey$parent->getRoles());
  7662.             //dd($token);  
  7663.             $this->container->get('security.token_storage')->setToken($token);
  7664.             $session $this->session;
  7665.             $produit $this->em->getRepository(Produit::class)->find($albumAcco);
  7666.             // dd($produit->getIdsjour()->getId());    
  7667.             $session->set("Sejour"$produit->getIdsjour()->getId());
  7668.             return $this->redirectToRoute("ActiverSessionAlbum");
  7669.         } else {
  7670.             return $this->redirectToRoute("app_back_Parent");
  7671.         }
  7672.     }
  7673.     /**
  7674.      * @Route("/Parent/respondNotifSms",name="respondNotifSms")
  7675.      */
  7676.     function respondNotifSms(Request $request)
  7677.     {
  7678.         $resp $request->get("resp");
  7679.         /** @var \App\Entity\User $user */
  7680.         $user $this->getUser();
  7681.         $user->setSmsnotif($resp);
  7682.         $this->em->getManager()->persist($user);
  7683.         $parentsejour $this->em->getRepository(ParentSejour::class)->findBy(['idParent' => $user]);
  7684.         foreach ($parentsejour as $sejr) {
  7685.             $sejr->setSmsnotif($resp);
  7686.             if (strpos($sejr->getIdSejour()->getCodeSejour(), "EF") !== false) {
  7687.                 $sejr->setSmsnotif(0);
  7688.             }
  7689.             $this->em->getManager()->persist($sejr);
  7690.         }
  7691.         $this->em->getManager()->flush();
  7692.         return new Response('smsnotifmodifié');
  7693.     }
  7694.     /**
  7695.      * @Route("/Parent/CheckRandomNotice",name="CheckRandomNotice")
  7696.      */
  7697.     function CheckRandomNotice(Request $request)
  7698.     {
  7699.         $val $request->get("val");
  7700.         /** @var \App\Entity\User $user */
  7701.         $user $this->getUser();
  7702.         $parent $this->em->getRepository(User::class)->find($user->getId());
  7703.         $parent->setRandomnotice($val);
  7704.         $this->em->getManager()->persist($parent);
  7705.         $this->em->getManager()->flush();
  7706.         return new Response('ok');
  7707.     }
  7708.     /**
  7709.      * @Route("/Parent/CheckalbumNotif",name="CheckalbumNotif")
  7710.      */
  7711.     function CheckalbumNotif(Request $request)
  7712.     {
  7713.         $val $request->get("val");
  7714.         /** @var \App\Entity\User $user */
  7715.         $user $this->getUser();
  7716.         $parent $this->em->getRepository(User::class)->find($user->getId());
  7717.         $parent->setShowdetailsalbum($val);
  7718.         $this->em->getManager()->persist($parent);
  7719.         $this->em->getManager()->flush();
  7720.         return new Response('ok');
  7721.     }
  7722.     /**
  7723.      * @Route("/Parent/ChecklivreNotif",name="ChecklivreNotif")
  7724.      */
  7725.     function ChecklivreNotif(Request $request)
  7726.     {
  7727.         $val $request->get("val");
  7728.         /** @var \App\Entity\User $user */
  7729.         $user $this->getUser();
  7730.         $parent $this->em->getRepository(User::class)->find($user->getId());
  7731.         $parent->setShowdetailslivre($val);
  7732.         $this->em->getManager()->persist($parent);
  7733.         $this->em->getManager()->flush();
  7734.         return new Response('ok');
  7735.     }
  7736.     /**
  7737.      * @Route("/Parent/CheckphotosNotif",name="CheckphotosNotif")
  7738.      */
  7739.     function CheckphotosNotif(Request $request)
  7740.     {
  7741.         $val $request->get("val");
  7742.         /** @var \App\Entity\User $user */
  7743.         $user $this->getUser();
  7744.         $parent $this->em->getRepository(User::class)->find($user->getId());
  7745.         $parent->setShowdetailsphotos($val);
  7746.         $this->em->getManager()->persist($parent);
  7747.         $this->em->getManager()->flush();
  7748.         return new Response('ok');
  7749.     }
  7750.     /**
  7751.      * @Route("/Parent/CheckcalNotif",name="CheckcalNotif")
  7752.      */
  7753.     function CheckcalNotif(Request $request)
  7754.     {
  7755.         $val $request->get("val");
  7756.         /** @var \App\Entity\User $user */
  7757.         $user $this->getUser();
  7758.         $parent $this->em->getRepository(User::class)->find($user->getId());
  7759.         $parent->setShowdetailscal($val);
  7760.         $this->em->getManager()->persist($parent);
  7761.         $this->em->getManager()->flush();
  7762.         return new Response('ok');
  7763.     }
  7764.     /**
  7765.      * @Route("/Parent/CheckretrosNotif",name="CheckretrosNotif")
  7766.      */
  7767.     function CheckretrosNotif(Request $request)
  7768.     {
  7769.         $val $request->get("val");
  7770.         /** @var \App\Entity\User $user */
  7771.         $user $this->getUser();
  7772.         $parent $this->em->getRepository(User::class)->find($user->getId());
  7773.         $parent->setShowdetailsretros($val);
  7774.         $this->em->getManager()->persist($parent);
  7775.         $this->em->getManager()->flush();
  7776.         return new Response('ok');
  7777.     }
  7778.     /**
  7779.      * @Route("/Parent/hidePubProd",name="hidePubProd")
  7780.      */
  7781.     function hidePubProd(Request $request)
  7782.     {
  7783.         $val $request->get("val");
  7784.         /** @var \App\Entity\User $user */
  7785.         $user $this->getUser();
  7786.         $parent $this->em->getRepository(User::class)->find($user->getId());
  7787.         $parent->setShowpubprod('false');
  7788.         $this->em->getManager()->persist($parent);
  7789.         $this->em->getManager()->flush();
  7790.         return new Response('ok');
  7791.     }
  7792.     /**
  7793.      * @Route("/Parent/PackPhotosNumerique_Modifier/{nbr}/{id}", name="PackPhotosNumerique_Modifier")
  7794.      */
  7795.     public function PackPhotosNumerique_Modifier($nbr$id)
  7796.     {
  7797.         $SEjourService $this->sejourService;
  7798.         /** @var \App\Entity\User $user */
  7799.         $user $this->getUser();
  7800.         $userId $user->getId();
  7801.         $user $this->getUser();
  7802.         $session $this->session;
  7803.         $session->set('pageMenu''');
  7804.         $idSejour $session->get("Sejour");
  7805.         $produitcondition $session->get("produit");
  7806.         $produit $session->get("produittype");
  7807.         $sejour $SEjourService->getsejourpourparent($idSejour);
  7808.         $em $this->em;
  7809.         $clipart $em->getRepository(Clipart::class)->findAll();
  7810.         $listeattachlikephoto $SEjourService->getlikephotosejour($userId$idSejour);
  7811.         $listeattach $SEjourService->getatachmentsejour($idSejour);
  7812.         $nbLikes count($listeattachlikephoto);
  7813.         //Stella
  7814.         $AllPagesAcc null;
  7815.         $random false;
  7816.         $Albumproduct $em->getRepository(Produit::class)->findOneBy(['id' => $id]);
  7817.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  7818.         $idAcc $sejour->getIdAcommp();
  7819.         $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  7820.         $part $sejour->getIdPartenaire();
  7821.         $nompart $part->getUsername();
  7822.         $logopart $part->getLogourl();
  7823.         $nbPhoto count($listeattach);
  7824.         // die();
  7825.         if ($nbLikes == 0) {
  7826.             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]);
  7827.         }
  7828.         if ($nbLikes != 0) {
  7829.             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]);
  7830.         }
  7831.     }
  7832.     /**
  7833.      * @Route("Parent/PackPhotosNumerique_Favoris/{nbr}", name="PackPhotosNumerique_Favoris")
  7834.      */
  7835.     public function PackPhotosNumerique_Favoris($nbr)
  7836.     {
  7837.         $SEjourService $this->sejourService;
  7838.         $user $this->getUser();
  7839.         $userId $this->getUser()->getId();
  7840.         $session $this->get('session');
  7841.         $session->set('pageMenu''');
  7842.         $idSejour $session->get("Sejour");
  7843.         $produitcondition $session->get("produit");
  7844.         $produit $session->get("produittype");
  7845.         $sejour $SEjourService->getsejourpourparent($idSejour);
  7846.         $em $this->getDoctrine()->getManager();
  7847.         $listeattachlikephoto $em->getRepository(Likephoto::class)->findBy(['idUser' =>  $userId'idSejour' =>  $idSejour]);
  7848.         foreach ($listeattachlikephoto as $photo) {
  7849.             $idattach $photo->getIdSejourAttchment();
  7850.             $SejattachPhoto  $photo->getIdSejourAttchment();
  7851.             $urlPhoto  =   $SejattachPhoto->getIdAttchment()->getPath();
  7852.             //$urlPhoto =   $attachPhoto->getPath();
  7853.             $new_url str_replace('upload/''upload/f_auto,q_auto,h_900/l_Logo5Sur5White_nh6tyk,o_10,fl_relative.tiled/',  $urlPhoto);
  7854.             $photosData[] = [
  7855.                 'id' => $photo->getId(),
  7856.                 'url' =>    $new_url,
  7857.                 'caption' => "",
  7858.             ];
  7859.         }
  7860.         $nbLikes count($listeattachlikephoto);
  7861.         // Convertir le tableau PHP en JSON
  7862.         $photosDataJSON json_encode($photosData);
  7863.         return $this->render('Parent/PackPhotosNumerique_Favoris.html.twig', [
  7864.             "nbr" => $nbr,
  7865.             "sejour" => $sejour,
  7866.             "nbLikes" => $nbLikes,
  7867.             'photosFav' =>    $photosDataJSON
  7868.         ]);
  7869.     }
  7870.     /**
  7871.      * @Route("Parent/PackPhotosNumerique_Offert/{nbr}", name="PackPhotosNumerique_Offert")
  7872.      */
  7873.     public function PackPhotosNumerique_Offert($nbr)
  7874.     {
  7875.         $SEjourService $this->sejourService;
  7876.         $user $this->getUser();
  7877.         $userId $this->getUser()->getId();
  7878.         $session $this->get('session');
  7879.         $session->set('pageMenu''');
  7880.         $idSejour $session->get("Sejour");
  7881.         $produitcondition $session->get("produit");
  7882.         $produit $session->get("produittype");
  7883.         $sejour $SEjourService->getsejourpourparent($idSejour);
  7884.         $em $this->getDoctrine()->getManager();
  7885.         $listeattachlikephoto $em->getRepository(Likephoto::class)->findBy(['idUser' => $userId'idSejour' => $idSejour]);
  7886.         foreach ($listeattachlikephoto as $photo) {
  7887.             $idattach $photo->getIdSejourAttchment();
  7888.             $SejattachPhoto $photo->getIdSejourAttchment();
  7889.             $urlPhoto $SejattachPhoto->getIdAttchment()->getPath();
  7890.             //$urlPhoto = $attachPhoto->getPath();
  7891.             $new_url str_replace('upload/''upload/f_auto,q_auto,h_900/l_Logo5Sur5White_nh6tyk,o_10,fl_relative.tiled/'$urlPhoto);
  7892.             $photosData[] = [
  7893.                 'id' => $photo->getId(),
  7894.                 'url' => $new_url,
  7895.                 'caption' => "",
  7896.             ];
  7897.         }
  7898.         $nbLikes count($listeattachlikephoto);
  7899.         // Convertir le tableau PHP en JSON
  7900.         $photosDataJSON json_encode($photosData);
  7901.         return $this->render('Parent/PackPhotosNumerique_Favoris.html.twig', [
  7902.             "nbr" => $nbr,
  7903.             "sejour" => $sejour,
  7904.             "nbLikes" => $nbLikes,
  7905.             'photosFav' => $photosDataJSON
  7906.         ]);
  7907.     }
  7908.     /**
  7909.      * @Route("Parent/AjoutPackPhotosNum/{nbr}", name="AjoutPackPhotosNum")
  7910.      */
  7911.     public function AjoutPackPhotosNumParent($nbr)
  7912.     {
  7913.         $SEjourService $this->sejourService;
  7914.         /** @var \App\Entity\User $user */
  7915.         $user $this->getUser();
  7916.         $userId $user->getId();
  7917.         $user $this->getUser();
  7918.         $session $this->session;
  7919.         $session->set('pageMenu''');
  7920.         $idSejour $session->get("Sejour");
  7921.         $sejour $SEjourService->getsejourpourparent($idSejour);
  7922.         $em $this->em;
  7923.         $clipart $em->getRepository(Clipart::class)->findAll();
  7924.         //  $listeattachlikephoto = $SEjourService->getlikephotosejour($userId, $idSejour);
  7925.         //$listerandom =  $SEjourService->getatachmentsejour($idSejour);
  7926.         $listeattach $SEjourService->getCombinedattachSejour($idSejour'photo');
  7927.         $listerandom =  $listeattach;
  7928.         $AllPagesAcc null;
  7929.         $Albumproduct $em->getRepository(Produit::class)->findOneBy(['labele' => 'RandomPackPhotosNum' $nbr]);
  7930.         $random true;
  7931.         $AllPages $em->getRepository(Page::class)->findBy(['idproduit' => $Albumproduct]);
  7932.         $idAcc $sejour->getIdAcommp();
  7933.         $albumAcc $em->getRepository(Produit::class)->findOneBy(['idsjour' => $idSejour'iduser' => $idAcc'statut' => 'saved'], ['id' => 'DESC']);
  7934.         $part $sejour->getIdPartenaire();
  7935.         $nompart $part->getUsername();
  7936.         $logopart $part->getLogourl();
  7937.         if ($albumAcc != null and $albumAcc != "") {
  7938.             $AllPagesAcc $em->getRepository(Page::class)->findBy(['idproduit' => $albumAcc]);
  7939.         }
  7940.         $allpagesResult = array();
  7941.         $j 0;
  7942.         if ($random == true) {
  7943.             foreach ($AllPages as $p) {
  7944.                 $arrayexploded preg_split('[randomid|randompath]'$p->getCouleurbordure());
  7945.                 $rr "";
  7946.                 for ($i 0$i sizeof($arrayexploded); $i $i 2) {
  7947.                     if ($i sizeof($arrayexploded)) {
  7948.                         if (sizeof($listerandom) == 0) {
  7949.                             //$listerandom = $SEjourService->getatachmentsejour($idSejour);
  7950.                             $listerandom $SEjourService->getCombinedattachSejour($idSejour'photo');
  7951.                         }
  7952.                         $arrayRsRandom $this->random_functionNolikes($listerandom);
  7953.                         $rr $rr $arrayexploded[$i] . $arrayRsRandom['idelem'] . $arrayexploded[$i 1] . $arrayRsRandom['pathelem'];
  7954.                         unset($listerandom[$arrayRsRandom['elem']]);
  7955.                     } else {
  7956.                         $rr $rr $arrayexploded[$i];
  7957.                     }
  7958.                     $listerandom $listerandom;
  7959.                 }
  7960.                 $resultFinal $rr;
  7961.                 $p->setCouleurbordure($resultFinal);
  7962.                 array_push($allpagesResult$p);
  7963.                 if ($j sizeof($listeattach) - 1) {
  7964.                     $j $j 1;
  7965.                 } else {
  7966.                     $j 0;
  7967.                 }
  7968.             }
  7969.             $AllPages $allpagesResult;
  7970.         }
  7971.         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]);
  7972.     }
  7973.     /**
  7974.      * @Route("/Parent/SavePackPhotosNumerique", name="SavePackPhotosNumeriqueParent")
  7975.      */
  7976.     public function SavePackPhotosNumeriqueParent(Request $request)
  7977.     {
  7978.         $session $this->session;
  7979.         $serviceuser $this->etablissementService;
  7980.         $page $request->get("pages");
  7981.         $sejour $request->get("sejour");
  7982.         $prodid $request->get('idProd');
  7983.         $nomprod $request->get('nomprod');
  7984.         $nbr $request->get('nbr');
  7985.         $user $this->getUser();
  7986.         $nbr strval($nbr);
  7987.         $produittype $session->get("produit");
  7988.         $produit $session->get("produittype");
  7989.         //  $Album = $serviceuser->SavePhotosPochetteParent($page, $user, $sejour, $prodid, $produit, $produittype, $nbr,$nomprod);
  7990.         $refPackNum null;
  7991.         if ($sejour) {
  7992.             $refPackNum $this->generateRefPackPhotosNum($sejour$user);
  7993.         }
  7994.         $Album $serviceuser->SavePackPhotosNumerique($page$user$sejour$prodid$produit$produittype$nbr$nomprod$refPackNum);
  7995.         //sendmailparent
  7996.         $dateNow = new \Datetime();
  7997.         /** @var \App\Entity\User $user */
  7998.         $user $this->getUser();
  7999.         $userEmail $user->getEmail();
  8000.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  8001.         //$this->EmailServie->MailRelancePanier($userEmail);
  8002.         return new response('done');
  8003.     }
  8004. /**
  8005.  * @Route("/Parent/CommandeDirecteAddPackNumeriqueAuPanier", name="CommandeDirecteAddPackNumeriqueAuPanier")
  8006.  */
  8007. public function CommandeDirecteAddPackNumeriqueAuPanier(Request $request)
  8008. {
  8009.     $em $this->em->getManager();
  8010.     $session $this->session;
  8011.     $this->logger->info('Début CommandeDirecteAddPackNumeriqueAuPanier');
  8012.     $serviceuser $this->etablissementService;
  8013.     $photos $request->get("photos");
  8014.     $sejour $request->get("sejour");
  8015.     $nbr $request->get('nbr');
  8016.     $user $this->getUser();
  8017.     $nbr strval($nbr);
  8018.     $nomprod "Pack Photos Numerique - " $nbr;
  8019.     
  8020.     // Créer le produit pack photos
  8021.     $packPhotos $serviceuser->SavePackPhotosNumerique($photos$user$sejour$nbr$nomprod);
  8022.     $product $em->getRepository(Produit::class)->find($packPhotos->getId());
  8023.   
  8024.     // Récupérer ou créer le panier
  8025.     $typeref $em->getRepository(Typeref::class)->find(8);
  8026.     $statutPanier $em->getRepository(Ref::class)->findOneBy(["libiller" => "creer""typeref" => $typeref]);
  8027.     $panierTrace $em->getRepository(Panier::class)->findOneBy(["creerPar" => $user"statut" => $statutPanier]);
  8028.     if ($panierTrace === null) {
  8029.         $panierTrace = new Panier();
  8030.         $panierTrace->setDateCreation(new \DateTime());
  8031.         $panierTrace->setCreerPar($user);
  8032.         $panierTrace->setStatut($statutPanier);
  8033.         $em->persist($panierTrace);
  8034.         $em->flush();
  8035.     }
  8036.     $this->logger->info('Panier récupéré', ['panier_id' => $panierTrace $panierTrace->getId() : 'null']);
  8037.     // Récupérer les produits du panier en session
  8038.     $Products $session->get("Panier", []);
  8039.     $inser false;
  8040.     
  8041.     // Vérifier si le panier est vide (pas de produits en session)
  8042.     if(count($Products) == 0) {
  8043.         // Créer directement une commande et une commande numérique
  8044.         $commande = new Commande();
  8045.         $commande->setDateCreation(new \DateTime());
  8046.         $commande->setCreerPar($user);
  8047.         $commande->setStatut($statutPanier);
  8048.         $commande->setTyperef($typeref);
  8049.         $commande->setMontantTTC($product->getIdConditionnement()->getMontantTTC());
  8050.         $commande->setIdsjour($sejour);
  8051.         $commande->setIdpanier($panierTrace->getId());
  8052.         $commande->setNumComande($this->generateUniqueOrderNumber());
  8053.         $em->persist($commande);
  8054.         $em->flush();
  8055.         
  8056.         $commandeNumerique = new CommandeNumerique();
  8057.         $commandeNumerique->setDateCreation(new \DateTime());
  8058.         $commandeNumerique->setCreerPar($user);
  8059.         $commandeNumerique->setIdCommande($commande);
  8060.         $commandeNumerique->setStatut($statutPanier);
  8061.         $commandeNumerique->setLinkdownload($product->getId());
  8062.         $commandeNumerique->setEtat(0); // État en attente de paiement
  8063.         $em->persist($commandeNumerique);
  8064.         $em->flush();
  8065.         
  8066.         // Ajouter le produit au panier en session pour le paiement
  8067.         $p = [
  8068.             "id" => $product->getId(),
  8069.             "nom" => $product->getType()->getLabeletype(),
  8070.             "ident" => $product->getLabele(),
  8071.             "codesejour" => $product->getIdsjour()->getcodeSejour(),
  8072.             "mnt" => $product->getIdConditionnement()->getMontantTTC(),
  8073.             "path" => $product->getType()->getAttachements()[0]->getIdAttachement()->getPath(),
  8074.             "condition" => $product->getIdConditionnement()->getId(),
  8075.             "qte" => 1
  8076.         ];
  8077.         array_push($Products$p);
  8078.         $session->set('Panier'$Products);
  8079.         
  8080.         // Ajouter le produit au panier en base de données
  8081.         $panierProduit = new PanierProduit();
  8082.         $panierProduit->setIdProduit($product);
  8083.         $panierProduit->setIdPanier($panierTrace);
  8084.         $panierProduit->setQuantite(1);
  8085.         $panierProduit->setPrixTotal($product->getIdConditionnement()->getMontantTTC());
  8086.         $em->persist($panierProduit);
  8087.         $em->flush();
  8088.         
  8089.         // Rediriger vers la page de paiement
  8090.         return $this->redirectToRoute('paiement_commande_directe', [
  8091.             'id' => $commande->getId()
  8092.         ]);
  8093.     } else {
  8094.         // Il y a déjà des produits dans le panier
  8095.         // Ajouter le produit au panier existant
  8096.         
  8097.         // Vérifier si le produit existe déjà dans le panier en session
  8098.         foreach ($Products as $key => $p) {
  8099.             if ($p['id'] === $product->getId()) {
  8100.                 $inser true;
  8101.                 $Products[$key]['qte'] += 1;
  8102.                 $Products[$key]['mnt'] += $product->getIdConditionnement()->getMontantTTC();
  8103.             }
  8104.         }
  8105.         // Vérifier si le produit existe dans PanierProduit en base de données
  8106.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(["idProduit" => $product"idPanier" => $panierTrace]);
  8107.         if ($panierProduit === null) {
  8108.             $panierProduit = new PanierProduit();
  8109.             $panierProduit->setIdProduit($product);
  8110.             $panierProduit->setIdPanier($panierTrace);
  8111.             $panierProduit->setQuantite(1);
  8112.             $panierProduit->setPrixTotal($product->getIdConditionnement()->getMontantTTC());
  8113.             $em->persist($panierProduit);
  8114.             $em->flush();
  8115.         } else {
  8116.             // Mettre à jour la quantité et le prix total
  8117.             $panierProduit->setQuantite($panierProduit->getQuantite() + 1);
  8118.             $panierProduit->setPrixTotal($panierProduit->getPrixTotal() + $product->getIdConditionnement()->getMontantTTC());
  8119.             $em->persist($panierProduit);
  8120.             $em->flush();
  8121.         }
  8122.         // Si le produit n'est pas déjà dans le panier en session, l'ajouter
  8123.         if (!$inser) {
  8124.             $p = [
  8125.                 "id" => $product->getId(),
  8126.                 "nom" => $product->getType()->getLabeletype(),
  8127.                 "ident" => $product->getLabele(),
  8128.                 "codesejour" => $product->getIdsjour()->getcodeSejour(),
  8129.                 "mnt" => $product->getIdConditionnement()->getMontantTTC(),
  8130.                 "path" => $product->getType()->getAttachements()[0]->getIdAttachement()->getPath(),
  8131.                 "condition" => $product->getIdConditionnement()->getId(),
  8132.                 "qte" => 1
  8133.             ];
  8134.             array_push($Products$p);
  8135.         }
  8136.         // Mettre à jour le panier en session
  8137.         $session->set('Panier'$Products);
  8138.         
  8139.         // Ajouter un message flash pour informer l'utilisateur
  8140.         $this->addFlash('success''Le pack photos a été ajouté à votre panier.');
  8141.         
  8142.         // Rediriger vers le panier
  8143.         $this->logger->info('Redirection vers le panier');
  8144.         return new Response('done');
  8145.     }
  8146. }
  8147. /**
  8148.  * Génère un numéro de commande unique
  8149.  */
  8150. private function generateUniqueOrderNumber()
  8151. {
  8152.     // Générer un numéro de commande basé sur la date et un nombre aléatoire
  8153.     return date('YmdHis') . rand(10009999);
  8154. }
  8155. /**
  8156.  * @Route("/Parent/confirmation-pack-photos/{id}", name="confirmation_pack_photos")
  8157.  */
  8158. public function confirmationPackPhotos($id): Response
  8159. {
  8160.     $commandeNumerique $this->em->getRepository(CommandeNumerique::class)->find($id);
  8161.     
  8162.     if (!$commandeNumerique) {
  8163.         throw $this->createNotFoundException('Commande numérique introuvable');
  8164.     }
  8165.     
  8166.     $commande $commandeNumerique->getIdCommande();
  8167.     $user $commande->getCreerPar();
  8168.     $sejour $commande->getIdsjour();
  8169.     
  8170.     return $this->render('Parent/confirmation_pack_photos.html.twig', [
  8171.         'commandeNumerique' => $commandeNumerique,
  8172.         'commande' => $commande,
  8173.         'user' => $user,
  8174.         'sejour' => $sejour,
  8175.         'downloadUrl' => $this->generateUrl('telechargerPack', ['idCommande' => $commandeNumerique->getId()])
  8176.     ]);
  8177. }
  8178.     /**
  8179.      * @Route("/Parent/SavePackPhotosNumeriqueComandeSave_panier", name="SavePackPhotosNumeriqueComandeSave_panier")
  8180.      */
  8181.     public function AddPackNumeriqueAuPanier(Request $request)
  8182.     {
  8183.         $em $this->em->getManager();
  8184.         $session $this->session;
  8185.         $serviceuser $this->etablissementService;
  8186.         $photos $request->get("photos");
  8187.         $sejour $request->get("sejour");
  8188.         $nbr $request->get('nbr');
  8189.         $user $this->getUser();
  8190.         $nbr strval($nbr);
  8191.         $nomprod "Pack Photos Numerique - " $nbr;
  8192.         //test de la fonction envoieMailPackNumerique
  8193.      
  8194.         $packPhotos $serviceuser->SavePackPhotosNumerique($photos$user$sejour$nbr$nomprod);
  8195.         $product $em->getRepository(Produit::class)->find($packPhotos->getId());
  8196.       // ---  Test pour envoyer le mail pak numerique ---// 
  8197.       //   $this->emailsCmdService->envoieMailPackNumerique($packPhotos->getId());
  8198.       
  8199.         // $this->printerService->PackPhotosNumerique($packPhotos->getId(),20);
  8200.         $typeref $em->getRepository(Typeref::class)->find(8);
  8201.         $statutPanier $em->getRepository(Ref::class)->findOneBy(["libiller" => "creer""typeref" => $typeref]);
  8202.         $panierTrace $em->getRepository(Panier::class)->findOneBy(["creerPar" => $user"statut" => $statutPanier]);
  8203.         if ($panierTrace === null) {
  8204.             $panierTrace = new Panier();
  8205.             $panierTrace->setDateCreation(new \DateTime());
  8206.             $panierTrace->setCreerPar($user);
  8207.             $panierTrace->setStatut($statutPanier);
  8208.             $em->persist($panierTrace);
  8209.             $em->flush();
  8210.         }
  8211.         // Add product to cart session
  8212.         $Products $session->get("Panier", []);
  8213.         $inser false;
  8214.         foreach ($Products as $key => $p) {
  8215.             if ($p['id'] === $product->getId()) {
  8216.                 $inser true;
  8217.                 $Products[$key]['qte'] += 1;
  8218.                 $Products[$key]['mnt'] += $product->getIdConditionnement()->getMontantTTC();
  8219.             }
  8220.         }
  8221.         // Check if product exists in PanierProduit
  8222.         $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(["idProduit" => $product"idPanier" => $panierTrace]);
  8223.         if ($panierProduit === null) {
  8224.             $panierProduit = new PanierProduit();
  8225.             $panierProduit->setIdProduit($product);
  8226.             $panierProduit->setIdPanier($panierTrace);
  8227.             $panierProduit->setQuantite(1);
  8228.             $panierProduit->setPrixTotal($product->getIdConditionnement()->getMontantTTC());
  8229.             $em->persist($panierProduit);
  8230.             $em->flush();
  8231.         } else {
  8232.             // Update existing product quantity and total price
  8233.             $panierProduit->setQuantite($panierProduit->getQuantite() + 1);
  8234.             $panierProduit->setPrixTotal($panierProduit->getPrixTotal() + $product->getIdConditionnement()->getMontantTTC());
  8235.             $em->persist($panierProduit);
  8236.             $em->flush();
  8237.         }
  8238.         if (!$inser) {
  8239.             $p = [
  8240.                 "id" => $product->getId(),
  8241.                 "nom" => $product->getType()->getLabeletype(),
  8242.                 "ident" => $product->getLabele(),
  8243.                 "codesejour" => $product->getIdsjour()->getcodeSejour(),
  8244.                 "mnt" => $product->getIdConditionnement()->getMontantTTC(),
  8245.                 "path" => $product->getType()->getAttachements()[0]->getIdAttachement()->getPath(),
  8246.                 "condition" => $product->getIdConditionnement()->getId(),
  8247.                 "qte" => 1
  8248.             ];
  8249.             array_push($Products$p);
  8250.         }
  8251.         $session->set('Panier'$Products);
  8252.         // Send reminder email
  8253.         /** @var \App\Entity\User $user */
  8254.         $userEmail $user->getEmail();
  8255.         $this->EmailServie->SaveMailRelancePanier($userEmail);
  8256.     
  8257.         return new Response('done');
  8258.     }
  8259.     /* public function SavePackPhotosNumeriqueComandeSave_panier(PrinterService $PrinterService, Request $request)
  8260.     {
  8261.         $em = $this->em;
  8262.         var_dump("Debut Creation du pack numerique ");
  8263.         $session = $this->session;
  8264.         $serviceuser = $this->etablissementService;
  8265.         $attachements = $request->get('attachements');
  8266.         $page = $request->get("pages");
  8267.         $sejour = $request->get("sejour");
  8268.         $prodid = $request->get('idProd');
  8269.         var_dump($prodid);
  8270.         $nomprod = $request->get('nomprod');
  8271.         $nbr = $request->get('nbr');
  8272.         $user = $this->getUser();
  8273.         $nbr = strval($nbr);
  8274.         $produittype = $session->get("produit");
  8275.         $produit = $session->get("produittype");
  8276.         if ($sejour !== null) {
  8277.             $refPackNum = $this->generateRefPackPhotosNum($sejour, $user);
  8278.             $Album = $serviceuser->SavePackPhotosNumerique($page, $user, $sejour, $prodid, $produit, $produittype, $nbr, $nomprod, $refPackNum);
  8279.             $produit = $em->getRepository(Produit::class)->find($Album->getId());
  8280.             $serviceuser->commandepackphotoNum($attachements, $sejour, $user, $Album);
  8281.             //   $PrinterService->PackPhotosNumerique($sejour,$refPackNum,$Album);
  8282.             $inser = false;
  8283.             $Products = $session->get("Panier");
  8284.             //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
  8285.             $user = $this->getUser();
  8286.             $typeref = $em->getRepository(Typeref::class)->find(8);
  8287.             $statutPanier = $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer", "typeref" => $typeref));
  8288.             $panierTrace = $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user, "statut" => $statutPanier));
  8289.             //fin
  8290.             if ($panierTrace == null) {
  8291.                 $panierTrace = new Panier();
  8292.                 $dateNow = new \Datetime();
  8293.                 $panierTrace->setDateCreation($dateNow);
  8294.                 $panierTrace->setCreerPar($user);
  8295.                 $panierTrace->setStatut($statutPanier);
  8296.                 $em->getManager()->persist($panierTrace);
  8297.                 $em->getManager()->flush();
  8298.             }
  8299.             //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
  8300.             if ($Products == null) {
  8301.                 $Products = [];
  8302.             }
  8303.             if ($Products != null) {
  8304.                 foreach ($Products as $key => $p) {
  8305.                     if ($p['id'] == $produit->getId()) {
  8306.                         $inser = true;
  8307.                         $Products[$key]['qte'] = $p['qte'] + 1;
  8308.                         $Products[$key]['mnt'] = $p['mnt'] + $produit->getIdConditionnement()->getMontantTTC();
  8309.                     }
  8310.                 }
  8311.             }
  8312.             //Touhemi 03-07-2020 :Rechercher  si le produti existe déja ds panierProduit
  8313.             $panierProduit = $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit, "idPanier" => $panierTrace));
  8314.             if ($panierProduit == null) {
  8315.                 $panierProduit = new PanierProduit();
  8316.                 $panierProduit->setIdProduit($produit);
  8317.                 $panierProduit->setIdPanier($panierTrace);
  8318.                 $em->getManager()->persist($panierProduit);
  8319.                 $em->getManager()->flush();
  8320.             }
  8321.             //fin
  8322.             //   Touhemi 03-07-2020 ajouter plus un au produit et modifier prixTotal
  8323.             $oldQte = $panierProduit->getQuantite();
  8324.             $newQte = $oldQte + 1;
  8325.             $panierProduit->setQuantite($newQte);
  8326.             $oldTotal = $panierProduit->getPrixTotal();
  8327.             $newTotal = $oldTotal + $produit->getIdConditionnement()->getMontantTTC();
  8328.             $panierProduit->setPrixTotal($newTotal);
  8329.             $em->getManager()->persist($panierProduit);
  8330.             $em->getManager()->flush();
  8331.             //fin
  8332.             if ($inser === false) {
  8333.                 $p = [];
  8334.                 $p["id"] = $produit->getId();
  8335.                 $p["nom"] = $produit->getType()->getLabeletype();
  8336.                 $p["ident"] = $produit->getLabele();
  8337.                 $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  8338.                 $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  8339.                 $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  8340.                 $p["condition"] = $produit->getIdConditionnement()->getId();
  8341.                 $p["qte"] = 1;
  8342.                 array_push($Products, $p);
  8343.             }
  8344.             $session->set('Panier', $Products);
  8345.             //sendmail_parent
  8346.             $dateNow = new \Datetime();
  8347.             $user = $this->getUser();
  8348.             $userEmail = $user->getEmail();
  8349.             $this->EmailServie->SaveMailRelancePanier($userEmail);
  8350.             // $this->EmailServie->MailRelancePanier($userEmail);
  8351.         }
  8352.         return new response('done');
  8353.     }
  8354. */
  8355.     /**
  8356.      * @Route("/Parent/SavePackPhotosNumeriqueComandeSave_panierfree", name="SavePackPhotosNumeriqueComandeSave_panierfree")
  8357.      */
  8358.     public function SavePackPhotosNumeriqueComandeSave_panierfree(PrinterService $PrinterServiceRequest $request)
  8359.     {
  8360.         $em $this->em;
  8361.         var_dump("Debut Creation du pack numerique ");
  8362.         $session $this->session;
  8363.         $serviceuser $this->etablissementService;
  8364.         $attachements $request->get('attachements');
  8365.         $page $request->get("pages");
  8366.         $sejour $request->get("sejour");
  8367.         $prodid $request->get('idProd');
  8368.         var_dump($prodid);
  8369.         $nomprod $request->get('nomprod');
  8370.         $nbr $request->get('nbr');
  8371.         $user $this->getUser();
  8372.         $nbr strval($nbr);
  8373.         $produittype $session->get("produit");
  8374.         $produit $session->get("produittype");
  8375.         if ($sejour !== null) {
  8376.             $refPackNum $this->generateRefPackPhotosNum($sejour$user);
  8377.             $Album $serviceuser->SavePackPhotosNumeriquefree($page$user$sejour$prodid$produit$produittype$nbr$nomprod$refPackNum);
  8378.             $produit $em->getRepository(Produit::class)->find($Album->getId());
  8379.             $serviceuser->commandepackphotoNum($attachements$sejour$user$Album);
  8380.             //   $PrinterService->PackPhotosNumerique($sejour,$refPackNum,$Album);
  8381.             $inser false;
  8382.             $Products $session->get("Panier");
  8383.             //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
  8384.             $user $this->getUser();
  8385.             $typeref $em->getRepository(Typeref::class)->find(8);
  8386.             $statutPanier $em->getRepository(Ref::class)->findOneBy(array("libiller" => "creer""typeref" => $typeref));
  8387.             $panierTrace $em->getRepository(Panier::class)->findOneBy(array("creerPar" => $user"statut" => $statutPanier));
  8388.             //fin
  8389.             if ($panierTrace == null) {
  8390.                 $panierTrace = new Panier();
  8391.                 $dateNow = new \Datetime();
  8392.                 $panierTrace->setDateCreation($dateNow);
  8393.                 $panierTrace->setCreerPar($user);
  8394.                 $panierTrace->setStatut($statutPanier);
  8395.                 $em->getManager()->persist($panierTrace);
  8396.                 $em->getManager()->flush();
  8397.             }
  8398.             //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
  8399.             if ($Products == null) {
  8400.                 $Products = [];
  8401.             }
  8402.             if ($Products != null) {
  8403.                 foreach ($Products as $key => $p) {
  8404.                     if ($p['id'] == $produit->getId()) {
  8405.                         $inser true;
  8406.                         $Products[$key]['qte'] = $p['qte'] + 1;
  8407.                         $Products[$key]['mnt'] = $p['mnt'] + $produit->getIdConditionnement()->getMontantTTC();
  8408.                     }
  8409.                 }
  8410.             }
  8411.             //Touhemi 03-07-2020 :Rechercher  si le produti existe déja ds panierProduit
  8412.             $panierProduit $em->getRepository(PanierProduit::class)->findOneBy(array("idProduit" => $produit"idPanier" => $panierTrace));
  8413.             if ($panierProduit == null) {
  8414.                 $panierProduit = new PanierProduit();
  8415.                 $panierProduit->setIdProduit($produit);
  8416.                 $panierProduit->setIdPanier($panierTrace);
  8417.                 $em->getManager()->persist($panierProduit);
  8418.                 $em->getManager()->flush();
  8419.             }
  8420.             //fin
  8421.             //   Touhemi 03-07-2020 ajouter plus un au produit et modifier prixTotal
  8422.             $oldQte $panierProduit->getQuantite();
  8423.             $newQte $oldQte 1;
  8424.             $panierProduit->setQuantite($newQte);
  8425.             $oldTotal $panierProduit->getPrixTotal();
  8426.             $newTotal $oldTotal $produit->getIdConditionnement()->getMontantTTC();
  8427.             $panierProduit->setPrixTotal($newTotal);
  8428.             $em->getManager()->persist($panierProduit);
  8429.             $em->getManager()->flush();
  8430.             //fin
  8431.             if ($inser === false) {
  8432.                 $p = [];
  8433.                 $p["id"] = $produit->getId();
  8434.                 $p["nom"] = $produit->getType()->getLabeletype();
  8435.                 $p["ident"] = $produit->getLabele();
  8436.                 $p["codesejour"] = $produit->getIdsjour()->getcodeSejour();
  8437.                 $p["mnt"] = $produit->getIdConditionnement()->getMontantTTC();
  8438.                 $p["path"] = $produit->getType()->getAttachements()[0]->getIdAttachement()->getPath();
  8439.                 $p["condition"] = $produit->getIdConditionnement()->getId();
  8440.                 $p["qte"] = 1;
  8441.                 array_push($Products$p);
  8442.             }
  8443.             $session->set('Panier'$Products);
  8444.             //sendmail_parent
  8445.             $dateNow = new \Datetime();
  8446.             /** @var \App\Entity\User $user */
  8447.             $user $this->getUser();
  8448.             $userEmail $user->getEmail();
  8449.             $this->EmailServie->SaveMailRelancePanier($userEmail);
  8450.             // $this->EmailServie->MailRelancePanier($userEmail);
  8451.         }
  8452.         return new response('done');
  8453.     }
  8454.     function generateRefPackPhotosNum($idsejour$user)
  8455.     {
  8456.         //photonum_code_sejour_idparent_random;
  8457.         $em $this->em;
  8458.         $date = new \Datetime();
  8459.         $Milliseconde $date->format('dmYhis');
  8460.         $sejour $this->em->getRepository(Sejour::class)->find($idsejour);
  8461.         $ref "photonum_" $sejour->getCodeSejour() . "_" $user->getId() . "_" $Milliseconde;
  8462.         return $ref;
  8463.     }
  8464.     /**
  8465.      * @Route("/downloadpackphotonum/{refcmdnum}", name="downloadpackphotonum",methods={"GET"})
  8466.      */
  8467.     public function downloadpackphotonumAction($refcmdnum)
  8468.     {
  8469.         $tab explode("_"$refcmdnum);
  8470.         if (sizeof($tab) == 4) {
  8471.             $codesejour $tab[1];
  8472.             $iduser $tab[2];
  8473.             $sejour $this->em->getRepository(Sejour::class)->findOneBy(array('codeSejour' => $codesejour));
  8474.             $user $this->em->getRepository(User::class)->find(intval($iduser));
  8475.             if ($user && $sejour) {
  8476.                 $commandenumerique $this->em->getRepository(CommandeNumerique::class)->findOneBy(array('linkdownload' => $refcmdnum));
  8477.                 if ($commandenumerique) {
  8478.                     if ($commandenumerique->getEtat() === 1) {
  8479.                         $commandenumerique->setEtat(2);
  8480.                         $commandenumerique->setDateTelechargement(new \DateTime());
  8481.                         $this->em->getManager()->persist($commandenumerique);
  8482.                         $this->em->getManager()->flush();
  8483.                         $response = new BinaryFileResponse($this->getParameter('kernel.project_dir') . '/public/ParentPhotosNumerique/' $refcmdnum '/' $refcmdnum '.zip');
  8484.                         $response->headers->set('Content-Type'"application/zip");
  8485.                         // Set content disposition inline of the file
  8486.                         $response->setContentDisposition(
  8487.                             ResponseHeaderBag::DISPOSITION_ATTACHMENT,
  8488.                             $refcmdnum '.zip'
  8489.                         );
  8490.                         return $response;
  8491.                     } elseif ($commandenumerique->getEtat() == 2) {
  8492.                         return new JsonResponse(array('message' => 'commande déjà livrée'), 400);
  8493.                     } else {
  8494.                         return new JsonResponse(array('message' => 'commande invalide'), 400);
  8495.                     }
  8496.                 } else {
  8497.                     return new JsonResponse(array('message' => 'commande introuvable'), 400);
  8498.                 }
  8499.             }
  8500.         } else {
  8501.             return new JsonResponse(array('message' => 'lien invalide'), 400);
  8502.         }
  8503.     }
  8504.     /**
  8505.      * @Route("/Parent/showpub" , name="showpub")
  8506.      */
  8507.     public function showpub()
  8508.     {
  8509.         /** @var User $user */
  8510.         $user $this->getUser();
  8511.         if (!$user) {
  8512.             return new JsonResponse(['status' => 'error''message' => 'User not found'], 400);
  8513.         }
  8514.         // Set showpubprod to true
  8515.         $user->setShowpubprod(1);
  8516.         // Save the changes to the database
  8517.         $this->em->getManager()->persist($user);
  8518.         $this->em->getManager()->flush();
  8519.         // Return a success response
  8520.         return new JsonResponse(['status' => 'success']);
  8521.     }
  8522.     /**
  8523.      * @Route("/Parent/Mentionslegales", name="mentionlegale")
  8524.      */
  8525.     public function Mentionslegales()
  8526.     {
  8527.         return $this->render('Parent/footer/mentionlegal.html.twig', []);
  8528.     }
  8529.     /**
  8530.      * @Route("/Parent/Conditongeneral", name="Conditongeneral")
  8531.      */
  8532.     public function Conditongeneral()
  8533.     {
  8534.         return $this->render('Parent/footer/Condition.html.twig', []);
  8535.     }
  8536. }