src/Controller/CdromController.php line 197

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Accueil;
  4. use App\Entity\User;
  5. use UserEntity\Stacks;
  6. use App\Entity\StackTransit;
  7. use App\Entity\StackZones;
  8. use App\Entity\StackCategories;
  9. use App\Entity\StackSequences;
  10. use App\Entity\StackTimer;
  11. use App\Entity\Commentaires;
  12. use App\Entity\Statistiques;
  13. use App\Repository\AccueilRepository;
  14. use App\Repository\UserRepository;
  15. use App\Repository\StacksRepository;
  16. use App\Repository\StackTransitRepository;
  17. use App\Repository\StackZonesRepository;
  18. use App\Repository\StackCategoriesRepository;
  19. use App\Repository\StackSequencesRepository;
  20. use App\Repository\StackTimerRepository;
  21. use App\Repository\CommentairesRepository;
  22. use App\Repository\StatistiquesRepository;
  23. use App\Form\AccueilType;
  24. use App\Form\StackTimerType;
  25. use App\Form\StacksType;
  26. use App\Form\StacksEditType;
  27. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  28. use Symfony\Component\HttpFoundation\Request;
  29. use Symfony\Component\HttpFoundation\Response;
  30. use Symfony\Component\Routing\Annotation\Route;
  31. use Symfony\Component\Mailer\MailerInterface;
  32. use Symfony\Component\Mime\Email;
  33. use Symfony\Component\Mime\Address;
  34. use Symfony\Bridge\Twig\Mime\TemplatedEmail;
  35. use Symfony\Component\HttpFoundation\RedirectResponse;
  36. use Doctrine\ORM\EntityManagerInterface;
  37. use Symfony\Component\String\Slugger\SluggerInterface;
  38. use Symfony\Component\Security\Core\Security;
  39. use Doctrine\Common\Collections\ArrayCollection;
  40. class CdromController extends AbstractController
  41. {
  42.   public $parPage 5;
  43.   private $stacksRepo;
  44.   public function __construct(StatistiquesRepository $statRepoCommentairesRepository $commRepStackCategoriesRepository $catRepStackSequencesRepository $seqRepStackZonesRepository $stackZoneRepoStacksRepository $stacksRepoAccueilRepository $accRepoSluggerInterface $sluggerEntityManagerInterface $em)
  45.   {
  46.     $this->statRepo $statRepo;
  47.     $this->commRep $commRep;
  48.     $this->catRep $catRep;
  49.     $this->seqRep $seqRep;
  50.     $this->stackZoneRepo $stackZoneRepo;
  51.     $this->stacksRepo $stacksRepo;
  52.     $this->accRepo $accRepo;
  53.     $this->slugger $slugger;
  54.     $this->em $em;
  55.   }
  56.   public function mouche($action$id)
  57.   {
  58.     $stat = new Statistiques();
  59.     $macard $this->stacksRepo->find($id);
  60.     $stat->setIp($_SERVER['REMOTE_ADDR']);
  61.     $stat->setOs($_SERVER['HTTP_USER_AGENT']);
  62.     $stat->setAction($action);
  63.     $stat->setCard($macard);
  64.     $stat->setDateCrea(new \DateTime());
  65.     $this->em->persist($stat);
  66.     $this->em->flush();
  67.   }
  68.   /**
  69.   * @Route("/cdromNatif", name="front_cdromBifNatif")
  70.   */
  71.   public function front_cdromBifNatif(): Response
  72.   {
  73.     // recupere la stack
  74.     $stack $this->stacksRepo->find(1);
  75.     // mouche
  76.     $this->mouche("visite""début");
  77.     return $this->render('cdrom/homeNatif.html.twig', [
  78.       'controller_name' => 'front_cdromBifNatif',
  79.       'stack' => $stack,
  80.       'zindex' => 500,
  81.     ]);
  82.   }
  83.   /**
  84.   * @Route("/cdromAgrandi", name="front_cdromBifAgrandi")
  85.   */
  86.   public function front_cdromBifAgrandi(): Response
  87.   {
  88.     // recupere la stack
  89.     $stack $this->stacksRepo->find(1);
  90.     // mouche
  91.     $this->mouche("visite""début");
  92.     return $this->render('cdrom/homeAgrandi.html.twig', [
  93.       'controller_name' => 'front_cdromBifAgrandi',
  94.       'stack' => $stack,
  95.       'zindex' => 500,
  96.     ]);
  97.   }
  98.     // -------------------------------- projo640bif
  99.     /**
  100.     * @Route("/cdromNatif/bif", name="front_cdromNatifBif")
  101.     */
  102.     public function front_cdromNatifBif(): Response
  103.     {
  104.       // recupere la stack
  105.       $stack $this->stacksRepo->find(1);
  106.       // mouche
  107.       $this->mouche("visite""début");
  108.       return $this->render('cdrom/projo640bif/index.html.twig', [
  109.         'controller_name' => 'front_cdromNatifBif',
  110.         'stack' => $stack,
  111.         'zindex' => 500,
  112.       ]);
  113.     }
  114.     /**
  115.     * @Route("/cdromNatif/bif/{id}", name="front_cdrom_640_ciblebif")
  116.     */
  117.     public function cdrom_640Ciblebif($id): Response
  118.     {
  119.       // recupere la stack
  120.       $stack $this->stacksRepo->find($id);
  121.       // mouche
  122.       $this->mouche("visite""début");
  123.       return $this->render('cdrom/projo640bif/index.html.twig', [
  124.         'controller_name' => 'front_cdrom_640_ciblebif',
  125.         'stack' => $stack,
  126.         'zindex' => 500,
  127.       ]);
  128.     }
  129.     // -------------------------------- projo900bif
  130.     /*
  131.     * @Route("/cdrom/bif", name="front_cdromBif")
  132.     public function cdrombif(): Response
  133.     {
  134.       // recupere la stack
  135.       $stack = $this->stacksRepo->find(1);
  136.       // mouche
  137.       $this->mouche("visite", "début");
  138.       return $this->render('cdrom/projo900bif/index.html.twig', [
  139.         'controller_name' => 'front_cdromBif',
  140.         'stack' => $stack,
  141.         'zindex' => 500,
  142.       ]);
  143.     }
  144.     */
  145.     /**
  146.     * @Route("/cdrom/bif/{id}", name="front_cdrom_900_ciblebif")
  147.     */
  148.     public function cdrom_900Ciblebif($id): Response
  149.     {
  150.       // recupere la stack
  151.       $stack $this->stacksRepo->find($id);
  152.       // mouche
  153.       $this->mouche("visite""début");
  154.       return $this->render('cdrom/projo900bif/index.html.twig', [
  155.         'controller_name' => 'front_cdrom_900_ciblebif',
  156.         'stack' => $stack,
  157.         'zindex' => 500,
  158.       ]);
  159.     }
  160.     // -------------------------------- xxxx
  161.     /**
  162.     * @Route("/recupStackProjo2bif", name="projo_stacks_recupStack2bif", methods={"POST"})
  163.     */
  164.     public function recupStackProjo2bif(): Response
  165.     {
  166.       // recupere datas de l'ajax
  167.       $id utf8_decode(htmlspecialchars($_POST["id"]));
  168.       $zindex utf8_decode(htmlspecialchars($_POST["zindex"]));
  169.       $stackSize $_POST["size"];
  170.       $oldStack $_POST["oldStack"];
  171.       $oldRetourBiff $_POST["oldRetourBiff"];
  172.       // recupere l'objet de la stack à afficher
  173.       $stack $this->stacksRepo->find($id);
  174.       dump($stack->getId());
  175.       // mouche
  176.       $this->mouche("visite"$id);
  177.       // recupere les zones
  178.       $mesrolls $this->stackZoneRepo->recupRollOver($stack->getId());
  179.       // recup l'objet de la stack menu index
  180.       if ( $stack->getSsequence()->getNom() == "Index" ){
  181.         $stackMenuIndex $this->stacksRepo->find(92);
  182.       }
  183.       else{
  184.         $stackMenuIndex "0";
  185.       }
  186.       // Navigations
  187.       // recupere la stack de destination du btn nav H
  188.       if ( $stack->getNavH() !== null ) {
  189.           $stackNavH $this->stacksRepo->find($stack->getNavH());
  190.         } else {
  191.           $stackNavH null;
  192.         }
  193.         // recupere la stack de destination du btn nav G
  194.         if ( $stack->getNavG() !== null ) {
  195.           $stackNavG $this->stacksRepo->find($stack->getNavG());
  196.         } else {
  197.           $stackNavG null;
  198.         }
  199.         // recupere la stack de destination du btn nav G
  200.         if ( $stack->getNavD() !== null ) {
  201.           $stackNavD $this->stacksRepo->find($stack->getNavD());
  202.         } else {
  203.           $stackNavD null;
  204.         }
  205.         // recupere la stack de destination du btn nav BG
  206.         if ( $stack->getNavBG() !== null ) {
  207.           $stackNavBG $this->stacksRepo->find($stack->getNavBG());
  208.         } else {
  209.           $stackNavBG null;
  210.         }
  211.         // recupere la stack de destination du btn nav BD
  212.         if ( $stack->getNavBD() !== null ) {
  213.           $stackNavBD $this->stacksRepo->find($stack->getNavBD());
  214.         } else {
  215.           $stackNavBD null;
  216.       }
  217.       dump($stackSize);
  218.       // rendu
  219.       if($stackSize == 640){
  220.         return $this->render('cdrom/projo640bif/divStack.html.twig', [
  221.           'controller_name' => 'projo640_stacks_recupStack2bif',
  222.           'stack' => $stack,
  223.           'stackSize' => $stackSize,
  224.           'mesrolls' => $mesrolls,
  225.           'zindex' => $zindex,
  226.           'oldStack' => $oldStack,
  227.           'oldRetourBiff' => $oldRetourBiff,
  228.           'stackNavH' => $stackNavH,
  229.           'stackNavG' => $stackNavG,
  230.           'stackNavD' => $stackNavD,
  231.           'stackNavBG' => $stackNavBG,
  232.           'stackNavBD' => $stackNavBD,
  233.           'stackMenuIndex' => $stackMenuIndex,
  234.         ]);
  235.       }
  236.       else {
  237.         return $this->render('cdrom/projo900bif/divStack.html.twig', [
  238.           'controller_name' => 'projo900_stacks_recupStack2bif',
  239.           'stack' => $stack,
  240.           'stackSize' => $stackSize,
  241.           'mesrolls' => $mesrolls,
  242.           'zindex' => $zindex,
  243.           'oldStack' => $oldStack,
  244.           'oldRetourBiff' => $oldRetourBiff,
  245.           'stackNavH' => $stackNavH,
  246.           'stackNavG' => $stackNavG,
  247.           'stackNavD' => $stackNavD,
  248.           'stackNavBG' => $stackNavBG,
  249.           'stackNavBD' => $stackNavBD,
  250.           'stackMenuIndex' => $stackMenuIndex,
  251.         ]);
  252.       }
  253.     }
  254.     /**
  255.     * @Route("/recupImgbif", name="front_stacks_recupImgRollo", methods={"POST"})
  256.     */
  257.     public function recupImgFRollo(): Response
  258.     {
  259.       // recupere datas de l'ajax
  260.       $id $_POST["id"];
  261.       $idParent $_POST["idParent"];
  262.       $stackSize $_POST["size"];
  263.       $oldRetourBiff $_POST["oldRetourBiff"];
  264.       // recupere la stack à afficher
  265.       $stack $this->stacksRepo->find($id);
  266.       // mouche
  267.       $this->mouche("rollover"$id);
  268.       // nombre de zones de la stack à afficher
  269.       $mesZones $stack->getZones();
  270.       // recupere les zones
  271.       $mesrolls $this->stackZoneRepo->recupRollOver22($mesZones);
  272.       //$mesrolls = $this->stackZoneRepo->recupRollOver($stack->getZones());
  273.       //$service = $repository->findBy(array('name' => 'Registration'),array('name' => 'ASC'));
  274.       //$mesrolls = $this->stackZoneRepo->findBy(array('name' => 'Registration'), array('name' => 'ASC'));
  275.       //$mesrolls = $this->stackZoneRepo->findBy(array('name' => 'Registration'), array('name' => 'ASC'));
  276.       //$service = $repository->findBy(array('name' => 'Registration'),array('name' => 'ASC'));
  277.       // recupere la zone du parent actif
  278.       $mesrollsParent $this->stackZoneRepo->recupZoneParentActive($idParent$stack->getId());
  279.       //$parent = $this->stacksRepo->find($mesrollsParent->getStacks());
  280.       $parent $this->stacksRepo->find($idParent);
  281.       //
  282.       return $this->render('cdrom/projo900bif/divStack_imageRollo.html.twig', [
  283.         'controller_name' => 'front_stacks_recupImg',
  284.         'stack' => $stack,
  285.         'stackSize' => $stackSize,
  286.         'mesrolls' => $mesrolls,
  287.         'idParent' => $idParent,
  288.         'parent' => $parent,
  289.         'mesrollsParent' => $mesrollsParent,
  290.         'oldRetourBiff' => $oldRetourBiff,
  291.       ]);
  292.     }
  293.     /**
  294.     * @Route("/recupImgbif2", name="front_stacks_recupImgRollo2", methods={"POST"})
  295.     */
  296.     public function recupImgFRollo2(): Response
  297.     {
  298.       // recupere datas de l'ajax
  299.       $id $_POST["id"];
  300.       $idParent $_POST["idParent"];
  301.       $stackSize $_POST["size"];
  302.       // recupere la stack à afficher
  303.       $stack $this->stacksRepo->find($id);
  304.       // mouche
  305.       $this->mouche("rollover2"$id);
  306.       //
  307.       return $this->render('cdrom/projo900bif/divStack_imageRollo2.html.twig', [
  308.         'controller_name' => 'front_stacks_recupImg',
  309.         'stack' => $stack,
  310.         'stackSize' => $stackSize,
  311.       ]);
  312.     }
  313.     /**
  314.     * @Route("/recupImg", name="front_stacks_recupImg", methods={"POST"})
  315.     */
  316.     public function recupImgF(): Response
  317.     {
  318.       // recupere datas de l'ajax
  319.       $id $_POST["id"];
  320.       $stackSize $_POST["size"];
  321.       //dump($stackSize);
  322.       // recupere la stack à afficher
  323.       $stack $this->stacksRepo->find($id);
  324.       // mouche
  325.       $this->mouche("recupImgF"$id);
  326.       //
  327.       return $this->render('cdrom/projo900bif/divStack_imageRollo.html.twig', [
  328.         'controller_name' => 'front_stacks_recupImg',
  329.         'stack' => $stack,
  330.         'stackSize' => $stackSize,
  331.       ]);
  332.     }
  333. }