src/Controller/ContactController.php line 2888

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\ClassTheatre\asides;
  4. use App\ClassTheatre\TheatreController;
  5. use App\ClassTheatre\UtilsContacts;
  6. use App\Exception\RedirectException;
  7. use App\Service\Abonnements\Abonnements;
  8. use App\Service\Date_time;
  9. use App\Service\EditUtils;
  10. use App\Service\Functions;
  11. use App\Service\TheatreMail\TheatreMail;
  12. use App\Service\UploadUtils;
  13. use App\Service\UtilsEdit;
  14. use App\Validator\CheckWebsite;
  15. use Doctrine\ORM\EntityManagerInterface;
  16. use Psr\Log\LoggerInterface;
  17. use Symfony\Component\Cache\Adapter\AdapterInterface;
  18. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  19. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  20. use Symfony\Component\Form\Extension\Core\Type\FormType;
  21. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  22. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  23. use Symfony\Component\Form\Extension\Core\Type\TextType;
  24. use Symfony\Component\Form\FormFactoryInterface;
  25. use Symfony\Component\HttpFoundation\RedirectResponse;
  26. use Symfony\Component\HttpFoundation\Request;
  27. use Symfony\Component\Routing\Annotation\Route;
  28. use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
  29. use Symfony\Contracts\Translation\TranslatorInterface;
  30. use Symfony\Component\Validator\Constraints\Email;
  31. use Symfony\Component\Validator\Constraints\NotBlank;
  32. use Symfony\Component\Validator\Constraints\Url;
  33. use TheatreCore\Classes\Constants\Constants;
  34. use TheatreCore\Classes\Ecoles;
  35. use TheatreCore\Classes\Images\Images;
  36. use TheatreCore\Entity\Aidecontacts;
  37. use TheatreCore\Entity\Aides;
  38. use TheatreCore\Entity\BookmarkExtranetuser;
  39. use TheatreCore\Entity\Classifications;
  40. use TheatreCore\Entity\Contacts;
  41. use TheatreCore\Entity\Contents;
  42. use TheatreCore\Entity\Dvds;
  43. use TheatreCore\Entity\Extranetusers;
  44. use TheatreCore\Entity\Files;
  45. use TheatreCore\Entity\Multimedias;
  46. use TheatreCore\Entity\News;
  47. use TheatreCore\Entity\ObjectMultimedia;
  48. use TheatreCore\Entity\PersonEcole;
  49. use TheatreCore\Entity\Persons;
  50. use TheatreCore\Entity\Playlists;
  51. use TheatreCore\Entity\Podcasts;
  52. use TheatreCore\Entity\Regions;
  53. use TheatreCore\Entity\Schedules;
  54. use TheatreCore\Entity\Spectacles;
  55. use TheatreCore\Entity\Stats;
  56. use TheatreCore\Entity\Texts;
  57. use TheatreCore\Entity\Typesstructures;
  58. use TheatreCore\Form\Type\RelationsType;
  59. class ContactController extends TheatreController
  60. {
  61.     // id de l'objet
  62.     protected $idobject null;
  63.     // objet
  64.     protected $obj null;
  65.     // type d'objet
  66.     protected $type_object 'contacts';
  67.     // object contents
  68.     protected $contents;
  69.     // object multimedias
  70.     protected $multimedias;
  71.     // infos sur l'objet
  72.     protected $infosobject = array();
  73.     // précision fil d'arianne
  74.     protected $locate null;
  75.     // titre de la page
  76.     protected $title_page null;
  77.     // meta keywords et meta description
  78.     protected $meta_keywords '';
  79.     protected $meta_description '';
  80.     // taille maxi des vidéos
  81.     protected $other_dimensions = array();
  82.     // infos pour mon théâtre
  83.     protected $mtinfos = array();
  84.     // pour le menu principal
  85.     protected $rub_courante null;
  86.     // titre et localisation en plus
  87.     protected $extra_title '';
  88.     protected $extra_locate '';
  89.     // est-ce qu'on est sur la home ?
  90.     protected $is_accueil false;
  91.     // les styles standard des blocs text et spectacle
  92.     protected $stylemore_spectacle = array('imagep' => 'width:80px;''descsp' => 'width:300px;');
  93.     protected $stylemore_text = array('imagep' => 'width:60px;''desctxt' => 'width:295px;');
  94.     // soutien JTN
  95.     protected $idclassification_soutien;
  96.     protected $ids_spectacle_in;
  97.     protected $ids_spectacle_prod;
  98.     protected $ids_spectacle_structures_diffusions;
  99.     protected $ids_spectacle_all;
  100.     protected $ids_spectacle_anciens;
  101.     protected $ids_spectacle_soutien;
  102.     protected $ids_spectacle_aide;
  103.     protected $ids_spectacle_laureats_nominations;
  104.     protected $ids_spectacle_soutiens;
  105.     protected $ids_spectacle_selections;
  106.     protected $ids_spectacle_publisher;
  107.     protected $ids_multimedia_in;
  108.     protected $ids_multimedia_prod;
  109.     protected $ids_multimedia_contact;
  110.     protected $ids_multimedia_all;
  111.     protected $nb_contact_recherche 5;
  112.     public $format_vignette = array(
  113.         'stylemore' => array('imagep' => 'width:65px;''descsp' => 'width:330px;'),
  114.         'vignette' => array('width' => 65'height' => 65'direction' => 'crop')
  115.     );
  116.     protected $asides "";
  117.     protected $serviceAbonnements;
  118.     private ?LoggerInterface $logger null;
  119.     private $redirectedFrom null;
  120.     private ?AdapterInterface $cache null;
  121.     // {{{ _construct()
  122.     /** constructeur hérité
  123.      *
  124.      */
  125.     public function __construct(
  126.         EntityManagerInterface $em,
  127.         TranslatorInterface $translator,
  128.         TokenStorageInterface $tokenStorage,
  129.         Functions $func,
  130.         Abonnements $abonnements,
  131.         LoggerInterface $logger,
  132.         AdapterInterface $cache
  133.     )
  134.     {
  135.         // load new aside
  136.         $this->asides = new asides();
  137.         $this->func $func;
  138.         $this->serviceAbonnements $abonnements;
  139.         $GLOBALS['rub_courante'] = 'contacts';
  140.         $GLOBALS['publish'] = 1;
  141.         $this->em $em;
  142.         $this->logger $logger;
  143.         $this->cache $cache;
  144.         // hérite du constructeur parent
  145.         parent::__construct($translator$tokenStorage);
  146.     }
  147.     public function InitController($slug null$action null$params_init = [])
  148.     {
  149.         $this->slug $slug;
  150.         $this->view->action $this->context['action'] = $action;
  151.         $this->RouterOptions($slug$action$GLOBALS['rub_courante']);
  152.         $this->view->controller $GLOBALS['rub_courante'];
  153.         // charger swfobject
  154.         $this->context['view']->jquery_flash true;
  155.         if (!empty($params_init['idcontact'])) {
  156.             $this->idobject $this->id = (int)$params_init['idcontact'];
  157.         } else {
  158.             $this->context['params']['idcontact'] = $this->idobject = (int)$this->id;
  159.         }
  160.         // si idcontact n'existe pas, on renvoi sur une page d'erreur TODO
  161.         if (empty($this->id)) {
  162.             throw new RedirectException($this->context['url_module'] . '/erreur/');
  163.         }
  164.         // Classe principale (ici contact)
  165.         $this->obj $this->em->getRepository('TheatreCore\\Entity\\' ucfirst($this->type_object));
  166.         // Classe Contents
  167.         $this->contents $this->em->getRepository(Contents::class);
  168.         // Classe Multimedias
  169.         $this->multimedias $this->em->getRepository(Multimedias::class);
  170.         // status des contenus => publié
  171.         $this->contents->setPublishStatus($this->publish_status);
  172.         // on recupere l'enregistrement
  173.         $this->infosobject $this->obj->getInfosContact($this->idobject, array('get_idtypestructure' => true));
  174.         if (($this->infosobject['idtypestructure'] == 'ED' || $this->infosobject['idtypestructure'] == 'RV') && empty($params_init)) {
  175.             throw new RedirectException('/editions/' $this->infosobject['url_clean']);
  176.         }
  177.         // voir si c'est une école de théâtre
  178.         $ecoles_type = array('EC''LE''JT');
  179.         if (in_array($this->infosobject['idtypestructure'], $ecoles_type)) {
  180.             $this->context['view']->is_ecole true;
  181.         }
  182.         // si JTN => class_spectacle_jtn => 103
  183.         if ($this->idobject == 3914) {
  184.             $this->context['view']->is_jtn true;
  185.             $this->idclassification_soutien 103;
  186.         }
  187.         // trouver le directeur actuel de la structure
  188.         $boss $this->obj->getAssociatePersons($this->idobject1false);
  189.         foreach ($boss as $k => $v) {
  190.             $date_current = new \Datetime(date('Y-m-d H:i:s'));
  191.             $date_current $date_current->format('Y-m-d');
  192.             if ($v['date_start'] != '0000-00-00 00:00:00') {
  193.                 $date_start = new \Datetime($v['date_start']);
  194.                 $date_start $date_start->format('Y-m-d');
  195.                 if ($date_start $date_current) {
  196.                     unset($boss[$k]);
  197.                 }
  198.             }
  199.             if ($v['date_end'] != '0000-00-00 00:00:00') {
  200.                 $date_end = new \Datetime($v['date_end']);
  201.                 $date_end $date_end->format('Y-m-d');
  202.                 if ($date_end $date_current) {
  203.                     unset($boss[$k]);
  204.                 }
  205.             }
  206.         }
  207.         $this->infosobject['boss'] = $boss;
  208.         // tester si il y a un bandeau custom
  209.         $files $this->em->getRepository(Files::class);
  210.         $files->setPublishStatus(1);
  211.         $this->context['view']->bandeau $files->getObjectFiles($this->idobject'contacts'100);
  212.         // tester si il y a une image de profile
  213.         $profilepicture $this->obj->getVignetteContact($this->idobject, array('width' => 90'height' => 90), 'class_pp');
  214.         if (strpos($profilepicture'normal-def') === false) {
  215.             $this->context['view']->profilepicture $profilepicture;
  216.         }
  217.         // si france
  218.         if ($this->infosobject['country'] != 'France') {
  219.             $this->infosobject['country_view'] = true;
  220.         }
  221.         // le nombre de spectacles
  222.         $this->infosobject['nb_spectacles'] = $this->countAllSpectacles();
  223.         // le nombre de vidéos
  224.         $this->infosobject['nb_multimedias'] = $this->countAllMultimedias();
  225.         // les critiques
  226.         $this->infosobject['nb_critiques'] = $this->countAllCritiques();
  227.         // url_folder
  228.         $this->infosobject['url_folder'] = '/' $this->type_object '/' $this->infosobject['url_clean'];
  229.         // url du dossier
  230.         $this->url_folder $this->infosobject['url_folder'];
  231.         // style
  232.         $this->style_more = array('rubrique''dossier''auteur''pageregion');
  233.         // seulement les données publiées
  234.         $GLOBALS['publish'] = 1;
  235.         /*
  236.             format orrect à remettre lors de la mis-en-production
  237.             public $format_vignette = array(
  238.                 'stylemore' => array('imagep' => 'width:65px;', 'descsp' => 'width:330px;'),
  239.                 'vignette' => array('width'=>100,'height'=>100,'direction'=>'crop')
  240.             );
  241.         */
  242.         $this->format_vignette = array(
  243.             'vignette' => array('width' => 100'height' => 100'direction' => 'crop')
  244.         );
  245.     }
  246.     // }}}
  247.     // {{{ contenus()
  248.     /** Les articles associés aux object
  249.      *
  250.      */
  251.     public function contenus_contact($type_class$type_class_view$other_dimensions = array('width' => 500'grow' => false))
  252.     {
  253.         parent::contenus($this->type_object$this->idobject$type_class$type_class_view$other_dimensions);
  254.     }
  255.     // }}}
  256.     // {{{ buildMenuAdmin()
  257.     /** Construit le menu admin
  258.      *
  259.      *
  260.      * @access protected
  261.      * @return void
  262.      */
  263.     protected function buildMenuAdmin()
  264.     {
  265.         $menu_object['presentation-edit'] = array('nom' => 'Présentation''title' => 'Présentation de ' $this->infosobject['fullname']);
  266.         $menu_object['infos-generales'] = array('nom' => 'Infos générales''title' => 'Infos générales de ' $this->infosobject['fullname']);
  267.         // if(!empty($this->infosobject['is_partenaire'])) {
  268.         $menu_object['bandeau'] = array('nom' => 'Bandeau''title' => 'Bandeau de ' $this->infosobject['fullname']);
  269.         // }
  270.         // TODO: a remettre pour la V3
  271.         // if(!empty($this->infosobject['stats_access'])) {
  272.         //     $menu_object['stats'] = array('nom' => 'Stats spectacles', 'title' => 'Stats de '.$this->infosobject['fullname']);
  273.         //     $menu_object['stats-videos'] = array('nom' => 'Stats vidéos', 'title' => 'Stats vidéos de '.$this->infosobject['fullname']);
  274.         // }
  275.         $menu_object['documents'] = array('nom' => 'Documents (PDF)''title' => 'Documents numérisés de ' $this->infosobject['fullname']);
  276.         // si c'est une ecole => menu ecole JTN uniquement pour l'instant
  277.         if ($this->em->getRepository(PersonEcole::class)->countEleves($this->infosobject['idcontact']) > && $this->infosobject['idcontact'] == 3914) {
  278.             $menu_object['eleves'] = array('nom' => 'Élèves''title' => 'Élèves de ' $this->infosobject['fullname']);
  279.         }
  280.         // menu courant actif
  281.         $menu_object[$this->context['action']]['active'] = 'on';
  282.         if ($this->context['action'] == 'documents-edit' || $this->context['action'] == 'documents-delete') {
  283.             $menu_object['documents']['active'] = 'on';
  284.         }
  285.         $keys_menu_object array_keys($menu_object);
  286.         $first reset($keys_menu_object);
  287.         $menu_object[$first]['first'] = true;
  288.         // envoyer le menu
  289.         $this->view->menu_admin $menu_object;
  290.     }
  291.     // }}}
  292.     // {{{ buildMenu()
  293.     /** Construit le menu et l'envoie à la vue
  294.      *
  295.      *
  296.      * @access protected
  297.      * @return void
  298.      */
  299.     protected function buildMenu()
  300.     {
  301.         // le nombre de spectacles (ajoute spectacle à venir dans aside "voir")
  302.         // $this->infosobject['nb_spectacles'] = $this->countAllSpectacles();
  303.         // le nombre de vidéos
  304.         $this->infosobject['nb_multimedias'] = $this->countAllMultimedias();
  305.         // les critiques
  306.         $this->infosobject['nb_critiques'] = $this->countAllCritiques();
  307.         // url_folder
  308.         $this->infosobject['url_folder'] = '/' $this->type_object '/' $this->infosobject['url_clean'];
  309.         // url du dossier
  310.         $this->url_folder $this->infosobject['url_folder'];
  311.         // style
  312.         $this->style_more = array('rubrique''dossier''auteur''pageregion');
  313.         // seulement les données publiées
  314.         $GLOBALS['publish'] = 1;
  315.         $menu_object = array();
  316.         // accueil avec l'actualite
  317.         $menu_object['detail-contact'] = array('nom' => 'Actualité''title' => 'Actualités de ' $this->infosobject['fullname']);
  318.         if ($this->contents->getAssociateContent($this->idobject$this->type_object'class_presentation_structure')) {
  319.             $menu_object['presentation'] = array('nom' => 'En savoir +''title' => 'Présentation de ' $this->infosobject['fullname']);
  320.         }
  321.         $res_class_articles $this->contents->getAssociateContent($this->idobject$this->type_object'class_article');
  322.         if (!is_null($res_class_articles) && count($res_class_articles) > 0) {
  323.             $menu_person['presentation'] = array('nom' => 'En savoir +''title' => 'Présentation de ' $this->infosobject['fullname'], 'icone' => '111-user.png');
  324.         }
  325.         // presentation du contact
  326.         // voir si le contact est associé à un prix
  327.         $aides $this->em->getRepository(Aides::class);
  328.         $params_sql_aides = array(
  329.             'special' => array(
  330.                 'aides' => array(
  331.                     'idcontacts' => $this->infosobject['idcontact'],
  332.                 ),
  333.                 'type_aide' => 2// Prix et distinctions
  334.             ),
  335.             'dbg' => array('nombre_prix''Nombre de prix'),
  336.         );
  337.         $nb_laureats $aides->countAides($params_sql_aides);
  338.         if ($nb_laureats 0) {
  339.             $menu_object['laureats'] = array('nom' => 'Lauréats''title' => 'Lauréats de ' $this->infosobject['fullname']);
  340.         }
  341.         $params_sql_aides['special']['type_aide'] = 3// nominations
  342.         $params_sql_aides['dbg'] = array('nombre_nominations''Nombre de nominations');
  343.         $nb_nomination $aides->countAides($params_sql_aides);
  344.         if ($nb_nomination 0) {
  345.             $menu_object['nominations'] = array('nom' => 'Nominations''title' => 'Nominations de ' $this->infosobject['fullname']);
  346.         }
  347.         //Si nous sommes sur France Culture
  348. //        || $this->context['view']->nb_spectacles_in_audio > 0 || $this->context['view']->nb_spectacles_anciens_audio > 0 || $this->context['view']->nb_spectacles_prod_audio > 0 || $this->context['view']->nb_spectacles_coprod_audio > 0
  349.         if ($this->idobject == 595 || $this->idobject == 5222) {
  350.             $menu_object['podcasts'] = array('nom' => html_entity_decode('&Eacute;couter'), 'title' => html_entity_decode('&Eacute;couter') . ' France Culture ' $this->infosobject['fullname']);
  351.         }
  352.         $sql 'SELECT COUNT(p.idplaylist)
  353.               FROM playlists p
  354.               LEFT JOIN playlist_classification pc ON p.idplaylist = pc.idplaylist
  355.               LEFT JOIN aides a ON a.idcontact=' $this->infosobject['idcontact'] . '
  356.               LEFT JOIN text_aide ta ON a.`idaide`=ta.`idaide`
  357.               WHERE 1 AND a.`publish`=1 AND a.`type_aide` IN (2,3) AND pc.idclassification = 144 AND p.idtext = ta.idtext
  358.               GROUP BY p.idtext';
  359.         $nb_textes_auteurs $this->obj->queryOne($sql);
  360.         if ($nb_textes_auteurs 0) {
  361.             $menu_object['auteurs'] = array('nom' => 'Le texte par l\'auteur''title' => 'Le texte par leurs auteurs');
  362.         }
  363.         $params_sql_aides['special']['type_aide'] = 1// soutiens
  364.         $params_sql_aides['dbg'] = array('nombre_soutiens''Nombre de soutiens');
  365.         $nb_soutien $aides->countAides($params_sql_aides);
  366.         if ($nb_soutien 0) {
  367.             $menu_object['soutiens'] = array('nom' => 'Soutiens''title' => 'Soutenus par ' $this->infosobject['fullname']);
  368.         }
  369.         $params_sql_aides['special']['type_aide'] = 4// sélection
  370.         $params_sql_aides['dbg'] = array('nombre_selections''Nombre de sélections');
  371.         $nb_selection $aides->countAides($params_sql_aides);
  372.         if ($nb_selection 0) {
  373.             $menu_object['selections'] = array('nom' => 'Sélections''title' => 'Sélectionnés par ' $this->infosobject['fullname']);
  374.         }
  375.         // // ancien élèves si école
  376.         $ecoles_type = array('EC''LE''JT');
  377.         //
  378.         if (in_array($this->infosobject['idtypestructure'], $ecoles_type)) {
  379.             $person_ecole $this->em->getRepository(PersonEcole::class);
  380.             $nb_eleves $person_ecole->countEleves($this->infosobject['idcontact']);
  381.             if ($this->idobject == 3914) {
  382.                 $label_etudiants 'Artistes';
  383.                 $label_anciens 'Anciens artistes';
  384.             } else {
  385.                 $label_etudiants 'Étudiants';
  386.                 $label_anciens 'Anciens étudiants';
  387.             }
  388.             // trouver les étudiants en cours d'étude = étudiant sans date de fin ou date de fin > à la date du jour
  389.             if ($nb_eleves 0) {
  390.                 $menu_object['etudiants'] = array('nom' => $label_etudiants'title' => $label_etudiants ' de ' $this->infosobject['fullname']);
  391.             }
  392.         }
  393.         //Les prochains spectacles avec émissions associés
  394.         $totalProchainsSpectaclesPodcasts 0;
  395.         if (in_array($this->idobject, [5955222])) {
  396.             $params_sql = array(
  397.                 'special' => array(
  398.                     'textfictif' => 0,
  399.                     'plus_proche' => true,
  400.                     'podcasts' => [
  401.                         'type_podcast' => 'franceculture'
  402.                     ]
  403.                 ),
  404.                 'dbg' => array('total_spectacles_emissions_associces''Total des spectacles avec textes non fictifs qui ont un podcast'),
  405.             );
  406.             $params_sql['special']['type_franceinter'] = null;
  407.             if ($this->idobject == 5222) {
  408.                 $params_sql['special']['type_franceinter'] = 1;
  409.             }
  410.             $totalProchainsSpectaclesPodcasts $this->em->getRepository(Spectacles::class)->countListSpectacles($params_sql);
  411.         }
  412.         // archives des spectacles
  413.         $nb_anciens $nb_affiche 0;
  414.         if ($this->infosobject['nb_spectacles'] > 0) {
  415.             if (empty($this->context['view']->nb_total_spectacle)) {
  416.                 $this->action_spectacles(nullfalse);
  417.             }
  418.             $menu_object['spectacles'] = array(
  419.                 'nom' => 'En scènes (' $this->context['view']->nb_total_spectacle ')',
  420.                 'title' => 'Tous les spectacles de ' $this->infosobject['fullname'],
  421.                 'subaction' => array(
  422.                     'en-scene' => 'soutiens en scène'
  423.                 )
  424.             );
  425.         } else if ($nb_soutien || $nb_laureats || $nb_nomination || ($nb_affiche $this->countEnScene(['affiche' => true])) || ($nb_anciens $this->countEnScene(['anciens' => true])) || $totalProchainsSpectaclesPodcasts 0) {
  426.             $menu_object['en-scene'] = array('nom' => 'En scène''title' => 'Les mises en scène autour de ' $this->infosobject['fullname']);
  427.         }
  428.         // les spectacles à l'affiche avec des textes nonfictif
  429.         $this->context['view']->nb_en_scene $this->em->getRepository(Spectacles::class)->countListSpectacles(array(
  430.             'special' => array(
  431.                 'textfictif' => 0,
  432.                 'aide' => array(
  433.                     'idcontact' => $this->idobject,
  434.                 ),
  435.                 'text_aide' => true,
  436.             ),
  437.             'dbg' => array('menu_list_textes_affiche''Liste des spectacles avec textes non fictifs qui ont reçu une aide'),
  438.         ));
  439.         //$nb_selection == 0 &&
  440.         // if($nb_soutien==0 && $nb_laureats==0 && $nb_nomination==0 && $this->context['view']->nb_en_scene>0) {
  441.         //     $menu_object['en-scene'] = array('nom' => 'En scène', 'title' => 'Tous les textes soutenus à l\'affiche de '.$this->infosobject['fullname']);
  442.         // }
  443.         // else {
  444.         //     // pour en scène
  445.         //     if($this->context['action']=='en-scene') {
  446.         //         if(!empty($_SESSION['from_page_aide']) && !empty($menu_object[$_SESSION['from_page_aide']])) {
  447.         //             $this->current = $menu_object[$_SESSION['from_page_aide']];
  448.         //             $menu_object[$_SESSION['from_page_aide']]['active'] = 'on';
  449.         //         }
  450.         //     }
  451.         //     // pour les auteurs
  452.         //     else if($this->context['action']=='auteurs') {
  453.         //         if(!empty($_SESSION['from_page_aide'])) {
  454.         //             $this->current = $menu_object[$_SESSION['from_page_aide']];
  455.         //             $menu_object[$_SESSION['from_page_aide']]['active'] = 'on';
  456.         //         }
  457.         //     }
  458.         // }
  459.         // TODO: Enlever à la release
  460.         // if(in_array($this->infosobject['idtypestructure'],$ecoles_type)) {
  461.         //
  462.         //     if($nb_eleves_old>0) {
  463.         //         $menu_object['anciens-etudiants'] = array('nom' => $label_anciens.' ('.$nb_eleves_old.')', 'title' => $label_anciens.' de '.$this->infosobject['fullname']);
  464.         //     } else {
  465.         //         $menu_object['anciens-etudiants'] = array('nom' => $label_anciens, 'title' => $label_anciens.' de '.$this->infosobject['fullname']);
  466.         //         $this->context['view']->no_eleve = true;
  467.         //     }
  468.         //
  469.         //     // spectacles des élèves
  470.         //     if($nb_eleves>0) {
  471.         //         $menu_object['etudiants-spectacles'] = array('nom' => 'Anciens à l\'affiche', 'title' => $label_anciens.' de '.$this->infosobject['fullname']);
  472.         //     }
  473.         // }
  474.         // 15621 = ministere de l'education
  475.         if (!empty($this->idobject) && $this->idobject == 15621) {
  476.             $menu_object['en-scene'] = array('nom' => 'en scène''title' => 'Tous les textes en scène de ' $this->infosobject['fullname']);
  477.             unset($menu_object['spectacles']);
  478.         }
  479.         // évènements
  480.         $news $this->em->getRepository(News::class);
  481.         $news_params = array(
  482.             'special' => array(
  483.                 'by_object' => array('idcontact' => $this->idobject),
  484.             ),
  485.         );
  486.         $countnews $news->countNews($news_params);
  487.         // les critiques
  488.         if ($this->infosobject['nb_critiques'] > 0) {
  489.             $menu_object['critiques'] = array('nom' => 'Critiques (' $this->infosobject['nb_critiques'] . ')''title' => 'Toutes les critiques des spectacles de ' $this->infosobject['fullname']);
  490.         }
  491.         // 15621 = ministere de l'education
  492. //        if(!empty($this->idobject) && $this->idobject != 15621){
  493.         if ($countnews 0) {
  494.             $menu_object['evenements'] = array('nom' => 'Évènements''title' => 'Évènements autour de ' $this->infosobject['fullname'] . ' proposés par les internautes');
  495.         }
  496. //        }
  497.         // Y a t"il des vidéos
  498.         if ($this->infosobject['nb_multimedias'] > 0) {
  499.             $menu_object['videos'] = array('nom' => 'Vidéos (' $this->infosobject['nb_multimedias'] . ')''title' => 'Vidéos de ' $this->infosobject['fullname']);
  500.         } else {
  501.             $culturebox_params = array(
  502.                 'special' => array(
  503.                     'type_podcast' => 'culturebox'//commun
  504.                     'is_integrale' => true//commun
  505.                     'idcontacts' => $this->idobject
  506.                 ),
  507.                 'dbg' => array('culturebox_data''Les replay culturebox'),
  508.             );
  509.             $derniers_culturebox $this->em->getRepository(Podcasts::class)->countListPodcasts($culturebox_params);
  510.             if ($derniers_culturebox) {
  511.                 $menu_object['captations'] = array('nom' => 'Vidéos''title' => 'Vidéos de ' $this->infosobject['fullname']);
  512.             }
  513.         }
  514.         // emmision ou podcast
  515.         $countecouter $this->em->getRepository(Podcasts::class)->countPodcasts('spectacles'$this->ids_spectacle_all'franceinter'true);
  516.         $countPodcast = (int)$this->em->getRepository(Podcasts::class)->countPodcastsForContact($this->idobject);
  517.         if ($countecouter 0) {
  518.             $menu_object['emissions'] = array('nom' => 'Audio''title' => 'Audio de ' $this->infosobject['fullname']);
  519.         } else if ($countPodcast 0) {
  520.             $menu_object['podcasts'] = array('nom' => 'Audio''title' => 'Audio de ' $this->infosobject['fullname']);
  521.         }
  522.         // Y a t"il des contenus éduc
  523.         $nb_educ $this->countAllEduc();
  524.         if ($nb_educ 0) {
  525.             $menu_object['contenu-pedagogique'] = array('nom' => 'Éduc (' $nb_educ ')''title' => 'Contenus pédagogiques de ' $this->infosobject['fullname']);
  526.         }
  527.         $this->context['view']->nb_files $this->countTelechargements();
  528.         if ($this->context['view']->nb_files 0) {
  529.             $menu_object['telechargements'] = array('nom' => html_entity_decode('<span class="tc-icon-download-outline"></span>'), 'oldnom' => 'DOC. NUMÉRISÉS''title' => 'Documents numérisés de ' $this->infosobject['fullname']);
  530.         }
  531.         // menu courant actif
  532.         foreach ($menu_object as $kmenu => $vmenu) {
  533.             if ($kmenu == $this->context['action'] || !empty($vmenu['subaction'][$this->context['action']])) {
  534.                 $menu_object[$kmenu]['active'] = 'on';
  535.                 $this->current $menu_object[$kmenu];
  536.             }
  537.         }
  538.         //Si nous sommes dans des captations
  539.         if ($this->context['action'] == 'captations' || $this->context['action'] == 'dvd') {
  540.             $menu_object['videos']['active'] = 'on';
  541.             $this->current $menu_object['videos'];
  542.         }
  543.         // Audios actifs
  544.         if ($this->context['action'] == 'podcasts') {
  545.             $menu_object['emissions']['active'] = 'on';
  546.             $this->current $menu_object['emissions'];
  547.         }
  548.         // anciens à l'affiche
  549.         if (in_array($this->context['action'], ['anciens-etudiants'])) {
  550.             $menu_object['etudiants']['active'] = 'on';
  551.             $this->current $menu_object['etudiants'];
  552.         } else if (in_array($this->context['action'], ['etudiants-spectacles-tous''etudiants-spectacles''calendrier'])) {
  553.             $menu_object['spectacles']['active'] = 'on';
  554.             $this->current $menu_object['spectacles'];
  555.         }
  556.         if ($this->context['action'] == 'telechargements') {
  557.             $menu_object['telechargements']['nom'] = html_entity_decode('<span class="tc-icon-download"></span>');
  558.         }
  559.         // ajoute la class
  560.         foreach ($menu_object as $k => $v) {
  561.             $menu_object[$k]['classcolor'] = ' menu_' $k;
  562.         }
  563.         $key_menu_object array_keys($menu_object);
  564.         $first reset($key_menu_object);
  565.         $menu_object[$first]['first'] = true;
  566.         // envoyer le menu
  567.         $this->view->menu_object $menu_object;
  568.         // retraiter le menu  pour créer un sous menu étudiant
  569. //        if(!empty($menu_object['etudiants']) || !empty($menu_object['anciens-etudiants'])) {
  570. //            foreach($menu_object as $k=>$v) {
  571. //                $new_menu_object[$k] = $v;
  572. //            }
  573. //
  574. //            if($this->context['action']=='etudiants-spectacles' || $this->context['action']=='etudiants' || $this->context['action']=='anciens-etudiants' || $this->context['action']=='etudiants-spectacles-tous') {
  575. //                $new_menu_object['ecoles']['active'] = 'on';
  576. //                $this->current = $new_menu_object['ecoles'];
  577. //            }
  578. //
  579. //            $this->view->menu_object = $new_menu_object;
  580. //
  581. //        }
  582.     }
  583.     // }}}
  584.     // {{{ finalizeAction()
  585.     /** Après l'action, construit le titre de page et le fil d'arianne
  586.      *
  587.      *
  588.      * @access protected
  589.      * @return void
  590.      */
  591.     protected function finalizeAction()
  592.     {
  593.         $this->context['controller'] = 'contacts';
  594.         // construction du menu
  595.         $this->buildMenu();
  596.         // menu admin
  597.         $this->buildMenuAdmin();
  598.         if (!empty($this->extra_title)) {
  599.             $this->title_page .= $this->extra_title ' - ' $this->infosobject['fullname'];
  600.         } else if (!empty($this->current['title'])) {
  601.             $this->title_page .= $this->current['title'];
  602.         } else {
  603.             $this->title_page .= $this->infosobject['fullname'];
  604.         }
  605.         // titre de la page
  606.         $this->title_page .= ' - tous ses textes, mises en scène, activités';
  607.         // situation
  608.         $this->view->locate = array('/contacts/' => 'Contacts');
  609.         // rubrique (pour le menu principal)
  610.         $this->rub_courante 'contacts';
  611.         // complément du fil d'arianne
  612.         if (empty($this->is_accueil)) {
  613.             if (empty($this->extra_locate) && !empty($this->current['nom'])) {
  614.                 $this->extra_locate $this->current['nom'];
  615.             }
  616.             // on ajoute la sous-rubrique actuelle
  617.             $this->view->locate[$this->infosobject['url_folder'] . '/'] = $this->infosobject['fullname'];
  618.             $this->view->locate[0] = $this->extra_locate;
  619.         } else {
  620.             // à l'accueil, on ne précise pas la sous-rubrique
  621.             $this->view->locate[0] = $this->infosobject['fullname'];
  622.             $this->view->is_accueil true;
  623.         }
  624.         // envoi au template
  625.         $this->view->data_object $this->infosobject;
  626.         // autres infos pour mon theatre
  627.         $mtinfos = array(
  628.             'object' => $this->type_object,
  629.             'idobject' => $this->idobject,
  630.             'urifrom' => '/' $this->type_object '/' $this->infosobject['url_clean'] . '/',
  631.             'info_rub' => 'ce contact'
  632.         );
  633.         $this->view->mtinfos $mtinfos;
  634.         // barre de modification
  635.         $this->view->barre_infos[] = array(
  636.             'url' => '/contacts/' $this->infosobject['url_clean'] . '/infos-generales',
  637.             'title' => 'modifier ce contact',
  638.             'icone' => 'edit_icon',
  639.         );
  640.         $this->view->barre_infos[] = array(
  641.             'url' => '/contacts/' $this->infosobject['url_clean'] . '/documents-edit',
  642.             'title' => 'ajouter un document PDF',
  643.             'icone' => 'addpdf_icon',
  644.         );
  645.         // voir si l'objet est bookmarke
  646.         $bookmark $this->em->getRepository(BookmarkExtranetuser::class);
  647.         if ($this->isGranted('IS_AUTHENTICATED_REMEMBERED')
  648.             && $bookmark->isBookmark($this->idobject'contacts'$this->context['session']->getIdextranetuser())) {
  649.             $this->view->is_bookmark true;
  650.         }
  651.         // action add/delete bookmark
  652.         if (isset($_GET['bookmark'])) {
  653.             $this->view->bookmark true;
  654.             $do_action $_GET['do_action'];
  655.             $this->view->$do_action true;
  656.         }
  657.         if (empty($this->current['idcontent'])) {
  658.             $this->current['idcontent'] = null;
  659.         }
  660.         // statistique de visite
  661.         if (!empty($this->idobject) && !$this->no_stats) {
  662.             $statsinfos = array(
  663.                 'type' => 'article',
  664.                 'module' => $this->context['module'],
  665.                 'url' => $_SERVER['REQUEST_URI'],
  666.                 'idcontent' => (int)$this->current['idcontent'],
  667.                 'object' => 'contacts',
  668.                 'idobject' => $this->idobject,
  669.                 'video' => (int)(!empty($this->view->detailarticle['display_media']))
  670.             );
  671.             $stats $this->em->getRepository(Stats::class);
  672.             $stats->setStats($statsinfos__FILE__ ':' __LINE__);
  673.         }
  674.         // pour les liens dans le template
  675.         $this->view->url_folder $this->url_folder;
  676.         $this->context['view']->info_theatre true;
  677.         // charge l'aside à la vue,
  678.         $this->view->aside $this->asides->view($this->view);
  679.         $this->exports();
  680.     }
  681.     // }}}
  682.     // {{{ action_detail_contact()
  683.     /** Accueil de la page contact
  684.      *
  685.      * @Route("/contacts/{slug}/", name="contact_view")
  686.      * @Route("/contacts/{slug}/detail-contact/", name="contact_detail_contact")
  687.      *
  688.      **/
  689.     public function action_detail_contact(Request $request$slug)
  690.     {
  691.         $this->InitController($slug'detail-contact');
  692.         $this->action_actualites($request);
  693.         // presentation "bio_txt"
  694.         $biotxt $this->contents->getAssociateContent($this->idobject$this->type_object'class_presentation_structure', array('wiki_convert' => true));
  695.         if (!empty($biotxt['text'])) {
  696.             if (strlen($biotxt['text']) > 351) {
  697.                 $biotxt['text'] = substr($biotxt['text'], 0351);
  698.                 $biotxt['text'] = strip_tags($biotxt['text'], '<a>');
  699.                 $biotxt['text_strlen'] = true;
  700.             }
  701.             $this->view->biotxt $biotxt;
  702.             // mots-clés et description
  703.             $this->func->makeMetaFromHtml($biotxt['text'], $this->meta_description$this->meta_keywords);
  704.         }
  705.         foreach ($this->context['view']->spectacles_affiche as $k => $v) {
  706.             $this->context['view']->spectacles_affiche[$k]['footer_date'] = true;
  707.         }
  708.         foreach ($this->context['view']->spectacles_derniers as $k => $v) {
  709.             $this->context['view']->spectacles_derniers[$k]['no_date'] = true;
  710.             $this->context['view']->spectacles_derniers[$k]['footer_date'] = true;
  711.         }
  712.         foreach ($this->context['view']->spectacles_prod as $k => $v) {
  713.             $this->context['view']->spectacles_prod[$k]['footer_contact'] = true;
  714.         }
  715.         foreach ($this->context['view']->spectacles_prod_derniers as $k => $v) {
  716.             $this->context['view']->spectacles_prod_derniers[$k]['footer_contact'] = true;
  717.         }
  718.         $schedules $this->em->getRepository(Schedules::class);
  719.         $ids_spectacle_in $this->obj->getSpectaclesIn($this->idobject);
  720.         $ids_spectacle_structures_diffusions $this->obj->getSpectaclesProd($this->idobjectfalsenull77);
  721.         $ids_spectacles array_merge($ids_spectacle_in$ids_spectacle_structures_diffusions);
  722.         if (!empty($ids_spectacles)) {
  723.             $biographies_dates_demains $schedules->getDateBySpectaclesDemain($ids_spectacles3null'old', ['idcontact' => $this->idobject]);
  724.             $biographies_dates_demains_reconstruction = array();
  725.             foreach ($biographies_dates_demains as $k => $v) {
  726.                 $date_month $schedules->getFormeDate($k"%B %Y"true);
  727.                 $date_month_hastag $schedules->getFormeDate($k"%B_%Y"true);
  728.                 $biographies_dates_demains_reconstruction[$date_month_hastag]['datas'][$k] = $v;
  729.                 foreach ($biographies_dates_demains_reconstruction[$date_month_hastag]['datas'][$k]['datas'] as $idata => $data) {
  730.                     $biographies_dates_demains_reconstruction[$date_month_hastag]['datas'][$k]['datas'][$idata]['spectacle'] = $this->em->getRepository(Spectacles::class)->getInfosSpectacle($data['idspectacle'], ['get_vignette' => true]);
  731.                 }
  732.             }
  733.             $this->context['view']->asides_prochaines_representations $biographies_dates_demains_reconstruction;
  734.         }
  735.         // $t = "text";
  736.         // $params_sql_aidecontact = array(
  737.         //     'special' => array(
  738.         //         'object' => $t,
  739.         //         'aides' => array(
  740.         //             //'idcontacts' => $this->idobject,
  741.         //             'no_empty' => true,
  742.         //             'type_aides' => array(3),
  743.         //         ),
  744.         //     ),
  745.         //     'limit' => array(0,100),
  746.         //     'dbg' => array('list_aidecontacts_'.$t,'Liste des catégories d\'aide pour '.$t),
  747.         // );
  748.         // $aidecontacts = Theatre::factory('aidecontacts');
  749.         // $this->context['view']->list_aidecontacts = $aidecontacts->getListAidecontacts($params_sql_aidecontact);
  750.         // print_r($this->context['view']->list_aidecontacts);
  751.         //derniers lauréats
  752.         $this->getContactAides(array(2), array('vignette_video' => false'limit' => array(02), 'no_year_array' => true));
  753.         if (!empty($this->view->list_aides_text)) {
  754.             $this->view->list_derniers_laureats $this->view->list_aides_text;
  755. //             unset($this->view->list_aides_text);
  756. //
  757. //             foreach($list_aides_text AS $idcontent => $value){
  758. //                 $this->context['view']->list_aides_text[$idcontent] = $value;
  759. //             }
  760.         }
  761.         //Spectacles soutenus par "nom de l'école" à l'affiche
  762.         $params_sql = array(
  763.             'params' => array(
  764.                 'where' => ' s.publish=1 ',
  765.                 'limit' => array(04),
  766.                 'order' => ['sad.dateStart''DESC']
  767.             ),
  768.             'special' => array(
  769. //                'plus_proche' => true,
  770.                 // avec une aides
  771.                 'spectacle_aide' => true,
  772.                 'aide' => array(
  773.                     'idcontact' => $this->idobject,
  774.                     'type_aide' => [1//Les spectacles sélectionnés
  775.                 )
  776.             ),
  777.             'dbg' => array('aide''Les spectacles avec une aide du contact'),
  778.         );
  779.         unset($params_sql['special']['prochains']);
  780.         unset($params_sql['special']['plus_proche']);
  781.         $spectacles_soutenus_ecoles $this->em->getRepository(Spectacles::class)->getListSpectacles($params_sql, ['display' => ['affiche_date_creation' => true]], false, ['allauthors' => true]);
  782.         foreach ($spectacles_soutenus_ecoles as $ks => $value_spectacle) {
  783.             $spectacles_soutenus_ecoles[$ks]['annee_creation'] = $this->em->getRepository(Spectacles::class)->getFormeDate($spectacles_soutenus_ecoles[$ks]['creation_date'], '%Y'true); //%a %d/%m/%Y;
  784.             unset($spectacles_soutenus_ecoles[$ks]['contact_creation']);
  785.         }
  786.         $this->view->list_spectacles_sountenu_par_ecole $spectacles_soutenus_ecoles;
  787.         unset($params_sql['params']['order']);
  788.         $params_sql['special']['plus_proche'] = true;
  789.         $params_sql['special']['prochains'] = true;
  790.         $this->view->list_spectacles_sountenu_prochains $this->em->getRepository(Spectacles::class)->getListSpectacles($params_sqlnullfalse, ['allauthors' => true'carrer_couleurs' => true]);
  791.         foreach ($this->view->list_spectacles_sountenu_prochains as $ks => $v) {
  792.             $this->view->list_spectacles_sountenu_prochains[$ks]['footer_contact'] = true;
  793.         }
  794.         //Les spectacles soutenus
  795.         $params_sql['params']['order'] = ['sad.dateStart''DESC'];
  796.         unset($params_sql['special']['prochains']);
  797.         unset($params_sql['special']['plus_proche']);
  798.         $params_sql['special']['aide']['type_aide'] = [4];
  799.         $spectacles_selectionnes_ecoles $this->em->getRepository(Spectacles::class)->getListSpectacles($params_sql, ['display' => ['affiche_date_creation' => true]], false, ['allauthors' => true'carrer_couleurs' => true]);
  800.         foreach ($spectacles_selectionnes_ecoles as $ks => $value_spectacle) {
  801.             $spectacles_selectionnes_ecoles[$ks]['annee_creation'] = $this->em->getRepository(Spectacles::class)->getFormeDate($spectacles_selectionnes_ecoles[$ks]['creation_date'], '%Y'true); //%a %d/%m/%Y;
  802.             unset($spectacles_selectionnes_ecoles[$ks]['contact_creation']);
  803.         }
  804.         $this->view->list_spectacles_selectionnes_par_ecole $spectacles_selectionnes_ecoles;
  805.         unset($params_sql['params']['order']);
  806.         $params_sql['special']['plus_proche'] = true;
  807.         $params_sql['special']['prochains'] = true;
  808.         $this->view->list_spectacles_selectionne_prochains $this->em->getRepository(Spectacles::class)->getListSpectacles($params_sqlnullfalse, ['allauthors' => true'carrer_couleurs' => true]);
  809.         foreach ($this->view->list_spectacles_selectionne_prochains as $ks => $v) {
  810.             $this->view->list_spectacles_selectionne_prochains[$ks]['footer_contact'] = true;
  811.         }
  812.         $this->getContactAides(array(23), ['limit' => [02], 'no_year_array' => true]);
  813.         if (!empty($this->context['view']->list_aides_text)) {
  814.             $this->context['view']->textes_nommes $this->context['view']->list_aides_text;
  815.             $this->context['view']->list_aides_text null;
  816.         }
  817. //        if(!$this->context['view']->is_prix){
  818.         $this->getContactAides(array(4), ['limit' => [02], 'no_year_array' => true]);
  819.         if (!empty($this->context['view']->list_aides_text)) {
  820.             $this->context['view']->textes_selectionnes $this->context['view']->list_aides_text;
  821.             $this->context['view']->list_aides_text null;
  822.         }
  823.         $this->getContactAides(array(1), ['limit' => [02], 'no_year_array' => true]);
  824.         if (!empty($this->context['view']->list_aides_text)) {
  825.             $this->context['view']->textes_soutenus $this->context['view']->list_aides_text;
  826.             $this->context['view']->list_aides_text null;
  827.         }
  828.         $spectacles $this->em->getRepository(Spectacles::class);
  829.         if (in_array($this->idobject, [5955222])) {
  830.             //Les spectacles à l'affiche avec podcasts audio France Culture
  831.             $params_sql = array(
  832.                 'special' => array(
  833.                     'textfictif' => 0,
  834.                     'prochains' => true,
  835.                     'podcasts' => [
  836.                         'type_podcast' => 'franceculture'
  837.                     ]
  838.                 ),
  839.                 'params' => [
  840.                     'limit' => [04]
  841.                 ],
  842.                 'dbg' => array('list_textes_affiche''Liste des spectacles avec textes non fictifs qui ont un podcast'),
  843.             );
  844.             $params_sql['special']['type_franceinter'] = null;
  845.             if ($this->idobject == 5222) {
  846.                 $params_sql['special']['type_franceinter'] = 1;
  847.             }
  848.             //Les derniers spectacles en lien avec France Radio
  849.             $this->context['view']->spectacles_podcasts $spectacles->getListSpectacles($params_sqlnullfalse, ['carrer_couleurs' => true]);
  850.         } else {
  851.             //Les spectacles à l'affiche avec podcasts audio France Culture
  852.             $params_sql = array(
  853.                 'special' => array(
  854.                     'textfictif' => 0,
  855.                     'prochains' => true,
  856.                     'podcasts' => [
  857.                         'type_podcast' => 'franceculture',
  858.                     ],
  859.                     'idcontact' => $this->idobject,
  860.                 ),
  861.                 'params' => [
  862.                     'where' => ' AND s.publish=1 AND ' $this->getWhereIdcontact(),
  863.                     'limit' => [02]
  864.                 ],
  865.                 'dbg' => array('list_textes_affiche''Liste des spectacles avec textes non fictifs qui ont un podcast'),
  866.             );
  867.             //Les derniers spectacles en lien avec France Radio
  868.             $this->context['view']->spectacles_emission $spectacles->getListSpectacles($params_sqlnullfalse, ['carrer_couleurs' => true]);
  869.         }
  870.         //Les anciens étudiants à l'affiche
  871.         $list_idpersons $this->em->getRepository(PersonEcole::class)->getPersons($this->idobject, array('get_ids' => true));
  872.         if (!empty($list_idpersons)) {
  873.             $where_idperson 'sp.`idperson` IN (' join(','$list_idpersons) . ') ';
  874.             $params_sql = array(
  875.                 'params' => array(
  876.                     'where' => ' AND (' $where_idperson ') ',
  877.                     'limit' => array(04),
  878.                 ),
  879.                 'special' => array(
  880.                     'prochains' => true,
  881.                     // les élèves du contact
  882.                     'get_eleves' => array(
  883.                         'idcontact' => $this->idobject,
  884.                     ),
  885.                 ),
  886.                 'dbg' => array('scenes''Les spectacles à l\'affiche'),
  887.             );
  888.             //On récupère la listes
  889.             $this->context['view']->spectacles_anciens_etudiants_affiches $spectacles->getListSpectacles($params_sqlnullfalse, ['allauthors' => true]);
  890.         }
  891.         $this->context['view']->show_prix false;
  892.         //Aside spécifique à théâtre en acte
  893.         if ($this->infosobject['idcontact'] == 28366) {
  894.             $this->asides->load('educ_canope_enacte');
  895.             $this->asides->load('educ_lettre_info');
  896.         }
  897.         $this->asides->load('contact_adresse');
  898.         $this->asides->load('contact_calendrier');
  899.         $this->asides->load('contact_telecharge_pdf');
  900.         //Uniquement pour les contacts écoles
  901.         if ($this->infosobject['idtypestructure'] == 'EC') {
  902.             $this->asides->load('ecoles_generic');
  903.         }
  904.         $this->asides->load('common_prochain_evenement');
  905.         $this->asides->load(['common_culturebox' => [
  906.             'footer_custom' => true
  907.         ]]);
  908. //        $this->asides->load('contact_franceculture');
  909.         // $this->asides->load('contact_maj');
  910.         $this->asides->load('common_carrer_informations');
  911.         $this->asides->load('common_participer_contacts');
  912.         if (!empty($this->infosobject['facebook'])) {
  913.             $this->asides->load(['common_facebook' => array(
  914.                 'url_custom' => $this->infosobject['facebook']
  915.             )]);
  916.         }
  917.         if (!empty($this->infosobject['twitter'])) {
  918.             $this->asides->load(['common_twitter' => array(
  919.                 'url_custom' => $this->infosobject['twitter']
  920.             )]);
  921.         }
  922.         return $this->view('contacts/detail-contact.html.twig');
  923.     }
  924.     // }}}
  925.     // {{{ action_actualites()
  926.     /** Actualites du contact (première page)
  927.      *
  928.      */
  929.     public function action_actualites(Request $request)
  930.     {
  931.         // indique que l'on est sur la page d'acceuil
  932.         $this->view->is_accueil true;
  933.         $aides $this->em->getRepository(Aides::class);
  934.         $multimedias $this->em->getRepository(Multimedias::class);
  935.         $spectacles $this->em->getRepository(Spectacles::class);
  936.         $params_display_text = array(
  937.             'vignette_format' => array('width' => $_ENV['VIGN_TEXT_WIDTH'], 'height' => $_ENV['VIGN_TEXT_HEIGHT'], 'direction' => 'thumb'),
  938.             'hide_publishing_date' => true,
  939.         );
  940.         $limit_spectacle_a_laffiche 6;
  941.         $limit_critiques_accueil 4;
  942.         $limit_en_tournee_spectacles 4;
  943.         $limit_derniers_programmes 4;
  944.         $this->context['view']->is_aides true;
  945.         // les textes lauréats et nominés à l'affiche
  946.         $params_sql_spectacle_text_aide = array(
  947.             'special' => array(
  948.                 'prochains' => 180,
  949.                 'aide' => array(
  950.                     'idcontact' => $this->idobject,
  951.                     'type_aide' => array(23), // lauréats et nominés
  952.                 ),
  953.                 'text_aide' => true,
  954.             ),
  955.             'params' => array(
  956.                 'limit' => array(05),
  957.             ),
  958.             'dbg' => array('text_aide_spectacle_laureats_nominations''Les textes lauréats ou nominés'),
  959.         );
  960.         // quand on demande le texte, demander également l'aide pour le contact
  961.         $params_sql_text_aides = array(
  962.             'get_aides' => array(
  963.                 'special' => array(
  964.                     'aides' => array(
  965.                         'idcontacts' => array($this->idobject),
  966.                     )
  967.                 ),
  968.             )
  969.         );
  970.         /*
  971.          * Textes
  972.          * LAURÉATS OU NOMINÉS À L'AFFICHE
  973.          *
  974.         */
  975.         $params_sql_spectacle_text_aide['spectacle']['aide']['type_aide'] = array(2);
  976.         $params_sql_spectacle_text_aide['params']['limit'] = array(02);
  977.         $this->context['view']->aides_texts_laureats_alone_affiche $this->em->getRepository(Texts::class)->getTextsFromSpectacles(
  978.             $this->em->getRepository(Spectacles::class)->getListSpectacles($params_sql_spectacle_text_aide, array(), false, array('allauthors' => true'carrer_couleurs' => true)), // texts à l'affiche avec une aide de ce contact
  979.             $params_sql_text_aides// quelles aides ?
  980.             $params_display_text // affichage texte
  981.         );
  982.         /*
  983.          * Textes
  984.          * soutenus à l'affiche
  985.          *
  986.         */
  987.         unset($params_sql_spectacle_text_aide['spectacle']);
  988.         $params_sql_spectacle_text_aide['special']['aide']['type_aide'] = array(1); //soutenu
  989.         $params_sql_spectacle_text_aide['special']['aide']['dbg'] = array('text_aide_spectacle_soutiens''Les textes avec un soutien/aide');
  990.         $params_sql_spectacle_text_aide['params']['limit'] = array(04);
  991.         $this->context['view']->aides_texts_soutiens_affiche $this->em->getRepository(Texts::class)->getTextsFromSpectacles(
  992.             $this->em->getRepository(Spectacles::class)->getListSpectacles($params_sql_spectacle_text_aide, array(), false, ['carrer_couleurs' => true]), // texts à l'affiche avec une aide de ce contact
  993.             $params_sql_text_aides// quelles aides ?
  994.             $params_display_text // affichage texte
  995.         );
  996.         /*
  997.          * Textes
  998.          * sélectionnés à l'affiche
  999.         */
  1000.         $params_sql_spectacle_text_aide['special']['aide']['type_aide'] = array(4); //sélectionné
  1001.         $params_sql_spectacle_text_aide['special']['aide']['dbg'] = array('text_aide_spectacle_selections''Les textes avec un selections/aide');
  1002.         $params_sql_spectacle_text_aide['params']['limit'] = array(04);
  1003.         $this->context['view']->textes_selections_affiches $this->em->getRepository(Texts::class)->getTextsFromSpectacles(
  1004.             $this->em->getRepository(Spectacles::class)->getListSpectacles($params_sql_spectacle_text_aide, array(), false, ['carrer_couleurs' => true]), // texts à l'affiche avec une aide de ce contact
  1005.             $params_sql_text_aides// quelles aides ?
  1006.             $params_display_text // affichage texte
  1007.         );
  1008.         /*
  1009.          * @spectacles
  1010.          * lauréats ou nominés à l'affiche
  1011.         */
  1012.         $params_sql_spectacle_aide = array(
  1013.             'special' => array(
  1014.                 'prochains' => 180,
  1015.                 'aide' => array(
  1016.                     'idcontact' => $this->idobject,
  1017.                     'type_aide' => array(23), // lauréats ou nominés
  1018.                 ),
  1019.                 'spectacle_aide' => true,
  1020.             ),
  1021.             'dbg' => array('aides_spectacles_laureats_affiche''Les spectacles avec laureats à l\'affiche'),
  1022.         );
  1023.         $this->context['view']->aides_spectacles_laureats_affiche $this->em->getRepository(Spectacles::class)->getListSpectacles($params_sql_spectacle_aide$this->format_vignettefalse, array('allauthors' => true'carrer_couleurs' => true));
  1024.         // les spectacles lauréats ou nominés à l'affiche
  1025. //        $this->getContactAides(2, ['limit' => [0, 2]]);
  1026.         /*
  1027.          * Programme de saison
  1028.         */
  1029.         $this->context['view']->booklets $this->em->getRepository(Files::class)->getBookletsCurrent($this->idobjecttrue);
  1030.         /*
  1031.          * Les évènements
  1032.         */
  1033.         $news $this->em->getRepository(News::class);
  1034.         $news_params = array(
  1035.             'params' => array(
  1036.                 'limit' => array(05),
  1037.             ),
  1038.             'special' => array(
  1039.                 'publish_valid' => true,
  1040.                 'no_schedule_contact' => true,
  1041.                 'by_object' => array('idcontact' => $this->idobject),
  1042.             ),
  1043.         );
  1044.         // trouver 7 prochains évènements
  1045.         // si pas de 7 prochains, trouver 7 anciens
  1046.         foreach (array('news') as $t) {
  1047.             $news_list = array();
  1048.             $count_total 0;
  1049.             $news_params['special']['type_news'] = $t;
  1050.             foreach (array('prochains''anciens') as $d) {
  1051.                 $news_params['dbg'] = array('news_' $d'Liste des news ' $d);
  1052.                 $news_params['special'][$d] = true;
  1053.                 if (!empty($exclude_news)) {
  1054.                     $news_params['params']['where'] = ' AND T1.idnew NOT IN (' join(','$exclude_news) . ') ';
  1055.                 }
  1056.                 $news_params['params']['limit'] = array(0$count_total);
  1057.                 $news_list[$d] = $news->getListNews($news_params);
  1058.                 if (!empty($news_list[$d])) {
  1059.                     $count_total $total_prochains_evements count($news_list[$d]);;
  1060.                     // liste d'exclusion => pas de en cours dans les anciens
  1061.                     foreach ($news_list[$d] as $k => $v) {
  1062.                         $exclude_news[$k] = $v['idnew'];
  1063.                     }
  1064.                     $this->view->{'is_news_list_' $t} = true;
  1065.                 }
  1066.                 unset($news_params['special'][$d]);
  1067.             }
  1068.             $this->view->{'news_list_' $t} = $news_list;
  1069.         }
  1070.         $exclude null;
  1071.         $exclude_tab = array();
  1072.         /*
  1073.          * Les critiques
  1074.         */
  1075.         // trouver les contenus associés 101 et les classer par date
  1076.         $params_sql = array(
  1077.             'special' => array(
  1078.                 'get_critiques_idcontact' => $this->idobject,
  1079.                 'get_extranetuser' => true// on veut l'utilisateur
  1080.                 'publish' => 1// les critiques publiées
  1081.             ),
  1082.             'sql' => array(
  1083.                 'limit' => array(0$limit_critiques_accueil),
  1084.                 'order' => ' ct.`date_article` DESC'// classement
  1085.             ),
  1086.             'dbg' => array('critiques''Liste des critiques'),
  1087.         );
  1088.         $cacheItem $this->cache->getItem("contact_actualites_get_critiques_{$this->idobject}");
  1089.         if (! $cacheItem->isHit()) {
  1090.             $result $this->em->getRepository(Contents::class)->getListContents($params_sql, array('get_critiques' => true));
  1091.             $cacheItem->set($result)
  1092.                 ->expiresAt((new \DateTime('now'))->add(\DateInterval::createFromDateString('7 hours')));
  1093.             $this->cache->save($cacheItem);
  1094.         }
  1095.         $this->context['view']->dernieres_critiques $cacheItem->get();
  1096.         // un objet spectacles
  1097.         $spectacles $this->em->getRepository(Spectacles::class);
  1098.         // recherche sur le contact
  1099.         $where_idcontact ' AND ' $this->getWhereIdcontact();
  1100.         /*
  1101.          * Spectacles
  1102.          * Prochains spectacles
  1103.          * réalisés avec le soutien de contact
  1104.          *
  1105.         */
  1106.         $params_sql_affiche = array(
  1107.             'params' => array(
  1108.                 'where' => $where_idcontact ' AND s.publish=1 ',
  1109.                 'limit' => array(0$limit_spectacle_a_laffiche),
  1110.             ),
  1111.             'special' => array(
  1112.                 'prochains' => 500,
  1113.                 'idcontact' => $this->idobject,
  1114.             ),
  1115.             'dbg' => array('spectacles_affiche''Les prochains spectacles à l\'affiche'),
  1116.         );
  1117.         // cas festival
  1118.         if (!empty($this->infosobject['is_festival'])) {
  1119.             $params_sql_affiche['special']['type_contact'] = 'idcontactFestival';
  1120.         }
  1121.         // spectacles de ce contact à l'affiche en ce moment (180 jours) => recherche sur le calendrier
  1122.         $spectacles_affiche $spectacles->getListSpectacles($params_sql_affiche$this->format_vignettefalse, array('allauthors' => true'carrer_couleurs' => true));
  1123.         foreach ($spectacles_affiche as $k => $v) {
  1124.             $spectacles_affiche[$k]['no_date'] = true;
  1125.             if (!empty($v['city'])) {
  1126.                 unset($spectacles_affiche[$k]['city']);
  1127.             }
  1128.             if (!empty($v['periode']['city'])) {
  1129.                 unset($spectacles_affiche[$k]['periode']['city']);
  1130.             }
  1131.         }
  1132.         //$spectacles->getSQLSpectacles($params_sql_affiche['params'],$params_sql_affiche['special'],false);
  1133.         $this->view->spectacles_affiche $spectacles_affiche;
  1134.         // a exclure à la fin
  1135.         if (!empty($spectacles_affiche)) {
  1136.             $exclude_tab $this->func->getExclude($spectacles_affiche);
  1137.         }
  1138.         if (!empty($exclude_tab)) {
  1139.             $exclude ' NOT IN (' implode(','$exclude_tab) . ')';
  1140.         } else {
  1141.             $exclude null;
  1142.         }
  1143.         /*
  1144.          * #Productteur (17), coprod (18), prod délégué (19). Recherche sur spectacle_contact+idrole
  1145.          * En scène
  1146.          * Prochains spectacles
  1147.          * réalisés avec le soutien de contact
  1148.          *
  1149.          * prochains spectacles coproduit PAR ce lieu mais pas dans ce lieu puisque en tournée
  1150.          *
  1151.         */
  1152.         // TODO à réintégrer pour la release
  1153.         $params_sql_and_exclude '';
  1154.         if (!is_null($exclude)) {
  1155.             $params_sql_and_exclude .= ' AND s.idspectacle ' $exclude;
  1156.         }
  1157.         $params_sql_prod = array(
  1158.             'params' => array(
  1159.                 'from' => ['SpectacleContact sc_relation' => 'sc_relation.idspectacle=s.idspectacle'],
  1160.                 'where' => ' AND s.publish=1 AND sc_relation.idrole IN (17,18,19) AND sc_relation.idcontact=' $this->idobject $params_sql_and_exclude,
  1161.                 'groupby' => 's.idspectacle',
  1162.                 'select' => 'contacts.idcontact as datecontact',
  1163.                 'limit' => array(0$limit_en_tournee_spectacles),
  1164.             ),
  1165.             'special' => array(
  1166.                 'prochains' => 500,
  1167.                 // exclure les spectacles qui sont dans le lieu
  1168.                 'from_schedules' => 'SELECT idcontact,idspectacle,date FROM schedules WHERE idcontact!=' $this->idobject ' AND date>=\'' date('Y-m-d') . '\' ',
  1169.             ),
  1170.             'dbg' => array('spectacles_prod''Les spectacles coproduits')
  1171.         );
  1172.         $spectacles_prod $this->view->spectacles_prod $spectacles->getListSpectacles($params_sql_prod$this->format_vignettefalse, array('allauthors' => true'carrer_couleurs' => true));
  1173.         $exclude_prod_tab $this->func->getExclude($spectacles_prod);
  1174.         // TODO FIN DU --
  1175.         // liste d'exclusion
  1176.         if (!empty($exclude_prod_tab)) {
  1177.             $exclude_prod ' NOT IN (' implode(','$exclude_prod_tab) . ')';
  1178.         } else {
  1179.             $exclude_prod null;
  1180.         }
  1181.         // suite exclusion
  1182.         if (!empty($spectacles_prod)) {
  1183.             $exclude_tab array_merge($exclude_prod_tab$exclude_tab);
  1184.         }
  1185.         if (!empty($exclude_tab)) {
  1186.             $exclude ' NOT IN (' implode(','$exclude_tab) . ')';
  1187.         } else {
  1188.             $exclude null;
  1189.         }
  1190.         /*
  1191.          * #derniers spectacles (exclusion de à l'affiche) => recherche sur le calendrier
  1192.          * Spectacles
  1193.          * Derniers spectacles programmés
  1194.          *
  1195.         */
  1196.         $params_sql_derniers = array(
  1197.             'params' => array(
  1198.                 'limit' => array(0$limit_derniers_programmes),
  1199.                 'where' => $where_idcontact ' AND s.publish=1 '//AND s.idspectacle '.$exclude,
  1200.                 'select' => 'contacts.idcontact as datecontact',
  1201.             ),
  1202.             'special' => array(
  1203.                 'anciens_stricts' => true,
  1204.                 'count_in_spectacle_anciens' => true,
  1205.                 // 'idcontact' => $this->idobject,
  1206.             )
  1207.         );
  1208.         $spectacles_derniers $spectacles->getListSpectacles($params_sql_derniers$this->format_vignettefalse, array('allauthors' => true'carrer_couleurs' => true));
  1209.         $this->view->spectacles_derniers $spectacles_derniers;
  1210.         // suite exclusion
  1211.         if (!empty($spectacles_derniers)) {
  1212.             $exclude_tab array_merge($this->func->getExclude($this->view->spectacles_derniers), $exclude_tab);
  1213.         }
  1214.         // nb de spectacle
  1215.         $nb_spectacles count($spectacles_derniers) + count($spectacles_affiche);
  1216.         $this->view->nb_spectacles $nb_spectacles;
  1217.         // derniers spectacles coproduits
  1218.         $where_sql_prod_derniers ' AND s.publish=1 
  1219.                                     AND (sc_relation.idrole IN (17,18,19) AND sc_relation.idcontact=' $this->idobject ')';
  1220.         if (!is_null($exclude_prod)) {
  1221.             $where_sql_prod_derniers .= ' AND s.idspectacle ' $exclude_prod;
  1222.         }
  1223.         $params_sql_prod_derniers = array(
  1224.             'params' => array(
  1225.                 'from' => ['SpectacleContact sc_relation' => 'sc_relation.idspectacle=s.idspectacle'],
  1226.                 'where' => $where_sql_prod_derniers,
  1227.                 'limit' => array(0$limit_en_tournee_spectacles),
  1228.                 'select' => 'contacts.idcontact as datecontact',
  1229.             ),
  1230.             'special' => array(
  1231.                 'anciens' => 'all',
  1232.             ),
  1233.             'dbg' => array('spectacles_prod_derniers''Les derniers spectacles coproduits')
  1234.         );
  1235.         $spectacles_prod_derniers $spectacles->getListSpectacles($params_sql_prod_derniers$this->format_vignettefalse, array('allauthors' => true'carrer_couleurs' => true));
  1236.         $this->view->spectacles_prod_derniers $spectacles_prod_derniers;
  1237.         $nb_spectacles_prod count($spectacles_prod);
  1238.         $this->view->nb_spectacles_prod $nb_spectacles_prod;
  1239.         // derniers spectacles coproduits
  1240.         $where_sql_par_role_diffuseurs ' AND s.publish=1 AND (sc_relation.idrole IN (77) AND sc_relation.idcontact=' $this->idobject ')';
  1241.         $params_sql_par_role_diffuseurs = array(
  1242.             'params' => array(
  1243.                 'from' => ['SpectacleContact sc_relation' => 'sc_relation.idspectacle=s.idspectacle'],
  1244.                 'where' => $where_sql_par_role_diffuseurs,
  1245.                 'limit' => array(0$limit_en_tournee_spectacles),
  1246.                 'select' => 'contacts.idcontact as datecontact',
  1247.             ),
  1248.             'special' => array(
  1249.                 'anciens' => 'all',
  1250.             ),
  1251.             'dbg' => array('spectacles_par_role_diffuseurs''Les derniers spectacles coproduits')
  1252.         );
  1253.         $spectacles_par_role_diffuseurs $spectacles->getListSpectacles($params_sql_par_role_diffuseurs$this->format_vignettefalse, array('allauthors' => true'carrer_couleurs' => true));
  1254.         $this->view->spectacles_par_role_diffuseurs $spectacles_par_role_diffuseurs;
  1255.         // nombre total de spectacles/videos/coprod
  1256.         $nb_total $nb_spectacles $nb_spectacles_prod;
  1257.         $this->view->nb_total $nb_total;
  1258.         // suite exclusion
  1259.         if (!empty($spectacles_prod_derniers)) {
  1260.             $exclude_tab array_merge($this->func->getExclude($spectacles_prod_derniers), $exclude_tab);
  1261.         }
  1262.         //$this->view->debug_view = $spectacles->getDebugView(true);
  1263.         // liste d'exclusion
  1264.         $excluded '';
  1265.         if (!empty($exclude_tab)) {
  1266.             $exclude_final ' AND s.idspectacle NOT IN (' implode(','$exclude_tab) . ')';
  1267.             $excluded 'excluded_' implode('-'$exclude_tab);
  1268.         } else {
  1269.             $exclude_final null;
  1270.         }
  1271.         $cacheItem $this->cache->getItem("contact_actualites_count_nb_autres_{$this->idobject}_$excluded");
  1272.         if (! $cacheItem->isHit()) {
  1273.             $sql_count_autres 'SELECT COUNT(DISTINCT(sct.idspectacle))
  1274.                              FROM spectacles s
  1275.                              INNER JOIN spectacle_contact sct ON sct.idspectacle = s.idspectacle
  1276.                              INNER JOIN schedules sc ON sc.idspectacle = s.idspectacle
  1277.                              WHERE (
  1278.                                 (sct.idrole IN (17,18,19) AND sct.idcontact=' $this->idobject ')
  1279.                                 OR (sc.idcontact=' $this->idobject ')
  1280.                              ) ' $exclude_final;
  1281.             // nb
  1282.             $nb_autres $spectacles->queryOne($sql_count_autres);
  1283.             $cacheItem->set($nb_autres)
  1284.                 ->expiresAt((new \DateTime('now'))->add(\DateInterval::createFromDateString('7 hours')));
  1285.             $this->cache->save($cacheItem);
  1286.         }
  1287.         $this->view->nb_autres $cacheItem->get();
  1288.         // voir si il y a d'autres spectacles
  1289.         if (!empty($this->infosobject['idmultimedia'])) {
  1290.             $params = array(
  1291.                 'idmultimedia' => $this->infosobject['idmultimedia']
  1292.             );
  1293.             $this->view->video_tete $multimedias->getInfosVideoTete($paramsfalse, array('width' => '415''height' => '345'));
  1294.         }
  1295.         if (!empty($this->view->video_tete)) {
  1296.             // voir s'il y a une vidéo à l'affiche, sinon, dernière vidéo à l'affiche
  1297.             $params_sql_videos = array(
  1298.                 'params' => array(
  1299.                     'limit' => array(01),
  1300.                     'where' => $where_idcontact ' AND s.publish=1 ',
  1301.                     'select' => 'contacts.idcontact as datecontact',
  1302.                     'groupby' => ' om.idmultimedia ',
  1303.                 ),
  1304.                 'special' => array(
  1305.                     'multimedias_videos_associes' => 'all'//multimedias_videos_associes
  1306.                     'prochains' => true,
  1307.                     //'tri_plus_proches' => true, // NE FONCTIONNE PAS
  1308.                 ),
  1309.                 'dbg' => array('videos_recentes''Lesvidéos récentes')
  1310.             );
  1311.             $videos_contact $spectacles->getListSpectacles($params_sql_videos$this->format_vignettefalse, array('allauthors' => true'carrer_couleurs' => true));
  1312.             // voir s'il y a une vidéo à l'affiche, sinon, dernière vidéo à l'affiche
  1313.             if (empty($videos_contact)) {
  1314.                 unset($params_sql_videos['special']['prochains']);
  1315.                 $params_sql_videos['special']['anciens'] = true;
  1316.                 $videos_contact $spectacles->getListSpectacles($params_sql_videos$this->format_vignettefalse, array('allauthors' => true'carrer_couleurs' => true));
  1317.             }
  1318.             foreach ($videos_contact as $v) {
  1319.                 $this->view->video_tete $multimedias->getInfosVideoTete($vfalse, array('width' => '415''height' => '345'));
  1320.                 break;
  1321.             }
  1322.             if (isset($this->view->video_tete['media'][0])) {
  1323.                 $request->getSession()->set('currentVideo'md5($this->view->video_tete['media'][0]['idmultimedia']));
  1324.             }
  1325.         }
  1326.         // TODO FIN DU --
  1327.         //Les vidéos en partenartiat
  1328.         $params_query_commun = array(
  1329.             'object' => array($this->idobject => ['contacts']),
  1330.             'where' => array(array('multimedias''audio_video'2)),
  1331.             'order' => array('multimedias.date'),
  1332.             'limit' => array(04),
  1333.             'dbg' => array('last_listes''Vidéo en partenariat du contact - liste des multimedias'),
  1334.         );
  1335.         $params_videos = array(
  1336.             'alldata' => true,
  1337.             'display' => array(
  1338.                 'no_footer' => true,
  1339.                 'videos_169_format' => true
  1340.             )
  1341.         );
  1342.         $this->view->videos_last_publish $this->em->getRepository(Multimedias::class)->getListMultimedias($params_query_commun, array(), $params_videos);
  1343.         // Podcast franceculture culturebox => les derniers référencés
  1344.         $podcasts $this->em->getRepository(Podcasts::class);
  1345.         if (in_array($this->idobject, [5955222])) {
  1346.             $franceculture_params = array(
  1347.                 'limit' => array(03),
  1348.                 'special' => array(
  1349.                     'type_podcast' => 'franceculture',
  1350.                     'type_franceinter' => null
  1351.                 ),
  1352.                 'dbg' => array('derniers_franceculture''Les trois derniers podcasts france radio référencés'),
  1353.             );
  1354.             if ($this->idobject == 5222) {
  1355.                 $franceculture_params['special']['type_franceinter'] = 1;
  1356.             }
  1357.             $api_derniers_franceculture $podcasts->getListPodcasts($franceculture_params);
  1358.             foreach ($api_derniers_franceculture as $k => $v) {
  1359.                 $currentDate $v['datePodcast']->format('Y-m-d h:i');
  1360.                 if (empty($derniers_franceculture[$currentDate])) {
  1361.                     $derniers_franceculture[$currentDate]['date'] = $podcasts->getFormeDate($currentDate'%a %d %B %Y'true); //%a %d/%m/%Y
  1362.                 }
  1363.                 $derniers_franceculture[$currentDate]['datas'][] = $v;
  1364.             }
  1365.             $this->context['view']->podcasts_par_date $derniers_franceculture;
  1366.         } else {
  1367.             // franceculture
  1368.             $franceculture_params = array(
  1369.                 'limit' => array(07),
  1370.                 'special' => array(
  1371.                     'idcontacts' => array('idcontact' => $this->idobject),
  1372.                     'type_podcast' => 'franceculture',
  1373.                 ),
  1374.                 'dbg' => array('derniers_franceculture''Les derniers podcasts franceculture référencés pour le contact'),
  1375.             );
  1376.             $this->context['view']->derniers_franceculture $podcasts->getListPodcasts($franceculture_params);
  1377.         }
  1378.         // Culturebox => les derniers référencés
  1379.         $culturebox_params = array(
  1380.             'limit' => array(01),
  1381.             'special' => array(
  1382.                 'idcontacts' => array('idcontact' => $this->idobject),
  1383.                 'type_podcast' => 'culturebox',
  1384.             ),
  1385.             'dbg' => array('derniers_culturebox''Les derniers replay culturebox référencés'),
  1386.         );
  1387.         $format_vignette = array('width' => 480'direction' => 'thumb');
  1388.         $this->context['view']->derniers_culturebox $podcasts->getListPodcasts($culturebox_params$format_vignette);
  1389.         //Prochains spectacles avec vidéos à l'affiche
  1390.         $params_sql = array(
  1391.             'special' => array(
  1392.                 // 'plus_proche' => true,
  1393.                 'prochains' => true//prochains
  1394.                 'multimedias_videos_associes' => true //Avec vidéos
  1395.             ),
  1396.             'params' => array(
  1397.                 'limit' => array(020),
  1398.                 'where' => ' AND s.publish=1 AND ' $this->getWhereIdcontact()
  1399.             ),
  1400.             'dbg' => array('list_textes_affiche''Liste des spectacles avec textes non fictifs qui ont reçu une aide'),
  1401.         );
  1402.         $list_spectacles_videos $this->em->getRepository(Spectacles::class)->getListSpectacles($params_sql);
  1403.         $this->view->spectacles_nocity true;
  1404.         $this->view->contactsvideos true;
  1405.         $format_vignette = array('width' => $_ENV['VIGN_VIDEO_WIDTH'], 'height' => $_ENV['VIGN_VIDEO_HEIGHT'], 'fleche' => 'none''ratio' => '169');
  1406.         foreach ($list_spectacles_videos as $idspectacle => $spectacle) {
  1407. //            not working because of doctrine join table with no condition (object = spectacle)
  1408. //            $idmultimedia = $spectacle['idmultimedia'];
  1409.             $sql "SELECT DISTINCT om.idmultimedia
  1410.                 FROM object_multimedia om
  1411.                 WHERE om.idobject = $idspectacle AND object like 'spectacles'
  1412.                 LIMIT 1";
  1413.             $spectacle['idmultimedia'] = $idmultimedia $this->em->getRepository(Multimedias::class)->queryOne($sql, array(), nulltrue);
  1414.             $nb_multimedias $multimedias->getMultimediasBy('spectacles'$spectacle['idspectacle'], null'count');
  1415.             if ($nb_multimedias 0) {
  1416.                 $multimedia_listes[$idmultimedia] = $this->em->getRepository(Multimedias::class)->getInfosMultimedia($idmultimediatruefalse, array('vignette' => $format_vignette));
  1417.                 $multimedia_listes[$idmultimedia]['spectacle'] = $spectacle;
  1418.                 $multimedia_listes[$idmultimedia]['spectacle']['schedule'] = $this->em->getRepository(Spectacles::class)->getProchDateLieu(
  1419.                     array('prochains' => true),
  1420.                     $spectacle['idspectacle'],
  1421.                     $this->idobject
  1422.                 );
  1423.                 if (count($multimedia_listes) == 5) {
  1424.                     break;
  1425.                 }
  1426.             }
  1427.         }
  1428.         if (isset($multimedia_listes)) {
  1429.             if (empty($this->view->video_tete)) {
  1430.                 $multimedia_listes_array_values array_values($multimedia_listes);
  1431.                 $video_tete array_shift($multimedia_listes_array_values);
  1432.                 $this->view->video_tete $multimedias->getInfosVideoTete($video_tetefalse, array('width' => '415''height' => '345'));
  1433.                 unset($multimedia_listes[$video_tete['idmultimedia']]);
  1434.             }
  1435.             $this->view->multimedia_affiches $multimedia_listes;
  1436.         }
  1437.         //Les prochaines dates
  1438.         $schedules $this->em->getRepository(Schedules::class);
  1439.         $ids_spectacle_prod $this->obj->getSpectaclesProd($this->idobject);
  1440.         $ids_spectacle_structures_diffusions $this->obj->getSpectaclesProd($this->idobjectfalsenull77);
  1441.         $ids_spectacles array_merge($ids_spectacle_prod$ids_spectacle_structures_diffusions);
  1442.         if (!empty($ids_spectacles)) {
  1443.             $biographies_dates_demains $schedules->getDateBySpectaclesDemain($ids_spectacles3);
  1444.             foreach ($biographies_dates_demains as $k => $v) {
  1445.                 foreach ($biographies_dates_demains[$k]['datas'] as $idata => $data) {
  1446.                     $biographies_dates_demains[$k]['datas'][$idata]['spectacle'] = $this->em->getRepository(Spectacles::class)->getInfosSpectacle($data['idspectacle'], ['get_vignette' => true]);
  1447.                 }
  1448.             }
  1449.             $this->context['view']->schedules_dates_demains $biographies_dates_demains;
  1450.         }
  1451.     }
  1452.     // }}}
  1453.     // {{{ action_emissions()
  1454.     /** Podcasts de la page contact
  1455.      *
  1456.      * @Route("/contacts/{slug}/emissions", name="contact_emissions")
  1457.      * @Route("/contacts/{slug}/emissions/cat/{params_cat}", name="contact_emissions_cat")
  1458.      * @Route("/contacts/{slug}/emissions/cat/{params_cat}/type/{type}", name="contact_emissions_cat_type")
  1459.      *
  1460.      * @access public
  1461.      * @return void
  1462.      */
  1463.     public function action_emissions($slug null$params_cat 'podcasts-spectacles'$type 'in')
  1464.     {
  1465.         $this->InitController($slug'emissions');
  1466.         $this->context['params']['type'] = $type;
  1467.         $this->context['params']['cat'] = $params_cat;
  1468.         $this->action_spectacles($slugfalse, ['filtre_type' => 'audio''get_spectacles_with_audios' => true]);
  1469.         $arrays_type_podcasts = [
  1470.             'podcasts-spectacles' => 'spectacles',
  1471.             'podcasts-spectacles-tous' => 'spectacles',
  1472.             'podcasts-spectacles-anciens' => 'spectacles',
  1473.             'podcasts-spectacles-coprod' => 'spectacles',
  1474.             'podcasts-spectacles-selections' => 'spectacles',
  1475.             'podcasts-textes' => 'textes'
  1476.         ];
  1477.         $arrays_order_redirect = [
  1478.             'in' => 'podcasts-spectacles',
  1479. //            '' => 'podcasts-spectacles-tous',
  1480.             'anciens' => 'podcasts-spectacles-anciens',
  1481.             'coprod' => 'podcasts-spectacles-coprod',
  1482.             'selections' => 'podcasts-spectacles-selections',
  1483.         ];
  1484.         $cat 'podcasts-spectacles';
  1485.         if (isset($params_cat) && array_key_exists($params_cat$arrays_type_podcasts)) {
  1486.             $cat $params_cat;
  1487.         }
  1488.         $this->view->cat $cat;
  1489.         if ($this->context['view']->{'nb_spectacles_' $type '_audio'} == 0) {
  1490.             foreach ($arrays_order_redirect as $key => $value) {
  1491.                 if (isset($this->context['view']->{'nb_spectacles_' $key '_audio'}) && $this->context['view']->{'nb_spectacles_' $key '_audio'} > 0) {
  1492.                     return $this->redirectToRoute('contact_emissions_cat_type', ['slug' => $this->context['view']->url_clean'params_cat' => $value'type' => $key]);
  1493.                 }
  1494.             }
  1495.         }
  1496.         $this->context['view']->podcasts_content true;
  1497.         $this->context['view']->type_content $type_content $arrays_type_podcasts[$cat];
  1498.         $params_sql $this->setCommonSearchSpectacles(array(
  1499.             'special' => array(
  1500.                 'textfictif' => 0,
  1501.                 'prochains' => true
  1502.             ),
  1503.             'dbg' => array('list_textes_affiche''Liste des spectacles avec textes non fictifs qui ont un podcast'),
  1504.         ));
  1505.         if (!empty($this->context['params']['type']) && $this->context['params']['type'] == 'prod' && in_array($this->idobject, [5955222])) {
  1506.             unset($params_sql['special']['prochains']);
  1507.         }
  1508.         $spectacles $this->em->getRepository(Spectacles::class);
  1509.         $textes $this->em->getRepository(Texts::class);
  1510.         $display_spectacle = [];
  1511.         $format_vignette = [];
  1512.         //Spectacles
  1513.         if ($type_content == 'spectacles') {
  1514.             //Si c'est France Culture
  1515.             if (in_array($this->idobject, [5955222])) {
  1516.                 $params_sql['special']['podcasts'] = [
  1517.                     'type_podcast' => 'franceculture',
  1518.                     'publish' => 1
  1519.                 ];
  1520.                 $params_sql['special']['type_franceinter'] = null;
  1521.                 if ($this->idobject == 5222) {
  1522.                     $params_sql['special']['type_franceinter'] = 1;
  1523.                 }
  1524.                 $display_spectacle = ['carrer_couleurs' => true'allauthors' => true];
  1525.                 if ($type == 'podcasts-spectacles-tous') {
  1526.                     $format_vignette['display'] = ['affiche_date_creation' => true];
  1527.                     $params_sql['params']['order'] = 'creation_date DESC';
  1528.                 }
  1529.             } else {
  1530.                 $this->redirectedFrom 'emissions';
  1531.                 $this->action_spectacles($slugtrue, ['filtre_type' => 'audio''get_spectacles_with_audios' => true]);
  1532.             }
  1533.         } //Textes
  1534.         else {
  1535.             $params_sql['count_only_distinct'] = 't.`idtext`';
  1536.         }
  1537.         $this->context['view']->nb_spectacles_total $spectacles->countListSpectacles($params_sql);
  1538.         $params_sql['params']['limit'] = array($this->getLimitStart(), $this->perPage);
  1539.         $list_spectacles $spectacles->getListSpectacles($params_sql$format_vignettefalse$display_spectacle);
  1540.         //Les spectacles et si c'est france culture
  1541.         if ($type_content == 'spectacles' && in_array($this->idobject, [5955222])) {
  1542.             $this->context['view']->spectacles $list_spectacles;
  1543.             $this->context['view']->pagination $this->getPagination($this->context['view']->nb_spectacles_total10);
  1544.             $this->context['view']->pagination['spectacle'] = true;
  1545.             if ($type == 'podcasts-spectacles-tous' || $type == 'podcasts-spectacles') {
  1546.                 foreach ($this->context['view']->spectacles as $idspectacle => $spectacle) {
  1547.                     if (!empty($spectacle['creation_date']) && $type == 'podcasts-spectacles-tous') {
  1548.                         $this->context['view']->spectacles[$idspectacle]['annee_creation'] = $spectacles->getFormeDate($spectacle['creation_date'], '%Y'true);
  1549.                         unset($this->context['view']->spectacles[$idspectacle]['contact_creation']);
  1550.                     }
  1551.                     if ($type == 'podcasts-spectacles') {
  1552.                         $this->context['view']->spectacles[$idspectacle]['footer_contact'] = true;
  1553. //                            unset($this->context['view']->spectacles[$idspectacle]['contact_creation']);
  1554.                     }
  1555.                 }
  1556.             }
  1557.         } //Les textes
  1558.         else if ($type_content == 'textes') {
  1559.             foreach ($list_spectacles as $k => $v) {
  1560.                 if (!empty($v['idtext'])) {
  1561.                     $idtexts[$v['idtext']] = $v['idtext'];
  1562.                 }
  1563.             }
  1564.             $params_sql_texts['special'] = array(
  1565.                 'idtext' => array('IN'$idtexts),
  1566.                 'join' => true,
  1567.             );
  1568.             $params_sql_texts['special']['podcasts'] = [
  1569.                 'type_podcast' => 'franceculture'
  1570.             ];
  1571.             $vignette = array(
  1572.                 'vignette_format' =>
  1573.                     array(
  1574.                         'height' => $_ENV['VIGN_TEXT_HEIGHT'],
  1575.                         'width' => $_ENV['VIGN_TEXT_WIDTH'],
  1576.                         'direction' => 'thumb'
  1577.                     )
  1578.             );
  1579.             $this->context['view']->texts $textes->getTextsFromSpectacles($list_spectacles$params_sql_texts$vignette);
  1580.         }
  1581.         if (!empty($this->context['view']->texts) || !empty($this->context['view']->spectacles)) {
  1582.             $this->context['view']->contents true;
  1583.         }
  1584.         $this->getAsidesAudios();
  1585.         return $this->view('contacts/emissions.html.twig');
  1586.     }
  1587.     // }}}
  1588.     // {{{ action_captations()
  1589.     /** Captations de la page contact
  1590.      *
  1591.      * @Route("/contacts/{slug}/captations", name="contact_captations")
  1592.      * @Route("/contacts/{slug}/captations/filtre/{p_filtre}", name="contact_captations_p_filtre")
  1593.      * @Route("/contacts/{slug}/captations/type/{p_type}", name="contact_captations_p_type")
  1594.      *
  1595.      * @access public
  1596.      * @return void
  1597.      */
  1598.     public function action_captations($slug null$execute_corps true$p_filtre null$p_type null)
  1599.     {
  1600.         $this->context['params']['filtre'] = $p_filtre;
  1601.         $this->context['params']['type'] = $p_type;
  1602.         if (!is_null($slug) && $execute_corps) {
  1603.             $this->InitController($slug'captations');
  1604.         }
  1605.         $podcasts $this->em->getRepository(Podcasts::class);
  1606.         $format_vignette = array('width' => 480'direction' => 'thumb');
  1607.         $filtre_vod = array(
  1608.             'vod' => array(
  1609.                 'type' => 1
  1610.             ),
  1611.             'svod' => array(
  1612.                 'type' => 2
  1613.             )
  1614.         );
  1615.         $filtre_culturebox = array(
  1616.             'all' => array(
  1617.                 'name' => 'Toutes les captations en ligne',
  1618.                 'key_type' => 'all'
  1619.             ),
  1620.             'derniere-chance' => array(
  1621.                 'name' => 'Dernière chance',
  1622.                 'key_type' => 'derniere-chance'
  1623.             ),
  1624.             'captations-a-venir' => array(
  1625.                 'name' => 'Captations à venir',
  1626.                 'key_type' => 'captations-a-venir'
  1627.             )
  1628.         );
  1629.         $filtre = (!empty($this->context['params']['filtre']) && array_key_exists($this->context['params']['filtre'], $filtre_culturebox)) ? $this->context['params']['filtre'] : 'all';
  1630.         $type = (!empty($this->context['params']['type']) && array_key_exists($this->context['params']['type'], $filtre_vod)) ? $this->context['params']['type'] : null;
  1631.         $culturebox_params = array(
  1632.             'limit' => ($filtre == 'derniere-chance') ? array(04) : array(0200),
  1633.             'special' => array(
  1634.                 'type_podcast' => 'culturebox'//commun
  1635.                 'is_integrale' => true//commun
  1636.                 'idcontacts' => $this->idobject
  1637.             ),
  1638.             'dbg' => array('culturebox_data''Les replay culturebox'),
  1639.         );
  1640.         if (!is_null($type)) {
  1641.             $culturebox_params['special']['type_diffusion'] = $filtre_vod[$type]['type'];
  1642.             $this->view->subaside_action $type;
  1643.             $this->view->subaside_action_view 'type/' $type;
  1644.         }
  1645.         $culturebox_params_opts['all']['special']['current'] = true;
  1646.         //dernières en ligne
  1647.         //$culturebox_params_opts['last']['special']['current'] = true;
  1648.         //$culturebox_params_opts['last']['special']['order'] = array('podcasts' => 'debut_visionnage_ft'); //dernières
  1649.         //prochains
  1650.         $culturebox_params_opts['captations-a-venir']['special']['next'] = true;
  1651.         //last chance
  1652.         $culturebox_params_opts['derniere-chance']['special']['lastchance'] = true;
  1653.         $culturebox_params_opts['derniere-chance']['special']['current'] = true;
  1654.         foreach ($filtre_culturebox as $k => $v) {
  1655.             if (isset($culturebox_params_opts[$k])) {
  1656.                 $culturebox_params_counts array_merge_recursive($culturebox_params$culturebox_params_opts[$k]);
  1657.                 $filtre_culturebox[$k]['count'] = $podcasts->countListPodcasts($culturebox_params_counts);
  1658.             }
  1659.         }
  1660.         $this->context['view']->filtre_culturebox $filtre_culturebox;
  1661.         if (!$execute_corps) {
  1662.             return true;
  1663.         }
  1664.         if (isset($culturebox_params_opts[$filtre])) {
  1665.             if ($filtre_culturebox[$filtre]['count'] > 0) {
  1666.                 $culturebox_params array_merge_recursive($culturebox_params$culturebox_params_opts[$filtre]);
  1667.             } else /*if ($filtre !== 'all')*/ {
  1668. //                return $this->redirectToRoute('contact_captations_p_filtre', ['slug' => $this->context['view']->url_clean,  'filtre' => 'all']);
  1669.             }
  1670.         }
  1671.         $this->context['view']->list_captations $podcasts->getListPodcasts($culturebox_params$format_vignette);
  1672.         $arrays_contacts = [];
  1673.         foreach ($this->context['view']->list_captations as $value) {
  1674.             if (!empty($value['podcast_contact'])) {
  1675.                 foreach ($value['podcast_contact'] as $key => $contact) {
  1676.                     $arrays_contacts[$key] = $contact;
  1677.                 }
  1678.             }
  1679.         }
  1680.         usort($arrays_contacts, function ($a$b) {
  1681.             return strcmp($a['organisation'], $b['organisation']);
  1682.         });
  1683.         $this->view->contacts_partenaires $arrays_contacts;
  1684.         // compter le nombre totale de captations intégrales
  1685.         $this->context['view']->nb_podcasts $podcasts->countPodcasts();
  1686.         if ($filtre == 'all') {
  1687.             $this->context['view']->is_all_captation true;
  1688.         }
  1689.         if ($filtre == 'derniere-chance') {
  1690.             $this->context['view']->is_last_chance true;
  1691.         }
  1692.         if ($filtre == 'captations-a-venir') {
  1693.             $this->context['view']->is_future_captation true;
  1694.         }
  1695.         $this->getAsidesVideos(null$filtre);
  1696.         // titre de la page
  1697.         $this->view->title_page 'Captation culturebox';
  1698.         $this->rub_courante 'culturebox';
  1699.         $this->view->locate = array(
  1700.             => $this->view->title_page
  1701.         );
  1702.         //On affiche la publicité google
  1703.         $asides_publicite = new asides();
  1704.         asides::setEntityManager($this->em);
  1705.         asides::loadaside('Publicite')->addGoogle($asides_publicite$this->serviceAbonnements);
  1706.         $this->context['view']->asides_publicite $asides_publicite->view($this->context['view']);
  1707.         return $this->view('contacts/captations.html.twig');
  1708.     }
  1709.     // {{{ action_podcasts()
  1710.     /** Podcasts de la page contact
  1711.      *
  1712.      * @Route("/contacts/{slug}/podcasts", name="contact_podcasts")
  1713.      * @Route("/contacts/{slug}/podcasts/emission/{emission}", name="contact_podcasts_par_emission")
  1714.      * @Route("/contacts/{slug}/podcasts/podcast/{podcast}", name="contact_podcasts_par_podcast")
  1715.      *
  1716.      * @access public
  1717.      * @return void
  1718.      */
  1719.     public function action_podcasts($slug null$emission null$podcast null)
  1720.     {
  1721.         $this->context['params']['emission'] = $emission;
  1722.         $this->context['params']['podcast'] = $podcast;
  1723.         $this->InitController($slug'podcasts');
  1724.         $podcasts $this->em->getRepository(Podcasts::class);
  1725.         $culturebox_params = array(
  1726.             'direction' => 'DESC',
  1727.             'special' => array(
  1728.                 'type_podcast' => ['soundcloud''franceinter']
  1729.             ),
  1730.             'dbg' => array('derniers_culturebox_current''Les replay France Culture référencés'),
  1731.         );
  1732.         $choices = [
  1733.             'franceculture' => 0,
  1734.             'franceinter' => 1
  1735.         ];
  1736.         if (!in_array($this->idobject, [5955222])) {
  1737.             $aside_spectacle_audios true//Pour le chargement des asides en dessous
  1738.             $culturebox_params['special']['idcontacts'] = $this->idobject;
  1739.         } else {
  1740.             $aside_spectacle_audios false//Pour le chargement des asides en dessous
  1741.             $culturebox_params['special']['type_podcast'] = 'franceculture';
  1742.             $culturebox_params['special']['type_franceinter'] = 0;
  1743.             if ($this->idobject == 5222) {
  1744.                 $culturebox_params['special']['type_franceinter'] = 1;
  1745.             }
  1746.         }
  1747.         if (!empty($this->context['params']['emission'])) {
  1748.             $culturebox_params['special']['type_podcast'] = 'franceinter';
  1749.             $culturebox_params['special']['emission'] = $this->context['params']['emission'];
  1750.         } else if (!empty($this->context['params']['podcast'])) {
  1751.             $culturebox_params['special']['type_podcast'] = $this->context['params']['podcast'];
  1752.             if ($this->context['params']['podcast'] === 'franceinter') {
  1753.                 $culturebox_params['special']['type_franceinter'] = $choices['franceinter'];
  1754.             } else if ($this->context['params']['podcast'] === 'franceculture') {
  1755.                 $culturebox_params['special']['type_franceinter'] = $choices['franceculture'];
  1756.             }
  1757.          }
  1758.         $this->perPage 10;
  1759.         //Nombre total de podcasts
  1760.         $total_podcasts $podcasts->countListPodcasts($culturebox_params);
  1761.         $this->context['view']->pagination $this->getPagination($total_podcasts);
  1762.         $this->context['view']->pagination['totalItems'] = $total_podcasts;
  1763.         $this->context['view']->pagination['custom'] = true;
  1764.         $this->context['view']->pagination['custom_name'] = "podcasts";
  1765.         $culturebox_params['limit'] = array($this->getLimitStart(), $this->perPage);
  1766.         //données renvoyées à la vue
  1767.         $this->context['view']->list_captations $podcasts->getListPodcasts($culturebox_params);
  1768.         $this->getAsidesAudios(true$aside_spectacle_audios);
  1769.         return $this->view('contacts/podcasts.html.twig');
  1770.     }
  1771.     // }}}
  1772.     // {{{ action_presentation()
  1773.     /** Présentation générale
  1774.      *
  1775.      * @Route("/contacts/{slug}/presentation", name="contact_presentation")
  1776.      * @Route("/contacts/{slug}/presentation/idcontent/{p_idcontent}/pdf/{p_pdf}", name="contact_presentation_pdf")
  1777.      * @Route("/contacts/{slug}/presentation/idcontent/{p_idcontent}/pdf/{p_pdf}/download/{p_download}", name="contact_presentation_pdf_download")
  1778.      *
  1779.      * @access public
  1780.      * @return void
  1781.      */
  1782.     public function action_presentation($slug null$execute true$p_idcontent null$p_pdf null$p_download null)
  1783.     {
  1784.         if ($execute) {
  1785.             $this->InitController($slug'presentation');
  1786.         }
  1787.         $this->context['params']['idcontent'] = $p_idcontent;
  1788.         $this->setParamsPDF($p_pdf$p_download);
  1789.         $show_default_ensavoirplus true;
  1790.         // presentation "bio_txt"
  1791.         $biotxt $this->contents->getAssociateContent($this->idobject$this->type_object'class_presentation_structure', array('wiki_convert' => true));
  1792.         if (!empty($biotxt['text'])) {
  1793.             $this->view->biotxt $biotxt;
  1794.             // mots-clés et description
  1795.             $this->func->makeMetaFromHtml($biotxt['text'], $this->meta_description$this->meta_keywords);
  1796.             $show_default_ensavoirplus false;
  1797.         }
  1798.         $this->action_ensavoirplus($slugfalse$show_default_ensavoirplus);
  1799.         // il faut également la photo associé et le site web
  1800.         $files $this->em->getRepository(Files::class);
  1801.         $files->setPublishStatus($this->publish_status);
  1802.         $photos $files->getObjectFiles($this->idobject$this->type_object'class_photo_person');
  1803.         $format_vignette $format_vignette = array('width' => 220'height' => '180''direction' => 'L');
  1804.         $format_vignette_fou['blur'] = true;
  1805.         if (!empty($photos)) {
  1806.             // creation d'une vignette
  1807.             foreach ($photos as $k => $v) {
  1808.                 $photos[$k]['vignette'] = $this->obj->getVignetteContact($this->idobject$format_vignette);
  1809.                 $photos[$k]['vignette_flou'] = $this->obj->getVignetteContact($this->idobject$format_vignette_fou);
  1810.             }
  1811.             $this->view->photos $photos;
  1812.         }
  1813.         // carte google ?
  1814.         if (isset($this->infosobject['geocodable']) && $this->infosobject['geocodable'] == 1) {
  1815.             $this->view->google_maps_key Constants::Get('google_maps_key'0);
  1816.             $this->view->cartox $this->infosobject['x'];
  1817.             $this->view->cartoy $this->infosobject['y'];
  1818.             $this->view->cartoc 11;
  1819.             // dimension de la carte
  1820.             $this->view->cartow 360;
  1821.             $this->view->cartoh 240;
  1822.             $this->view->geocodable true;
  1823.         }
  1824.         $this->setAsidesCommunEnSavoirPlus();
  1825.         if ($execute) {
  1826.             $this->checkConditionsPDF();
  1827.             return $this->view('contacts/presentation.html.twig');
  1828.         }
  1829.     }
  1830.     // }}}
  1831.     // {{{ action_ensavoirplus()
  1832.     /** ensavoirplus
  1833.      *
  1834.      * @Route("/contacts/{slug}/ensavoirplus", name="contact_ensavoirplus")
  1835.      * @Route("/contacts/{slug}/ensavoirplus/idcontent/{p_idcontent}", name="contact_ensavoirplus_idcontent")
  1836.      * @Route("/contacts/{slug}/ensavoirplus/idcontent/{p_idcontent}/pdf/{p_pdf}", name="contact_ensavoirplus_idcontent_pdf")
  1837.      * @Route("/contacts/{slug}/ensavoirplus/idcontent/{p_idcontent}/pdf/{p_pdf}/download/{p_download}", name="contact_ensavoirplus_idcontent_pdf_download")
  1838.      *
  1839.      * @access public
  1840.      * @return void
  1841.      */
  1842.     public function action_ensavoirplus($slug null$aside true$default_content false$p_idcontent null$p_pdf null$p_download null)
  1843.     {
  1844.         if ($aside) {
  1845.             $this->InitController($slug'ensavoirplus');
  1846.         }
  1847.         $this->context['params']['idcontent'] = $p_idcontent;
  1848.         $this->setParamsPDF($p_pdf$p_download);
  1849.         $this->extra_locate $this->extra_title 'En savoir +';
  1850.         $bioarticles $this->contents->getAssociateContent($this->idobject'contacts''class_article');
  1851.         if (!empty($bioarticles['text'])) {
  1852.             $this->view->bioarticles $bioarticles;
  1853.             if ($default_content) {
  1854.                 return $this->redirectToRoute('contact_ensavoirplus_idcontent', ['slug' => $this->context['view']->url_clean'p_idcontent' => $bioarticles['idcontent']]);
  1855.             }
  1856.         }
  1857.         $this->contenus('class_article''ensavoirplus', array(), array('limit' => 'all'));
  1858.         if ($aside) {
  1859.             if (!empty($this->context['params'])) {
  1860.                 $params $this->context['params'];
  1861.             }
  1862.             if (isset($params) && (!empty($params['idcontent']) || $this->func->my_is_int($params['idcontent']))) {
  1863.                 $this->context['view']->bioarticles $this->em->getRepository(Contents::class)->getInfosContent($params['idcontent'], ['wiki_convert' => true'get_files' => true]);
  1864.             } else if (!empty($this->context['view']->list_captations)) {
  1865.             } else {
  1866.                 return $this->redirect('/biographies/' $this->context['view']->url_clean '/presentation/');
  1867.             }
  1868.             //Gestion du réseau social custom
  1869.             if (!empty($this->view->detailarticle['deck'])) {
  1870.                 $description_html $this->view->detailarticle['deck'];
  1871.             } else {
  1872.                 $description_html $this->view->detailarticle['text'];
  1873.             }
  1874. //            $url = URL_THNET.'/biographies/'.$this->infosperson['url_clean'].'/'.$this->context['action'].'/idcontent/'.$this->view->detailarticle['idcontent'];
  1875. //            $title = $this->view->detailarticle['title'].' - '.$this->infosperson['fullname'];
  1876. //            $this->setReseauSocial($title, $description_html, $url);
  1877.             $this->setAsidesCommunEnSavoirPlus();
  1878.         }
  1879.         if ($aside) {
  1880.             $this->checkConditionsPDF();
  1881.             return $this->view('contacts/ensavoirplus.html.twig');
  1882.         }
  1883.     }
  1884.     // }}}
  1885.     // {{{ action_videos()
  1886.     /** Vidéos associés à cette personne
  1887.      *
  1888.      * @Route("/contacts/{slug}/videos", name="contact_videos")
  1889.      * @Route("/contacts/{slug}/videos/type/{params_type}", name="contact_videos_type")
  1890.      *
  1891.      * @access public
  1892.      * @return void
  1893.      */
  1894.     public function action_videos($slug null$params_type null)
  1895.     {
  1896.         $this->context['params']['type'] = $params_type;
  1897.         $this->InitController($slug'videos');
  1898.         $object_multimedia $this->em->getRepository(ObjectMultimedia::class);
  1899.         $multimedias $this->em->getRepository(Multimedias::class);
  1900.         $format_vignette = array('width' => $_ENV['VIGN_VIDEO_WIDTH'], 'height' => $_ENV['VIGN_VIDEO_HEIGHT'], 'fleche' => 'none''ratio' => '169');
  1901.         /*
  1902.             Trouver les vidéos directement associées au contact ET aux spectacles dont le contact a pu être
  1903.             - producteur / coprod / prod delegue
  1904.             - compagnie / lieu de création
  1905.             - lieu de représentation
  1906.         */
  1907.         //20 résultats par page
  1908.         $this->perPage 20;
  1909.         //On indique que l'on souhaite faire afficher les vidéos en lien avec des spectacles
  1910.         $this->context['view']->videos_blocks true;
  1911.         $this->context['view']->spectacles_videos true;
  1912.         //On récupères les spectacles - à venir - anciens - produit - coproduit
  1913.         $this->action_spectacles($slugtrue, [
  1914.             'get_spectacles_with_multimedias' => true
  1915.         ]);
  1916.         //Nombres total de vidéos en partenariat
  1917.         $nb_videos_partenariats $this->multimedias->getMultimediasBy('contacts'$this->idobject' AND m.audio_video=2''count');
  1918.         //LE tableau renvoyé vers la vue.
  1919.         $multimedia = [];
  1920.         // On récupère les vidéos en partenariat spécifique à l'action des vidéos
  1921.         if (isset($this->context['params']['type']) && in_array($this->context['params']['type'], ['partenariat'])) {
  1922.             $this->context['view']->type_spectacle 'partenariat';
  1923.             //paramètre commun utile à plusieurs requêtes
  1924.             $params_query_commun = array(
  1925.                 'object' => array($this->idobject => ['contacts']),
  1926.                 'where' => array(array('multimedias''audio_video'2)),
  1927.                 'order' => array('multimedias.date'),
  1928.                 'limit' => array('all'),
  1929.                 'dbg' => array('last_commun''Vidéos en partenariat du contact'),
  1930.             );
  1931.             // On récupère la liste des dates pour les saisons et les années
  1932.             $params_query_get_dates array_merge($params_query_commun, array(
  1933.                 'select' => array('multimedias.`date`''YEAR(multimedias.`date`) as annee'),
  1934.                 'count_only_spectacles' => true,
  1935.                 'dbg' => array('last_dates''Vidéo en partenariat du contact - liste des dates'),
  1936.             ));
  1937.             $sql_dates_multimedias $this->em->getRepository(Multimedias::class)->getSQLMultimedias($params_query_get_datesfalse);
  1938.             $listdates $multimedias->queryAll($sql_dates_multimedias);
  1939.             if (!empty($listdates)) {
  1940.                 foreach ($listdates as $a) {
  1941.                     if ($a['date'] > date('Y-m-d'mktime(000831$a['annee']))) {
  1942.                         $s $a['annee'] . '-' . ($a['annee'] + 1);
  1943.                     } else {
  1944.                         $s = ($a['annee'] - 1) . '-' $a['annee'];
  1945.                     }
  1946.                     $saisons[$s] = $s;
  1947.                     $saisons_key[] = $s;
  1948.                     $annees[$a['annee']] = $a['annee'];
  1949.                 }
  1950.                 if (!empty($saisons)) {
  1951.                     // liste des saisons des spectacles
  1952.                     $this->view->saisons $saisons;
  1953.                     if (!empty($saisons)) {
  1954.                         $this->getCommonSearch(array(
  1955.                                 'saisons_annees' => [
  1956.                                     'saisons' => $saisons
  1957.                                 ]
  1958.                             )
  1959.                         );
  1960.                         $this->getCommonSearchView();
  1961.                     }
  1962.                     // dernière saison
  1963.                     foreach ($saisons as $s) {
  1964.                         $this->view->current_saison $s;
  1965.                         break;
  1966.                     }
  1967.                 }
  1968.             }
  1969.             // recherche par saison
  1970.             if (!empty($_REQUEST['s'])) {
  1971.                 $saison filter_var($_REQUEST['s'], FILTER_SANITIZE_URL);
  1972.             } else {
  1973.                 $saison null;
  1974.             }
  1975.             $annees_saison explode('-'$saison);
  1976.             if (count($annees_saison) == 2) {
  1977.                 $datestart Date_time::getSaisonDatestart((int)$annees_saison[0]);
  1978.                 $dateend Date_time::getSaisonDateend((int)$annees_saison[1]);
  1979.             }
  1980.             // On ajout le paramètre des dates à la requête commune
  1981.             if (!empty($datestart) && !empty($dateend)) {
  1982.                 $params_query_commun['where_date_multimedias'] = array(
  1983.                     'datestart' => $datestart,
  1984.                     'dateend' => $dateend
  1985.                 );
  1986.             }
  1987.             //On récupère le nombre total de multimédias
  1988.             $params_query_total array_merge($params_query_commun, array(
  1989.                 'select' => array(),
  1990.                 'dbg' => array('last_total''Vidéo en partenariat du contact - liste totales des vidéos'),
  1991.             ));
  1992.             $sql_dates_multimedias $this->em->getRepository(Multimedias::class)->getSQLMultimedias($params_query_totalfalse);
  1993.             $total $this->em->getRepository(Multimedias::class)->queryAll($sql_dates_multimedias);
  1994.             $nb_videos_partenariats count($total);
  1995.             //On s'ocucpe de la pagination
  1996.             $this->context['view']->pagination $this->getPagination($nb_videos_partenariats);
  1997.             $this->context['view']->pagination['totalItems'] = $nb_videos_partenariats;
  1998.             $this->context['view']->pagination['custom'] = true;
  1999.             $this->context['view']->pagination['custom_name'] = "vidéos";
  2000.             // Récupération de la liste des dernières videos du contact
  2001.             $params_query_last array_merge($params_query_commun, array(
  2002.                 'limit' => array($this->getLimitStart(), $this->perPage),
  2003.                 'dbg' => array('last_listes''Vidéo en partenariat du contact - liste des multimedias'),
  2004.             ));
  2005.             $videos_listes_partenariats $this->em->getRepository(Multimedias::class)->getListMultimedias($params_query_last, array(), ['alldata' => true]);
  2006.         }
  2007.         //Si nous récupérons des vidéos en provenance en partenariat
  2008.         if (!empty($videos_listes_partenariats)) {
  2009.             $this->context['view']->videos_classic true;
  2010.             // $multimedia ;
  2011.             foreach ($videos_listes_partenariats as $idmultimedia => $v) {
  2012.                 $multimedia[$idmultimedia] = $this->em->getRepository(Multimedias::class)->getInfosMultimedia($idmultimediatruefalse, array('vignette' => $format_vignette));
  2013.                 if ($idspectacle key($v['spectacles'])) {
  2014.                     $multimedia[$idmultimedia]['spectacle'] = $this->em->getRepository(Spectacles::class)->getInfosSpectacle($idspectacle);
  2015.                 }
  2016.             }
  2017.         } ///Sinon nous affichons les vidéos en lien avec les spectacles de l'action_spectacles
  2018.         else if (!empty($this->context['view']->spectacles)) {
  2019.             //Nous affichons des données différent en fonction des filtres de l'utilisateur
  2020.             //Par dérfault les prochains spectacles
  2021.             $params_schedule = array('prochains' => true);
  2022.             if (in_array($this->context['view']->type_spectacle, ['anciens'])) {
  2023.                 //Les anciens spectacles
  2024.                 $params_schedule = array('anciens' => true);
  2025.             }
  2026.             $idobject $this->idobject;
  2027.             if (in_array($this->context['view']->type_spectacle, ['coprod'])) {
  2028.                 $idobject null;
  2029.             }
  2030.             //on traite les données pour pouvoir les afficher comme convenus
  2031.             foreach ($this->context['view']->spectacles as $idspectacle => $spectacle) {
  2032.                 $idmultimedia $spectacle['idmultimedia'];
  2033.                 $multimedia[$idmultimedia] = $this->em->getRepository(Multimedias::class)->getInfosMultimedia($idmultimediatruefalse, array('vignette' => $format_vignette));
  2034.                 $multimedia[$idmultimedia]['spectacle'] = $spectacle;
  2035.                 if (in_array($this->context['view']->type_spectacle, ['prod'])) {
  2036.                     $multimedia[$idmultimedia]['spectacle']['footer_creation_date'] = true;
  2037.                 } else {
  2038.                     $multimedia[$idmultimedia]['spectacle']['schedule'] = $this->em->getRepository(Spectacles::class)->getProchDateLieu(
  2039.                         $params_schedule,
  2040.                         $spectacle['idspectacle'],
  2041.                         $idobject
  2042.                     );
  2043.                 }
  2044.             }
  2045.         } else {
  2046.             if ($nb_videos_partenariats 0) {
  2047.                 return $this->redirectToRoute('contact_videos_type', ['slug' => $this->context['view']->url_clean,  'params_type' => 'partenariat']);
  2048.             }
  2049.         }
  2050.         $this->context['view']->spectacles $multimedia;
  2051.         $this->context['view']->contactsvideos true;
  2052.         $this->getAsidesVideos();
  2053.         return $this->view('contacts/videos.html.twig');
  2054.     }
  2055.     // }}}
  2056.     // {{{ action_videos_v1() à réactiver en temps voulu par françois
  2057.     /** Vidéos associés à cette personne
  2058.      *
  2059.      *
  2060.      * @access public
  2061.      * @return void
  2062.      */
  2063.     public function action_videos_v1() //ancienne version de la page vidéo
  2064.     {
  2065.         /*
  2066.             Trouver les vidéos associées directement au contact ET aux spectacles dont le contact à pu être
  2067.             - producteur / coprod / prod delegue
  2068.             - compagnie / lieu de création
  2069.             - lieu de représentation
  2070.         */
  2071.         // les vidéos de spectacles joués dans ce lieu
  2072.         $ids_multimedia_in $this->getMultimediasIn($this->ids_spectacle_in);
  2073.         // les vidéos de spectacle coproduit par ce contact
  2074.         $ids_multimedia_prod $this->getMultimediasProd($this->ids_spectacle_prod);
  2075.         // commence le tableau de tout
  2076.         $ids_multimedia_all array_unique(array_merge($ids_multimedia_in$ids_multimedia_prod));
  2077.         $ids_multimedia_all_doublons array_merge($ids_multimedia_in$ids_multimedia_prod);
  2078.         // les vidéos de spectacle associées (en partenariat) à ce contact
  2079.         $ids_multimedia_contact $this->getMultimediasContact(false$ids_multimedia_all_doublons);
  2080.         // les vidéos associées aux contact => soit parceque c'est un lieu de représentation, soit parceque c'est une coprod/partenariat
  2081.         if (!empty($ids_multimedia_contact)) {
  2082.             $ids_multimedia_all array_unique(array_merge($ids_multimedia_all$ids_multimedia_contact));
  2083.         }
  2084.         // toutes les valeurs
  2085.         $valeurs = array(
  2086.             'multimedias' => array(
  2087.                 'in' => array('nb' => count($ids_multimedia_in)),
  2088.                 'prod' => array('nb' => count($ids_multimedia_prod)),
  2089.                 'contact' => array('nb' => count($ids_multimedia_contact)),
  2090.                 'all' => array('nb' => count($ids_multimedia_all)),
  2091.             ),
  2092.             'spectacles' => array(
  2093.                 'in' => array('nb' => count($this->ids_spectacle_in)),
  2094.                 'prod' => array('nb' => count($this->ids_spectacle_prod)),
  2095.                 'all' => array('nb' => count($this->ids_spectacle_all)),
  2096.             ),
  2097.         );
  2098.         $this->view->nb $valeurs;
  2099.         if ($valeurs['multimedias']['all']['nb'] > $this->nb_contact_recherche) {
  2100.             // trouver les auteurs qui sont liés directement au contact ou à ses spectacles
  2101.             $sql_authors 'SELECT DISTINCT(persons.idperson), persons.firstname, persons.lastname, persons.url_clean
  2102.                     FROM persons, object_multimedia
  2103.                     WHERE object_multimedia.object=\'persons\'
  2104.                     AND object_multimedia.idobject=persons.idperson
  2105.                     AND object_multimedia.idrole IN (1,21)
  2106.                     AND object_multimedia.idmultimedia IN (' join(','$ids_multimedia_all) . ') ORDER BY persons.lastname';
  2107.             $authors $this->obj->queryAll($sql_authors);
  2108.             if (!empty($authors)) {
  2109.                 // liste des auteurs
  2110.                 $authors_tab[0] = 'Choisissez un auteur/metteur en scène...';
  2111.                 foreach ($authors as $k => $v) {
  2112.                     $authors_tab[$v['idperson']] = mb_strtoupper($v['lastname'], CHARSET) . ' ' $v['firstname'];
  2113.                     if (!empty($_REQUEST['idperson']) && $v['idperson'] == $_REQUEST['idperson']) {
  2114.                         $this->view->search_person $v;
  2115.                     }
  2116.                 }
  2117.                 $this->context['form']->addElement('select''idperson''Auteurs'$authors_tab, array('id' => 'idperson_author'));
  2118.                 // on recherche les vidéos du contact associées à une personne
  2119.                 if (!empty($_REQUEST['idperson']) && $this->func->my_is_int($_REQUEST['idperson'])
  2120.                     && !empty($authors_tab[$_REQUEST['idperson']])) {
  2121.                     $idperson = (int)$_REQUEST['idperson'];
  2122.                     // les vidéos associées à cette personne
  2123.                     $params_query_person = array(
  2124.                         'where' => array(
  2125.                             array('multimedias''idmultimedia'$ids_multimedia_all),
  2126.                         ),
  2127.                         'object' => array('persons' => $idperson),
  2128.                         'language' => 'fr',
  2129.                         'limit' => array(015),
  2130.                         'dbg' => array('person''Vidéos associé au contact et à une personne'),
  2131.                     );
  2132.                     $videos_person $this->multimedias->getListMultimedias($params_query_person);
  2133.                     $this->view->videos_person $videos_person;
  2134.                     // la personne
  2135.                 }
  2136.             }
  2137.             // trouver les années des vidéos (vidéos publiées en)
  2138.             // trouver les années et saison des spectacles
  2139.             $current_year $this->getYear();
  2140.             // recherche une saison ?
  2141.             $saison $this->getSaison();
  2142.             // grouper les dates par saisons
  2143.             $sql_annees 'SELECT schedules.date, YEAR(schedules.date) as annee
  2144.                            FROM schedules, spectacles, object_multimedia, multimedias
  2145.                            WHERE schedules.idspectacle=spectacles.idspectacle
  2146.                            AND object_multimedia.idobject=spectacles.idspectacle AND object_multimedia.object=\'spectacles\'
  2147.                            AND multimedias.idmultimedia=object_multimedia.idmultimedia
  2148.                            AND multimedias.publish=1
  2149.                            AND spectacles.publish=1
  2150.                            AND object_multimedia.idmultimedia IN (' join(','$ids_multimedia_all) . ') ORDER BY schedules.date';
  2151.             // autres propositions
  2152.             //AND schedules.idspectacle IN ('.join(',', $ids_spectacle_all).') ORDER BY schedules.date';
  2153.             //AND object_multimedia.idmultimedia IN ('.join(',', $ids_multimedia_all).') ORDER BY schedules.date';
  2154.             //AND schedules.idspectacle IN ('.join(',', $ids_spectacle_all).') ORDER BY schedules.date';
  2155.             //AND schedules.idspectacle IN ('.join(',', $ids_spectacle_in).') ORDER BY schedules.date';
  2156.             //AND schedules.idcontact='.$this->idobject.' ORDER BY schedules.date';
  2157.             $listdates $this->obj->queryAll($sql_annees);
  2158.             // liste des saisons et des années
  2159.             if (PEAR::isError($listdates)) {
  2160.                 echo $listdates->getDebugInfos();
  2161.             } elseif (!empty($listdates)) {
  2162.                 foreach ($listdates as $a) {
  2163.                     if ($a['date'] > date('Y-m-d'mktime(000831$a['annee']))) {
  2164.                         $s $a['annee'] . '-' . ($a['annee'] + 1);
  2165.                     } else {
  2166.                         $s = ($a['annee'] - 1) . '-' $a['annee'];
  2167.                     }
  2168.                     $saisons[$s] = $s;
  2169.                     $saisons_key[] = $s;
  2170.                     $annees[$a['annee']] = $a['annee'];
  2171.                 }
  2172.                 // liste des saisons des spectacles
  2173.                 $this->view->saisons $saisons;
  2174.                 if (!empty($saisons)) {
  2175.                     $this->context['form']->addElement('select''s''Saisons'array_merge(array('' => 'Choisissez une saison...'), $saisons), array('id' => 'saisons'));
  2176.                 }
  2177.                 // liste des annees des spectacles
  2178.                 $this->view->annees $annees;
  2179.                 if (!empty($annees)) {
  2180.                     $this->context['form']->addElement('select''y''Années'array_merge(array('' => 'Choisissez une année...'), $annees), array('id' => 'annees'));
  2181.                 }
  2182.             }
  2183.             // si aucune recherche par person, par année ou par saison => recherche par saison
  2184.             if (empty($current_year) && empty($saison) && empty($idperson)) {
  2185.                 if (!empty($saisons)) {
  2186.                     $saison Date_time::getLastSaison($saisons);
  2187.                 }
  2188.             }
  2189.             // recherche par saison
  2190.             if (!empty($saison)) {
  2191.                 $annees_saison explode('-'$saison);
  2192.                 if (count($annees_saison) == 2) {
  2193.                     $datestart date('Y-m-d'mktime(00091, (int)$annees_saison[0]));
  2194.                     $dateend date('Y-m-d'mktime(000831, (int)$annees_saison[1]));
  2195.                 }
  2196.                 // saison de recherche
  2197.                 $this->view->saison $saison;
  2198.                 // saison précédente / suivante
  2199.                 if (!empty($saisons)) {
  2200.                     foreach ($saisons as $s) {
  2201.                         if (isset($prev)) {
  2202.                             $saisons_nav['next'] = $s;
  2203.                             break;
  2204.                         }
  2205.                         if ($s == $saison && !isset($saisons_nav['prev'])) {
  2206.                             if (isset($current_s)) {
  2207.                                 $saisons_nav['prev'] = $current_s;
  2208.                             }
  2209.                             $prev true;
  2210.                         }
  2211.                         $current_s $s;
  2212.                     }
  2213.                     if (!empty($saisons_nav)) {
  2214.                         $this->view->saisons_nav $saisons_nav;
  2215.                     }
  2216.                 }
  2217.             }
  2218.             // annee
  2219.             if (!empty($current_year)) { // recherche par année
  2220.                 $datestart date('Y-m-d'mktime(00011$current_year));
  2221.                 $dateend date('Y-m-d'mktime(0001231$current_year));
  2222.                 // annee de recherche
  2223.                 $this->view->current_year $current_year;
  2224.             }
  2225.             // recherche période
  2226.             if (!empty($datestart) && !empty($dateend)) {
  2227.                 //$where_idcontact .= ' AND sc.date BETWEEN \''.$datestart.'\' AND \''.$dateend.'\' ';
  2228.             }
  2229.             if (empty($datestart) && empty($dateend)) {
  2230.                 // un objet spectacle
  2231.                 $spectacles $this->em->getRepository(Spectacles::class);
  2232.                 // trouver le spectacle avec vidéo avec la date la plus proche
  2233.                 $sql 'SELECT MAX(schedules.date) as lastdate, MAX(YEAR(schedules.date)) as annee
  2234.                        FROM schedules, object_multimedia
  2235.                        WHERE schedules.idspectacle=object_multimedia.idobject
  2236.                        AND object_multimedia.object=\'spectacles\'
  2237.                        AND schedules.idcontact=' $this->idobject '
  2238.                        AND object_multimedia.idmultimedia IN (' join(','$ids_multimedia_all) . ')';
  2239.                 $last_spectacle_video $this->obj->queryRow($sql);
  2240.                 // si la date est avant le 7 juillet, alors saison = annee / annee-1
  2241.                 if ($last_spectacle_video['lastdate'] < date('Y-m-d'mktime(00071$last_spectacle_video['annee']))) {
  2242.                     $datestart date('Y-m-d'mktime(00091$last_spectacle_video['annee'] - 1));
  2243.                     $dateend date('Y-m-d'mktime(000831$last_spectacle_video['annee']));
  2244.                 } else {
  2245.                     $datestart date('Y-m-d'mktime(00091$last_spectacle_video['annee']));
  2246.                     $dateend date('Y-m-d'mktime(000831$last_spectacle_video['annee'] + 1));
  2247.                     $this->view->current_saison true;
  2248.                 }
  2249.             }
  2250.             $this->view->datestart $datestart;
  2251.             $this->view->dateend $dateend;
  2252.         }
  2253.         // les vidéos de spectacles à l'affiche dans le lieu
  2254.         if ($valeurs['multimedias']['in']['nb'] > 0) {
  2255.             $params_query_in = array(
  2256.                 'affiche' => true,
  2257.                 'where' => array(
  2258.                     //array('schedules','idcontact',$this->idobject),
  2259.                     array('schedules''idspectacle'$this->ids_spectacle_in),
  2260.                 ),
  2261.                 'group' => array('multimedias' => 'idmultimedia'),
  2262.                 'direction' => 'DESC',
  2263.                 'limit' => array(040),
  2264.                 'dbg' => array('affiche''Vidéos de spectacles à l\'affiche dans ce lieu'),
  2265.             );
  2266.             // si datestart et dateend
  2267.             if (!empty($datestart) && !empty($dateend)) {
  2268.                 $params_query_in['affiche'] = array('saison' => array($datestart$dateend));
  2269.             }
  2270.             $spectacles_in $this->multimedias->getListMultimedias($params_query_in);
  2271.             $this->view->spectacles_in $spectacles_in;
  2272.             $nb_spectacles_in count($spectacles_in);
  2273.             $this->view->nb_spectacles_in_saison $nb_spectacles_in;
  2274.         }
  2275.         // les vidéos de spectacles coproduits par ce contact
  2276.         if ($valeurs['multimedias']['prod']['nb'] > 0) {
  2277.             $params_query_prod = array(
  2278.                 'affiche' => true,
  2279.                 'where' => array(
  2280.                     array('schedules''idspectacle'$this->ids_spectacle_prod),
  2281.                 ),
  2282.                 'group' => array('multimedias' => 'idmultimedia'),
  2283.                 'direction' => 'DESC',
  2284.                 'limit' => array(0100),
  2285.                 'dbg' => array('coprod''Vidéos de spectacles à l\'affiche coproduit par ce contact'),
  2286.             );
  2287.             // si datestart et dateend
  2288.             if (!empty($datestart) && !empty($dateend)) {
  2289.                 $params_query_prod['affiche'] = array('saison' => array($datestart$dateend));
  2290.             }
  2291.             $spectacles_prod $this->multimedias->getListMultimedias($params_query_prod);
  2292.             $nb_spectacles_prod count($spectacles_prod);
  2293.             $this->view->nb_spectacles_prod_saison $nb_spectacles_prod;
  2294.             $this->view->spectacles_prod $spectacles_prod;
  2295.         }
  2296.         //  les vidéos en partenariat avec le contact
  2297.         if ($valeurs['multimedias']['contact']['nb'] > 0) {
  2298.             $params_query_contact = array(
  2299.                 //'affiche' => true,
  2300.                 'where' => array(
  2301.                     array('multimedias''idmultimedia'$ids_multimedia_contact),
  2302.                 ),
  2303.                 'limit' => array(0100),
  2304.                 'direction' => 'DESC',
  2305.                 'group' => array('multimedias' => 'idmultimedia'),
  2306.                 'dbg' => array('contact''Vidéos en partenariat avec ce contact'),
  2307.             );
  2308.             // si datestart et dateend
  2309.             if (!empty($datestart) && !empty($dateend)) {
  2310.                 $params_query_contact['affiche'] = array('saison' => array($datestart$dateend));
  2311.             }
  2312.             $videos_contact $this->multimedias->getListMultimedias($params_query_contact);
  2313.             $nb_videos_contact count($videos_contact);
  2314.             $this->view->nb_videos_contact_saison $nb_videos_contact;
  2315.             $this->view->videos_contact $videos_contact;
  2316.         }
  2317.         // colonne un si il y a des spectacles
  2318.         if ($valeurs['multimedias']['in']['nb'] > 0) {
  2319.             $this->view->colonne_unb true;
  2320.         }
  2321.         // contact important
  2322.         if ($valeurs['multimedias']['all']['nb'] > $this->nb_contact_recherche) {
  2323.             $this->view->big_contact true;
  2324.         }
  2325.         $sql 'SELECT DISTINCT(idmultimedia) FROM object_multimedia WHERE object=\'contact\' AND idobject=' $this->idobject;
  2326.         $idmultimedias_object $this->obj->queryCol($sql);
  2327.         // trouver les videos de l'espace vidéo
  2328.         $this->context['view']->nb_multimedias $this->multimedias->getMultimediasBy('contacts'$this->idobject' AND m.audio_video=2''count');
  2329.         // pas de commentaire et de vote
  2330.         $this->view->no_comment true;
  2331.         $this->view->no_vote true;
  2332.         // le spectacle en premier
  2333.         $this->view->first_spectacles true;
  2334.         $this->style_more[] = 'videos';
  2335.         $this->extra_locate 'Vidéos';
  2336.         $this->extra_title $this->extra_locate;
  2337.         //aside
  2338.         $this->asides->load('contact_saison_auteurs');
  2339.         $this->asides->load('common_participer_contacts');
  2340.     }
  2341.     // }}}
  2342.     // {{{ action_spectacles()
  2343.     /** Spectacles de la structure
  2344.      *
  2345.      * @Route("/contacts/{slug}/spectacles", name="contact_spectacles")
  2346.      * @Route("/contacts/{slug}/spectacles/type/{p_type}", name="contact_spectacles_type")
  2347.      *
  2348.      * @access public
  2349.      * @return void
  2350.      */
  2351.     public function action_spectacles($slug null$execute_corps_page true$params = array(), $p_type null)
  2352.     {
  2353.         if (empty($this->context['params']['type'])) {
  2354.             $this->context['params']['type'] = $p_type;
  2355.         }
  2356.         if ($execute_corps_page && empty($params)) {
  2357.             $this->InitController($slug'spectacles');
  2358.         }
  2359.         //menu en scène
  2360.         if (empty($this->context['view']->all_en_scene)) {
  2361.             $this->context['view']->all_en_scene $this->countEnScene(['affiche' => true]);
  2362.         }
  2363.         if (empty($this->context['view']->anciens_en_scene)) {
  2364.             $this->context['view']->anciens_en_scene $this->countEnScene(['anciens' => true]);
  2365.         }
  2366.         $whereIdContact '';
  2367.         if (in_array($this->idobject, [5955222]) && $this->context['action'] == 'emissions') {
  2368.             $whereIdContact '';
  2369.         } else {
  2370.             $whereIdContact ' AND ' $this->getWhereIdcontact();
  2371.         }
  2372.         $this->perPage 20;
  2373.         $filtres = array(
  2374.             //les spectacles produits dans le contact (in)
  2375.             'in' => array(
  2376.                 // 'idcontact' => $this->idobject,
  2377.                 'params_sql' => array(
  2378.                     'params' => array(
  2379.                         'where' => ' AND s.publish=1 ' $whereIdContact,
  2380.                         'classement' => 'ASC'//$this->getOrder()
  2381.                         'groupby' => 's.idspectacle',
  2382.                     ),
  2383.                     'special' => array(
  2384.                         'idcontact' => $this->idobject,
  2385.                         'prochains' => true,
  2386.                         'order' => true
  2387.                     ),
  2388.                     'dbg' => array('spectacles_in_list''Les spectacles à l\'affiche dans ce lieu')
  2389.                 ),
  2390.                 'view' => array(
  2391.                     'special' => array(
  2392.                         'footer_date' => true,
  2393.                         'no_date' => true
  2394.                     ),
  2395.                     'spectacles_nocity' => true //spécifique à la page vidéo
  2396.                 )
  2397.             ),
  2398.             //les anciens spectacles
  2399.             'anciens' => array(
  2400.                 'params_sql' => array(
  2401.                     'params' => array(
  2402.                         'where' => ' AND s.publish=1 ' $whereIdContact,
  2403.                         'select' => 'contacts.idcontact as datecontact',
  2404.                         'groupby' => 's.idspectacle',
  2405.                     ),
  2406.                     'special' => array(
  2407.                         'anciens_stricts' => true,
  2408.                         'count_in_spectacle_anciens' => true,
  2409.                         'idcontact' => $this->idobject,
  2410.                     ),
  2411.                     'dbg' => array('spectacles_anciens_list''Spectacles anciens par ce contact')
  2412.                 ),
  2413.                 'view' => array(
  2414.                     'noshow' => true,
  2415.                     'special' => array(
  2416.                         'footer_date' => true,
  2417.                     ),
  2418.                     'spectacles_nocity' => true //spécifique à la page vidéo
  2419.                 ),
  2420.                 'unset' => array(
  2421.                     'special,prochains' => true,
  2422.                     'special,count_in_spectacle_anciens' => true
  2423.                 )
  2424.             ),
  2425.             //les productions -anciennes
  2426.             // 'prod-anciens' => array(
  2427.             //     'params_sql' => array(
  2428.             //         'params' => array(
  2429.             //             'from' => 'spectacle_contact sct',
  2430.             //             'where' => 'AND s.publish=1
  2431.             //                         AND sct.idspectacle=s.idspectacle
  2432.             //                         AND sct.idrole IN ('.implode(',', array(17,18,19)).')
  2433.             //                         AND (sct.idcontact='.$this->idobject.' OR s.idcontact_production='.$this->idobject.') ',
  2434.             //             'groupby' => 's.idspectacle',
  2435.             //             'order' => 's.creation_date DESC'
  2436.             //         ),
  2437.             //         'special' => array(
  2438.             //             'anciens_stricts' => true,
  2439.             //             'count_in_spectacle_anciens' => true
  2440.             //         ),
  2441.             //         'dbg' => array('spectacles_prod_list','Spectacles prod/coprod/prod deleg de ce contact')
  2442.             //     ),
  2443.             //     'unset' => array(
  2444.             //         'special,prochains' => true,
  2445.             //         'special,count_in_spectacle_anciens' => true
  2446.             //     ),
  2447.             //     'view' => array(
  2448.             //         'special' => array(
  2449.             //             'display' => array('affiche_date_creation' => true),
  2450.             //             'annee_creation' => true
  2451.             //         )
  2452.             //     )
  2453.             // ),
  2454.             //les prod
  2455.             'diffusions' => array(
  2456.                 'params_sql' => array(
  2457.                     'params' => array(
  2458.                         'from' => 'TheatreCore\Entity\SpectacleContact sct',
  2459.                         'where' => ' AND s.publish=1 AND sct.idspectacle=s.idspectacle
  2460.                                     AND (sct.idrole IN (77) AND sct.idcontact=' $this->idobject ')',
  2461.                         'groupby' => 's.idspectacle',
  2462.                         'order' => ['creation_date''DESC']
  2463.                     ),
  2464.                     'dbg' => array('spectacles_prod_list''Spectacles prod/coprod/prod deleg de ce contact')
  2465.                 ),
  2466.                 'unset' => array(
  2467.                     'special,prochains' => true,
  2468.                     // 'special,count_in_spectacle_anciens' => true
  2469.                 ),
  2470.                 'view' => array(
  2471.                     'special' => array(
  2472.                         'display' => array('affiche_date_creation' => true),
  2473.                         'annee_creation' => true
  2474.                     )
  2475.                 )
  2476.             ),
  2477.             'prod' => array(
  2478.                 'params_sql' => array(
  2479.                     'params' => array(
  2480.                         'from' => 'TheatreCore\Entity\SpectacleContact sct',
  2481.                         'where' => 'AND s.publish=1
  2482.                                     AND sct.idspectacle=s.idspectacle
  2483.                                     AND sct.idrole IN (' implode(',', array(171819)) . ')
  2484.                                     AND (sct.idcontact=' $this->idobject ' OR s.idcontactProduction=' $this->idobject ') ',
  2485.                         'groupby' => 's.idspectacle',
  2486.                         'order' => ['creation_date''DESC']
  2487.                     ),
  2488.                     'dbg' => array('spectacles_prod_list''Spectacles prod/coprod/prod deleg de ce contact')
  2489.                 ),
  2490.                 'unset' => array(
  2491.                     'special,prochains' => true,
  2492.                     // 'special,count_in_spectacle_anciens' => true
  2493.                 ),
  2494.                 'view' => array(
  2495.                     'special' => array(
  2496.                         'display' => array('affiche_date_creation' => true),
  2497.                         'annee_creation' => true
  2498.                     )
  2499.                 )
  2500.             ),
  2501.             //les coproductions
  2502.             'coprod' => array(
  2503.                 'params_sql' => array(
  2504.                     'params' => array(
  2505.                         'from' => 'TheatreCore\Entity\SpectacleContact sct',
  2506.                         'where' => 'AND s.publish=1
  2507.                                     AND sct.idspectacle=s.idspectacle
  2508.                                     AND sct.idrole IN (' implode(',', array(171819)) . ')
  2509.                                     AND (sct.idcontact=' $this->idobject ' OR s.idcontactProduction=' $this->idobject ') ',
  2510.                         'groupby' => 's.idspectacle',
  2511.                     ),
  2512.                     'special' => array(
  2513.                         'prochains' => true,
  2514.                         'plus_proche' => true
  2515.                     ),
  2516.                     'dbg' => array('spectacles_prod_list''Spectacles prod/coprod/prod deleg de ce contact')
  2517.                 ),
  2518.                 'view' => array(
  2519.                     'special' => array(
  2520.                         'footer_contact' => true,
  2521.                     )
  2522.                 ),
  2523.                 'unset' => array(
  2524.                     'params,order' => true
  2525.                 )
  2526.             ),
  2527.             'soutiens,selections,laureats_nominations,aide' => array(
  2528.                 'params_sql' => array(
  2529.                     'params' => array(
  2530.                         'groupby' => 's.idspectacle',
  2531.                     ),
  2532.                     'special' => array(
  2533.                         'prochains' => true,
  2534.                         // TODO: chercher une solution pour ça
  2535.                         // 'idspectacle' => $this->ids_spectacle_soutiens,
  2536.                         'idspectacle' => 'checks_exists',
  2537.                         // 'idcontact' => $this->idobject,
  2538.                     ),
  2539.                     'dbg' => array('spectacles_multiples_list''Spectacles multiples par ce contact')
  2540.                 ),
  2541.                 'view' => array(
  2542.                     'special' => array(
  2543.                         'footer_contact' => true,
  2544.                     )
  2545.                 )
  2546.             )
  2547.         );
  2548.         $this->format_vignette = array(
  2549.             'stylemore' => array('imagep' => 'width:75px;''descsp' => 'width:100%;'),
  2550.             'vignette' => array('width' => $_ENV['VIGN_SPECTACLE_WIDTH'], 'height' => $_ENV['VIGN_SPECTACLE_HEIGHT'], 'direction' => 'crop')
  2551.         );
  2552.         //Tous les filtres par défaults (spectacles simples, ou spectacles avec podcasts France Culture);
  2553.         $filtre_type = ['spectacles''audio'];
  2554.         //Si on doit executer le corps de page
  2555.         if ($execute_corps_page) {
  2556.             $filtre_type = ['spectacles'];
  2557.         }
  2558.         //Si on demande un filtre spécifique
  2559.         if (!empty($params['filtre_type'])) {
  2560.             if (!is_array($params['filtre_type'])) {
  2561.                 $params['filtre_type'] = [$params['filtre_type']];
  2562.             }
  2563.             $filtre_type $params['filtre_type'];
  2564.         }
  2565.         if (!isset($this->context['view']->nb_total_spectacle)) {
  2566.             $this->context['view']->nb_total_spectacle 0;
  2567.         }
  2568.         $selected $this->context['view']->type_spectacle 'in';
  2569.         $total_spectacle $total_spectacle_plus 0;
  2570.         foreach ($filtre_type as $k_filtre_type => $v_filtre_type) {
  2571.             foreach ($filtres as $kfiltres => $vfiltres) {
  2572.                 $filtres_plus explode(','$kfiltres);
  2573.                 //on clean le nom du filtre
  2574.                 $var_filtres preg_replace('/-/''_'$kfiltres);
  2575.                 // cas festival
  2576.                 if (!empty($this->infosobject['is_festival'])) {
  2577.                     $filtres[$kfiltres]['params_sql']['special']['type_contact'] =
  2578.                     $vfiltres['params_sql']['special']['type_contact'] = 'idcontactFestival';
  2579.                 }
  2580.                 if (!empty($params['get_spectacles_with_multimedias'])) {
  2581.                     $filtres[$kfiltres]['params_sql']['special']['multimedias_videos_associes'] =
  2582.                     $vfiltres['params_sql']['special']['multimedias_videos_associes'] = true;
  2583.                     // if (!empty($this->infosobject['is_festival'])) {
  2584.                     //     $filtres[$kfiltres]['params_sql']['special']['multimedias_videos_associes_contact_festival'] =
  2585.                     //     $vfiltres['params_sql']['special']['multimedias_videos_associes_contact_festival'] = $this->idobject;
  2586.                     // }
  2587.                     if ($var_filtres != 'coprod') {
  2588.                         $filtres[$kfiltres]['params_sql']['special']['multimedias_videos_associes_contact'] =
  2589.                         $vfiltres['params_sql']['special']['multimedias_videos_associes_contact'] = $this->idobject;
  2590.                     }
  2591.                 }
  2592.                 if (!empty($params['get_spectacles_with_critiques'])) {
  2593.                     $filtres[$kfiltres]['params_sql']['special']['contenus_associes_critiques'] =
  2594.                     $vfiltres['params_sql']['special']['contenus_associes_critiques'] = true;
  2595.                     // if($var_filtres != 'coprod'){
  2596.                     //     $filtres[$kfiltres]['params_sql']['special']['multimedias_videos_associes_contact'] =
  2597.                     //     $vfiltres['params_sql']['special']['multimedias_videos_associes_contact'] = $this->idobject;
  2598.                     // }
  2599.                 }
  2600.                 if (!empty($params['get_spectacles_coprod'])) {
  2601.                     $vfiltres['params_sql']['special']['coprod'] = $params['get_spectacles_coprod'];
  2602.                     $filtres[$kfiltres]['params_sql']['special']['coprod'] = $params['get_spectacles_coprod'];
  2603.                 }
  2604.                 if (!empty($filtres[$kfiltres]['unset'])) {
  2605.                     foreach ($filtres[$kfiltres]['unset'] as $ku => $vu) {
  2606.                         $ku explode(','$ku);
  2607.                         unset($filtres[$kfiltres]['params_sql'][$ku[0]][$ku[1]]);
  2608.                         unset($vfiltres['params_sql'][$ku[0]][$ku[1]]);
  2609.                     }
  2610.                 }
  2611.                 $filtre_sup '';
  2612.                 if ($v_filtre_type == 'audio') {
  2613.                     $vfiltres['params_sql']['special']['podcasts'] = [
  2614.                         'type_podcast' => 'franceculture',
  2615.                         'publish' => 1
  2616.                     ];
  2617.                     $filtre_sup '_audio';
  2618.                 }
  2619.                 //si c'est un choix multiples comme par exemple : aide,soutiens,selections,laureats_nominations
  2620.                 if (count($filtres_plus) > 1) {
  2621.                     foreach ($filtres_plus as $kk => $vv) {
  2622.                         $filtres_cp $filtres[$kfiltres];
  2623.                         if ($vv == "soutiens") {
  2624.                         // $filtres_cp['params_sql']['special']['by_classification'] = 103;
  2625.                             $filtres_cp['params_sql']['special']['spectacle_aide']['end'] = date('Y-m-d');
  2626.                         }
  2627.                         if (!empty($filtres_cp['params_sql']['special']['idspectacle'])) {
  2628.                             $filtres_cp['params_sql']['special']['idspectacle'] = $this->{'ids_spectacle_' $vv};
  2629.                         }
  2630.                         if (!empty($this->{'ids_spectacle_' $vv})) {
  2631.                             $total_spectacle_plus += $this->context['view']->{'nb_spectacles_' $vv $filtre_sup} = $this->em->getRepository(Spectacles::class)->countListSpectacles($filtres_cp['params_sql']);
  2632.                             //On applique le filtre des années/saisons/jours après avoir compter le nombre total de spectacle dans la « catégorie »
  2633.                             if ($this->context['params']['type'] == $vv && !empty($filtres_cp[$vv]['params_sql'])) {
  2634.                                 $vfiltres['params_sql'] = $this->setCommonSearchSpectacles($filtres_cp[$vv]['params_sql']);
  2635.                             }
  2636.                             //Pour la pagination
  2637.                             $this->context['view']->{'nb_spectacles_filtre_' $vv $filtre_sup} = $this->em->getRepository(Spectacles::class)->countListSpectacles($filtres_cp['params_sql']);
  2638.                             if (!empty($this->context['params']['type']) && $this->context['params']['type'] == $vv && $this->context['view']->{'nb_spectacles_' $vv} > 0) {
  2639.                                 $this->context['view']->type_spectacle $vv;
  2640.                                 $selected $vv;
  2641.                             }
  2642.                             $filtres[$vv] = $filtres_cp;
  2643.                         }
  2644.                     }
  2645.                 } else {
  2646.                     if (!empty($filtres[$kfiltres]['params_sql']['special']['idspectacle'])) {
  2647.                         if (!empty($this->{'ids_spectacle_' $var_filtres})) {
  2648.                             $vfiltres['params_sql']['special']['idspectacle'] = $this->{'ids_spectacle_' $var_filtres};
  2649.                             $filtres[$kfiltres]['params_sql']['special']['idspectacle'] = $this->{'ids_spectacle_' $var_filtres};
  2650.                         }
  2651.                     }
  2652.                     $this->context['view']->{'nb_spectacles_' $var_filtres $filtre_sup} = $this->em->getRepository(Spectacles::class)->countListSpectacles($vfiltres['params_sql']);
  2653.                     //On applique le filtre des années/saisons/jours après avoir compter le nombre total de spectacle dans la « catégorie »
  2654.                     if ($this->context['params']['type'] == $var_filtres && !empty($filtres[$var_filtres]['params_sql'])) {
  2655.                         $vfiltres['params_sql'] = $filtres[$var_filtres]['params_sql'] = $this->setCommonSearchSpectacles($filtres[$var_filtres]['params_sql'], true);
  2656.                     }
  2657.                     //Pour la pagination
  2658.                     $this->context['view']->{'nb_spectacles_filtre_' $var_filtres $filtre_sup} = $this->em->getRepository(Spectacles::class)->countListSpectacles($vfiltres['params_sql']);
  2659.                     if (!empty($this->context['view']->{'nb_spectacles_' $var_filtres $filtre_sup})) {
  2660.                         $total_spectacle += ((int)$this->context['view']->{'nb_spectacles_' $var_filtres $filtre_sup});
  2661.                         if (!empty($this->context['params']['type']) && in_array($this->context['params']['type'], explode(','$kfiltres)) && $this->context['view']->{'nb_spectacles_' $var_filtres $filtre_sup} > 0) {
  2662.                             $this->context['view']->type_spectacle $kfiltres;
  2663.                             $selected $kfiltres;
  2664.                         }
  2665.                     }
  2666.                 }
  2667.             }
  2668.         }
  2669.         $this->context['view']->nb_total_spectacle $total_spectacle $total_spectacle_plus;
  2670.         if (empty($this->context['view']->{'nb_spectacles_' $selected $filtre_sup}) && $this->context['view']->{'nb_spectacles_' $selected $filtre_sup} == 0) {
  2671.             foreach ($filtres as $kfiltres => $vfiltres) {
  2672.                 $filtres_plus explode(','$kfiltres);
  2673.                 if (count($filtres_plus) > 1) {
  2674.                     foreach ($filtres_plus as $kk => $vv) {
  2675.                         if ($this->context['view']->{'nb_spectacles_' $vv} > 0) {
  2676.                             $this->context['view']->type_spectacle $vv;
  2677.                             $selected $vv;
  2678.                             break 1;
  2679.                         }
  2680.                     }
  2681.                 } else {
  2682.                     $test preg_replace('/-/''_'$kfiltres);
  2683.                     if (!empty($this->context['view']->{'nb_spectacles_' $test}) && $this->context['view']->{'nb_spectacles_' $test} > 0) {
  2684.                         $this->context['view']->type_spectacle $kfiltres;
  2685.                         $selected $kfiltres;
  2686.                         break 1;
  2687.                     }
  2688.                 }
  2689.             }
  2690.         }
  2691.         $this->context['view']->total_spectacle $total_spectacle;
  2692.         // print_r($this->context['view']);
  2693.         if (($total_spectacle || $total_spectacle_plus 0) && $execute_corps_page) {
  2694.             $this->context['view']->current_page 'spectacles';
  2695.             $this->context['view']->{'spectacles_' $selected} = true;
  2696.             $params_sql $filtres[$selected]['params_sql'];
  2697.             $params_sql['params']['limit'] = array($this->getLimitStart(), $this->perPage);
  2698.             $filtre_sup '';
  2699.             if (in_array('audio'$filtre_type)) {
  2700.                 $params_sql['special']['podcasts'] = [
  2701.                     'type_podcast' => 'franceculture',
  2702.                     'publish' => 1
  2703.                 ];
  2704.                 $filtre_sup '_audio';
  2705.             }
  2706.             $options_spectacles = [
  2707.                 'allauthors' => true,
  2708.                 'carrer_couleurs' => true
  2709.             ];
  2710.             //Suppression des carrer pour les appels ajax de la page
  2711.             if (!empty($_GET['v'])) {
  2712.                 unset($options_spectacles['carrer_couleurs']);
  2713.             }
  2714.             $spectacles $this->em->getRepository(Spectacles::class);
  2715.             $this->context['view']->spectacles $spectacles->getListSpectacles($params_sql$this->format_vignettefalse$options_spectacles);
  2716.             $this->context['view']->pagination $this->getPagination(
  2717.                 $this->context['view']->{'nb_spectacles_filtre_' $selected $filtre_sup},
  2718.                 $this->perPage,
  2719.                 [
  2720.                     //Nombre total des représentations pour cette liste de spectacles
  2721.                     'total_dates' => $spectacles->countListSchedules($params_sql),
  2722.                 ]
  2723.             );
  2724.             if (isset($this->redirectedFrom) && $this->redirectedFrom === 'emissions'){
  2725.                 $paramsSqlNoPerPage $params_sql;
  2726.                 unset($paramsSqlNoPerPage['params']['limit']);
  2727.                 $nbSpectacles $spectacles->countListSpectacles($paramsSqlNoPerPagefalse);
  2728.                 $this->context['view']->pagination $this->getPagination(
  2729.                     $nbSpectacles,
  2730.                     $this->perPage,
  2731.                     [
  2732.                         //Nombre total des représentations pour cette liste de spectacles
  2733.                         'total_dates' => $spectacles->countListSchedules($params_sql),
  2734.                     ]
  2735.                 );
  2736.                 $this->context['view']->pagination['totalItems'] = $nbSpectacles;
  2737.             } else {
  2738.                 $this->context['view']->pagination['totalItems'] = $this->context['view']->{'nb_spectacles_filtre_' $selected $filtre_sup};
  2739.             }
  2740.             $this->context['view']->pagination['spectacle'] = true;
  2741.             $this->context['view']->pagination['representation_spectacle'] = true;
  2742.             //on initialise tout ce qui est nécessaire à la vue
  2743.             if (!empty($filtres[$selected]['view'])) {
  2744.                 $params_view $filtres[$selected]['view'];
  2745.                 unset($params_view['special']);
  2746.                 if (!empty($params_view) && is_array($params_view)) {
  2747.                     foreach ($params_view as $k => $v) {
  2748.                         $this->context['view']->$k $v;
  2749.                     }
  2750.                 }
  2751.                 if (!empty($filtres[$selected]['view']['special'])) {
  2752.                     foreach ($this->context['view']->spectacles as $ks => $vs) {
  2753.                         foreach ($filtres[$selected]['view']['special'] as $kv => $vv) {
  2754.                             if ($kv == 'annee_creation') {
  2755.                                 if (!empty($this->context['view']->spectacles[$ks]['spectacle'])) {
  2756.                                     $this->context['view']->spectacles[$ks]['spectacle']['annee_creation'] = $this->em->getRepository(Spectacles::class)->getFormeDate($this->context['view']->spectacles[$ks]['spectacle']['creation_date'], '%Y'true); //%a %d/%m/%Y;
  2757.                                 } else {
  2758.                                     $this->context['view']->spectacles[$ks]['annee_creation'] = $this->em->getRepository(Spectacles::class)->getFormeDate($this->context['view']->spectacles[$ks]['creation_date'], '%Y'true); //%a %d/%m/%Y;
  2759.                                 }
  2760.                             } else {
  2761.                                 $this->context['view']->spectacles[$ks][$kv] = $vv;
  2762.                             }
  2763.                         }
  2764.                     }
  2765.                 }
  2766.             }
  2767.             $ListSeasonsYears null;
  2768.             $search_ids_spectacles = [];
  2769.             if (!empty($this->{'ids_spectacle_' $selected})) {
  2770.                 $search_ids_spectacles $this->{'ids_spectacle_' $selected};
  2771.             }
  2772.             if (!empty($params["get_spectacles_with_critiques"])) {
  2773.                 $critiqueParam true;
  2774.             } else {
  2775.                 $critiqueParam false;
  2776.             }
  2777.             if ($SpectaclesDates $this->getSpectaclesDates($critiqueParam$search_ids_spectacles)) {
  2778.                 $ListSeasonsYears $this->getListSeasonsYears($SpectaclesDates);
  2779.             }
  2780.             $this->getCommonSearch(array(
  2781.                     'inverse_periode' => true,
  2782.                     'saisons_annees' => $ListSeasonsYears,
  2783.                     'nb_days' => 1200,
  2784.                 )
  2785.             );
  2786.             $this->getCommonSearchView();
  2787.             if ((empty($params['get_spectacles_with_multimedias']) && empty($params['get_spectacles_with_critiques'])) && empty($params['get_spectacles_with_audios'])) {
  2788.                 // github issue #465 : retirer la recherche par période (ajout utilisation d'un booléen)
  2789.                 $this->getAsidesSpectacles(true);
  2790.             }
  2791.             return $this->view('contacts/spectacles.html.twig');
  2792.         }
  2793.         else {
  2794.             return $this->redirectToRoute("contact_view", [
  2795.                 "slug" => $this->slug
  2796.             ]);
  2797.         }
  2798.     }
  2799.     // }}}
  2800.     // {{{ action_contenu_pedagogique()
  2801.     /** Spectacles avec contenu pédagogiques
  2802.      *
  2803.      * @Route("/contacts/{slug}/contenu-pedagogique", name="contenu_pedagogique")
  2804.      *
  2805.      * @access public
  2806.      * @return void
  2807.      */
  2808.     public function action_contenu_pedagogique($slug null)
  2809.     {
  2810.         $this->InitController($slug'contenu-pedagogique');
  2811.         // contenus éduc
  2812.         $idclassification 125;
  2813.         // contrainte de recherche sur le contact
  2814.         $where_idcontact null;
  2815.         // auteur
  2816.         $idperson_author null;
  2817.         $ids_spectacle_in $this->obj->getSpectaclesIn($this->idobjectfalse$idclassification);
  2818.         $ids_spectacle_prod $this->obj->getSpectaclesProd($this->idobjectfalse$idclassification);
  2819.         // les spectacles DANS ce lieu
  2820.         $nb_spectacles_in count($ids_spectacle_in);
  2821.         $this->view->nb_spectacles_in $nb_spectacles_in;
  2822.         // pour afficher la colonne spectacle_in_or_jtn
  2823.         if (!empty($nb_spectacles_in)) {
  2824.             $this->view->spectacles_in_or_soutien true;
  2825.         }
  2826.         // les spectacles coproduits ou lieu de cré ou compagnie
  2827.         $nb_spectacles_prod count($ids_spectacle_prod);
  2828.         $this->view->nb_spectacles_prod $nb_spectacles_prod;
  2829.         $ids_spectacle_all array_unique(array_merge($ids_spectacle_prod$ids_spectacle_in));
  2830.         // si c'est le JTN (idcontact = 3914), trouver les spectacles avec cette classification
  2831.         // classification JTN => 103 => class_spectacle_jtn
  2832.         if (!empty($this->idclassification_soutien)) {
  2833.             $ids_spectacle_soutien $this->obj->getSpectaclesSoutien($this->idobjectfalse$idclassification);
  2834.             $nb_spectacles_soutien count($ids_spectacle_soutien);
  2835.             $this->view->nb_spectacles_soutien $nb_spectacles_soutien;
  2836.             // pour afficher la colonne spectacle_in_or_soutien
  2837.             if (empty($nb_spectacles_in)) {
  2838.                 $this->view->spectacles_in_or_soutien true;
  2839.             }
  2840.             $ids_spectacle_all array_unique(array_merge($ids_spectacle_all$ids_spectacle_soutien));
  2841.         }
  2842.         // si un des 2 nbs est sup à 30
  2843.         if ($nb_spectacles_in $this->nb_contact_recherche || $nb_spectacles_prod $this->nb_contact_recherche ||
  2844.             (!empty($nb_spectacles_soutien) && $nb_spectacles_soutien $this->nb_contact_recherche)) {
  2845.             $sql_from null;
  2846.             // trouver tous les metteurs en scènes associés aux spectacles de ce contact
  2847.             $directors $this->getSpectaclesDirectors($ids_spectacle_all);
  2848.             // liste des metteurs en scène
  2849.             if (!empty($directors)) {
  2850.                 foreach ($directors as $k => $v) {
  2851.                     $directors_tab[$v['idperson']] = mb_strtoupper($v['lastname'], 'utf8') . ' ' $v['firstname'];
  2852.                     if (!empty($_REQUEST['idperson_director']) && $v['idperson'] == $_REQUEST['idperson_director']) {
  2853.                         $this->view->search_director $v;
  2854.                     }
  2855.                 }
  2856.                 natsort($directors_tab);
  2857.                 $directors_tab[0] = 'Choisissez un metteur en scène...';
  2858. //                $this->context['form']->addElement('select', 'idperson_director', 'Metteurs en scène', $directors_tab, array('id' => 'idperson_director'));
  2859.                 // si on cherche un metteur en scène
  2860.                 if (!empty($_REQUEST['idperson_director']) && $this->func->my_is_int($_REQUEST['idperson_director'])
  2861.                     && !empty($directors_tab[$_REQUEST['idperson_director']])) {
  2862.                     $idperson_director = (int)$_REQUEST['idperson_director'];
  2863.                     $where_idcontact .= ' AND sp.idperson=' $idperson_director ' AND sp.idrole=1 ';
  2864.                 } else {
  2865. //                    $this->context['form']->setDefaults(array('idperson_director' => 0));
  2866.                 }
  2867.             }
  2868.             // trouver tous les auteurs associés aux spectacles de ce contact
  2869.             $authors $this->getSpectaclesAuthors($ids_spectacle_all);
  2870.             // liste des auteurs
  2871.             if (!empty($authors)) {
  2872.                 foreach ($authors as $k => $v) {
  2873.                     $authors_tab[$v['idperson']] = mb_strtoupper($v['lastname'], 'utf8') . ' ' $v['firstname'];
  2874.                     if (!empty($_REQUEST['idperson_author']) && $v['idperson'] == $_REQUEST['idperson_author']) {
  2875.                         $this->view->search_author $v;
  2876.                     }
  2877.                 }
  2878.                 natsort($authors_tab);
  2879.                 $authors_tab[0] = 'Choisissez un auteur...';
  2880. //                $this->context['form']->addElement('select', 'idperson_author', 'Auteurs', $authors_tab, array('id' => 'idperson_author'));
  2881.                 // si on cherche un auteur
  2882.                 if (!empty($_REQUEST['idperson_author']) && $this->func->my_is_int($_REQUEST['idperson_author'])
  2883.                     && !empty($authors_tab[$_REQUEST['idperson_author']])) {
  2884.                     $idperson_author = (int)$_REQUEST['idperson_author'];
  2885.                 } else {
  2886. //                    $this->context['form']->setDefaults(array('idperson_author' => 0));
  2887.                 }
  2888.             }
  2889.             // recherche une année ?
  2890.             $current_year $this->getYear();
  2891.             // une saison ?
  2892.             $saison $this->getSaison();
  2893.             // les dates des spectacles de tous les spectacles associés à ce contact
  2894.             $listdates $this->getSpectaclesDates(false$ids_spectacle_all);
  2895.             // récupérer la liste des années et des saisons et générer les listes déroulantes
  2896.             if (!empty($listdates)) {
  2897.                 $annees_saisons $this->getListSeasonsYears($listdates);
  2898.                 // liste des saisons
  2899.                 $this->view->saisons $annees_saisons['saisons'];
  2900.                 // liste des annees
  2901.                 $this->view->annees $annees_saisons['annees'];
  2902.                 $this->getCommonSearch([
  2903.                     'saisons_annees' => [
  2904.                         'saisons' => $annees_saisons['saisons'],
  2905.                         'annees' => $annees_saisons['annees'] + $annees_saisons['annees']
  2906.                     ]
  2907.                 ]);
  2908.                 $this->getCommonSearchView();
  2909.             }
  2910.             // si aucune recherche par person, par année ou par saison => recherche par saison
  2911.             // if(empty($current_year) && empty($saison) && empty($idperson_director) && empty($idperson_author)) {
  2912.             //     // prendre la dernière saison
  2913.             //     $saison = Date_time::getLastSaison($annees_saisons['saisons']);
  2914.             // }
  2915.             // recherche par saison
  2916.             if (!empty($saison)) {
  2917.                 $annees_saison explode('-'$saison);
  2918.                 if (count($annees_saison) == 2) {
  2919.                     $datestart Date_time::getSaisonDatestart((int)$annees_saison[0]);
  2920.                     $dateend Date_time::getSaisonDateend((int)$annees_saison[1]);
  2921.                 }
  2922.                 // saison de recherche
  2923.                 $this->view->saison $saison;
  2924.                 // saison précédente / suivante
  2925.                 $this->view->saisons_nav $this->getSaisonsNav($annees_saisons['saisons'], $saison);
  2926.                 $this->context['view']->booklets $this->em->getRepository(Files::class)->getBookletsBySaison($saison$this->idobject);
  2927.             }
  2928.             // annee
  2929.             if (!empty($current_year)) { // recherche par année
  2930.                 $datestart date('Y-m-d'mktime(00011$current_year));
  2931.                 $dateend date('Y-m-d'mktime(0001231$current_year));
  2932.                 // annee de recherche
  2933.                 $this->view->current_year $current_year;
  2934.             }
  2935.             // recherche période
  2936.             if (!empty($datestart) && !empty($dateend)) {
  2937.                 $where_idcontact .= ' AND sc.date BETWEEN \'' $datestart '\' AND \'' $dateend '\' ';
  2938.             }
  2939.         }
  2940.         // spectacles de ce contact à l'affiche en ce moment (s jours) => recherche sur le calendrier
  2941.         $spectacles_in $this->getListSpectaclesIn($where_idcontact$idperson_author, array('allauthors' => true), array(), $idclassification);
  2942.         if (!empty($spectacles_in)) {
  2943.             foreach ($spectacles_in as $k => $v) {
  2944.                 $idspectacles_in[$v['idspectacle']] = $v['idspectacle'];
  2945.                 $spectacles_in[$k]['url_clean_more'] = 'contenus-pedagogiques/';
  2946.             }
  2947.         }
  2948.         $this->view->nb_spectacles_in_saison count($spectacles_in);// nombre affiché
  2949.         // github issue #462 : afficher par ordre antéchronologique
  2950. //        $this->view->spectacles_in = $spectacles_in;
  2951.         $this->view->spectacles_in$this->sortSpectaclesByEndDate($spectacles_in);
  2952.         $sqlSchedules 'SELECT idcontact FROM schedules WHERE idcontact=' $this->idobject ' ' str_replace('sc.'''$where_idcontact);
  2953.         $subQuery $this->em->getConnection()->executeQuery($sqlSchedules);
  2954.         $resSubQuery $subQuery->fetchAll(\PDO::FETCH_COLUMN | \PDO::FETCH_ASSOC);
  2955.         $where_idcontact_tournee $where_idcontact '
  2956.             AND sc.idcontact NOT IN (' implode(','$resSubQuery) . ') ';
  2957.         $spectacles_prod $this->getListSpectaclesProd($where_idcontact_tournee$idperson_author, array('allauthors' => true), array(), $idclassification);
  2958.         // ajouter le lien
  2959.         if (!empty($spectacles_prod)) {
  2960.             foreach ($spectacles_prod as $k => $v) {
  2961.                 $spectacles_prod[$k]['url_clean_more'] = 'contenus-pedagogiques/';
  2962.             }
  2963.         }
  2964.         $this->view->spectacles_prod $spectacles_prod;
  2965.         $this->view->nb_spectacles_prod_saison count($spectacles_prod); // nombre affiché
  2966.         // les soutiens JTN
  2967.         if (!empty($nb_spectacles_soutien)) {
  2968.             $spectacles_soutien $this->getListSpectaclesSoutien($where_idcontact$idperson_author, array('allauthors' => true), array(), $idclassification);
  2969.             // ajouter le lien
  2970.             if (!empty($spectacles_soutien)) {
  2971.                 foreach ($spectacles_soutien as $k => $v) {
  2972.                     $spectacles_soutien[$k]['url_clean_more'] = 'contenus-pedagogiques/';
  2973.                 }
  2974.             }
  2975.             $this->view->spectacles_soutien $spectacles_soutien;
  2976.             $this->view->nb_spectacles_soutien_saison count($spectacles_soutien);
  2977.         }
  2978.         //  contact avec bcp de bordel => affichage avec moteur de recherche
  2979.         if ($nb_spectacles_in $this->nb_contact_recherche
  2980.             || $nb_spectacles_prod $this->nb_contact_recherche
  2981.             || (!empty($nb_spectacles_soutien) && $nb_spectacles_soutien $this->nb_contact_recherche)) {
  2982.             $this->view->big_contact true;
  2983.         }
  2984.         //$this->style_more[] = 'pageregion';
  2985.         // $menu_object['spectacles_in'] = array('nom' => 'Dans ce lieu ('.$this->view->nb_spectacles_in_saison.')');
  2986.         // $menu_object['spectacles_prod'] = array('nom' => 'Coproduction en tournée ('.$this->view->nb_spectacles_prod_saison.')');
  2987.         //
  2988.         // // menu courant actif
  2989.         // $menu_object[$this->context['action']]['active'] = 'on';
  2990.         // $first = reset(array_keys($menu_object));
  2991.         // $menu_object[$first]['first'] = true;
  2992.         //
  2993.         // $this->context['view']->menu_spectacles = $menu_object;
  2994.         // On supprime les mentions mise en scene, les dates et ville
  2995.         foreach ($this->context['view']->spectacles_in as $k => $v) {
  2996.             $this->context['view']->spectacles_in[$k]['no_date'] = true;
  2997.             $this->context['view']->spectacles_in[$k]['footer_date'] = true;
  2998.         }
  2999.         // github issue #462 : ne pas afficher la recherche par période
  3000.         $this->context['view']->noPeriodSearch true;
  3001.         $menu_urls = array(
  3002.             'contenu-pedagogique' => array(
  3003.                 'name' => 'Tous les spectacles',
  3004.                 'key_page' => 'contenu-pedagogique'
  3005.             )
  3006.         );
  3007.         //aside
  3008.         $this->asides->load(['contact_contenu_educ' => array(
  3009.             'php' => array(
  3010.                 'method' => 'asidesUrlLists',
  3011.                 'urls' => $menu_urls,
  3012.                 'url' => '/contacts/key_url_clean/key_page',
  3013.                 'params' => array(
  3014.                     'key_url_clean' => $this->context['view']->url_clean,
  3015.                     'key_page' => 'auto_key',
  3016.                     'activate' => (empty($saison)) ? $this->context['action'] : false
  3017.                 )
  3018.             )
  3019.         )]);
  3020.         $this->asides->load(['common_participer_contacts' => array(
  3021.             'exec' => array(
  3022.                 'color' => 'educ'
  3023.             )
  3024.         )]);
  3025.         return $this->view('contacts/contenu-pedagogique.html.twig');
  3026.     }
  3027.     // }}}
  3028.     // {{{ action_critiques()
  3029.     /** Critiques des spectacles dans le lieu
  3030.      *
  3031.      * @Route("/contacts/{slug}/critiques", name="contact_critiques")
  3032.      * @Route("/contacts/{slug}/critiques/type/{p_type}", name="contact_critiques_type")
  3033.      *
  3034.      * @access public
  3035.      * @return void
  3036.      */
  3037.     public function action_critiques($slug null$p_type null)
  3038.     {
  3039.         $this->context['params']['type'] = $p_type;
  3040.         $this->InitController($slug'critiques');
  3041.         $this->action_spectacles($slugtrue, [
  3042.             'get_spectacles_with_critiques' => true
  3043.         ]);
  3044.         $critiques_spectacles = array(
  3045.             'in' => array(
  3046.                 'name' => 'Spectacles à venir',
  3047.                 'key' => 'in',
  3048.                 'count' => $this->context['view']->nb_spectacles_in
  3049.             ),
  3050.             'anciens' => array(
  3051.                 'name' => 'Spectacles passés',
  3052.                 'key' => 'anciens',
  3053.                 'count' => $this->context['view']->nb_spectacles_anciens
  3054.             ),
  3055.             'coprod' => array(
  3056.                 'name' => 'Production en scène',
  3057.                 'key' => 'coprod',
  3058.                 'count' => $this->context['view']->nb_spectacles_coprod
  3059.             ),
  3060.             'prod' => array(
  3061.                 'name' => 'Toutes les produtions',
  3062.                 'key' => 'prod',
  3063.                 'count' => $this->context['view']->nb_spectacles_prod
  3064.             ),
  3065.             'diffusions' => array(
  3066.                 'name' => 'Diffusés',
  3067.                 'key_type' => 'diffusions',
  3068.                 'count' => $this->context['view']->nb_spectacles_diffusions
  3069.             )
  3070.         );
  3071.         $idobject $this->idobject;
  3072.         if (in_array($this->context['view']->type_spectacle, ['coprod'])) {
  3073.             $idobject null;
  3074.         }
  3075.         if (!empty($this->context['view']->spectacles)) {
  3076.             foreach ($this->context['view']->spectacles as $k => $s) {
  3077.                 $this->context['view']->spectacles[$k]['critiques'] = $this->em->getRepository(Contents::class)->countAssociateContent('spectacles'$s['idspectacle'], 'class_critique', array('publish_valid' => 1));
  3078.                 if (!in_array($this->context['view']->type_spectacle, ['coprod'])) {
  3079.                     unset($this->context['view']->spectacles[$k]['city']);
  3080.                 }
  3081.                 if (!empty($annees_saisons)) {
  3082.                     $this->context['view']->spectacles[$k]['no_date'] = true;
  3083.                 }
  3084.             }
  3085.         }
  3086.         // asides
  3087.         $this->asides->load(['url_lists,filtre_critiques' => array(
  3088.             'exec' => array(
  3089.                 'color' => 'critiques',
  3090.                 'htmlstart' => true,
  3091.                 'htmlend' => ($this->context['view']->type_spectacle == 'anciens') ? false true
  3092.             ),
  3093.             'php' => array(
  3094.                 'method' => 'asidesUrlLists',
  3095.                 'urls' => $critiques_spectacles,
  3096.                 'url' => '/contacts/key_url_clean/critiques/type/key_url',
  3097.                 'params' => array(
  3098.                     'key_url_clean' => $this->context['view']->url_clean,
  3099.                     'key_url' => 'auto_key',
  3100.                     'activate' => $this->context['view']->type_spectacle
  3101.                 )
  3102.             ),
  3103.             'title' => html_entity_decode('&Agrave; l\'affiche'),
  3104.         )]);
  3105.         if ($this->context['view']->type_spectacle == 'anciens') {
  3106.             $this->asides->load(['par_saison' => array(
  3107.                 'exec' => array(
  3108.                     'htmlend' => true,
  3109.                     'color' => 'critiques'
  3110.                 ),
  3111.                 'php' => array(
  3112.                     'method' => 'asidesUrlListsForms',
  3113.                     'url' => '/contacts/{v_url_clean}/critiques/type/anciens',
  3114.                 ),
  3115.                 'title' => 'Recherche par saison'
  3116.             )]);
  3117.         }
  3118.         $this->asides->load(['common_participer_contacts' => array(
  3119.             'exec' => ['color' => 'critiques']
  3120.         )]);
  3121.         return $this->view('contacts/critiques.html.twig');
  3122.     }
  3123.     // }}}
  3124.     // {{{ action_api()
  3125.     /** Spectacles de la structure
  3126.      *
  3127.      *
  3128.      * @access public
  3129.      * @return void
  3130.      */
  3131.     public function action_api($api_data true)
  3132.     {
  3133.         $datas null;
  3134.         $where_idcontact null;
  3135.         // recherche de spectacles
  3136.         if (!empty($this->context['params']['spectacles']) || array_key_exists('authors'$this->context['params'])) {
  3137.             // inactif pour le moment
  3138.             $idperson_author null;
  3139.             // par défaut, recherche sur la saison si aucune demande
  3140.             if (!$this->isSearchPeriod() && !$this->isSearchSeason()) {
  3141.                 // les dates des spectacles de tous les spectacles associés à ce contact
  3142.                 $listdates $this->getSpectaclesDates();
  3143.                 // récupérer la dernière saison
  3144.                 if (!empty($listdates)) {
  3145.                     $saison Date_time::getLastSaison($this->getListSeasonsYears($listdates'saisons'));
  3146.                     // récupèrer le début et la fin de cette saison
  3147.                     $annees_saison explode('-'$saison);
  3148.                     // remplier search_period
  3149.                     if (count($annees_saison) == 2) {
  3150.                         $this->setSearchPeriod(Date_time::getSaisonDatestart((int)$annees_saison[0]), Date_time::getSaisonDateend((int)$annees_saison[1]));
  3151.                     }
  3152.                 }
  3153.             }
  3154.             // une saison ?
  3155.             if ($this->isSearchSeason()) {
  3156.                 // récupèrer le début et la fin de cette saison
  3157.                 $annees_saison explode('-'$this->getSeason());
  3158.                 // remplier search_period
  3159.                 if (count($annees_saison) == 2) {
  3160.                     $this->setSearchPeriod(Date_time::getSaisonDatestart((int)$annees_saison[0]), Date_time::getSaisonDateend((int)$annees_saison[1]));
  3161.                 }
  3162.             }
  3163.             // les saisons avec des spectacles
  3164.             if (isset($_REQUEST['get_seasons']) && count($this->ids_spectacle_all) > 0) {
  3165.                 if (!empty($listdates)) {
  3166.                     $saisons_annees $this->getListSeasonsYears($listdates);
  3167.                 } else {
  3168.                     $saisons_annees $this->getListSeasonsYears($this->getSpectaclesDates());
  3169.                 }
  3170.                 return $saisons_annees;
  3171.             }
  3172.             // maintenant c'est OK
  3173.             if ($this->isSearchPeriod()) {
  3174.                 $where_idcontact ' AND sc.date BETWEEN \'' $this->getFromPeriod() . '\' AND \'' $this->getToPeriod() . '\' ';
  3175.             }
  3176.         }
  3177.         if (!empty($this->context['params']['spectacles'])) {
  3178.             // spectacles soutenus par une aide de la structure
  3179.             if ($this->context['params']['spectacles'] == 'aide' && count($this->ids_spectacle_aide) > 0) {
  3180.                 // uniquement les saisons qui présentent des aides
  3181.                 if (isset($_REQUEST['get_seasons'])) {
  3182.                     return $this->getListSeasonsYears($this->getSpectaclesDates(false$this->ids_spectacle_aide));
  3183.                 }
  3184.                 $datas $this->getListSpectaclesAide($where_idcontact$idperson_author, array('api' => $api_data));
  3185.             }
  3186.             // spectacles joués dans ce lieu (défaut = saison courante)
  3187.             if ($this->context['params']['spectacles'] == 'in' || $this->context['params']['spectacles'] == 'publisher') {
  3188.                 $this->setOrder("ASC");
  3189.                 if (!empty($_REQUEST['order'])) {
  3190.                     $this->setOrder($_REQUEST['order']);
  3191.                 }
  3192.                 // uniquement les saisons qui présentent des spectacles joués dans le lieu
  3193.                 if (isset($_REQUEST['get_seasons']) && count($this->ids_spectacle_in) > 0) {
  3194.                     return $this->getListSeasonsYears($this->getSpectaclesDates(false$this->ids_spectacle_in));
  3195.                 }
  3196.                 $datas $this->getListSpectaclesIn($where_idcontact$idperson_author, array('api' => $api_data));
  3197.             }
  3198.             // Productteur (17), coprod (18), prod délégué (19). Recherche sur spectacle_contact+idrole
  3199.             // spectacles coproduits par ce lieu (défaut = saison courante)
  3200.             if ($this->context['params']['spectacles'] == 'prod' && count($this->ids_spectacle_prod) > 0) {
  3201.                 // uniquement les saisons qui présentent des spectacles prod/coprod
  3202.                 if (isset($_REQUEST['get_seasons'])) {
  3203.                     return $this->getListSeasonsYears($this->getSpectaclesDates(false$this->ids_spectacle_prod));
  3204.                 }
  3205.                 $datas $this->getListSpectaclesProd($where_idcontact$idperson_author, array('api' => $api_data));
  3206.             }
  3207.             // anciens élèves
  3208.             if ($this->context['params']['spectacles'] == 'eleve') {
  3209.                 $datas $this->getListSpectaclesEleve($where_idcontact$idperson_author, array('api' => $api_data));
  3210.             }
  3211.             // les soutiens JTN (défaut : saison courante)
  3212.             if (!empty($this->idclassification_soutien)) {
  3213.                 if ($this->context['params']['spectacles'] == 'soutien' && count($this->ids_spectacle_soutien) > 0) {
  3214.                     // uniquement les saisons qui présentent des spectacles soutenus
  3215.                     if (isset($_REQUEST['get_seasons'])) {
  3216.                         return $this->getListSeasonsYears($this->getSpectaclesDates(false$this->ids_spectacle_soutien));
  3217.                     }
  3218.                     $datas $this->getListSpectaclesSoutien($where_idcontact$idperson_author, array('api' => $api_data));
  3219.                 }
  3220.             }
  3221.             // spectacles avec l'aide d'une structure en particulier sur les textes
  3222.             if ($this->context['params']['spectacles'] == 'partners') {
  3223.                 $datas $this->getListSpectaclesTextAideContact($where_idcontact$idperson_author, array('api' => $api_data));
  3224.             }
  3225.             // infos de base
  3226.         } else {
  3227.             $datas = array(
  3228.                 array(
  3229.                     'name' => $this->infosobject['organisation'],
  3230.                     'permanent_url' => $_ENV['URL_THNET'] . '/contacts/' $this->infosobject['url_clean'] . '/',
  3231.                     'country' => $this->infosobject['country']
  3232.                 )
  3233.             );
  3234.             // ajouter les infos complémentaires
  3235.             if (!empty($GLOBALS['api']['data']) && $GLOBALS['api']['data'] == 'extended') {
  3236.                 $field_more = array(
  3237.                     'id' => 'idcontact',
  3238.                     'subtitle' => 'nom_suite',
  3239.                     'address' => 'address1',
  3240.                     'address_more' => 'address2',
  3241.                     'zip' => 'zip',
  3242.                     'city' => 'city',
  3243.                     'country' => 'country',
  3244.                     'phone' => array(
  3245.                         'general' => 'phone1',
  3246.                         'booking' => 'phone2',
  3247.                     ),
  3248.                     'website' => 'url',
  3249.                     'geo' => array(
  3250.                         'x' => 'x',
  3251.                         'y' => 'y',
  3252.                     ),
  3253.                 );
  3254.                 // parcourir
  3255.                 foreach ($field_more as $k => $v) {
  3256.                     if (is_array($v)) {
  3257.                         foreach ($v as $kb => $vb) {
  3258.                             $datas[0][$k][$kb] = $this->infosobject[$vb];
  3259.                         }
  3260.                     } else {
  3261.                         $datas[0][$k] = $this->infosobject[$v];
  3262.                     }
  3263.                 }
  3264.             }
  3265.         }
  3266.         // recherche de personnes
  3267.         if (array_key_exists('authors'$this->context['params'])) {
  3268.             // les auteurs de la maison d'édition
  3269.             $persons $this->em->getRepository(Persons::class);
  3270.             $param_sql_persons = array(
  3271.                 'special' => array(
  3272.                     'contacts' => array(
  3273.                         'publishers' => array($this->idobject)
  3274.                     )
  3275.                 ),
  3276.                 'params' => array(
  3277.                     'limit' => array(01000)
  3278.                 ),
  3279.                 'dbg' => array('api_contacts_authors''Liste des auteurs associes a l\'editeur')
  3280.             );
  3281.             $datas $persons->getListPersons($param_sql_persons);
  3282.             if (!empty($datas)) {
  3283.                 foreach ($datas as $k => $v) {
  3284.                     $idpersons[$v['idperson']] = $v['idperson'];
  3285.                 }
  3286.             }
  3287.             // spectacles associés à ces personnes
  3288.             if ($this->context['params']['authors'] == 'spectacles' && !empty($idpersons)) {
  3289.                 $spectacles $this->em->getRepository(Spectacles::class);
  3290.                 $params_sql = array(
  3291.                     'special' => array(
  3292.                         'join_person' => array(
  3293.                             'idperson_authors_roles' => $idpersons
  3294.                         )
  3295.                     ),
  3296.                     'params' => array(
  3297.                         'where' => $where_idcontact ' AND s.`publish`=1 ',
  3298.                         'limit' => $this->getLimit(nulltrue),
  3299.                     ),
  3300.                     'dbg' => array('api_contacts_authors_spectacles''Spectacles avec ces personnes comme auteur/metteur ou autre')
  3301.                 );
  3302.                 if ($this->isSearchArea()) {
  3303.                     $spectacles->setZoneRecherche($this->em->getRepository(Regions::class)->getZipCode($this->getArea())); // définir la zone de recherche
  3304.                     $params_sql['special']['carte_version'] = 'bigregions';
  3305.                     $params_sql['special']['area'] = $this->getArea();
  3306.                 }
  3307.                 $datas $spectacles->getListSpectacles($params_sql$this->format_vignettefalse, array('api' => $api_data));
  3308.                 // noter les auteurs de l'éditeur
  3309.                 foreach ($datas as $k => $v) {
  3310.                     if (!empty($v['authors'])) {
  3311.                         foreach ($v['authors'] as $kb => $vb) {
  3312.                             if (isset($_REQUEST['get_person_illustration'])) {
  3313.                                 $datas[$k]['authors'][$kb]['poster'] = $persons->getVignettePerson($kb, array('width' => 800'height' => 800'direction' => 'thumb'), true);
  3314.                             }
  3315.                             if (array_key_exists($kb$idpersons)) {
  3316.                                 $datas[$k]['authors'][$kb]['is_publisher_author'] = true;
  3317.                             }
  3318.                         }
  3319.                     }
  3320.                     if (!empty($v['directors'])) {
  3321.                         foreach ($v['directors'] as $kb => $vb) {
  3322.                             if (isset($_REQUEST['get_person_illustration'])) {
  3323.                                 $datas[$k]['directors'][$kb]['poster'] = $persons->getVignettePerson($kb, array('width' => 800'height' => 800'direction' => 'thumb'), true);
  3324.                             }
  3325.                             if (array_key_exists($kb$idpersons)) {
  3326.                                 $datas[$k]['directors'][$kb]['is_publisher_author'] = true;
  3327.                             }
  3328.                         }
  3329.                     }
  3330.                 }
  3331.             }
  3332.         }
  3333.         return $datas;
  3334.     }
  3335.     // }}}
  3336.     // {{{ action_evenements()
  3337.     /** Evenements et spectacles proposé par les internautes
  3338.      *
  3339.      * @Route("/contacts/{slug}/evenements", name="contact_evenements")
  3340.      *
  3341.      * @access public
  3342.      * @return void
  3343.      */
  3344.     public function action_evenements($slug null)
  3345.     {
  3346.         $this->InitController($slug'evenements');
  3347.         $this->context['view']->is_description true;
  3348.         // les évènements
  3349.         $news $this->em->getRepository(News::class);
  3350.         $news_params = array(
  3351.             'params' => array(
  3352.                 'limit' => array(0200),
  3353.             ),
  3354.             'special' => array(
  3355.                 'publish_valid' => true,
  3356.                 'by_object' => array('idcontact' => $this->idobject),
  3357.             ),
  3358.         );
  3359.         // trouver 7 prochains évènements
  3360.         // si pas de 7 prochains, trouver 7 anciens
  3361.         foreach (array('news''spectacles') as $t) {
  3362.             $news_list = array();
  3363.             $news_params['special']['type_news'] = $t;
  3364.             foreach (array('prochains''anciens') as $d) {
  3365.                 if ($d == 'anciens' && !empty($_GET['v']) && $_GET['v'] == 'ajax') {
  3366.                     $news_params['params']['limit'] = array(03);
  3367.                 } else {
  3368.                     $news_params['params']['limit'] = array(0200);
  3369.                 }
  3370.                 $news_params['dbg'] = array('news_' $d'Liste des news ' $d);
  3371.                 $news_params['special'][$d] = true;
  3372.                 if (!empty($exclude_news)) {
  3373.                     $news_params['params']['where'] = ' AND T1.idnew NOT IN (' join(','$exclude_news) . ') ';
  3374.                 }
  3375.                 $news_list[$d] = $news->getListNews($news_params);
  3376.                 if (!empty($news_list[$d])) {
  3377.                     // liste d'exclusion => pas de en cours dans les anciens
  3378.                     foreach ($news_list[$d] as $k => $v) {
  3379.                         $exclude_news[$k] = $v['idnew'];
  3380.                     }
  3381.                     $this->view->{'is_news_list_' $t} = true;
  3382.                 }
  3383.                 unset($news_params['special'][$d]);
  3384.             }
  3385.             $this->view->{'news_list_' $t} = $news_list;
  3386.         }
  3387.         // page en cours
  3388.         $this->view->from_page $this->url_folder '/evenements/';
  3389.         //asides
  3390.         $this->asides->load(['common_participer_contacts' => array(
  3391.             'exec' => ['color' => 'evenements']
  3392.         )]);
  3393.         return $this->view('contacts/evenements.html.twig');
  3394.     }
  3395.     // }}}
  3396.     // {{{ action_dvd()
  3397.     /** Liste des DVDs VOD associés à des spectacles coproduits par le contact TODO
  3398.      *
  3399.      * @Route("/contacts/{slug}/dvd", name="contact_dvd")
  3400.      *
  3401.      * @access public
  3402.      * @return void
  3403.      */
  3404.     public function action_dvd($slug nullImages $images)
  3405.     {
  3406.         $this->InitController($slug'dvd');
  3407.         //On récupères le total des spectacles avec vidéos
  3408.         $this->action_spectacles($slugtrue, [
  3409.             'get_spectacles_with_multimedias' => true
  3410.         ]);
  3411.         //On récupère la liste des DVDS
  3412.         $this->view->list_dvds $this->getDvds();
  3413.         $this->getAsidesVideos(null);
  3414.         return $this->view('contacts/dvd.html.twig');
  3415.     }
  3416.     // }}}
  3417.     // {{{ action_autorisation()
  3418.     /** Demander à l'utilisateur s'il possède l'autorisation de modifier la page contact
  3419.      *
  3420.      * @Route("/contacts/{slug}/autorisation", name="contact_autorisation")
  3421.      *
  3422.      */
  3423.     public function action_autorisation($slug nullUploadUtils $edit_utilsFilesController $files_utilsRequest $request)
  3424.     {
  3425.         $GLOBALS['rub_courante'] = 'contacts';
  3426.         $this->InitController($slug'detail-contact');
  3427.         if ($this->getUser() instanceof Extranetusers) {
  3428.             // paramètre d'instanciation
  3429.             $params_edit = array(
  3430.                 'idobject' => $this->idobject,
  3431.                 'object' => 'contacts',
  3432.                 'page' => 'contacts',
  3433.             );
  3434.             $url_redirect '/' $params_edit['page'] . '/' $this->infosobject['urlClean'] . '/';
  3435.             // controlleur pour l'edition
  3436.             $edit_utils->load($this->context$params_edit);
  3437.             // les droits
  3438.             $object_rights $edit_utils->checkObjectRights();
  3439.             $this->view->object_rights $object_rights;
  3440.             // checker si la personne connectée à les droits sur cette fiche
  3441.             if (!empty($object_rights['update'])) {
  3442.                 return $this->redirect($url_redirect 'presentation-edit/'); // rediriger sur la page d'édition
  3443.             } elseif (!empty($object_rights['wait'])) {
  3444.                 // si success, afficher le message d'attente
  3445.                 if (isset($_GET['success'])) {
  3446.                     $this->view->success true;
  3447.                     $this->view->extranetuser_email $this->getUser()->getEmail();
  3448.                 } else {
  3449.                     return $this->redirect($url_redirect 'presentation/'); // rediriger sur la page de présentatio où il y a le message wait
  3450.                 }
  3451.             } else { // sinon, form de demande de droits
  3452.                 $this->context['formFactory'] = $this->get('form.factory')->createBuilder(FormType::class, null, [
  3453.                     'attr' => [
  3454.                         'id' => 'masterform',
  3455.                         'novalidate' => true
  3456.                     ]
  3457.                 ]);
  3458.                 // formulaire
  3459.                 $this->context['formFactory']->add('himself'CheckboxType::class, [
  3460.                     'label' => '« Je représente ' $this->infosobject['organisation'] . ' »',
  3461.                     'required' => false,
  3462.                 ]);
  3463.                 $this->view->is_contact true;
  3464.                 $constraints = [];
  3465.                 if (empty($_POST['form']['himself'])) {
  3466.                     $constraints = [
  3467.                         new NotBlank([
  3468.                             'message' => 'Justification : vous devez justifier votre demande'
  3469.                         ])
  3470.                     ];
  3471.                 }
  3472.                 $this->context['formFactory']->add('justification'TextareaType::class, [
  3473.                     'label' => 'Justification',
  3474.                     'required' => false,
  3475.                     'constraints' => $constraints,
  3476.                     'attr' => [
  3477.                         'rows' => 5,
  3478.                         'cols' => 100
  3479.                     ]
  3480.                 ]);
  3481.                 $this->context['formFactory']->add('validation'SubmitType::class, [
  3482.                     'label' => 'Envoyer la demande',
  3483.                     'attr' => [
  3484.                         'class' => 'boutform'
  3485.                     ]
  3486.                 ]); // validation
  3487.                 $this->context['form'] = $this->context['formFactory']->getForm();
  3488.                 $this->context['form']->handleRequest($request);
  3489.                 // le nom et l'url pour le template autorisation
  3490.                 $this->view->fullname $this->infosobject['fullname'];
  3491.                 // url_folder
  3492.                 $this->infosobject['url_folder'] = '/' $this->type_object '/' $this->infosobject['url_clean'];
  3493.                 // url du dossier
  3494.                 $this->url_folder $this->infosobject['url_folder'];
  3495.                 $this->view->url_folder $this->infosobject['url_folder'];
  3496.                 if ($this->context['form']->isSubmitted() && $this->context['form']->isValid()) {
  3497.                     //=> enregistrer dans person_extranetuser
  3498.                     $himself $this->context['form']->get('himself')->getData();
  3499.                     // droits à 15 ==> autoriser directement / 8 ==> attente
  3500.                     $type_right 15;
  3501.                     if (!empty($himself)) {
  3502.                         $motif 'Je représente ' $this->view->fullname;
  3503.                     } else {
  3504.                         $motif $this->context['form']->get('justification')->getData();
  3505.                     }
  3506.                     $edit_utils->setRights($type_right, array('justification' => $motif'status' => 1));
  3507.                     // envoyer le mail à l'admin
  3508.                     if ($type_right == 8) {
  3509.                         $edit_utils->sendAlerte($this->context['view']->data_object['idcontact'], 'access'$this->context['form']->exportValue('justification'));
  3510.                     }
  3511.                     // rediriger sur cette page avec le message d'attente
  3512.                     return $this->redirect($url_redirect 'autorisation/?success');
  3513.                 }
  3514.             }
  3515.         } else { // personne non loguée
  3516.             // rediriger vers montheatre/connexion
  3517.             return $this->redirectToRoute('app_login', ['urifrom' => '/contacts/' $this->context['view']->url_clean '/presentation-edit/''entete_connexion' => 'contacts']);
  3518.         }
  3519.         $this->extra_locate $this->extra_title 'Autorisation de modification';
  3520.         return $this->view('contacts/autorisation.html.twig', [
  3521.             'form' => $this->context['form']->createView()
  3522.         ]);
  3523.     }
  3524.     // }}}
  3525.     // {{{ action_etudiants()
  3526.     /** Les étudiants
  3527.      *
  3528.      * @Route("/contacts/{slug}/etudiants", name="contact_etudiants")
  3529.      *
  3530.      */
  3531.     public function action_etudiants($slug nullEcoles $ecolesEcolesController $ecoles_folder)
  3532.     {
  3533.         $this->InitController($slug'laureats');
  3534.         if ($this->em->getRepository(PersonEcole::class)->countEleves($this->infosobject['idcontact'], ['current' => true]) == 0) {
  3535.             return $this->redirectToRoute('contact_anciens_etudiants', ['slug' => $this->context['view']->url_clean]);
  3536.         }
  3537.         $ecoles_folder->action_etudiants($ecoles, [
  3538.             'idcontact' => $this->idobject,
  3539.             'stop_execute' => true
  3540.         ]);
  3541.         $this->view = (object)array_merge((array)$this->view, (array)$ecoles_folder->view);
  3542.         $this->context array_merge($this->context$ecoles_folder->context);
  3543.         $this->context['view']->page $this->url_folder '/etudiants';
  3544.         $this->context['view']->affiche_ecole false;
  3545.         $this->extra_locate $this->extra_title 'Étudiants actuellement inscrits';
  3546.         $this->context['view']->voir_tous_etudiants true;
  3547.         //aside
  3548.         $this->getAsidesEtudiants('etudiants');
  3549.         $this->asides->load(['ecoles_with_photos' => array(
  3550.             'exec' => array(
  3551.                 'htmlstart' => true,
  3552.             ),
  3553.             'title_sub' => (isset($this->view->is_jtn) && $this->view->is_jtn) ? 'Artistes' 'Type d\'affichage',
  3554.         )]);
  3555.         $this->asides->load(['ecoles_promotions_encours' => array(
  3556.             'exec' => array(
  3557.                 'alone' => false
  3558.             ),
  3559.             'php' => array(
  3560.                 'method' => 'asidesUrlLists',
  3561.                 'urls' => $this->context['view']->annees,
  3562.                 'url' => 'key_page/y/key_year/photo/key_photos',
  3563.                 'params' => array(
  3564.                     'annee' => 'auto_key',
  3565.                     'key_page' => $this->context['view']->page,
  3566.                     'key_photo' => $this->context['view']->photos,
  3567.                 )
  3568.             ),
  3569.             'title' => (isset($this->view->is_jtn) && $this->view->is_jtn) ? 'Promotions' 'Promotions en cours d\'étude',
  3570.         )]);
  3571.         $titre_ecole_roles 'Tri par section';
  3572.         $titre_ecole_roles .= (!empty($this->context['view']->annee_promo)) ? 'pour la promo ' $this->context['view']->annee_promo '';
  3573.         $this->asides->load(['ecoles_roles' => array(
  3574.             'exec' => array(
  3575.                 'htmlend' => true
  3576.             ),
  3577.             'title' => $titre_ecole_roles,
  3578.         )]);
  3579.         $this->asides->load('ecoles_modifier');
  3580.         return $this->view('contacts/etudiants.html.twig');
  3581.     }
  3582.     // }}}
  3583.     /** Les anciens étudiants
  3584.      *
  3585.      * @Route("/contacts/{slug}/anciens-etudiants", name="contact_anciens_etudiants")
  3586.      */
  3587.     public function action_anciens_etudiants(
  3588.         $slug null,
  3589.         Ecoles $ecoles,
  3590.         EcolesController $ecoles_folder,
  3591.         FormFactoryInterface $formFactory
  3592.     )
  3593.     {
  3594.         $this->InitController($slug'etudiants');
  3595.         $ecoles_folder->action_anciens(
  3596.             $ecoles,
  3597.             [
  3598.                 'idcontact' => $this->idobject,
  3599.                 'stop_execute' => true
  3600.             ],
  3601.             nullnullnull,
  3602.             $formFactory
  3603.         );
  3604.         $this->view = (object)array_merge((array)$this->view, (array)$ecoles_folder->view);
  3605.         $this->context array_merge($this->context$ecoles_folder->context);
  3606.         $this->context['view']->page $this->url_folder '/anciens-etudiants';
  3607.         $this->context['view']->affiche_ecole false;
  3608.         if (isset($this->view->is_jtn) && $this->view->is_jtn) {
  3609.             $this->extra_locate $this->extra_title 'Anciens artistes JTN';
  3610.         } else {
  3611.             $this->extra_locate $this->extra_title 'Anciens étudiants';
  3612.         }
  3613.         //asides
  3614.         $this->getAsidesEtudiants('anciens-etudiants');
  3615.         $this->asides->load(['ecoles_with_photos' => [
  3616.             'exec' => [
  3617.                 'htmlstart' => true
  3618.             ],
  3619.             'title_sub' => html_entity_decode('Type d\'affichage'),
  3620.         ]]);
  3621.         $this->asides->load(['recherche_promotion' => [
  3622.             'exec' => [
  3623.                 'htmlstart' => true,
  3624.                 'htmlend' => true
  3625.             ],
  3626.             'action' => '/contacts/' $this->view->url_clean '/anciens-etudiants',
  3627.             'title_sub' => 'choisir une promotion'
  3628.         ]]);
  3629.         $this->asides->load(['ecoles_roles' => [
  3630.             'exec' => [
  3631.                 'htmlend' => true
  3632.             ],
  3633.             'title' => 'Tri par section pour la promo',
  3634.         ]]);
  3635.         $this->asides->load('ecoles_modifier');
  3636.         return $this->view('contacts/anciens-etudiants.html.twig');
  3637.     }
  3638.     // {{{ action_etudiants_spectacles()
  3639.     /** Les anciens étudiants
  3640.      *
  3641.      * @Route("/contacts/{slug}/etudiants-spectacles/", name="contact_etudiants_spectacles")
  3642.      *
  3643.      */
  3644.     public function action_etudiants_spectacles($slug nullEcoles $ecolesEcolesController $ecoles_folder)
  3645.     {
  3646.         $this->InitController($slug'etudiants-spectacles');
  3647.         $ecoles_folder->action_anciens_affiche($ecoles, [
  3648.             'idcontact' => $this->idobject,
  3649.             'stop_execute' => true
  3650.         ]);
  3651.         $this->view = (object)array_merge((array)$this->view, (array)$ecoles_folder->view);
  3652.         $this->context array_merge($this->context$ecoles_folder->context);
  3653.         $this->context['view']->page $this->url_folder '/etudiants-spectacles';
  3654.         $this->context['view']->affiche_ecole false;
  3655.         if (isset($this->view->is_jtn) && $this->view->is_jtn) {
  3656.             $this->extra_locate $this->extra_title 'Anciens artistes à l\'affiche';
  3657.         } else {
  3658.             $this->extra_locate $this->extra_title 'Anciens étudiants à l\'affiche';
  3659.         }
  3660.         $this->action_spectacles($slugfalse);
  3661.         //asides
  3662.         $this->getAsidesSpectacles('etudiants-spectacles');
  3663.         $this->asides->load(['ecoles_with_photos' => array(
  3664.             'title' => html_entity_decode('Filtres'),
  3665.         )]);
  3666.         $this->asides->load(['ecoles_roles' => array(
  3667.             'exec' => array(
  3668.                 'htmlend' => true
  3669.             ),
  3670.             'title' => 'Tri par section pour la promo ' $this->__getView('annee_promo'),
  3671.         )]);
  3672.         $this->asides->load('ecoles_modifier');
  3673.         return $this->View('contacts/etudiants-spectacles.html.twig');
  3674.     }
  3675.     // }}}
  3676.     /** Trie le tableau entrant par ordre inverse des dates de fin de spectacles
  3677.      *
  3678.      * @param array $array
  3679.      * @return array
  3680.      */
  3681.     private function sortSpectaclesByEndDate(array $array): array
  3682.     {
  3683.         $sortedArray = [];
  3684.         $intermediateArray = [];
  3685.         foreach ($array as $key => $value) {
  3686.             if (isset($value['periode']['dateend_std'])) {
  3687.                 $intermediateArray[$key] = $value['periode']['dateend_std'];
  3688.             } else {
  3689.                 $intermediateArray[$key] = $value['prochdate_std'];
  3690.             }
  3691.         }
  3692.         arsort($intermediateArray);
  3693.         foreach ($intermediateArray as $key => $value) {
  3694.             $sortedArray[$key] = $array[$key];
  3695.         }
  3696.         return $sortedArray;
  3697.     }
  3698.     // {{{ setAsidesCommunEnSavoirPlus()
  3699.     /** method permettant d'éviter de dupliquer du code à différents endroits
  3700.      *
  3701.      */
  3702.     private function setAsidesCommunEnSavoirPlus()
  3703.     {
  3704.         // new array pour v2
  3705.         $idextranetuser null;
  3706.         if ($this->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
  3707.             $idextranetuser $this->context['session']->getIdextranetuser();
  3708.         }
  3709.         $auteurs_menu_genre = array(
  3710.             'presentation' => array(
  3711.                 'name' => 'Présentation',
  3712.                 'key_genre' => 'presentation',
  3713.             )
  3714.         );
  3715.         if (!$this->contents->getAssociateContent($this->idobject$this->type_object'class_presentation_structure')) {
  3716.             unset($auteurs_menu_genre['presentation']);
  3717.         }
  3718.         if (isset($this->view->articles)) {
  3719.             $this->context['view']->morearticle true;
  3720.         }
  3721.         $this->asides->load(['bio_files' => array(
  3722.             'exec' => array(
  3723.                 'alone' => true,
  3724.                 'color' => 'context'
  3725.             )
  3726.         )]);
  3727.         $this->asides->load(['url_lists_alone,bio_lists_new' => array(
  3728.             'php' => array(
  3729.                 'method' => 'asidesUrlLists',
  3730.                 'urls' => $auteurs_menu_genre,
  3731.                 'url' => '/contacts/{v_url_clean}/key_genre',
  3732.                 'params' => array(
  3733.                     'activate' => $this->context['action']
  3734.                 )
  3735.             )
  3736.         )]);
  3737.         $this->asides->load(['textes_menu_educ' => array(
  3738.             'exec' => array(
  3739.                 'alone' => true,
  3740.                 'color' => 'context'
  3741.             ),
  3742.         )]);
  3743.         // aside
  3744.         $this->asides->load('contact_pres_modif');
  3745.         // $this->asides->load('contact_modifier_log');
  3746.         //Uniquement pour les contacts écoles
  3747.         if ($this->infosobject['idtypestructure'] == 'EC') {
  3748.             $this->asides->load('ecoles_generic');
  3749.         }
  3750.         $this->asides->load('common_participer_contacts');
  3751.     }
  3752.     // {{{ action get aside pour les audios
  3753.     /**
  3754.      *
  3755.      */
  3756.     public function getAsidesAudios($activate_aside_podcast false$aside_spectacle_audios true)
  3757.     {
  3758.         $totalSpectaclesPodcasts 0;
  3759.         if ($aside_spectacle_audios) {
  3760.             if (empty($this->context['view']->nb_spectacles_in_audio)) {
  3761.                 $this->action_spectacles(nullfalse, ['filtre_type' => 'audio''get_spectacles_with_audios' => true]);
  3762.             }
  3763.             $this->asides->load(['url_lists_alone,emissions' => [
  3764.                 'exec' => ['color' => 'audios'],
  3765.                 'php' => array(
  3766.                     'method' => 'asidesUrlLists',
  3767.                     'urls' => [
  3768.                         //                     'podcasts-textes '=> array(
  3769.                         //                         'name' => 'Textes à l\'affiche',
  3770.                         //                         'key_type' => 'podcasts-textes',
  3771.                         //                     ),
  3772.                         'podcasts-spectacles' => array(
  3773.                             'name' => 'Spectacles à venir',
  3774.                             'key_cat' => 'podcasts-spectacles',
  3775.                             'key_type' => 'in',
  3776.                             'count' => ($this->context['view']->nb_spectacles_in_audio $totalSpectaclesPodcasts)
  3777.                         ),
  3778.                         'podcasts-spectacles-anciens' => array(
  3779.                             'name' => 'Spectacles passés',
  3780.                             'key_cat' => 'podcasts-spectacles-anciens',
  3781.                             'key_type' => 'anciens',
  3782.                             'count' => $this->context['view']->nb_spectacles_anciens_audio
  3783.                         ),
  3784.                         'podcasts-spectacles-coprod' => array(
  3785.                             'name' => 'Productions en scène',
  3786.                             'key_cat' => 'podcasts-spectacles-coprod',
  3787.                             'key_type' => 'coprod',
  3788.                             'count' => $this->context['view']->nb_spectacles_coprod_audio
  3789.                         ),
  3790.                         'podcasts-spectacles-tous' => array(
  3791.                             'name' => 'Toutes les productions',
  3792.                             'key_cat' => 'podcasts-spectacles-tous',
  3793.                             'key_type' => 'prod',
  3794.                             'count' => ($this->context['view']->nb_spectacles_prod_audio $totalSpectaclesPodcasts)
  3795.                         ),
  3796.                         'podcasts-spectacles-selections' => array(
  3797.                             'name' => 'Spectacles sélectionnés',
  3798.                             'key_cat' => 'podcasts-spectacles-selections',
  3799.                             'key_type' => 'selections',
  3800.                             'count' => (isset($this->context['view']->nb_spectacles_selections_audio)) ? $this->context['view']->nb_spectacles_selections_audio $totalSpectaclesPodcasts $totalSpectaclesPodcasts
  3801.                         )
  3802.                     ],
  3803.                     'url' => '/contacts/{v_url_clean}/key_action/cat/key_cat/type/key_type',
  3804.                     'params' => array(
  3805.                         'key_action' => 'emissions',
  3806.                         'activate' => (!empty($this->context['view']->cat)) ? $this->context['view']->cat ''
  3807.                     ),
  3808.                 ),
  3809.                 'title' => 'ÉMISSIONS ASSOCIÉES'
  3810.             ]]);
  3811.         }
  3812.         if (in_array($this->idobject, [5955222])) {
  3813.             $activate $this->context['view']->url_clean;
  3814.             $urls = [
  3815.                 'podcasts' => [
  3816.                     'name' => 'Toutes les émissions',
  3817.                     'url' => '/audios/emissions/',
  3818.                 ],
  3819.                 [
  3820.                     'name' => 'Les émissions critiques',
  3821.                     'url' => '/critiques/audios'
  3822.                 ],
  3823.                 [
  3824.                     'name' => 'France Culture',
  3825.                     'url' => '/contacts/France-Culture/podcasts/',
  3826.                     'key' => 'France-Culture'
  3827.                 ],
  3828.                 [
  3829.                     'name' => 'France Inter',
  3830.                     'url' => '/contacts/France-Inter/podcasts/',
  3831.                     'key' => 'France-Inter'
  3832.                 ],
  3833.             ];
  3834.         } else {
  3835.             $activate '';
  3836.             if ($activate_aside_podcast) {
  3837.                 $activate 'all';
  3838.                 foreach (['emission''podcast'] as $value) {
  3839.                     if (!empty($this->context['params'][$value])) {
  3840.                         $activate $this->context['params'][$value];
  3841.                         break;
  3842.                     }
  3843.                 }
  3844.             }
  3845.             $countAllPodcasts = (int)$this->em->getRepository(Podcasts::class)->countPodcasts('contacts'$this->idobject);
  3846.             $countFranceCulturePodcasts = (int)$this->em->getRepository(Podcasts::class)->countPodcasts('contacts'$this->idobject, ['type_franceinter' => 0]);
  3847.             $countFranceInterPodcasts = (int)$this->em->getRepository(Podcasts::class)->countPodcasts('contacts'$this->idobject, ['type_franceinter' => 1]);
  3848.             $countSoundcloudPodcasts = (int)$this->em->getRepository(Podcasts::class)->countPodcasts('contacts'$this->idobject'soundcloud');
  3849.             $urls = [
  3850.                 'podcasts' => [
  3851.                     'name' => 'Toutes les émissions',
  3852.                     'url' => '/contacts/{v_url_clean}/podcasts/',
  3853.                     'kety_activate' => 'all',
  3854.                     'count' => $countAllPodcasts
  3855.                 ],
  3856.                 [
  3857.                     'name' => 'France Culture',
  3858.                     'url' => '/contacts/{v_url_clean}/podcasts/podcast/key_emission',
  3859.                     'key_emission' => 'franceculture',
  3860.                     'count' => $countFranceCulturePodcasts
  3861.                 ],
  3862.                 [
  3863.                     'name' => 'France Inter',
  3864.                     'url' => '/contacts/{v_url_clean}/podcasts/podcast/key_emission',
  3865.                     'key_emission' => 'franceinter',
  3866.                     'count' => $countFranceInterPodcasts
  3867.                 ],
  3868.                 [
  3869.                     'name' => 'Soundcloud',
  3870.                     'url' => '/contacts/{v_url_clean}/podcasts/podcast/soundcloud',
  3871.                     'key_emission' => 'soundcloud',
  3872.                     'count' => $countSoundcloudPodcasts
  3873.                 ],
  3874.             ];
  3875.         }
  3876. //        if ($countAllPodcasts + $countFranceCulturePodcasts + $countFranceInterPodcasts + $countSoundcloudPodcasts > 0) {
  3877.             $this->asides->load(['url_lists_alone,podcasts' => array(
  3878.                 'exec' => ['color' => 'audios'],
  3879.                 'php' => array(
  3880.                     'method' => 'asidesUrlLists',
  3881.                     'urls' => $urls,
  3882.                     'url' => '/key_url/',
  3883.                     'params' => array(
  3884.                         'activate' => $activate
  3885.                     ),
  3886.                 ),
  3887.                 'title' => html_entity_decode('écouter'),
  3888.             )]);
  3889. //        }
  3890.         if (in_array($this->idobject, [5955222])) {
  3891.             $this->asides->load([
  3892.                 'contact_franceculture_menu' => [
  3893.                     'php' => [
  3894.                         'method' => 'asidesPodcasts',
  3895.                         'params' => [
  3896.                             'station' => ($this->idobject == 5222) ? 'franceinter' 'franceculture',
  3897.                             'em' => $this->em
  3898.                         ]
  3899.                     ]
  3900.                 ]
  3901.             ]);
  3902.         } else if ($this->context['action'] == 'podcasts') {
  3903.             $this->asides->load([
  3904.                 'contact_franceculture_menu,franceculture' => [
  3905.                     'custom_url_clean' => 'France-Culture',
  3906.                     'title_custom' => 'France Culture',
  3907.                     'logo_custom' => 'france-culture'
  3908.                 ]
  3909.             ]);
  3910.             $this->asides->load([
  3911.                 'contact_franceculture_menu,franceinter' => [
  3912.                     'custom_url_clean' => 'France-Inter',
  3913.                     'title_custom' => 'France Inter',
  3914.                     'logo_custom' => 'france-inter'
  3915.                 ]
  3916.             ]);
  3917.             $this->asides->load([
  3918.                 'contact_franceculture_menu,autres' => [
  3919.                     'php' => [
  3920.                         'method' => 'asidesPodcasts',
  3921.                         'params' => [
  3922.                             'station' => 'soundcloud',
  3923.                             'em' => $this->em
  3924.                         ]
  3925.                     ]
  3926.                 ]
  3927.             ]);
  3928.         } else {
  3929.             $this->asides->load(['common_carrer_informations' => [
  3930.                 'exec' => ['color' => 'spectacles'],
  3931.             ]]);
  3932.         }
  3933.         $this->asides->load(['common_participer_contacts' => array(
  3934.             'exec' => ['color' => 'spectacles'],
  3935.         )]);
  3936.     }
  3937.     // {{{ action get aside pour les videos
  3938.     /**
  3939.      *
  3940.      */
  3941.     public function getAsidesVideos($nb_videos_partenariats null$filtre_captation null)
  3942.     {
  3943.         $multimedias $this->em->getRepository(Multimedias::class);
  3944.         if (is_null($nb_videos_partenariats)) {
  3945.             $params_query_commun = array(
  3946.                 'object' => array($this->idobject => ['contacts']),
  3947.                 'where' => array(array('multimedias''audio_video'2)),
  3948.                 'order' => array('multimedias.date'),
  3949.                 'limit' => array('all'),
  3950.                 'dbg' => array('last_commun''Vidéos en partenariat du contact'),
  3951.             );
  3952.             $sql_dates_multimedias $multimedias->getSQLMultimedias($params_query_communfalse);
  3953.             $total $multimedias->queryAll($sql_dates_multimedias);
  3954.             $nb_videos_partenariats count($total);
  3955.         }
  3956.         if (empty($this->context['view']->nb_spectacles_anciens)) {
  3957.             $this->action_spectacles(nullfalse);
  3958.         }
  3959.         //La liste des menu qui sera affiché à travers les asides
  3960.         $this->context['view']->menu_videos = array(
  3961.             'in' => array(
  3962.                 'name' => 'Spectacles à venir',
  3963.                 'key_url' => 'contacts/{v_url_clean}/videos',
  3964.                 'key_type' => 'in',
  3965.                 'count' => $this->context['view']->nb_spectacles_in
  3966.             ),
  3967.             'anciens' => array(
  3968.                 'name' => 'Spectacles passés',
  3969.                 'key_url' => 'contacts/{v_url_clean}/videos/type/key_type',
  3970.                 'key_type' => 'anciens',
  3971.                 'spectacle_anciens' => array('anciens' => true),
  3972.                 'count' => $this->context['view']->nb_spectacles_anciens
  3973.             ),
  3974.             'coprod' => array(
  3975.                 'name' => 'Productions en scène',
  3976.                 'key_url' => 'contacts/{v_url_clean}/videos/type/key_type',
  3977.                 'key_type' => 'coprod',
  3978.                 'count' => $this->context['view']->nb_spectacles_coprod
  3979.             ),
  3980.             'prod' => array(
  3981.                 'name' => 'Toutes les productions',
  3982.                 'key_url' => 'contacts/{v_url_clean}/videos/type/key_type',
  3983.                 'key_type' => 'prod',
  3984.                 'spectacle_anciens' => array('anciens' => true),
  3985.                 'count' => $this->context['view']->nb_spectacles_coprod
  3986.             ),
  3987.             'partenariat' => array(
  3988.                 'name' => 'Toutes les vidéos en partenariat',
  3989.                 'key_url' => 'contacts/{v_url_clean}/videos/type/key_type',
  3990.                 'key_type' => 'partenariat',
  3991.                 // 'spectacle_anciens' => array('anciens' => true),
  3992.                 'count' => $nb_videos_partenariats
  3993.             ),
  3994.         );
  3995.         $count_dvds $this->getDvds(true);
  3996.         $podcasts $this->em->getRepository(Podcasts::class);
  3997.         $culturebox_params = array(
  3998.             'special' => array(
  3999.                 'type_podcast' => 'culturebox'//commun
  4000.                 'is_integrale' => true//commun
  4001.                 'idcontacts' => $this->idobject,
  4002.                 'current' => true
  4003.             ),
  4004.             'dbg' => array('culturebox_data''Les replay culturebox'),
  4005.         );
  4006.         $nb_captations $podcasts->countListPodcasts($culturebox_params);
  4007.         $culturebox_params_vod = array(
  4008.             'special' => array(
  4009.                 'type_podcast' => 'culturebox'//commun
  4010.                 'idcontacts' => $this->idobject,
  4011.                 'type_diffusion' => 1
  4012.             ),
  4013.             'dbg' => array('culturebox_data''Les vods culturebox'),
  4014.         );
  4015.         $nb_vod $podcasts->countListPodcasts($culturebox_params_vod);
  4016.         $culturebox_params_vod['special']['type_diffusion'] = 2;
  4017.         $nb_svod $podcasts->countListPodcasts($culturebox_params_vod);
  4018.         $contact_dvd = array(
  4019.             'dvd' => array(
  4020.                 'name' => 'DVD',
  4021.                 'key_url' => '/contacts/' $this->context['view']->url_clean '/dvd',
  4022.                 'count' => $count_dvds,
  4023.                 'key_type' => 'dvd_'
  4024.             ),
  4025.             'captations' => array(
  4026.                 'name' => 'Captation(s) en streaming (gratuit)',
  4027.                 'key_url' => '/contacts/' $this->context['view']->url_clean '/captations',
  4028.                 'count' => $nb_captations,
  4029.                 'key_type' => 'captations_'
  4030.             ),
  4031.             'vod' => array(
  4032.                 'name' => 'VOD',
  4033.                 'key_url' => '/contacts/' $this->context['view']->url_clean '/captations/type/vod',
  4034.                 'count' => $nb_vod,
  4035.                 'key_type' => 'captations_vod'
  4036.             ),
  4037.             'svod' => array(
  4038.                 'name' => 'SVOD',
  4039.                 'key_url' => '/contacts/' $this->context['view']->url_clean '/captations/type/svod',
  4040.                 'count' => $nb_svod,
  4041.                 'key_type' => 'captations_svod'
  4042.             )
  4043.         );
  4044.         $this->asides->load(['url_lists' => array(
  4045.             'exec' => array(
  4046.                 'htmlstart' => true,
  4047.                 'htmlend' => (in_array($this->context['view']->type_spectacle, ['anciens''partenariat']) && (!in_array($this->context['action'], ['captations''dvd']))) ? false true,
  4048.                 'color' => 'videos',
  4049.             ),
  4050.             'php' => array(
  4051.                 'method' => 'asidesUrlLists',
  4052.                 'urls' => $this->context['view']->menu_videos,
  4053.                 'url' => '/key_url/',
  4054.                 'params' => array(
  4055.                     'activate' => (!in_array($this->context['action'], ['captations''dvd'])) ? $this->context['view']->type_spectacle ''
  4056.                 ),
  4057.             ),
  4058.             'title' => html_entity_decode('Voir'),
  4059.         )]);
  4060.         if (in_array($this->context['view']->type_spectacle, ['anciens''partenariat']) && (!in_array($this->context['action'], ['captations''dvd']))) {
  4061.             $this->asides->load(['par_saison' => array(
  4062.                 'exec' => array(
  4063.                     'htmlend' => true,
  4064.                     'color' => 'videos',
  4065.                 ),
  4066.                 'php' => array(
  4067.                     'method' => 'asidesUrlListsForms',
  4068.                     'url' => '/contacts/{v_url_clean}/videos/type/key_type/',
  4069.                     'params' => array(
  4070.                         'key_type' => $this->context['view']->type_spectacle
  4071.                     )
  4072.                 ),
  4073.                 'title' => html_entity_decode('Recherche par période')
  4074.             )]);
  4075.         }
  4076.         if (empty($this->view->subaside_action)) {
  4077.             $this->view->subaside_action null;
  4078.         }
  4079.         if ($count_dvds || $nb_captations 0) {
  4080.             $this->asides->load(['url_lists_alone,contact_dvd' => array(
  4081.                 'exec' => ['alone' => true'color' => 'videos'],
  4082.                 'php' => [
  4083.                     'method' => 'asidesUrlLists',
  4084.                     'urls' => $contact_dvd,
  4085.                     'url' => 'key_url',
  4086.                     'params' => array(
  4087.                         'activate' => $this->context['action'] . '_' $this->view->subaside_action
  4088.                     )
  4089.                 ],
  4090.                 'title' => 'Films & Captations'
  4091.             )]);
  4092.         }
  4093.         if (!empty($this->context['view']->filtre_culturebox)) {
  4094.             $this->asides->load(['url_lists_alone' => array(
  4095.                 'exec' => ['alone' => true'color' => 'videos'],
  4096.                 'php' => array(
  4097.                     'method' => 'asidesUrlLists',
  4098.                     'urls' => $this->context['view']->filtre_culturebox,
  4099.                     'url' => '/contacts/' $this->context['view']->url_clean '/captations/filtre/key_type',
  4100.                     'params' => array(
  4101.                         'key_type' => 'auto_key',
  4102.                         'activate' => $filtre_captation,
  4103.                     )
  4104.                 ),
  4105.                 'title' => 'Filtres'
  4106.             )]);
  4107.             $this->asides->load('common_partenaire_culturebox');
  4108.         }
  4109.         $this->asides->load(['common_participer_contacts' => array(
  4110.             'exec' => ['color' => 'videos']
  4111.         )]);
  4112.     }
  4113.     // {{{ action get aside pour les spectacles
  4114.     /**
  4115.      *
  4116.      */
  4117.     public function getAsidesSpectacles(bool $noAsideSearchByPeriod false)
  4118.     {
  4119.         $type_spectacle '';
  4120.         if (!in_array($this->context['action'], ['podcasts''etudiants-spectacles-tous''calendrier''emissions'])) {
  4121.             if (!empty($this->context['params']['cat'])) {
  4122.                 $type_spectacle $this->context['params']['cat'];
  4123.             } else if (!empty($this->context['view']->periode_spectacle)) {
  4124.                 $type_spectacle $this->context['view']->periode_spectacle;
  4125.             } else if (!empty($this->context['view']->type_spectacle)) {
  4126.                 $type_spectacle $this->context['view']->type_spectacle;
  4127.             }
  4128.         }
  4129.         // Liste aside pour contacts/spectacles @TODO remplire URL? + activate
  4130.         $this->context['view']->menu_spectacles = array(
  4131.             array(
  4132.                 'name' => 'Spectacles à venir',
  4133.                 'key_url' => 'contacts/{v_url_clean}/spectacles',
  4134.                 'key_type' => 'in',
  4135.                 'count' => $this->context['view']->nb_spectacles_in
  4136.             ),
  4137.             array(
  4138.                 'name' => 'Spectacles passés',
  4139.                 'key_url' => 'contacts/{v_url_clean}/spectacles/type/key_type',
  4140.                 'key_type' => 'anciens',
  4141.                 'count' => $this->context['view']->nb_spectacles_anciens
  4142.             ),
  4143.             array(
  4144.                 'name' => 'Productions en scène',
  4145.                 'key_url' => 'contacts/{v_url_clean}/spectacles/type/key_type',
  4146.                 'key_type' => 'coprod',
  4147.                 'count' => $this->context['view']->nb_spectacles_coprod
  4148.             ),
  4149.             array(
  4150.                 'name' => 'Toutes les productions',
  4151.                 'key_url' => 'contacts/{v_url_clean}/spectacles/type/key_type',
  4152.                 'key_type' => 'prod',
  4153.                 'count' => $this->context['view']->nb_spectacles_prod
  4154.             ),
  4155.             array(
  4156.                 'name' => 'Diffusés',
  4157.                 'key_url' => 'contacts/{v_url_clean}/spectacles/type/key_type',
  4158.                 'key_type' => 'diffusions',
  4159.                 'count' => $this->context['view']->nb_spectacles_diffusions
  4160.             )
  4161.         );
  4162.         if (!isset($this->context['view']->all_en_scene)) {
  4163.             $this->context['view']->all_en_scene $this->countEnScene(['affiche' => true]);
  4164.         }
  4165.         if (!isset($this->context['view']->anciens_en_scene)) {
  4166.             $this->context['view']->anciens_en_scene $this->countEnScene(['anciens' => true]);
  4167.         }
  4168.         // aside
  4169.         if ($this->context['view']->total_spectacle 0) {
  4170.             $this->asides->load(['url_lists,menu_principal' => array(
  4171.                 'exec' => array(
  4172.                     'htmlstart' => true,
  4173.                     'htmlend' => true,
  4174.                     'color' => 'spectacles',
  4175.                 ),
  4176.                 'php' => array(
  4177.                     'method' => 'asidesUrlLists',
  4178.                     'urls' => $this->context['view']->menu_spectacles,
  4179.                     'url' => '/key_url/',
  4180.                     'params' => array(
  4181.                         'activate' => $type_spectacle
  4182.                     ),
  4183.                 ),
  4184.                 'title' => html_entity_decode('Voir'),
  4185.             )]);
  4186.             if (!isset($this->context['params']['cat'])) {
  4187.                 $this->context['params']['cat'] = null;
  4188.             }
  4189.             if ($this->context['action'] != 'calendrier' && !in_array($type_spectacle, ['in''coprod''affiche''soutiens''anciens-textes''etudiants-spectacles-tous''podcasts-spectacles-tous']) && !in_array($this->context['action'], ['podcasts''etudiants-spectacles-tous']) && !in_array($this->context['params']['cat'], ['podcasts-spectacles'])) {
  4190.                 $this->asides->load(['par_saison' => array(
  4191.                     'exec' => array(
  4192.                         'htmlstart' => true,
  4193.                         'htmlend' => true,
  4194.                         'color' => 'spectacles'
  4195.                     ),
  4196.                     'php' => array(
  4197.                         'method' => 'asidesUrlListsForms',
  4198.                         'url' => '/contacts/{v_url_clean}/{v_current_page}/type/{v_type_spectacle}',
  4199.                     ),
  4200.                     'title' => 'Recherche par période'
  4201.                 )]);
  4202.             }
  4203.         }
  4204.         $totalSpectaclesPodcasts 0;
  4205.         //Si on est chez France Culture
  4206.         if (in_array($this->idobject, [5955222])) {
  4207.             $params_sql $this->setCommonSearchSpectacles(array(
  4208.                 'special' => array(
  4209.                     'textfictif' => 0,
  4210.                     'plus_proche' => true,
  4211.                     'podcasts' => [
  4212.                         'type_podcast' => 'franceculture'
  4213.                     ]
  4214.                 ),
  4215.                 'dbg' => array('list_textes_affiche''Liste des spectacles avec textes non fictifs qui ont un podcast'),
  4216.             ));
  4217.             $params_sql['special']['type_franceinter'] = null;
  4218.             if ($this->idobject == 5222) {
  4219.                 $params_sql['special']['type_franceinter'] = 1;
  4220.             }
  4221.             $totalProchainsSpectaclesPodcasts $this->em->getRepository(Spectacles::class)->countListSpectacles($params_sql);
  4222.             unset($params_sql['special']['plus_proche']);
  4223.             $totalSpectaclesPodcasts $this->em->getRepository(Spectacles::class)->countListSpectacles($params_sql);
  4224.         }
  4225.         //Si le total des spectacles audios n'existe pas
  4226.         if (!isset($this->context['view']->nb_spectacles_in_audio)) {
  4227.             $this->action_spectacles($this->slugfalse);
  4228.         }
  4229.         $schedules $this->em->getRepository(Schedules::class);
  4230.         $ids_spectacle_prod $this->obj->getSpectaclesProd($this->idobject);
  4231.         $ids_spectacle_structures_diffusions $this->obj->getSpectaclesProd($this->idobjectfalsenull77);
  4232.         $ids_spectacles array_merge($ids_spectacle_prod$ids_spectacle_structures_diffusions);
  4233.         $biographies_dates_demains = [];
  4234.         if (!empty($ids_spectacles)) {
  4235.             $biographies_dates_demains $schedules->getDateBySpectaclesDemain($ids_spectacles1000null'old', ['idcontact' => $this->idobject'count' => true]);
  4236.         }
  4237.         $urls = [];
  4238.         if ($biographies_dates_demains && !empty($ids_spectacles)) {
  4239.             $urls[] = [
  4240.                 'name' => 'Spectacles dans le lieu',
  4241.                 'count' => $schedules->getDateBySpectaclesDemain($ids_spectacles1000null'old', ['idcontact' => $this->idobject'count' => true]),
  4242.                 'key_type' => 'structure',
  4243.             ];
  4244.         };
  4245.         if (!empty($ids_spectacles)) {
  4246.             $urls[] = [
  4247.                 'name' => 'Productions en scène',
  4248.                 'count' => $schedules->getDateBySpectaclesDemain($ids_spectacles1000null'old', ['count' => true]),
  4249.                 'key' => 'prod',
  4250.                 'url' => '/contacts/{v_url_clean}/calendrier/',
  4251.             ];
  4252.         };
  4253.         if ($biographies_dates_demains && !empty($ids_spectacles)) {
  4254.             $this->asides->load(['url_lists,calendrier' => [
  4255.                 'exec' => array(
  4256.                     'color' => 'spectacles',
  4257.                     'htmlstart' => true,
  4258.                     'htmlend' => ($this->context['action'] == 'calendrier') ? false true
  4259.                 ),
  4260.                 'php' => array(
  4261.                     'method' => 'asidesUrlLists',
  4262.                     'urls' => $urls,
  4263.                     'url' => '/contacts/{v_url_clean}/key_action/type/key_type',
  4264.                     'params' => array(
  4265.                         'key_action' => 'calendrier',
  4266.                         'activate' => (!empty($this->context['view']->type_calendrier)) ? $this->context['view']->type_calendrier null
  4267.                     ),
  4268.                 ),
  4269.                 'title' => 'Calendrier'
  4270.             ]]);
  4271.         }
  4272.         if ($this->context['action'] == 'calendrier') {
  4273.             $this->asides->load(['url_lists,filtre' => array(
  4274.                 'exec' => [
  4275.                     'color' => 'spectacles',
  4276.                     'htmlend' => true,
  4277.                 ],
  4278.                 'php' => array(
  4279.                     'method' => 'asidesUrlLists',
  4280.                     'urls' => (!empty($this->context['view']->menu_aside_mois)) ? $this->context['view']->menu_aside_mois : [],
  4281.                     'url' => '/contacts/{v_url_clean}/calendrier/#params',
  4282.                 ),
  4283.                 'title' => 'Recherche par période'
  4284.             )]);
  4285.         }
  4286.         $aides $this->em->getRepository(Aides::class);
  4287.         $params_sql_aides = array(
  4288.             'special' => array(
  4289.                 'aides' => array(
  4290.                     'idcontacts' => $this->infosobject['idcontact'],
  4291.                 ),
  4292.                 'type_aide' => 2// Prix et distinctions
  4293.             ),
  4294.             'dbg' => array('nombre_prix''Nombre de prix'),
  4295.         );
  4296.         //vaeur par défauts
  4297.         $categorie_arrays = array(
  4298.             'nominations' => array(
  4299.                 'title_aside' => 'Voir',
  4300.                 'title_page' => 'nommés ou lauréats',
  4301.                 'type_aide' => 2,
  4302.             ),
  4303.             'soutiens' => array(
  4304.                 'title_aside' => 'Soutiens ',
  4305.                 'title_page' => 'soutenus',
  4306.                 'type_aide' => 1,
  4307.             ),
  4308.             'selections' => array(
  4309.                 'title_aside' => 'Sélections',
  4310.                 'title_page' => 'sélectionnés',
  4311.                 'type_aide' => 4,
  4312.             ),
  4313.         );
  4314.         $type 0;
  4315.         if (!empty($this->context['params']['type'])) {
  4316.             $type $this->context['params']['type'];
  4317.         }
  4318.         foreach ($categorie_arrays as $kcategorie => $vcategorie) {
  4319.             $sub_title 'nominations';
  4320.             $params_sql_aides['special']['type_aide'] = $vcategorie['type_aide']; // soutiens
  4321.             $params_sql_aides['dbg'] = array('nombre_' $kcategorie'Nombre de soutiens');
  4322.             if ($count_aides_soutiens $aides->countAides($params_sql_aides) > 0) {
  4323.                 if (isset($type) && $vcategorie['type_aide'] == $type) {
  4324.                     $this->view->categorie_title $vcategorie['title_page'];
  4325.                 }
  4326.                 $filtre_nb_spectacles $kcategorie;
  4327.                 if ($kcategorie == 'nominations') {
  4328.                     $filtre_nb_spectacles 'laureats_nominations';
  4329.                 }
  4330.                 $spectacles_avenir $this->context['view']->{'nb_spectacles_' $filtre_nb_spectacles};
  4331.                 $avenir $this->countEnScene(['type_aide' => $vcategorie['type_aide'], 'prochains' => true'without_lecture' => true]);
  4332.                 $ancien $this->countEnScene(['type_aide' => $vcategorie['type_aide'], 'anciens' => true]);
  4333.                 if ($spectacles_avenir || $avenir || $ancien 0) {
  4334.                     //On récupère la valeur du paramètre
  4335.                     $params_asides_nomsoutsec = (!empty($this->context['params']['periode'])) ? $this->context['params']['periode'] : $this->context['params']['type'];
  4336.                     $this->asides->load(['url_lists,menu_' $kcategorie => array(
  4337.                         'exec' => array(
  4338.                             'htmlstart' => true,
  4339.                             'color' => 'spectacles',
  4340.                             'htmlend' => true
  4341.                         ),
  4342.                         'php' => array(
  4343.                             'method' => 'asidesUrlLists',
  4344.                             'urls' => [
  4345.                                 $kcategorie '_' $type => array(
  4346.                                     'name' => 'Spectacles à l\'affiche',
  4347.                                     'url' => '/contacts/{v_url_clean}/spectacles/type/key_categorie',
  4348.                                     'key_periode' => 'soutiens',
  4349.                                     'key_valide' => $kcategorie '_' $kcategorie,
  4350.                                     'count' => $spectacles_avenir
  4351.                                 ),
  4352.                                 'affiche_' $kcategorie => array(
  4353.                                     'name' => 'Textes en scène à venir',
  4354.                                     'key_periode' => 'affiche',
  4355.                                     'key_valide' => 'affiche_' $vcategorie['type_aide'],
  4356.                                     'count' => $avenir
  4357.                                 ),
  4358.                                 'anciens-textes_' $kcategorie => array(
  4359.                                     'name' => 'Tous les textes en scène',
  4360.                                     'key_periode' => 'anciens-textes',
  4361.                                     'key_valide' => 'anciens-textes_' $vcategorie['type_aide'],
  4362.                                     'count' => $ancien
  4363.                                 )
  4364.                             ],
  4365.                             'url' => '/contacts/{v_url_clean}/key_action/periode/key_periode/type/key_type',
  4366.                             'params' => array(
  4367.                                 'activate' => $params_asides_nomsoutsec '_' $type,
  4368.                                 'key_action' => 'en-scene',
  4369.                                 'key_type' => $vcategorie['type_aide'],
  4370.                                 'key_categorie' => $kcategorie
  4371.                             ),
  4372.                         ),
  4373.                         'title' => html_entity_decode($vcategorie['title_aside']),
  4374.                     )]);
  4375.                 }
  4376.             }
  4377.         }
  4378.         if (!in_array($type_spectacle, ['in''coprod''prod''affiche''soutiens''anciens']) && !in_array($this->context['action'], ['etudiants-spectacles-tous''calendrier''emissions'])) {
  4379.             $aside_date_load false;
  4380.             if (in_array($type_spectacle, ['podcasts-spectacles''in''coprod''prod''affiche']) && empty($this->context['view']->menu_jours)) {
  4381.                 $this->context['view']->menu_jours = [
  4382.                     array(
  4383.                         'name' => 'dans les 7 prochains jours',
  4384.                         'key_day' => '7',
  4385.                     ),
  4386.                     array(
  4387.                         'name' => 'dans les 30 prochains jours',
  4388.                         'key_day' => '30',
  4389.                     ),
  4390.                     array(
  4391.                         'name' => 'dans les 3 prochains mois',
  4392.                         'key_day' => '90',
  4393.                     ),
  4394.                     array(
  4395.                         'name' => 'dans les 12 prochains mois',
  4396.                         'key_day' => '365',
  4397.                     )
  4398.                 ];
  4399.                 $this->asides->load(['url_lists,menu_days' => array(
  4400.                     'exec' => array(
  4401.                         'htmlstart' => true,
  4402.                         'color' => 'spectacles'
  4403.                     ),
  4404.                     'php' => array(
  4405.                         'method' => 'asidesUrlLists',
  4406.                         'urls' => $this->context['view']->menu_jours,
  4407.                         'url' => '/contacts/{v_url_clean}/{v_current_page}/generate_params',
  4408.                         'structure' => array(
  4409.                             // 'photo' => $this->__getView('photo'),
  4410.                             // 'role' => $this->__getView('role'),
  4411.                             'cat' => $this->context['params']['cat'],
  4412.                             'type' => $this->context['params']['type'],
  4413.                             'structure_classic' => array(
  4414.                                 'd' => 'key_day',
  4415.                                 's' => 'v_saison'
  4416.                             )
  4417.                         ),
  4418.                         'params' => array(
  4419.                             'activate' => (!empty($_GET['d'])) ? (int)$_GET['d'] : ''
  4420.                         ),
  4421.                     ),
  4422.                     'title' => 'Recherche par période'
  4423.                 )]);
  4424.                 $aside_date_load true;
  4425.             }
  4426.             if (!$noAsideSearchByPeriod) {
  4427.                 $this->asides->load(['par_saison,test' => array(
  4428.                     'exec' => array(
  4429.                         'htmlstart' => ($aside_date_load) ? false true,
  4430.                         'htmlend' => true,
  4431.                         'color' => 'spectacles'
  4432.                     ),
  4433.                     'php' => array(
  4434.                         'method' => 'asidesUrlListsForms',
  4435.                         'url' => '/contacts/{v_url_clean}/{v_current_page}/periode/{p_periode}'
  4436.                     ),
  4437.                     //                 'title' => 'Recherche par période'
  4438.                 )]);
  4439.             }
  4440.         }
  4441.         if ($totalEtudiantAside $this->em->getRepository(PersonEcole::class)->countEleves($this->infosobject['idcontact'])) {
  4442.             $this->asides->load(['url_lists,menu_etudiants' => array(
  4443.                 'exec' => array(
  4444.                     'htmlstart' => true,
  4445.                     'color' => 'spectacles',
  4446.                     'htmlend' => ($this->context['action'] == 'etudiants-spectacles-tous') ? false true
  4447.                 ),
  4448.                 'php' => array(
  4449.                     'method' => 'asidesUrlLists',
  4450.                     'urls' => [
  4451.                         [
  4452.                             'name' => html_entity_decode('Anciens à l\'affiche'),
  4453.                             'key_type' => 'etudiants-spectacles-tous',
  4454.                             'count' => $totalEtudiantAside
  4455.                         ]
  4456.                     ],
  4457.                     'url' => '/contacts/{v_url_clean}/key_type',
  4458.                     'params' => array(
  4459.                         'activate' => $this->context['action']
  4460.                     ),
  4461.                 ),
  4462.                 'title' => (isset($this->view->is_jtn) && $this->view->is_jtn) ? 'anciens artistes JTN' 'anciens étudiants',
  4463.             )]);
  4464.             if ($this->context['action'] == 'etudiants-spectacles-tous') {
  4465.                 $default_date null;
  4466.                 if (!empty($this->context['view']->days)) {
  4467.                     $default_date $this->context['view']->days;
  4468.                 } else if (!empty($this->view->current_saison)) {
  4469.                     $default_date $this->view->current_saison;
  4470.                 }
  4471.                 if (!empty($this->context['view']->menu_jours)) {
  4472.                     $this->asides->load(['url_lists,menu_days' => array(
  4473.                         'exec' => array(
  4474.                             'alone' => false
  4475.                         ),
  4476.                         'php' => array(
  4477.                             'method' => 'asidesUrlLists',
  4478.                             'urls' => $this->context['view']->menu_jours,
  4479.                             'url' => '/contacts/{v_url_clean}/etudiants-spectacles-tous/generate_params',
  4480.                             'params' => array(
  4481.                                 'activate' => $default_date
  4482.                             ),
  4483.                             'structure' => array(
  4484.                                 // 'photo' => $this->__getView('photo'),
  4485.                                 // 'role' => $this->__getView('role'),
  4486.                                 'sexe' => $this->__getView('sexe'),
  4487.                                 'structure_classic' => array(
  4488.                                     'd' => 'v_key',
  4489.                                     's' => 'v_saison'
  4490.                                 )
  4491.                             )
  4492.                         ),
  4493.                         'title' => 'Recherche par période'
  4494.                     )]);
  4495.                 }
  4496.                 $this->asides->load(['recherche_par_periode' => array(
  4497.                     'exec' => array(
  4498.                         'alone' => false,
  4499.                         'htmlend' => true
  4500.                     ),
  4501.                     'php' => array(
  4502.                         'method' => 'asidesUrlListsForms',
  4503.                         'url' => '/contacts/{v_url_clean}/etudiants-spectacles-tous/',
  4504.                     ),
  4505.                     'structure' => array(
  4506.                         // 'photo' => $this->__getView('photo'),
  4507.                         // 'role' => $this->__getView('role'),
  4508. //                         'sexe' => $this->__getView('sexe'),
  4509.                         'structure_classic' => array(
  4510.                             's' => 'v_saison'
  4511.                         )
  4512.                     ),
  4513.                     'title' => (empty($this->context['view']->menu_jours)) ? 'Recherche par période' false
  4514.                 )]);
  4515.             }
  4516.         }
  4517.         if (!in_array($type_spectacle, ['anciens-textes''affiche'])) {
  4518.             $this->asides->load(['common_carrer_informations' => [
  4519.                 'exec' => ['color' => 'spectacles'],
  4520.             ]]);
  4521.         }
  4522.         //  if(!in_array($type_spectacle, ['in','anciens','prod','coprod'])){
  4523.         //      $this->asides->load(['recherche_par_periode' => array(
  4524.         //          'exec' => array(
  4525.         //              'alone' => false
  4526.         //          ),
  4527.         //          'php' => array(
  4528.         //              'method' => 'asidesUrlListsForms',
  4529.         //              'url' => '/contacts/{v_url_clean}/{v_current_page}/type/{v_type_spectacle}'
  4530.         //          ),
  4531.         //          'title' => 'Recherche par période'
  4532.         //      )]);
  4533.         //  }
  4534.         $this->asides->load(['common_participer_contacts' => array(
  4535.             'exec' => ['color' => 'spectacles'],
  4536.         )]);
  4537.     }
  4538.     // }}}
  4539.     // {{{ action get aside pour les etudiants
  4540.     /**
  4541.      *
  4542.      */
  4543.     public function getAsidesEtudiants($activate 'etudiants')
  4544.     {
  4545.         $this->view->{'page_' $activate} = true;
  4546.         if ((isset($this->view->is_jtn) && !$this->view->is_jtn) || $activate == 'anciens-etudiants') {
  4547.             $this->asides->load('ecoles_nb_etudiants');
  4548.         }
  4549.         if (isset($this->view->is_jtn) && $this->view->is_jtn) {
  4550.             $label_aside 'artistes JTN';
  4551.         } else {
  4552.             $label_aside 'étudiants';
  4553.         }
  4554.         $ecoles_type = array('EC''LE''JT');
  4555.         $person_ecole $this->em->getRepository(PersonEcole::class);
  4556.         $nb_eleves $person_ecole->countEleves($this->infosobject['idcontact']);
  4557.         $nb_eleves_current $person_ecole->countEleves($this->infosobject['idcontact'], array('current' => true));
  4558.         $nb_eleves_old $nb_eleves $nb_eleves_current;
  4559.         $all_type_etudiants = array(
  4560.             array(
  4561.                 'name' => (isset($this->view->is_jtn) && $this->view->is_jtn) ? 'Artistes JTN' html_entity_decode('&Eacute;tudiants'),
  4562.                 'key_type' => 'etudiants',
  4563.                 'count' => $nb_eleves_current
  4564.             ),
  4565.             array(
  4566.                 'name' => html_entity_decode('Anciens ' $label_aside),
  4567.                 'key_type' => 'anciens-etudiants',
  4568.                 'count' => $nb_eleves_old
  4569.             ),
  4570. //            array(
  4571. //                'name' => html_entity_decode('Anciens à l\'affiche'),
  4572. //                'key_type' => 'etudiants-spectacles',
  4573. //                'count' => $nb_eleves_old
  4574. //            ),
  4575.         );
  4576.         $this->asides->load(['url_lists_alone,voir_all_type' => array(
  4577.             'php' => array(
  4578.                 'method' => 'asidesUrlLists',
  4579.                 'urls' => $all_type_etudiants,
  4580.                 'url' => '/contacts/{v_url_clean}/key_type',
  4581.                 'params' => array(
  4582.                     'activate' => $activate
  4583.                 )
  4584.             ),
  4585.             'title' => html_entity_decode('Voir'),
  4586.         )]);
  4587.         $config_asides_etudiants = array(
  4588.             'etudiants-spectacles' => array(
  4589.                 'external' => 'etudiants-spectacles-tous',
  4590.                 'url_external' => '/contacts/' $this->view->url_clean '/etudiants-spectacles-tous/',
  4591.                 'url' => '/contacts/' $this->view->url_clean '/etudiants-spectacles/'
  4592.             ),
  4593.             'etudiants-spectacles-tous' => array(
  4594.                 'external' => 'etudiants-spectacles',
  4595.                 'url_external' => '/contacts/' $this->view->url_clean '/etudiants-spectacles/',
  4596.                 'url' => '/contacts/' $this->view->url_clean '/etudiants-spectacles-tous/'
  4597.             ),
  4598.             //uniquement pour les dates
  4599.             'anciens-etudiants' => array(
  4600.                 'external' => 'anciens-etudiants',
  4601.                 'url' => '/contacts/' $this->view->url_clean '/anciens-etudiants/'
  4602.             )
  4603.         );
  4604.         if (!empty($config_asides_etudiants[$activate])) {
  4605.             $config $config_asides_etudiants[$activate];
  4606.             if ($activate == 'etudiants-spectacles' || $activate == 'etudiants-spectacles-tous') {
  4607.                 $menu_menu_etudiants = array(
  4608.                     array(
  4609.                         'name' => 'Afficher par ' $label_aside,
  4610.                         'url' => $config_asides_etudiants['etudiants-spectacles-tous']['url_external'] . 'generate_params',
  4611.                         'key' => 'etudiants-spectacles'
  4612.                     ),
  4613.                     array(
  4614.                         'name' => 'Afficher par spectacles',
  4615.                         'url' => $config_asides_etudiants['etudiants-spectacles']['url_external'] . 'generate_params',
  4616.                         'key' => 'etudiants-spectacles-tous'
  4617.                     ),
  4618.                 );
  4619.                 $this->asides->load(['url_lists,menu_etudiants' => array(
  4620.                     'exec' => array(
  4621.                         'htmlstart' => true
  4622.                     ),
  4623.                     'php' => array(
  4624.                         'method' => 'asidesUrlLists',
  4625.                         'urls' => $menu_menu_etudiants,
  4626.                         'url' => $config['url'] . 'generate_params',
  4627.                         'params' => array(
  4628.                             'activate' => $this->context['action']
  4629.                         ),
  4630.                         'structure' => array(
  4631.                             // 'role' => $this->__getView('role'),
  4632.                             // 'photo' => $this->__getView('photo'),
  4633.                             'sexe' => $this->__getView('sexe'),
  4634.                             'structure_classic' => array(
  4635.                                 'd' => 'v_key',
  4636.                                 's' => 'v_saison'
  4637.                             )
  4638.                         )
  4639.                     ),
  4640.                     'subtitle' => 'Type d\'affichage',
  4641.                 )]);
  4642.                 if ($this->__getView('current_saison')) {
  4643.                     $this->context['view']->menu_jours[] = array(
  4644.                         'name' => 'au cours de la saison ' $this->view->current_saison,
  4645.                         'key_url' => '/contacts/' $this->view->url_clean '/etudiants-spectacles',
  4646.                         'v_saison' => $this->__getView('current_saison')
  4647.                     );
  4648.                 }
  4649.             }
  4650. //            $default_date = null;
  4651. //            if(!empty($this->context['view']->days)){
  4652. //                $default_date = $this->context['view']->days;
  4653. //            }
  4654. //            else if(!empty($this->view->current_saison)){
  4655. //                $default_date = $this->view->current_saison;
  4656. //            }
  4657. //            $this->asides->load(['url_lists,menu_days' => array(
  4658. //                'exec' => array(
  4659. //                    'htmlstart' => true
  4660. //                ),
  4661. //                'php' => array(
  4662. //                    'method' => 'asidesUrlLists',
  4663. //                    'urls' => $this->context['view']->menu_jours,
  4664. //                    'url' => $config['url'].'generate_params',
  4665. //                    'params' => array(
  4666. //                        'activate' => $default_date
  4667. //                    ),
  4668. //                    'structure' => array(
  4669. //                        // 'photo' => $this->__getView('photo'),
  4670. //                        // 'role' => $this->__getView('role'),
  4671. //                        'sexe' => $this->__getView('sexe'),
  4672. //                        'structure_classic' => array(
  4673. //                            'd' => 'v_key',
  4674. //                            's' => 'v_saison'
  4675. //                        )
  4676. //                    )
  4677. //                ),
  4678. //                'subtitle' => 'Par période'
  4679. //            )]);
  4680.         }
  4681.         if ($activate == 'etudiants-spectacles' || $activate == 'etudiants-spectacles-tous') {
  4682.             $this->asides->load(['par_saison' => array(
  4683.                 'exec' => array(
  4684.                     'alone' => false
  4685.                 ),
  4686.                 'action' => $config['url'],
  4687.                 'structure' => array(
  4688.                     // 'photo' => $this->__getView('photo'),
  4689.                     // 'role' => $this->__getView('role'),
  4690.                     'sexe' => $this->__getView('sexe'),
  4691.                     'structure_classic' => array(
  4692.                         's' => 'v_saison'
  4693.                     )
  4694.                 )
  4695.             )]);
  4696.             $this->asides->load(['recherche_par_periode' => array(
  4697.                 'exec' => array(
  4698.                     'alone' => false
  4699.                 ),
  4700.                 'action' => $config['url'],
  4701.                 'structure' => array(
  4702.                     // 'photo' => $this->__getView('photo'),
  4703.                     // 'role' => $this->__getView('role'),
  4704.                     'sexe' => $this->__getView('sexe'),
  4705.                     'structure_classic' => array(
  4706.                         's' => 'v_saison'
  4707.                     )
  4708.                 )
  4709.             )]);
  4710.         }
  4711.     }
  4712.     // }}}
  4713.     // {{{ action_image_profil()
  4714.     /** Changer/ajouter l'image de profil
  4715.      *
  4716.      *
  4717.      * @access public
  4718.      * @return void
  4719.      */
  4720.     public function action_image_profil()
  4721.     {
  4722.         $this->extra_locate $this->extra_title 'Image de profil';
  4723.         $this->style_more[] = array(
  4724.             '/navigation/js/Jcrop/css/jquery.Jcrop.css',
  4725.             '/navigation/js/upload/fineuploader.css'
  4726.         );
  4727.         $this->js_more[] = '/Jcrop/js/jquery.Jcrop.min.js';
  4728.         $this->js_more[] = 'upload/jquery.fineuploader-3.0.min.js';
  4729.     }
  4730.     // }}}
  4731.     // {{{ action_bandeau()
  4732.     /** Changer/ajouter le bandeau
  4733.      *
  4734.      * @Route("/contacts/{slug}/bandeau/", name="contact_bandeau")
  4735.      *
  4736.      * @access public
  4737.      * @return void
  4738.      */
  4739.     public function action_bandeau($slug nullUploadUtils $edit_utilsFilesController $files_utilsRequest $request)
  4740.     {
  4741.         $GLOBALS['rub_courante'] = 'contacts';
  4742.         $this->InitController($slug'bandeau');
  4743.         // si connecté, instancier la classe utilitaires d'édition
  4744.         if ($this->getUser() instanceof Extranetusers) {
  4745.             // paramètre d'instanciation
  4746.             $params_edit = array(
  4747.                 'idobject' => $this->idobject,
  4748.                 'object' => 'contacts',
  4749.             );
  4750.             $url_redirect '/contacts/' $this->infosobject['urlClean'] . '/';
  4751.             // controlleur pour l'edition
  4752.             $edit_utils->load($this->context$params_edit);
  4753.             // les droits
  4754.             $this->view->object_rights $object_rights $edit_utils->checkObjectRights();
  4755.             // checker si la personne connectée à les droits sur cette fiche
  4756.             if (empty($object_rights['update'])) {
  4757.                 return $this->redirect($url_redirect 'autorisation/');
  4758.             }
  4759.         } else { // personne non loguée
  4760.             // rediriger vers montheatre/connexion
  4761.             return $this->redirectToRoute('app_login', ['urifrom' => '/contacts/' $this->infosobject['urlClean'] . '/bandeau''entete_connexion' => 'contacts']);
  4762.         }
  4763.         $this->extra_locate $this->extra_title 'Bandeau';
  4764.         $this->style_more[] = array(
  4765.             '/navigation/js/Jcrop/css/jquery.Jcrop.css',
  4766.             '/navigation/js/upload/fineuploader.css'
  4767.         );
  4768.         $this->js_more[] = '/Jcrop/js/jquery.Jcrop.min.js';
  4769.         $this->js_more[] = 'upload/jquery.fineuploader-3.0.min.js';
  4770.         return $this->view('contacts/bandeau.html.twig');
  4771.     }
  4772.     // }}}
  4773.     // {{{ action_documents_edit()
  4774.     /** Ajouter des documents à la structure
  4775.      *
  4776.      * @Route("/contacts/{slug}/documents-edit/", name="contact_documents_edit")
  4777.      * @Route("/contacts/{slug}/documents-edit/idfile/{idfile}", name="contact_documents_edit_idfile")
  4778.      *
  4779.      * @access public
  4780.      * @return void
  4781.      */
  4782.     public function action_documents_edit($idfile null$slug nullUploadUtils $edit_utilsFilesController $files_utilsRequest $requestEditUtils $editUtils)
  4783.     {
  4784.         $GLOBALS['rub_courante'] = 'contacts';
  4785.         $this->InitController($slug'documents');
  4786.         $this->context['params']['idfile'] = $idfile;
  4787.         // paramètre d'instanciation
  4788.         $params_edit = array(
  4789.             'idobject' => $this->idobject,
  4790.             'object' => 'contacts',
  4791.         );
  4792.         // si connecté, instancier la classe utilitaires d'édition
  4793.         if ($this->getUser() instanceof Extranetusers) {
  4794.             // controlleur pour l'edition
  4795.             $edit_utils->load($this->context$params_edit);
  4796.             // les droits
  4797.             $object_rights $edit_utils->checkObjectRights();
  4798.             $this->view->object_rights $object_rights;
  4799.             // checker si la personne connectée à les droits sur cette fiche
  4800.             //    if(!empty($object_rights['update'])) {
  4801.             // pour la gestion des fichiers
  4802.             $files_utils->InitFilesController($this->context$params_edit);
  4803.             $this->context['view']->data_object $this->infosobject;
  4804.             $response $files_utils->documents_edit($request$editUtils);
  4805.             if ($response instanceof RedirectResponse) {
  4806.                 return $response;
  4807.             }
  4808.             //    } else { // la personne n'a pas les droits => renvoi sur le formulaire de demande
  4809.             //        actionRedirect($context['view']->data_object['url_folder'].'/autorisation/');
  4810.             //    }
  4811.         } else { // personne non loguée
  4812.             // rediriger vers montheatre/connexion
  4813.             return $this->redirectToRoute('app_login', [
  4814.                 'urifrom' => $request->getRequestUri(),
  4815.                 'entete_connexion' => $params_edit['object']]
  4816.             );
  4817.         }
  4818.         /* géré par Files_edit */
  4819.         $this->extra_locate $this->extra_title 'Ajouter/modifier un document';
  4820.         $this->view->style_more[] = '/navigation/js/upload/fineuploader.css';
  4821.         $this->view->js_more[] = 'upload/jquery.fineuploader-3.0.min.js';
  4822.         // style et js en plus pour les champs de relation
  4823.         $this->view->style_more[] = 'relat.css';
  4824.         $this->view->js_more[] = 'ajax.relation.js';
  4825.         $this->context['view']->jquery_cal 'datepicker';
  4826.         return $this->view('contacts/documents-edit.html.twig', [
  4827.             'form' => $files_utils->context['form']->createView()
  4828.         ]);
  4829.     }
  4830.     // }}}
  4831.     // {{{
  4832.     // {{{ action_documents_delete()
  4833.     /** Ajouter des documents à la structure
  4834.      *
  4835.      * @Route("/contacts/{slug}/documents-delete/idfile/{idfile}", name="contact_documents_delete_idfile")
  4836.      *
  4837.      * @access public
  4838.      * @return void
  4839.      */
  4840.     public function action_documents_delete($idfile null$slug nullUploadUtils $edit_utilsFilesController $files_utilsRequest $request)
  4841.     {
  4842.         $GLOBALS['rub_courante'] = 'contacts';
  4843.         $this->InitController($slug'documents');
  4844.         $this->context['params']['idfile'] = $idfile;
  4845.         // paramètre d'instanciation
  4846.         $params_edit = array(
  4847.             'idobject' => $this->idobject,
  4848.             'object' => 'contacts',
  4849.         );
  4850.         // si connecté, instancier la classe utilitaires d'édition
  4851.         if ($this->getUser() instanceof Extranetusers) {
  4852.             // controlleur pour l'edition
  4853.             $edit_utils->load($this->context$params_edit);
  4854.             // les droits
  4855.             $object_rights $edit_utils->checkObjectRights();
  4856.             $this->view->object_rights $object_rights;
  4857.             // checker si la personne connectée à les droits sur cette fiche
  4858.             //    if(!empty($object_rights['update'])) {
  4859.             // pour la gestion des fichiers
  4860.             $files_utils->InitFilesController($this->context$params_edit);
  4861.             $this->context['view']->data_object $this->infosobject;
  4862.             $response $files_utils->documents_delete($request);
  4863.             if ($response instanceof RedirectResponse) {
  4864.                 return $response;
  4865.             }
  4866.             //    } else { // la personne n'a pas les droits => renvoi sur le formulaire de demande
  4867.             //        actionRedirect($context['view']->data_object['url_folder'].'/autorisation/');
  4868.             //    }
  4869.         } else { // personne non loguée
  4870.             // rediriger vers montheatre/connexion
  4871.             return $this->redirectToRoute('app_login', ['urifrom' => $this->context['view']->data_object['url_folder'] . '/documents-edit''entete_connexion' => $params_edit['object']]);
  4872.         }
  4873.         $this->extra_locate $this->extra_title 'Ajouter/modifier un document';
  4874.         return $this->view('contacts/documents-delete.html.twig', [
  4875. //            'form' => $files_utils->context['form']->createView()
  4876.         ]);
  4877.     }
  4878.     // {{{ action_documents()
  4879.     /** Les documents lié à la structure
  4880.      *
  4881.      * @Route("/contacts/{slug}/documents", name="contact_documents")
  4882.      *
  4883.      * @access public
  4884.      * @return void
  4885.      */
  4886.     public function action_documents($slug nullUploadUtils $edit_utilsFilesController $files_utilsRequest $request)
  4887.     {
  4888.         $GLOBALS['rub_courante'] = 'contacts';
  4889.         $this->InitController($slug'documents');
  4890.         // paramètre d'instanciation
  4891.         $params_edit = array(
  4892.             'idobject' => $this->idobject,
  4893.             'object' => 'contacts',
  4894.         );
  4895.         // si connecté, instancier la classe utilitaires d'édition
  4896.         if ($this->getUser() instanceof Extranetusers) {
  4897.             // controlleur pour l'edition
  4898.             $edit_utils->load($this->context$params_edit);
  4899.             // les droits
  4900.             $object_rights $edit_utils->checkObjectRights();
  4901.             // checker si la personne connectée à les droits sur cette fiche
  4902.             if (!empty($object_rights['update'])) {
  4903.                 $this->context['formFactory'] = $this->get('form.factory')->createBuilder(FormType::class, null, [
  4904.                     'attr' => [
  4905.                         'id' => 'masterform',
  4906.                         'novalidate' => true
  4907.                     ]
  4908.                 ]);
  4909.                 // pour la gestion des fichiers
  4910.                 $files_utils->InitFilesController($this->context$params_edit);
  4911.                 $files_utils->documents($request);
  4912.                 $this->view->form $files_utils->context['form']->createView();
  4913.             } else { // la personne n'a pas les droits => renvoi sur le formulaire de demande
  4914.                 return $this->redirect($this->infosobject['url_folder'] . '/autorisation/');
  4915.             }
  4916.         } else { // personne non loguée
  4917.             // rediriger vers montheatre/connexion
  4918.             return $this->redirectToRoute('app_login', ['urifrom' => $this->infosobject['url_folder'] . '/documents''entete_connexion' => $params_edit['object']]);
  4919.         }
  4920.         /* géré par Files_edit */
  4921.         $this->extra_locate $this->extra_title 'Documents associés';
  4922.         // style et js en plus pour les champs de relation
  4923.         $this->view->style_more[] = 'relat';
  4924.         $this->view->js_more[] = 'ajax.relation.js';
  4925.         return $this->view('contacts/documents.html.twig');
  4926.     }
  4927.     // }}}
  4928.     // {{{ action_telechargements()
  4929.     /** Les documents lié à la structure
  4930.      *
  4931.      * @Route("/contacts/{slug}/telechargements", name="contact_telechargements")
  4932.      *
  4933.      * @access public
  4934.      * @return void
  4935.      */
  4936.     public function action_telechargements($slug null)
  4937.     {
  4938.         $this->InitController($slug'telechargements');
  4939.         $this->extra_locate $this->extra_title 'Documents associés';
  4940.         // saison courante
  4941.         $this->context['view']->current_saison Date_time::getLastSaison();
  4942.         // une saison ?
  4943.         $this->context['view']->saison Date_time::getSaisonParam();
  4944.         if ($this->context['view']->saison == $this->context['view']->current_saison) {
  4945.             $this->context['view']->is_current_saison true;
  4946.         }
  4947.         $files $this->em->getRepository(Files::class);
  4948.         $classifications $this->em->getRepository(Classifications::class);
  4949.         // classifications des contacts
  4950.         $classifications_contact_list $classifications->getClassificationList('files''contacts'null, array(1), 'get_value');
  4951.         // classifications des spectacles
  4952.         $classifications_spectacle_list $classifications->getClassificationList('files''spectacles'null, array(1), 'get_value');
  4953.         // joindre les deux
  4954.         $classifications_list array_merge($classifications_contact_list$classifications_spectacle_list);
  4955.         // liste des fichiers
  4956.         $params_object_files = array(
  4957.             'valid' => 1,
  4958.             'publish' => 1,
  4959.             'force_mode' => 'file',
  4960.             'debug_sql_associate' => false
  4961.         );
  4962.         $object_files $files->getObjectFiles($this->idobject'contacts'$classifications_list$params_object_files);
  4963.         if (!empty($object_files)) {
  4964.             // trouver toutes les saisons
  4965.             foreach ($object_files as $k => $v) {
  4966.                 if (!empty($v['saison'])) {
  4967.                     $saisons[$v['saison']] = $v['saison'];
  4968.                 }
  4969.             }
  4970.             // classement du tableau
  4971.             if (!empty($saisons)) {
  4972.                 krsort($saisons);
  4973.                 $this->getCommonSearch([
  4974.                     'saisons_annees' => array(
  4975.                         'saisons' => $saisons,
  4976.                     )
  4977.                 ]);
  4978.                 $this->getCommonSearchView();
  4979.                 // première saison
  4980.                 if (empty($this->context['view']->saison)) {
  4981.                     foreach ($saisons as $k => $v) {
  4982.                         $this->context['view']->saison $v;
  4983.                         break;
  4984.                     }
  4985.                 }
  4986.             }
  4987.             foreach ($object_files as $k => $v) {
  4988.                 if (!empty($v['saison']) && $v['saison'] == $this->context['view']->saison) {
  4989.                     if (array_key_exists($v['idclassification'], $classifications_spectacle_list)) {
  4990.                         // infos sur le spectacle => trouver le spectacle
  4991.                         $classifications $this->em->getRepository(Classifications::class);
  4992.                         $sql 'SELECT idobject 
  4993.                         FROM object_file
  4994.                         WHERE idfile=' $v['idfile'] . '
  4995.                         AND object=\'spectacles\' ';
  4996.                         $idspectacle $classifications->queryOne($sql);
  4997.                         if (!empty($idspectacle)) {
  4998.                             $params_sql_spectacle = array(
  4999.                                 'special' => array(
  5000.                                     'idspectacle' => $idspectacle,
  5001.                                     'publish' => 'all',
  5002.                                     'join' => true// jointure gauche avec schedules
  5003.                                     'plus_proche' => true,
  5004.                                 ),
  5005.                                 'params' => array(
  5006.                                     'order' => ['s.dateinsert''DESC'],
  5007.                                     'limit' => array(0100),
  5008.                                     'where' => ' AND s.statut != 4',
  5009.                                 ),
  5010.                                 'dbg' => array('spectacles_list''Liste des spectacles'),
  5011.                             );
  5012.                             // affichage
  5013.                             $params_display = array(
  5014.                                 'stylemore' => array('imagep' => 'width:65px''descsp' => 'width:310px;'),
  5015.                             );
  5016.                             $spectacles $this->em->getRepository(Spectacles::class)->getListSpectacles($params_sql_spectacle$params_display);
  5017.                             foreach ($spectacles as $s) {
  5018.                                 $v['objects']['spectacles'][] = $s;
  5019.                             }
  5020.                             //$this->context['view']->files['spectacles'][$idspectacle]['files'][$v['idfile']] = $v;
  5021.                             $this->context['view']->files['spectacles'][$k] = $v;
  5022.                         }
  5023.                     }
  5024.                     if (array_key_exists($v['idclassification'], $classifications_contact_list)) {
  5025.                         $this->context['view']->files['general'][$k] = $v;
  5026.                     }
  5027.                 }
  5028.             }
  5029.             $this->context['view']->is_file true;
  5030.             if (!empty($saisons)) {
  5031.                 //setDebug($saisons);
  5032.             }
  5033.         }
  5034.         $this->js_more[] = 'jquery.matchHeight-min.js';
  5035.         //aside
  5036.         $this->asides->load('contact_telechargement_infos');
  5037.         return $this->view('contacts/telechargements.html.twig');
  5038.     }
  5039.     // }}}
  5040.     // {{{ action_presentation_edit()
  5041.     /** Modifier la présentation textuelle de la structure
  5042.      *
  5043.      * @Route("/contacts/{slug}/presentation-edit", name="contact_presentation_edit")
  5044.      *
  5045.      * @access public
  5046.      * @return void
  5047.      */
  5048.     public function action_presentation_edit($slug nullUploadUtils $uploadUtilsRequest $requestTheatreMail $TheatreMailUtilsEdit $utilsEditEditUtils $editUtils)
  5049.     {
  5050.         return $this->redirectToRoute('index', [], Response::HTTP_MOVED_PERMANENTLY);
  5051.     }
  5052.     // }}}
  5053.     // {{{ action_infos_generales()
  5054.     /** Informations générales sur la structure
  5055.      *
  5056.      * @Route("/contacts/{slug}/infos-generales", name="contact_infos_generales")
  5057.      *
  5058.      * @access public
  5059.      */
  5060.     public function action_infos_generales($slug nullRequest $requestTheatreMail $TheatreMailEditUtils $editUtils)
  5061.     {
  5062.         $this->InitController($slug'infos-generales');
  5063.         $this->extra_locate $this->extra_title 'Modifier vos informations';
  5064.         $idcontact $this->infosobject['idcontact'];
  5065.         if (isset($_GET['update_success'])) {
  5066.             $this->view->reponse['save_ok'] = 'Vos informations ont bien été enregistrées';
  5067.         }
  5068.         // si connecté, instancier la classe utilitaires d'édition
  5069.         if ($this->getUser() instanceof Extranetusers) {
  5070.             // paramètre d'instanciation
  5071.             $params_edit = array(
  5072.                 'idobject' => $idcontact,
  5073.                 'object' => 'contacts',
  5074.                 'em' => $this->em
  5075.             );
  5076.             $url_redirect '/contacts/' $this->infosobject['urlClean'] . '/';
  5077.             $object_fields = array(
  5078.                 'url',
  5079.                 'facebook',
  5080.                 'twitter',
  5081.                 'instagram',
  5082.                 'url_ticket',
  5083.                 'organisation',
  5084.                 'nom_suite',
  5085.                 'idtypestructure',
  5086.                 'license',
  5087.                 'address1',
  5088.                 'address2',
  5089.                 'zip',
  5090.                 'city',
  5091.                 'country',
  5092.                 'phone1',
  5093.                 'phone2',
  5094.                 'fax',
  5095.                 'email1',
  5096.                 'email2',
  5097.                 'email1_online',
  5098.                 'email2_online',
  5099.             );
  5100.             $editUtils->setParams($this->context$params_edit);
  5101.             // les droits
  5102.             $object_rights $editUtils->checkObjectRights();
  5103.             $this->view->object_rights $object_rights;
  5104.             // checker si la personne connectée à les droits sur cette fiche
  5105.             if (!empty($object_rights['update'])) {
  5106.                 $data $this->infosobject;
  5107.                 $GLOBALS['from_id'] = $data['idmultimedia'];
  5108.                 // les champs
  5109.                 $fields = array('text''link''facebook''twitter''instagram');
  5110.                 $form $this->get('form.factory')->createBuilder(FormType::class, $this->infosobject, [
  5111.                     'attr' => [
  5112.                         'id' => 'masterform'
  5113.                     ]
  5114.                 ]);
  5115.                 $form->add('organisation'TextType::class, [
  5116.                     'label' => 'Nom court',
  5117.                     'constraints' => [
  5118.                         new NotBlank([
  5119.                             'message' => 'Nom court : veuillez préciser le nom de votre structure'
  5120.                         ])
  5121.                     ],
  5122.                     'attr' => [
  5123.                         'size' => '45',
  5124.                         'id' => 'organisation'
  5125.                     ]
  5126.                 ]);
  5127.                 $form->add('nom_suite'TextType::class, [
  5128.                     'label' => 'Nom complet',
  5129.                     'required' => false,
  5130.                     'attr' => [
  5131.                         'size' => '45',
  5132.                         'id' => 'nom_suite'
  5133.                     ]
  5134.                 ]);
  5135.                 // select type structure
  5136.                 $typesstructures $this->em->getRepository(Typesstructures::class);
  5137.                 $typestructure_list $typesstructures->getTypeStructureList(true);
  5138.                 $typestructurenames_list $typesstructures->getTypeStructureList(truefalse, array(), true);
  5139.                 $typestructureselect_list = [];
  5140.                 foreach ($typestructure_list as $key => $value) {
  5141.                     $typestructureselect_list[$value] = $typestructurenames_list[$key];
  5142.                 }
  5143.                 $form->add('idtypestructure'ChoiceType::class, [
  5144.                     'label' => 'Type de structure',
  5145.                     'choices' => array_flip($typestructureselect_list),
  5146.                     'placeholder' => 'Choisissez dans la liste',
  5147.                     'required' => false,
  5148.                     'attr' => [
  5149.                         'class' => 'select_typestructure',
  5150.                         'id' => 'idtypestructure'
  5151.                     ]
  5152.                 ]);
  5153.                 $form->add('license'TextType::class, [
  5154.                     'label' => 'Licence de spectacle',
  5155.                     'required' => false,
  5156.                     'attr' => [
  5157.                         'size' => '45',
  5158.                         'id' => 'license'
  5159.                     ]
  5160.                 ]);
  5161.                 $form->add('address1'TextType::class, [
  5162.                     'label' => 'Adresse',
  5163.                     'constraints' => [
  5164.                         new NotBlank([
  5165.                             'message' => 'Adresse : veuillez préciser l\'adresse'
  5166.                         ])
  5167.                     ],
  5168.                     'attr' => [
  5169.                         'size' => '45',
  5170.                         'id' => 'address1'
  5171.                     ]
  5172.                 ]);
  5173.                 $form->add('address2'TextType::class, [
  5174.                     'label' => 'Adresse suite',
  5175.                     'required' => false,
  5176.                     'attr' => [
  5177.                         'size' => '45',
  5178.                         'id' => 'address2'
  5179.                     ]
  5180.                 ]);
  5181.                 $form->add('zip'TextType::class, [
  5182.                     'label' => 'Code postal',
  5183.                     'constraints' => [
  5184.                         new NotBlank([
  5185.                             'message' => 'Code postal : veuillez préciser le code postal'
  5186.                         ])
  5187.                     ],
  5188.                     'attr' => [
  5189.                         'size' => '45',
  5190.                         'id' => 'zip'
  5191.                     ]
  5192.                 ]);
  5193.                 $form->add('city'TextType::class, [
  5194.                     'label' => 'Ville',
  5195.                     'constraints' => [
  5196.                         new NotBlank([
  5197.                             'message' => 'Ville : veuillez préciser la ville'
  5198.                         ])
  5199.                     ],
  5200.                     'attr' => [
  5201.                         'size' => '45',
  5202.                         'id' => 'city'
  5203.                     ]
  5204.                 ]);
  5205.                 $form->add('country'ChoiceType::class, [
  5206.                     'label' => 'Pays',
  5207.                     'choices' => $this->em->getRepository(Contacts::class)->getCountryList(),
  5208.                     'constraints' => [
  5209.                         new NotBlank([
  5210.                             'message' => 'Pays : veuillez préciser le pays'
  5211.                         ])
  5212.                     ],
  5213.                     'attr' => [
  5214.                         'id' => 'country'
  5215.                     ]
  5216.                 ]);
  5217.                 $form->add('phone1'TextType::class, [
  5218.                     'label' => 'Téléphone général',
  5219.                     'required' => false,
  5220.                     'attr' => [
  5221.                         'size' => '45',
  5222.                         'id' => 'phone1'
  5223.                     ]
  5224.                 ]);
  5225.                 $form->add('phone2'TextType::class, [
  5226.                     'label' => 'Téléphone location',
  5227.                     'required' => false,
  5228.                     'attr' => [
  5229.                         'size' => '45',
  5230.                         'id' => 'phone2'
  5231.                     ]
  5232.                 ]);
  5233.                 $form->add('fax'TextType::class, [
  5234.                     'label' => 'Télécopie',
  5235.                     'required' => false,
  5236.                     'attr' => [
  5237.                         'size' => '45',
  5238.                         'id' => 'fax'
  5239.                     ]
  5240.                 ]);
  5241.                 $form->add('email1'TextType::class, [
  5242.                     'label' => 'Email général',
  5243.                     'required' => false,
  5244.                     'constraints' => [
  5245. //                        new NotBlank([
  5246. //                            'message' => 'Email : veuillez préciser un email'
  5247. //                        ]),
  5248.                         new Email([
  5249.                             'message' => 'Email général : l\'adresse email principale semble incorrecte'
  5250.                         ])
  5251.                     ],
  5252.                     'attr' => [
  5253.                         'size' => '45',
  5254.                         'id' => 'email1'
  5255.                     ]
  5256.                 ]);
  5257.                 $form->add('email2'TextType::class, [
  5258.                     'label' => 'Email location',
  5259.                     'required' => false,
  5260.                     'constraints' => [
  5261.                         new Email([
  5262.                             'message' => 'Email location : l\'adresse email de location semble incorrecte'
  5263.                         ])
  5264.                     ],
  5265.                     'attr' => [
  5266.                         'size' => '45',
  5267.                         'id' => 'email2'
  5268.                     ]
  5269.                 ]);
  5270.                 // masquer les adresses ?
  5271.                 $form->add('email1_online'ChoiceType::class, [
  5272.                     'placeholder' => false,
  5273.                     'label' => 'Email général visible',
  5274.                     'expanded' => true,
  5275.                     'multiple' => false,
  5276.                     'choices' => [
  5277.                         'oui' => 1,
  5278.                         'non' => 0
  5279.                     ],
  5280.                     'required' => false,
  5281.                 ]);
  5282.                 $form->add('email2_online'ChoiceType::class, [
  5283.                     'placeholder' => false,
  5284.                     'label' => 'Email location visible',
  5285.                     'expanded' => true,
  5286.                     'multiple' => false,
  5287.                     'choices' => [
  5288.                         'oui' => 1,
  5289.                         'non' => 0
  5290.                     ],
  5291.                     'required' => false,
  5292.                 ]);
  5293.                 $form->add('url_ticket'TextType::class, [
  5294.                     'label' => 'Billetterie en ligne',
  5295.                     'required' => false,
  5296.                     'constraints' => [
  5297.                         new Url([
  5298.                             'protocols' => ['http''https'],
  5299.                             'message' => 'Billetterie : l\'adresse du site semble incorrecte(elle doit commencer par http://)'
  5300.                         ])
  5301.                     ],
  5302.                     'attr' => [
  5303.                         'size' => '45',
  5304.                         'id' => 'link'
  5305.                     ]
  5306.                 ]);
  5307.                 $form->add('url'TextType::class, [
  5308.                     'label' => 'Site internet',
  5309.                     'required' => false,
  5310.                     'constraints' => [
  5311.                         new Url([
  5312.                             'protocols' => ['http''https'],
  5313.                             'message' => 'Site internet : l\'adresse du site semble incorrecte (elle doit commencer par https://)'
  5314.                         ]),
  5315.                         new CheckWebsite([
  5316.                             'message' => 'Site Internet : le site Internet que vous avez précisé ne semble pas disponible ! Vérifiez qu\'il s\'agit bien de la bonne adresse'
  5317.                         ])
  5318.                     ],
  5319.                     'attr' => [
  5320.                         'size' => '45',
  5321.                         'id' => 'link'
  5322.                     ]
  5323.                 ]);
  5324.                 $form->add('facebook'TextType::class, [
  5325.                     'label' => 'Profil Facebook',
  5326.                     'required' => false,
  5327.                     'constraints' => [
  5328.                         new Url([
  5329.                             'protocols' => ['http''https'],
  5330.                             'message' => 'Profil Facebook : l\'adresse du profil facebook semble incorrecte (elle doit commencer par httpss://)'
  5331.                         ])
  5332.                     ],
  5333.                     'attr' => [
  5334.                         'size' => '45',
  5335.                         'id' => 'facebook'
  5336.                     ]
  5337.                 ]);
  5338.                 $form->add('twitter'TextType::class, [
  5339.                     'label' => 'Profil Twitter',
  5340.                     'required' => false,
  5341.                     'constraints' => [
  5342.                         new Url([
  5343.                             'protocols' => ['http''https'],
  5344.                             'message' => 'Profil Twitter : l\'adresse du profil twitter semble incorrecte (elle doit commencer par httpss://)'
  5345.                         ])
  5346.                     ],
  5347.                     'attr' => [
  5348.                         'size' => '45',
  5349.                         'id' => 'twitter'
  5350.                     ]
  5351.                 ]);
  5352.                 $form->add('instagram'TextType::class, [
  5353.                     'label' => 'Profil Instagram',
  5354.                     'required' => false,
  5355.                     'constraints' => [
  5356.                         new Url([
  5357.                             'protocols' => ['http''https'],
  5358.                             'message' => 'Profil Instagram : l\'adresse du profil instagram semble incorrecte (elle doit commencer par httpss://)'
  5359.                         ])
  5360.                     ],
  5361.                     'attr' => [
  5362.                         'size' => '45',
  5363.                         'id' => 'instagram'
  5364.                     ]
  5365.                 ]);
  5366.                 // choix de la vidéo de tête
  5367.                 $form->add('idmultimedia'RelationsType::class, [
  5368.                     'label' => 'Vidéo de tête',
  5369.                     'type_object' => 'form',
  5370.                     'type_dbdo' => 'multimedias',
  5371.                     'dbdo' => 'contacts',
  5372.                     'relat' => 'simple'
  5373.                 ]);
  5374.                 $form->add('validation'SubmitType::class, [
  5375.                     'label' => 'Enregistrer les informations',
  5376.                     'attr' => [
  5377.                         'class' => 'boutform boutbig'
  5378.                     ]
  5379.                 ]); // validation
  5380.                 $form $form->getForm();
  5381.                 $form->handleRequest($request);
  5382.                 // enregistrement des informations
  5383.                 if ($form->isSubmitted() && $form->isValid()) {
  5384.                     foreach ($object_fields as $f) {
  5385.                         if ($form->has($f)) {
  5386.                             $values[$f] = $this->escape($form->get($f)->getData());
  5387.                         }
  5388.                     }
  5389.                     // enregistrer la dernière version validée par un administrateur (fige)
  5390.                     // les versions intermédiaires ne seront pas enregistrées
  5391.                     if (!empty($data['valid_version'])) {
  5392.                         $values['other_versions'] = serialize($data);
  5393.                         $values['valid_version'] = 0;// remettre à zero la valid version
  5394.                     }
  5395.                     // un multimedia sélectionné ?
  5396.                     $idmultimedia $form->get('idmultimedia')->getViewData();
  5397.                     $values['idmultimedia'] = 0;
  5398.                     if (!empty($idmultimedia)) {
  5399.                         $values['idmultimedia'] = $idmultimedia;
  5400.                     }
  5401.                     // enregistrer les nouvelles versions
  5402.                     $editUtils->obj->setUpdateFields($values);
  5403.                     if ($editUtils->obj->setData($idcontact)) {
  5404.                         // envoyer un mail à l'admin
  5405.                         $editUtils->sendAlerte($idcontact'update''Mise à jour des informations générales'$TheatreMail);
  5406. //                        $edit_utils->logAction($idcontact,null,'contacts',$this->getUser()->getIdextranetuser());
  5407.                         // prévenir du success
  5408.                         $reponse['save_ok'] = 'Vos informations ont bien été enregistrées';
  5409.                         return $this->redirect('/contacts/' $data['url_clean'] . '/infos-generales?update_success');
  5410.                         // les nouvelles valeurs
  5411.                         $data $values;
  5412.                         // pour le pays
  5413.                         $data['country_code'] = $data['country'];
  5414.                     } else {
  5415.                         $this->logger->error('Pb pendant l\'enregistrement d\'un contact');
  5416.                     }
  5417.                 }
  5418.                 if (!$form->isSubmitted()) {
  5419.                     $form->get('email1_online')->setData(0);
  5420.                     if ($this->infosobject['email1Online']) {
  5421.                         $form->get('email1_online')->setData($this->infosobject['email1Online']);
  5422.                     }
  5423.                     $form->get('email2_online')->setData(0);
  5424.                     if ($this->infosobject['email2Online']) {
  5425.                         $form->get('email2_online')->setData($this->infosobject['email2Online']);
  5426.                     }
  5427.                     if (empty($data['country_code'])) {
  5428.                         $form->get('country')->setData(array('FR'));
  5429.                     } else {
  5430.                         $form->get('country')->setData(strtoupper($data['country_code']));
  5431.                     }
  5432.                     if (empty($data['idtypestructure'])) {
  5433.                         $form->get('idtypestructure')->setData(0);
  5434.                     } else {
  5435.                         $form->get('idtypestructure')->setData($data['idtypestructure']);
  5436.                     }
  5437.                     if (!empty($data['urlTicket'])) {
  5438.                         $form->get('url_ticket')->setData($data['urlTicket']);
  5439.                     }
  5440.                     if (!empty($data['idmultimedia'])) {
  5441.                         $form->get('idmultimedia')->setData($data['idmultimedia']);
  5442.                     }
  5443.                 }
  5444.             } else { // la personne n'a pas les droits => renvoi sur le formulaire de demande
  5445.                 return $this->redirect($url_redirect 'autorisation/');
  5446.             }
  5447.         } else { // personne non loguée
  5448.             // rediriger vers montheatre/connexion
  5449.             return $this->redirect('/montheatre/connexion?urifrom=/contacts/' $this->context['view']->url_clean '/infos-generales&entete_connexion=contacts');
  5450.         }
  5451.         $this->view->js_more[] = 'ajax.relation.js';
  5452.         return $this->view('contacts/infos-generales.html.twig', [
  5453.             'form' => $form->createView()
  5454.         ]);
  5455.     }
  5456.     // }}}
  5457.     // {{{ action_equipe()
  5458.     /** Les équipes
  5459.      *
  5460.      *
  5461.      * @access public
  5462.      * @return void
  5463.      */
  5464.     public function action_equipe()
  5465.     {
  5466.         // style et js en plus pour les champs de relation
  5467.         $this->style_more[] = 'relat';
  5468.         $this->js_more[] = 'ajax.relation.js';
  5469.         $this->extra_locate $this->extra_title 'Equipe';
  5470.     }
  5471.     // }}}
  5472.     // {{{ action_eleves()
  5473.     /** Les éléves
  5474.      *
  5475.      *
  5476.      * @access public
  5477.      * @return void
  5478.      */
  5479.     public function action_eleves()
  5480.     {
  5481.         if ($this->idobject == 3914) { // pour le JTN
  5482.             $this->extra_locate $this->extra_title 'Artistes';
  5483.         } else {
  5484.             $this->extra_locate $this->extra_title 'Élèves';
  5485.         }
  5486.     }
  5487.     // }}}
  5488.     // {{{ action_eleves_edit()
  5489.     /** Les éléves ajout/modification
  5490.      *
  5491.      *
  5492.      * @access public
  5493.      * @return void
  5494.      */
  5495.     public function action_eleves_edit()
  5496.     {
  5497.         // style et js en plus pour les champs de relation
  5498.         $this->style_more[] = 'relat';
  5499.         $this->js_more[] = 'ajax.relation.js';
  5500.         $this->extra_locate $this->extra_title 'Élèves - Ajout/modification';
  5501.     }
  5502.     // }}}
  5503.     // {{{ action_dossiers()
  5504.     /** Les dossiers de presse
  5505.      *
  5506.      *
  5507.      * @access public
  5508.      * @return void
  5509.      */
  5510.     public function action_dossiers()
  5511.     {
  5512.         // style et js en plus pour les champs de relation
  5513.         /*$this->style_more[] = 'relat';
  5514.         $this->js_more[] = 'ajax.relation.js'; */
  5515.         $dossiers $this->contents->getAssociateContents($this->idobject$this->type_object'class_dossier_presse', array('no_by_lang' => true'get_files' => true));
  5516.         $this->view->dossiers $dossiers;
  5517.         $this->style_more[] = array('/navigation/js/upload/fileuploader.css');
  5518.         $this->js_more[] = 'upload/fileuploader.js';
  5519.         $this->extra_locate $this->extra_title 'Dossiers de presse';
  5520.     }
  5521.     // }}}
  5522.     // {{{ action_ecole()
  5523.     /** Anciens élèves
  5524.      *
  5525.      *
  5526.      * @access public
  5527.      * @return void
  5528.      */
  5529.     public function action_ecole()
  5530.     {
  5531.         if ($this->idobject == 3914) { // pour le JTN
  5532.             $this->extra_locate $this->extra_title 'Artistes';
  5533.             $this->context['view']->is_artiste true;
  5534.         } else {
  5535.             $this->extra_locate $this->extra_title 'Anciens élèves';
  5536.         }
  5537.     }
  5538.     // }}}
  5539.     // {{{ action_laureats()
  5540.     /** Lauréats d'un prix
  5541.      *
  5542.      * @Route("/contacts/{slug}/laureats", name="contact_laureats")
  5543.      * @Route("/contacts/{slug}/laureats/type/{p_type}", name="contact_laureats_type")
  5544.      * @Route("/contacts/{slug}/laureats/type/{p_type}/idaide/{p_idaide}", name="contact_laureats_type_idaide")
  5545.      *
  5546.      * @access public
  5547.      * @return void
  5548.      */
  5549.     public function action_laureats($slug null$p_type null$p_idaide null)
  5550.     {
  5551.         $this->context['params']['type'] = $p_type;
  5552.         $this->context['params']['idaide'] = $p_idaide;
  5553.         $this->InitController($slug'laureats');
  5554.         $this->context['view']->current_page 'laureats';
  5555.         $this->context['view']->show_prix false;
  5556.         $this->getContactAides(2);
  5557.         $this->context['view']->title_type 'Lauréat';
  5558.         $this->context['view']->menu_title_type 'lauréats';
  5559.         $this->asides->load(['url_lists' => array(
  5560.             'exec' => array(
  5561.                 'htmlstart' => true
  5562.             ),
  5563.             'php' => array(
  5564.                 'method' => 'asidesUrlLists',
  5565.                 'urls' => $this->context['view']->menu_types_object,
  5566.                 'url' => '/contacts/{v_url_clean}/{v_current_page}/type/key_type?y={v_year}',
  5567.                 'params' => array(
  5568.                     'key_type' => 'auto_key'
  5569.                 )
  5570.             ),
  5571.             'title' => 'Voir'
  5572.         )]);
  5573.         $this->asides->load(['par_annee' => array(
  5574.             'exec' => array(
  5575.                 'htmlend' => true
  5576.             ),
  5577.             'php' => array(
  5578.                 'method' => 'asidesUrlListsForms',
  5579.                 'url' => '/contacts/{v_url_clean}/{v_current_page}'
  5580.             ),
  5581.             'title' => 'Recherche par période'
  5582.         )]);
  5583.         // $this->asides->load('laureat_nbscene');
  5584.         $this->asides->load('contact_list_aidecontacts');
  5585.         $this->asides->load('laureat_prix_list');
  5586.         $this->asides->load('laureat_signaler');
  5587.         $this->asides->load('contact_chartreuse');
  5588.         return $this->view('contacts/laureats.html.twig');
  5589.     }
  5590.     // {{{ action_nominations()
  5591.     /** Nominations d'un prix
  5592.      *
  5593.      * @Route("/contacts/{slug}/nominations/", name="contact_nominations")
  5594.      * @Route("/contacts/{slug}/nominations/type/{p_type}", name="contact_nominationsç_type")
  5595.      * @Route("/contacts/{slug}/nominations/type/{p_type}/idaide/{p_idaide}", name="contact_nominations_type_idaide")
  5596.      *
  5597.      * @access public
  5598.      * @return void
  5599.      */
  5600.     public function action_nominations($slug null$p_type null$p_idaide null)
  5601.     {
  5602.         $this->InitController($slug'nominations');
  5603.         $this->context['view']->current_page 'nominations';
  5604.         $this->context['view']->show_prix false;
  5605.         $this->context['params']['type'] = $p_type;
  5606.         $this->context['params']['idaide'] = $p_idaide;
  5607.         $this->getContactAides(array(23));
  5608.         if (!empty($this->context['view']->filtres_aides_categories[$this->context['view']->params_filtre])) {
  5609.             $this->context['view']->aside_aide_contact_soutiens $this->em->getRepository(Aides::class)->getListAides([
  5610.                 'special' => array(
  5611.                     'aides' => array(
  5612.                         'idcontacts' => $this->idobject
  5613.                     ),
  5614.                     'idaidecontact' => $this->context['view']->filtres_aides_categories[$this->context['view']->params_filtre],
  5615.                     'type_aide' => array(23)
  5616.                 )
  5617.             ]);
  5618.         }
  5619.         $this->context['view']->title_type 'Nomination';
  5620.         $this->context['view']->menu_title_type 'nominés';
  5621.         $this->getAsideContent(['show_aides_contacts']);
  5622.         $this->asides->load('contact_chartreuse');
  5623.         return $this->view('contacts/nominations.html.twig');
  5624.     }
  5625.     // }}}
  5626.     // {{{ action_prix()
  5627.     /** Redirection des prix vers l'accueil (arnaque simplifié)
  5628.      *
  5629.      * @Route("/contacts/{slug}/prix", name="contact_prix")
  5630.      *
  5631.      * @access public
  5632.      * @return void
  5633.      */
  5634.     public function action_prix($slug null)
  5635.     {
  5636.         $this->InitController($slug'aides');
  5637.         return $this->redirectToRoute('contact_view', ['slug' => $this->context['view']->url_clean]);
  5638.     }
  5639.     // {{{ action_soutiens()
  5640.     /** Soutien à quelque chose
  5641.      *
  5642.      * @Route("/contacts/{slug}/soutiens", name="contact_soutiens")
  5643.      * @Route("/contacts/{slug}/soutiens/type/{type}", name="contact_soutiens_type")
  5644.      * @Route("/contacts/{slug}/soutiens/type/{type}/idaide/{idaide}", name="contact_soutiens_type_idaide")
  5645.      *
  5646.      * @access public
  5647.      * @return void
  5648.      */
  5649.     public function action_soutiens($slug null$type null$idaide null)
  5650.     {
  5651.         $this->context['params']['type'] = $type;
  5652.         $this->context['params']['idaide'] = $idaide;
  5653.         $this->InitController($slug'soutiens');
  5654.         // $tthis->conetext['view']->type_object
  5655.         //on supprime l'affichage de la date et de la ville
  5656.         $this->context['view']->noshow true;
  5657.         $this->context['view']->current_page 'soutiens';
  5658.         $this->perPage 20;
  5659.         $this->getContactAides(array(1));
  5660.         $this->context['view']->title_type 'Soutien';
  5661.         $this->context['view']->menu_title_type 'soutenus';
  5662.         $this->asides->load(['url_lists' => array(
  5663.             'exec' => array(
  5664.                 'htmlstart' => true,
  5665.             ),
  5666.             'php' => array(
  5667.                 'method' => 'asidesUrlLists',
  5668.                 'urls' => $this->context['view']->menu_types_object,
  5669.                 'url' => '/contacts/{v_url_clean}/{v_current_page}/type/key_type',
  5670.                 'params' => array(
  5671.                     'key_type' => 'auto_key'
  5672.                 )
  5673.             ),
  5674.             'title' => 'Voir'
  5675.         )]);
  5676.         $this->asides->load(['par_annee' => array(
  5677.             'exec' => array(
  5678.                 'htmlend' => true,
  5679.                 'color' => ($this->context['action'] == 'selections') ? 'textes' 'context',
  5680.             ),
  5681.             'php' => array(
  5682.                 'method' => 'asidesUrlListsForms',
  5683.                 'url' => '/contacts/{v_url_clean}/{v_current_page}'
  5684.             ),
  5685.             'title' => 'Recherche par periode'
  5686.         )]);
  5687.         $this->asides->load('contact_list_aidecontacts');
  5688.         $this->asides->load('contact_chartreuse');
  5689.         return $this->view('contacts/soutiens.html.twig');
  5690.     }
  5691.     // }}}
  5692.     // {{{ action_selections()
  5693.     /** Sélection de quelques choses
  5694.      *
  5695.      * @Route("/contacts/{slug}/selections", name="contact_selections")
  5696.      * @Route("/contacts/{slug}/selections/type/{type}/", name="contact_selections_type")
  5697.      * @Route("/contacts/{slug}/selections/type/{type}/idaide/{idaide}", name="contact_selections_type_idaide")
  5698.      *
  5699.      * @access public
  5700.      * @return void
  5701.      */
  5702.     public function action_selections($slug null$type null$idaide null)
  5703.     {
  5704.         $this->context['params']['type'] = $type;
  5705.         $this->context['params']['idaide'] = $idaide;
  5706.         $this->InitController($slug'selections');
  5707.         $this->getContactAides(array(4));
  5708.         $this->context['view']->title_type 'Sélection';
  5709.         $this->context['view']->menu_title_type 'sélectionnés';
  5710.         // $this->getAsideContent();
  5711.         $this->asides->load(['url_lists' => array(
  5712.             'exec' => array(
  5713.                 'htmlstart' => true,
  5714.                 'color' => ($this->context['action'] == 'selections') ? 'textes' 'context',
  5715.             ),
  5716.             'php' => array(
  5717.                 'method' => 'asidesUrlLists',
  5718.                 'urls' => $this->context['view']->menu_types_object,
  5719.                 'url' => '/contacts/{v_url_clean}/{v_current_page}/type/key_type',
  5720.                 'params' => array(
  5721.                     'key_type' => 'auto_key'
  5722.                 )
  5723.             ),
  5724.             'title' => 'Voir'
  5725.         )]);
  5726.         $this->asides->load(['par_annee' => array(
  5727.             'exec' => array(
  5728.                 'htmlend' => true,
  5729.                 'color' => ($this->context['action'] == 'selections') ? 'textes' 'context',
  5730.             ),
  5731.             'php' => array(
  5732.                 'method' => 'asidesUrlListsForms',
  5733.                 'url' => '/contacts/{v_url_clean}/selections'
  5734.             ),
  5735.             'title' => 'Recherche par periode'
  5736.         )]);
  5737.         $this->asides->load(['contact_list_aidecontacts' => array(
  5738.             'exec' => ['color' => 'textes']
  5739.         )]);
  5740.         $this->asides->load('laureat_signaler');
  5741.         $this->asides->load('contact_chartreuse');
  5742.         $this->context['view']->current_page 'selections';
  5743.         $this->context['view']->pagination['totalItems'] = $this->context['view']->pagination['total'];
  5744.         $this->context['view']->pagination['custom'] = true;
  5745.         $this->context['view']->pagination['custom_name'] = "selections";
  5746.         // $this->context['view']->pagination['perpage'] = 25;
  5747.         return $this->view('contacts/selections.html.twig');
  5748.     }
  5749.     // }}}
  5750.     // {{{ action_auteurs()
  5751.     /** Nominations d'un auteur
  5752.      *
  5753.      * @Route("/contacts/{slug}/auteurs", name="contact_auteurs")
  5754.      *
  5755.      * @access public
  5756.      * @return void
  5757.      */
  5758.     public function action_auteurs($slug null)
  5759.     {
  5760.         $this->InitController($slug'auteurs');
  5761.         $this->context['view']->current_page 'auteurs';
  5762.         $this->getContactAides(array(23));
  5763.         $this->context['view']->noshowtexteoriginal true;
  5764.         $title_types = array(
  5765.             'selections' => 'aux sélections',
  5766.             'laureats' => 'aux lauréats',
  5767.             'nominations' => 'aux nominations',
  5768.             'soutiens' => 'aux soutiens',
  5769.         );
  5770.         // si on vient de la page autre
  5771.         if (!empty($_REQUEST['from_page_aide']) && !empty($title_types[$_REQUEST['from_page_aide']])) {
  5772.             $_SESSION['from_page_aide'] = $_REQUEST['from_page_aide'];
  5773.         }
  5774.         if (!empty($_SESSION['from_page_aide'])) {
  5775.             $this->context['view']->title_type $title_types[$_SESSION['from_page_aide']];
  5776.             $this->context['view']->from_page_aide $_SESSION['from_page_aide'];
  5777.         }
  5778.         $this->context['view']->title_type 'Les textes par leurs auteurs';
  5779.         $this->context['view']->menu_title_type 'Nominations des textes par l\'auteur';
  5780.         $nav_textes_auteurs = array(
  5781.             array(
  5782.                 'name' => 'Tous les textes par leurs auteurs',
  5783.                 'key_url' => '/textes/edition/auteurs-spectacles/periode/affiche'
  5784.             )
  5785.         );
  5786.         //asides
  5787.         $this->asides->load(['url_lists' => array(
  5788.             'exec' => ['color' => 'videos''htmlstart' => true],
  5789.             'php' => array(
  5790.                 'method' => 'asidesUrlLists',
  5791.                 'urls' => $nav_textes_auteurs,
  5792.                 'url' => 'key_url'
  5793.             ),
  5794.             'title' => 'Voir'
  5795.         )]);
  5796.         $this->asides->load(['par_annee' => array(
  5797.             'exec' => ['color' => 'videos''htmlend' => true],
  5798.             'php' => array(
  5799.                 'method' => 'asidesUrlListsForms',
  5800.                 'url' => '/contacts/{v_url_clean}/auteurs/'
  5801.             ),
  5802.             'title' => 'Recherche par période'
  5803.         )]);
  5804.         return $this->view('contacts/auteurs.html.twig');
  5805.     }
  5806.     // }}}
  5807.     // {{{ action_etudiants_spectacles_tous()
  5808.     /** Anciens élèves
  5809.      *
  5810.      * @access public
  5811.      * @return void
  5812.      */
  5813.     public function action_etudiants_spectacles_tous($slug null)
  5814.     {
  5815.         $this->action_spectacles($slugfalse);
  5816.         $this->perPage 20;
  5817.         require_once PATH_LIBS 'Controllers/Ecoles_folder.php';
  5818.         $ecoles_folder = new Ecoles_folder($this->context, array(
  5819.             'idcontact' => $this->idobject,
  5820.         ));
  5821.         // classes
  5822.         $person_ecole $this->em->getRepository(PersonEcole::class);
  5823.         // compter mes élèves
  5824.         if ($person_ecole->countEleves($this->idobject) > 0) {
  5825.             $spectacles $this->em->getRepository(Spectacles::class);
  5826.             // les élèves
  5827.             $list_idpersons $person_ecole->getPersons($this->idobject, array('get_ids' => true));
  5828.             $where_idperson 'sp.`idperson` IN (' join(','$list_idpersons) . ') ';
  5829.             $params_sql = array(
  5830.                 'params' => array(
  5831.                     'where' => ' AND (' $where_idperson ') ',
  5832.                     'limit' => 'all',
  5833.                 ),
  5834.                 'special' => array(
  5835.                     'plus_proche' => true,
  5836.                     // les élèves du contact
  5837.                     'get_eleves' => array(
  5838.                         'idcontact' => $this->idobject,
  5839.                     ),
  5840.                 ),
  5841.                 'dbg' => array('scenes''Les spectacles à l\'affiche'),
  5842.             );
  5843.             // trouver les spectacle avec la classification JTN
  5844.             if (!empty($idclassification_specifique)) {
  5845.                 $params_sql = array(
  5846.                     'params' => array(
  5847.                         'limit' => 'all',
  5848.                     ),
  5849.                     'special' => array(
  5850.                         'plus_proche' => true,
  5851.                         'by_classification' => $idclassification_specifique,
  5852.                         'eleves_from_idcontact' => $this->idobject,
  5853.                     ),
  5854.                     'dbg' => array('etudiants_spectacles_tous''Les spectacles à l\'affiche des étudiants'),
  5855.                 );
  5856.             }
  5857.             // recherche par saison
  5858.             if (!empty($this->context['view']->saison)) {
  5859.                 $params_sql['special']['saison'] = $this->context['view']->saison;
  5860.             } elseif (!empty($this->context['view']->year)) { // recherche par année
  5861.                 $params_sql['special']['year'] = $this->context['view']->year;
  5862.             } elseif (!empty($this->context['view']->datestart) && !empty($this->context['view']->dateend)) { // par période
  5863.                 $params_sql['special']['period'] = array(
  5864.                     'start' => $this->context['view']->datestart,
  5865.                     'end' => $this->context['view']->dateend,
  5866.                 );
  5867.             } else { // prochains jours
  5868.                 $params_sql['special']['prochains'] = $this->context['view']->days;
  5869.             }
  5870.             //paginations
  5871.             $this->context['view']->pagination $this->getPagination(
  5872.                 $spectacles->countListSpectacles($params_sql), //Total de spectacle
  5873.                 $this->perPage//Nombre max de résultat
  5874.                 [
  5875.                     //Nombre total des représentations pour cette liste de spectacles
  5876.                     'total_dates' => $spectacles->countListSchedules($params_sql),
  5877.                 ]
  5878.             );
  5879.             $this->context['view']->pagination['spectacle'] = true;
  5880.             $this->context['view']->pagination['representation_spectacle'] = true;
  5881.             //Application des limites pour le nombre de spectacles
  5882.             $params_sql['params']['limit'] = array($this->getLimitStart(), $this->perPage);
  5883.             //On récupère la listes
  5884.             $this->context['view']->spectacles $spectacles->getListSpectacles($params_sqlnullfalse, ['allauthors' => true]);
  5885.         }
  5886.         $this->getAsidesSpectacles('etudiants-spectacles-tous');
  5887.     }
  5888.     // }}}
  5889.     // {{{ action_stats()
  5890.     /** l'action par défault
  5891.      *
  5892.      * @Route("/contacts/{slug}/stats", name="contact_stats")
  5893.      *
  5894.      */
  5895.     public function action_stats($slug null)
  5896.     {
  5897.         $this->InitController($slug'stats');
  5898.         if ($this->infosobject['stats_access'] == 1) {
  5899.             $utilscontacts = new UtilsContacts(array(
  5900.                 'idcontact' => $this->idobject,
  5901.                 'contacts' => $this->em->getRepository(Contacts::class)
  5902.             ));
  5903.             // champs de recherche
  5904. //            $this->context['form']->addElement('text', 'from', 'Entre', array('size'=>'7','id'=>'from'));
  5905. //            $this->context['form']->addElement('text', 'to', 'et', array('size'=>'7','id'=>'to'));
  5906.             // les dates des spectacles de tous les spectacles associés à ce contact
  5907.             $listdates $utilscontacts->getDatesCoprod();
  5908.             // récupérer la liste des années et des saisons et générer les listes déroulantes
  5909.             if (!empty($listdates)) {
  5910.                 $annees_saisons $this->getListSeasonsYears($listdates);
  5911.                 // liste des saisons
  5912.                 $this->view->saisons $annees_saisons['saisons'];
  5913. //                $this->context['form']->addElement('select', 's', 'Saisons', array_merge(array('' => 'Choisissez une saison...'),$annees_saisons['saisons']), array('id' => 'saisons'));
  5914.                 // liste des annees
  5915.                 $this->view->annees $annees_saisons['annees'];
  5916. //                $this->context['form']->addElement('select', 'y', 'Années', array_diff_key(array(0 => 'Choisissez une année...'),$annees_saisons['annees'])+$annees_saisons['annees'], array('id' => 'annees'));
  5917.             }
  5918.             // les totaux
  5919.             // le nombre de représentation au total soutenus par la structure
  5920.             $this->context['view']->nb_dates $utilscontacts->countDatesCoprod();
  5921.             // le nombre de représentation au total soutenus par la structure en France
  5922.             $this->context['view']->nb_dates_fr $utilscontacts->countFranceDatesCoprod();
  5923.             // le nombre de représentation au total soutenus par la structure à l'étranger
  5924.             $this->context['view']->nb_dates_i8n $utilscontacts->countInternationalDatesCoprod();
  5925.             // le nombre de pays différents (hors France)
  5926.             $this->context['view']->nb_countries $utilscontacts->countCountriesDatesCoprod();
  5927.             // le nombre de spectacles au total soutenus par la structure
  5928.             $this->context['view']->nb_spectacles $utilscontacts->countSpectaclesCoprod();
  5929.             // le nombre total de représentations dans les différents type de structure (T, CDN...) = un tableau
  5930.             $this->context['view']->nb_dates_typestructure $utilscontacts->countTypestructureDatesCoprod();
  5931.             // compter par rapport au différent type de structure
  5932.             if (!empty($this->context['view']->nb_dates_typestructure)) {
  5933.                 $this->context['view']->total_dates_typestructure $utilscontacts->getTotal($this->context['view']->nb_dates_typestructurefalse);
  5934.                 // le nombre de représentations dans les autres type de structure
  5935.                 if ($this->context['view']->nb_dates $this->context['view']->total_dates_typestructure) {
  5936.                     $this->context['view']->nb_dates_alltypestructure $this->context['view']->nb_dates $this->context['view']->total_dates_typestructure;
  5937.                 } else {
  5938.                     $this->context['view']->nb_dates_alltypestructure $this->context['view']->total_dates_typestructure $this->context['view']->nb_dates;
  5939.                 }
  5940.             }
  5941.             // classe des dates
  5942. //            require_once PATH_LIBS.'Date/Date_time.php';
  5943.             // recherche une année ?
  5944.             $current_year $this->getYear();
  5945.             // une saison ?
  5946.             $saison $this->getSaison();
  5947.             // une période
  5948.             $from $this->getFrom();
  5949.             $to $this->getTo();
  5950.             if (!Date_time::checkStartEndFormat($from$to) && !empty($annees_saisons)) {
  5951.                 // si aucune recherche par année, par période ou par saison => recherche par saison
  5952.                 if (empty($current_year) && empty($saison)) {
  5953.                     // prendre la dernière saison
  5954.                     $saison Date_time::getLastSaison($annees_saisons['saisons']);
  5955.                 }
  5956.                 // recherche par saison
  5957.                 if (!empty($saison)) {
  5958.                     $annees_saison explode('-'$saison);
  5959.                     if (count($annees_saison) == 2) {
  5960.                         $from Date_time::getSaisonDatestart((int)$annees_saison[0]);
  5961.                         $to Date_time::getSaisonDateend((int)$annees_saison[1]);
  5962.                     }
  5963.                     // saison de recherche
  5964.                     $this->view->saison $saison;
  5965.                     // saison précédente / suivante
  5966.                     $this->view->saisons_nav $this->getSaisonsNav($annees_saisons['saisons'], $saison);
  5967.                 }
  5968.                 // recherche par annee
  5969.                 if (!empty($current_year)) { // recherche par année
  5970.                     $from date('Y-m-d'mktime(00011$current_year));
  5971.                     $to date('Y-m-d'mktime(0001231$current_year));
  5972.                     // annee de recherche
  5973.                     $this->view->current_year $current_year;
  5974.                 }
  5975.             }
  5976.             // au final, il doit y avoir une recherche période
  5977.             if (!empty($from) && !empty($to)) {
  5978.                 if (!Date_time::checkStartEndFormat($from$to)) {
  5979.                     $this->context['error'][] = 'Paramètres de recherche inccorect';
  5980.                 } else {
  5981.                     $utilscontacts->setPeriodeRecherche($from$to);
  5982.                     $this->context['view']->from $utilscontacts->contacts->getFormeDate($from'%d/%m/%Y'true);
  5983.                     $this->context['view']->to $utilscontacts->contacts->getFormeDate($to'%d/%m/%Y'true);
  5984.                 }
  5985.             }
  5986.             // le nombre de spectacles soutenus par la structure sur la période
  5987.             $this->context['view']->nb_spectacles_periode $utilscontacts->countSpectaclesCoprod();
  5988.             // le nombre de représentation soutenus par la structure sur la période
  5989.             $this->context['view']->nb_dates_periode $utilscontacts->countDatesCoprod();
  5990.             // le nombre de représentations dans les différents type de structure (T, CDN...) sur la période
  5991.             // en paramètre => les totaux calculés précédement
  5992.             $this->context['view']->nb_dates_typestructure_periode $utilscontacts->countTypestructureDatesCoprod($this->context['view']->nb_dates_typestructure);
  5993.             // compter par rapport au différent type de structure
  5994.             if (!empty($this->context['view']->nb_dates_typestructure_periode)) {
  5995.                 $this->context['view']->total_dates_typestructure_periode $utilscontacts->getTotal($this->context['view']->nb_dates_typestructure_periodetrue);
  5996.                 // le nombre de représentations dans les autres type de structure
  5997.                 if ($this->context['view']->nb_dates_periode $this->context['view']->total_dates_typestructure_periode) {
  5998.                     $this->context['view']->nb_dates_alltypestructure_periode $this->context['view']->nb_dates_periode $this->context['view']->total_dates_typestructure_periode;
  5999.                 } else {
  6000.                     $this->context['view']->nb_dates_alltypestructure_periode $this->context['view']->total_dates_typestructure_periode $this->context['view']->nb_dates_periode;
  6001.                 }
  6002.             }
  6003.             // le nombre de représentation soutenus par la structure en France sur la période
  6004.             $this->context['view']->nb_dates_fr_periode $utilscontacts->countFranceDatesCoprod();
  6005.             // le nombre de représentation soutenus par la structure à l'étranger sur la période
  6006.             $this->context['view']->nb_dates_i8n_periode $utilscontacts->countInternationalDatesCoprod();
  6007.             // le nombre de pays différents (hors France)
  6008.             $this->context['view']->nb_countries_periode $utilscontacts->countCountriesDatesCoprod();
  6009.             // jquery
  6010.             $this->context['view']->jquery_cal 'datepicker';
  6011.             /*$data_charts_string = '<script type="text/javascript">';
  6012.                 //var data_'.$d.' = ['.join(',', $$d).'];';
  6013.             $data_charts_string .= '
  6014.                 var data_evolution_multimedias = ['.join(',', $evolution_multimedias).'];
  6015.                 var data_date_evolution_multimedias = ['.join(',', $date_evolution_multimedias).'];';
  6016.             $data_charts_string .= '</script>';
  6017.             $this->view->data_charts = $data_charts_string;*/
  6018.         } else {
  6019.             $this->context['error'][] = 'Nos excuses mais les statistiques sont réservées aux abonnés premium';
  6020.         }
  6021.         return $this->view('contacts/stats.html.twig');
  6022.     }
  6023.     // }}}
  6024.     // {{{ getAsideContent()
  6025.     /** Function aside pour des actions diff
  6026.      *
  6027.      *
  6028.      * @access public
  6029.      * @return void
  6030.      */
  6031.     public function getAsideContent($params_page = array())
  6032.     {
  6033.         $htmlend true;
  6034.         if (isset($this->context['view']->menu_nb_scene)) {
  6035.             if ($this->context['action'] == 'soutiens') {
  6036.                 $htmlend false;
  6037.             } else {
  6038.                 $htmlend false;
  6039.             }
  6040.         } else {
  6041.             //on, force la fermeture de l'aside quand on se trouve dans nominations
  6042.             if ($this->context['action'] == 'nominations') {
  6043.                 $htmlend false;
  6044.             }
  6045.         }
  6046.         $this->asides->load(['url_lists' => array(
  6047.             'exec' => array(
  6048.                 'htmlstart' => true,
  6049.                 'htmlend' => $htmlend,
  6050.                 'color' => ($this->context['action'] == 'selections') ? 'textes' 'context',
  6051.             ),
  6052.             'php' => array(
  6053.                 'method' => 'asidesUrlLists',
  6054.                 'urls' => $this->context['view']->menu_types_object,
  6055.                 'url' => '/contacts/{v_url_clean}/{v_current_page}/type/key_type?y={v_year}',
  6056.                 'params' => array(
  6057.                     'key_type' => 'auto_key'
  6058.                 )
  6059.             ),
  6060.             'title' => 'Voir'
  6061.         )]);
  6062.         if (isset($this->context['view']->menu_nb_scene)) {
  6063.             $this->asides->load(['url_lists,laureat_nbscene' => array(
  6064.                 'exec' => array(
  6065.                     // 'htmlend' => true,
  6066.                     'color' => ($this->context['action'] == 'selections') ? 'textes' 'context',
  6067.                 ),
  6068.                 'php' => array(
  6069.                     'method' => 'asidesUrlLists',
  6070.                     'urls' => $this->context['view']->menu_nb_scene,
  6071.                     'url' => 'key_url',
  6072.                     'params' => array(
  6073.                         'key_type' => 'auto_key'
  6074.                     )
  6075.                 )
  6076.             )]);
  6077.         }
  6078.         $this->asides->load(['par_annee' => array(
  6079.             'exec' => array(
  6080.                 'htmlend' => true,
  6081.                 'color' => ($this->context['action'] == 'selections') ? 'textes' 'context',
  6082.             ),
  6083.             'php' => array(
  6084.                 'method' => 'asidesUrlListsForms',
  6085.                 'url' => '/contacts/{v_url_clean}/{v_current_page}'
  6086.             ),
  6087.             'title' => 'Recherche par periode'
  6088.         )]);
  6089.         if ($this->context['view']->list_aidecontacts) {
  6090.             $this->asides->load(['laureat_prix_list' => array(
  6091.                 'exec' => array(
  6092.                     'alone' => true,
  6093.                     // 'htmlstart' => ($this->context['action'] == 'soutiens') ? false : true,
  6094.                     'color' => ($this->context['action'] == 'selections') ? 'textes' 'context',
  6095.                 )
  6096.             )]);
  6097.         }
  6098.         if (empty($params_page['show_aides_contacts'])) {
  6099.             $this->asides->load('contact_list_aidecontacts');
  6100.         }
  6101.         $this->asides->load('laureat_signaler');
  6102.     }
  6103.     // }}}
  6104.     // {{{ action_calendrier()
  6105.     /** page des calendrier pour les contacts
  6106.      *
  6107.      * @Route("/contacts/{slug}/calendrier/", name="contact_calendrier")
  6108.      * @Route("/contacts/{slug}/calendrier/type/{p_type}", name="contact_calendrier_type")
  6109.      *
  6110.      * @access public
  6111.      * @return void
  6112.      */
  6113.     public function action_calendrier($slug null$p_type null)
  6114.     {
  6115.         $this->context['params']['type'] = $p_type;
  6116.         $this->InitController($slug'calendrier');
  6117.         $this->action_spectacles($slugfalse);
  6118.         $schedules $this->em->getRepository(Schedules::class);
  6119.         $ids_spectacles array_merge($this->ids_spectacle_prod$this->ids_spectacle_structures_diffusions);
  6120.         $type 'prod';
  6121.         $params = [];
  6122.         if (!empty($this->context['params']['type']) && $this->context['params']['type'] == 'structure') {
  6123.             $ids_spectacles array_merge($this->ids_spectacle_in$this->ids_spectacle_structures_diffusions);
  6124.             $type 'structure';
  6125.             $params = [
  6126.                 'idcontact' => $this->idobject
  6127.             ];
  6128.         }
  6129.         $this->context['view']->{$type '_calendrier'} = true;
  6130.         $this->context['view']->type_calendrier $type;
  6131. //        $cache_critiques = Theatre_quick_cache::cacheAccess('calendrier_'.$type.'_'.$this->idobject,'lists','contacts');
  6132. //        $cache_critiques_menu = Theatre_quick_cache::cacheAccess('calendrier_'.$type.'_menu_'.$this->idobject,'lists','contacts');
  6133. //        $total = $schedules->getDateBySpectaclesDemain($ids_spectacles, 1000, null, 'old', ['count' => true]);
  6134. //        $totalStructure = $schedules->getDateBySpectaclesDemain($ids_spectacles, 1000, null, 'old', ['idcontact' => $this->idobject, 'count' => true]);
  6135. //        $cached_data_menu = $cache_critiques_menu->get();
  6136. //        if (Theatre_quick_cache::useCache() && $cached_data = $cache_critiques->get() && $cached_data_menu) { // on récupère les données du cache
  6137. //            $this->context['view']->schedules_dates_demains_par_mois = unserialize($cached_data);
  6138. //            $this->context['view']->menu_aside_mois = unserialize($cached_data_menu);
  6139. //        } else {
  6140.         $biographies_dates_demains $schedules->getDateBySpectaclesDemain($ids_spectacles1000null'old'$params);
  6141.         if (!$biographies_dates_demains) {
  6142.             return $this->redirectToRoute("contact_view", [
  6143.                 "slug" => $this->slug
  6144.             ]);
  6145.         }
  6146.         $menu_aside = array();
  6147.         $biographies_dates_demains_reconstruction = array();
  6148.         foreach ($biographies_dates_demains as $k => $v) {
  6149.             $date_month $schedules->getFormeDate($k"%B %Y"true);
  6150.             $date_month_hastag $schedules->getFormeDate($k"%B_%Y"true);
  6151.             if (empty($biographies_dates_demains_reconstruction[$date_month_hastag])) {
  6152.                 $menu_aside[$date_month_hastag] = [
  6153.                     'name' => $date_month,
  6154.                     'params' => $date_month_hastag,
  6155.                 ];
  6156.                 $biographies_dates_demains_reconstruction[$date_month_hastag] = $menu_aside[$date_month_hastag];
  6157.             }
  6158.             $biographies_dates_demains_reconstruction[$date_month_hastag]['datas'][$k] = $v;
  6159.             foreach ($biographies_dates_demains_reconstruction[$date_month_hastag]['datas'][$k]['datas'] as $idata => $data) {
  6160.                 $biographies_dates_demains_reconstruction[$date_month_hastag]['datas'][$k]['datas'][$idata]['spectacle'] = $this->em->getRepository(Spectacles::class)->getInfosSpectacle($data['idspectacle'], ['get_vignette' => true]);
  6161.             }
  6162.         }
  6163.         $this->context['view']->schedules_dates_demains_par_mois $biographies_dates_demains_reconstruction;
  6164. //            $cache_critiques->save(serialize($this->context['view']->schedules_dates_demains_par_mois));
  6165. //
  6166.         $this->context['view']->menu_aside_mois $menu_aside;
  6167. //            $cache_critiques_menu->save(serialize($this->context['view']->menu_aside_mois));
  6168. //        }
  6169.         $this->getAsidesSpectacles(); //appels asides communs
  6170.         return $this->view('contacts/calendrier.html.twig');
  6171.     }
  6172.     // }}}
  6173.     // {{{ action_en_scene()
  6174.     /** trouver les textes à l'affiche qui ont un soutien de la structure
  6175.      *
  6176.      * @Route("/contacts/{slug}/en-scene/", name="contact_en_scene")
  6177.      * @Route("/contacts/{slug}/en-scene/periode/{periode}/", name="contact_en_scene_periode")
  6178.      * @Route("/contacts/{slug}/en-scene/periode/{periode}/type/{type}", name="contact_en_scene_periode_type")
  6179.      * @Route("/contacts/{slug}/en-scene/periode/{periode}/type/{type}/area/{p_area}", name="contact_en_scene_periode_type_area")
  6180.      *
  6181.      * @access public
  6182.      * @return void
  6183.      */
  6184.     public function action_en_scene($slug null$periode null$type null$p_area null)
  6185.     {
  6186.         $this->context['params']['periode'] = $periode;
  6187.         $this->context['params']['type'] = $type;
  6188.         $this->context['params']['area'] = $p_area;
  6189.         $this->InitController($slug'en-scene');
  6190.         $this->action_spectacles($slugfalse);
  6191.         $this->perPage 20;
  6192.         $default_type_spectacle 'affiche';
  6193.         $this->context['view']->current_page 'en-scene';
  6194.         // tous les spectacles ou ceux à l'affiche
  6195.         $this->context['view']->periode_spectacle $default_type_spectacle;
  6196. //        if(!empty($this->context['params']['periode']) && !empty($this->context['view']->menu_spectacles_soutiens[$this->context['params']['periode']]) && $this->context['view']->menu_spectacles_soutiens[$this->context['params']['periode']]['count'] > 0) {
  6197.         if (!empty($this->context['params']['periode'])) {
  6198.             $this->context['view']->periode_spectacle $this->context['params']['periode'];
  6199.         }
  6200.         // On ajoute une condition pour afficher le titre dans la view selon l'url
  6201.         if ($this->context['view']->url_clean == 'Artcena') {
  6202.             $this->context['view']->is_artcena_affiche true;
  6203.         }
  6204.         $type '';
  6205.         if (!empty($this->context['params']['type'])) {
  6206.             $type $this->context['params']['type'];
  6207.         }
  6208.         //Tous les contenus hors podcasts france culture (sélection, soutiens, nomminatione etc.)
  6209.         // marquer l'élément actif
  6210.         $this->context['view']->menu_periodes[$this->context['view']->periode_spectacle]['active'] = 'on';
  6211.         $this->context['view']->{'periode_' $this->context['view']->periode_spectacle} = true;
  6212.         $this->getCommonSearch(array(
  6213.             'saisons_annees' => Date_time::getListSaisons(2000, (date('Y') + 1)),
  6214.             //'default_saison' => Date_time::getLastSaison(),
  6215.             'inverse_periode' => true,
  6216.             'nb_days' => 720,
  6217.         ));
  6218.         $this->getCommonSearchView();
  6219.         $spectacles $this->em->getRepository(Spectacles::class);
  6220.         $texts $this->em->getRepository(Texts::class);
  6221.         // les spectacles à l'affiche avec des textes nonfictif
  6222.         $params_sql $this->setCommonSearchSpectacles(array(
  6223.             'params' => [
  6224.                 'where' => ' AND (s.title IS NULL OR s.title = \'\') '
  6225.             ],
  6226.             'special' => array(
  6227.                 //'get_text'
  6228.                 'textfictif' => 0,
  6229.                 'aide' => array(
  6230.                     'idcontact' => $this->idobject,
  6231.                     'type_aide' => $type
  6232.                 ),
  6233.                 'text_aide' => true,
  6234.                 'plus_proche' => true,
  6235.             ),
  6236.             'dbg' => array('list_textes_affiche''Liste des spectacles avec textes non fictifs qui ont reçu une aide'),
  6237.         ));
  6238.         if (!empty($params_sql['special']['area'])) {
  6239.             $spectacles->setZoneRecherche($this->em->getRepository(Regions::class)->getZipCode($params_sql['special']['area'])); // définir la zone de recherche
  6240.         }
  6241.         //order d'affichage par defaut commune à différents filtres
  6242.         $params_sql['params']['order'] = ['creation_date''DESC'];
  6243.         if ($this->context['view']->periode_spectacle == 'all') {
  6244.             //unset($params_sql['special']['saison']);
  6245.             unset($params_sql['special']['prochains']);
  6246.             unset($params_sql['special']['plus_proche']);
  6247.             unset($this->context['view']->days);
  6248.             $this->context['view']->detail_annee_creation_spectacle true;
  6249.             $this->context['view']->noshow_detail_periode true;
  6250.         } else if ($this->context['view']->periode_spectacle == 'anciens-textes') {
  6251.             //unset($params_sql['special']['saison']);
  6252.             $this->context['view']->is_anciens_textes true;
  6253.             $params_sql['special']['anciens'] = true;
  6254.             $params_sql['special']['anciens_stricts'] = true;
  6255.             unset($params_sql['special']['prochains']);
  6256.             unset($params_sql['special']['plus_proche']);
  6257.             unset($this->context['view']->days);
  6258.             $this->context['view']->detail_annee_creation_spectacle true;
  6259.             $this->context['view']->noshow_detail_periode true;
  6260.         } else if ($this->context['view']->periode_spectacle == 'affiche') {
  6261.             //ordre d'aaffiche propre au filtre à l'affiche
  6262.             // $params_sql['params']['order'] = array(
  6263.             //     'classement' => tru
  6264.             // );
  6265.             $params_sql['params']['order'] = ['sc.date''ASC'];
  6266.         } else {
  6267.             return $this->redirectToRoute("contact_en_scene", [
  6268.                 "slug" => $slug
  6269.             ]);
  6270.         }
  6271.         $this->context['view']->nb_spectacles_total $spectacles->countListSpectacles($params_sql);
  6272.         $this->context['view']->nb_dates_total $spectacles->countListSchedules($params_sql);
  6273.         $params_sql['params']['limit'] = array($this->getLimitStart(), $this->perPage);
  6274.         $list_spectacles $spectacles->getListSpectacles($params_sql);
  6275.         foreach ($list_spectacles as $idspectacle => $spectacle) {
  6276.             if (!empty($spectacle['creation_date'])) {
  6277.                 $list_spectacles[$idspectacle]['annee_creation'] = $spectacles->getFormeDate($spectacle['creation_date'], '%Y'true);
  6278.             }
  6279.         }
  6280.         $params_display['vignette_format'] = array('width' => $_ENV['VIGN_TEXT_WIDTH'], 'height' => $_ENV['VIGN_TEXT_HEIGHT'], 'direction' => 'thumb');
  6281.         if (!empty($list_spectacles)) {
  6282.             $this->context['view']->texts $texts->getTextsFromSpectacles($list_spectacles, array(), $params_display);
  6283.         }
  6284.         $this->context['view']->pagination $this->getPagination($this->context['view']->nb_spectacles_total10, array(
  6285.             'total_dates' => $this->context['view']->nb_dates_total,
  6286.         ));
  6287.         $this->context['view']->pagination['spectacle'] = true;
  6288.         $this->context['view']->pagination['representation_spectacle'] = true;
  6289.         $title_types = array(
  6290.             'selections' => 'aux sélections',
  6291.             'laureats' => 'aux lauréats',
  6292.             'nominations' => 'aux nominations',
  6293.             'soutiens' => 'aux soutiens',
  6294.         );
  6295.         // si on vient de la page autre
  6296.         if (!empty($_REQUEST['from_page_aide']) && !empty($title_types[$_REQUEST['from_page_aide']])) {
  6297.             $_SESSION['from_page_aide'] = $_REQUEST['from_page_aide'];
  6298.         }
  6299.         if (!empty($_SESSION['from_page_aide'])) {
  6300.             $this->context['view']->title_type $title_types[$_SESSION['from_page_aide']];
  6301.             $this->context['view']->from_page_aide $_SESSION['from_page_aide'];
  6302.         }
  6303.         // ajouter masonery
  6304.         $this->context['view']->js_more[] = 'jquery.masonry.min.js';
  6305.         $this->extra_locate $this->extra_title 'Textes en scène';
  6306.         $this->context['view']->show_prix false;
  6307.         if (!empty($this->context['view']->texts) || !empty($this->context['view']->spectacles)) {
  6308.             $this->context['view']->contents true;
  6309.         } //Si c'est France Culture on opte pour une redirection vers le contenu directement
  6310.         else if (in_array($this->idobject, [5955222]) && empty($this->context['params']['periode'])) {
  6311.             $params_sql $this->setCommonSearchSpectacles(array(
  6312.                 'special' => array(
  6313.                     'textfictif' => 0,
  6314.                     'plus_proche' => true,
  6315.                     'podcasts' => [
  6316.                         'type_podcast' => 'franceculture'
  6317.                     ]
  6318.                 ),
  6319.                 'dbg' => array('list_textes_affiche''Liste des spectacles avec textes non fictifs qui ont un podcast'),
  6320.             ));
  6321.             $params_sql['special']['type_franceinter'] = null;
  6322.             if ($this->idobject == 5222) {
  6323.                 $params_sql['special']['type_franceinter'] = 1;
  6324.             }
  6325.             $totalProchainsSpectaclesPodcasts $this->em->getRepository(Spectacles::class)->countListSpectacles($params_sql);
  6326.             unset($params_sql['special']['plus_proche']);
  6327.             $totalSpectaclesPodcasts $this->em->getRepository(Spectacles::class)->countListSpectacles($params_sql);
  6328.             if ($totalSpectaclesPodcasts 0) {
  6329.                 return $this->redirectToRoute('contact_emissions_cat_type', ['slug'=> $this->context['view']->url_clean'params_cat' => 'podcasts-spectacles''type'  => 'in']);
  6330.             } else if ($totalProchainsSpectaclesPodcasts 0) {
  6331.                 return $this->redirectToRoute('contact_emissions_cat_type', ['slug'=> $this->context['view']->url_clean'params_cat' => 'podcasts-spectacles''type'  => 'anciens']);
  6332.             }
  6333.         }
  6334.         //action en scène
  6335.         $this->getAsidesSpectacles(true); //appels asides communs
  6336.         return $this->view('contacts/en-scene.html.twig');
  6337.     }
  6338.     // }}}
  6339.     // {{{ getInfosContact()
  6340.     /** Les infos sur le contact
  6341.      *
  6342.      */
  6343.     public function getInfosContact()
  6344.     {
  6345.         return $this->infosobject;
  6346.     }
  6347.     // }}}
  6348.     // {{{ getLocate()
  6349.     /** Ou se trouve t'on (getter)
  6350.      *
  6351.      */
  6352.     public function getLocate()
  6353.     {
  6354.         return $this->locate;
  6355.     }
  6356.     // }}}
  6357.     // {{{ getTitlePage()
  6358.     /** Titre de la page (getter)
  6359.      *
  6360.      */
  6361.     public function getTitlePage()
  6362.     {
  6363.         return $this->title_page;
  6364.     }
  6365.     // }}}
  6366.     // {{{ getStyleMore()
  6367.     /** Style en plus (getter)
  6368.      *
  6369.      */
  6370.     public function getStyleMore()
  6371.     {
  6372.         return $this->style_more;
  6373.     }
  6374.     // }}}
  6375.     // {{{ getMetaKeywords()
  6376.     /** Keywords (getter)
  6377.      *
  6378.      */
  6379.     public function getMetaKeywords()
  6380.     {
  6381.         return $this->meta_keywords;
  6382.     }
  6383.     // }}}
  6384.     // {{{ getMetaDescription()
  6385.     /** Description (getter)
  6386.      *
  6387.      */
  6388.     public function getMetaDescription()
  6389.     {
  6390.         return $this->meta_description;
  6391.     }
  6392.     // }}}
  6393.     // {{{ getMtinfos()
  6394.     /** Infos mon théâtre
  6395.      *
  6396.      */
  6397.     public function getMtinfos()
  6398.     {
  6399.         return $this->mtinfos;
  6400.     }
  6401.     // }}}
  6402.     // {{{ setOtherDimensions()
  6403.     /** Taille maxi des vidéos
  6404.      *
  6405.      */
  6406.     public function setOtherDimensions($other_dimensions)
  6407.     {
  6408.         $this->other_dimensions $other_dimensions;
  6409.     }
  6410.     // }}}
  6411.     // {{{ getMultimediasIn()
  6412.     /** Récupérer les ids des vidéos des spectacles coproduits par le lieu
  6413.      *
  6414.      * @param array ids_spectacle_in Liste des ids des spectacles joués dans le lieu
  6415.      */
  6416.     public function getMultimediasIn($ids_spectacle_in = array(), $count false$exclude_ids_multimedia = array())
  6417.     {
  6418.         // les vidéos de spectacles joués dans ce lieu
  6419.         if (empty($ids_spectacle_in)) {
  6420.             if ($count) return 0; else return array();
  6421.         }
  6422.         if ($count) {
  6423.             $sql 'SELECT COUNT(DISTINCT(multimedias.idmultimedia)) ';
  6424.         } else {
  6425.             $sql 'SELECT DISTINCT(multimedias.idmultimedia) ';
  6426.         }
  6427.         // requete commune
  6428.         $sql .= 'FROM object_multimedia, multimedias
  6429.                  WHERE object_multimedia.idmultimedia=multimedias.idmultimedia
  6430.                  AND multimedias.publish=1
  6431.                  AND object_multimedia.object=\'spectacles\'
  6432.                  AND object_multimedia.idobject IN (' join(','$ids_spectacle_in) . ')';
  6433.         // exclure des ids ?
  6434.         if (!empty($exclude_ids_multimedia)) {
  6435.             $sql .= ' AND object_multimedia.idmultimedia NOT IN (' join(','$exclude_ids_multimedia) . ')';
  6436.         }
  6437.         if ($count) {
  6438.             $ids_multimedia_in $this->obj->queryOne($sql);
  6439.         } else {
  6440.             $ids_multimedia_in $this->obj->queryCol($sql);
  6441.         }
  6442.         return $ids_multimedia_in;
  6443.     }
  6444.     // }}}
  6445.     // {{{ getMultimediasProd()
  6446.     /** Récupérer les ids des vidéos des spectacles coproduits par le lieu
  6447.      *
  6448.      * @param array ids_spectacle_prod Liste des ids des spectacles coproduit par la structure
  6449.      * @return array
  6450.      */
  6451.     public function getMultimediasProd($ids_spectacle_prod = array(), $count false$exclude_ids_multimedia = array())
  6452.     {
  6453.         // les vidéos de spectacle coproduit par ce contact
  6454.         if (empty($ids_spectacle_prod)) {
  6455.             if ($count) return 0; else return array();
  6456.         }
  6457.         if ($count) {
  6458.             $sql 'SELECT COUNT(DISTINCT(multimedias.idmultimedia)) ';
  6459.         } else {
  6460.             $sql 'SELECT DISTINCT(multimedias.idmultimedia) ';
  6461.         }
  6462.         // requete commune
  6463.         $sql .= 'FROM object_multimedia, multimedias
  6464.                  WHERE object_multimedia.idmultimedia=multimedias.idmultimedia
  6465.                  AND multimedias.publish=1
  6466.                  AND object_multimedia.object=\'spectacles\'
  6467.                  AND object_multimedia.idobject IN (' join(','$ids_spectacle_prod) . ')';
  6468.         // exclure des ids ?
  6469.         if (!empty($exclude_ids_multimedia)) {
  6470.             $sql .= ' AND object_multimedia.idmultimedia NOT IN (' join(','$exclude_ids_multimedia) . ')';
  6471.         }
  6472.         if ($count) {
  6473.             $ids_multimedia_prod $this->obj->queryOne($sql);
  6474.         } else {
  6475.             $ids_multimedia_prod $this->obj->queryCol($sql);
  6476.         }
  6477.         return $ids_multimedia_prod;
  6478.     }
  6479.     // }}}
  6480.     // {{{ getMultimediasContact()
  6481.     /** Récupérer les ids des vidéos autres
  6482.      *
  6483.      * @param bool $count Compter seulement
  6484.      * @return array
  6485.      */
  6486.     public function getMultimediasContact($count false$exclude_ids_multimedia = array(), $exclude_ids_spectacle = array())
  6487.     {
  6488.         // les vidéos de spectacle associées (en partenariat) à ce contact
  6489.         if ($count) {
  6490.             $sql 'SELECT COUNT(DISTINCT(multimedias.idmultimedia)) ';
  6491.         } else {
  6492.             $sql 'SELECT DISTINCT(multimedias.idmultimedia) ';
  6493.         }
  6494.         // requete commune
  6495.         $sql .= 'FROM object_multimedia, multimedias
  6496.                  WHERE object_multimedia.idmultimedia=multimedias.idmultimedia
  6497.                  AND multimedias.publish=1
  6498.                  AND object_multimedia.object=\'contacts\'
  6499.                  AND object_multimedia.idobject=' $this->idobject;
  6500.         // exclure des ids multimedias ?
  6501.         if (!empty($exclude_ids_multimedia)) {
  6502.             $sql .= ' AND object_multimedia.idmultimedia NOT IN (' join(','$exclude_ids_multimedia) . ')';
  6503.         }
  6504.         // exclure les vidéos de spectacle
  6505.         if (!empty($exclude_ids_spectacle)) {
  6506.             //$sql .= ' AND (object_multimedia.object=\'spectacles\' AND object_multimedia.idobject NOT IN ('.join(',', $exclude_ids_spectacle).'))';
  6507.             $sql .= ' AND object_multimedia.idobject NOT IN (
  6508.                         SELECT object_multimedia.idobject FROM object_multimedia WHERE
  6509.                         object_multimedia.object=\'spectacles\' AND object_multimedia.idobject IN (' join(','$exclude_ids_spectacle) . ')
  6510.                     )';
  6511.         }
  6512.         if ($count) {
  6513.             $ids_multimedia_contact $this->obj->queryOne($sql);
  6514.         } else {
  6515.             $ids_multimedia_contact $this->obj->queryCol($sql);
  6516.         }
  6517.         return $ids_multimedia_contact;
  6518.     }
  6519.     // }}}
  6520.     // {{{ countAllSpectacles()
  6521.     /** Compter le nb total de spectacles
  6522.      *
  6523.      * @return int
  6524.      */
  6525.     public function countAllSpectacles()
  6526.     {
  6527.         // les spectacles DANS ce lieu
  6528.         $this->ids_spectacle_in $this->obj->getSpectaclesIn($this->idobject);
  6529.         $this->context['view']->nb_spectacles_in count($this->ids_spectacle_in);
  6530.         // les spectacles coproduits ou lieu de crée ou compagnie
  6531.         $this->ids_spectacle_prod $this->obj->getSpectaclesProd($this->idobject);
  6532.         $this->context['view']->nb_spectacles_prod count($this->ids_spectacle_prod);
  6533.         $this->ids_spectacle_structures_diffusions $this->obj->getSpectaclesProd($this->idobjectfalsenull77);
  6534.         $this->context['view']->nb_spectacles_structures_diffusions count($this->ids_spectacle_structures_diffusions);
  6535.         /*
  6536.         // spectacles co-produit non joué dans le lieu
  6537.         foreach($this->ids_spectacle_prod as $k=>$v) {
  6538.             $p = false;
  6539.             foreach($this->ids_spectacle_in as $kb=>$vb) {
  6540.                 if($v==$vb) {
  6541.                     $p = true;
  6542.                 }
  6543.             }
  6544.             if(!$p) echo "non présent";
  6545.         }
  6546.         exit;
  6547.         */
  6548.         // les spectacles avec une aide
  6549.         $this->ids_spectacle_aide $this->obj->getSpectaclesAide($this->idobject);
  6550.         $this->context['view']->nb_spectacles_aide count($this->ids_spectacle_aide);
  6551.         // les spectacles avec lauréagts/nominattions
  6552.         $this->ids_spectacle_laureats_nominations $this->obj->getSpectaclesAide($this->idobjectnull, array(23));
  6553.         $this->context['view']->nb_spectacles_laureats_nominations count($this->ids_spectacle_laureats_nominations);
  6554.         // les spectacles avec soutiens
  6555.         $this->ids_spectacle_soutiens $this->obj->getSpectaclesAide($this->idobjectnull, array(1));
  6556.         $this->context['view']->nb_spectacles_soutiens count($this->ids_spectacle_soutiens);
  6557.         // les spectacles avec sélection
  6558.         $this->ids_spectacle_selections $this->obj->getSpectaclesAide($this->idobjectnull, array(4));
  6559.         $this->context['view']->nb_spectacles_selections count($this->ids_spectacle_selections);
  6560.         // tous les spectacles
  6561.         $this->ids_spectacle_all array_unique(array_merge($this->ids_spectacle_prod$this->ids_spectacle_in$this->ids_spectacle_aide$this->ids_spectacle_structures_diffusions));
  6562.         $ids_spectacle_anciens $this->ids_spectacle_all;
  6563.         $ids_spectacle_anciens array_diff_key($ids_spectacle_anciens$this->ids_spectacle_in);
  6564.         $this->ids_spectacle_anciens $ids_spectacle_anciens;
  6565.         // cas du JTN => les spectacles avec le soutien de
  6566.         if (!empty($this->idclassification_soutien)) {
  6567.             $this->ids_spectacle_soutien $this->obj->getSpectaclesSoutien($this->idclassification_soutien);
  6568.             $this->context['view']->nb_spectacles_soutien count($this->ids_spectacle_soutien);
  6569.             $this->ids_spectacle_all array_unique(array_merge($this->ids_spectacle_all$this->ids_spectacle_soutien));
  6570.         }
  6571.         // cas d'un éditeur
  6572.         if ($this->infosobject['idtypestructure'] == 'ED') {
  6573.             $this->ids_spectacle_publisher $this->obj->getSpectaclesPublisher($this->idobject);
  6574.             $this->context['view']->nb_spectacles_publisher count($this->ids_spectacle_publisher);
  6575.             $this->ids_spectacle_all array_unique(array_merge($this->ids_spectacle_all$this->ids_spectacle_publisher));
  6576.         }
  6577.         $this->context['view']->nb_spectacles_all count($this->ids_spectacle_all);
  6578.         return count($this->ids_spectacle_all);
  6579.     }
  6580.     // }}}
  6581.     // {{{ countAllMultimedias()
  6582.     /** Compter le nb total de documents vidéos
  6583.      *
  6584.      * @return int
  6585.      */
  6586.     public function countAllMultimedias()
  6587.     {
  6588.         $sql '
  6589.             SELECT COUNT(DISTINCT(multimedias.idmultimedia))
  6590.             FROM multimedias
  6591.             WHERE
  6592.             multimedias.`publish`=1
  6593.             AND (';
  6594.         if (count($this->ids_spectacle_in) > || count($this->ids_spectacle_prod) > 0) {
  6595.             $sql .= 'multimedias.`idmultimedia` IN (
  6596.                             SELECT multimedias.`idmultimedia`
  6597.                             FROM object_multimedia JOIN multimedias ON object_multimedia.`idmultimedia`=multimedias.`idmultimedia`
  6598.                             AND object_multimedia.`object` IN (\'contacts\', \'spectacles\')
  6599.                             AND object_multimedia.idobject IN (' join(','array_merge($this->ids_spectacle_in$this->ids_spectacle_prod)) . ')
  6600.                         ) OR ';
  6601.         }
  6602.         $sql .= 'multimedias.`idmultimedia` IN (    
  6603.                         SELECT multimedias.idmultimedia
  6604.                         FROM object_multimedia JOIN multimedias ON object_multimedia.`idmultimedia`=multimedias.`idmultimedia`
  6605.                         AND object_multimedia.object IN (\'contacts\')
  6606.                         AND object_multimedia.idobject=' $this->idobject '
  6607.                     )
  6608.             )';
  6609.         /*
  6610.          * TODO:
  6611.          * pour récupérer les spectacles partenaires, mettre 'contacts' à la place de spectacles pour object_multimedia.object
  6612.         */
  6613.         return $this->obj->queryOne($sql);
  6614.         /*$nb_multimedias = $this->getMultimediasIn($this->ids_spectacle_in,true)+$this->getMultimediasProd($this->ids_spectacle_prod,true)+$this->getMultimediasContact(true);
  6615.         return $nb_multimedias;*/
  6616.     }
  6617.     // }}}
  6618.     // {{{ countAllCritiques()
  6619.     /** Compter le nb de critiques
  6620.      *
  6621.      * @return int
  6622.      */
  6623.     public function countAllCritiques($params = array())
  6624.     {
  6625.         $cacheKey "contact_count_all_critiques_{$this->idobject}_";
  6626.         $sql '
  6627.             SELECT COUNT(DISTINCT(ct.`idcontent`))
  6628.             FROM schedules sc
  6629.             JOIN spectacles s ON s.`idspectacle`=sc.`idspectacle`
  6630.             JOIN object_content oc ON s.`idspectacle`=oc.`idobject`
  6631.             JOIN contents ct ON oc.`idcontent`=ct.`idcontent`
  6632.             JOIN content_classification cc ON ct.`idcontent`=cc.`idcontent`
  6633.             WHERE s.`publish`=1 AND s.`valid`=1
  6634.             AND ct.`publish`=1 AND ct.`valid`=1
  6635.             AND cc.`idclassification`=101 ';
  6636.         if (!empty($this->ids_spectacle_all) && empty($params['all'])) {
  6637.             $sql .= ' AND (
  6638.                 sc.`idspectacle` IN (' $this->obj->arrayToIn($this->ids_spectacle_all) . ')
  6639.                 OR (
  6640.                     sc.`idcontact`=' $this->idobject ' OR sc.`idcontact_festival`=' $this->idobject '
  6641.                 )
  6642.             )';
  6643.             $cacheKey .= "all_" implode('-'$this->ids_spectacle_all);
  6644.         } else {
  6645.             $sql .= ' AND (
  6646.                 sc.`idcontact`=' $this->idobject ' OR sc.`idcontact_festival`=' $this->idobject '
  6647.             )';
  6648.         }
  6649.         $date date('Y-m-d');
  6650.         if (!empty($params['anciens'])) {
  6651.             $cacheKey .= "_anciens_$date";
  6652.             $sql .= " AND sc.date < '$date' ";
  6653.         }
  6654.         if (!empty($params['prochains'])) {
  6655.             $cacheKey .= "_prochains_$date";
  6656.             $sql .= " AND sc.date >= '$date' ";
  6657.         }
  6658.         $cacheItem $this->cache->getItem($cacheKey);
  6659.         if (! $cacheItem->isHit()) {
  6660.             $res $this->obj->queryOne($sql);
  6661.             $cacheItem->set($res)
  6662.                 ->expiresAt((new \DateTime('now'))->add(\DateInterval::createFromDateString('7 hours')));
  6663.             $this->cache->save($cacheItem);
  6664.         }
  6665.         if (!empty($res)) {
  6666.             // si pas de résultat, compter les critiques associés à ids_spectacle_all
  6667.             return $res;
  6668.         } else {
  6669.             return 0;
  6670.         }
  6671.     }
  6672.     // }}}
  6673.     // {{{ countAllEduc()
  6674.     /** Compter le nb total de spectacles éduc
  6675.      *
  6676.      * @return int
  6677.      */
  6678.     public function countAllEduc()
  6679.     {
  6680.         $idclassification 125;
  6681.         // les spectacles DANS ce lieu
  6682.         $cacheItem $this->cache->getItem("contact_countAllEduc_getSpectaclesIn_{$this->idobject}_$idclassification");
  6683.         if (! $cacheItem->isHit()) {
  6684.             $res $this->obj->getSpectaclesIn($this->idobjecttrue$idclassification);
  6685.             $cacheItem->set($res)
  6686.                 ->expiresAt((new \DateTime('now'))->add(\DateInterval::createFromDateString('7 hours')));
  6687.             $this->cache->save($cacheItem);
  6688.         }
  6689.         $nb_spectacles_in $cacheItem->get();
  6690.         // les spectacles coproduits ou lieu de crée ou compagnie
  6691.         $nb_spectacles_prod $this->obj->getSpectaclesProd($this->idobjecttrue$idclassification);
  6692.         $nb_spectacles_prod 0;
  6693.         $nb_spectacles_all $nb_spectacles_in $nb_spectacles_prod;
  6694.         // cas du JTN => les spectacles avec le soutien de
  6695.         /*if(!empty($this->idclassification_soutien)) {
  6696.             $nb_spectacles_soutien = $this->obj->getSpectaclesSoutien($this->idclassification_soutien,$idclassification);
  6697.             $nb_spectacles_all = $nb_spectacles_all+$nb_spectacles_soutien;
  6698.         }*/
  6699.         // cas d'un éditeur
  6700.         if ($this->infosobject['idtypestructure'] == 'ED') {
  6701.             $nb_spectacles_publisher $this->obj->getSpectaclesPublisher($this->idobjecttrue$idclassification);
  6702.             $nb_spectacles_all $nb_spectacles_all $nb_spectacles_publisher;
  6703.         }
  6704.         return $nb_spectacles_all;
  6705.     }
  6706.     // }}}
  6707.     // {{{ getSpectaclesDirectors()
  6708.     /** Trouver les metteurs en scènes associés aux spectacles de la structure
  6709.      *
  6710.      * @param int $idspectacles Les identifiants des spectacles
  6711.      * @return array
  6712.      */
  6713.     private function getSpectaclesDirectors($idspectacles = array())
  6714.     {
  6715.         if (empty($idspectacles)) {
  6716.             $idspectacles $this->ids_spectacle_all;
  6717.         }
  6718.         // recherche les metteurs en scène à partir de la liste des tous les spectacles du contact
  6719.         $sql_directors 'SELECT persons.url_clean, persons.idperson, persons.lastname, persons.firstname
  6720.                         FROM persons, spectacle_person, spectacles
  6721.                         WHERE persons.idperson=spectacle_person.idperson
  6722.                         AND spectacles.idspectacle=spectacle_person.idspectacle
  6723.                         AND spectacles.publish=1
  6724.                         AND spectacle_person.idrole=1
  6725.                         AND spectacle_person.idspectacle IN (' join(','$idspectacles) . ')
  6726.                         ORDER BY persons.lastname';
  6727.         $directors $this->obj->queryAll($sql_directors);
  6728.         return $directors;
  6729.     }
  6730.     // }}}
  6731.     // {{{ getSpectaclesAuthors()
  6732.     /** Trouver les auteurs et les auteurs de traduction
  6733.      *
  6734.      * @param int $idspectacles Les identifiants des spectacles
  6735.      * @return array
  6736.      */
  6737.     public function getSpectaclesAuthors($idspectacles = array())
  6738.     {
  6739.         if (empty($idspectacles)) {
  6740.             $idspectacles $this->ids_spectacle_all;
  6741.         }
  6742.         // les auteurs des textes traduits
  6743.         $sql_authors_traduction 'SELECT persons.url_clean, persons.idperson, persons.lastname, persons.firstname
  6744.                                     FROM persons, text_traduction, text_author, text_spectacle, spectacles
  6745.                                     WHERE persons.idperson=text_author.idperson
  6746.                                     AND spectacles.idspectacle=text_spectacle.idspectacle
  6747.                                     AND text_spectacle.idtext=text_traduction.idtexttraduction
  6748.                                     AND text_traduction.idtext=text_author.idtext
  6749.                                     AND spectacles.publish=1
  6750.                                     AND spectacles.idspectacle IN (' join(','$idspectacles) . ')
  6751.                                     ORDER BY persons.lastname';
  6752.         $authors_traduction $this->obj->queryAll($sql_authors_traduction);
  6753.         // trouver les auteurs des textes originaux
  6754.         $sql_authors 'SELECT persons.url_clean, persons.idperson, persons.lastname, persons.firstname
  6755.                         FROM persons, text_spectacle, text_author, spectacles
  6756.                         WHERE persons.idperson=text_author.idperson
  6757.                         AND spectacles.idspectacle=text_spectacle.idspectacle
  6758.                         AND text_spectacle.idtext=text_author.idtext
  6759.                         AND spectacles.publish=1
  6760.                         AND spectacles.idspectacle IN (' join(','$idspectacles) . ')
  6761.                         ORDER BY persons.lastname';
  6762.         $authors $this->obj->queryAll($sql_authors);
  6763.         // on merge les 2
  6764.         if (!empty($authors_traduction)) {
  6765.             $authors array_merge($authors$authors_traduction);
  6766.         }
  6767.         return $authors;
  6768.     }
  6769.     // }}}
  6770.     // {{{ getSpectaclesDates()
  6771.     /** Récupere  la liste des dates des spectacles à partir de la liste de tous les spectacles
  6772.      *
  6773.      * @param bool $critique Les dates des critiques
  6774.      * @param int $idspectacles Les identifiants des spectacles
  6775.      * @return array
  6776.      */
  6777.     public function getSpectaclesDates($critique false$idspectacles = array())
  6778.     {
  6779.         if (empty($idspectacles)) {
  6780.             if (!empty($this->ids_spectacle_all)) {
  6781.                 $idspectacles $this->ids_spectacle_all;
  6782.             } else {
  6783.                 return null;
  6784.             }
  6785.         }
  6786.         $cacheKey "contact_spectacles_dates_{$this->idobject}";
  6787.         $sql_annees '
  6788.             SELECT sc.`date`, YEAR(sc.`date`) as annee
  6789.             FROM schedules sc
  6790.             JOIN spectacles s ON s.`idspectacle`=sc.`idspectacle`
  6791.             JOIN object_content oc ON s.`idspectacle`=oc.`idobject`
  6792.             JOIN contents ct ON oc.`idcontent`=ct.`idcontent`
  6793.             JOIN content_classification cc ON ct.`idcontent`=cc.`idcontent`
  6794.             WHERE s.`publish`=1 AND s.`valid`=1
  6795.             AND ct.`publish`=1 AND ct.`valid`=1
  6796.             AND (sc.`idcontact`=' $this->idobject ' OR sc.`idcontact_festival`=' $this->idobject ')
  6797.             ORDER BY sc.`date`';
  6798.         // uniquement les spectacles avec une critique
  6799.         if ($critique) {
  6800.             $cacheKey .= "_critique_" implode('-'$idspectacles);
  6801.             $sql_annees '
  6802.                 SELECT sc.`date`, YEAR(sc.`date`) as annee
  6803.                 FROM schedules sc
  6804.                 JOIN spectacles s ON s.`idspectacle`=sc.`idspectacle`
  6805.                 JOIN object_content oc ON s.`idspectacle`=oc.`idobject`
  6806.                 JOIN contents ct ON oc.`idcontent`=ct.`idcontent`
  6807.                 JOIN content_classification cc ON ct.`idcontent`=cc.`idcontent`
  6808.                 WHERE s.`publish`=1 AND s.`valid`=1
  6809.                 AND ct.`publish`=1 AND ct.`valid`=1
  6810.                 AND cc.`idclassification`=101
  6811.                 AND
  6812.                     (
  6813.                         sc.`idspectacle` IN (' implode(','$idspectacles) . ')
  6814.                         OR (sc.`idcontact`=' $this->idobject ' OR sc.`idcontact_festival`=' $this->idobject ')
  6815.                     )
  6816.                 ORDER BY sc.`date`';
  6817.         }
  6818.         $cacheItem $this->cache->getItem($cacheKey);
  6819.         if (! $cacheItem->isHit()) {
  6820.             $res $this->obj->queryAll($sql_annees);
  6821.             $cacheItem->set($res)
  6822.                 ->expiresAt((new \DateTime('now'))->add(\DateInterval::createFromDateString('7 hours')));
  6823.             $this->cache->save($cacheItem);
  6824.         }
  6825.         $listdates $cacheItem->get();
  6826.         // liste des saisons et des années
  6827.         if (empty($listdates)) {
  6828.             //echo $listdates->getDebugInfos();
  6829.             return array();
  6830.         } else {
  6831.             return $listdates;
  6832.         }
  6833.     }
  6834.     // }}}
  6835.     // {{{ getListSpectaclesProd()
  6836.     /**  Productteur (17), coprod (18), prod délégué (19). Recherche sur spectacle_contact+idrole
  6837.      * prochains spectacles coproduit PAR ce lieu mais pas dans ce lieu puisque en tournée
  6838.      *
  6839.      * @param string $where_idcontact La chaine SQL de recherche
  6840.      * @param int $idperson_author Identifiant de l'auteur recherché
  6841.      * @param array $params_display Paramètre d'affichage en plus (par exemple array('api' => true) pour formater pour API)
  6842.      * @param array $params_sql_more Paramètre SQL en plus
  6843.      * @param array $idclassification Recherche les spectacles avec une classification particulière
  6844.      * @return array
  6845.      */
  6846.     public function getListSpectaclesProd($where_idcontact$idperson_author null$params_display = array(), $params_sql_more = array(), $idclassification null)
  6847.     {
  6848.         $params_sql = array(
  6849.             'params' => array(
  6850.                 'from' => 'TheatreCore\Entity\SpectacleContact sct',
  6851.                 'where' => $where_idcontact '
  6852.                             AND s.publish=1
  6853.                             AND sct.idspectacle=s.idspectacle
  6854.                             AND sct.idrole IN (17,18,19)
  6855.                             AND (sct.idcontact=' $this->idobject ' OR s.idcontactProduction=' $this->idobject ') ',
  6856.                 'limit' => $this->getLimit(nulltrue),
  6857.                 //'classement' => 'DESC',
  6858.             ),
  6859.             //AND (sct.idcontact='.$this->idobject.' OR s.idcontact_production='.$this->idobject.') ',
  6860.             'special' => array(//'plus_proche' => true,
  6861.             ),
  6862.             'dbg' => array('prod''Spectacles prod/coprod/prod deleg de ce contact')
  6863.         );
  6864.         // cas => uniquement les spectacles avec un contenu éduc
  6865.         if (!empty($idclassification)) {
  6866.             $params_sql['special']['idclassification'] = $idclassification;
  6867.         }
  6868.         // cas auteur
  6869.         if (!empty($idperson_author)) {
  6870.             $params_sql['special']['join_author'] = true;
  6871.             $params_sql['special']['idperson_author'] = $idperson_author;
  6872.         }
  6873.         // ajouter des paramètres
  6874.         if ($params_sql_more) {
  6875.             $params_sql $this->addParamsSql($params_sql$params_sql_more);
  6876.         }
  6877.         // executer
  6878.         return $this->em->getRepository(Spectacles::class)->getListSpectacles($params_sql$this->format_vignettefalse$params_display);
  6879.     }
  6880.     // }}}
  6881.     // {{{ getListSpectaclesIn()
  6882.     /**  Liste des spectacles dans le lieu
  6883.      *
  6884.      * @param string $where_idcontact La chaine SQL de recherche
  6885.      * @param int $idperson_author Identifiant de l'auteur recherché
  6886.      * @param array $params_display Paramètre d'affichage en plus (par exemple array('api' => true) pour formater pour API)
  6887.      * @param array $params_sql_more Paramètre supplémentaire pour la requpete SQL
  6888.      * @param array $idclassification Recherche les spectacles avec une classification particulière
  6889.      * @return array
  6890.      */
  6891.     public function getListSpectaclesIn($where_idcontact$idperson_author null$params_display = array(), $params_sql_more = array(), $idclassification null)
  6892.     {
  6893.         $params_sql = array(
  6894.             'params' => array(
  6895.                 'where' => $where_idcontact ' AND s.publish=1 AND ' $this->getWhereIdcontact(),
  6896.                 'limit' => $this->getLimit(nulltrue),
  6897.                 'classement' => $this->getOrder(),
  6898.             ),
  6899.             'special' => array(
  6900.                 "prochains" => true,
  6901.                 "order" => true
  6902.             ),
  6903.             'dbg' => array('in''Spectacles dans le lieu'),
  6904.         );
  6905.         if (isset($_REQUEST['get_texts'])) {
  6906.             if ($_REQUEST['get_texts'] == true) {
  6907.                 $params_sql['special']['get_texts'] = true;
  6908.             }
  6909.         }
  6910.         if ($this->isSearchArea()) {
  6911.             $params_sql['special']['carte_version'] = 'bigregions';
  6912.             $params_sql['special']['area'] = $this->getArea();
  6913.             $params_sql['special']['get_schedule_ville'] = $this->getArea();
  6914.         }
  6915.         if ($this->isSearchSeason()) {
  6916.             unset($params_sql['special']['prochains']);
  6917.         }
  6918.         // cas => uniquement les spectacles avec un contenu éduc
  6919.         if (!empty($idclassification)) {
  6920.             $params_sql['special']['idclassification'] = $idclassification;
  6921.         }
  6922.         // cas auteur
  6923.         if (!empty($idperson_author)) {
  6924.             $params_sql['special']['join_author'] = true;
  6925.             $params_sql['special']['idperson_author'] = $idperson_author;
  6926.         }
  6927.         // cas festival
  6928.         if (!empty($this->infosobject['is_festival'])) {
  6929.             $params_sql['special']['type_contact'] = 'idcontactFestival';
  6930.         }
  6931.         // ajouter des paramètres
  6932.         if ($params_sql_more) {
  6933.             $params_sql $this->addParamsSql($params_sql$params_sql_more);
  6934.         }
  6935.         return $this->em->getRepository(Spectacles::class)->getListSpectacles($params_sql$this->format_vignettefalse$params_display);
  6936.     }
  6937.     // }}}
  6938.     // {{{ getListSpectaclesEleve()
  6939.     /**  Liste des spectacles des eleves
  6940.      *
  6941.      * @param string $where_idcontact La chaine SQL de recherche
  6942.      * @param int $idperson_author Identifiant de l'auteur recherché
  6943.      * @param array $params_display Paramètre d'affichage en plus (par exemple array('api' => true) pour formater pour API)
  6944.      * @param array $params_display Paramètre supplémentaire pour la requpete SQL
  6945.      * @return array
  6946.      */
  6947.     public function getListSpectaclesEleve($where_idcontact$idperson_author null$params_display = array(), $params_sql_more = array())
  6948.     {
  6949.         $params_sql = array(
  6950.             'params' => array(
  6951.                 'from' => 'person_ecole pe',
  6952.                 'where' => $where_idcontact ' AND s.publish=1 AND pe.`idperson`=sp.`idperson` AND pe.`idcontact`=' . (int)$this->idobject ' ',
  6953.                 'limit' => $this->getLimit(nulltrue),
  6954.                 'classement' => $this->getOrder(),
  6955.             ),
  6956.             'special' => array(
  6957.                 'plus_proche' => true,
  6958.             ),
  6959.             'dbg' => array('in''Eleves à l\'affiche'),
  6960.         );
  6961.         // cas auteur
  6962.         if (!empty($idperson_author)) {
  6963.             $params_sql['special']['join_author'] = true;
  6964.             $params_sql['special']['idperson_author'] = $idperson_author;
  6965.         }
  6966.         // ajouter des paramètres
  6967.         if ($params_sql_more) {
  6968.             $params_sql $this->addParamsSql($params_sql$params_sql_more);
  6969.         }
  6970.         $datas $this->em->getRepository(Spectacles::class)->getListSpectacles($params_sql$this->format_vignettefalse$params_display);
  6971.         // parcourir les spectacles trouvé
  6972.         foreach ($datas as $s) {
  6973.             // les élèves et leur role
  6974.             $list_eleves $this->getPersonByContactSpectacle($this->idobject$s['idspectacle']);
  6975.             // dans le array
  6976.             if (!empty($list_eleves)) {
  6977.                 $new_list_eleves = array();
  6978.                 foreach ($list_eleves as $k => $v) {
  6979.                     if (!isset($new_list_eleves[$v['idperson']])) {
  6980.                         $new_list_eleves[$v['idperson']] = $v;
  6981.                     }
  6982.                     $new_list_eleves[$v['idperson']]['roles'][$v['idrole']] = array($v['role_string']);
  6983.                 }
  6984.                 foreach ($new_list_eleves as $t => $e) {
  6985.                     $new_list_eleves[$t]['roles'] = noPunct($e['roles']);
  6986.                 }
  6987.                 $datas[$s['idspectacle']]['eleves'] = noPunct($new_list_eleves);
  6988.             }
  6989.         }
  6990.         return $datas;
  6991.     }
  6992.     // }}}
  6993.     // {{{ getListSpectaclesSoutien()
  6994.     /**  Liste des spectacles avec le soutien de la structure
  6995.      *
  6996.      * @param string $where_idcontact La chaine SQL de recherche
  6997.      * @param int $idperson_author Identifiant de l'auteur recherché
  6998.      * @param array $params_display Paramètre d'affichage en plus (par exemple array('api' => true) pour formater pour API)
  6999.      * @param array $params_sql_more Paramètre SQL en plus
  7000.      * @param array $idclassification Recherche les spectacles avec une classification particulière
  7001.      * @return array
  7002.      */
  7003.     public function getListSpectaclesSoutien($where_idcontact$idperson_author null$params_display = array(), $params_sql_more = array(), $idclassification null)
  7004.     {
  7005.         $params_sql = array(
  7006.             'params' => array(
  7007.                 'where' => $where_idcontact ' AND s.publish=1',
  7008.                 'limit' => $this->getLimit(nulltrue),
  7009.                 'select' => 'sc.date',
  7010.             ),
  7011.             'special' => array(
  7012. //                'by_classification' => $this->idclassification_soutien,
  7013.                 'aide' => true,
  7014.                 'spectacle_aide' => [
  7015.                     'idcontact' => $this->idobject,
  7016.                     'end' => date('Y-m-d')
  7017.                 ],
  7018.                 // récup des élèves
  7019.                 'get_eleves' => array(
  7020.                     'idcontact' => $this->idobject
  7021.                 ),
  7022.             ),
  7023.             'dbg' => array('spectacle_soutien''Les spectacles avec le soutien du contact'),
  7024.         );
  7025.         // cas => uniquement les spectacles avec un contenu éduc
  7026.         if (!empty($idclassification)) {
  7027.             $params_sql['special']['idclassification'] = $idclassification;
  7028.         }
  7029.         // cas auteur
  7030.         if (!empty($idperson_author)) {
  7031.             $params_sql['special']['join_author'] = true;
  7032.             $params_sql['special']['idperson_author'] = $idperson_author;
  7033.         }
  7034.         // ajouter des paramètres
  7035.         if ($params_sql_more) {
  7036.             $params_sql $this->addParamsSql($params_sql$params_sql_more);
  7037.         }
  7038.         return $this->em->getRepository(Spectacles::class)->getListSpectacles($params_sql$this->format_vignettefalse$params_display);
  7039.     }
  7040.     // }}}
  7041.     // {{{ getListSpectaclesAide()
  7042.     /**  Liste des spectacles avec une aide associée à la structure
  7043.      *
  7044.      * @param string $where_idcontact La chaine SQL de recherche
  7045.      * @param int $idperson_author Identifiant de l'auteur recherché
  7046.      * @param array $params_display Paramètre d'affichage en plus (par exemple array('api' => true) pour formater pour API)
  7047.      * @param array $params_sql_more Paramètre SQL en plus
  7048.      * @param array $idclassification Recherche les spectacles avec une classification particulière
  7049.      * @return array
  7050.      */
  7051.     public function getListSpectaclesAide($where_idcontact$idperson_author null$params_display = array(), $params_sql_more = array(), $idclassification null)
  7052.     {
  7053.         $params_sql = array(
  7054.             'params' => array(
  7055.                 'where' => $where_idcontact ' AND s.publish=1 ',
  7056.                 'limit' => $this->getLimit(nulltrue),
  7057.             ),
  7058.             'special' => array(
  7059.                 'plus_proche' => true,
  7060.                 // avec une aides
  7061.                 'spectacle_aide' => true,
  7062.                 'aide' => array(
  7063.                     'idcontact' => $this->idobject
  7064.                 ),
  7065.                 // récup des élèves
  7066.                 'get_eleves' => array(
  7067.                     'idcontact' => $this->idobject
  7068.                 ),
  7069.             ),
  7070.             'dbg' => array('aide''Les spectacles avec une aide du contact'),
  7071.         );
  7072.         // cas => uniquement les spectacles avec un contenu éduc
  7073.         if (!empty($idclassification)) {
  7074.             $params_sql['special']['idclassification'] = $idclassification;
  7075.         }
  7076.         // cas auteur
  7077.         if (!empty($idperson_author)) {
  7078.             $params_sql['special']['join_author'] = true;
  7079.             $params_sql['special']['idperson_author'] = $idperson_author;
  7080.         }
  7081.         // ajouter des paramètres
  7082.         if ($params_sql_more) {
  7083.             $params_sql $this->addParamsSql($params_sql$params_sql_more);
  7084.         }
  7085.         return $this->em->getRepository(Spectacles::class)->getListSpectacles($params_sql$this->format_vignettefalse$params_display);
  7086.     }
  7087.     // }}}
  7088.     // {{{ getListSpectaclesTextAideContact()
  7089.     /**  Rechercher les spectacles monté à partir de textes ayant reçu une aide spécifique
  7090.      *
  7091.      * @param string $idcontact le contact recherché
  7092.      * @param int $idperson_author Identifiant de l'auteur recherché
  7093.      * @param array $params_display Paramètre d'affichage en plus (par exemple array('api' => true) pour formater pour API)
  7094.      * @param array $params_sql_more Paramètre SQL en plus
  7095.      * @param array $idclassification Recherche les spectacles avec une classification particulière
  7096.      * @return array
  7097.      */
  7098.     public function getListSpectaclesTextAideContact($where_idcontact$idperson_author null$params_display = array(), $params_sql_more = array(), $idclassification null)
  7099.     {
  7100.         /*
  7101.     'special' => array(
  7102.                 'textfictif' => 0,
  7103.                 'aide' => array(
  7104.                     'idcontact' => $this->idobject,
  7105.                 ),
  7106.                 'text_aide' => true,
  7107.             ),
  7108.             'dbg' => array('menu_list_textes_affiche', 'Liste des spectacles avec textes non fictifs qui ont reçu une aide'),
  7109.          */
  7110.         $params_sql = array(
  7111.             'params' => array(
  7112.                 'where' => $where_idcontact ' AND s.`publish`=1 ',
  7113.                 'limit' => $this->getLimit(nulltrue),
  7114.             ),
  7115.             'special' => array(
  7116.                 'textfictif' => 0,
  7117.                 'aide' => array(
  7118.                     'idcontact' => $this->idobject,
  7119.                 ),
  7120.                 'text_aide' => true,
  7121.                 //'plus_proche' => true,
  7122.             ),
  7123.             'dbg' => array('list_textes_aide_affiche''Liste des spectacles avec textes non fictifs qui ont reçu une aide'),
  7124.         );
  7125.         // ajouter des paramètres
  7126.         if ($params_sql_more) {
  7127.             $params_sql $this->addParamsSql($params_sql$params_sql_more);
  7128.         }
  7129.         // on souhaite également les infos sur le texte
  7130.         if (isset($_REQUEST['get_texts'])) {
  7131.             $params_sql['special']['get_text'] = array(
  7132.                 'get_illustration' => array(
  7133.                     'format' => array('width' => 300'height' => 300'direction' => 'thumb')
  7134.                 )
  7135.             );
  7136.         }
  7137.         // executer
  7138.         return $this->em->getRepository(Spectacles::class)->getListSpectacles($params_sql$this->format_vignettefalse$params_display);
  7139.     }
  7140.     // }}}
  7141.     // {{{ getPersonByContactSpectacle()
  7142.     /**  Les élèves d'une école pour un spectacle
  7143.      *
  7144.      * @param string $idcontact Le contact
  7145.      * @param int $idspectacle Le spectacle
  7146.      * @return array
  7147.      */
  7148.     public function getPersonByContactSpectacle($idcontact$idspectacle)
  7149.     {
  7150.         // trouver les élèves qui ont participé et leur rôle
  7151.         $sql_role 'SELECT DISTINCT(spectacle_person.`idspectacle`), spectacle_person.*, persons.`firstname`, persons.`lastname`, persons.`url_clean`, langterms.`fr` as role_string
  7152.                      FROM spectacle_person
  7153.                         INNER JOIN persons ON spectacle_person.`idperson`=persons.`idperson`
  7154.                         INNER JOIN person_ecole ON person_ecole.`idperson`=spectacle_person.`idperson`
  7155.                         INNER JOIN roles ON spectacle_person.`idrole`=roles.`idrole`
  7156.                             INNER JOIN langterms ON langterms.`id`=roles.`role`
  7157.                      WHERE spectacle_person.`idspectacle`=' . (int)$idspectacle '
  7158.                      AND person_ecole.`idcontact`=' . (int)$idcontact;
  7159.         $results $this->em->getRepository(Spectacles::class)->queryAll($sql_role);
  7160.         if (!empty($results) && !PEAR::isError($results)) {
  7161.             return $results;
  7162.         } else {
  7163.             return array();
  7164.         }
  7165.     }
  7166.     // }}}
  7167.     // {{{ getContactAides()
  7168.     /** Récupérer les laureats et nominations et les soutiens et les sélection
  7169.      *
  7170.      *
  7171.      * @access public
  7172.      * @param $type_aide int
  7173.      * @return void
  7174.      */
  7175.     public function getContactAides($type_aide$params = array())
  7176.     {
  7177.         $show_url_text_by_author false;
  7178.         if (!empty($this->context['view']->current_page)) {
  7179.             $this->context['view']->{'page_' $this->context['view']->current_page} = true;
  7180.         }
  7181.         // menu type
  7182.         $this->context['view']->menu_types_object = array(
  7183.             //'tous' =>   array('name' => 'Tous les lauréats'),
  7184.             'text' => array('name' => 'Tous les textes'),
  7185.             'spectacle' => array('name' => 'Tous les spectacles'),
  7186.             'person' => array('name' => 'Tous les artistes'),
  7187.             'contact' => array('name' => 'Toutes les structures')
  7188.         );
  7189.         $this->context['view']->filtres_aides_categories = array(
  7190.             'spectacle' => 107//résident de création
  7191.             'text' => 106 //résident d'écriture
  7192.         );
  7193.         // chercher une aide précise
  7194.         if (!empty($this->context['params']['idaide'])) {
  7195.             $idaide = (int)$this->context['params']['idaide'];
  7196.             $this->context['view']->{'texts_' $idaide} = true;
  7197.         }
  7198.         if (!empty($this->context['params']['type']) && !empty($this->context['view']->menu_types_object[$this->context['params']['type']])) {
  7199.             $type_object $this->context['params']['type'];
  7200.         } else {
  7201.             $type_object 'text';
  7202.         }
  7203.         foreach ($this->context['view']->menu_types_object as $t => $v) {
  7204.             // récupèrer les prix associés au contact
  7205.             $object_aide $this->em->getRepository('TheatreCore\Entity\\' ucfirst($t) . 'Aide');
  7206.             if (!is_array($type_aide)) {
  7207.                 $type_aide = array($type_aide);
  7208.             }
  7209.             //playlists table
  7210.             //idperson = 7051
  7211.             //idtext =     24291
  7212.             $params_sql_aide = array(
  7213.                 'special' => array(
  7214.                     'aides' => array(
  7215.                         'idcontacts' => $this->infosobject['idcontact'],
  7216.                         'type_aides' => $type_aide,
  7217.                     ),
  7218.                 ),
  7219.                 'dbg' => array($t '_aide_count''Nombre de ' $t ' lauréats'),
  7220.             );
  7221.             // compter le nombre total de lauréats
  7222.             $this->context['view']->menu_types_object[$t]['nb'] = $object_aide->{'countList' ucfirst($t) . 'Aide'}($params_sql_aide);
  7223.             if ($this->context['view']->menu_types_object[$t]['nb'] == 0) {
  7224.                 unset($this->context['view']->menu_types_object[$t]);
  7225.             } else {
  7226.                 $this->context['view']->menu_types_object[$t]['params_sql'] = $params_sql_aide;
  7227.                 $this->context['view']->menu_types_object[$t]['object_aide'] = $object_aide;
  7228.             }
  7229.         }
  7230.         if (!empty($this->context['view']->menu_types_object)) {
  7231.             // si type_object est vide, chercher un autre
  7232.             if (!isset($this->context['view']->menu_types_object[$type_object])) {
  7233.                 foreach ($this->context['view']->menu_types_object as $t => $v) {
  7234.                     $type_object $t;
  7235.                     break;
  7236.                 }
  7237.             }
  7238.             if (empty($this->context['params']['idaide'])) {
  7239.                 $this->context['view']->menu_types_object[$type_object]['active'] = 'on';
  7240.             }
  7241.             $this->context['view']->params_filtre $type_object;
  7242.             if ($type_object == 'contact') {
  7243.                 $this->perPage 50;
  7244.             }
  7245.             $aidecontacts $this->em->getRepository(Aidecontacts::class);
  7246.             $this->context['view']->aide_type_object $type_object;
  7247.             foreach ($this->context['view']->menu_types_object as $t => $v) {
  7248.                 // si on est dans le contexte
  7249.                 if ($type_object == $t) {
  7250.                     // il faut retrouver les différents aidecontact
  7251.                     $params_sql_aidecontact = array(
  7252.                         'where' => array(
  7253.                             array($t '_aide''publish'1),
  7254.                         ),
  7255.                         'special' => array(
  7256.                             'object' => $t,
  7257.                             'aides' => array(
  7258.                                 'idcontacts' => $this->idobject,
  7259.                                 'no_empty' => true,
  7260.                                 'type_aides' => $type_aide,
  7261.                             ),
  7262.                         ),
  7263.                         'limit' => array(0100),
  7264.                         'dbg' => array('list_aidecontacts_' $t'Liste des catégories d\'aide pour ' $t),
  7265.                     );
  7266.                     $this->context['view']->list_aidecontacts $aidecontacts->getListAidecontacts($params_sql_aidecontact);
  7267.                     if (count($this->context['view']->list_aidecontacts) == && !empty($idaide)) {
  7268.                         foreach ($this->context['view']->list_aidecontacts as $k => $value) {
  7269.                             $this->context['view']->categorie_aidecontact $value;
  7270.                         }
  7271.                     }
  7272.                     $object_aide $this->context['view']->menu_types_object[$t]['object_aide'];
  7273.                     $params_sql_aide $this->context['view']->menu_types_object[$t]['params_sql'];
  7274.                     $params_sql_aide['where'][] = array($t '_aide''publish'1);
  7275.                     // trouver les années où il y a eu des lauréats pour toutes les aides
  7276.                     $this->getCommonSearch(array(
  7277.                             'saisons_annees' => array(
  7278.                                 'annees' => $object_aide->getYears($params_sql_aide),
  7279.                             )
  7280.                         )
  7281.                     );
  7282.                     $this->getCommonSearchView();
  7283.                     if (!empty($this->context['view']->year)) {
  7284.                         $params_sql_aide['special']['period']['year'] = $this->context['view']->year;
  7285.                     }
  7286.                     // cherche une aide précise
  7287.                     if (!empty($idaide)) {
  7288.                         $params_sql_aide['special']['aides']['idaide'] = $idaide;
  7289.                         // par courir les aides et marquer l'active
  7290.                         foreach ($this->context['view']->list_aidecontacts as $ka => $va) {
  7291.                             foreach ($va['aides'] as $kb => $vb) {
  7292.                                 if (empty($vb[''])) {
  7293.                                     $this->context['view']->list_aidecontacts[$ka]['aides'][$kb]['mention_contacts'] = $aidecontacts->wikiTransform($vb['mention_contacts']);
  7294.                                 }
  7295.                                 if ($vb['idaide'] == $idaide) {
  7296.                                     $this->context['view']->list_aidecontacts[$ka]['aides'][$kb]['active'] = true;
  7297.                                     $this->context['view']->list_aidecontacts[$ka]['active'] = true;
  7298.                                 }
  7299.                             }
  7300.                         }
  7301.                     }
  7302.                     $params_display = array();
  7303.                     // texte style
  7304.                     if ($type_object == 'text') {
  7305.                         $params_display['vignette_format'] = array('width' => $_ENV['VIGN_TEXT_WIDTH'], 'height' => $_ENV['VIGN_TEXT_HEIGHT'], 'direction' => $_ENV['VIGN_TEXT_DIRECT']);
  7306.                         //suppression de la condition qui n'est utile que pour la V1
  7307.                         $params_display['stylemore'] = array('imagep' => 'width:60px;''desctxt' => 'width:210px;');
  7308.                         $params_display['publisher_first_inverse'] = true;
  7309.                         $params_sql_aide['get_texts_with_aides'] = true;
  7310.                     }
  7311.                     // pour les contacts
  7312.                     if ($type_object == 'contact') {
  7313.                         $params_sql_aide['get_contacts_with_aides'] = true;
  7314.                     }
  7315.                     // pour les spectacles
  7316.                     if ($type_object == 'spectacle') {
  7317.                         $params_sql_aide['get_spectacles_with_aides'] = true;
  7318.                     }
  7319.                     $this->context['view']->{'nb_list_aides_' $t} = $object_aide->{'countList' ucfirst($t) . 'Aide'}($params_sql_aide);
  7320.                     if (!empty($params['limit'])) {
  7321.                         $params_sql_aide['limit'] = array($params['limit'][0], $params['limit'][1]);
  7322.                     } else {
  7323.                         $params_sql_aide['limit'] = array($this->getLimitStart(), $this->perPage);
  7324.                     }
  7325.                     $params_sql_aide['dbg'] = array($t '_aide_list''Les ' $t ' lauréats');
  7326.                     $list $object_aide->{'getList' ucfirst($t) . 'Aide'}($params_sql_aide$params_display);
  7327.                     $this->context['view']->noshow false;
  7328.                     //on récupère les playlists pour la page 'texts par l'auteur'
  7329.                     if ($type_object == 'text' && ($this->context['action'] == 'auteurs' || !empty($params['vignette_video'])) || ($this->context['action'] == 'nominations' && !$show_url_text_by_author)) {
  7330.                         $first_boucle false;
  7331.                         foreach ($list as $key => $val) {
  7332.                             if (!empty($val['texts'])) {
  7333.                                 foreach ($val['texts'] as $skey => $sval) {
  7334.                                     $sql 'SELECT p.idplaylist
  7335.                                           FROM playlists p
  7336.                                           LEFT JOIN playlist_classification pc ON p.idplaylist = pc.idplaylist
  7337.                                           WHERE pc.idclassification = 144 AND p.idtext = ' $sval['idtext'] . '
  7338.                                           GROUP BY p.idtext';
  7339.                                     if ($type_object == 'text' && ($this->context['action'] == 'auteurs' || !empty($params['vignette_video']))) {
  7340.                                         if (!$first_boucle) {
  7341.                                             $this->context['view']->{'nb_list_aides_' $t} = 0;
  7342.                                             $first_boucle true;
  7343.                                         }
  7344.                                         if ($x $this->obj->queryOne($sql)) {
  7345.                                             $playlists $this->em->getRepository(Playlists::class);
  7346.                                             $playlist $playlists->getInfosPlaylist(
  7347.                                                 $x,
  7348.                                                 array(
  7349.                                                     'all' => true,
  7350.                                                     'multimedias' => true,
  7351.                                                     'format_vignette' => array('width' => $_ENV['VIGN_VIDEO_WIDTH'], 'height' => $_ENV['VIGN_VIDEO_HEIGHT'], 'fleche' => 'none''ratio' => '169')
  7352.                                                 ),
  7353.                                                 array('format_vignette' => true)
  7354.                                             );
  7355.                                             $video = (array_shift($playlist['multimedias']));
  7356.                                             $list[$key]['texts'][$sval['idtext']]['vignette'] = $video['image_media'];
  7357.                                             $list[$key]['texts'][$sval['idtext']]['thtv'] = true;
  7358.                                             $list[$key]['texts'][$sval['idtext']]['thtv_permalink'] = $video['permalink'];
  7359.                                             $list[$key]['texts'][$sval['idtext']]['url_clean_video'] = $playlist['urlClean'];
  7360.                                             $this->context['view']->{'nb_list_aides_' $t}++;
  7361.                                         } else {
  7362.                                             unset($list[$key]['texts'][$skey]);
  7363.                                         }
  7364.                                     } else {
  7365.                                         $show_url_text_by_author true;
  7366.                                         $this->context['view']->tag_text_by_author 1;
  7367.                                     }
  7368.                                 }
  7369.                             }
  7370.                         }
  7371.                     }
  7372.                     if (!empty($this->context['view']->list_aidecontacts)) {
  7373.                         $nb_aidecontacts 0;
  7374.                         foreach ($this->context['view']->list_aidecontacts as $k => $v) {
  7375.                             if (empty($v['aides'])) {
  7376.                                 $nb_aidecontacts $nb_aidecontacts count($v['aides']);
  7377.                             }
  7378.                         }
  7379.                     }
  7380.                     // si pas de sous-catégorie/aide, afficher la catégorie/aidecontact
  7381.                     if (empty($this->context['view']->list_aidecontacts) || $nb_aidecontacts == 1) {
  7382.                         if (!empty($nb_aide) && $nb_aide == 1) {
  7383.                             unset($this->context['view']->list_aidecontacts);
  7384.                         }
  7385.                         foreach ($list as $k => $v) {
  7386.                             $this->context['view']->aidecontact $v['aide']['aidecontact'];
  7387.                             break;
  7388.                         }
  7389.                     }
  7390.                     // groupement par année
  7391.                     $list_by_year = array();
  7392.                     if (empty($params['no_year_array'])) {
  7393.                         foreach ($list as $k => $v) {
  7394.                             if (!empty($v[$t 's'])) {
  7395.                                 $list_by_year[$v['year_start']][$v['idaide']]['description'] = $v['aide'];
  7396.                                 foreach ($v[$t 's'] as $kb => $vb) {
  7397.                                     $list_by_year[$v['year_start']][$v['idaide']][$t 's'][] = $vb;
  7398.                                 }
  7399.                             }
  7400.                         }
  7401.                         // dans les années, groupement par type d'aide
  7402.                         $this->context['view']->{'list_aides_' $t} = $list_by_year;
  7403.                     } // aucun groupement par année, array simple, textes
  7404.                     else {
  7405.                         foreach ($list as $k => $v) {
  7406.                             if (!empty($v['texts'])) {
  7407.                                 $idtext key($v['texts']);
  7408.                                 $list_texts[$idtext] = reset($v['texts']);
  7409.                                 $list_texts[$idtext]['aides'] = $v['aide'];
  7410.                             }
  7411.                         }
  7412.                         if (!empty($list_texts)) {
  7413.                             $this->context['view']->{'list_aides_' $t} = $list_texts;
  7414.                         }
  7415.                     }
  7416.                     $this->context['view']->pagination $this->getPagination($this->context['view']->{'nb_list_aides_' $t});
  7417.                 }
  7418.             }
  7419.         }
  7420.         // ajouter masonery
  7421.         //$this->context['view']->js_more[] = 'jquery.masonry.min.js';
  7422.     }
  7423.     // }}}
  7424.     // {{{ addParamsSql()
  7425.     /**  Ajouter/supprimer des paramètres pour getListSpectacles
  7426.      *
  7427.      * @param array $params_sql tableau orginal
  7428.      * @param array $params_sql tableau complété
  7429.      * @return array
  7430.      */
  7431.     public function addParamsSql($params_sql$params_sql_more)
  7432.     {
  7433.         // ajouter des paramètres
  7434.         unset($params_sql['params']['limit']);
  7435.         unset($params_sql['special']['plus_proche']);
  7436.         $params_sql array_merge_recursive($params_sql$params_sql_more);
  7437.         return $params_sql;
  7438.     }
  7439.     // }}}
  7440.     // {{{ getWhereIdcontact()
  7441.     /**  Définir le pattern de recherche en fonction du type (festival ou structure classique)
  7442.      *
  7443.      * @return string
  7444.      */
  7445.     public function getWhereIdcontact()
  7446.     {
  7447.         if (!empty($this->infosobject['is_festival'])) {
  7448.             return ' (sc.`idcontact`=' . (int)$this->idobject ' OR sc.`idcontactFestival`=' . (int)$this->idobject ') ';
  7449.         } else if ($this->infosobject['idtypestructure'] == 'ED' || $this->infosobject['idtypestructure'] == 'RV') {
  7450.             return ' t.`idcontact_publisher`=' . (int)$this->idobject ' ';
  7451.         } else {
  7452.             return ' sc.`idcontact`=' . (int)$this->idobject ' ';
  7453.         }
  7454.     }
  7455.     // }}}
  7456.     // {{{ getDvds()
  7457.     /** Les dvds et la VOD associées à ce spectacle
  7458.      *
  7459.      * @param bool $count_only Compter seulement
  7460.      * @return array|int
  7461.      *
  7462.      */
  7463.     public function getDvds($count_only false)
  7464.     {
  7465.         $params_sql = array(
  7466.             'dbg' => array('dvds_contact''Les dvds associés aux spectacles coproduits par la structure'),
  7467.             'special' => array(
  7468.                 'idspectacles' => $this->ids_spectacle_prod,
  7469.             )
  7470.         );
  7471.         if (empty($this->ids_spectacle_prod)) {
  7472.             $params_sql['special']['idcontacts'] = $this->idobject;
  7473.         }
  7474.         if ($count_only) {
  7475.             $params_sql['count_only'] = true;
  7476.             $params_sql['limit'] = array('all');
  7477.         } else {
  7478.             $params_sql['limit'] = array(0100);
  7479.         }
  7480.         return $this->em->getRepository(Dvds::class)->getListDvds($params_sql);
  7481.     }
  7482.     // }}}
  7483.     // {{{ countVod()
  7484.     /** Compter le nb de VOD
  7485.      *
  7486.      * @param bool $count_only Compter seulement
  7487.      * @return array|int
  7488.      *
  7489.      */
  7490.     public function countVod()
  7491.     {
  7492.         $params_sql = array(
  7493.             'dbg' => array('vods_contact''Compter les VODs'),
  7494.             'count_only' => true,
  7495.             'special' => array(
  7496.                 'vods' => true,
  7497.                 'idspectacles' => $this->ids_spectacle_prod,
  7498.             )
  7499.         );
  7500.         if (empty($this->ids_spectacle_prod)) {
  7501.             $params_sql['special']['idcontacts'] = $this->idobject;
  7502.         }
  7503.         return count($this->em->getRepository(Dvds::class)->getListDvds($params_sql));
  7504.     }
  7505.     // }}}
  7506.     // {{{ countTelechargements()
  7507.     /** Compter le nb de fichiers
  7508.      *
  7509.      * @return int
  7510.      *
  7511.      */
  7512.     public function countTelechargements()
  7513.     {
  7514.         $files $this->em->getRepository(Files::class);
  7515.         $classifications $this->em->getRepository(Classifications::class);
  7516.         // classifications des contacts
  7517.         $classifications_contact_list $classifications->getClassificationList('files''contacts'null, array(1), 'get_value');
  7518.         // classifications des spectacles
  7519.         $classifications_spectacle_list $classifications->getClassificationList('files''spectacles'null, array(1), 'get_value');
  7520.         // joindre les deux
  7521.         $classifications_list array_merge($classifications_contact_list$classifications_spectacle_list);
  7522.         // liste des fichiers
  7523.         $params_object_files = array(
  7524.             'valid' => 1,
  7525.             'publish' => 1,
  7526.             'force_mode' => 'file',
  7527.             'debug_sql_associate' => false
  7528.         );
  7529.         return $files->countObjectFiles($this->idobject'contacts'$classifications_list$params_object_files);
  7530.     }
  7531.     // }}}
  7532.     // {{{ countEnScene()
  7533.     /** Compter le nb de fichiers
  7534.      *
  7535.      * @return int
  7536.      *
  7537.      */
  7538.     public function countEnScene($params = array())
  7539.     {
  7540.         $this->getCommonSearch(array(
  7541. //            'saisons_annees' => Date_time::getListSaisons(2000,(date('Y')+1)),
  7542.             //'default_saison' => Date_time::getLastSaison(),
  7543.             'inverse_periode' => true,
  7544.             'nb_days' => 720,
  7545.         ));
  7546.         $params_sql $this->setCommonSearchSpectacles(array(
  7547.             'special' => array(
  7548.                 //'get_text'
  7549.                 'textfictif' => 0,
  7550.                 'aide' => array(
  7551.                     'idcontact' => $this->idobject,
  7552.                 ),
  7553.                 'text_aide' => true,
  7554.                 'plus_proche' => true
  7555.             ),
  7556.             'dbg' => array('list_textes_affiche''Liste des spectacles avec textes non fictifs qui ont reçu une aide'),
  7557.         ));
  7558.         if (!empty($params['all'])) {
  7559.             unset($params_sql['special']['prochains']);
  7560.             unset($params_sql['special']['plus_proche']);
  7561.         } else if (!empty($params['anciens'])) {
  7562.             unset($params_sql['special']['prochains']);
  7563.             unset($params_sql['special']['plus_proche']);
  7564.             $params_sql['special']['anciens'] = true;
  7565.             $params_sql['special']['anciens_stricts'] = true;
  7566.         }
  7567.         if (!empty($params['type_aide'])) {
  7568.             $params_sql['special']['aide']['type_aide'] = (is_array($params['type_aide'])) ? $params['type_aide'] : [$params['type_aide']];
  7569.         }
  7570.         if (!empty($params['without_lecture'])) {
  7571.             $params_sql['params']['where'] = ' AND s.`idtypespectacle` != 1';
  7572.         }
  7573.         return $this->em->getRepository(Spectacles::class)->countListSpectacles($params_sql);
  7574.     }
  7575.     // }}}
  7576.     /** Les asides communs aux pages biographies
  7577.      *
  7578.      */
  7579.     public function get_asides_biographies($type_page 'tous')
  7580.     {
  7581.         $menu_biographies = array(
  7582.             'auteurs' => array(
  7583.                 'name' => 'Tous les auteurs',
  7584.                 'key_filtre' => 'auteurs',
  7585.                 // 'count' => $spectacles_counts['prochains']
  7586.             ),
  7587.             // 'traducteurs' => array(
  7588.             //     'name' => 'Tous les traducteurs',
  7589.             //     'key_filtre' => 'traducteurs',
  7590.             //     // 'count' => $spectacles_counts['prochains']
  7591.             // ),
  7592.             // 'auteurs-affiche' => array(
  7593.             //     'name' => 'Les auteurs à l\'affiche',
  7594.             //     'key_filtre' => 'auteurs_affiche',
  7595.             //     'url' => '/editions/{v_url_clean}/auteurs/type/key_filtre/generate_params'
  7596.             //     // 'count' => $spectacles_counts['tous']
  7597.             // ),
  7598.             'decouverte-auteurs' => array(
  7599.                 'name' => 'Les auteurs par eux-mêmes',
  7600.                 'key_filtre' => 'decouverte-auteurs',
  7601.                 'url' => '/editions/{v_url_clean}/decouverte-auteurs',
  7602.             ),
  7603.         );
  7604.         //Tous les menus
  7605.         $this->asides->load(['url_lists' => array(
  7606.             'exec' => [
  7607.                 'color' => 'biographies',
  7608.                 'htmlstart' => true,
  7609.                 'htmlend' => (isset($this->view->menu_jours_auteurs)) ? false true
  7610.             ],
  7611.             'php' => array(
  7612.                 'method' => 'asidesUrlLists',
  7613.                 'urls' => $menu_biographies,
  7614.                 'url' => '/editions/{v_url_clean}/biographies/type/key_filtre/generate_params',
  7615.                 'params' => array(
  7616.                     'activate' => $this->view->type,
  7617.                 ),
  7618.                 'structure' => array(
  7619.                     'structure_classic' => array(
  7620.                         'd' => 'v_days',
  7621.                     )
  7622.                 )
  7623.             ),
  7624.             'title' => 'Voir'
  7625.         )]);
  7626.         if (isset($this->view->menu_jours_auteurs)) {
  7627.             $this->asides->load(['url_lists,menu_days' => array(
  7628.                 'exec' => [
  7629.                     'color' => 'biographies',
  7630.                     'htmlend' => true
  7631.                 ],
  7632.                 'php' => array(
  7633.                     'method' => 'asidesUrlLists',
  7634.                     'urls' => $this->view->menu_jours,
  7635.                     'url' => '/editions/{v_url_clean}/auteurs/type/key_filtre/generate_params',
  7636.                     'params' => array(
  7637.                         'key_filtre' => $this->view->type,
  7638.                         'activate' => $this->context['view']->days
  7639.                     ),
  7640.                     'structure' => array(
  7641.                         'structure_classic' => array(
  7642.                             'd' => 'key_day',
  7643.                         )
  7644.                     )
  7645.                 ),
  7646.                 'title' => 'Recherche par période'
  7647.             )]);
  7648.         }
  7649.         // $this->asides->load(['recherche_texte.inc' => array(
  7650.         //     'exec' => ['htmlstart' => true, 'color'=>'biographies'],
  7651.         //     'action' => '/editions/editeurs'
  7652.         // )]);
  7653.         if (!empty($this->view->alphabet)) {
  7654.             $this->asides->load(['recherche_alphabetique' => array(
  7655.                 'exec' => array(
  7656.                     'htmlstart' => true,
  7657.                     'htmlend' => true,
  7658.                     'color' => 'biographies'
  7659.                 ),
  7660.                 'php' => array(
  7661.                     'method' => 'asidesUrlLists',
  7662.                     'urls' => $this->view->alphabet,
  7663.                     'url' => '/editions/{v_url_clean}/biographies?lettre=key_letter',
  7664.                     'params' => [
  7665.                         'key_letter' => 'auto_key'
  7666.                     ]
  7667.                 ),
  7668.                 'title_seconds' => 'Recherche alphabétique'
  7669.             )]);
  7670.         }
  7671.         // $this->get_asides_common('biographies');
  7672.     }
  7673.     // }}}
  7674.     /** Les asides communs à toutes les plusieurs pages
  7675.      *
  7676.      */
  7677.     public function get_asides_common($color 'editions'$params_asides = array())
  7678.     {
  7679.         $params_carte_common = array(
  7680.             'exec' => ['color' => $color],
  7681.         );
  7682.         if (!empty($params_asides['carte_url_custom'])) {
  7683.             $params_carte_common['url'] = $params_asides['carte_url_custom'];
  7684.         }
  7685.         if (!in_array($this->context['action'], array('textes''biographies')) && (!empty($params_asides['no_show_map']) && $params_asides['no_show_map'])) {
  7686.             $this->asides->load(['common_carte' => $params_carte_common]);
  7687.         }
  7688.         $this->asides->load(['common_participer_contacts' => array(
  7689.             'url_custom_edit' => '/contacts/' $this->view->url_clean '/infos-generales'
  7690.         )]);
  7691.     }
  7692.     // }}}
  7693. }