src/Controller/OrthoController.php line 80

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\CenterZipcode;
  4. use App\Entity\Centers;
  5. use App\Entity\Cities;
  6. use App\Entity\Geocode;
  7. use App\Entity\Image;
  8. use App\Entity\Maps;
  9. use App\Entity\PracticeSpeechTherapists;
  10. use App\Entity\Practices;
  11. use App\Entity\ServiceSpeechTherapists;
  12. use App\Entity\Services;
  13. use App\Entity\SpeechTherapist;
  14. use App\Entity\Zipcode;
  15. use Knp\Component\Pager\PaginatorInterface;
  16. use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  17. use Symfony\Component\HttpFoundation\Request;
  18. use Symfony\Component\HttpFoundation\Response;
  19. use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
  20. use Symfony\Component\Routing\Annotation\Route;
  21. class OrthoController extends AbstractController
  22. {
  23.     /**
  24.      * @Route("/orthophoniste/{id}", name="redirect_id_ortho", requirements={"id"="\d+"})
  25.      */
  26.     public function redirectIdOnly($id)
  27.     {
  28.         $ortho $this->getDoctrine()->getRepository(SpeechTherapist::class)->find($id);
  29.         if ($ortho) {
  30.             $slug $this->slugify->slugify($ortho->getFirstName() . '-' $ortho->getName());
  31.             $url $this->router->generate(
  32.                 'page_single_ortho_alone',
  33.                 array('nomortho' => $slug'idortho' => $id)
  34.             );
  35.         } else {
  36.             $url $this->router->generate(
  37.                 'liste_ortho'
  38.             );
  39.         }
  40.         return $this->redirect($url301);
  41.     }
  42.     /**
  43.      * @Route("/orthophoniste/page/{page}", name="redirect_page_ortho")
  44.      */
  45.     public function redirectPage($page null)
  46.     {
  47.         if ($page) {
  48.             $url $this->router->generate(
  49.                 'liste_ortho'
  50.             );
  51.         }
  52.         return $this->redirect($url301);
  53.     }
  54.     /**
  55.      * @Route("/orthophoniste", name="liste_ortho")
  56.      */
  57.     public function renderDefault(): Response
  58.     {
  59.         $this->setTemplateParameters(array('title_seo' => "Orthophonistes : Trouvez un orthophoniste près de chez vous"));
  60.         $data =  $this->JsonProvider->getJson('seo_text_orthos');
  61.         $this->setTemplateParameters(array('seo_text' => json_decode($data)));
  62.         $this->setInternalLinkage('orthoListe');
  63.         return $this->renderTemplate('pages/annuaire_search_Orthophonists.twig');
  64.     }
  65.     /**
  66.      * @Route("/orthophoniste-{zipcode}-{ville}.html", name="results_ortho_audio_by_city", requirements={"zipcode"="\d{5}"}, defaults={"page" = 1})
  67.      * @Route("/orthophoniste-{zipcode}-{ville}/filtre-resultats/exercice-{exercice}.html", name="results_ortho_by_city_filter_exercice", requirements={"zipcode"="\d{5}"}, defaults={"page" = 1})
  68.      * @Route("/orthophoniste-{zipcode}-{ville}/filtre-resultats/{specialisation}.html", name="results_ortho_by_city_filter_specialisation", requirements={"zipcode"="\d{5}"}, defaults={"page" = 1})
  69.      * @Route("/orthophoniste-{departementCode}-{departementTexte}.html", name="results_ortho_by_departement", requirements={"departementCode"="[0-9]{1,2}[0-9A-B]{1}"}, defaults={"page" = 1})
  70.      * @Route("/orthophoniste-{departementCode}-{departementTexte}/filtre-resultats/exercice-{exercice}.html", name="results_ortho_by_departement_filter_exercice", requirements={"departementCode"="[0-9]{1,2}[0-9A-B]{1}"}, defaults={"page" = 1})
  71.      * @Route("/orthophoniste-{departementCode}-{departementTexte}/filtre-resultats/{specialisation}.html", name="results_ortho_by_departement_filter_specialisation", requirements={"departementCode"="[0-9]{1,2}[0-9A-B]{1}"}, defaults={"page" = 1})
  72.      * 
  73.      */
  74.     public function renderList($zipcode null$ville null$departementCode null$departementTexte null$exercice null$specialisation nullRequest $requestPaginatorInterface $paginator): Response
  75.     {
  76.         $result = [];
  77.         $searchtype = [];
  78.         $orthos = [];
  79.         $orthos_filtered = [];
  80.         $lat $lng $canonical_url null;
  81.         $ortho_title_seo $ortho_description_seo null;
  82.         if ($zipcode) {
  83.             /*************** Description seo *******************/
  84.             $description_seo "Orthophoniste à " $this->dataProvider->wordUpperCaseFirstLetter($ville) . " (" $zipcode ") : Trouvez un orthophoniste proche de chez vous, consultez ses coordonnées et prenez rendez-vous avec l'Annuaire de l'Audition.";
  85.             $search_by 'zipcode';
  86.             $localisation $this->getDoctrine()->getRepository(Zipcode::class)->findOneBy(array(
  87.                 'zipcode' => $zipcode,
  88.                 'city' => strtoupper($ville)
  89.             ));
  90.             if (!$localisation) {
  91.                 $localisation $this->getDoctrine()->getRepository(Zipcode::class)->findOneBy(array(
  92.                     'zipcode' => $zipcode,
  93.                     'city' => strtoupper(str_replace('-'' '$ville))
  94.                 ));
  95.             }
  96.             if (!$localisation) {
  97.                 $localisation $this->getDoctrine()->getRepository(Zipcode::class)->findByZipCodeAndCityLike($zipcode$ville);
  98.             }
  99.             if (!$localisation) {
  100.                 $localisation $this->getDoctrine()->getRepository(Zipcode::class)->findOneBy(['zipcode' => $zipcode]);
  101.             }
  102.             if (!$localisation) {
  103.                 throw new NotFoundHttpException();
  104.             }
  105.             $departementTexte "";
  106.             if ($ville != $this->slugify->slugify($localisation->getCity())) {
  107.                 return $this->redirectProvider->redirect301('results_ortho_audio_by_city', array('ville' => $this->slugify->slugify($localisation->getCity()), 'zipcode' => $zipcode));
  108.             }
  109.             $cities $localisation->getCities();
  110.             if (!$cities) {
  111.                 $cities $this->geoProvider->addCities($ville$zipcode$localisation);
  112.             }
  113.             if (!empty($localisation->getCities())) {
  114.                 $departementTexte $localisation->getCities()->getDeptTxt();
  115.                 $depcode $localisation->getCities()->getDeptcode();
  116.                 $lat $localisation->getCities()->getLat();
  117.                 $lng $localisation->getCities()->getLng();
  118.             } else {
  119.                 $dep $localisation->getDepartment();
  120.                 $departementTexte substr($dep7);
  121.                 $depcode substr($dep02);
  122.             }
  123.             //PREFOOTER
  124.             $searchtype['departementCode'] = $depcode;
  125.             $searchtype['departementTexte'] = $this->slugify->slugify($departementTexte);
  126.             $searchtype['ville'] = strtolower($ville);
  127.             $searchtype['zipcode'] = $zipcode;
  128.             // BREADCRUMB
  129.             $this->breadDatas['type'] = 'city';
  130.             $this->breadDatas['final'] = $localisation->getCity() . " (" $zipcode ")";
  131.             $search_location $ville;
  132.             $this->breadDatas['final_url'] = $this->router->generate(
  133.                 'results_ortho_audio_by_city',
  134.                 array('zipcode' => $zipcode'ville' => $this->slugify->slugify($ville))
  135.             );
  136.             $this->breadDatas['departementTxt'] = $departementTexte;
  137.             $this->breadDatas['departementCode'] = $depcode;
  138.             // Recherche des Orthophonistes par zipcode
  139.             $orthos $this->getDoctrine()->getRepository(SpeechTherapist::class)->findByLocalisationId($localisation->getId());
  140.             foreach ($orthos as $ortho) {
  141.                 $ortho->zip $zipcode;
  142.                 $ortho->city $ville;
  143.             }
  144.             $total_results count($orthos);
  145.             $limit 30 $total_results;
  146.             if ($total_results 30) {
  147.                 $orthos_proximite = [];
  148.                 // ------- Récupération coordonnées de la ville courante
  149.                 $lat $localisation->getCities()->getLat();
  150.                 $lng $localisation->getCities()->getLng();
  151.                 $idLoc $localisation->getCities()->getId();
  152.                 $cities_proximite $this->getDoctrine()->getRepository(Zipcode::class)->findCitiesByProximite($lat$lng$idLoc);
  153.                 foreach ($cities_proximite as $city) {
  154.                     if ($zip_pro $this->getDoctrine()->getRepository(Zipcode::class)->find($city[0]->getId())) {
  155.                         $zip_pro_id $zip_pro->getId();
  156.                         if ($total_results 30) {
  157.                             $orthos_proximite $this->getDoctrine()->getRepository(SpeechTherapist::class)->findByLocalisationId($city[0]->getId());
  158.                             foreach ($orthos_proximite as $ortho_proximite) {
  159.                                 if (!in_array($ortho_proximite$orthos) && $total_results 30) {
  160.                                     $ortho_proximite->zip $zip_pro->getZipcode();
  161.                                     $ortho_proximite->city $zip_pro->getCity();
  162.                                     array_push($orthos$ortho_proximite);
  163.                                     $total_results count($orthos);
  164.                                     $limit 30 $total_results;
  165.                                 }
  166.                             }
  167.                         }
  168.                     }
  169.                 }
  170.             }
  171.             $datasFilters = array('ville' => $ville'zipcode' => $zipcode);
  172.             $arrondissement false;
  173.             if ($ville == "paris" || $ville == "marseille" || $ville == "lyon") {
  174.                 $arrondissement " " $this->dataProvider->getArrondissement($zipcode);
  175.                 if ($ville != "paris")
  176.                     $this->breadDatas['villeArrondissement'] = $ville;
  177.             }
  178.             $title_seo "Orthophonistes à " $this->dataProvider->wordUpperCaseFirstLetter($localisation->getCity()) . $arrondissement " (" $zipcode ")";
  179.             // Description seo //
  180.             if ($localisation) {
  181.                 $ortho_title_seo $localisation->getSpeechtherapistsTitleSeo();
  182.                 $ortho_description_seo html_entity_decode(strip_tags($localisation->getSpeechtherapistsDescriptionSeo()), ENT_QUOTES);
  183.             }
  184.             $canonical_url $this->router->generate('results_ortho_audio_by_city', array(
  185.                 'zipcode' => $zipcode'ville' => $this->slugify->slugify($ville)
  186.             ));
  187.             //$searchtype['exceptZipCode'] = $zipcode;
  188.             $this->setTemplateParameters(array('zipcode' => $zipcode));
  189.             $this->setTemplateParameters(array('ville' => $ville));
  190.             $centers_url $this->router->generate('results_centres_audio_by_city', array('zipcode' => $zipcode'ville' => $this->slugify->slugify($ville)));
  191.             $medecin_url $this->router->generate('results_medecin_audio_by_city', array('zipcode' => $zipcode'ville' => $this->slugify->slugify($ville)));
  192.             //$audio_url = $this->router->generate('results_audio_by_city', array('zipcode' => $zipcode, 'ville' => $this->slugify->slugify($ville)));
  193.         } elseif ($departementCode) {
  194.             $depcode $departementCode;
  195.             /************ Description seo **************/
  196.             $description_seo "Orthophoniste " $this->dataProvider->wordUpperCaseFirstLetter($departementTexte) . " (" $departementCode ") : Trouvez un orthophoniste proche de chez vous, consultez ses coordonnées et prenez rendez-vous avec l'Annuaire de l'Audition.";
  197.             // PREFOOTER 
  198.             $searchtype['departementCode'] = $departementCode;
  199.             $searchtype['departementTexte'] = $this->slugify->slugify($departementTexte);
  200.             $localisation $this->getDoctrine()->getRepository(Cities::class)->findOneBy(array('deptCode' => $departementCode));
  201.             $ville $localisation->getVille();
  202.             $zipcode $localisation->getZipCode();
  203.             //$departementTexte = $localisation->getDeptTxt();
  204.             $localisation $this->getDoctrine()->getRepository(Cities::class)->findOneBy(array('deptCode' => $departementCode));
  205.             $checkDept $this->slugify->slugify($localisation->getDeptTxt());
  206.             if ($checkDept != $departementTexte && ($departementTexte != 'lyon' && $departementTexte != 'paris' && $departementTexte != 'marseille')) {
  207.                 return $this->redirectProvider->redirect301('results_ortho_by_departement', array('departementCode' => $departementCode'departementTexte' => $checkDept));
  208.             }
  209.             $ville $localisation->getVille();
  210.             $zipcode $localisation->getZipCode();
  211.             // DEPARTEMENT ET COORDONNEES
  212.             $localisationId $localisation->getId();
  213.             $lat $localisation->getLat();
  214.             $lng $localisation->getLng();
  215.             // BREADCRUMB
  216.             $this->breadDatas['type'] = 'dept';
  217.             $this->breadDatas['final'] = $localisation->getDeptTxt() . " (" $departementCode ")";
  218.             $this->breadDatas['final_url'] = $this->router->generate(
  219.                 'results_ortho_by_departement',
  220.                 array('departementCode' => $departementCode'departementTexte' => $this->slugify->slugify($departementTexte))
  221.             );
  222.             $search_location $departementTexte;
  223.             $title_seo "Orthophonistes " $this->dataProvider->wordUpperCaseFirstLetter($localisation->getDeptTxt()) . " (" $departementCode ")";
  224.             // Recherche des Orthophonistes par departement
  225.             // TOUTES LES VILLES DU DEPARTEMENT 
  226.             if ($departementTexte == 'lyon' || $departementTexte == 'paris' || $departementTexte == 'marseille') {
  227.                 $this->breadDatas['type'] = 'city';
  228.                 $title_seo "Orthophonistes à " $this->dataProvider->wordUpperCaseFirstLetter($departementTexte) . " (" $departementCode ")";
  229.                 $this->breadDatas['final'] = $this->dataProvider->wordUpperCaseFirstLetter($departementTexte) . " (" $departementCode ")";
  230.                 $citiesInDept $this->getDoctrine()->getRepository(Zipcode::class)->findBy(['city' => $departementTexte]);
  231.                 // BREADCRUMB SPECIFIQUE
  232.                 switch ($departementTexte) {
  233.                     case 'paris':
  234.                         $this->breadDatas['departementTxt'] = 'Paris';
  235.                         $this->breadDatas['departementCode'] = 75;
  236.                         break;
  237.                     case 'lyon':
  238.                         $this->breadDatas['departementTxt'] = 'Rhône';
  239.                         $this->breadDatas['departementCode'] = 69;
  240.                         break;
  241.                     case 'marseille':
  242.                         $this->breadDatas['departementTxt'] = 'Bouches-du-Rhône';
  243.                         $this->breadDatas['departementCode'] = 13;
  244.                         break;
  245.                 }
  246.             } else {
  247.                 $citiesInDept $this->getDoctrine()->getRepository(Zipcode::class)->findCitiesInDept($departementCode);
  248.             }
  249.             // TOUS LES DOCTEURS DE TOUTES LES VILLES
  250.             foreach ($citiesInDept as $city) {
  251.                 $orthosincity $this->getDoctrine()->getRepository(SpeechTherapist::class)->findByLocalisationId($city->getId());
  252.                 foreach ($orthosincity as $orthoincity) {
  253.                     if (!in_array($orthoincity$orthos)) {
  254.                         $orthoincity->zip $city->getZipcode();
  255.                         $orthoincity->city $city->getCity();
  256.                         array_push($orthos$orthoincity);
  257.                     }
  258.                 }
  259.             }
  260.             $datasFilters = array('departementCode' => $departementCode'departementTexte' => $departementTexte);
  261.             // Description seo //
  262.             //---- On cherche l'objet Map ayant le nom qui commence par depcode %
  263.             $maps $this->getDoctrine()->getRepository(Maps::class)->findOneMapByDepCode($departementCode);
  264.             if ($maps && isset($maps[0])) {
  265.                 $ortho_title_seo $maps[0]->getSpeechtherapistsTitleSeo();
  266.                 $ortho_description_seo html_entity_decode(strip_tags($maps[0]->getSpeechtherapistsDescriptionSeo()), ENT_QUOTES);
  267.             }
  268.             $canonical_url $this->router->generate('results_ortho_by_departement', array('departementCode' => $departementCode'departementTexte' => $departementTexte));
  269.             $centers_url $this->router->generate('results_centres_audio_by_departement', array('departementCode' => $departementCode'departementTexte' => $this->slugify->slugify($departementTexte)));
  270.             $medecin_url $this->router->generate('results_medecin_by_departement', array('departementCode' => $departementCode'departementTexte' => $this->slugify->slugify($departementTexte)));
  271.             //$audio_url = $this->router->generate('results_audio_by_departement', array('departementCode' => $departementCode, 'departementTexte' => $this->slugify->slugify($departementTexte)));
  272.         }
  273.         // Récupération des filtres exercices
  274.         $exercice_filters $this->FiltersProvider->getOrthoExerciceFilters($orthos$datasFilters);
  275.         // Récupération des filtres spécialisation
  276.         $specialisation_filters $this->FiltersProvider->getOrthoSpecialisationFilters($orthos$datasFilters);
  277.         $filtered false;
  278.         // SI filtre par exercice
  279.         if ($exercice) {
  280.             foreach ($orthos as $ortho) {
  281.                 if ($exercice == 'liberal') {
  282.                     $cabinetF $this->getDoctrine()->getRepository(PracticeSpeechTherapists::class)->findOneBy(['speechTherapists' => $ortho->getId()]);
  283.                     if ($cabinetF)
  284.                         $orthos_filtered[] = $ortho;
  285.                 } else if ($exercice == 'hospitalier') {
  286.                     $serviceF $this->getDoctrine()->getRepository(ServiceSpeechTherapists::class)->findOneBy(['speechTherapistsId' => $ortho->getId()]);
  287.                     if ($serviceF)
  288.                         $orthos_filtered[] = $ortho;
  289.                 }
  290.             }
  291.             $filtered true;
  292.         }
  293.         if ($specialisation) {
  294.             foreach ($orthos as $ortho) {
  295.                 $spesOrtho $this->getSpecialisation($ortho);
  296.                 foreach ($spesOrtho as $speOrtho) {
  297.                     if ($this->slugify->slugify($speOrtho) == $specialisation) {
  298.                         if (!in_array($ortho$orthos_filtered)) {
  299.                             $orthos_filtered[] = $ortho;
  300.                         }
  301.                     }
  302.                 }
  303.             }
  304.             $filtered true;
  305.         }
  306.         if ($filtered) {
  307.             $result $this->cardProvider->getOrthoCards($orthos_filteredtrue);
  308.         } else {
  309.             $result $this->cardProvider->getOrthoCards($orthostrue);
  310.         }
  311.         $results_paginated $paginator->paginate(
  312.             $result,
  313.             $request->query->getInt('page'1),
  314.             30
  315.         );
  316.         $map = array();
  317.         foreach ($results_paginated as $result_paginated) {
  318.             if (array_key_exists('hospital'$result_paginated)) {
  319.                 if ($marker $this->geoProvider->getHospitalCoords($result_paginated['hospital'], $result_paginated['image'], 'Ortho'$result_paginated['ortho']->getTitle())) {
  320.                     $map['markers'][] = $marker;
  321.                 }
  322.             } else if (array_key_exists('practice'$result_paginated)) {
  323.                 if ($marker $this->geoProvider->getPracticeCoords($result_paginated['practice'], $result_paginated['image'], 'Ortho'$result_paginated['ortho']->getTitle())) {
  324.                     $map['markers'][] = $marker;
  325.                 }
  326.             }
  327.         }
  328.         $this->setTemplateParameters(array(
  329.             'searchresult' => array('orthophonists' => $results_paginated),
  330.             'filter' => array(
  331.                 'exercice' => $exercice_filters,
  332.                 'specialisation' => $specialisation_filters,
  333.             )
  334.         ));
  335.         //$this->setTemplateParameters(array('search_location' => $search_location));
  336.         $deptForPreFooter = ($departementTexte == "paris" || $departementTexte == "marseille" || $departementTexte == "lyon") ? "à " $departementTexte "en " $departementTexte;
  337.         /*$this->breadDatas['ville'] = $ville;
  338.         $this->breadDatas['zipcode'] = $zipcode;*/
  339.         $this->setBreadcrumb('orthophonistes''list');
  340.         // Maillage
  341.         $searchtype['lng'] = $lng;
  342.         $searchtype['lat'] = $lat;
  343.         $searchtype['localisationId'] = $localisation->getId();
  344.         $this->setInternalLinkage('orthoListe'$searchtype);
  345.         $this->setTemplateParameters(array('dept' => $deptForPreFooter));
  346.         $this->setTemplateParameters(array('map' => $map));
  347.         $this->setTemplateParameters(array('title_seo' => ($title_seo) ?? "Orthophonistes"));
  348.         $this->setTemplateParameters(array('description_seo' => $description_seo));
  349.         $this->setTemplateParameters(array('canonical_url' => $canonical_url));
  350.         $this->setTemplateParameters(array('seo_text' => array('title' => $ortho_title_seo'text' => $ortho_description_seo)));
  351.         $this->setPrevNextRel(count($result), $request->query->getInt('page'), $request->getSchemeAndHttpHost() . $request->getPathInfo());
  352.         $this->setTitleSearch();
  353.         $this->setTemplateParameters(array(
  354.             'centers_url' => $centers_url,
  355.             //'audio_url' =>$audio_url, 
  356.             'medecin_url' => $medecin_url
  357.         ));
  358.         return $this->renderTemplate('pages/annuaire_searchResults_Orthophonists.twig');
  359.     }
  360.     /**
  361.      * @Route("/orthophoniste/{ville}-{zipcode}/{nomortho}-{idortho}-practice-{idPractice}.html", name="page_orthophoniste_with_practice", requirements={"zipcode"="\d{5}", "nomortho"="[a-zA-Z0-9\-_\/]+", "ville"="[a-zA-Z0-9\-_\/]+", "idPractice"="[0-9]+"})
  362.      * @Route("/orthophoniste/{ville}-{zipcode}/{nomortho}-{idortho}-service-{idService}.html", name="page_orthophoniste_with_service", requirements={"zipcode"="\d{5}", "nomortho"="[a-zA-Z0-9\-_\/]+", "ville"="[a-zA-Z0-9\-_\/]+", "idPractice"="[0-9]+"})
  363.      * @Route("/orthophoniste/{ville}-{zipcode}/{nomortho}-{idortho}.html", name="page_orthophoniste", requirements={"zipcode"="\d{5}", "nomortho"="[a-zA-Z0-9\-_\/]+", "ville"="[a-zA-Z0-9\-_\/]+"})
  364.      * * @Route("/orthophoniste/{nomortho}-{idortho}.html", name="page_single_ortho_alone", requirements={"nomortho"="[a-zA-Z0-9\-_\/]+", "idortho"="[0-9]+"})
  365.      * 
  366.      */
  367.     public function renderPage($zipcode null$ville null$nomortho$idortho$idPractice null$idService nullRequest $request): Response
  368.     {
  369.         $team = [];
  370.         $page_provider = [];
  371.         $ortho $this->getDoctrine()->getRepository(SpeechTherapist::class)->find($idortho);
  372.         if (!$ortho) {
  373.             if ($zipcode) {
  374.                 return $this->redirectProvider->redirect301('results_ortho_audio_by_city', array('zipcode' => $zipcode'ville' => $ville));
  375.             } else {
  376.                 return $this->redirectProvider->redirect301('liste_ortho');
  377.             }
  378.         }
  379.         $slugOrtho $this->slugify->slugify($ortho->getFirstName() . '-' $ortho->getName());
  380.         if ($slugOrtho != $nomortho) {
  381.             if ($idPractice) {
  382.                 return $this->redirectProvider->redirect301('page_orthophoniste_with_practice', array('zipcode' => $zipcode'ville' => $ville'nomortho' => $slugOrtho'idortho' => $idortho'idPractice' => $idPractice));
  383.             } else if ($idService) {
  384.                 return $this->redirectProvider->redirect301('page_orthophoniste_with_service', array('zipcode' => $zipcode'ville' => $ville'nomortho' => $slugOrtho'idortho' => $idortho'idService' => $idService));
  385.             } else {
  386.                 return $this->redirectProvider->redirect301('page_single_ortho_alone', array('nomortho' => $slugOrtho'idortho' => $idortho));
  387.             }
  388.         }
  389.         $alone false;
  390.         if (!$idPractice && !$idService) {
  391.             $alone true;
  392.         }
  393.         // Centres à proximités du cabinet //
  394.         // On teste s'il y a un cabinet en paramètre, sinon on récupère le premier cabinet dans la requête.
  395.         $centre_proximite = [];
  396.         $cabinet $service null;
  397.         if ($idPractice) {
  398.             $cabinet $this->getDoctrine()->getRepository(Practices::class)->find($idPractice);
  399.             if (!$cabinet) {
  400.                 return $this->redirectProvider->redirect301('page_single_ortho_alone', array('nomortho' => $slugOrtho'idortho' => $idortho));
  401.             }
  402.         } else if ($idService) {
  403.             $service $this->getDoctrine()->getRepository(Services::class)->find($idService);
  404.             if (!$service) {
  405.                 return $this->redirectProvider->redirect301('page_single_ortho_alone', array('nomortho' => $slugOrtho'idortho' => $idortho));
  406.             }
  407.         }
  408.         /*else {
  409.             // On récupère le premier Cabinet dans le requête pour s'enservir de ces adresses etc...
  410.             $cabinet = $this->getDoctrine()->getRepository(SpeechTherapist::class)->findPracticeByOrthoID($idortho, null, 1);
  411.             $cabinet = ($cabinet)? $cabinet[0] : NULL;
  412.         }*/
  413.         // Les autres cabinets
  414.         $buttons = [];
  415.         $practices $this->getDoctrine()->getRepository(SpeechTherapist::class)->findPracticeByOrthoID($idortho);
  416.         $i 1;
  417.         $idspractices = array();
  418.         foreach ($practices as $practice) {
  419.             $zipcodeCheck $this->getDoctrine()->getRepository(Zipcode::class)->findOneBy(['id' => $practice->getLocalisation()->getId()]);
  420.             if ($zipcodeCheck) {
  421.                 if ($alone) {
  422.                     $url $this->router->generate(
  423.                         'page_orthophoniste_with_practice',
  424.                         array(
  425.                             'zipcode' => trim($practice->getLocalisation()->getZipcode()),
  426.                             'nomortho' => $slugOrtho,
  427.                             'idortho' => $idortho,
  428.                             'ville' => $this->slugify->slugify($practice->getLocalisation()->getCity()),
  429.                             'idPractice' => $practice->getId()
  430.                         )
  431.                     );
  432.                     return $this->redirect($url301);
  433.                 }
  434.                 $current = ($practice->getId() == $idPractice) ? true false;
  435.                 $idspractices[] = $practice->getId();
  436.                 array_push($buttons, array(
  437.                     "title" => "Cabinet " $i,
  438.                     "url" => "/orthophoniste/" $this->slugify->slugify($practice->getLocalisation()->getCity()) . "-" trim($practice->getLocalisation()->getZipcode()) . "/" $slugOrtho '-' $idortho "-practice-" $practice->getId() . ".html",
  439.                     "current" => $current,
  440.                 ));
  441.                 $i++;
  442.                 if ($current) {
  443.                     if ($zipcode != trim($practice->getLocalisation()->getZipcode())) {
  444.                         return $this->redirectProvider->redirect301(
  445.                             'page_orthophoniste_with_practice',
  446.                             array(
  447.                                 'ville' => $this->slugify->slugify($practice->getLocalisation()->getCity()),
  448.                                 'zipcode' => trim($practice->getLocalisation()->getZipcode()),
  449.                                 'nomortho' => $nomortho,
  450.                                 'idortho' => $idortho,
  451.                                 'idPractice' => $idPractice
  452.                             )
  453.                         );
  454.                     }
  455.                     // Infos Cabinet
  456.                     $adresse $cabinet->getAddress() . " \n";
  457.                     if ($cabinet->getAdditionalAddress()) {
  458.                         $adresse .= $cabinet->getAdditionalAddress() . " \n";
  459.                     }
  460.                     $adresse .= $cabinet->getLocalisation()->getZipcode() . ' ' $cabinet->getLocalisation()->getCity() . " \n";
  461.                     if ($cabinet->getPoBox()) {
  462.                         $adresse .= $cabinet->getPoBox() . " \n";
  463.                     }
  464.                     if ($cabinet->getZipCedex()) {
  465.                         $adresse .= $cabinet->getZipCedex() . " ";
  466.                     }
  467.                     if ($cabinet->getCityCedex()) {
  468.                         $adresse .= $cabinet->getCityCedex();
  469.                     }
  470.                     $cabinet_ortho $this->getDoctrine()->getRepository(PracticeSpeechTherapists::class)->findOneBy(['speechTherapists' => $ortho->getId(), 'practiceId' => $idPractice]);
  471.                     $tel1 = ($cabinet_ortho && $cabinet_ortho->getPhone()) ? $cabinet_ortho->getPhone() : $cabinet->getPhone();
  472.                     $page_provider = array(
  473.                         "coords" => array(
  474.                             "items" => array(
  475.                                 "tel1" => $tel1,
  476.                                 "address" => $cabinet->getAddress() . " \n" $cabinet->getAdditionalAddress(),
  477.                                 "zip" => trim($cabinet->getLocalisation()->getZipcode()),
  478.                                 "city" => $cabinet->getLocalisation()->getCity(),
  479.                                 "bp" => $cabinet->getPoBox(),
  480.                                 "zipcedex" => $cabinet->getZipCedex(),
  481.                                 "citycedex" => $cabinet->getCityCedex()
  482.                             ),
  483.                             "coordTitle" => $practice->getName()
  484.                         )
  485.                     );
  486.                 }
  487.             }
  488.         }
  489.         if ($idPractice && !in_array($idPractice$idspractices)) {
  490.             $zipcodeCheckCurrent $this->getDoctrine()->getRepository(Zipcode::class)->findOneBy(['id' => $idPractice]);
  491.             if (!$zipcodeCheckCurrent) {
  492.                 return $this->redirectProvider->redirect301('page_single_ortho_alone', array('nomortho' => $slugOrtho'idortho' => $idortho));
  493.             }
  494.         }
  495.         // Les autres services
  496.         $services $this->getDoctrine()->getRepository(SpeechTherapist::class)->findServiceByOrthoID($idortho);
  497.         $idsservices = array();
  498.         $j 1;
  499.         foreach ($services as $serv) {
  500.             if ($alone) {
  501.                 $url $this->router->generate(
  502.                     'page_orthophoniste_with_service',
  503.                     array(
  504.                         'zipcode' => rtrim($serv->getHospital()->getLocalisation()->getZipcode()),
  505.                         'nomortho' => $slugOrtho,
  506.                         'idortho' => $idortho,
  507.                         'ville' => $this->slugify->slugify($serv->getHospital()->getLocalisation()->getCity()),
  508.                         'idService' => $serv->getId()
  509.                     )
  510.                 );
  511.                 return $this->redirect($url301);
  512.             }
  513.             $idservice $serv->getId();
  514.             $idsservices[] = $idservice;
  515.             $current = ($idservice == $idService) ? true false;
  516.             array_push($buttons, array(
  517.                 "title" => "Service ORL " $j,
  518.                 "url" => "/orthophoniste/" $this->slugify->slugify($serv->getHospital()->getLocalisation()->getCity()) . "-" trim($serv->getHospital()->getLocalisation()->getZipcode()) . "/" $slugOrtho '-' $idortho "-service-" $idservice ".html",
  519.                 "current" => $current,
  520.             ));
  521.             $j++;
  522.             if ($current) {
  523.                 if ($zipcode != trim($serv->getHospital()->getLocalisation()->getZipcode())) {
  524.                     return $this->redirectProvider->redirect301(
  525.                         'page_orthophoniste_with_service',
  526.                         array(
  527.                             'ville' => $this->slugify->slugify($serv->getHospital()->getLocalisation()->getCity()),
  528.                             'zipcode' => rtrim($serv->getHospital()->getLocalisation()->getZipcode()),
  529.                             'nomortho' => $nomortho,
  530.                             'idortho' => $idortho,
  531.                             'idService' => $idService
  532.                         )
  533.                     );
  534.                 }
  535.                 $page_provider = array(
  536.                     "coords" => array(
  537.                         "items" => array(
  538.                             "address" => $serv->getHospital()->getAddress() . " \n" $serv->getHospital()->getAdditionalAddress(),
  539.                             "zip" => $serv->getHospital()->getLocalisation()->getZipcode(),
  540.                             "city" => $serv->getHospital()->getLocalisation()->getCity(),
  541.                             "bp" => $serv->getHospital()->getPoBox(),
  542.                             "zipcedex" => $serv->getHospital()->getCedex(),
  543.                             "citycedex" => $serv->getHospital()->getCityCedex()
  544.                         ),
  545.                         "coordTitle" => $serv->getHospital()->getCorporateName(),
  546.                         'subtitleORLService' => $serv->getName(),
  547.                         'link' => $url $this->router->generate(
  548.                             'page_service_hospitalier_avec_service',
  549.                             array(
  550.                                 'ville' => $ville,
  551.                                 'zipcode' => $zipcode,
  552.                                 'nomhopital' => $this->slugify->slugify($serv->getHospital()->getCorporateName()),
  553.                                 'idhopital' => $serv->getHospital()->getId(),
  554.                                 'nomservice' => $this->slugify->slugify($serv->getName()),
  555.                                 'idservice' => $serv->getId(),
  556.                             )
  557.                         )
  558.                     )
  559.                 );
  560.                 for ($i 1$i <= 3$i++) {
  561.                     $tel $serv->{'getTitle' $i}();
  562.                     if (!empty($tel))
  563.                         $tel .= "\n";
  564.                     $tel .= $serv->{'getDescription' $i}();
  565.                     $page_provider['coords']['items']['tel' $i] = $tel;
  566.                 }
  567.             }
  568.         }
  569.         if ($idService && !in_array($idService$idsservices)) {
  570.             return $this->redirectProvider->redirect301('page_single_ortho_alone', array('nomortho' => $slugOrtho'idortho' => $idortho));
  571.         }
  572.         // Logo //
  573.         $logo $this->dataProvider->getAvatar('Ortho'$ortho->getTitle());
  574.         if ($logoId $this->getDoctrine()->getRepository(Image::class)->findOneBy(['class' => 'SpeechTherapist''entityId' => $idortho'cover' => 1])) {
  575.             $file $this->bo_url "images/" $logoId->getId() . "-medium.jpg";
  576.             if (@fopen($file"r")) {
  577.                 $logo $file;
  578.             }
  579.         }
  580.         if (!$alone) {
  581.             $localisation $this->getDoctrine()->getRepository(Zipcode::class)->findByZipCodeAndCityLike($zipcode$ville);
  582.             if (!$localisation) {
  583.                 $localisation $this->getDoctrine()->getRepository(Zipcode::class)->findOneBy(['zipcode' => $zipcode]);
  584.             }
  585.             if ($zipcode != trim($localisation->getZipcode()) || $ville != $this->slugify->slugify($localisation->getCity())) {
  586.                 return $this->redirectProvider->redirect301('page_single_ortho_alone', array('nomortho' => $nomortho'idortho' => $idortho));
  587.             }
  588.             if (!$localisation) {
  589.                 throw new NotFoundHttpException();
  590.             }
  591.             $cities $localisation->getCities();
  592.             if (!$cities) {
  593.                 $cities $this->geoProvider->addCities($ville$zipcode$localisation);
  594.             }
  595.             $slugVille $this->slugify->slugify($localisation->getCity());
  596.             if ($cabinet || $service) {
  597.                 $object = ($cabinet) ? $cabinet $service;
  598.                 $idObject $object->getId();
  599.                 // Coordonnées de localisation
  600.                 if ($service)
  601.                     $geocode $this->dataProvider->getGeoCode($service->getHospital());
  602.                 else
  603.                     $geocode $this->dataProvider->getGeoCode($object);
  604.                 $lat $geocode['lat'];
  605.                 $lng $geocode['lng'];
  606.                 $idLoc $geocode['idLoc'];
  607.                 $centersCity $this->getDoctrine()->getRepository(Centers::class)->findBy([
  608.                     'localisation' => $localisation->getId(),
  609.                     'advertiser' => 1,
  610.                     'visible' => 1
  611.                 ]);
  612.                 shuffle($centersCity);
  613.                 foreach ($centersCity as $c) {
  614.                     array_push($centre_proximite$c);
  615.                 }
  616.                 $centersRelated $this->getDoctrine()->getRepository(CenterZipcode::class)->findBy(['zipcodeId' => $localisation->getId()]);
  617.                 shuffle($centersRelated);
  618.                 foreach ($centersRelated as $c) {
  619.                     $cr $this->getDoctrine()->getRepository(Centers::class)->findOneBy([
  620.                         'id' => $c->getCenterId(),
  621.                         'advertiser' => 1,
  622.                         'visible' => 1
  623.                     ]);
  624.                     if ($cr) {
  625.                         array_push($centre_proximite$cr);
  626.                     }
  627.                 }
  628.                 if (sizeof($centre_proximite) < 6) {
  629.                     $limit sizeof($centre_proximite);
  630.                     $proximites $this->getDoctrine()->getRepository(Centers::class)->findCentersByProximiteCity(array('lat' => $lat'lng' => $lng), $localisation->getId(), $limit);
  631.                     shuffle($proximites);
  632.                     foreach ($proximites as $proximite) {
  633.                         $centerPro $this->getDoctrine()->getRepository(Centers::class)->findOneBy([
  634.                             'id' => $proximite[0]->getId(),
  635.                             'visible' => 1
  636.                         ]);
  637.                         if ($centerPro && !in_array($centerPro$centre_proximite)) {
  638.                             array_push($centre_proximite$centerPro);
  639.                         }
  640.                     }
  641.                 }
  642.                 /*$centersRelated = $this->getDoctrine()->getRepository(CenterZipcode::class)->findBy(['zipcodeId'=>$localisation->getId()]);            
  643.                 foreach($centersRelated as $centerRelated) {
  644.                     $cr = $this->getDoctrine()->getRepository(Centers::class)->findOneBy(['id'=>$centerRelated->getCenterId(), 'advertiser'=>1]);             
  645.                     if($cr) {
  646.                         array_push($centre_proximite, $cr);
  647.                     }
  648.                     if (sizeof($centre_proximite) >= 6) break;
  649.                 } 
  650.                 if (sizeof($centre_proximite) < 6) {
  651.                     $centersCity = $this->getDoctrine()->getRepository(Centers::class)->findBy(['localisation'=>$localisation->getId(), 'advertiser'=>1]);
  652.                 
  653.                     foreach ($centersCity as $c) {
  654.                         array_push($centre_proximite, $c);
  655.                         if (sizeof($centre_proximite) >= 6) break;             
  656.                     }
  657.                 }
  658.                 if (sizeof($centre_proximite) < 6) {
  659.                     $proximites = $this->getDoctrine()->getRepository(Geocode::class)->findEntitiesByProximite('Centers', array('lat'=>$lat, 'lng'=>$lng), 100);
  660.                     foreach($proximites as $proximite) {
  661.                         $centerPro = $this->getDoctrine()->getRepository(Centers::class)->findOneBy(['id'=>$proximite[0]->getId(), 'advertiser'=>1]);
  662.                         if($centerPro && !in_array($centerPro, $centre_proximite)) {
  663.                             array_push($centre_proximite, $centerPro);
  664.                             if (sizeof($centre_proximite) >= 6) break;
  665.                         }
  666.                     }
  667.                 }
  668.                 shuffle($centre_proximite);*/
  669.                 $centre_proximite $this->cardProvider->getCenterCards($centre_proximite);
  670.                 $team null;
  671.                 // On cherche les autres Orthophonistes du même cabinet //
  672.                 if ($cabinet)
  673.                     $otherOrthos $this->getDoctrine()->getRepository(SpeechTherapist::class)->findByPractice($cabinet->getId(), $idortho);
  674.                 elseif ($service)
  675.                     $otherOrthos $this->getDoctrine()->getRepository(SpeechTherapist::class)->findByService($service->getId(), $idortho);
  676.                 if ($otherOrthos) {
  677.                     foreach ($otherOrthos as $otherOrtho) {
  678.                         $otherOrtho->zip $zipcode;
  679.                         $otherOrtho->city $ville;
  680.                         $otherOrtho->specialisation $this->getSpecialisation($otherOrtho);
  681.                     }
  682.                     $team $this->cardProvider->getOrthoCards($otherOrthosfalse);
  683.                 }
  684.             }
  685.             $searchtype['lat'] = $lat;
  686.             $searchtype['lng'] = $lng;
  687.             $searchtype['currentCityId'] = $idLoc;
  688.             $this->setInternalLinkage('orthoPage'$searchtype);
  689.             $this->setTemplateParameters(array('city' => ($localisation) ? $localisation->getCity() : null));
  690.             $dep $localisation->getDepartment();
  691.             $departementTxt $localisation->getCities()->getDeptTxt();
  692.             $departementCode $localisation->getCities()->getDeptCode();
  693.             $map['markers'][] = array(
  694.                 "lat" => $lat,
  695.                 "lon" => $lng,
  696.                 "premium" => true,
  697.                 "src" => "url(" $logo ")"
  698.             );
  699.             $this->breadDatas['ville'] = $localisation->getCity();
  700.             $this->breadDatas['zipcode'] = $localisation->getZipcode();
  701.             $this->breadDatas['departementTxt'] = $departementTxt;
  702.             $this->breadDatas['departementCode'] = $departementCode;
  703.             $this->setTemplateParameters(array('map' => $map));
  704.         } else {
  705.             $this->setInternalLinkage('orthoListe');
  706.         }
  707.         // Header //
  708.         $header = array(
  709.             "image" => $logo,
  710.             "name" => $ortho->getFirstName(),
  711.             "surname" => $ortho->getName(),
  712.             "job" => "Orthophoniste",
  713.         );
  714.         // Spécialisation //
  715.         $specialization $this->getSpecialisation($ortho);
  716.         $centers_url $this->router->generate('results_centres_audio_by_city', array('zipcode' => $zipcode'ville' => $this->slugify->slugify($ville)));
  717.         //$audio_url = $this->router->generate('results_audio_by_city', array('zipcode' => $zipcode, 'ville' => $this->slugify->slugify($ville)));
  718.         $medecin_url $this->router->generate('results_medecin_audio_by_city', array('zipcode' => $zipcode'ville' => $this->slugify->slugify($ville)));
  719.         $this->setTemplateParameters(array(
  720.             "page_orthophonist" => array(
  721.                 "header" => $header,
  722.                 "centers" => $centre_proximite,
  723.                 "team" => $team,
  724.                 "specialization" => $specialization,
  725.                 "lieuType" => ($service) ? 'service ORL' 'cabinet',
  726.             ),
  727.             'search' => array(
  728.                 'filter' => $buttons,
  729.             ),
  730.             "page_provider" => $page_provider,
  731.         ));
  732.         // Breadcrumb
  733.         $this->breadDatas['final'] = $ortho->getFirstName() . ' ' $ortho->getName();
  734.         $title_seo $ortho->getFirstName() . ' ' $ortho->getName() . ' - Orthophoniste';
  735.         if ($ville) {
  736.             $title_seo .=  ' à ' $this->dataProvider->wordUpperCaseFirstLetter($ville) . ' (' $zipcode ')';
  737.         }
  738.         /************* Description seo ****************/
  739.         $description_seo "Prenez rendez-vous avec " $ortho->getFirstName() . " " $ortho->getName() . ", orthophoniste à " $this->dataProvider->wordUpperCaseFirstLetter($ville) . " (" $zipcode "). Consultez ses coordonnées et son adresse sur l'Annuaire de l'Audition.";
  740.         $this->setTemplateParameters(array('title_seo' => $title_seo));
  741.         $this->setTemplateParameters(array('description_seo' => $description_seo));
  742.         $this->setBreadcrumb('orthophonistes''single');
  743.         $this->setTemplateParameters(array('dataLayerCenters' => $centre_proximite'creative' => 'fiche-orthophoniste'));
  744.         $this->setTemplateParameters(array(
  745.             'centers_url' => $centers_url,
  746.             //'audio_url' =>$audio_url, 
  747.             'medecin_url' => $medecin_url
  748.         ));
  749.         if ($idPractice$this->setTemplateParameters(array('idPractice' => $idPractice));
  750.         if ($idService)  $this->setTemplateParameters(array('idService' => $idService));
  751.         if ($idPractice || $idService) {
  752.             $id_entity $idPractice ?? $idService;
  753.             $entity $idPractice 'practice' 'service';
  754.             // on cherche le cache des parkings
  755.             if (file_exists('overpass/parkings/' $entity '/' $entity '-' intval($id_entity) . '.json')) {
  756.                 $data json_decode(file_get_contents('overpass/parkings/' $entity '/' $entity '-' intval($id_entity) . '.json'));
  757.                 $parkings $this->renderView('modules/map/nearby.html.twig', array(
  758.                     'type' => "parkings",
  759.                     'parkings' => (array)$data
  760.                 ));
  761.                 $this->setTemplateParameters(array('parkings' => $parkings));
  762.             }
  763.             $transport_communs = [];
  764.             // on cherche le cache des bus
  765.             if (file_exists('overpass/buses/' $entity '/' $entity '-' intval($id_entity) . '.json')) {
  766.                 $data json_decode(file_get_contents('overpass/buses/' $entity '/' $entity '-' intval($id_entity) . '.json'));
  767.                 if ($data) {
  768.                     $transport_communs['buses'] = $data;
  769.                 }
  770.                 $buses $this->renderView('modules/map/nearby.html.twig', array(
  771.                     'type' => "transport",
  772.                     'subtype' => "buses",
  773.                     'buses' => (array)$data
  774.                 ));
  775.                 $this->setTemplateParameters(array('buses' => $buses));
  776.             }
  777.             // on cherche le cache des métros/trains
  778.             if (file_exists('overpass/subways/' $entity '/' $entity '-' intval($id_entity) . '.json')) {
  779.                 $data json_decode(file_get_contents('overpass/subways/' $entity '/' $entity '-' intval($id_entity) . '.json'));
  780.                 if ($data) {
  781.                     $transport_communs['subways'] = $data;
  782.                 }
  783.                 $subways $this->renderView('modules/map/nearby.html.twig', array(
  784.                     'type' => "transport",
  785.                     'subtype' => "subways",
  786.                     'subways' => (array)$data
  787.                 ));
  788.                 $this->setTemplateParameters(array('subways' => $subways));
  789.             }
  790.             // on cherche le cache des trams.
  791.             if (file_exists('overpass/trams/' $entity '/' $entity '-' intval($id_entity) . '.json')) {
  792.                 $data json_decode(file_get_contents('overpass/trams/' $entity '/' $entity '-' intval($id_entity) . '.json'));
  793.                 if ($data) {
  794.                     $transport_communs['trams'] = $data;
  795.                 }
  796.                 $trams $this->renderView('modules/map/nearby.html.twig', array(
  797.                     'type' => "transport",
  798.                     'subtype' => "trams",
  799.                     'trams' => (array)$data
  800.                 ));
  801.                 $this->setTemplateParameters(array('trams' => $trams));
  802.             }
  803.         }
  804.         // FAQ //
  805.         $faqs = [];
  806.         $nomortho $ortho->getTitle() . ' ' $ortho->getFirstName() . ' ' $ortho->getName();
  807.         $entity $cabinet;
  808.         if (!$cabinet && $service && $service->getHospital()) $entity $service->getHospital();
  809.         if ($entity) {
  810.             $address $entity->getAddress();
  811.             if ($entity->getLocalisation() && $entity->getLocalisation()->getId()) {
  812.                 $address .= " " $entity->getLocalisation()->getZipcode() . " " $entity->getLocalisation()->getCity();
  813.             }
  814.             $faqs[] = [
  815.                 "question" => "Quelle est l'adresse" . ($ortho->getTitle() == "Mme" " de " " du ") . $nomortho " ?",
  816.                 "response" => "L'adresse" . ($ortho->getTitle() == "Mme" " de " " du ") . $nomortho " est " $address
  817.             ];
  818.             $phone $entity->getPhone();
  819.             if ($phone) {
  820.                 $faqs[] = [
  821.                     "question" => "Comment contacter " $nomortho " ?",
  822.                     "response" => "Il est possible de contacter " $nomortho " par téléphone au " $phone "."
  823.                 ];
  824.             }
  825.         }
  826.         //$placename = $cabinet ? $entity->getName() : $entity->getCorporateName();
  827.         $placeType $cabinet "cabinet" "service";
  828.         if ($otherOrthos) {
  829.             $suffix sizeof($otherOrthos) > "s" "";
  830.             $suffix_ENT sizeof($otherOrthos) > "nt" "";
  831.             $placeAddress " " $entity->getAddress();
  832.             if ($entity->getLocalisation() && $entity->getLocalisation()->getId()) {
  833.                 $placeAddress .= " " $entity->getLocalisation()->getZipcode() . " " $entity->getLocalisation()->getCity();
  834.             }
  835.             $response_txt "";
  836.             foreach ($otherOrthos as $doc) {
  837.                 $response_txt .= "<li>" $doc->getTitle() . " " $doc->getFirstName() . " " $doc->getName() . "</li>";
  838.             }
  839.             $faqs[] = [
  840.                 "question" => "Quels sont les autres orthophonistes du " $placeType . ($ortho->getTitle() == "Mme" " de " " du ") . $nomortho " ?",
  841.                 "response" => sizeof($otherOrthos) . " autre" $suffix " orthophoniste" $suffix " exerce" $suffix_ENT " également dans le " $placeType . ($ortho->getTitle() == "Mme" " de " " du ") . $nomortho " :<ul>" $response_txt "</ul>"
  842.             ];
  843.         }
  844.         if ($transport_communs) {
  845.             $response_txt "<ul>";
  846.             foreach ($transport_communs as $type => $tc) {
  847.                 $type $type == 'buses' 'Bus - ' : ($type == 'subways' 'Métro - ' 'Tram - ');
  848.                 foreach ($tc as $value) {
  849.                     $response_txt .= "<li>" $type $value->name "</li>";
  850.                 }
  851.             }
  852.             $response_txt .= "</ul>";
  853.             $faqs[] = [
  854.                 "question" => "Comment accéder au " $placeType . ($ortho->getTitle() == "Mme" " de " " du ") . $nomortho " par les transports en commun ?",
  855.                 "response" => "Le " $placeType . ($ortho->getTitle() == "Mme" " de " " du ") . $nomortho " est situé à proximité des arrêts suivants :<ul>" $response_txt "</ul>"
  856.             ];
  857.         }
  858.         $this->setTemplateParameters(array('faqs' => $faqs));
  859.         return $this->renderTemplate('pages/annuaire_page_Orthophonist.twig');
  860.     }
  861.     public function getSpecialisation(SpeechTherapist $ortho)
  862.     {
  863.         $result = [];
  864.         $specialites = array(
  865.             'Aphasie''Articulation''Apprentissage de la voix''Apprentissage de la voix oesophagienne''Autisme''Bégaiement''Déglutition primaire''Démutisation''Division palatine''Dysarthrie',
  866.             'Dyscalculie''Dyslexie''Dysorthographie''Dysphagie''Dysphasie''Laryngectomie''Lecture labiale''Prise en charge maladie neuro-végétatives''Rééducation tubaire''Surdité''Trisomie''Trouble de la parole et du langage''Trouble de la voix''Trouble neuro-visuels''Rééducation à domicile''Rééducation langues étrangères'
  867.         );
  868.         for ($i 0$i <= 25$i++) {
  869.             if ($ortho->{'getAdvertisers' $i}() == 1) {
  870.                 if ($i == 25 && !empty($ortho->getAdvertisers25Text()))
  871.                     $result[] = $specialites[$i] . " (" $ortho->getAdvertisers25Text() . ")";
  872.                 else {
  873.                     $result[] = $specialites[$i];
  874.                 }
  875.             }
  876.         }
  877.         if (!empty($ortho->getSpecialtyIfAdvertisers()))
  878.             $result[] = $ortho->getSpecialtyIfAdvertisers();
  879.         return $result;
  880.     }
  881. }