src/Controller/Admin/PublicController.php line 316

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Admin;
  3. use App\Entity\AppCarteMenuItem;
  4. use App\Entity\AppDeviceToken;
  5. use App\Entity\AppEmail;
  6. use App\Entity\AppGallery;
  7. use App\Entity\AppGroup;
  8. use App\Entity\Configurations;
  9. use App\Entity\CrossApp;
  10. use App\H3\TTControllerTrait;
  11. use App\Repository\AdvertisersRepository;
  12. use App\Repository\AppCarteMenuItemRepository;
  13. use App\Repository\AppCarteMenuRepository;
  14. use App\Repository\AppCarteMenuTypeRepository;
  15. use App\Repository\AppDeviceTokenRepository;
  16. use App\Repository\AppEventRepository;
  17. use App\Repository\AppGalleryRepository;
  18. use App\Repository\AppGroupRepository;
  19. use App\Repository\AppSlidesRepository;
  20. use App\Repository\ConfigurationsRepository;
  21. use App\Repository\CrossAppRepository;
  22. use App\Repository\DancePlaningRepository;
  23. use App\Repository\DanceTypeRepository;
  24. use App\Repository\NotificationPushRepository;
  25. use App\Repository\PagesCarousselRepository;
  26. use App\Repository\PagesRepository;
  27. use App\Services\GoogleReviews;
  28. use App\Services\NotificationPhoto;
  29. use App\Services\Tools;
  30. use Doctrine\ORM\EntityManagerInterface;
  31. use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
  32. use ImalH\PDFLib\PDFLib;
  33. use Symfony\Component\HttpClient\HttpClient;
  34. use Symfony\Component\HttpFoundation\JsonResponse;
  35. use Symfony\Component\HttpFoundation\Request;
  36. use Symfony\Component\HttpFoundation\Response;
  37. use Symfony\Component\Routing\Annotation\Route;
  38. use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
  39. use Symfony\Component\Security\Core\Exception\AccessDeniedException;
  40. use Symfony\Contracts\HttpClient\HttpClientInterface;
  41. class PublicController extends AbstractDashboardController
  42. {
  43.     use TTControllerTrait;
  44.     private static $__forms = [
  45.         "questions" => [
  46.             "I" => [
  47.                 "heading_label" => "VOTRE ACCUEIL AU SEIN DE L’ETABLISSEMENT",
  48.                 "forms" => [
  49.                     [
  50.                         "label" => "La signalisation de l'établissement à l’extérieur",
  51.                         "question_number"  => 1,
  52.                         "custom_response" => false
  53.                     ],[
  54.                         "label" => "Les facilités pour le stationnement",
  55.                         "question_number"  => 2,
  56.                         "custom_response" => false
  57.                     ],[
  58.                         "label" => "La signalisation interne des services",
  59.                         "question_number"  => 3,
  60.                         "custom_response" => false
  61.                     ],[
  62.                         "label" => "L'accueil au niveau des admissions",
  63.                         "question_number"  => 4,
  64.                         "custom_response" => false
  65.                     ],[
  66.                         "label" => "L'accueil dans les services de soins",
  67.                         "question_number"  => 5,
  68.                         "custom_response" => false
  69.                     ],[
  70.                         "label" => "L'accueil au bloc opératoire",
  71.                         "question_number"  => 6,
  72.                         "custom_response" => false
  73.                     ],
  74.                 ]
  75.             ],
  76.             "II" => [
  77.                 "heading_label" => "LES DELAIS D'ATTENTE",
  78.                 "forms" => [
  79.                     [
  80.                         "label" => "Lors de l'admission (entrée...)",
  81.                         "question_number"  => 7,
  82.                         "custom_response" => false
  83.                     ],[
  84.                         "label" => "Lors de la sortie (sortie...)",
  85.                         "question_number"  => 8,
  86.                         "custom_response" => false
  87.                     ],[
  88.                         "label" => "Aux urgences",
  89.                         "question_number"  => 9,
  90.                         "custom_response" => false
  91.                     ],[
  92.                         "label" => "Dans le service d'hospitalisation",
  93.                         "question_number"  => 10,
  94.                         "custom_response" => false
  95.                     ],[
  96.                         "label" => "Au bloc opératoire",
  97.                         "question_number"  => 11,
  98.                         "custom_response" => false
  99.                     ],[
  100.                         "label" => "A la radiologie",
  101.                         "question_number"  => 12,
  102.                         "custom_response" => false
  103.                     ],
  104.                 ]
  105.             ],
  106.             "III" => [
  107.                 "heading_label" => "VOTRE PRISE EN CHARGE DANS LE SERVICE",
  108.                 "forms" => [
  109.                     [
  110.                         "label" => "L'identification du personnel",
  111.                         "question_number"  => 13,
  112.                         "custom_response" => false
  113.                     ],[
  114.                         "label" => "La disponibilité des médecins, infirmières, sages-femmes et autres agents ",
  115.                         "question_number"  => 14,
  116.                         "custom_response" => false
  117.                     ],[
  118.                         "label" => "L'amabilité du personnel",
  119.                         "question_number"  => 15,
  120.                         "custom_response" => false
  121.                     ],[
  122.                         "label" => "La prise en charge de la douleur ",
  123.                         "question_number"  => 16,
  124.                         "custom_response" => false
  125.                     ],[
  126.                         "label" => "L’efficacité du traitement anti-douleur",
  127.                         "question_number"  => 17,
  128.                         "custom_response" => false
  129.                     ],[
  130.                         "label" => "La qualité des soins médicaux",
  131.                         "question_number"  => 18,
  132.                         "custom_response" => false
  133.                     ],[
  134.                         "label" => "La qualité des soins paramédicaux et sociaux (infirmière, aide-soignant, psychologue, kiné, assistante sociale, diététicienne...)",
  135.                         "question_number"  => 19,
  136.                         "custom_response" => false
  137.                     ],[
  138.                         "label" => "La qualité du transport interne (transport par les brancardiers)",
  139.                         "question_number"  => 20,
  140.                         "custom_response" => false
  141.                     ],[
  142.                         "label" => "Avez-vous eu un report d’hospitalisation ou de passage au bloc",
  143.                         "question_number"  => 21,
  144.                         "custom_response" => [
  145.                             'Oui' => 'Oui',
  146.                             'Non' => 'Non'
  147.                         ]
  148.                     ],[
  149.                         "label" => "La qualité des réponses à vos attentes et préoccupations au service maternité",
  150.                         "question_number"  => 22,
  151.                         "custom_response" => false
  152.                     ],[
  153.                         "label" => "La qualité de l’accompagnement à la parentalité (allaitement, soin du cordon, toilette)",
  154.                         "question_number"  => 23,
  155.                         "custom_response" => false
  156.                     ],
  157.                 ]
  158.             ],
  159.             "IV" => [
  160.                 "heading_label" => "VOTRE APPRECIATION SUR L'HEBERGEMENT",
  161.                 "forms" => [
  162.                     'La chambre' => [
  163.                         [
  164.                             "label" => "Le confort de la chambre (toilette, douche literie...)",
  165.                             "question_number"  => 24,
  166.                             "custom_response" => false
  167.                         ],[
  168.                             "label" => "Le calme de la chambre et du service",
  169.                             "question_number"  => 25,
  170.                             "custom_response" => false
  171.                         ],[
  172.                             "label" => "La propreté de la chambre",
  173.                             "question_number"  => 26,
  174.                             "custom_response" => false
  175.                         ],[
  176.                             "label" => "Le fonctionnement des équipements notamment de sécurité (appel malade…)",
  177.                             "question_number"  => 27,
  178.                             "custom_response" => false
  179.                         ],[
  180.                             "label" => "Le respect de votre intimité",
  181.                             "question_number"  => 28,
  182.                             "custom_response" => false
  183.                         ],
  184.                     ]
  185.                     ,'Les repas' => [
  186.                         [
  187.                             "label" => "La qualité des repas",
  188.                             "question_number"  => 29,
  189.                             "custom_response" => false
  190.                         ],[
  191.                             "label" => "La quantité des plats servis",
  192.                             "question_number"  => 30,
  193.                             "custom_response" => false
  194.                         ],[
  195.                             "label" => "La variété des repas",
  196.                             "question_number"  => 31,
  197.                             "custom_response" => false
  198.                         ],[
  199.                             "label" => "La température des repas",
  200.                             "question_number"  => 32,
  201.                             "custom_response" => false
  202.                         ],[
  203.                             "label" => "Les horaires des repas",
  204.                             "question_number"  => 33,
  205.                             "custom_response" => false
  206.                         ],[
  207.                             "label" => "Le respect du régime alimentaire",
  208.                             "question_number"  => 34,
  209.                             "custom_response" => false
  210.                         ],
  211.                     ]
  212.                     ,'Les services' => [
  213.                         [
  214.                             "label" => "Le téléphone et la TV",
  215.                             "question_number"  => 35,
  216.                             "custom_response" => false
  217.                         ],[
  218.                             "label" => "Le service du courrier",
  219.                             "question_number"  => 36,
  220.                             "custom_response" => false
  221.                         ],[
  222.                             "label" => "Le culte",
  223.                             "question_number"  => 37,
  224.                             "custom_response" => false
  225.                         ],[
  226.                             "label" => "La Wifi (accès internet)",
  227.                             "question_number"  => 38,
  228.                             "custom_response" => false
  229.                         ],[
  230.                             "label" => "L’espace de lecture",
  231.                             "question_number"  => 39,
  232.                             "custom_response" => false
  233.                         ]
  234.                     ]
  235.                 ]
  236.             ],
  237.             "V" => [
  238.                 "heading_label" => "VOTRE INFORMATION PENDANT VOTRE SEJOUR",
  239.                 "forms" => [
  240.                     [
  241.                         "label" => "Livret d'accueil remis à votre arrivée",
  242.                         "question_number"  => 40,
  243.                         "custom_response" => [
  244.                             'Oui' => 'Oui',
  245.                             'Non' => 'Non'
  246.                         ]
  247.                     ],[
  248.                         "label" => "Informations données par le médecin (traitement, opération...)",
  249.                         "question_number"  => 41,
  250.                         "custom_response" => false
  251.                     ],[
  252.                         "label" => "Informations sur les bénéfices/risques liés à votre traitement ou intervention",
  253.                         "question_number"  => 42,
  254.                         "custom_response" => false
  255.                     ],[
  256.                         "label" => "Informations données par les paramédicaux sur les soins",
  257.                         "question_number"  => 43,
  258.                         "custom_response" => false
  259.                     ],[
  260.                         "label" => "Informations données à votre famille ou la personne de confiance",
  261.                         "question_number"  => 44,
  262.                         "custom_response" => false
  263.                     ],[
  264.                         "label" => "Informations sur la possibilité de faire une plainte ou une lettre de satisfaction",
  265.                         "question_number"  => 45,
  266.                         "custom_response" => false
  267.                     ]
  268.                 ]
  269.             ],
  270.             "VI" => [
  271.                 "heading_label" => "VOTRE SORTIE",
  272.                 "forms" => [
  273.                     [
  274.                         "label" => "Sur le plan médical (information sur votre traitement, vos prochains rendez-vous...)",
  275.                         "question_number"  => 46,
  276.                         "custom_response" => false
  277.                     ],[
  278.                         "label" => "Sur le plan administratif (bulletin de sortie, formalités permettant la prise en charge financière de votre séjour, récupération de vos dépôts et valeurs...)",
  279.                         "question_number"  => 47,
  280.                         "custom_response" => false
  281.                     ],[
  282.                         "label" => "Formalités de sortie sur le plan médical",
  283.                         "question_number"  => 48,
  284.                         "custom_response" => false
  285.                     ],[
  286.                         "label" => "Formalités de sortie sur le plan administratif",
  287.                         "question_number"  => 49,
  288.                         "custom_response" => false
  289.                     ],
  290.                 ]
  291.             ],
  292.             "VII" => [
  293.                 "heading_label" => "VOTRE OPINION GENERALE",
  294.                 "forms" => [
  295.                     [
  296.                         "label" => "Votre opinion générale",
  297.                         "question_number"  => 50,
  298.                         "custom_response" => false
  299.                     ],
  300.                 ]
  301.             ],
  302.         ],
  303.         "responses" => [
  304.             "Très satisfait(e)" => "Très satisfait(e)",
  305.             "Satisfait(e)" => "Satisfait(e)",
  306.             "Pas du tout satisfait(e)" => "Pas du tout satisfait(e)",
  307.             "Non concerné(e)" => "Non concerné(e)"
  308.         ]
  309.     ];
  310.     /**
  311.      * @Route("/post/send/device/notification", name="route_send_device_notification", methods={"POST"})
  312.      */
  313.     public function send_device_notification(Request $requestCrossAppRepository $crossAppRepositoryEntityManagerInterface $entityManagerAppDeviceTokenRepository  $appDeviceTokenRepository){
  314.         $package  $request->get('pkg');
  315.         if ( null != $package ){
  316.             $app  $crossAppRepository->findOneBy(['app_package_name' => $package]);
  317.             $token  $request->get('token');
  318.             $check  $appDeviceTokenRepository->findOneBy(['app'=>$app'token'=>$token]);
  319.             if ( null == $check ){
  320.                 $entity  = (new AppDeviceToken())->setApp($app);
  321.                 $entity->setToken($request->get('token'));
  322.                 if (null != $request->get("platform")){
  323.                     $entity->setPlatform($request->get("platform"));
  324.                 }
  325.                 $entityManager->persist($entity);
  326.                 $entityManager->flush();
  327.             } else {
  328.                 if (null != $request->get("platform") and null == $check->getPlatform()){
  329.                     $check->setPlatform$request->get("platform") );
  330.                     $entityManager->persist($check);
  331.                     $entityManager->flush();
  332.                 }
  333.             }
  334.             if (null != $request->get("v")){
  335.                 $app->setAppVersion($request->get("v"));
  336.                 $entityManager->persist($app);
  337.                 $entityManager->flush();
  338.             }
  339.         }
  340.         $out  = new \stdClass();
  341.         $out->success true;
  342.         return new JsonResponse($out);
  343.     }
  344.     /**
  345.      * @Route("/send/email", name="route_send_email", methods={"POST"})
  346.      */
  347.     public function send_mail(Request $requestCrossAppRepository $crossAppRepositoryEntityManagerInterface $entityManager){
  348.         $out  = new \stdClass();
  349.         $out->success false;
  350.         /** @var CrossApp|null $app */
  351.         $app  $crossAppRepository->findOneBy(['app_package_name' => $request->get('pkg')]);
  352.         if ( null != $app ){
  353.             // $to  = "rivomanana.dev@gmail.com";
  354.             $to  $app->getContactCoords()[0]->getEmail();
  355.             if ( null != $to ){
  356.                 $headers "Return-Path: Yziapp <webmaster@appadmin.yziapp.com>\r\n";
  357.                 $headers .= "From: Yziapp <webmaster@appadmin.yziapp.com>\r\n";
  358.                 $headers .= "Organization: Yziprod\r\n";
  359.                 $headers .= "MIME-Version: 1.0\r\n";
  360.                 $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
  361.                 $headers .= "X-Priority: 3\r\n";
  362.                 $headers .= "X-Mailer: PHP"phpversion() ."\r\n" ;
  363.                 $start_hospi  = \DateTime::createFromFormat("Y-m-d"$_POST['start_hospi']);
  364.                 $end_hospi  = \DateTime::createFromFormat("Y-m-d"$_POST['end_hospi']);
  365.                 $_POST['start_hospi'] = $start_hospi->format('d/m/Y');
  366.                 $_POST['end_hospi'] = $end_hospi->format('d/m/Y');
  367.                 $send mail($to'Questionnaire de satisfaction App'$this->get('twig')->render('admin/mail.chu.html.twig', [
  368.                     'post' => $_POST,
  369.                     'forms' => self::$__forms
  370.                 ]), $headers);
  371.                 $out->success $send;
  372.                 $app_email  = (new AppEmail())
  373.                     ->setApp($app)
  374.                     ->setEmail('place.holder.email@contet.com')
  375.                     ->setMessage(json_encode($_POST))
  376.                     ->setCreatedAt(new \DateTime());
  377.                 $entityManager->persist($app_email);
  378.                 $entityManager->flush();
  379.             }
  380.         }
  381.         return new JsonResponse($out);
  382.     }
  383.     /**
  384.      * @Route("/get/data", name="route_get_data")
  385.      */
  386.     public function get_data(
  387.         Request $request,
  388.         AppCarteMenuItemRepository $appCarteMenuItemRepository,
  389.         PagesRepository $pagesRepository,
  390.         PagesCarousselRepository $pagesCarousselRepository,
  391.         AppGroupRepository $appGroupRepository,
  392.         CrossAppRepository $crossAppRepository,
  393.         ConfigurationsRepository $configurationsRepository,
  394.         HttpClientInterface $httpClient,
  395.         AppCarteMenuTypeRepository $appCarteMenuTypeRepository,
  396.         NotificationPhoto $notificationPhoto,
  397.         AppCarteMenuRepository $appCarteMenuRepository,
  398.         AppSlidesRepository $slidesRepository,
  399.         AppGalleryRepository $appGalleryRepository,
  400.         DanceTypeRepository $danceTypeRepository,
  401.         DancePlaningRepository $dancePlaningRepository,
  402.         NotificationPushRepository $notificationPushRepository,
  403.         AdvertisersRepository $advertisersRepository,
  404.         AppEventRepository $appEventRepository
  405.     ){
  406.         $out  = new \stdClass();
  407.         $out->data = new \stdClass();
  408.         $out->data->success false;
  409.         /** @var CrossApp|null $app */
  410.         $app  $crossAppRepository->findOneBy(['app_package_name' => $request->get('pkg')]);
  411.         if ( null != $app ){
  412.             $out->data->success true;
  413.             $out->data->sitename $app->getName();
  414.             $out->data->logo  $app->getLogo() ? $this->generateUrl('route_get_app_logo', [
  415.                 'encoded_file_name' => base64_encode($app->getLogo())
  416.             ], UrlGeneratorInterface::ABSOLUTE_URL) : "";
  417.             /** planing */
  418.             $dance_type  $app->getDanceTypes();
  419.             if ( null != $dance_type ){
  420.                 $days  = ["Lundi""Mardi""Mercredi""Jeudi""Vendredi""Samedi""Dimanche"];
  421.                 $out->data->planing_crc = [];
  422.                 foreach ( $dance_type as $item ){
  423.                     if ( $item->getStatus() ){
  424.                         $out->data->planing_crc[$item->getName()] = [];
  425.                         foreach( $days as $day ){
  426.                             $planing_day $dancePlaningRepository->createQueryBuilder('d')
  427.                                 ->select('d.content')
  428.                                 ->andWhere('d.type = :type')
  429.                                 ->andWhere('d.day = :day')
  430.                                 ->setParameters(['day'=>$day'type'=>$item])
  431.                                 ->getQuery()->getResult();
  432.                             if ( is_array($planing_day) and sizeof($planing_day) )
  433.                                 $out->data->planing_crc[$item->getName()][$day] = $planing_day;
  434.                         }
  435.                     }
  436.                 }
  437.                 ksort($out->data->planing_crc);
  438.             }
  439.             /** fb */
  440.             $fb  $app->getAppFbs();
  441.             if ( null != $fb ){
  442.                 $out->data->facebook = new \stdClass();
  443.                 foreach ( $fb as $fb_item ){
  444.                     switch ( $fb_item->getType() ){
  445.                         case 'primary':
  446.                             $out->data->facebook->appId $fb_item->getFbAppId();
  447.                             $out->data->facebook->pageUrl $fb_item->getPageUrl();
  448.                             $out->data->facebook->photo_360 $fb_item->getUrlPhoto360();
  449.                             $out->data->facebook->info $fb_item->getInfo();
  450.                             $out->data->facebook->elfsight_instagram $fb_item->getInstagramElfsight();
  451.                             break;
  452.                         case 'secondary':
  453.                             $out->data->facebook->secondary = [
  454.                                 'appId' => $fb_item->getFbAppId(),
  455.                                 'pageUrl'=> $fb_item->getPageUrl(),
  456.                                 'photo_360'=> $fb_item->getUrlPhoto360(),
  457.                                 'elfsight_instagram' => $fb_item->getInstagramElfsight(),
  458.                                 'info' => $fb_item->getInfo()
  459.                             ];
  460.                             break;
  461.                         default:
  462.                             $out->data->facebook->appId "";
  463.                             $out->data->facebook->pageUrl "";
  464.                             $out->data->facebook->photo_360 "";
  465.                             $out->data->facebook->info "";
  466.                             $out->data->facebook->elfsight_instagram "";
  467.                     }
  468.                 }
  469.             }
  470.             /** about */
  471.             $about  $app->getAppAbouts();
  472.             if ( null != $about ){
  473.                 $out->data->about = new \stdClass();
  474.                 foreach ( $about as $about_item ){
  475.                     switch ( $about_item->getType() ){
  476.                         case 'primary':
  477.                             $out->data->about->image $about_item->getPhoto() ? $this->generateUrl'route_get_photo_about', [
  478.                                 'encoded_file_name' => base64_encode($about_item->getPhoto())
  479.                             ], UrlGeneratorInterface::ABSOLUTE_URL) : "" ;
  480.                             $out->data->about->title $about_item->getTitle();
  481.                             $out->data->about->content $about_item->getContent();
  482.                             break;
  483.                         case 'secondary':
  484.                             $out->data->about->secondary = [
  485.                                 'image' => $about_item->getPhoto() ? $this->generateUrl'route_get_photo_about', [
  486.                                     'encoded_file_name' => base64_encode($about_item->getPhoto())
  487.                                 ], UrlGeneratorInterface::ABSOLUTE_URL) : "",
  488.                                 'title'=> $about_item->getTitle(),
  489.                                 'content'=> $about_item->getContent()
  490.                             ];
  491.                             break;
  492.                         default:
  493.                             $out->data->about->image "";
  494.                             $out->data->about->title "";
  495.                             $out->data->about->content "";
  496.                     }
  497.                 }
  498.             }
  499.             /** carte-menus */
  500.             //$carteMenus   = $app->getAppCarteMenus();
  501.             $carteMenus   $appCarteMenuRepository->findBy(["app" => $app], ["id" => "DESC"]);
  502.             if ( null != $carteMenus ){
  503.                 usort($carteMenus, function ($start$end){
  504.                     $start_ordering null == $start->getOrdering() ? 90000 $start->getOrdering();
  505.                     $end_ordering null == $end->getOrdering() ? 90000 $end->getOrdering();
  506.                     return $start_ordering $end_ordering ? -1;
  507.                 });
  508.                 $out->data->carte_menus = new \stdClass();
  509.                 $out->data->carte_menus->cardsData = [];
  510.                 $option_menu_multi = [];
  511.                 foreach ($this->getParameter('carte_multiple') as $package_name => $props){
  512.                     $item_type = [];
  513.                     foreach ($props as $k=>$v){
  514.                         foreach ($v as $_v)
  515.                             $item_type[$_v] = $_v;
  516.                     }
  517.                     $option_menu_multi[array_keys($props)[0]] = $item_type;
  518.                 }
  519.                 /*foreach ( $carteMenus as $carteMenu ){
  520.                     if ( isset($option_menu_multi[$app->getAppPackageName()]) ){
  521.                         $out->data->carte_menus->cardsData->{$carteMenu->getType()} = [];
  522.                     }
  523.                 }*/
  524.                 $hack_separator '~';
  525.                 foreach ( $carteMenus as $carteMenu ){
  526.                     /*if ( $carteMenu->getId() != 55 )
  527.                         continue;*/
  528.                     if ( true == $carteMenu->getStatus() ){
  529.                         $item  = new \stdClass();
  530.                         $item->label  $carteMenu->getTitle();
  531.                         $item->__id $carteMenu->getId();
  532.                         $item->photo "https://appadmin.yziapp.com/" 'images/cross.app.carte.menu.image/' $carteMenu->getPhoto();
  533.                         $item->content  =new \stdClass();
  534.                         $item->content->items = [];
  535.                         $item->content->has_categories false;
  536.                         if ( null != $carteMenu->getAppCarteMenuItems() ){
  537.                             $cartes_menus $appCarteMenuItemRepository->findBy(['carte'=>$carteMenu], ['ordering' => "ASC"]);
  538.                             usort($cartes_menus, function ($start$end){
  539.                                 $start_ordering null == $start->getOrdering() ? 90000 $start->getOrdering();
  540.                                 $end_ordering null == $end->getOrdering() ? 90000 $end->getOrdering();
  541.                                 return $start_ordering $end_ordering ? -1;
  542.                             });
  543.                             $categorized = [];
  544.                             $temp_categorized = [];
  545.                             $uncategorized  = [];
  546.                             foreach ($cartes_menus as $appCarteMenuItem){
  547.                                 if ( true == $appCarteMenuItem->getStatus() ){
  548.                                     if ( null == $appCarteMenuItem->getType() ){
  549.                                         $uncategorized[] = $appCarteMenuItem;
  550.                                     } else {
  551.                                         $ordering__ null != $appCarteMenuItem->getType()->getOrdering() ? (int)$appCarteMenuItem->getType()->getOrdering() : 90000;
  552.                                         $temp_categorized[$appCarteMenuItem->getType()->getName().$hack_separator.$ordering__.$hack_separator.(int)$appCarteMenuItem->getType()->getId()][] = $appCarteMenuItem;
  553.                                     }
  554.                                 }
  555.                             }
  556.                             if ( sizeof($temp_categorized) ){
  557.                                 $item->content->has_categories true;
  558.                                 $temp_srt = [];
  559.                                 foreach ( $temp_categorized as $__k => $i_c ){
  560.                                     list($name$ordering$id) = explode($hack_separator$__k);
  561.                                     $temp_srt[$id] = (int)$ordering;
  562.                                 }
  563.                                 asort($temp_srt);
  564.                                 foreach ( $temp_srt as $id_type => $ordering ){
  565.                                     $type $appCarteMenuTypeRepository->find($id_type);
  566.                                     $ordering__ null == $type->getOrdering() ? 90000 : (int)$type->getOrdering();
  567.                                     if ( $type ){
  568.                                         $key   $type->getName() . $hack_separator $ordering__$hack_separator $type->getId();
  569.                                         $categorized[$type->getName()] = $temp_categorized[$key];
  570.                                     }
  571.                                 }
  572.                             }
  573.                             /** if without category */
  574.                             if ( sizeof$uncategorized ) ){
  575.                                 if ( false == $item->content->has_categories ){
  576.                                     /** @var AppCarteMenuItem $menuItem */
  577.                                     foreach ( $uncategorized as $menuItem ){
  578.                                         $item->content->items[] = [
  579.                                             "photo" => $this->generateUrl('route_get_photo_carte_menu', ['encoded_file_name' => base64_encode($menuItem->getPhoto())], UrlGeneratorInterface::ABSOLUTE_URL),
  580.                                             "title" => $menuItem->getName(),
  581.                                             "brand" => null == $menuItem->getAppCarteMenuBrand() ? "" $menuItem->getAppCarteMenuBrand()->getName(),
  582.                                             "description" => nl2br($menuItem->getDescription()),
  583.                                             "price" => number_format($menuItem->getPrice(), 2','' ')
  584.                                         ];
  585.                                     }
  586.                                 } else {
  587.                                     $items_u = [
  588.                                         "category" => "",
  589.                                         "catgory_items" => []
  590.                                     ];
  591.                                     /** @var AppCarteMenuItem $menuItem */
  592.                                     foreach ( $uncategorized as $menuItem ){
  593.                                         if ( true == $menuItem->getStatus() ){
  594.                                             $items_u["catgory_items"][] = [
  595.                                                 "photo" => $this->generateUrl('route_get_photo_carte_menu', ['encoded_file_name' => base64_encode($menuItem->getPhoto())], UrlGeneratorInterface::ABSOLUTE_URL),
  596.                                                 "title" => $menuItem->getName(),
  597.                                                 "brand" => null == $menuItem->getAppCarteMenuBrand() ? "" $menuItem->getAppCarteMenuBrand()->getName(),
  598.                                                 "description" => $menuItem->getDescription(),
  599.                                                 "price" => number_format($menuItem->getPrice(), 2','' ')
  600.                                             ];
  601.                                         }
  602.                                     }
  603.                                     $item->content->items[] = $items_u;
  604.                                 }
  605.                             }
  606.                             /** if categorized */
  607.                             if ( sizeof$categorized ) ){
  608.                                 /** @var AppCarteMenuItem[] $menuItems */
  609.                                 foreach ( $categorized as $category_name => $menuItems ){
  610.                                     $items = [
  611.                                         "category" => $category_name,
  612.                                         "catgory_items" => []
  613.                                     ];
  614.                                     foreach ( $menuItems as $menuItem ){
  615.                                         if ( true == $menuItem->getStatus() ){
  616.                                             $items["catgory_items"][] = [
  617.                                                 "photo" => $this->generateUrl('route_get_photo_carte_menu', ['encoded_file_name' => base64_encode($menuItem->getPhoto())], UrlGeneratorInterface::ABSOLUTE_URL),
  618.                                                 "title" => $menuItem->getName(),
  619.                                                 "brand" => null == $menuItem->getAppCarteMenuBrand() ? "" $menuItem->getAppCarteMenuBrand()->getName(),
  620.                                                 "description" => $menuItem->getDescription(),
  621.                                                 "price" => number_format($menuItem->getPrice(), 2','' ')
  622.                                             ];
  623.                                         }
  624.                                     }
  625.                                     $item->content->items[] = $items;
  626.                                 }
  627.                             }
  628.                         }
  629.                         if ( isset($option_menu_multi[$app->getAppPackageName()]) ){
  630.                             $out->data->carte_menus->cardsData[$carteMenu->getType()][] = $item;
  631.                         } else
  632.                             $out->data->carte_menus->cardsData[] = $item;
  633.                     }
  634.                 }
  635.             }
  636.             /** map_api_key */
  637.             $map_api_key  $app->getMapApiKey();
  638.             $out->data->map_api_key $map_api_key;
  639.             /** itineraire */
  640.             $itineraire  $app->getAppItineraires();
  641.             if ( null != $itineraire ){
  642.                 foreach ( $app->getAppItineraires() as $item_itineraire ){
  643.                     switch ( $item_itineraire->getType() ){
  644.                         case 'primary':
  645.                             $out->data->itineraire = [
  646.                                 "center" => ["lat" => $item_itineraire->getCenterLat(), "long" => $item_itineraire->getCenterLong()],
  647.                                 "addr" => $item_itineraire->getMapAddress(),
  648.                                 "iframe" => $item_itineraire->getLinkIframe()
  649.                             ];
  650.                             break;
  651.                         case 'secondary':
  652.                             $out->data->itineraire['secondary'] = [
  653.                                 "center" => ["lat" => $item_itineraire->getCenterLat(), "long" => $item_itineraire->getCenterLong()],
  654.                                 "addr" => $item_itineraire->getMapAddress(),
  655.                                 "iframe" => $item_itineraire->getLinkIframe()
  656.                             ];
  657.                             break;
  658.                         default:
  659.                             $out->data->itineraire = [
  660.                                 "center" => ["lat" => null"long" => null],
  661.                                 "addr" => null
  662.                             ];
  663.                     }
  664.                 }
  665.                 /*$out->data->itineraire = [
  666.                     "center" => [
  667.                         'lat' => null != $itineraire[0] ? $itineraire[0]->getCenterLat() : "",
  668.                         'long' => null != $itineraire[0] ? $itineraire[0]->getCenterLong() : ""
  669.                     ],
  670.                     "addr" => null != $itineraire[0] ? $itineraire[0]->getMapAddress() : ""
  671.                 ];*/
  672.             } else
  673.                 $out->data->itineraire = [];
  674.             /** contact */
  675.             $contact  $app->getContactCoords();
  676.             if ( null != $contact ){
  677.                 foreach ( $contact as $contact_item ){
  678.                     switch ( $contact_item->getType() ){
  679.                         case 'primary':
  680.                             $out->data->contact = [
  681.                                 "contact_photo" => $contact_item->getPhoto() ? $this->generateUrl('route_get_get_photo_contact', [
  682.                                     'encoded_file_name' => base64_encode($contact_item->getPhoto())
  683.                                 ], UrlGeneratorInterface::ABSOLUTE_URL) : "",
  684.                                 "contact_data" => [
  685.                                     "coords" => [
  686.                                         "phone" => $contact_item->getPhone(),
  687.                                         "phone_secondary" => $contact_item->getPhoneHome(),
  688.                                         "adress" => $contact_item->getAddress(),
  689.                                         "info" => nl2br($contact_item->getInfo()),
  690.                                         "email" => $contact_item->getEmail()
  691.                                     ]
  692.                                 ]
  693.                             ];
  694.                             if ( Tools::isTwoShop($this->get('parameter_bag'), $app->getAppPackageName()) ){
  695.                                 $out->data->contact['bb_photo_contact'] = $contact_item->getBbPhotoContact() ? $this->generateUrl('route_get_get_photo_contact', [
  696.                                     'encoded_file_name' => base64_encode($contact_item->getBbPhotoContact())
  697.                                 ], UrlGeneratorInterface::ABSOLUTE_URL) : "";
  698.                             }
  699.                             break;
  700.                         case 'secondary':
  701.                             if ( null != $contact_item->getPhone()
  702.                                 or null != $contact_item->getAddress()
  703.                                 or null != $contact_item->getInfo()
  704.                                 or null != $contact_item->getEmail()
  705.                             ) {
  706.                                 $out->data->contact['secondary'] = [
  707.                                     "contact_photo" => $contact_item->getPhoto() ? $this->generateUrl('route_get_get_photo_contact', [
  708.                                         'encoded_file_name' => base64_encode($contact_item->getPhoto())
  709.                                     ], UrlGeneratorInterface::ABSOLUTE_URL) : "",
  710.                                     "contact_data" => [
  711.                                         "coords" => [
  712.                                             "phone" => $contact_item->getPhone(),
  713.                                             "adress" => $contact_item->getAddress(),
  714.                                             "phone_secondary" => $contact_item->getPhoneHome(),
  715.                                             "info" => $contact_item->getInfo(),
  716.                                             "email" => $contact_item->getEmail()
  717.                                         ]
  718.                                     ]
  719.                                 ];
  720.                             }
  721.                             break;
  722.                         default:
  723.                             $out->data->contact = [
  724.                                 "contact_photo" => "",
  725.                                 "contact_data" => [
  726.                                     "coords" => [
  727.                                         "phone" => "",
  728.                                         "adress" => "",
  729.                                         "info" => "",
  730.                                         "email" => ""
  731.                                     ]
  732.                                 ]
  733.                             ];
  734.                     }
  735.                 }
  736.             } else
  737.                 $out->data->contact = [];
  738.             /** gallery_photos */
  739.             //$galleries = $app->getAppGalleries();
  740.             $galleries $appGalleryRepository->getGallery$app );
  741.             if ( null != $galleries ){
  742.                usort($galleries, function (AppGallery $startAppGallery $end){
  743.                     $start_ordering null == $start->getOrdering() ? 90000 $start->getOrdering();
  744.                     $end_ordering null == $end->getOrdering() ? 90000 $end->getOrdering();
  745.                     return $start_ordering $end_ordering ? -1;
  746.                 });
  747.                 foreach ( $galleries as $gallery ){
  748.                     $photo  $this->getParameter('kernel.project_dir') . '/public/images/cross.app.gallery/' $gallery->getPhoto();
  749.                     if ( file_exists($photo) ){
  750.                         list($width$height$type$attr) = getimagesize($photo);
  751.                         //$divisor = \gmp_intval( \gmp_gcd( $width, $height ) );
  752.                         $out->data->gallery_photos[] = [
  753.                             "src" => $this->generateUrl('route_get_photo_gallery', [
  754.                                 'encoded_file_name' => base64_encode($gallery->getPhoto())
  755.                             ], UrlGeneratorInterface::ABSOLUTE_URL),
  756.                             "width" => $width/*/$divisor*/,
  757.                             "group" => $gallery->getAppGroup(),
  758.                             "height" => $height/*/$divisor*/
  759.                         ];
  760.                     }
  761.                 }
  762.             } else
  763.                 $out->data->gallery_photos = [];
  764.             /** events */
  765.            // $events = $app->getAppEvents();
  766.             $events $appEventRepository->findBy(['app'=>$app], ['date' => 'ASC']);
  767.             if ( null != $events ){
  768.                 $event_lists = [];
  769.                 foreach ($events as $event){
  770.                     if ( true == $event->getStatus() /*$event->getDate() >= new \DateTime()*/ ){
  771.                         $event_lists[] = [
  772.                             "photo" => $event->getPhoto() ? $this->generateUrl('route_get_photo_event', [
  773.                                 'encoded_file_name' => base64_encode($event->getPhoto())
  774.                             ], UrlGeneratorInterface::ABSOLUTE_URL) : null,
  775.                             "content" => $event->getContent(),
  776.                             "date" => $event->getDate()->format("d-m-Y H:i"),
  777.                         ];
  778.                     }
  779.                 }
  780.                 $out->data->events $event_lists;
  781.             } else
  782.                 $out->data->events = [];
  783.             /** formations */
  784.             $formations $app->getFormations();
  785.             if ( null != $formations ){
  786.                 foreach ($formations as $formation){
  787.                     $photo  $this->getParameter('kernel.project_dir') . '/public/images/cross.app.formations/' $formation->getPhoto();
  788.                     list($width$height$type$attr) = getimagesize($photo);
  789.                     //$divisor = \gmp_intval( \gmp_gcd( $width, $height ) );
  790.                     $out->data->formations[] = [
  791.                         "photo" => $this->generateUrl('route_get_photo_formation', [
  792.                             'encoded_file_name' => base64_encode($formation->getPhoto())
  793.                         ], UrlGeneratorInterface::ABSOLUTE_URL),
  794.                         "width" => $width/*/$divisor*/,
  795.                         "name" => $formation->getName(),
  796.                         "description" => $formation->getDescription(),
  797.                         "category" => $formation->getCategory(),
  798.                         "height" => $height/*/$divisor*/
  799.                     ];
  800.                 }
  801.             } else
  802.                 $out->data->formations = [];
  803.             /** slides */
  804.             //$slides  = $app->getAppSlides();
  805.             $slides  $slidesRepository->findBy(['app'=>$app,'status'=>true], ['ordering'=>'ASC']);
  806.             if ( null != $slides ){
  807.                 usort($slides, function ($start$end){
  808.                     $start_ordering null == $start->getOrdering() ? 90000 $start->getOrdering();
  809.                     $end_ordering null == $end->getOrdering() ? 90000 $end->getOrdering();
  810.                     return $start_ordering $end_ordering ? -1;
  811.                 });
  812.                 foreach ( $slides as $slide ){
  813.                     $out->data->slides[] = [
  814.                         $this->generateUrl('route_get_photo_slides', [
  815.                             'encoded_file_name' => base64_encode($slide->getPhoto())
  816.                         ], UrlGeneratorInterface::ABSOLUTE_URL)
  817.                     ];
  818.                 }
  819.             } else
  820.                 $out->data->slides  = [];
  821.             /** shop_url */
  822.             $out->data->shop_url $app->getShopUrl();
  823.             $out->data->secondary_shop_url $app->getShopSecondaryUrl();
  824.             $out->data->rdv_url $app->getRdvUrl();
  825.             $out->data->secondary_rdv_url $app->getRdvSecondaryUrl();
  826.             /** notifications */
  827.             //$notifications = $app->getNotificationPushes();
  828.             $notifications $notificationPushRepository->findBy(['app' => $app],  ['created_at' => 'DESC']);
  829.             if ( null != $notifications and sizeof($notifications) ){
  830.                 foreach ( $notifications as $notification ){
  831.                     $photo_file $notification->getPhoto();
  832.                     $extension pathinfo$photo_filePATHINFO_EXTENSION );
  833.                     $is_video in_array$extension, ['mp4''webm''ogg''mov''avi''mkv'] );
  834.                     if ( in_array$extension, ['png''jpg''jpeg''gif''bmp''svg''webp'] ) ){
  835.                         $photo $notificationPhoto->getPhoto($notification->getPhoto());
  836.                     } else {
  837.                         $photo $notificationPhoto->getPhoto($notification->getPhotoVideo());
  838.                     }
  839.                     $out->data->notifications[] = [
  840.                         "id" => $notification->getId(),
  841.                         "title" => $notification->getTitle(),
  842.                         "body" => $notification->getDescription(),
  843.                         "seen" => $notification->getSeen(),
  844.                         "photo" => $photo,
  845.                         "is_video" => $is_video,
  846.                         "video_file" => $notificationPhoto->getPhoto$notification->getPhoto() ),
  847.                         "date" => $notification->getCreatedAt()->format("d/m/Y")
  848.                     ];
  849.                 }
  850.             } else
  851.                 $out->data->notifications = [];
  852.             /** ratings */
  853.             $gr  = new GoogleReviews($app->getGooglePlaceId(),   (null != $app->getMapApiKey() ? $app->getMapApiKey() : 'AIzaSyALsd4b_E60Ki2_dT7i8aTerg6ZalCjyOE'), $httpClient);
  854.             $out->data->ratings $gr->getReviews();
  855.             $out->data->ratings_secondary = (new GoogleReviews($app->getPlaceIdSecondary(), (null != $app->getMapApiKey() ? $app->getMapApiKey() : 'AIzaSyALsd4b_E60Ki2_dT7i8aTerg6ZalCjyOE'), $httpClient))
  856.              ->getReviews();
  857.             /** yziapp */
  858.             /** @var Configurations|null $title_about */
  859.             $title_about $configurationsRepository->findOneBy(['config_key' => 'about_title']);
  860.             /** @var Configurations|null $title_about */
  861.             $content_about $configurationsRepository->findOneBy(['config_key' => 'about_content']);
  862.             $out->data->yziapp = [
  863.                 "title" => null != $title_about $title_about->getConfigValue() : '-',
  864.                 "content" => null != $content_about $content_about->getConfigValue() : '-'
  865.             ];
  866.             /** uber */
  867.             $out->data->uber_url  $app->getUberUrl();
  868.             /** rvd on/off */
  869.             $out->data->use_booking null == $app->getUseBooking() ? true : !$app->getUseBooking();
  870.             /** inwood */
  871.             /*$out->data->_360_inwood = "com.yziapp.seco.bois" == $app->getAppPackageName() ?
  872.                 (null != $configurationsRepository->findOneBy(['config_key' => 'urlPhoto360_secondary_'.$app->getAppPackageName()])
  873.                     ? $configurationsRepository->findOneBy(['config_key' => 'urlPhoto360_secondary_'.$app->getAppPackageName()])->getConfigValue() : null )
  874.                 : null;*/
  875.             /** group */
  876.             if ( isset($this->getParameter('app_with_group')[$app->getAppPackageName()]) ){
  877.                 $out->data->group = [];
  878.                 foreach ( $this->getParameter('app_with_group')[$app->getAppPackageName()] as $k => $v ){
  879.                     $fields = [
  880.                         'title''content''place-id''facebook''logo''shop_url''email''adress''phone''mobile_phone''horaire',
  881.                         'lat''lng''map_adress''iframe_map''photo_360'
  882.                     ];
  883.                     foreach ( $fields as $field ){
  884.                         $check  $appGroupRepository->findOneBy(['name'=>$k'field' => md5($app->getId()).'-'.$field]);
  885.                         if ( "logo" == $field ){
  886.                             $out->data->group[$k][$field] = (null != $check and $check instanceof AppGroup and null != $check->getValue()) ? 'https://appadmin.yziapp.com/images/app.logo.group/'.$check->getValue() : '';
  887.                         } else if ("place-id" == $field){
  888.                             $out->data->group[$k][$field] = null != $check $check->getValue() : '';
  889.                             $google_review = new GoogleReviews((null != $check $check->getValue() : ''),   (null != $app->getMapApiKey() ? $app->getMapApiKey() : 'AIzaSyALsd4b_E60Ki2_dT7i8aTerg6ZalCjyOE'), $httpClient);
  890.                             $out->data->group[$k]['ratings'] = $google_review->getReviews();
  891.                         } else
  892.                             $out->data->group[$k][$field] = null != $check $check->getValue() : '';
  893.                     }
  894.                     $out->data->group[$k]['group_name'] = $v;
  895.                 }
  896.             }
  897.             /** question_responses */
  898.             if ( in_array($app->getAppPackageName(), array_keys($this->getParameter('with_qr'))) ){
  899.                 $out->data->qr = [];
  900.                 foreach ( $app->getQuestionResponses() as $questionResponse ){
  901.                     $out->data->qr[] = [
  902.                         'title' => $questionResponse->getQuestion(),
  903.                         'content' => $questionResponse->getResponse()
  904.                     ];
  905.                 }
  906.             }
  907.             /** annonceurs */
  908.             $out->data->advertiser = [];
  909.             foreach ( $advertisersRepository->findBy(['app' => $app]) as $advertiser ){
  910.                 $item = [
  911.                     'name' => $advertiser->getName(),
  912.                     'link' => $advertiser->getLink(),
  913.                     'photo' => $request->getSchemeAndHttpHost() . '/public/images/chu.advertiser/' $advertiser->getPhoto(),
  914.                     'display_in_home' => $advertiser->getShowInIndex(),
  915.                     'description' => $advertiser->getDescription(),
  916.                     'chu' => json_decode($advertiser->getChu(), true)
  917.                 ];
  918.                 $out->data->advertiser[] = $item;
  919.             }
  920.             /** page galleries */
  921.             if ( in_array($app->getAppPackageName(), $this->getParameter('with_pages')) ){
  922.                 $out->data->pages = [];
  923.                 foreach ( $pagesRepository->findBy(['cross_app' => $app]) as $page ){
  924.                     if ( $page->getWithBuilder() ){
  925.                         $file $request->getSchemeAndHttpHost() . '/public/html-iframe/page-'.$app->getId().'-'.$page->getId().'.html?_='.md5(time());
  926.                         $content '<iframe frameborder="0" height="900px" scrolling="yes" src="'.$file.'" width="100%"></iframe>';
  927.                     } else
  928.                         $content $page->getContent();
  929.                     $item  = [];
  930.                     $item['title'] = $page->getTitle();
  931.                     $item['id'] = $page->getId();
  932.                     $item['description'] = $page->getDescription();
  933.                     $item['facebook_link'] = $page->getFacebookPageUrl();
  934.                     $item['chu_address'] = $page->getChuAddress();
  935.                     $item['coordonnes'] = $page->getCoordonnes();
  936.                     $item['map'] = [
  937.                         'lat' => $page->getLatitude(),
  938.                         'lng'  => $page->getLongitude(),
  939.                         'latlong' => $page->getLatLng(),
  940.                         'adress' => $page->getAddress()
  941.                     ];
  942.                     $item['phone'] = $page->getPhone();
  943.                     $item['type'] = $page->getType();
  944.                     $item['website'] = $page->getWebsite();
  945.                     $item['email'] = $page->getEmail();
  946.                     $item['file'] = (null != $page->getAttachment() or "" != $page->getAttachment()) ? $this->generateUrl('route_get_page_file', ['encoded_file_name' => base64_encode($page->getAttachment())], UrlGeneratorInterface::ABSOLUTE_URL) : "";
  947.                     //$item['file'] = null != $page->getAttachment() ? $request->getSchemeAndHttpHost() . '/public/files/page.attachment/' . $page->getAttachment() : "";
  948.                     $item['content'] = $content;
  949.                     $item['galleries'] = [];
  950.                     foreach ( $pagesCarousselRepository->findBy(['page' => $page], ['ordering' => 'ASC']) as $pagesCaroussel ){
  951.                         $item['galleries'][] = [
  952.                             'photo' => $this->generateUrl('route_get_pages_n_slides', ['encoded_file_name' => base64_encode($pagesCaroussel->getPhoto())], UrlGeneratorInterface::ABSOLUTE_URL),
  953.                             'link'  => $pagesCaroussel->getLink()
  954.                         ];
  955.                     }
  956.                     $out->data->pages[$page->getSlug()] = $item;
  957.                 }
  958.             }
  959.             if ( "com.yziapp.vahiana.spa" == $app->getAppPackageName() ){
  960.                 $out->data->disable_booking_android false;
  961.             }
  962.             if ( "com.yziapp.chu.martinique" == $app->getAppPackageName() ){
  963.                 $out->data->questions_forms self::$__forms;
  964.             }
  965.             $out->data->hash  md5(json_encode($out));
  966.         }
  967.         $response  = new Response(json_encode($out));
  968.         $response->setStatusCode(200);
  969.         $response->headers->set('Content-Type''application/json; charset=UTF-8');
  970.         $response->headers->set('Access-Control-Allow-Origin''*');
  971.         $response->headers->set('Access-Control-Allow-Methods''OPTIONS,GET,POST,PUT,DELETE');
  972.         $response->headers->set('Access-Control-Max-Age'3600);
  973.         $response->headers->set('Access-Control-Allow-Headers'"Content-Type, x-xsrf-token");
  974.         $response->headers->set('Access-Control-Allow-Headers'"Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");
  975.         return $response;
  976.     }
  977.     /**
  978.      * @Route("/get/menus/uber-eats", methods={"GET"})
  979.      */
  980.     public function uber_eats_menu(){
  981.         $client HttpClient::create();
  982.         $bearerToken 'IA.VUNmGAAAAAAAEgASAAAABwAIAAwAAAAAAAAAEgAAAAAAAAGwAAAAFAAAAAAADgAQAAQAAAAIAAwAAAAOAAAAhAAAABwAAAAEAAAAEAAAABc_Q4ZlmVpCladCj_JnpBxfAAAAv8MaCyQHNMXKrC3-dTkHmvAWjTrlNZ0N7Dp6EIlZwlDfmvq8eYITT6bPDxZAsQ4ukLPcPf-cIcqvrXTnioauDfc63UE8FKSHiZ7tTxpGWZXltFRv9sbs4Rbb7brvt7oADAAAACRClmLOFkFhdLSInCQAAABiMGQ4NTgwMy0zOGEwLTQyYjMtODA2ZS03YTRjZjhlMTk2ZWU';
  983.         $out = new \stdClass();
  984.         $out->success false;
  985.         $apiUrl 'https://api.uber.com/v2/eats/stores/99bba954-b618-4b2d-853f-93e7b7d5b0b9/menus';
  986.         try {
  987.             // Faire la requête GET avec les headers
  988.             $response $client->request('GET'$apiUrl, [
  989.                 'headers' => [
  990.                     'Authorization' => 'Bearer ' $bearerToken,
  991.                     'Accept'        => 'application/json'// Optionnel selon l'API
  992.                 ],
  993.             ]);
  994.             // Récupérer le statut de la réponse
  995.             $statusCode $response->getStatusCode();
  996.             // Récupérer le contenu en JSON (si l'API retourne du JSON)
  997.             $content $response->toArray();
  998.             // ou en string si ce n'est pas du JSON : $content = $response->getContent();
  999.             $out->data    $content;
  1000.             $out->success true;
  1001.         } catch (\Exception $e) {
  1002.             // Gérer les erreurs
  1003.             $out->message $e->getMessage();
  1004.         }
  1005.         return new JsonResponse$out );
  1006.     }
  1007.     /**
  1008.      *  @Route("/get/cs/log", methods={"GET"})
  1009.      */
  1010.     public function display_log(){
  1011.         $file  $this->getParameter('kernel.project_dir') . '/log.json';
  1012.         if ( !file_exists$file ) )
  1013.             file_put_contents($filejson_encode([]));
  1014.         $content  json_decode(file_get_contents($file),true);
  1015.         $response  = new Response(implode("\n",$content), 200);
  1016.         $response->headers->set('Content-Type''text/plain');
  1017.         return $response;
  1018.     }
  1019.     /**
  1020.      *  @Route("/put/cs/log", methods={"POST"})
  1021.      */
  1022.     public function custom_log(Request $request){
  1023.         $log  $request->get('log');
  1024.         $file  $this->getParameter('kernel.project_dir') . '/log.json';
  1025.         if ( !file_exists$file ) )
  1026.             file_put_contents($filejson_encode([]));
  1027.         $content  json_decode(file_get_contents($file),true);
  1028.         $content[] = (new \DateTime('now'))->format('d-m-Y H:i:s') . ' ---->> ' $log;
  1029.         file_put_contents($filejson_encode($content));
  1030.         return new JsonResponse([]);
  1031.     }
  1032.     /**
  1033.      *  @Route("/get/page/photo/{encoded_file_name}", name="route_get_pages_n_slides")
  1034.      */
  1035.     public function get_pages_slides($encoded_file_name){
  1036.         $dir  $this->getParameter('kernel.project_dir') . '/public/images/page_caroussel/'base64_decode$encoded_file_name );
  1037.         if ( !file_exists$dir ) )
  1038.             throw new AccessDeniedException('file not found');
  1039.         $response  = new Response(file_get_contents($dir));
  1040.         $response->setStatusCode(200)
  1041.             ->headers->set('Content-Type''image/'.pathinfo($dirPATHINFO_EXTENSION));
  1042.         return $response;
  1043.     }
  1044.     /**
  1045.      *  @Route("/get/slide/photo/{encoded_file_name}", name="route_get_photo_slides")
  1046.      */
  1047.     public function get_photo_slides($encoded_file_name){
  1048.         $dir  $this->getParameter('kernel.project_dir') . '/public/images/cross.app.slide/'base64_decode$encoded_file_name );
  1049.         if ( !file_exists$dir ) )
  1050.             throw new AccessDeniedException('file not found');
  1051.         $response  = new Response(file_get_contents($dir));
  1052.         $response->setStatusCode(200)
  1053.             ->headers->set('Content-Type''image/'.pathinfo($dirPATHINFO_EXTENSION));
  1054.         return $response;
  1055.     }
  1056.     /**
  1057.      *  @Route("/get/page/file/{encoded_file_name}", name="route_get_page_file")
  1058.      */
  1059.     public function get_page_file_attachment($encoded_file_name){
  1060.         $dir  $this->getParameter('kernel.project_dir') . '/public/files/page.attachment/'base64_decode$encoded_file_name );
  1061.         if ( !file_exists$dir ) )
  1062.             throw new AccessDeniedException('file not found');
  1063.         $response  = new Response(file_get_contents($dir), 204, [
  1064.             'Access-Control-Allow-Origin' => '*',
  1065.             //'Access-Control-Allow-Credentials' => 'true',
  1066.             'Access-Control-Allow-Methods' => 'GET, POST, PUT, DELETE, OPTIONS',
  1067.             'Access-Control-Allow-Headers' => 'DNT, X-User-Token, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type',
  1068.             'Access-Control-Max-Age' => 1728000,
  1069.             'Content-Type' => mime_content_type($dir),
  1070.         ]);
  1071.         $response->setStatusCode(200);
  1072.           //  ->headers->set('Content-Type', mime_content_type($dir));
  1073.         return $response;
  1074.     }
  1075.     /**
  1076.      *  @Route("/get/gallery/photo/{encoded_file_name}", name="route_get_photo_gallery")
  1077.      */
  1078.     public function get_photo_gallery($encoded_file_name){
  1079.         $dir  $this->getParameter('kernel.project_dir') . '/public/images/cross.app.gallery/'base64_decode$encoded_file_name );
  1080.         if ( !file_exists$dir ) )
  1081.             throw new AccessDeniedException('file not found');
  1082.         $response  = new Response(file_get_contents($dir));
  1083.         $response->setStatusCode(200)
  1084.             ->headers->set('Content-Type''image/'.pathinfo($dirPATHINFO_EXTENSION));
  1085.         return $response;
  1086.     }
  1087.     /**
  1088.      *  @Route("/get/formation/photo/{encoded_file_name}", name="route_get_photo_formation")
  1089.      */
  1090.     public function get_photo_formation($encoded_file_name){
  1091.         $dir  $this->getParameter('kernel.project_dir') . '/public/images/cross.app.formations/'base64_decode$encoded_file_name );
  1092.         if ( !file_exists$dir ) )
  1093.             throw new AccessDeniedException('file not found');
  1094.         $response  = new Response(file_get_contents($dir));
  1095.         $response->setStatusCode(200)
  1096.             ->headers->set('Content-Type''image/'.pathinfo($dirPATHINFO_EXTENSION));
  1097.         return $response;
  1098.     }
  1099.     /**
  1100.      *  @Route("/get/events/photo/{encoded_file_name}", name="route_get_photo_event")
  1101.      */
  1102.     public function get_photo_event($encoded_file_name){
  1103.         $dir  $this->getParameter('kernel.project_dir') . '/public/images/cross.app.events/'base64_decode$encoded_file_name );
  1104.         if ( !file_exists$dir ) )
  1105.             throw new AccessDeniedException('file not found');
  1106.         $response  = new Response(file_get_contents($dir));
  1107.         $response->setStatusCode(200)
  1108.             ->headers->set('Content-Type''image/'.pathinfo($dirPATHINFO_EXTENSION));
  1109.         return $response;
  1110.     }
  1111.     /**
  1112.      *  @Route("/get/contact/photo/{encoded_file_name}", name="route_get_get_photo_contact")
  1113.      */
  1114.     public function get_photo_contact($encoded_file_name){
  1115.         $dir  $this->getParameter('kernel.project_dir') . '/public/images/cross.app.coords/'base64_decode$encoded_file_name );
  1116.         if ( !file_exists$dir ) )
  1117.             throw new AccessDeniedException('file not found');
  1118.         $response  = new Response(file_get_contents($dir));
  1119.         $response->setStatusCode(200)
  1120.             ->headers->set('Content-Type''image/'.pathinfo($dirPATHINFO_EXTENSION));
  1121.         return $response;
  1122.     }
  1123.     /**
  1124.      *  @Route("/get/carte/photo/{encoded_file_name}", name="route_get_photo_carte_menu", defaults={"encoded_file_name"=""})
  1125.      */
  1126.     public function get_photo_carte_menu(?string $encoded_file_name ""){
  1127.         $dir  "" != $encoded_file_name $this->getParameter('kernel.project_dir') . '/public/images/cross.app.carte.menu.item/'base64_decode$encoded_file_name )
  1128.             : $this->getParameter('kernel.project_dir') . '/public/images/e.png';
  1129.         if ( !file_exists$dir ) )
  1130.             throw new AccessDeniedException('file not found');
  1131.         $response  = new Response(file_get_contents($dir));
  1132.         $response->setStatusCode(200)
  1133.             ->headers->set('Content-Type''image/'.pathinfo($dirPATHINFO_EXTENSION));
  1134.         return $response;
  1135.     }
  1136.     /**
  1137.      *  @Route("/get/about/photo/{encoded_file_name}", name="route_get_photo_about")
  1138.      */
  1139.     public function get_photo_about($encoded_file_name){
  1140.         $dir  $this->getParameter('kernel.project_dir') . '/public/images/cross.app.about/'base64_decode$encoded_file_name );
  1141.         if ( !file_exists$dir ) )
  1142.             throw new AccessDeniedException('file not found');
  1143.         $response  = new Response(file_get_contents($dir));
  1144.         $response->setStatusCode(200)
  1145.             ->headers->set('Content-Type''image/'.pathinfo($dirPATHINFO_EXTENSION));
  1146.         return $response;
  1147.     }
  1148.     /**
  1149.      *  @Route("/get/logo/{encoded_file_name}", name="route_get_app_logo")
  1150.      */
  1151.     public function get_app_logo($encoded_file_name){
  1152.         $dir  $this->getParameter('kernel.project_dir') . '/public/images/app.logo/'base64_decode$encoded_file_name );
  1153.         if ( !file_exists$dir ) )
  1154.             throw new AccessDeniedException('file not found');
  1155.         $response  = new Response(file_get_contents($dir));
  1156.         $response->setStatusCode(200)
  1157.             ->headers->set('Content-Type''image/'.pathinfo($dirPATHINFO_EXTENSION));
  1158.         return $response;
  1159.     }
  1160. }