src/Controller/TextController.php line 673

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\ClassTheatre\asides;
  4. use App\ClassTheatre\TheatreController;
  5. use App\Exception\RedirectException;
  6. use App\Service\Abonnements\Abonnements;
  7. use App\Service\Ajoutaides;
  8. use App\Service\Functions;
  9. use App\Service\TheatreMail\SendmailTheatre;
  10. use App\Service\UtilsEdit;
  11. use Doctrine\ORM\EntityManagerInterface;
  12. use Psr\Log\LoggerInterface;
  13. use Symfony\Component\Form\Extension\Core\Type\FormType;
  14. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  15. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  16. use Symfony\Component\Form\FormFactoryInterface;
  17. use Symfony\Component\HttpFoundation\RedirectResponse;
  18. use Symfony\Component\HttpFoundation\Request;
  19. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  20. use Symfony\Component\Routing\Annotation\Route;
  21. use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
  22. use Symfony\Component\Validator\Constraints\NotBlank;
  23. use Symfony\Contracts\Translation\TranslatorInterface;
  24. use TheatreCore\Entity\BookmarkExtranetuser;
  25. use TheatreCore\Entity\Contents;
  26. use TheatreCore\Entity\Extranetusers;
  27. use TheatreCore\Entity\Multimedias;
  28. use TheatreCore\Entity\News;
  29. use TheatreCore\Entity\Persons;
  30. use TheatreCore\Entity\Playlists;
  31. use TheatreCore\Entity\Podcasts;
  32. use TheatreCore\Entity\Schedules;
  33. use TheatreCore\Entity\Spectacles;
  34. use TheatreCore\Entity\Stats;
  35. use TheatreCore\Entity\TextAide;
  36. use TheatreCore\Entity\Texts;
  37. use TheatreCore\Entity\Tplmessages;
  38. use Zend\Code\Scanner\Util;
  39. class TextController extends TheatreController
  40. {
  41.     // id du texte
  42.     protected $idtext null;
  43.     // object texts
  44.     protected $texts;
  45.     // infos sur le texte
  46.     protected $txt null;
  47.     // object contents
  48.     protected $contents;
  49.     // précision fil d'arianne
  50.     protected $locate null;
  51.     // titre de la page
  52.     protected $title_page null;
  53.     // nombre de com sur le spectacle
  54.     protected $nb_comments 0;
  55.     // paramètres pour les commentaires
  56.     protected $params_comments = array();
  57.     // meta keywords et meta description
  58.     protected $meta_keywords '';
  59.     protected $meta_description '';
  60.     // infos pour mon théâtre
  61.     protected $mtinfos = array();
  62.     // taille maxi des vidéos
  63.     protected $other_dimensions = array();
  64.     // nombre de mises en scène
  65.     protected $nbmes 0;
  66.     // nombre de mises en scène en langue original
  67.     protected $nbmes_original 0;
  68.     // nombre de mises en scène en traduit
  69.     protected $nbmes_translate 0;
  70.     // nombre de traductions
  71.     protected $nbtrad 0;
  72.     // type de page
  73.     protected $type null;
  74.     // pour la navigation
  75.     protected $extra_title '';
  76.     protected $extra_locate '';
  77.     // asides
  78.     protected $asides "";
  79.     private $logger;
  80.     // {{{ _construct()
  81.     public function __construct(
  82.         EntityManagerInterface $em,
  83.         TranslatorInterface $translator,
  84.         TokenStorageInterface $tokenStorage,
  85.         Functions $func,
  86.         Abonnements $abonnements,
  87.         LoggerInterface $logger
  88.     )
  89.     {
  90.         // surbrillance du menu principal (thnet)
  91.         $GLOBALS['rub_courante'] = 'textes';
  92.         parent::__construct($translator$tokenStorage);
  93.         $this->context['controller'] = 'textes';
  94.         $this->em $em;
  95.         $this->func $func;
  96.         $this->serviceAbonnements $abonnements;
  97.         $this->asides = new asides();
  98.         $this->logger $logger;
  99.     }
  100.     // }}}
  101.     public function InitController($slug null$action null)
  102.     {
  103.         $this->view->action $this->context['action'] = $action;
  104.         $this->RouterOptions($slug$action$GLOBALS['rub_courante']);
  105.         $this->view->controller $GLOBALS['rub_courante'];
  106.         $this->context['view']->jquery_flash true;
  107.         // identifiant du texte
  108.         $params['idtext'] = $this->context['id'] = $this->idtext $this->id;
  109.         // si le texte n'existe pas, on renvoi sur une page d'erreur (a faire !!!)
  110.         if (empty($params['idtext'])) {
  111.             throw new RedirectException($this->context['url_module'].'/erreur/');
  112.         }
  113.         // instancier un objet
  114.         $this->texts $this->em->getRepository(Texts::class);
  115.         //si la langue n'est pas le français je cherche le titre traduit
  116.         if ($this->context['lng'] != 'fr') {
  117.             $this->view->translateTitle $this->texts->getTranslateTitle($this->idtext$this->context['lng']);
  118.         }
  119.         // type de page
  120.         if (array_key_exists('type',$this->context['params'])) {
  121.             $this->type $this->context['params']['type'];
  122.         } else {
  123.             $this->type null;
  124.         }
  125.         // recupere l'enregistrement et le met dans un array
  126.         $this->txt $this->texts->getInfosText($this->idtext);
  127.         // compter le nombre de mes en ligne
  128.         $this->nbmes $this->texts->countSpectacles($this->idtexttrue, array('countforeignshow' => true));
  129.         // compter le nombre de traductions en ligne
  130.         $this->nbtrad $this->texts->countTranslations($this->idtext,1);
  131.         // editeur du texte
  132.         if (!empty($this->texts->idcontact_publisher)) {
  133.             $this->txt['publisher'] = $pub $this->texts->idcontact_publisher;
  134.             if (!empty($pub->country)) {
  135. //                $pub_country = $pub->getLink('country');
  136. //                $this->txt['publisher']['country'] = $pub_country->fr;
  137.             } else {
  138.                 unset($this->txt['publisher']['country']);
  139.             }
  140.         }
  141.         /* format vignette couverture */
  142.         $format_vignette = array('width' => $_ENV['VIGN_TEXT_WIDTH'], 'height' => $_ENV['VIGN_TEXT_HEIGHT'],'direction'=>'thumb');
  143.         // recuperer la couv
  144.         $this->contents $this->em->getRepository(Contents::class);
  145.         $illustrations $this->contents->getIllustrations($this->idtext,'texts','class_couv',$format_vignette);
  146.         if (!empty($illustrations)) {
  147.             // illustrations
  148.             $this->txt['illustrations'] = $illustrations['illustrations'];
  149.             // vignettes
  150.             if (!empty($illustrations['vignette_object'])) {
  151.                 $this->txt['vignette_object'] = $illustrations['vignette_object'];
  152.             }
  153.         }
  154.         $this->view->section_type 'oeuvre';
  155.         // id du texte
  156.         $this->view->idtext $this->idtext;
  157.         // traduction ou texte original ?
  158.         if ($this->txt['typetxt']=='translate' && !empty($this->txt['idtextoriginal'])) {
  159.             // les textes originaux
  160.             $txtorig $this->em->getRepository(Texts::class);
  161.             $this->txt['originaltext'] = $txtorig->getInfosText($this->txt['idtextoriginal']);
  162.             // pas de virgule sur le dernier translator
  163.             if (array_key_exists('alltranslators'$this->txt)) {
  164.                 $this->txt['alltranslators'] = $this->texts->noPunct($this->txt['alltranslators']);
  165.             }
  166.         }
  167.         // adaptation
  168.         if (array_key_exists('adaptation_infos'$this->txt) && !empty($this->txt['adaptation_infos'])) {
  169.             foreach ($this->txt['adaptation_infos'] as $k=>$v) {
  170.                 $adapt $this->em->getRepository(Texts::class);
  171.                 $adaptations[$k] = $adapt->getInfosText($k);
  172.             }
  173.             $adaptations $this->texts->noPunct($adaptations);
  174.             $this->txt['texts_adaptation'] = $adaptations;
  175.             $this->view->adaptation true;
  176.         }
  177.         $this->txt['jsonld'] = $this->texts->makeJsonLD($this->txt);
  178.         $this->view->meta_text true;
  179.         // pas de virgule sur le dernier author
  180.         if (array_key_exists('allauthors'$this->txt)) {
  181.             $this->txt['allauthors'] = $this->texts->noPunct($this->txt['allauthors']);
  182.         }
  183.         // titre de la page
  184.         $aut = array();
  185.         foreach ($this->txt['allauthors'] as $k=>$v) {
  186.             $aut[] = $v['firstname'].' '.$v['lastname'];
  187.         }
  188.         $this->view->data_text $this->txt;
  189.         if (!empty($aut)) {
  190.             $authors_string join(', '$aut);
  191.         } else {
  192.             $authors_string null;
  193.         }
  194.         // titre de la page (auteur + metteur + spectacle)
  195.         $this->title_page $this->txt['title'].' - '.$authors_string;
  196.         // style des texte
  197.         $this->style_more = array('dossier','texte');
  198.         // fil d'arianne
  199.         $this->locate = array(
  200.             '/editions/' => '&Eacute;ditions',
  201.             '/textes/'.$this->txt['url_clean'].'/' => $this->txt['title'],
  202.         );
  203.     }
  204.     // }}}
  205.     // {{{ finalizeAction()
  206.     /** S'execute après chaque action
  207.      *
  208.      *
  209.      * @access protected
  210.      * @return void
  211.      */
  212.     protected function finalizeAction()
  213.     {
  214.         // titre de la page
  215.         if ($this->extra_title) {
  216.             $this->title_page $this->extra_title.' - '.$this->title_page;
  217.         }
  218.         // complément fil d'arianne
  219.         if ($this->extra_locate) {
  220.             $this->locate[0] = $this->extra_locate;
  221.         }
  222.         // retourner toutes les variables a la vue
  223.         foreach ($this->txt as $key=>$value) {
  224.             $this->view->$key $value;
  225.         }
  226.         $this->buildMenu();
  227.         $this->view->page_info 'texte';
  228.         if (empty($this->current['idcontent'])) {
  229.             $this->current['idcontent'] = null;
  230.         }
  231.         // voir si l'objet est bookmarke
  232. //        $bookmark = $this->em->getRepository(BookmarkExtranetuser::class);
  233. //        if ($this->context['session']->isLogged('montheatre')
  234. //            && $bookmark->isBookmark($this->idtext,'texts',$this->context['session']->getValue('idextranetuser'))) {
  235. //            $this->view->is_bookmark = true;
  236. //        }
  237.         // action add/delete bookmark
  238.         if (isset($_GET['bookmark'])) {
  239.             $this->view->bookmark true;
  240.             $do_action $_GET['do_action'];
  241.             $this->view->$do_action true;
  242.         }
  243.         // statistique
  244.         // TODO: A supprimer lors de la release condition
  245.         if (!empty($this->idtext) && !$this->no_stats) {
  246.             $statsinfos = array(
  247.                 'type' => 'article',
  248.                 'module' => $this->context['module'],
  249.                 'url' => $_SERVER['REQUEST_URI'],
  250.                 'idcontent' => (int)$this->current['idcontent'],
  251.                 'object' => 'texts',
  252.                 'idobject' => $this->idtext,
  253.                 'video' => (int)(!empty($this->view->detailarticle['display_media']))
  254.             );
  255.             $stats $this->em->getRepository(Stats::class);
  256.             $stats->setStats($statsinfos__FILE__.':'.__LINE__);
  257.         }
  258.         // pour les liens dans les templates
  259.         $this->view->url_folder '/textes/'.$this->txt['url_clean'];
  260.         // autres infos
  261.         $this->mtinfos = array(
  262.             'object' => 'texts',
  263.             'idobject' => $this->idtext,
  264.             'urifrom' => $this->view->url_folder,
  265.             'info_rub' => 'ce texte',
  266.             'idcontent' => (int)$this->current['idcontent'],
  267.         );
  268.         $this->view->mtinfos $this->mtinfos;
  269.         //aside
  270.         $this->view->aside $this->asides->view($this->view);
  271.         // fil d'arianne
  272.         $this->view->locate $this->getLocate();
  273.         // titre meta
  274.         $this->view->title_page $this->getTitlePage();
  275.         // style en plus
  276.         $this->view->style_more $this->getStyleMore();
  277.         // keywords et description
  278.         $this->view->meta_keywords $this->getMetaKeywords();
  279.         $this->view->meta_description $this->getMetaDescription();
  280.         $this->addPubliciteGoogle();
  281.     }
  282.     // }}}
  283.     // {{{ buildMenu()
  284.     protected function buildMenu()
  285.     {
  286.         $this->current = array();
  287.         $this->current['idcontent'] = 0;
  288.         $this->current['menu_name'] = '';
  289.         // menu
  290.         $menu_texte = array(
  291.             array('url'=>'','name'=>'Présentation','icone'=>'10-medical.png','id'=>'home'),
  292.             array('url'=>'ensavoirplus','name'=>$this->context['tr']->trans('en_savoir_plus'),'idclassification'=>'6','type'=>true,'icone'=>'179-notepad4.png','id'=>'ensavoirplus'),
  293.             array('url'=>'articles','name'=> 'Articles','idclassification'=>'214','type'=>true,'icone'=>'179-notepad4.png','id'=>'ensavoirplus'),
  294.             array('url'=>'extraits','name'=>$this->context['tr']->trans('extraits'),'idclassification'=>'7','type'=>true,'icone'=>'46-movie-2.png','id'=>'extraits'),
  295.             array('url'=>'entretiens','name'=>$this->context['tr']->trans('entretiens'),'idclassification'=>'8','type'=>true,'icone'=>'179-notepad4.png','id'=>'entretiens'),
  296.         );
  297.         $this->nbmes_original $this->em->getRepository(Spectacles::class)->countSpectaclesInSpecificLanguage(
  298.             [
  299.                 'id_text' => $this->idtext,
  300.                 'lang' => $this->context['view']->data_text['language_src']
  301.             ]
  302.         );
  303.         if ($this->nbmes_original>0) {
  304.             $menu_texte[] = array('url'=>'mises-en-scene','name'=>'En sc&egrave;ne ('.$this->nbmes_original.')','icone'=>'28-star.png','id'=>'mises-en-scene');
  305.         }
  306.         else if ($this->nbtrad>0) {
  307.             $menu_texte[] = array('url'=>'traductions-en-scene','name'=>'En sc&egrave;ne ('.$this->nbtrad.')','icone'=>'28-star.png','id'=>'traductions-en-scene');
  308.         }
  309.         $countecouter $this->em->getRepository(Podcasts::class)->countPodcasts('texts',$this->idtext'franceinter');
  310.         $countecouter += $this->em->getRepository(Podcasts::class)->countPodcasts('texts',$this->idtext'soundcloud');
  311.         if ($countecouter){
  312.             $menu_texte[] = array('url'=>'podcasts','name'=> html_entity_decode('&Eacute;couter'),'icone'=>'179-notepad4.png','id'=>'podcasts');
  313.         }
  314.         if ($this->nbtrad>0) {
  315.             $menu_texte[] = array('url'=>'traductions','name'=>'Traductions ('.$this->nbtrad.')','icone'=>'179-notepad4.png','id'=>'traductions');
  316.         }
  317.         // génése
  318.         $nb_class_genese $this->em->getRepository(Contents::class)->countAssociateContent('texts',$this->idtext,'class_genese');
  319.         if ($nb_class_genese>0) {
  320.             $menu_texte[] = array(
  321.                 'url' => 'genese',
  322.                 'name' => 'Genèse',
  323.                 'idclassification' => '56',
  324.                 'id'=>'genese'
  325.             );
  326.         }
  327.         // voir s'il y a des contenus le texte par l'auteur
  328.         if ($this->em->getRepository(Playlists::class)->countPlaylists('texts',$this->idtext,'class_texte_parauteur')>0) {
  329.             $playlist $this->em->getRepository(Playlists::class)->getByClassification('texts',$this->idtext,'class_texte_parauteur');
  330.             $texte_playlist 'Le texte par l\'auteur';
  331.             $menu_texte[] = array('url' => 'playlist/id/'.$playlist['urlClean'], 'name' => $texte_playlist'id' => 'playlists');
  332.         }
  333.         // voir s'il y a des contenus vidéos
  334.         if ($this->em->getRepository(Playlists::class)->countPlaylists('texts',$this->idtext,'class_en_video')>0) {
  335.             $playlist $this->em->getRepository(Playlists::class)->getByClassification('texts',$this->idtext,'class_en_video');
  336.             $texte_playlist 'En vidéo ';
  337.             $menu_texte[] = array('url' => 'playlist/id/'.$playlist['urlClean'], 'name' => $texte_playlist'id' => 'playlists');
  338.         }
  339.         // voir s'il y a des contenus le texte par le traducteur
  340.         if ($this->em->getRepository(Playlists::class)->countPlaylists('texts',$this->idtext,'class_texte_par_traducteur')>0) {
  341.             $playlist $this->em->getRepository(Playlists::class)->getByClassification('texts',$this->idtext,'class_texte_par_traducteur');
  342.             $texte_playlist 'Le texte par le traducteur';
  343.             $menu_texte[] = array('url' => 'playlist/id/'.$playlist['urlClean'], 'name' => $texte_playlist'id' => 'playlists');
  344.         }
  345.         $menu_texte[] = array('url'=>'contenus-pedagogiques','name'=>'Éduc','idclassification'=>'125','id'=>'educ');
  346.         $evenements_params_commun = array(
  347.             'special' => array(
  348.                 'publish_valid' => true,
  349.                 'no_schedule_contact' => true,
  350.                 'by_object' => array('idtext' => $this->idtext),
  351.             )
  352.         );
  353.         if ($counts_events $this->em->getRepository(News::class)->countNews($evenements_params_commun)){
  354.             $menu_texte['evenements'] = array('url'=>'evenements','name'=> 'Evenements ('.$counts_events.')');
  355.         }
  356.         $mark_active'active';
  357.         foreach ($menu_texte as $key=>$value) {
  358.             //compter le nombre de contenus associes
  359.             if (isset($value['idclassification']) && $value['idclassification']!='') {
  360.                 $count $this->contents->countAssociateContent('texts',$this->idtext,$value['idclassification']);
  361.                 //pas de contenu, enlever l'item du menu
  362.                 if ($count==0) {
  363.                     // si il n'y a pas de contenus-pedagogiques, vérifier que les mises en scène liées non pas elle un contenu
  364.                     if ($value['url']=='contenus-pedagogiques') {
  365.                         $nb_spectacles_educ $this->contents->countSpectaclesWithContentsFromTexts($this->idtext,125); // 125 = contenus éduc
  366.                         if ($nb_spectacles_educ==0) {
  367.                             unset($menu_texte[$key]);
  368.                         }
  369.                     } else {
  370.                         //vider la ligne courante
  371.                         unset($menu_texte[$key]);
  372.                     }
  373.                 }
  374.             }
  375.             if ((empty($value['url']) && $this->context['action']=='detail-texte')
  376.                 || (!empty($this->type) && $value['url']==$this->type)
  377.                 || $value['url']==$this->context['action']) {
  378.                 $menu_texte[$key]['active'] = $mark_active;
  379.                 $this->current['menu_name'] = $menu_texte[$key]['name'];
  380.             }
  381.         }
  382.         if (strpos($this->context['action'],'playlist')!==false) {
  383.             foreach ($menu_texte as $k=>$v) {
  384.                 if (strpos($v['url'],'playlist')!==false && strpos($_SERVER['REQUEST_URI'],$v['url'])) {
  385.                     $menu_texte[$k]['active'] = 'on';
  386.                     $this->current['menu_name'] = $menu_texte[$k]['name'];
  387.                     break;
  388.                 }
  389.             }
  390.         }
  391.         if ($this->context['action']=='traductions-en-scene') {
  392.             foreach ($menu_texte as $k=>$v) {
  393.                 if ($v['url']=='mises-en-scene') {
  394.                     $menu_texte[$k]['active'] = 'on';
  395.                     $this->current['menu_name'] = $menu_texte[$k]['name'];
  396.                 }
  397.             }
  398.         }
  399.         $this->view->menu_texte $menu_texte;
  400.     }
  401.     // }}}
  402.     // {{{ contenus()
  403.     /** Les articles associés aux textes
  404.      *
  405.      */
  406.     public function contenus_text($type_class$type_class_view$other_dimensions=array('width'=>500'grow'=>false), $params=array())
  407.     {
  408.         parent::contenus('texts',$this->idtext,$type_class,$type_class_view,$other_dimensions,$params);
  409.     }
  410.     // }}}
  411.     // {{{ contenus_extraits()
  412.     /** Les articles associés aux textes
  413.      *
  414.      */
  415.     public function contenus_extraits($type_class$type_class_view$other_dimensions=array('width'=>500'grow'=>false), $params=array())
  416.     {
  417.         // grouper par langue
  418.         // si on a plusieurs classifications = sous-sous-sous-sous-menu
  419.         if (is_array($type_class)) {
  420.             $multiple true;
  421.             foreach ($type_class as $c) {
  422.                 $type_class_tab[] = '\''.$c.'\'';
  423.             }
  424.         }
  425.         // pour le template = ce qui est ajouté au lien
  426.         $this->view->type_class $type_class_view;
  427.         // requete SQL pour la liste des contenus associe a la classification
  428.         $sql 'SELECT c.title,c.idcontent,c.display_media,c.language,cl.classification,cl.idclassification';
  429.         // select en plus
  430.         if (!empty($params['select'])) {
  431.             $sql .= ','.$params['select'];
  432.         }
  433.         $sql .= ' FROM contents c, content_classification cc, classifications cl, object_content oc ';
  434.         // from en plus
  435.         if (!empty($params['from'])) {
  436.             $sql .= ','.$params['from'];
  437.         }
  438.         // join en plus
  439.         if (!empty($params['join'])) {
  440.             $sql .= $params['join'];
  441.         }
  442.         $sql .= ' WHERE oc.idcontent=c.idcontent
  443.                    AND cc.idcontent=c.idcontent
  444.                    AND cc.idclassification=cl.idclassification
  445.                    AND oc.object=\''.$object.'\' ';
  446.         if (!empty($params['where'])) {
  447.             $sql .= ' AND '.$params['where'];
  448.         } else {
  449.             $sql .= ' AND oc.idobject='.(int)$idobject;
  450.         }
  451.         if (!empty($params['specif_sql'])) {
  452.             $sql $params['specif_sql'];
  453.         }
  454.         if (!empty($multiple)) {
  455.             $sql .= ' AND cl.classification IN ('.join(','$type_class_tab).') ';
  456.         } else {
  457.             $sql .= ' AND cl.classification=\''.$type_class.'\' ';
  458.         }
  459.         $sql .= ' ORDER BY c.`range`,c.dateinsert ASC';
  460.         //AND oc.object='spectacles' AND c.language='".$lng."'
  461.         $articles_folder = new Articles_folder($this->context);
  462.         // taille maxi des vidéos
  463.         if (!empty($this->other_dimensions)) {
  464.             $articles_folder->setOtherDimensions($this->other_dimensions);
  465.         }
  466.         //echo $sql;
  467.         $articles_folder->execQuery($sql);
  468.         // liste des articles
  469.         $articles $articles_folder->getArticles();
  470.         // article sur lequel on se trouve
  471.         $detailarticle $articles_folder->getDetailArticle();
  472.         // marquer le contenu associé courant
  473.         if (!empty($detailarticle['idcontent'])) {
  474.             $this->current['idcontent'] = $detailarticle['idcontent'];
  475.         }
  476.         // génération des mots-clés pour les méta
  477.         if (!empty($articles)) {
  478.             foreach ($articles as $v) {
  479.                 if (!empty($v['content'])) {
  480.                     foreach ($v['content'] as $vv) {
  481.                         if (!empty($vv['title'])) {
  482.                             $this->meta_keywords .= ' '.$vv['title'];
  483.                         }
  484.                     }
  485.                 }
  486.             }
  487.         }
  488.         // pour le template
  489.         $this->view->articles $articles;
  490.         // pour le template
  491.         $this->view->detailarticle $detailarticle;
  492.         // titre de la page
  493.         if (empty($detailarticle['title']) || trim($detailarticle['title']) == '') {
  494.             if (!empty($this->current['menu_name'])) {
  495.                 $this->extra_locate $this->extra_title $this->current['menu_name'];
  496.             } else {
  497.                 $this->extra_locate $this->extra_title 'En savoir plus';
  498.             }
  499.         } else {
  500.             $this->extra_title $detailarticle['title'];
  501.             $this->extra_locate $this->contents->cutSentence($detailarticle['title'],40);
  502.         }
  503.         // statistiques TODO et pour le reste qui n'est pas "ensavoirplus" ?
  504.         if (in_array($this->context['action'], array('ensavoirplus'))) {
  505.             $statsinfos = array(
  506.                 'type' => 'article',
  507.                 'module' => $this->context['module'],
  508.                 'url' => $_SERVER['REQUEST_URI'],
  509.                 'idcontent' => (int)$this->current['idcontent'],
  510.                 'object' => 'texts',
  511.                 'idobject' => $idobject,
  512.                 'video' => (int)(!empty($detailarticle['display_media']))
  513.             );
  514.             $stats $this->em->getRepository(Stats::class);
  515.             $stats->setStats($statsinfos__FILE__.':'.__LINE__);
  516.         }
  517.     }
  518.     // }}}
  519.     // {{{ action_detail_texte()
  520.     /** Détails concernant le texte (accueil)
  521.      *
  522.      * @Route("/textes/{slug}/", name="text_index")
  523.      * @Route("/textes/{slug}/infos-texte", name="text_index_infos_texte")
  524.      *
  525.      * @access public
  526.      * @return void
  527.      */
  528.     public function action_detail_texte(
  529.         $slug null,
  530.         Request $request,
  531.         SendmailTheatre $sendmailTheatre
  532.     )
  533.     {
  534.         $this->InitController($slug'detail-texte');
  535.         if (empty($this->idtext)) {
  536.             return $this->redirectToRoute('erreur_type', ['type' => 'introuvable']);
  537.         }
  538.         // Vérification utilisateur connecté (pour pouvoir effectuer une demande de téléchargement de texte par email)
  539.         if ($this->context['session'] instanceof Extranetusers) {
  540.             $this->context['view']->userIsConnected true;
  541.         }
  542.         // Gestion de la demande de texte par email
  543.         if (isset($_GET['demande-texte-par-email'])) {
  544.             $this->context['view']->download_by_mail_request['onGoing'] = true;
  545.             // L'utilisateur demande à voir le formulaire de demande de texte par email
  546.             if (isset($this->context['view']->userIsConnected)) {
  547.                 $this->context['view']->download_by_mail_request['userEmail'] = $this->em->getRepository(Extranetusers::class)->getEmail($this->context['session']->getIdExtranetuser());
  548.             }
  549.             $this->context['formFactory'] = $formFactory $this->get('form.factory')->createBuilder(FormType::class, null, [
  550.                 'attr' => [
  551.                     'id' => 'get-text-by-mail-form'
  552.                 ]
  553.             ]);
  554.             $formFactory->add('mail_message'TextareaType::class, [
  555.                 'label' => false,
  556.                 'required' => true,
  557.                 'constraints' => [
  558.                     new NotBlank([
  559.                         'message' => 'Veuillez écrire un messsage'
  560.                     ])
  561.                 ],
  562.                 'attr' => [
  563.                     'rows' => 8,
  564.                     'cols' => 100
  565.                 ]
  566.             ]);
  567.             $formFactory->add('validation'SubmitType::class, [
  568.                 'label' => 'Envoyer la demande',
  569.                 'attr' => [
  570.                     'class' => 'boutform boutbig tc-bgcolor-editions'
  571.                 ]
  572.             ]);
  573.             $this->context['form'] = $form $formFactory->getForm();
  574.             // L'utilisateur vient d'envoyer le formulaire de demande de texte par email
  575.             $form->handleRequest($request);
  576.             if ($form->isSubmitted() && $form->isValid()) {
  577.                 // Récupération des adresses email nécessaires
  578.                 $mailFrom $this->context['view']->download_by_mail_request['userEmail'];
  579.                 $text_aide $this->em->getRepository(TextAide::class);
  580.                 $mailTo $text_aide->getEmailToDownloadText($this->idtext);
  581.                 // Récupération du ou des auteurs
  582.                 $textAuthors '';
  583.                 $i 0;
  584.                 $max count($this->txt['authors']);
  585.                 foreach($this->txt['authors'] as $author) {
  586.                     $i++;
  587.                     if ($i === 1) {
  588.                         $textAuthors .= ' de ' $author['firstname'] . ' '$author['lastname'];
  589.                     } else if ($i === $max) {
  590.                         $textAuthors .= ' et ' $author['firstname'] . ' ' $author['lastname'];
  591.                     } else {
  592.                         $textAuthors .= ', ' $author['firstname'] . ' ' $author['lastname'];
  593.                     }
  594.                 }
  595.                 // Récupération de l'url de la page de présentation du texte voulu
  596.                 $pageUrl 'https://www.theatre-contemporain.net' explode('?'$_SERVER['REQUEST_URI'])[0];
  597.                 // Récupération du template de l'email
  598.                 $templateRepo $this->em->getRepository(Tplmessages::class);
  599.                 $mailTemplate $templateRepo->findOneBy(['name' => 'Lire un texte']);
  600.                 // Les variables utilisées dans le template de l'email
  601.                 $values = [
  602.                     'download_title' => $this->txt['title'],
  603.                     'download_authors' => $textAuthors,
  604.                     'download_page_url' => $pageUrl,
  605.                     'download_applicant_first_name' => $this->context['session']->getFirstName(),
  606.                     'download_applicant_last_name' => $this->context['session']->getLastName(),
  607.                     'download_applicant_email' => $mailFrom,
  608.                     'download_applicant_message' => $form->get('mail_message')->getData(),
  609.                     'download_mail_subject' => ''
  610.                 ];
  611.                 // Création du sujet de l'email
  612.                 $mailSubject $templateRepo->setTemplateMsg($mailTemplate->getSubject(), $values);
  613.                 // Ajout de la variable manquante
  614.                 $values['download_mail_subject'] = $mailSubject;
  615.                 // Création du contenu de l'email
  616.                 // J'ai utilisé urldecode car certaines variables ###var### sont encodées en %23 en BDD
  617.                 $mailBody $templateRepo->setTemplateMsg(urldecode($mailTemplate->getMessage()), $values);
  618.                 // Création de l'email
  619.                 $sendmailTheatre->setSubject($mailSubject);
  620.                 $sendmailTheatre->setExpediteur('noreply@theatre-contemporain.net');
  621.                 $sendmailTheatre->setDestinataire($mailTo);
  622.                 $sendmailTheatre->prepareSimple($mailBody);
  623.                 // Envoi de l'email
  624.                 try {
  625.                     $sendmailTheatre->send();
  626.                     $this->context['view']->download_by_mail_request['mail_sent_message']['success'] = 'Votre message a bien été envoyé.';
  627.                  } catch (Exception $e) {
  628.                     $this->logger->error($e->getMessage());
  629.                     $this->logger->debug($e->getTraceAsString());
  630.                      //                            $this->context['tr']->setParams(array('contact_support' => $this->page_support));
  631.                       $this->context['error']['no'] = $this->context['tr']->trans('error_no_sendmessage');
  632.                 }
  633.             }
  634.             // Utilisé pour la demande du formulaire et après envoi du form
  635.             return $this->view('textes/detail-texte.html.twig', [
  636.                 'form' => $form->createView()
  637.             ]);
  638.         }
  639.         // Affichage normal de la page
  640.         else {
  641.             // indique que l'on est sur la page d'acceuil
  642.             $this->view->is_accueil true;
  643.             //@todo le contenu de get_mises_en_scene
  644.             $this->get_mises_en_scene();
  645.             //personnages ?
  646.             if (!empty($this->texts->nmale) || !empty($this->texts->nfemale) || !empty($this->texts->npeople)) {
  647.                 $this->txt['personnages'] = 1;
  648.             }
  649.             // contact de representation
  650.             if (!empty($this->texts->requestPerformingText) || !empty($this->texts->idcontact_performing)) {
  651.                 $this->txt['request_performing'] = 1;
  652.                 // si c'est l'editeur qui est aussi authorisation de representation
  653.                 if ($this->texts->idcontact_performing && $this->texts->idcontact_performing === $this->texts->idcontact_publisher) {
  654.                     $this->txt['performing_is_publisher'] = 1;
  655.                 }
  656.                 if ($this->texts->idcontact_performing 0) {
  657.                     $performing $this->texts->getLink('idcontact_performing');
  658.                     $performing_country $performing->getLink('country');
  659.                     $this->txt['performing'] = $performing->objToArray();
  660.                     if (isset($performing_country->fr)) {
  661.                         $this->txt['performing']['country'] = $performing_country->fr;
  662.                     }
  663.                 }
  664.             }
  665.             //Récupérer le podcast disponible
  666.             $culturebox_params = array(
  667.                 'direction' => 'DESC',
  668.                 'limit' => array(01),
  669.                 'special' => array(
  670.                     'idtexts' => $this->idtext,
  671.                     'type_podcast' => ['franceinter''soundcloud'],
  672.                     // 'is_integrale' => true,
  673.                 ),
  674.                 'dbg' => array('derniers_culturebox_current''Les replay France Culture référencés'),
  675.             );
  676.             $last_podcast $this->em->getRepository(Podcasts::class)->getListPodcasts($culturebox_params, ['width' => 480'direction' => 'thumb']);
  677.             foreach ($last_podcast as $k => $podcast) {
  678.                 if (!empty($podcast['podcast_person'])) {
  679.                     foreach ($podcast['podcast_person'] as $k_person => $v_person)
  680.                         if (!empty($this->txt['authors'][$v_person['idperson']])) {
  681.                             $last_podcast[$k]['person'] = $v_person;
  682.                         }
  683.                 }
  684.             }
  685.             $this->view->last_podcast $last_podcast;
  686.             // contact de traduction
  687.             if (!empty($this->txt['requestTranslationText']) || !empty($this->txt['idcontact_publisher'])) {
  688.                 $this->txt['request_translation'] = 1;
  689.                 // si c'est l'editeur qui est aussi authorisation de traduction
  690.                 if (empty($this->texts->idcontact_translation) || $this->texts->idcontact_translation == $this->texts->idcontact_publisher) {
  691.                     $this->txt['translation_is_publisher'] = 1;
  692.                 }
  693.                 // fiche du contact de traduction
  694.                 if (!empty($this->texts->idcontact_translation) && $this->texts->idcontact_translation 0) {
  695.                     $ct_translation $this->texts->getLink('idcontact_translation');
  696.                     $ct_translation_country $ct_translation->getLink('country');
  697.                     $this->txt['ct_translation'] = $ct_translation->objToArray();
  698.                     if (is_object($ct_translation_country)) {
  699.                         $this->txt['ct_translation']['country'] = $ct_translation_country->fr;
  700.                     }
  701.                 }
  702.             }
  703.             if ($this->nbmes 0) {
  704.                 $this->view->mestxt true;
  705.             }
  706.             if ($this->nbtrad 0) {
  707.                 $this->view->tradtxt true;
  708.             }
  709.             if (($this->nbmes $this->nbtrad) > 0) {
  710.                 if ($this->txt['typetxt'] == 'translate') {
  711.                     $this->view->voiraussitranslate true;
  712.                 } else {
  713.                     $this->view->voiraussi true;
  714.                 }
  715.             }
  716.             if (!empty($this->txt['adaptation_infos'])) {
  717.                 $adap $this->em->getRepository(Texts::class);
  718.                 $this->txt['adaptation_text'] = $adap->getInfosText(key($this->txt['adaptation_infos']));
  719.             }
  720.             // conversion champs wiki
  721.             $wikifields = array(
  722.                 'textaccessmore',
  723.                 'publishinfos',
  724.                 'abstract',
  725.                 'moreinfo',
  726.                 'request_translation_text',
  727.                 'request_performing_text',
  728.                 'help_translation',
  729.                 'help_publishing',
  730.                 'help_other'
  731.             );
  732.             foreach ($wikifields as $v) {
  733.                 if (empty($this->txt[$v])) continue;
  734.                 $this->txt[$v] = $this->texts->wikiTransform($this->txt[$v], $this->txt['markdown']);
  735.             }
  736.             // trouver la quatrième de couverture
  737.             $quatrieme $this->contents->getAssociateContent($this->idtext'texts''class_4couv', array('wiki_convert' => true));
  738.             if (!empty($quatrieme)) {
  739.                 $this->txt['quatrieme'] = $quatrieme;
  740.             }
  741.             $this->context['view']->type_aides = array(
  742.                 'prix' => array(
  743.                     'type_aides' => array(23),
  744.                     'label' => 'Prix et distinctions',
  745.                 ),
  746.                 'soutiens' => array(
  747.                     'type_aides' => array(1),
  748.                     'label' => 'Aide(s) et soutien(s)',
  749.                 ),
  750.                 'selections' => array(
  751.                     'type_aides' => array(4),
  752.                     'label' => 'Sélection(s)',
  753.                 ),
  754.             );
  755.             $text_aide $this->em->getRepository(TextAide::class);
  756.             foreach ($this->context['view']->type_aides as $k => $v) {
  757.                 $params_sql_aide = array(
  758.                     'where' => array(
  759.                         array('text_aide''publish'1)
  760.                     ),
  761.                     'idtext' => $this->idtext,
  762.                     'special' => array(
  763.                         'aides' => array(
  764.                             'type_aides' => $v['type_aides']
  765.                         )
  766.                     ),
  767.                     'get_texts_with_aides' => true,
  768.                     'dbg' => array('text_' $k$v['label']),
  769.                 );
  770.                 $this->context['view']->type_aides[$k]['aides'] = $text_aide->getListTextAide($params_sql_aide);
  771.                 if (empty($this->context['view']->type_aides[$k]['aides'])) {
  772.                     unset($this->context['view']->type_aides[$k]);
  773.                 }
  774.             }
  775.             if (!empty($this->context['view']->type_aides['prix'])) {
  776.                 $this->context['view']->laureats_nominations $this->context['view']->type_aides['prix']['aides'];
  777.                 unset($this->context['view']->type_aides['prix']);
  778.             }
  779.             $hasEmailToDownloadText $text_aide->hasEmailToDownloadText($this->idtext);
  780.             if ($hasEmailToDownloadText) {
  781.                 $this->context['view']->download_text_by_mail_proposal true;
  782.             }
  783.             $urlToDownloadText $text_aide->getUrlToDownloadText($this->idtext);
  784.             if ($urlToDownloadText) {
  785.                 $this->context['view']->download_text_by_url_proposal['url'] = $urlToDownloadText;
  786.             }
  787.             $this->extra_locate 'Présentation du texte';
  788.             //Les évènements
  789.             $evenements_params_commun = array(
  790.                 'params' => array(
  791.                     'limit' => array(05),
  792.                 ),
  793.                 'special' => array(
  794.                     'publish_valid' => true,
  795.                     'prochains' => true,
  796.                     'no_schedule_contact' => true,
  797.                     'by_object' => array('idtext' => $this->idtext),
  798.                 ),
  799.             );
  800.             $evenements_params $evenements_params_commun;
  801.             $list_evenements $this->view->news_list_news['prochains'] = $this->em->getRepository(News::class)->getListNews($evenements_params);
  802.             if (count($list_evenements) <= 5) {
  803.                 $nb_evenements count($list_evenements);
  804.                 $this->view->is_news_list_news true;
  805.                 foreach ($list_evenements as $k => $v) {
  806.                     $exclude_news[$k] = $v['idnew'];
  807.                 }
  808.                 if (!empty($exclude_news)) {
  809.                     $evenements_params['params']['where'] = ' AND T1.idnew NOT IN (' join(','$exclude_news) . ') ';
  810.                 }
  811.                 unset($evenements_params['special']['prochains']);
  812.                 $evenements_params['special']['anciens'] = true;
  813.                 $evenements_params['params']['limit'] = array(0$nb_evenements);
  814.                 $this->view->news_list_news['anciens'] = $this->em->getRepository(News::class)->getListNews($evenements_params);
  815.             }
  816.             if (empty($this->view->news_list_news['anciens'])) {
  817.                 unset($this->view->news_list_news['anciens']);
  818.             }
  819.             if (empty($this->view->news_list_news['prochains'])) {
  820.                 unset($this->view->news_list_news['prochains']);
  821.             }
  822.             //        $this->view->next_news = $this->>em->getRepository(News::class)->getListNews($evenements_params);
  823.             //Les playlists
  824.             $playlists $this->em->getRepository(Playlists::class);
  825.             if ($this->em->getRepository(Playlists::class)->countPlaylists('texts'$this->idtext'class_texte_parauteur') > 0) {
  826.                 $playlist $this->em->getRepository(Playlists::class)->getByClassification('texts'$this->idtext'class_texte_parauteur');
  827.                 $url_clean_playlist filter_var($playlist['urlClean'], FILTER_SANITIZE_STRING);
  828.                 $idplaylist $playlists->getIdByUrl($url_clean_playlist);
  829.                 $playlist $playlists->getInfosPlaylist(
  830.                     $idplaylist,
  831.                     array(
  832.                         'all' => true,
  833.                         'multimedias' => true
  834.                     )
  835.                 );
  836.                 foreach ($playlist['multimedias'] as $k => $v) {
  837.                     $this->context['view']->video $v;
  838.                     break;
  839.                 }
  840.                 $this->context['view']->video['url_clean_more'] = 'playlist/id/' $playlist['urlClean'];
  841.             }
  842.             // On affiche le lieu du spectacle dans la page detail-texte
  843.             if (!empty($this->context['view']->spectacles['current']['spectacles'])) {
  844.                 foreach ($this->context['view']->spectacles['current']['spectacles'] as $k => $v) {
  845.                     $this->context['view']->spectacles['current']['spectacles'][$k]['footer_contact'] = true;
  846.                 }
  847.             }
  848.             //Nous récupérons les deux prochains spectacles à l'affiches en traduction
  849.             $schedules $this->em->getRepository(Schedules::class);
  850.             $spectacle $this->em->getRepository(Spectacles::class);
  851.             $list_spectacles $this->GetListSpectaclesFromSpecificLanguage(array('traduction' => true'limit' => '0,2''idtypespectacle' => 4));
  852.             foreach ($list_spectacles as $kb => $vb) {
  853.                 if (!isset($vb['collage'])) {
  854.                     foreach ($this->context['view']->traduc as $k => $v) {
  855.                         if (isset($vb['idtext']) && $v['idtext'] == $vb['idtext']) {
  856.                             if ($schedule_futur $schedules->getDateLieuDemain($vb['idspectacle'], nullnull'new')) {
  857.                                 $vb['annee_creation'] = $spectacle->getFormeDate($vb['creation_date'], '%Y'true); //%a %d/%m/%Y
  858.                                 $this->context['view']->spectacles_traductions["current"]["spectacles"][$vb['idspectacle']] = $vb;
  859.                                 $this->context['view']->spectacles_traductions["current"]["spectacles"][$vb['idspectacle']]['traduction'] = $this->context['view']->traduc[$k];
  860.                             }
  861.                         }
  862.                     }
  863.                 }
  864.             }
  865.             // voir si ce spectacle à un replay culturebox
  866.             $culturebox_params = array(
  867.                 'limit' => array(01),
  868.                 'special' => array(
  869.                     'idtexts' => array('idtext' => $this->idtext),
  870.                     'type_podcast' => 'culturebox',
  871.                 ),
  872.                 'dbg' => array('derniers_culturebox''Les derniers replay culturebox référencés'),
  873.             );
  874.             $format_vignette = array('width' => 680'direction' => 'thumb');
  875.             $this->context['view']->derniers_culturebox $x $this->em->getRepository(Podcasts::class)->getListPodcasts($culturebox_params$format_vignette);
  876.             //aside
  877.             $this->asides->load('textes_thumbnail');
  878.             $this->asides->load(['common_prochain_evenement' => array(
  879.                 'url_custom' => '/textes/' $this->context['view']->url_clean '/evenements'
  880.             )]);
  881.             $this->asides->load('common_participer_textes');
  882.             return $this->view('textes/detail-texte.html.twig');
  883.         }
  884.     }
  885.     // }}}
  886.     // {{{ action_mises_en_scene()
  887.     /** les mises en scène du texte
  888.      *
  889.      * @Route("/textes/{slug}/mises-en-scene/", name="text_mises_en_scene")
  890.      *
  891.      * @access public
  892.      * @return void
  893.      */
  894.     public function action_mises_en_scene($slug null)
  895.     {
  896.         $this->InitController($slug'mises-en-scene');
  897.         $list_spectacles $this->GetListSpectaclesFromSpecificLanguage();
  898.         $schedules $this->em->getRepository(Schedules::class);
  899.         $spectacle $this->em->getRepository(Spectacles::class);
  900.         if (sizeof($list_spectacles) > 0) {
  901.             $this->extra_locate $this->extra_title 'Mises en scène du texte';
  902.             foreach ($list_spectacles as $kb => $vb) {
  903.                  if (isset($vb['idtext']) && $this->idtext == $vb['idtext']) {
  904.                     $spectacle_key_date = ["finish"];
  905.                     $afficher_date_creation true;
  906.                     // recuperer les dates futurs si il y en a
  907.                     $schedule_futur $schedules->getDateLieuDemain($vb['idspectacle'], nullnull'new');
  908.                     //si il y a des dates futurs
  909.                     if (!empty($schedule_futur)) {
  910.                         $current_spectacle true;
  911.                         //on affiche pas la date de création
  912.                         $afficher_date_creation false;
  913.                         // date dans le futur
  914.                         $this->view->futurdate true;
  915.                         // ajout des mots clés basés sur les lieux et dates de représentation futurs
  916.                         $this->meta_keywords .= ' ' $schedules->ScheduleToKeywords($schedule_futur20);
  917.                         // $spectacle_key_date = array("current", "finish");
  918.                         $spectacle_key_date = array("finish");
  919.                     }
  920.                     $vb['annee_creation'] = $spectacle->getFormeDate($vb['creation_date'], '%Y'true); //%a %d/%m/%Y
  921.                 }
  922.                 if ($vb['idtypespectacle']['idtypespectacle'] == 4) {
  923.                     if (isset($vb['collage']) && $vb['collage']) {
  924.                         $type "collages";
  925.                     } else {
  926.                         $type "spectacles";
  927.                     }
  928.                 } else {
  929.                     $type "lectures";
  930.                 }
  931.                 foreach ($spectacle_key_date AS $val) {
  932.                     $spectacles[$val][$type][$vb['idspectacle']] = $vb;
  933.                     if ("finish" == $val) {
  934.                         $spectacles[$val][$type][$vb['idspectacle']]['display']['affiche_date_creation'] = true//on affichage la date de creation ?
  935.                     }
  936.                 }
  937.             }
  938.             // pour le template
  939.             $this->view->spectacles $spectacles;
  940.             // titre de la page
  941.             $this->extra_locate $this->extra_title 'Mises en scène du texte';
  942.         } else {
  943.             $target '';
  944.             if ($this->GetListSpectaclesFromSpecificLanguage(['traduction' => true'count' => true]) > 0) {
  945.                 $target 'traductions-en-scene';
  946.             }
  947.             return $this->redirect($this->context['url_module'] . '/textes/' $this->context['view']->url_clean '/' $target);
  948.         }
  949.         $this->setAsidesTES_MES();
  950.         return $this->view('textes/mises-en-scene.html.twig');
  951.     }
  952.     // }}}
  953.     private function get_mises_en_scene(){
  954.         //on initialise les spectacles et le calendrier
  955.         $spectacle $this->em->getRepository(Spectacles::class);
  956.         // on recupere le calendrier
  957.         $schedules $this->em->getRepository(Schedules::class);
  958.         //la langue source du texte original
  959.         $language_original $this->context['view']->data_text['language_src'];
  960.         //Nouveaux formats d'image pour la V2
  961.         $format = array('width' => $_ENV['VIGN_SPECTACLE_WIDTH'], 'height' => $_ENV['VIGN_SPECTACLE_HEIGHT'], 'direction' => 'crop');
  962.         //Anciens formats d'image pour l'ancienne version
  963.         $current_spectacle false;
  964.         //on récupère le nombre de mises-en-scène dans la langue original
  965.         $language_originalc $this->context['view']->data_text['language_src'];
  966.         if (!empty($this->context['view']->data_text['originaltext'])){
  967.             $language_original $this->context['view']->data_text['originaltext']['language_src'];
  968.         }
  969.         $this->nbmes_original $spectacle->countSpectaclesInSpecificLanguage(
  970.             [
  971.                 'id_text' => $this->idtext,
  972.                 'lang' => $language_originalc
  973.             ]
  974.         );
  975.         //on vérifie qu'il existe bien des données à faire afficher si non, on redirige l'utilisateur ailleurs
  976.         if ($this->nbmes_original 0) {
  977.             // classement par date de creation
  978.             $params = array(
  979.                 'order' => ['creation_date''DESC'],
  980.                 'limit' => 'all',
  981.             );
  982.             // jointure sur schedules et contacts et recherche par text OU adaptation
  983.             $special = array(
  984.                 'join' => true,
  985.                 'select_by_text_or_adaptation' => $this->idtext,
  986.                 'spectacle' => array(
  987.                     'language_egal' => $language_original
  988.                 )
  989.             );
  990.             // requete standard
  991.             $sql $spectacle->getSQLSpectacles($params$special);
  992.             // executer la requete
  993.             $datas $sql->getArrayResult();
  994.             //tableaux
  995.             $spec_etranger = array();
  996.             $spec = array();
  997.             $lect = array();
  998.             // mettre en forme chaque reponse
  999.             foreach ($datas AS $data) {
  1000.                 $data $data[0];
  1001.                 $spectacle->loadResult($data);
  1002.                 //on affiche la date de creation
  1003.                 $afficher_date_creation true;
  1004.                 $spectacle_key_date = ["finish"];
  1005.                 //on initialise le SP
  1006.                 $sp = array();
  1007.                 // infos sur le spectacle
  1008.                 $idspectacle $spectacle->idspectacle//l'id du spectacle
  1009.                 $sp $spectacle->getInfosSpectacleRow($format); //on récupère les informatiosn sur le spectacle en lui indiquant les formats voulu
  1010.                 //on fusionne tous les auteurs/metteurs-en-scenes/acteurs en un seul tableau en supprimant les doublons
  1011.                 $sp $spectacle->clearSpectaclesAddAllPersons($sp);
  1012.                 // recuperer les dates futurs si il y en a
  1013.                 $schedule_futur $schedules->getDateLieuDemain($data['idspectacle'], nullnull'new');
  1014.                 //si il y a des dates futurs
  1015.                 if (!empty($schedule_futur)) {
  1016.                     $current_spectacle true;
  1017.                     //on affiche pas la date de création
  1018.                     $afficher_date_creation false;
  1019.                     // date dans le futur
  1020.                     $this->view->futurdate true;
  1021.                     // ajout des mots clés basés sur les lieux et dates de représentation futurs
  1022.                     $this->meta_keywords .= ' ' $schedules->ScheduleToKeywords($schedule_futur20);
  1023.                     $spectacle_key_date = array("current""finish");
  1024.                 }
  1025.                 // prochaine date et ville
  1026.                 $sp['display'] = array('affiche_date_creation' => $afficher_date_creation); //on affichage la date de creation ?
  1027.                 $sp['annee_creation'] = $spectacle->getFormeDate($spectacle->creationDate'%Y'true); //%a %d/%m/%Y
  1028.                 $sp['stylemore'] = array('imagep' => 'width:85px;''descsp' => 'width:300px;');
  1029.                 // france
  1030.                 foreach ($spectacle_key_date AS $val) {
  1031.                     if ("finish" == $val) {
  1032.                         $sp['display'] = array('affiche_date_creation' => true); //on affichage la date de creation ?
  1033.                     }
  1034.                     //if (empty($sp['country']) || $sp['country']=='FR') {
  1035.                     if ($spectacle->idtypespectacle['idtypespectacle'] == 4) {
  1036.                         if (isset($sp['collage']) && $sp['collage']) {
  1037.                             $type 'collages';
  1038.                         } else {
  1039.                             $type 'spectacles';
  1040.                         }
  1041.                     } else {
  1042.                         $type 'lectures';
  1043.                     }
  1044.                     $spec[$val][$type][$idspectacle] = $sp;
  1045.                     // } else {
  1046.                     //     if ($spectacle->idtypespectacle==4) {
  1047.                     //         $spec_etranger[$val]['spectacles'][$idspectacle] = $sp;
  1048.                     //     } else {
  1049.                     //         $spec_etranger[$val]['lectures'][$idspectacle] = $sp;
  1050.                     //     }
  1051.                     // }
  1052.                 }
  1053.             }
  1054.             $this->view->spectacle['showcurrent'] = $current_spectacle;
  1055.             $this->view->spectacles $spec;
  1056.             if (!empty($spec) || !empty($spec_etranger)) {
  1057.                 // recuperer un spectacle au hasard avec une affiche
  1058.                 $sql 'SELECT DISTINCT(s.idspectacle), s.creation_date, f.idfile
  1059.                         FROM spectacles s, object_file of, files f, file_classification fc, texts t, text_spectacle ts
  1060.                         WHERE t.idtext=ts.idtext AND t.idtext=' $this->idtext '
  1061.                         AND s.idspectacle=ts.idspectacle
  1062.                         AND s.idspectacle=of.idobject
  1063.                         AND of.idfile=f.idfile
  1064.                         AND fc.idfile=f.idfile
  1065.                         AND fc.idclassification=21
  1066.                         AND of.object=\'spectacles\'
  1067.                         ORDER BY RAND() LIMIT 0,1';
  1068.                 $res $this->texts->queryAll($sql);
  1069.                 // creer un objet 'spectacles'
  1070.                 if (!empty($res)) {
  1071.                     $spectacles $this->em->getRepository(Spectacles::class);
  1072.                     $infospectacle $spectacles->getInfosSpectacle($res[0]['idspectacle']);
  1073.                     // creer un objet 'contents'
  1074.                     $contents $this->em->getRepository(Contents::class);
  1075.                     if (!empty($infospectacle)) {
  1076.                         // recuperer les fichiers associes a ce contenu
  1077.                         $datafile $contents->getAssociateFileContent($res[0]['idspectacle'], 'spectacles''class_affiche_spec');
  1078.                         if (!empty($datafile)) {
  1079.                             $datafile[0]['vignette'] = $contents->getThumbnail($datafile[0]['file'], 255'L');
  1080.                             $infospectacle['files'] = $datafile;
  1081.                         }
  1082.                     }
  1083.                     // pour le template
  1084.                     $this->view->infospectacle $infospectacle;
  1085.                 }
  1086.             }
  1087.             return true;
  1088.         }
  1089.         return false;
  1090.     }
  1091.     // {{{ action_traductions()
  1092.     /** Les traductions du texte
  1093.      *
  1094.      * @Route("/textes/{slug}/traductions/", name="text_traductions")
  1095.      *
  1096.      * @access public
  1097.      * @return void
  1098.      */
  1099.     public function action_traductions($slug null)
  1100.     {
  1101.         $this->InitController($slug'traductions');
  1102.         $format_vignette_flou $format_vignette = array('width' => $_ENV['VIGN_TEXT_WIDTH'], 'height' => $_ENV['VIGN_TEXT_HEIGHT'],'direction'=>'thumb');
  1103.         $person $this->em->getRepository(Persons::class);
  1104.         $traduc = [];
  1105.         // recuperer toutes les traductions de ce texte
  1106.         if (!empty($this->idtext)) {
  1107.             $traduc $person->getTextsPerson($this->context['id'],'translation','publish',null,$this->idtext);
  1108.         }
  1109.         // remettre en forme le tableau avec le traducteur
  1110.         foreach ($traduc as $idtext=>$value) {
  1111.             $traduc[$idtext]['translators'] = $this->texts->getTranslators($value['idtext']);
  1112.             $traduc[$idtext]['translators'] = $this->texts->noPunct($traduc[$idtext]['translators']);
  1113.             $traduc[$idtext]['stylemore'] = array('imagep' => 'width:60px;''desctxt' => 'width:195px;');
  1114.             $traduc[$idtext]['illustration'] = $this->texts->getVignetteText($idtext$format_vignette);
  1115.             $format_vignette_flou['blur'] = true;
  1116.             $traduc[$idtext]['illustration_flou'] = $this->texts->getVignetteText($idtext$format_vignette_flou);
  1117.         }
  1118.         // pour le template
  1119.         $this->view->traduc $traduc;
  1120.         // titre de la page
  1121.         $this->extra_locate $this->extra_title 'Traductions';
  1122.         // style auteur
  1123.         $this->style_more[] = 'rubrique';
  1124.         // aside
  1125.         $this->asides->load('common_participer_textes');
  1126.         return $this->view('textes/traductions.html.twig');
  1127.     }
  1128.     // }}}
  1129.     // {{{ action_ensavoirplus()
  1130.     /** Les articles associés aux spectacles de type ensavoirplus
  1131.      *
  1132.      * @Route("/textes/{slug}/infos-texte/type/ensavoirplus/", name="text_ensavoirplus")
  1133.      * @Route("/textes/{slug}/infos-texte/type/ensavoirplus/idcontent/{idcontent}", name="text_ensavoirplus_idcontent")
  1134.      * @Route("/textes/{slug}/infos-texte/type/ensavoirplus/idcontent/{idcontent}/pdf/{p_pdf}", name="text_ensavoirplus_idcontent_pdf")
  1135.      * @Route("/textes/{slug}/infos-texte/type/ensavoirplus/idcontent/{idcontent}/pdf/{p_pdf}/download/{p_download}", name="text_ensavoirplus_idcontent_pdf_download")
  1136.      *
  1137.      */
  1138.     public function action_ensavoirplus($slug null$idcontent null$p_pdf null$p_download null)
  1139.     {
  1140.         $this->InitController($slug'ensavoirplus');
  1141.         $this->setParamsPDF($p_pdf$p_download);
  1142.         $this->context['params']['idcontent'] = $idcontent;
  1143.         $this->view->idcontentCurrent $idcontent;
  1144.         $this->contenus_text('class_article','ensavoirplus');
  1145.         $this->view->extra_url '/infos-texte/type';
  1146.         $this->view->extra_url_pdf '/type/ensavoirplus';
  1147.         //Si l'utilisateur à un abonnement actif
  1148.         $idextranetuser null;
  1149.         if ($this->getUser() instanceof Extranetusers){
  1150.             $idextranetuser $this->getUser()->getIdextranetuser();
  1151.         }
  1152.         //aside
  1153.         $this->asides->load(['textes_menu_educ' => array(
  1154.             'exec' => array(
  1155.                 'alone' => true,
  1156.                 'color' => 'context'
  1157.             ),
  1158.             'title' => 'voir'
  1159.         )]);
  1160.         $this->checkConditionsPDF();
  1161.         return $this->view('textes/infos-texte.html.twig');
  1162.     }
  1163.     // }}}
  1164.     // {{{ action_articles()
  1165.     /** Les articles associés aux spectacles de type articles
  1166.      *
  1167.      * @Route("/textes/{slug}/infos-texte/type/articles/", name="text_articles")
  1168.      * @Route("/textes/{slug}/infos-texte/type/articles/idcontent/{idcontent}", name="text_articles_idcontent")
  1169.      *
  1170.      */
  1171.     public function action_articles($slug null$idcontent null)
  1172.     {
  1173.         $this->context['params']['idcontent'] = $idcontent;
  1174.         $this->InitController($slug'articles');
  1175.         $this->view->typetext 'articles';
  1176.         $this->contenus_text('class_articles','articles');
  1177.         $this->view->extra_url_pdf '/type/'.$this->context['view']->typetext;
  1178.         if (isset($this->view->articles)){
  1179.             $this->context['view']->morearticle true;
  1180.         }
  1181.         //Si l'utilisateur à un abonnement actif
  1182.         $idextranetuser null;
  1183.         if ($this->getUser() instanceof Extranetusers){
  1184.             $idextranetuser $this->getUser()->getIdextranetuser();
  1185.         }
  1186.         $this->view->extra_url '/infos-texte/type';
  1187.         //aside
  1188.         $this->asides->load(['textes_menu_educ' => array(
  1189.             'exec' => array(
  1190.                 'alone' => true,
  1191.                 'color' => 'context'
  1192.             )
  1193.         )]);
  1194.         return $this->view('textes/infos-texte.html.twig');
  1195.     }
  1196.     // }}}
  1197.     // {{{ action_contenus_pedagogiques()
  1198.     /** Les articles associés aux spectacles de type contenu education
  1199.      *
  1200.      * @Route("/textes/{slug}/contenus-pedagogiques/", name="text_contenus_pedagogiques")
  1201.      * @Route("/textes/{slug}/contenus-pedagogiques/idcontent/{idcontent}", name="text_contenus_pedagogiques_idcontent")
  1202.      * @Route("/textes/{slug}/contenus-pedagogiques/idcontent/{idcontent}/pdf/{p_pdf}", name="text_contenus_pedagogiques_idcontent_pdf")
  1203.      * @Route("/textes/{slug}/contenus-pedagogiques/idcontent/{idcontent}/pdf/{p_pdf}/download/{p_download}", name="text_contenus_pedagogiques_idcontent_pdf_download")
  1204.      *
  1205.      */
  1206.     public function action_contenus_pedagogiques($slug null$idcontent null$p_pdf null$p_download null)
  1207.     {
  1208.         $this->context['params']['idcontent'] = $idcontent;
  1209.         $this->view->idcontentCurrent $idcontent;
  1210.         $this->InitController($slug'contenus-pedagogiques');
  1211.         $this->setParamsPDF($p_pdf$p_download);
  1212.         // Affiche la couleur educ sur la page textes/contenus-pedagogiques
  1213.         $this->context['view']->is_educ true;
  1214.         $params_sql_specific = array();
  1215.         //Si l'utilisateur à un abonnement actif
  1216.         $idextranetuser null;
  1217.         if ($this->context['session'] instanceof Extranetusers){
  1218.             $idextranetuser $this->context['session']->getIdextranetuser();
  1219.         }
  1220.         //on récupère le contenu theatre-en-acte
  1221.         if ($theatre_en_acte $this->contents->getAssociateContents($this->idtext,'texts','class_theatre_en_acte')){
  1222.             $theatre_en_acte reset($theatre_en_acte);
  1223.             //On prépare les liens pour les asides
  1224.             foreach ($theatre_en_acte AS $k => $v){
  1225.                 $id_contents_exclude[] = $v['idcontent'];
  1226.                 $urls_theatrenacte[$v['idcontent']] = array(
  1227.                     'url' => '/textes/{v_url_clean}/contenus-pedagogiques/idcontent/key_content',
  1228.                     'name' => $v['title'],
  1229.                     'key_content' => $v['idcontent']
  1230.                 );
  1231.             }
  1232.             $urls_theatrenacte['allspectacles'] = array(
  1233.                 'url' => '/textes/{v_url_clean}/selections/',
  1234.                 'name' => 'Tous les textes'
  1235.             );
  1236.             //on indique quel contenus ne devant pas être récupérés avec les contenus-pedagogiques
  1237.             if ($id_contents_exclude){
  1238.                 $params_sql_specific['where'] = ' oc.idobject='.(int)$this->idtext.' AND c.idcontent NOT IN ('.implode(','$id_contents_exclude).')';
  1239.             }
  1240.         }
  1241.         $params_sql_specific['limit'] = 'all';
  1242.         $this->contenus_text('class_contenu_educ','contenus-pedagogiques', array(), $params_sql_specific);
  1243.         if (empty($this->context['view']->articles) && !empty($id_contents_exclude) && empty($this->context['params']['idcontent'])){
  1244.             $idcontent reset($id_contents_exclude);
  1245.             return $this->redirectToRoute('text_contenus_pedagogiques_idcontent', ['slug' => $this->context['view']->url_clean'idcontent' => $idcontent]);
  1246.         }
  1247.         // trouver les mises en scène de ce texte qui ont des contenus educ
  1248.         $sql 'SELECT s.`idspectacle` FROM spectacles s
  1249.             JOIN text_spectacle ts  ON ts.`idspectacle`=s.`idspectacle`
  1250.             JOIN object_content oc  ON oc.`idobject`=s.`idspectacle`
  1251.             JOIN contents c ON c.`idcontent`=oc.`idcontent`
  1252.             JOIN content_classification cc ON cc.`idcontent`=c.`idcontent`
  1253.             WHERE c.publish=1
  1254.             AND oc.object=\'spectacles\'
  1255.             AND cc.idclassification=125
  1256.             AND ts.idtext IN ('.$this->idtext.')
  1257.             AND s.`publish`=1 AND s.`valid`=1';
  1258.         $idspectacles $this->texts->queryCol($sql);
  1259.         if (!empty($idspectacles)) {
  1260.             $this->context['view']->autres_spectacles $this->em->getRepository(Spectacles::class)->getListSpectacles(array(
  1261.                 'special' => array(
  1262.                     'idspectacle' => $idspectacles,
  1263.                 ),
  1264.                 'params' => array(
  1265.                     'limit' => array(0,200)
  1266.                 ),
  1267.                 'dbg' => array('list_others_spectacles''Liste des autres mes avec un contenus éduc'),
  1268.             ));
  1269.             if (!empty($this->context['view']->autres_spectacles)) {
  1270.                 foreach ($this->context['view']->autres_spectacles as $k=>$v) {
  1271.                     $this->context['view']->autres_spectacles[$k]['url_clean_more'] = 'contenus-pedagogiques/';
  1272.                     $this->context['view']->autres_spectacles[$k]['noshow_allauthors'] = true;
  1273.                 }
  1274.             }
  1275.         }
  1276.         //aside
  1277.         if (!empty($theatre_en_acte)){
  1278.             $this->asides->load(['url_lists_alone' => array(
  1279.                 'exec' => array('color' => 'educ'),
  1280.                 'php' => array(
  1281.                     'method' => 'asidesUrlLists',
  1282.                     'urls' => $urls_theatrenacte,
  1283.                     'params' => array(
  1284.                         'activate' => (!empty($this->context['params']['idcontent'])) ? $this->context['params']['idcontent'] : null
  1285.                     )
  1286.                 ),
  1287.                 'title' => 'Théâtre-en-acte'
  1288.             )]);
  1289.         }
  1290.         $this->asides->load(['textes_menu_educ' => array(
  1291.             'exec' => array(
  1292.                 'alone' => true,
  1293.                 'color' => 'educ'
  1294.             ),
  1295.             'title' => 'voir'
  1296.         )]);
  1297.         // $this->asides->load('textes_file_pdf');
  1298.         $this->asides->load('textes_mes');
  1299.         $this->asides->load('common_participer_textes');
  1300.         $this->checkConditionsPDF();
  1301.         return $this->view('textes/contenus-pedagogiques.html.twig');
  1302.     }
  1303.     // }}}
  1304.     // {{{ action_genese()
  1305.     /** Les articles "genese"
  1306.      *
  1307.      * @Route("/textes/{slug}/genese/", name="text_genese")
  1308.      * @Route("/textes/{slug}/genese/idcontent/{idcontent}", name="text_genese_idcontent")
  1309.      *
  1310.      */
  1311.     public function action_genese($slug null$idcontent null)
  1312.     {
  1313.         $this->context['params']['idcontent'] = $idcontent;
  1314.         $this->InitController($slug'genese');
  1315.         $this->contenus_text('class_genese','genese');
  1316.         // aside
  1317.         $this->asides->load('textes_menu_genese');
  1318.         return $this->view('textes/genese.html.twig');
  1319.     }
  1320.     // }}}
  1321.     // {{{ action_entretiens()
  1322.     /** Les articles associés aux textes de type entretiens
  1323.      *
  1324.      * @Route("/textes/{slug}/infos-texte/type/entretiens/", name="text_entretiens")
  1325.      *
  1326.      */
  1327.     public function action_entretiens($slug null)
  1328.     {
  1329.         $this->InitController($slug'entretiens');
  1330.         $this->contenus_text('class_entretien','entretiens');
  1331.         $this->asides->load('textes_menu_infos_texte');
  1332.         return $this->view('textes/infos-texte.html.twig');
  1333.     }
  1334.     // }}}
  1335.     // {{{ action_extraits()
  1336.     /** Les articles associés aux textes de type extraits
  1337.      *
  1338.      * @Route("/textes/{slug}/infos-texte/type/extraits/", name="text_extraits")
  1339.      * @Route("/textes/{slug}/infos-texte/type/extraits/idcontent/{idcontent}", name="text_extraits_idcontent")
  1340.      * @Route("/textes/{slug}/infos-texte/type/extraits/idcontent/{idcontent}/pdf/{p_pdf}", name="text_extraits_idcontent_pdf")
  1341.      * @Route("/textes/{slug}/infos-texte/type/extraits/idcontent/{idcontent}/pdf/{p_pdf}/download/{p_download}", name="text_extraits_idcontent_pdf_download")
  1342.      *
  1343.      */
  1344.     public function action_extraits($slug null$idcontent null$p_pdf null$p_download null)
  1345.     {
  1346.         $this->context['params']['idcontent'] = $idcontent;
  1347.         $this->setParamsPDF($p_pdf$p_download);
  1348.         $this->InitController($slug'extraits');
  1349.         $this->contenus_text('class_extrait','extraits', array('width'=>500'grow'=>false), ['limit' => 'all']);
  1350.         $this->view->typetext 'extraits';
  1351.         //aside
  1352.         $this->asides->load('textes_menu_extrait');
  1353.         $this->checkConditionsPDF();
  1354.         return $this->view('textes/infos-texte.html.twig');
  1355.     }
  1356.     // }}}
  1357.     // {{{ action_podcasts()
  1358.     /** liste de lecture
  1359.      *
  1360.      * @Route("/textes/{slug}/podcasts/", name="text_podcasts")
  1361.      * @Route("/textes/{slug}/podcasts/emission/{p_emission}", name="text_podcasts_emission")
  1362.      *
  1363.      * @access public
  1364.      * @return void
  1365.      */
  1366.     public function action_podcasts($slug null$p_emission null)
  1367.     {
  1368.         $this->InitController($slug'podcasts');
  1369.         $this->context['params']['emission'] = $p_emission;
  1370.         $podcasts $this->em->getRepository(Podcasts::class);
  1371.         $format_vignette = array('width'=>480,'direction'=>'thumb');
  1372.         // Culturebox => les derniers référencés
  1373.         $culturebox_params = array(
  1374.             'direction' => 'DESC',
  1375.             'limit' => array(0,200),
  1376.             'special' => array(
  1377.                 'idtexts' => $this->idtext,
  1378.                 'type_podcast' => ['franceinter'],
  1379.             ),
  1380.             'dbg' => array('derniers_culturebox_current''Les replay France Culture référencés'),
  1381.         );
  1382.         $culturebox_params['special']['type_franceinter'] = null//Pour France Culture
  1383.         $countFranceCulture $podcasts->countListPodcasts($culturebox_params);
  1384.         $culturebox_params['special']['type_franceinter'] = 1;
  1385.         $countFranceInter $podcasts->countListPodcasts($culturebox_params);
  1386.         $soundcloud_params $culturebox_params;
  1387.         $soundcloud_params['special']['type_podcast'] = 'soundcloud';
  1388.         unset($soundcloud_params['special']['type_franceinter']);
  1389.         $countSoundcloud $podcasts->countListPodcasts($soundcloud_params);
  1390.         $filtres_emissions = [
  1391.             'franceculture' => [
  1392.                 'name' => 'France Culture',
  1393.                 'count' => $countFranceCulture,
  1394.                 'params' => null,
  1395.                 'type' => 'franceculture'
  1396.             ],
  1397.             'franceinter' => [
  1398.                 'name' => 'France Inter',
  1399.                 'count' => $countFranceInter,
  1400.                 'params' => 1,
  1401.                 'type' => 'franceinter'
  1402.             ],
  1403.             'soundcloud' => [
  1404.                 'name' => 'Soundcloud',
  1405.                 'count' => $countSoundcloud,
  1406.                 'params' => null,
  1407.                 'type' => 'soundcloud'
  1408.             ],
  1409.         ];
  1410.         $curseur null;
  1411.         if (!empty($this->context['params']['emission']) && array_key_exists($this->context['params']['emission'], $filtres_emissions)){
  1412.             $curseur $this->context['params']['emission'];
  1413.             if ($this->context['params']['emission'] == "soundcloud") {
  1414.                 $culturebox_params $soundcloud_params;
  1415.             } else {
  1416.                 $culturebox_params['special']['type_franceinter'] = $filtres_emissions[$curseur]['params'];
  1417.             }
  1418.         }
  1419.         else{
  1420.             unset($culturebox_params['special']['type_franceinter']);
  1421.             $culturebox_params['special']['type_podcast'] = [
  1422.                 'franceinter',
  1423.                 'soundcloud'
  1424.             ];
  1425.         }
  1426.         $this->context['view']->list_captations $podcasts->getListPodcasts($culturebox_params,$format_vignette);
  1427.         $this->asides->load(['url_lists' => array(
  1428.             'exec' => [
  1429.                 'htmlstart' => true,
  1430.                 'alone' => false
  1431.             ],
  1432.             'php' => array(
  1433.                 'method' => 'asidesUrlLists',
  1434.                 'urls' => [
  1435.                     [
  1436.                         'name' => 'Toutes les émissions'
  1437.                     ]
  1438.                 ],
  1439.                 'url' => '/textes/{v_url_clean}/podcasts/',
  1440.                 'params' => array(
  1441.                     'activate' => (is_null($curseur)) ? true false
  1442.                 )
  1443.             ),
  1444.             'title' => 'écouter'
  1445.         )]);
  1446.         $this->asides->load(['url_lists,tst' => array(
  1447.             'exec' => [
  1448.                 'htmlend' => true,
  1449.                 'alone' => false
  1450.             ],
  1451.             'php' => array(
  1452.                 'method' => 'asidesUrlLists',
  1453.                 'urls' => $filtres_emissions,
  1454.                 'url' => '/textes/{v_url_clean}/podcasts/emission/key_type',
  1455.                 'params' => array(
  1456.                     'key_type' => 'auto_key',
  1457.                     'activate' => $curseur
  1458.                 )
  1459.             ),
  1460.             'title' => 'Trier'
  1461.         )]);
  1462.         if ($countFranceCulture){
  1463.             $this->asides->load(['bio_franceculture' => [ 'noactive' => true ]]);
  1464.         }
  1465.         //Pour France Inter
  1466.         if ($countFranceInter){
  1467.             $this->asides->load([
  1468.                 'contact_franceculture_menu,franceinter' => [
  1469.                     'custom_url_clean' => 'France-Inter',
  1470.                     'title_custom' => 'France Inter',
  1471.                     'logo_custom' => 'france-inter'
  1472.                 ]
  1473.             ]);
  1474.         }
  1475.         $this->asides->load('common_participer_spectacles');
  1476.         return $this->view('textes/podcasts.html.twig');
  1477.     }
  1478.     // }}}
  1479.     // {{{ action_playlist_text()
  1480.     /** Texte par l'auteur
  1481.      *
  1482.      * @Route("/textes/{slug}/playlist/id/{p_id}/", name="text_playlist")
  1483.      * @Route("/textes/{slug}/playlist/id/{p_id}/playlist/{p_playlist}/", name="text_id_playlist")
  1484.      * @Route("/textes/{slug}/playlist/id/{p_id}/video/{p_playlist}/", name="text_id_playlist")
  1485.      *
  1486.      */
  1487.     public function action_playlist_text($slug null$p_id null$p_playlist null)
  1488.     {
  1489.         $this->context['params']['id'] = $p_id;
  1490.         $this->context['params']['playlist'] = $p_playlist;
  1491.         $this->context['params']['video'] = $p_playlist;
  1492.         $this->InitController($slug'playlist');
  1493.         $this->context['view']->meta_video true;
  1494.         $multimedias $this->em->getRepository(Multimedias::class);
  1495.         $idplaylist parent::action_playlist();
  1496.         if ($idplaylist instanceof RedirectResponse) {
  1497.             return $idplaylist;
  1498.         }
  1499.         foreach ($this->context['view']->videos_playlist AS $video){
  1500.             if (!empty($video['current'])){
  1501.                 $video_data $multimedias->getInfosMultimedia($video['idmultimedia'],false,false,array('tableau' => true));
  1502.                 $video_data['typemultimedia'] = $multimedias->getTypeMultimediaLabel($multimedias->type);
  1503.                 $video_data['langue'] = $multimedias->getNameLanguage($video_data['language']);
  1504.                 $video_data['share'] = true;
  1505.                 $this->context['view']->video $video_data;
  1506.                 break;
  1507.             }
  1508.         }
  1509.         $this->context['view']->url_all_playlist = array(
  1510.             '/textes/editions/auteurs' => 'Voir tous les textes par leurs auteurs',
  1511.         );
  1512.         // playlist = class_en_video
  1513.         if (!empty($this->context['view']->playlist['classifications'][227])){
  1514.             $this->asides->load('textes_infos_envideos');
  1515.         }
  1516.         //le texte par l'auteur
  1517.         else if (!empty($this->context['view']->playlist['classifications'][144])){
  1518.             $this->asides->load('playlist_txt');
  1519.         }
  1520.         return $this->view('textes/playlist.html.twig');
  1521.     }
  1522.     // }}}
  1523.     // {{{ action_traductions_en_scene()
  1524.     /** Les traductions du texte
  1525.      *
  1526.      * @Route("/textes/{slug}/traductions-en-scene/", name="text_traductions_en_scene")
  1527.      *
  1528.      * @access public
  1529.      * @return void
  1530.      */
  1531.     public function action_traductions_en_scene($slug null)
  1532.     {
  1533.         $this->InitController($slug'traductions-en-scene');
  1534.         $spectacle $this->em->getRepository(Spectacles::class);
  1535.         $list_spectacles $this->GetListSpectaclesFromSpecificLanguage(array('traduction' => true));
  1536.         if (sizeof($list_spectacles) > 0) {
  1537.             foreach ($list_spectacles as $kb => $vb) {
  1538.                 foreach ($this->context['view']->traduc as $k => $v) {
  1539.                     if (isset($vb['idtext']) && $v['idtext'] == $vb['idtext']) {
  1540.                         $spectacle_key_date = ["finish"];
  1541.                         $afficher_date_creation true;
  1542.                         $vb['annee_creation'] = $spectacle->getFormeDate($vb['creation_date'], '%Y'true); //%a %d/%m/%Y
  1543.                         $type "";
  1544.                         if ($vb['idtypespectacle']['idtypespectacle'] == 4) {
  1545.                             if (isset($vb['collage']) && $vb['collage']) {
  1546.                                 $type "collages";
  1547.                             } else {
  1548.                                 $type "spectacles";
  1549.                             }
  1550.                         } else {
  1551.                             $type "lectures";
  1552.                         }
  1553.                         foreach ($spectacle_key_date AS $val) {
  1554.                             $spectacles[$val][$type][$vb['idspectacle']] = $vb;
  1555.                             $spectacles[$val][$type][$vb['idspectacle']]['traduction'] = $this->context['view']->traduc[$k];
  1556.                             if ("finish" == $val) {
  1557.                                 $spectacles[$val][$type][$vb['idspectacle']]['display']['affiche_date_creation'] = true//on affichage la date de creation ?
  1558.                             }
  1559.                         }
  1560.                     }
  1561.                 }
  1562.             }
  1563.             // pour le template
  1564.             $this->view->spectacles $spectacles;
  1565.             // titre de la page
  1566.             $this->extra_locate $this->extra_title 'Traductions en scène';
  1567.         } else {
  1568.             $target '';
  1569.             if ($this->GetListSpectaclesFromSpecificLanguage(['count' => true])) {
  1570.                 $target 'mises-en-scene';
  1571.             }
  1572.             return $this->redirect(getenv('thnet') . '/textes/' $this->context['view']->url_clean '/' $target);
  1573.         }
  1574.         //aside commun
  1575.         $this->setAsidesTES_MES();
  1576.         return $this->view('textes/traductions-en-scene.html.twig');
  1577.     }
  1578.     // }}}
  1579.     // {{{ action_evenements()
  1580.     /** Les évènements associés aux textes
  1581.      *
  1582.      * @Route("/textes/{slug}/evenements/", name="text_evenements")
  1583.      *
  1584.      */
  1585.     public function action_evenements($slug null)
  1586.     {
  1587.         $this->InitController($slug'evenements');
  1588.         $object $this->em->getRepository(News::class);
  1589.         foreach (['prochains''anciens'] AS $value){
  1590.             $evenements_params = array(
  1591.                 'params' => array(
  1592.                     'limit' => array(0,100)
  1593.                 ),
  1594.                 'special' => array(
  1595.                     'publish_valid' => true,
  1596.                     'by_object' => array('idtext' => $this->idtext),
  1597.                 )
  1598.             );
  1599.             $evenements_params['special'][$value] = true;
  1600.             if (!empty($exclude_news)) {
  1601.                 $evenements_params['params']['where'] = ' AND T1.idnew NOT IN ('.join(','$exclude_news).') ';
  1602.             }
  1603.             $news_list[$value] = $object->getListNews($evenements_params);
  1604.             if (!empty($news_list[$value])) {
  1605.                 // liste d'exclusion => pas de en cours dans les anciens
  1606.                 foreach ($news_list[$value] as $k=>$v) {
  1607.                     $exclude_news[$k] = $v['idnew'];
  1608.                 }
  1609.             }
  1610.             unset($evenements_params['special'][$value]);
  1611.         }
  1612.         $this->view->news_list_news $news_list;
  1613.         //Pour afficher la description tiny
  1614.         $this->context['view']->is_description true;
  1615.         $this->asides->load('common_participer_textes');
  1616.         return $this->view('textes/evenements.html.twig');
  1617.     }
  1618.     // }}}
  1619.     // {{{ action_aides_etape()
  1620.     /** Etape initial catégorie du type d'aide
  1621.      * @Route("/textes/{slug}/aides-etape/", name="text_aides_etape")
  1622.      */
  1623.     public function action_aides_etape(
  1624.         $slug null,
  1625.         Request $request,
  1626.         UtilsEdit $utilsEdit,
  1627.         FormFactoryInterface $formFactory,
  1628.         SessionInterface $session
  1629.     )
  1630.     {
  1631.         if(!$this->getUser() instanceof Extranetusers){
  1632.             return $this->redirectToRoute('app_login');
  1633.         }
  1634.         $this->InitController($slug'aides_etape');
  1635.         $text $this->getAjoutAideObject(
  1636.             $formFactory,
  1637.             $session,
  1638.             1,
  1639.             'aides',
  1640.             null,
  1641.             $utilsEdit
  1642.         );
  1643.         $text->getFormTypeAides($request);
  1644.         if ($text->validateAidesForm()){
  1645.             $text->saveAides();
  1646.             return $this->redirectToRoute('text_aides_etape1', ['slug' => $this->context['view']->url_clean]);
  1647.         }
  1648.         $this->asides->load('ajoutaides_informations_aides_textes');
  1649.         $this->view->no_bookmark true;
  1650.         $this->asides->load('common_participer_textes');
  1651.         return $this->view('textes/aides-etape.html.twig', [
  1652.             'form' => $this->context['form']->createView()
  1653.         ]);
  1654.     }
  1655.     // }}}
  1656.     /** Etape 1 aides du contact
  1657.      * @Route("/textes/{slug}/aides-etape1/", name="text_aides_etape1")
  1658.      */
  1659.     public function action_aides_etape1(
  1660.         $slug null,
  1661.         Request $request,
  1662.         UtilsEdit $utilsEdit,
  1663.         FormFactoryInterface $formFactory,
  1664.         SessionInterface $session
  1665.     )
  1666.     {
  1667.         if(!$this->getUser() instanceof Extranetusers){
  1668.             return $this->redirectToRoute('app_login');
  1669.         }
  1670.         $this->InitController($slug'aides_etape');
  1671.         $text $this->getAjoutAideObject(
  1672.             $formFactory,
  1673.             $session,
  1674.             1,
  1675.             'aides',
  1676.             1,
  1677.             $utilsEdit
  1678.         );
  1679.         $text->getSteps('Structures'1);
  1680.         if ($text->getFormContacts($request)){
  1681.             if ($text->validateContactsForm()){
  1682.                 $text->saveContacts();
  1683.                 return $this->redirectToRoute('text_aides_etape2', ['slug' => $this->context['view']->url_clean]);
  1684.             }
  1685.         }
  1686.         else{
  1687.             return $this->redirectToRoute('text_aides_etape', ['slug' => $this->context['view']->url_clean]);
  1688.         }
  1689.         $this->asides->load('ajoutaides_informations_aides_textes');
  1690.         $this->view->no_bookmark true;
  1691.         $this->asides->load('common_participer_textes');
  1692.         return $this->view('textes/aides-etape1.html.twig', [
  1693.             'form' => $this->context['form']->createView()
  1694.         ]);
  1695.     }
  1696.     /** Etape 2 aides de l'aide en lien avec le contact
  1697.      * @Route("/textes/{slug}/aides-etape2/", name="text_aides_etape2")
  1698.      */
  1699.     public function action_aides_etape2(
  1700.         $slug null,
  1701.         Request $request,
  1702.         UtilsEdit $utilsEdit,
  1703.         FormFactoryInterface $formFactory,
  1704.         SessionInterface $session
  1705.     )
  1706.     {
  1707.         if(!$this->getUser() instanceof Extranetusers){
  1708.             return $this->redirectToRoute('app_login');
  1709.         }
  1710.         $this->InitController($slug'aides_etape');
  1711.         $text $this->getAjoutAideObject(
  1712.             $formFactory,
  1713.             $session,
  1714.             1,
  1715.             'aides',
  1716.             2,
  1717.             $utilsEdit
  1718.         );
  1719.         $text->getSteps('Informations'2);
  1720.         if ($text->getFormAides($request)){
  1721.             if ($text->getValidAides()){
  1722.                 $text->getSaveAides();
  1723.                 return $this->redirectToRoute('text_aides_etape3', ['slug' => $this->context['view']->url_clean]);
  1724.             }
  1725.         } else {
  1726.             return $this->redirectToRoute('text_aides_etape', ['slug' => $this->context['view']->url_clean]);
  1727.         }
  1728.         $this->asides->load('ajoutaides_informations_aides_textes');
  1729.         $this->view->no_bookmark true;
  1730.         $this->asides->load('common_participer_textes');
  1731.         return $this->view('textes/aides-etape2.html.twig', [
  1732.             'form' => $this->context['form']->createView()
  1733.         ]);
  1734.     }
  1735.     // {{{ action_aides_etape3()
  1736.     /** Etape 3 message de validation
  1737.      * @Route("/textes/{slug}/aides-etape3/", name="text_aides_etape3")
  1738.      */
  1739.     public function action_aides_etape3(
  1740.         $slug null,
  1741.         UtilsEdit $utilsEdit,
  1742.         FormFactoryInterface $formFactory,
  1743.         SessionInterface $session
  1744.     )
  1745.     {
  1746.         if(!$this->getUser() instanceof Extranetusers){
  1747.             return $this->redirectToRoute('app_login');
  1748.         }
  1749.         $this->InitController($slug'aides_etape');
  1750.         $text $this->getAjoutAideObject(
  1751.             $formFactory,
  1752.             $session,
  1753.             1,
  1754.             'aides',
  1755.             3,
  1756.             $utilsEdit
  1757.         );
  1758.         $text->getSteps('Validation'3);
  1759.         $text->getValidation();
  1760.         $this->asides->load('ajoutaides_informations_aides_textes');
  1761.         $this->view->no_bookmark true;
  1762.         $this->asides->load('common_participer_textes');
  1763.         return $this->view('textes/aides-etape3.html.twig');
  1764.     }
  1765.     // }}}
  1766.     /** Etape 1 aides du type d'aide
  1767.      * @Route("/textes/{slug}/selections-etape", name="text_selections_etape")
  1768.      */
  1769.     public function action_selections_etape(
  1770.         $slug null,
  1771.         Request $request,
  1772.         UtilsEdit $utilsEdit,
  1773.         FormFactoryInterface $formFactory,
  1774.         SessionInterface $session
  1775.     )
  1776.     {
  1777.         if(!$this->getUser() instanceof Extranetusers){
  1778.             return $this->redirectToRoute('app_login');
  1779.         }
  1780.         $this->InitController($slug'aides_etape');
  1781.         $text $this->getAjoutAideObject(
  1782.             $formFactory,
  1783.             $session,
  1784.             4,
  1785.             'selections',
  1786.             null,
  1787.             $utilsEdit
  1788.         );
  1789.         $text->getFormTypeAides($request);
  1790.         if ($text->validateAidesForm()){
  1791.             $text->saveAides();
  1792.             return $this->redirectToRoute('text_selections_etape1', ['slug' => $this->context['view']->url_clean]);
  1793.         }
  1794.         $this->asides->load('ajoutaides_informations_selections_textes');
  1795.         $this->view->no_bookmark true;
  1796.         $this->asides->load('common_participer_textes');
  1797.         return $this->view('textes/selections-etape.html.twig', [
  1798.             'form' => $this->context['form']->createView()
  1799.         ]);
  1800.     }
  1801.     /** Etape 1 sélection du contact
  1802.      * @Route("/textes/{slug}/selections-etape1/", name="text_selections_etape1")
  1803.      */
  1804.     public function action_selections_etape1(
  1805.         $slug null,
  1806.         Request $request,
  1807.         UtilsEdit $utilsEdit,
  1808.         FormFactoryInterface $formFactory,
  1809.         SessionInterface $session
  1810.     )
  1811.     {
  1812.         if(!$this->getUser() instanceof Extranetusers){
  1813.             return $this->redirectToRoute('app_login');
  1814.         }
  1815.         $this->InitController($slug'aides_etape');
  1816.         $text $this->getAjoutAideObject(
  1817.             $formFactory,
  1818.             $session,
  1819.             4,
  1820.             'selections',
  1821.             1,
  1822.             $utilsEdit
  1823.         );
  1824.         $text->getSteps('Structures'1);
  1825.         if ($text->getFormContacts($request)){
  1826.             if ($text->validateContactsForm()){
  1827.                 $text->saveContacts();
  1828.                 return $this->redirectToRoute('text_selections_etape2', ['slug' => $this->context['view']->url_clean]);
  1829.             }
  1830.         }
  1831.         else{
  1832.             return $this->redirectToRoute('text_selections_etape', ['slug' => $this->context['view']->url_clean]);
  1833.         }
  1834.         $this->asides->load('ajoutaides_informations_selections_textes');
  1835.         $this->view->no_bookmark true;
  1836.         $this->asides->load('common_participer_textes');
  1837.         return $this->view('textes/selections-etape1.html.twig', [
  1838.             'form' => $this->context['form']->createView()
  1839.         ]);
  1840.     }
  1841.     // }}}
  1842.     /** Etape 2 sélection de l'aide en lien avec le contact
  1843.      * @Route("/textes/{slug}/selections-etape2/", name="text_selections_etape2")
  1844.      */
  1845.     public function action_selections_etape2(
  1846.         $slug null,
  1847.         Request $request,
  1848.         UtilsEdit $utilsEdit,
  1849.         FormFactoryInterface $formFactory,
  1850.         SessionInterface $session
  1851.     )
  1852.     {
  1853.         if(!$this->getUser() instanceof Extranetusers){
  1854.             return $this->redirectToRoute('app_login');
  1855.         }
  1856.         $this->InitController($slug'aides_etape');
  1857.         $text $this->getAjoutAideObject(
  1858.             $formFactory,
  1859.             $session,
  1860.             4,
  1861.             'selections',
  1862.             2,
  1863.             $utilsEdit
  1864.         );
  1865.         $text->getSteps('Informations'2);
  1866.         if ($text->getFormAides($request)){
  1867.             if ($text->getValidAides()){
  1868.                 $text->getSaveAides();
  1869.                 return $this->redirectToRoute('text_selections_etape3', ['slug' => $this->context['view']->url_clean]);
  1870.             }
  1871.         }
  1872.         else{
  1873.             return $this->redirectToRoute('text_selections_etape', ['slug' => $this->context['view']->url_clean]);
  1874.         }
  1875.         $this->asides->load('ajoutaides_informations_selections_textes');
  1876.         $this->view->no_bookmark true;
  1877.         $this->asides->load('common_participer_textes');
  1878.         return $this->view('textes/selections-etape2.html.twig', [
  1879.             'form' => $this->context['form']->createView()
  1880.         ]);
  1881.     }
  1882.     // }}}
  1883.     /** Etape 3 message de validation
  1884.      * @Route("/textes/{slug}/selections-etape3", name="text_selections_etape3")
  1885.      */
  1886.     public function action_selections_etape3(
  1887.         $slug null,
  1888.         UtilsEdit $utilsEdit,
  1889.         FormFactoryInterface $formFactory,
  1890.         SessionInterface $session
  1891.     )
  1892.     {
  1893.         if(!$this->getUser() instanceof Extranetusers){
  1894.             return $this->redirectToRoute('app_login');
  1895.         }
  1896.         $this->InitController($slug'aides_etape');
  1897.         $text $this->getAjoutAideObject(
  1898.             $formFactory,
  1899.             $session,
  1900.             4,
  1901.             'selections',
  1902.             3,
  1903.             $utilsEdit
  1904.         );
  1905.         $text->getSteps('Validation'3);
  1906.         $text->getValidation();
  1907.         $this->asides->load('ajoutaides_informations_selections_textes');
  1908.         $this->view->no_bookmark true;
  1909.         $this->asides->load('common_participer_textes');
  1910.         return $this->view('textes/selections-etape3.html.twig');
  1911.     }
  1912.     /** Appel du constructeur d'aide des objets
  1913.      * $typeaide : 4 = sélections
  1914.      */
  1915.     public function getAjoutAideObject(
  1916.         FormFactoryInterface $formFactory,
  1917.         SessionInterface $session,
  1918.         $typeaide 4,
  1919.         $type 'selections',
  1920.         $num null,
  1921.         $utilsEdit null
  1922.     )
  1923.     {
  1924.         $params_object = array(
  1925.             'object' => [
  1926.                 'type' => 'text',
  1927.                 'value' => $this->idtext
  1928.             ],
  1929.             'aides' => array(
  1930.                 'typeaide' => $typeaide //sélection
  1931.             ),
  1932.             'url' => '/textes/'.$this->context['view']->url_clean.'/'.$type.'-etape'.$num
  1933.         );
  1934.         $this->context['formFactory'] = $formFactory->createBuilder(FormType::class, null, [
  1935.             'attr' => [
  1936.                 'id' => 'masterform'
  1937.             ]
  1938.         ]);
  1939.         return new Ajoutaides(
  1940.             $this->em,
  1941.             $utilsEdit,
  1942.             $session,
  1943.             $this->context,
  1944.             $params_object
  1945.         );
  1946.     }
  1947.     // {{{ GetListSpectaclesFromSpecificLanguage()
  1948.     /** Récupération des textes en scènes dans la langue oriignal ou dans les langues de traductions
  1949.      *
  1950.      */
  1951.     public function GetListSpectaclesFromSpecificLanguage($params = array()){
  1952.         $spectacle $this->em->getRepository(Spectacles::class);
  1953.         $person $this->em->getRepository(Persons::class);
  1954.         //si nous sommes sur un texte traduit basé sur un texte original
  1955.         $original true;
  1956.         if ($this->txt['typetxt'] == 'translate'){
  1957.             $original false;
  1958.         }
  1959.         //language_egal
  1960.         //language_different
  1961.         if (!empty($this->idtext)) {
  1962.             // translation
  1963.             // adaptation_by_language_spectacle
  1964.             //si c'est un texte oiginal nous voulons les textes traduits
  1965.             if ($original){
  1966.                 $language_original $this->context['view']->data_text['language_src'];
  1967.                 $this->context['view']->traduc $person->getTextsPerson($this->context['id'], 'translation''publish'null$this->idtext);
  1968.                 foreach ($this->context['view']->traduc as $t) {
  1969.                     $idtexts[] = $t['idtext'];
  1970.                 }
  1971.                 $idtexts_original = array($this->idtext);
  1972.             }
  1973.             else{
  1974.                 $language_original null;
  1975.                 if (!empty($this->context['view']->data_text['originaltext']['language_src'])){
  1976.                     $language_original $this->context['view']->data_text['originaltext']['language_src'];
  1977.                     $idtexts_original = array($this->context['view']->data_text['originaltext']['idtext']);
  1978.                 }
  1979.                 $langue_traduction $this->context['view']->data_text['language_src'];
  1980.                 $this->context['view']->traduc = array($this->idtext => $this->context['view']->data_text);
  1981.                 $idtexts = array($this->idtext);
  1982.             }
  1983.         }
  1984.         // parcourir les traductions et trouver les mises en scènes
  1985.         $params_request = array(
  1986.             'params' => array(
  1987.                 'order' => ['creation_date''DESC'],
  1988.                 'limit' => array(0500),
  1989.             ),
  1990.             'dbg' => array('list_traductions_mise_en_scene''Liste des mises en scène à partir des traductions'),
  1991.         );
  1992.         //Si nous sélections un type de spectacle spécifique
  1993.         if (!empty($params['idtypespectacle'])){
  1994.             $params_request['params']['where'] = 'AND s.idtypespectacle = 4 ';
  1995.         }
  1996.         //Si nous voulons une limite aux spectacles
  1997.         if (!empty($params['limit'])){
  1998.             if (!is_array($params['limit'])){
  1999.                 $params['limit'] = explode(','$params['limit']);
  2000.                 if (count($params['limit']) == 1){
  2001.                     array_unshift($params['limit'], 0);
  2002.                 }
  2003.             }
  2004.             $params_request['params']['limit'] = $params['limit'];
  2005.         }
  2006.         if (!empty($params['traduction'])){
  2007.             if (isset($idtexts)){
  2008.                 $params_request['special']['idtext'] =  $idtexts;
  2009.             }
  2010.             else if (!empty($idtexts_original)) {
  2011.                 $params_request['special']['idtext'] =  $idtexts_original;
  2012.             }
  2013.             if ($original){
  2014.                 $params_request['special']['spectacle']['language_different'] =  $language_original;
  2015.             }
  2016.             else if (!empty($langue_traduction)) {
  2017.                 $params_request['special']['spectacle']['language_egal'] =  $langue_traduction;
  2018.             }
  2019.             // print_r($params_request);
  2020.             // 'language_different' => $language_original
  2021.         }
  2022.         else{
  2023.             $params_request['special']['join'] = true;
  2024.             $params_request['special']['select_by_text_or_adaptation'] = $this->idtext;
  2025.             $params_request['special']['spectacle'] = array(
  2026.                 'language_egal' => $language_original
  2027.             );
  2028.         }
  2029.         if (!empty($params['count'])){
  2030.             $params_request['params']['cout_only'] = true;
  2031.             return count($spectacle->getListSpectacles($params_request));
  2032.         }
  2033.         else{
  2034.             return $spectacle->getListSpectacles($params_requestnullfalse, ['allauthors' => true'carrer_couleurs' => true]);
  2035.         }
  2036.     }
  2037.     // }}}
  2038.     // {{{ getTxt()
  2039.     /** Les infos sur un texte
  2040.      *
  2041.      */
  2042.     public function getTxt() { return $this->txt; }
  2043.     // }}}
  2044.     // {{{ getLocate()
  2045.     /** Ou se trouve t'on (getter)
  2046.      *
  2047.      */
  2048.     public function getLocate() { return $this->locate; }
  2049.     // }}}
  2050.     // {{{ getTitlePage()
  2051.     /** Titre de la page (getter)
  2052.      *
  2053.      */
  2054.     public function getTitlePage() { return $this->title_page; }
  2055.     // }}}
  2056.     // {{{ getStyleMore()
  2057.     /** Style en plus (getter)
  2058.      *
  2059.      */
  2060.     public function getStyleMore() { return $this->style_more; }
  2061.     // }}}
  2062.     // {{{ getMetaKeywords()
  2063.     /** Keywords (getter)
  2064.      *
  2065.      */
  2066.     public function getMetaKeywords() { return $this->meta_keywords; }
  2067.     // }}}
  2068.     // {{{ getMetaDescription()
  2069.     /** Description (getter)
  2070.      *
  2071.      */
  2072.     public function getMetaDescription() { return $this->meta_description; }
  2073.     // }}}
  2074.     // {{{ setOtherDimensions()
  2075.     /** Taille maxi des vidéos
  2076.      *
  2077.      */
  2078.     public function setOtherDimensions($other_dimensions) { $this->other_dimensions $other_dimensions; }
  2079.     // }}}
  2080.     // {{{ setParamsComments()
  2081.     /** Paramètre des commentaires
  2082.      *
  2083.      */
  2084.     public function setParamsComments($params_comments) { $this->params_comments $params_comments; }
  2085.     // }}}
  2086.     // {{{ getMtinfos()
  2087.     /** Infos mon théâtre
  2088.      *
  2089.      */
  2090.     public function getMtinfos() { return $this->mtinfos; }
  2091.     // }}}
  2092.     // {{{ setAsidesTES_MES()
  2093.     /** Initialisation d'un aside commun à deux actions
  2094.      *
  2095.      */
  2096.     public function setAsidesTES_MES($params = array()){
  2097.         //aside
  2098.         $original_traduction = array(
  2099.             'original' => array(
  2100.                 'name' => 'En langue originale',
  2101.                 'key_activate' => 'mises-en-scene',
  2102.                 'count' => $this->GetListSpectaclesFromSpecificLanguage(['count' => true])
  2103.             ),
  2104.             'traduction' => array(
  2105.                 'name' => 'En traduction',
  2106.                 'key_activate' => 'traductions-en-scene',
  2107.                 'count' => $this->GetListSpectaclesFromSpecificLanguage(['traduction' => true'count' => true])
  2108.             )
  2109.         );
  2110.         if (array_key_exists('unset_traduction'$params) && !$params['unset_traduction']){
  2111.             unset($original_traduction['traduction']);
  2112.         }
  2113.         if (array_key_exists('unset_original'$params) && !$params['unset_original']){
  2114.             unset($original_traduction['original']);
  2115.         }
  2116.         if (array_key_exists('csm_name_en_scene'$params)){
  2117.             $original_traduction['original']['name'] = $params['csm_name_en_scene'];
  2118.         }
  2119.         // aside
  2120.         $this->asides->load(['url_lists_alone,tn_cdn_sn' => array(
  2121.             'php' => array(
  2122.                 'method' => 'asidesUrlLists',
  2123.                 'urls' => $original_traduction,
  2124.                 'url' => '/textes/{v_url_clean}/key_activate/',
  2125.                 'params' => array(
  2126.                     'activate' => $this->context['action'],
  2127.                 )
  2128.             ),
  2129.             'title' => 'Voir'
  2130.         )]);
  2131.         $this->asides->load('common_carrer_informations');
  2132.         $this->asides->load('common_participer_textes');
  2133.     }
  2134.     // }}}
  2135. }