src/Controller/EcolesController.php line 782

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\ClassTheatre\asides;
  4. use App\ClassTheatre\TheatreController;
  5. use App\Exception\RedirectException;
  6. use App\Service\Date_time;
  7. use App\Service\Functions;
  8. use Doctrine\ORM\EntityManagerInterface;
  9. use Symfony\Component\Cache\Adapter\AdapterInterface;
  10. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  11. use Symfony\Component\Form\Extension\Core\Type\FormType;
  12. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  13. use Symfony\Component\Form\FormFactoryInterface;
  14. use Symfony\Component\Routing\Annotation\Route;
  15. use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
  16. use Symfony\Contracts\Translation\TranslatorInterface;
  17. use TheatreCore\Classes\Ecoles;
  18. use TheatreCore\Entity\Aidecontacts;
  19. use TheatreCore\Entity\Contacts;
  20. use TheatreCore\Entity\EcoleRole;
  21. use TheatreCore\Entity\Multimedias;
  22. use TheatreCore\Entity\PersonEcole;
  23. use TheatreCore\Entity\Persons;
  24. use TheatreCore\Entity\Spectacles;
  25. class EcolesController extends TheatreController
  26. {
  27.     // {{{ _construct()
  28.     private ?AdapterInterface $cache null;
  29.     /** constructeur hérité
  30.      *
  31.      */
  32.     public function __construct(
  33.         EntityManagerInterface $em,
  34.         TranslatorInterface $translator,
  35.         TokenStorageInterface $tokenStorage,
  36.         Functions $func,
  37.         AdapterInterface $cache
  38.     )
  39.     {
  40.         // load new aside
  41.         $this->asides = new asides();
  42.         $this->func $func;
  43.         $GLOBALS['rub_courante'] = 'contacts';
  44.         $this->em $em;
  45.         $this->cache $cache;
  46.         // hérite du constructeur parent
  47.         parent::__construct($translator$tokenStorage);
  48.         $this->perPage 20;
  49.     }
  50.     // }}}
  51.     // {{{ InitController()
  52.     public function InitController($idcontact null$action null)
  53.     {
  54.         $this->idcontact $idcontact;
  55.         $this->view->action $this->context['action'] = $action;
  56.         $this->view->controller $GLOBALS['rub_courante'];
  57.         $this->contacts $this->em->getRepository(Contacts::class);
  58.         $this->person_ecole $this->em->getRepository(PersonEcole::class);
  59.         $this->ecole_role $this->em->getRepository(EcoleRole::class);
  60.         $this->context['view']->nb_eleves $this->person_ecole->countEleves($this->idcontact);
  61.         $idtypestructure 'EC';
  62.         $params_sql_typestructure = array(
  63.             'where' => array(
  64.                 array('contacts''idtypestructure'$idtypestructure),
  65.                 ' AND contacts.idcontact NOT IN (SELECT idcontact FROM contact_classification WHERE idclassification=99) ',
  66.             ),
  67.             'order' => array('contacts' => 'organisation'),
  68.             'direction' => 'ASC',
  69.             'idclassification' => array('NOT' => array(99)),
  70.             'limit' => array(0,300),
  71.             'dbg' => array('ecoles','Ecoles supérieures'),
  72.         );
  73.         $this->context['view']->structures $this->contacts->getListContacts($params_sql_typestructure,array(),array('get_profile_picture' => true));
  74.         foreach($this->context['view']->structures as $k=>$v) {
  75.             if(!empty($v['country_code'])){
  76.                 $this->context['view']->structures_by_country[$v['country_code']]['country'] = $v['country'];
  77.                 $this->context['view']->structures_by_country[$v['country_code']]['datas'][] = $v;
  78.             }
  79.         }
  80.         $this->context['view']->nb_structures count($this->context['view']->structures);
  81.         $this->asides = new asides();
  82.     }
  83.     // }}}
  84.     // {{{ buildMenu()
  85.     /** Construit le menu et l'envoie à la vue
  86.      *
  87.      *
  88.      * @access protected
  89.      * @return void
  90.      */
  91.     protected function buildMenu()
  92.     {
  93.         // menu pour écoles
  94.         $menu_content = array(
  95.             array(
  96.                 'name' => 'Actualités',
  97.                 'key_url' => 'ecoles/actualites'
  98.             ),
  99.             array(
  100.                 'name' => 'Les écoles',
  101.                 'key_url' => 'ecoles'
  102.             ),
  103.             array(
  104.                 'name' => 'Les étudiants',
  105.                 'key_url' => 'ecoles/etudiants',
  106.                 'key_url_2' => 'ecoles/anciens'
  107.             ),
  108. //            array(
  109. //                'name' => 'Les anciens à l\'affiche',
  110. //                'key_url' => 'ecoles/anciens-affiche',
  111. //            ),
  112.             array(
  113.                 'name' => 'Soutiens',
  114.                 'key_url' => 'ecoles/soutiens'
  115.             ),
  116.             array(
  117.                 'name' => 'En scène',
  118.                 'key_url' => 'ecoles/en-scene',
  119.                 'key_url_2' => 'ecoles/anciens-affiche-tous',
  120.                 'key_params' => 'type/prod'
  121.             )
  122.         );
  123.         $asides_top = new asides();
  124.         $asides_top->load(['aside_top' => array(
  125.             'php' => array(
  126.                 'method' => 'asidesUrlLists',
  127.                 'urls' => $menu_content,
  128.                 'url' => '/key_url/key_params',
  129.                 'params' => array(
  130.                     'key_url' => 'auto_key',
  131.                     'activate' => ($this->context['action'] == 'view') ? 'ecoles' 'ecoles/'.$this->context['action'],
  132.                     'key_params' => ''
  133.                 )
  134.             )
  135.         )
  136.         ]);
  137.         $this->context['view']->aside_top $asides_top->view();
  138.     }
  139.     // }}}
  140.     // {{{ finalizeAction()
  141.     /** Après l'action, construit le titre de page et le fil d'arianne
  142.      *
  143.      *
  144.      * @access protected
  145.      * @return void
  146.      */
  147.     protected function finalizeAction()
  148.     {
  149.         $this->buildMenu();
  150.         $this->context['view']->aside $this->asides->view();
  151.     }
  152.     // }}}
  153.     // {{{ action_actualites()
  154.     /** Actualités des écoles
  155.      *
  156.      * @Route("/ecoles/actualites", name="ecoles_actualites")
  157.      *
  158.      */
  159.     public function action_actualites()
  160.     {
  161.         $this->InitController(null'actualites');
  162.         $idtypestructure 'EC';
  163.         $multimedias $this->em->getRepository(Multimedias::class);
  164.         foreach($this->context['view']->structures AS $k => $v){
  165.             $idcontacts[] = $k;
  166.         }
  167.         $ids_spectacle_prod $this->contacts->getSpectaclesProd($idcontacts);
  168. //        print_r($ids_spectacle_prod);
  169.         $params_sql = array(
  170.             'where' => array(
  171.                 // $where_idcontact
  172.                 array('spectacles','idspectacle',$ids_spectacle_prod), // uniquement les spectacles
  173. //                array('schedules','idcontact',$idcontacts), // uniquement dans ces structures
  174.             ),
  175.             'affiche' => array('today' => 420),
  176.             'limit' => array(0,1),
  177.             'dbg' => array('affiche','Vidéos de spectacles à l\'affiche'),
  178.         );
  179.         $list_multimedias $multimedias->getListMultimedias(
  180.             $params_sql,
  181.             array('width'=>$_ENV['VIGN_VIDEO_WIDTH'],'height'=>$_ENV['VIGN_VIDEO_HEIGHT'],'fleche'=>'none','ratio' => '169'),
  182.             array('format_vignette' => true)
  183.         );
  184. //        $this->view->accueil_video['media'] = $list_multimedias;
  185.         $params_sql_typestructure = array(
  186.             'where' => array(
  187.                 array('contacts''idtypestructure'$idtypestructure),
  188.                 ' AND contacts.idcontact NOT IN (SELECT sub_c.idcontact FROM contacts sub_c WHERE sub_c.idtypestructure=\'EC\') ',
  189.             ),
  190.             'order' => array('contacts' => 'organisation'),
  191.             'direction' => 'ASC',
  192.             'idclassification' => array('NOT' => array(99)),
  193.             'limit' => array(0,300),
  194.             'dbg' => array('ecoles','Ecoles supérieures'),
  195.         );
  196.         $this->context['view']->structures $x $this->contacts->getListContacts($params_sql_typestructure,array(),array('get_profile_picture' => true));
  197.         //Prochains spectacles produits ou coproduits
  198.         $params_sql = [
  199.             'params' => array(
  200.                 'from' => 'TheatreCore\Entity\SpectacleContact sct',
  201.                 'where' => 'AND s.publish=1
  202.                                         AND sct.idspectacle=s.idspectacle
  203.                                         AND sct.idrole IN ('.implode(',', array(17,18,19)).')
  204.                                         AND (sct.idcontact IN (SELECT sub_c.idcontact FROM TheatreCore\Entity\Contacts sub_c WHERE sub_c.idtypestructure=\'EC\')
  205.                                         OR s.idcontactProduction IN (SELECT sub_c2.idcontact FROM TheatreCore\Entity\Contacts sub_c2 WHERE sub_c2.idtypestructure=\'EC\'))',
  206.                 'groupby' => 's.idspectacle',
  207.                 'order' => ['creation_date''DESC'],
  208.                 'limit' => [0,4]
  209.             ),
  210.             'special' => array(
  211. //                'idtypestructure' => 'EC',
  212. //                'structures_specifiques' => 'EC',
  213.             ),
  214.             'dbg' => array('list_others_spectacles''Liste spectacles produits par une école'),
  215.         ];
  216.         $spectacles $this->em->getRepository(Spectacles::class);
  217.         $spectacles_datas $spectacles->getListSpectacles($params_sqlnullfalse, ['allauthors' => true]);
  218.         foreach ($spectacles_datas AS $ks => $vs) {
  219.             $spectacles_datas[$ks]['display']['affiche_date_creation'] = true;
  220.             $spectacles_datas[$ks]['annee_creation'] = $spectacles->getFormeDate($spectacles_datas[$ks]['creation_date'], '%Y'true); //%a %d/%m/%Y;
  221.         }
  222.         $this->context['view']->derniers_spectacles $spectacles_datas;
  223.         unset($params_sql['params']['order']);
  224.         $params_sql['special']['order'] = ['sc.date''ASC'];
  225.         $params_sql['special']['prochains'] = '180';
  226.         $prochains_spectacles $spectacles->getListSpectacles($params_sqlnullfalse, ['allauthors' => true]);
  227.         foreach ($prochains_spectacles AS $ks => $vs) {
  228.             $prochains_spectacles[$ks]['footer_contact'] = true;
  229.         }
  230.         $this->context['view']->prochains_spectacles $prochains_spectacles;
  231.         // Derniers spectacles soutenus
  232.         $params_sql = [
  233.             'params' => array(
  234.                 'groupby' => 's.idspectacle',
  235.                 'limit' => array(04),
  236.                 'order' => ['creation_date''DESC']
  237.             ),
  238.             'special' => array(
  239.                 'aide' => [
  240. //                  'idcontact' => $idcontacts
  241.                     'idaidecontact' => 105
  242.                 ],
  243.                 'spectacle_aide' => true,
  244.             )
  245.         ];
  246.         $spectacles_datas $spectacles->getListSpectacles($params_sqlnullfalse, ['allauthors' => true]);
  247.         foreach ($spectacles_datas AS $ks => $vs) {
  248.             $spectacles_datas[$ks]['display']['affiche_date_creation'] = true;
  249.             $spectacles_datas[$ks]['annee_creation'] = $spectacles->getFormeDate($spectacles_datas[$ks]['creation_date'], '%Y'true); //%a %d/%m/%Y;
  250.         }
  251.         $this->context['view']->spectacles_soutenus $spectacles_datas;
  252.         // Prochains spectacles soutenus
  253.         $params_sql['special']['prochains'] = true;
  254.         $params_sql['special']['plus_proche'] = true;
  255.         $params_sql['params']['order'] = ['sc.date''ASC'];
  256.         $prochains_spectacles_soutenus $spectacles->getListSpectacles($params_sqlnullfalse, ['allauthors' => true]);
  257.         foreach ($prochains_spectacles_soutenus AS $ks => $vs) {
  258.             $prochains_spectacles_soutenus[$ks]['footer_contact'] = true;
  259.         }
  260.         $this->context['view']->prochains_spectacles_soutenus $prochains_spectacles_soutenus;
  261.         //Les prochains étudiants à l'affiche
  262.         // les élèves
  263.         $where_idperson 'sp.`idperson` IN ('.join(','$this->person_ecole->getPersons(null,array('get_ids' => true))).') ';
  264.         $params_sql = array(
  265.             'params' => array(
  266.                 'where' => ' AND ('.$where_idperson.') ',
  267.                 'limit' => array(06),
  268.                 'order' => ['sc.date''ASC']
  269.             ),
  270.             'special' => array(
  271. //                'plus_proche' => true,
  272.                 'prochains' => '180',
  273.                 'get_eleves' => 'all'
  274.             ),
  275.             'dbg' => array('anciens_affiche_tous','Les étudiants à l\'affiche'),
  276.         );
  277.         $this->context['view']->spectacles_anciens_etudiants_affiche $spectacles->getListSpectacles($params_sqlnullfalse, ['allauthors' => true]);
  278.         $this->loadAsidesActualites();
  279.         return $this->view('ecoles/actualites.html.twig');
  280.     }
  281.     // {{{ action_view()
  282.     /** Liste des écoles
  283.      *
  284.      * @Route("/ecoles/", name="ecoles_view")
  285.      *
  286.      */
  287.     public function action_view()
  288.     {
  289.         $this->InitController(null'view');
  290.         $this->asides->load('ecoles_view_texte');
  291.         return $this->view('ecoles/view.html.twig');
  292.     }
  293.     // }}}
  294.     // {{{ action_soutiens()
  295.     /** trouver les textes à l'affiche qui ont un soutien de la structure
  296.      *
  297.      * @Route("/ecoles/soutiens/", name="ecoles_soutiens")
  298.      *
  299.      * @access public
  300.      * @return void
  301.      */
  302.     public function action_soutiens($execute_content true)
  303.     {
  304.         if($execute_content){
  305.             $this->InitController(null'soutiens');
  306.         }
  307.         $params_sql = [
  308.             'params' => array(
  309.                 'groupby' => 's.idspectacle',
  310.                 'order' => ['creation_date''DESC']
  311.             ),
  312.             'special' => array(
  313. //                'aide' => [
  314. ////                        'idcontact' => $idcontacts,
  315. //                    'idaidecontact' => 105
  316. //                ],
  317.                 'spectacle_aide' => true,
  318. //                    'prochains' => true,
  319. //                    'plus_proche' => true
  320.             ),
  321.             'dbg' => array('spectacles_prod_list','Spectacles prod/coprod/prod deleg de ce contact')
  322.         ];
  323.         // chercher une aide précise
  324.         if(!empty($this->context['params']['idaide'])) {
  325.             $idaide = (int)$this->context['params']['idaide'];
  326.         }
  327.         foreach($this->context['view']->structures AS $k => $v){
  328.             $idcontacts[] = $k;
  329.         }
  330.         $params_sql_aidecontact = array(
  331.             'where' => array(
  332.                 array('spectacle_aide','publish',1),
  333.             ),
  334.             'special' => array(
  335.                 'object' => 'spectacle',
  336.                 'aides' => array(
  337.                     'idcontacts' => $idcontacts,
  338.                     'no_empty' => true,
  339.                     'idaidecontact' => [105],
  340.                 ),
  341.             ),
  342.             'limit' => array(0,100),
  343.             'dbg' => array('list_aidecontacts_spectacle','Liste des catégories d\'aide pour spectacles'),
  344.         );
  345.         $aidecontacts $this->em->getRepository(Aidecontacts::class);
  346.         $this->context['view']->list_aidecontacts $aidecontacts->getListAidecontacts($params_sql_aidecontact);
  347.         if(!empty($idaide)) {
  348.             $params_sql['special']['aides']['idaide'] = $idaide;
  349.             // par courir les aides et marquer l'active
  350.             foreach($this->context['view']->list_aidecontacts as $k=>$v) {
  351.                 foreach($v['aides'] as $kb=>$vb) {
  352.                     if(empty($vb[''])){
  353.                         $this->context['view']->list_aidecontacts[$k]['aides'][$kb]['mention_contacts'] = $aidecontacts->wikiTransform($vb['mention_contacts']);
  354.                     }
  355.                     if($vb['idaide']==$idaide) {
  356.                         $this->context['view']->list_aidecontacts[$k]['aides'][$kb]['active'] = true;
  357.                         $this->context['view']->list_aidecontacts[$k]['active'] = true;
  358.                     }
  359.                 }
  360.             }
  361.         }
  362.         $spectacles $this->em->getRepository(Spectacles::class);
  363.         $total_spectacles $spectacles->countListSpectacles($params_sql);
  364.         $this->context['view']->pagination $this->getPagination($total_spectacles20);
  365.         $this->context['view']->pagination['totalItems'] = $total_spectacles;
  366.         $this->context['view']->pagination['representation_spectacle'] = true;
  367.         $this->context['view']->pagination['spectacle'] = true;
  368.         $params_query_count $this->em->getRepository(Spectacles::class)->countListSchedules($params_sql_aidecontact);
  369.         $this->context['view']->pagination['total_dates'] = $params_query_count;
  370.         $params_sql['params']['limit'] = array($this->getLimitStart(), $this->perPage);
  371.         $spectacles_datas $spectacles->getListSpectacles($params_sqlfalsenull, ['carrer_couleurs' => true'allauthors' => true]);
  372.         foreach ($spectacles_datas AS $ks => $vs) {
  373.             $spectacles_datas[$ks]['display']['affiche_date_creation'] = true;
  374.             $spectacles_datas[$ks]['annee_creation'] = $spectacles->getFormeDate($spectacles_datas[$ks]['creation_date'], '%Y'true); //%a %d/%m/%Y;
  375.         }
  376.         $this->context['view']->spectacles $spectacles_datas;
  377.         $this->loadAsidesSoutiens();
  378.         if($execute_content) {
  379.             return $this->view('ecoles/soutiens.html.twig');
  380.         }
  381.     }
  382.     // }}}
  383.     // {{{ action_en_scene()
  384.     /** trouver les textes à l'affiche qui ont un soutien de la structure
  385.      *
  386.      * @Route("/ecoles/en-scene/", name="ecoles_en_scene")
  387.      * @Route("/ecoles/en-scene/type/{type}", name="ecoles_en_scene_type")
  388.      * @Route("/ecoles/en-scene/type/{type}/periode/{periode}", name="ecoles_en_scene_type_periode")
  389.      *
  390.      * @access public
  391.      * @return void
  392.      */
  393.     public function action_en_scene($execute_content true$type null$periode null){
  394.         if(empty($this->context['params']['type'])){
  395.             $this->context['params']['type'] = $type;
  396.         }
  397.         if(empty($this->context['params']['periode'])){
  398.             $this->context['params']['periode'] = $periode;
  399.         }
  400.         if($execute_content){
  401.             $this->InitController(null'en-scene');
  402.         }
  403.         $params = array(
  404.             'prod' => array(
  405.                 'params' => array(
  406.                     'from' => 'TheatreCore\Entity\SpectacleContact sct',
  407.                     'where' => 'AND s.publish=1
  408.                                         AND sct.idspectacle=s.idspectacle
  409.                                         AND sct.idrole IN ('.implode(',', array(17,18,19)).')
  410.                                         AND (sct.idcontact IN (SELECT sub_c.idcontact FROM TheatreCore\Entity\Contacts sub_c WHERE sub_c.idtypestructure=\'EC\')
  411.                                         OR s.idcontactProduction IN (SELECT sub_c2.idcontact FROM TheatreCore\Entity\Contacts sub_c2 WHERE sub_c2.idtypestructure=\'EC\')) ',
  412.                     'groupby' => 's.idspectacle',
  413.                     'order' => ['creation_date''DESC']
  414.                 ),
  415.                 'special' => array(
  416. //                    'idtypestructure' => 'EC',
  417. //                    'structures_specifiques' => 'EC',
  418.                 ),
  419.                 'dbg' => array('list_others_spectacles''Liste spectacles produits par une école'),
  420.             ),
  421.             'coprod' => array(
  422.                 'params' => array(
  423.                     'from' => 'TheatreCore\Entity\SpectacleContact sct',
  424.                     'where' => 'AND s.publish=1
  425.                                     AND sct.idspectacle=s.idspectacle
  426.                                     AND sct.idrole IN ('.implode(',', array(17,18,19)).')
  427.                                     AND (sct.idcontact IN (SELECT sub_c.idcontact FROM TheatreCore\Entity\Contacts sub_c WHERE sub_c.idtypestructure=\'EC\')
  428.                                     OR s.idcontactProduction IN (SELECT sub_c2.idcontact FROM TheatreCore\Entity\Contacts sub_c2 WHERE sub_c2.idtypestructure=\'EC\')) ',
  429.                     'groupby' => 's.idspectacle',
  430.                 ),
  431.                 'special' => array(
  432. //                    'prochains' => true,
  433. //                    'plus_proche' => true
  434.                 ),
  435.                 'dbg' => array('spectacles_prod_list','Spectacles prod/coprod/prod deleg de ce contact')
  436.             ),
  437.             'soutiens' => array(
  438.                 'params' => array(
  439.                     'groupby' => 's.idspectacle',
  440.                 ),
  441.                 'special' => array(
  442.                     'aide' => [
  443. //                        'idcontact' => $idcontacts,
  444.                         'idaidecontact' => 105
  445.                     ],
  446.                     'spectacle_aide' => true,
  447. //                    'prochains' => true,
  448. //                    'plus_proche' => true
  449.                 ),
  450.                 'dbg' => array('spectacles_prod_list','Spectacles prod/coprod/prod deleg de ce contact')
  451.             )
  452.         );
  453.         $spectacles $this->em->getRepository(Spectacles::class);
  454.         foreach($params AS $key => $param) {
  455.             foreach(['anciens''prochains'] as $val) {
  456.                 $p $param;
  457.                 if($val == 'prochains'){
  458.                     $p['special']['plus_proche'] = true;
  459.                     $p['special']['prochains'] = true;
  460.                     $p['params']['order'] = ['sc.date',  'DESC'];
  461.                 }
  462.                 else{
  463.                     $p['params']['order'] = ['creation_date''DESC'];
  464.                     $p['special'][$val] = true;
  465.                 }
  466.                 $this->context['view']->{'spectacles_count_' $key '_'.$val} = $spectacles->countListSpectacles($p);
  467.             }
  468.         }
  469.         if($execute_content) {
  470.             if (!empty($this->context['params']['type']) && array_key_exists($this->context['params']['type'], $params)) {
  471.                 $type $this->context['params']['type'];
  472.                 $this->context['view']->{'type_' $type} = true;
  473.                 $params_selected $params[$type];
  474.                 //Sélection de la période
  475.                 $periodes_selected 'prochains';
  476.                 $filtres_periodes = ['prochains''anciens'];
  477.                 if (!empty($this->context['params']['periode']) && in_array($this->context['params']['periode'], $filtres_periodes)) {
  478.                     $this->context['view']->{'type_'.$this->context['params']['periode']} = $periodes_selected $this->context['params']['periode'];
  479.                 }
  480.                 $this->context['view']->periodes_selected $periodes_selected;
  481.                 $params_selected['special'][$periodes_selected] = true;
  482.                 if($type == 'soutiens' && $periodes_selected == 'anciens'){
  483.                     unset($params_selected['special']['anciens']);
  484.                 }
  485.                 if ($periodes_selected == 'prochains') {
  486.                     //                $params_selected['special']['plus_proche'] = true;
  487.                     $params_selected['params']['order'] = ['sc.date',  'ASC'];
  488.                 } else {
  489.                     $params_selected['params']['order'] = ['creation_date''DESC'];
  490.                 }
  491.                 //            echo $spectacles->getSQLSpectacles($params_selected['params'], $params_selected['special']);
  492.                 //            exit;
  493.                 $this->context['view']->nb_spectacles_total $spectacles->countListSpectacles($params_selected);
  494.                 $this->context['view']->pagination $this->getPagination($this->context['view']->nb_spectacles_total10);
  495.                 $this->context['view']->pagination['totalItems'] = $this->context['view']->nb_spectacles_total;
  496.                 $this->context['view']->pagination['representation_spectacle'] = true;
  497.                 $this->context['view']->pagination['spectacle'] = true;
  498.                 if($periodes_selected != 'anciens') {
  499.                     $params_query_count $this->em->getRepository(Spectacles::class)->countListSchedules($params_selected);
  500.                     $this->context['view']->pagination['total_dates'] = $params_query_count;
  501.                 }
  502.                 $params_selected['params']['limit'] = array($this->getLimitStart(), $this->perPage);
  503.                 $spectacles_datas $spectacles->getListSpectacles($params_selectedfalsenull, ['carrer_couleurs' => true'allauthors' => true]);
  504.                 if ($periodes_selected == 'anciens') {
  505.                     foreach ($spectacles_datas AS $ks => $vs) {
  506.                         $spectacles_datas[$ks]['display']['affiche_date_creation'] = true;
  507.                         $spectacles_datas[$ks]['annee_creation'] = $spectacles->getFormeDate($spectacles_datas[$ks]['creation_date'], '%Y'true); //%a %d/%m/%Y;;
  508.                     }
  509.                 }
  510.                 foreach ($spectacles_datas AS $k => $v) {
  511.                     if ($type == 'coprod' || $type == 'soutiens' || $periodes_selected == 'prochains') {
  512.                         $spectacles_datas[$k]['footer_contact'] = true;
  513.                     } else if ($type == 'prod' && $periodes_selected == 'anciens') {
  514.                         $spectacles_datas[$k]['annee_creation'] = $spectacles->getFormeDate($spectacles_datas[$k]['creation_date'], '%Y'true); //%a %d/%m/%Y;
  515.                         $spectacles_datas[$k]['display'] = array('affiche_date_creation' => true);
  516.                     }
  517.                 }
  518.                 $this->context['view']->spectacles $spectacles_datas;
  519.             }
  520.             $this->loadEnScene();
  521.         }
  522.         return $this->view('ecoles/en-scene.html.twig');
  523.     }
  524.     // }}}
  525.     // {{{ action_etudiants()
  526.     /** Liste des étudiants
  527.      *
  528.      * @Route("/ecoles/etudiants/", name="ecoles_etudiants")
  529.      * @Route("/ecoles/etudiants/photo/{p_photo}/y/{p_y}", name="ecoles_etudiants_photo_y")
  530.      * @Route("/ecoles/etudiants/y/{p_y}/photo/{p_photo}", name="ecoles_etudiants_y_photo")
  531.      * @Route("/ecoles/etudiants/role/{p_role}/sexe/{p_sexe}/y/{p_y}/photo/{p_photo}", name="ecoles_etudiants_role_sexe_y_photo")
  532.      * @Route("/ecoles/etudiants/role/{p_role}/y/{p_y}/photo/{p_photo}", name="ecoles_etudiants_role_y_photo")
  533.      *
  534.      */
  535.     public function action_etudiants(Ecoles $ecoles$params = [], $p_photo null$p_y null$p_role null$p_sexe null)
  536.     {
  537.         if(empty($params['stop_execute'])) {
  538.             $this->context['params']['photo'] = $p_photo;
  539.             $this->context['params']['role'] = $p_role;
  540.             $this->context['params']['sexe'] = $p_sexe;
  541.             $this->context['params']['y'] = $p_y;
  542.         }
  543.         if(!empty($params['idcontact'])){
  544.             $this->InitController($params['idcontact'], 'etudiants');
  545.         }
  546.         else{
  547.             $this->InitController(null'etudiants');
  548.         }
  549.         $this->context['view']->page '/ecoles/etudiants';
  550.         $params_sql = array(
  551.             'special' => array(
  552.                 'person_ecole' => array(
  553.                     'periode' => 'actual',
  554.                     'exclude_jtn' => true,
  555.                 )
  556.             ),
  557.             'params' => array(
  558.                 'limit' => 'all'
  559.             ),
  560.             'dbg' => array('etudiants','Les étudiants en cours d\'étude')
  561.         );
  562.         // pour une école en particulier
  563.         if(!empty($this->idcontact)) {
  564.             $params_sql['special']['person_ecole']['idcontact'] = $this->idcontact;
  565.             unset($params_sql['special']['person_ecole']['exclude_jtn']);
  566.         }
  567.         $this->context['view']->annees $this->em->getRepository(Persons::class)->getPromos($params_sql);
  568.         // annee de promo
  569.         $annee_promo 'all';
  570.         $this->context['view']->annee_promo $annee_promo;
  571.         $annee_promo $this->context['view']->annee_promo_selected 'all';
  572.         if(!empty($this->context['params']['y']) && $this->context['params']['y'] != 'all' && array_key_exists($this->context['params']['y'], $this->context['view']->annees)) {
  573.             $this->context['view']->annee_promo_selected $annee_promo $this->context['view']->annee_promo $this->context['params']['y'];
  574.             $params_sql['special']['person_ecole']['periode'] = $this->context['view']->annee_promo;
  575.         }
  576. //        } else {
  577. //            foreach($this->context['view']->annees as $k=>$v) {
  578. //                $this->context['view']->annee_promo = $k;
  579. //                break;
  580. //            }
  581. //        }
  582.         //tous les étudiants
  583.         $this->context['view']->nb_etudiants $this->em->getRepository(Persons::class)->countListPersons($params_sql);
  584.         $this->context['view']->annees['all']['annee'] = 'Toutes les années';
  585.         $this->context['view']->annees[$annee_promo]['active'] = true;
  586.         // photos ou pas
  587.         $this->getWithPhoto($params_sql);
  588.         // les roles
  589.         $this->getRolesCommon($params_sql);
  590.         // sexe ?
  591.         $this->getSexeCommon($params_sql);
  592.         $this->context['view']->nb_etudiants_filtres $this->em->getRepository(Persons::class)->countListPersons($params_sql);
  593.         //la pagination
  594.         $this->context['view']->nb_etudiants_selected $this->em->getRepository(Persons::class)->countListPersons($params_sql);
  595.         $this->context['view']->pagination $this->getPagination($this->context['view']->nb_etudiants_selected10);
  596.         $params_sql['params']['limit'] = array($this->getLimitStart(),$this->perPage);
  597.         $params_display['vignette_format'] = array('width'=>$_ENV['VIGN_PERSONS_WIDTH'],'height'=>$_ENV['VIGN_PERSONS_HEIGHT'],'direction'=>'crop');
  598.         $this->context['view']->persons $this->em->getRepository(Persons::class)->getListPersons($params_sql,$params_display);
  599.         $this->context['view']->lien_ecole_actif true;
  600.         // copmpter uniquement cette année
  601.         $this->context['view']->nb_etudiants_annee $this->context['view']->nb_etudiants;
  602.         $this->context['view']->affiche_ecole true;
  603.         if(empty($params['stop_execute'])) {
  604.             $this->loadEtudiants();
  605.             return $this->view('ecoles/etudiants.html.twig');
  606.         }
  607.     }
  608.     // }}}
  609.     /** Liste des anciens étudiants
  610.      *
  611.      * @Route("/ecoles/anciens/", name="ecoles_anciens")
  612.      * @Route("/ecoles/anciens/role/{p_role}/y/{p_y}/photo/{p_photo}", name="ecoles_anciens_role_y_photo")
  613.      * @Route("/ecoles/anciens/photo/{p_photo}/y/{p_y}", name="ecoles_anciens_photo_y")
  614.      * @Route("/ecoles/anciens/role/{p_role}/sexe/{p_sexe}/y/{p_y}/photo/{p_photo}", name="ecoles_anciens_role_sexe_y_photo")
  615.      */
  616.     public function action_anciens(
  617.         Ecoles $ecoles,
  618.         $params = [],
  619.         $p_role null,
  620.         $p_y null,
  621.         $p_photo null,
  622.         FormFactoryInterface $formFactory
  623.     )
  624.     {
  625.         $this->context['params']['photo'] = $p_photo;
  626.         $this->context['params']['role'] = $p_role;
  627.         $this->context['params']['y'] = $p_y;
  628.         if(!empty($params['idcontact'])){
  629.             $this->InitController($params['idcontact'], 'anciens-etudiants');
  630.         }
  631.         else{
  632.             $this->InitController(null'anciens-etudiants');
  633.         }
  634.         $this->context['view']->page '/ecoles/anciens';
  635.         $this->context['view']->lien_ecole_actif true;
  636.         $promos $this->person_ecole->getPromos($this->idcontact,true);
  637.         $last_promo $this->person_ecole->getLastPromo($promos);
  638.         // un nombre de jours ?
  639.         $this->getSpectaclesCommon(null$ecoles);
  640.         $this->context['view']->days Date_time::getDaysParam();
  641.         if($this->context['view']->days){
  642.         }
  643.         // des éléves d'une année au hasard
  644.         else if(!empty($_REQUEST['annee_promo']) && array_key_exists($_REQUEST['annee_promo'], $promos))  {
  645.             $this->context['view']->annee_promo_selected $this->context['view']->annee_promo $promos[(int)$_REQUEST['annee_promo']];
  646.         } elseif(!empty($this->context['params']['y']) && array_key_exists($this->context['params']['y'], $promos)) {
  647.             $this->context['view']->annee_promo_selected $this->context['view']->annee_promo $this->context['params']['y'];
  648.         } else {
  649.             $this->context['view']->annee_promo_selected $this->context['view']->annee_promo $last_promo;
  650.         }
  651.         $this->context['formAsideSearch'] = $formFactory->createNamedBuilder('');
  652.         $this->context['formAsideSearch']->add('annee_promo'ChoiceType::class, [
  653.             'label' => 'Promo',
  654.             'placeholder' => 'Choisissez une saison...',
  655.             'choices' => $promos,
  656.             'attr' => [
  657.                 'id' => 'saisons'
  658.             ]
  659.         ]);
  660.         $this->context['formAsideSearch']->add('validation'SubmitType::class, [
  661.             'label' => 'Rechercher'
  662.         ]);
  663.         $this->getCommonSearchView();
  664.         $params_sql = [
  665.             'dbg' => ['etudiants','Les anciens étudiants']
  666.         ];
  667.         if(isset($this->context['view']->annee_promo) && $this->context['view']->annee_promo){
  668.             $params_sql['special']['person_ecole'] = [
  669.                 'periode' => $this->context['view']->annee_promo,
  670.                 'exclude_jtn' => true
  671.             ];
  672.         }
  673.         if(isset($this->context['view']->days) && $this->context['view']->days){
  674.             $params_sql['special']['spectacle'] = [
  675.                 'prochains' => $this->context['view']->days 'D'
  676.             ];
  677.         }
  678.         // pour une école en particulier
  679.         if(!empty($this->idcontact)) {
  680.             $params_sql['special']['person_ecole']['idcontact'] = $this->idcontact;
  681.             unset($params_sql['special']['person_ecole']['exclude_jtn']);
  682.         }
  683.         $this->getWithPhoto($params_sql);
  684.         $this->getRolesCommon($params_sql);
  685.         $this->getSexeCommon($params_sql);
  686.         $this->context['view']->nb_persons_total $this->em->getRepository(Persons::class)->countListPersons($params_sql);
  687.         $this->context['view']->nb_anciens_eleves $this->person_ecole->countEleves($this->idcontact, ['old' => true]);
  688.         $params_sql['params']['limit'] = [$this->getLimitStart(), $this->perPage];
  689.         $params_display['vignette_format'] = [
  690.             'width' => $_ENV['VIGN_PERSONS_WIDTH'],
  691.             'height' => $_ENV['VIGN_PERSONS_HEIGHT'],
  692.             'direction' => 'crop'
  693.         ];
  694.         $this->context['view']->persons $this->em->getRepository(Persons::class)->getListPersons($params_sql,$params_display);
  695.         $this->context['view']->pagination $this->getPagination($this->context['view']->nb_persons_total);
  696.         $this->context['view']->affiche_ecole true;
  697.         $this->loadEtudiants(false);
  698.         if (empty($params['stop_execute'])) {
  699.             return $this->view('ecoles/anciens.html.twig');
  700.         }
  701.     }
  702.     // {{{ action_anciens_affiche()
  703.     /** Liste des anciens étudiants à l'affiche
  704.      *
  705.      */
  706.     public function action_anciens_affiche(Ecoles $ecoles$params = [])
  707.     {
  708.         $this->context['view']->page '/ecoles/anciens-affiche';
  709.         if(!empty($params['idcontact'])){
  710.             $this->InitController($params['idcontact'], 'anciens-affiche');
  711.         }
  712.         else{
  713.             $this->InitController(null'anciens-affiche');
  714.         }
  715.         $this->getSpectaclesCommon(90$ecoles);
  716.         $params_sql = array(
  717.             'special' => array(
  718.                 'person_ecole' => array(
  719.                     'exclude_jtn' => true
  720.                 ),
  721.                 'spectacle' => array(
  722.                     'type' => 'all',
  723.                 ),
  724.             ),
  725.             'dbg' => array('spectacles_etudiants','Les spectacles des anciens étudiants')
  726.         );
  727.         // pour une école en particulier
  728.         if(!empty($this->idcontact)) {
  729.             $params_sql['special']['person_ecole']['idcontact'] = $this->idcontact;
  730.             unset($params_sql['special']['person_ecole']['exclude_jtn']);
  731.         }
  732.         $this->getWithPhoto($params_sql);
  733.         // recherche par saison
  734.         if(!empty($this->context['view']->saison)) {
  735.             $params_sql['special']['spectacle']['saison'] = $this->context['view']->saison;
  736.         } elseif(!empty($this->context['view']->year)) { // recherche par année
  737.             $params_sql['special']['spectacle']['year'] = $this->context['view']->year;
  738.         } elseif(!empty($this->context['view']->datestart) && !empty($this->context['view']->dateend)) { // par période
  739.             $params_sql['special']['spectacle']['periode'] = array(
  740.                 'start' => $this->context['view']->datestart,
  741.                 'end' => $this->context['view']->dateend,
  742.             );
  743.         }
  744.         $this->getRolesCommon($params_sql);
  745.         $this->getSexeCommon($params_sql);
  746.         $this->context['view']->nb_persons_total $this->em->getRepository(Persons::class)->countListPersons($params_sql);
  747.         $params_sql['params']['limit'] = array($this->getLimitStart(),$this->perPage);
  748.         $params_display['vignette_format'] = array('width'=>$_ENV['VIGN_PERSONS_WIDTH'],'height'=>$_ENV['VIGN_PERSONS_HEIGHT'],'direction'=>'crop');
  749.         $this->context['view']->persons $this->em->getRepository(Persons::class)->getListPersons($params_sql,$params_display);
  750.         $this->context['view']->pagination $this->getPagination($this->context['view']->nb_persons_total);
  751.         $this->loadAsidesAnciensAffiche();
  752.     }
  753.     // }}}
  754.     // {{{ action_anciens_affiche_tous()
  755.     /** Liste des anciens étudiants à l'affiche
  756.      *
  757.      * @Route("/ecoles/anciens-affiche-tous/", name="ecoles_anciens_affiche_tous")
  758.      * @Route("/ecoles/anciens-affiche-tous/periode/{periode}/", name="ecoles_anciens_affiche_tous_periode")
  759.      *
  760.      */
  761.     public function action_anciens_affiche_tous($periode 'periode'Ecoles $ecoles)
  762.     {
  763.         $this->context['params']['periode'] = $periode;
  764.         $this->InitController(null'anciens-affiche-tous');
  765.         $this->getSpectaclesCommon(90$ecoles);
  766.         // les élèves
  767.         $where_idperson 'sp.`idperson` IN ('.join(','$this->person_ecole->getPersons(null,array('get_ids' => true))).') ';
  768.         $params_sql = array(
  769.             'params' => array(
  770.                 'where' => ' AND ('.$where_idperson.') ',
  771.             ),
  772.             'special' => array(
  773. //                'plus_proche' => true,
  774.                 'get_eleves' => 'all',
  775.             ),
  776.             'dbg' => array('anciens_affiche_tous','Les étudiants à l\'affiche'),
  777.         );
  778.         // recherche par saison
  779.         if(!empty($this->context['view']->saison)) {
  780.             $params_sql['special']['saison'] = $this->context['view']->saison;
  781.         } elseif(!empty($this->context['view']->year)) { // recherche par année
  782.             $params_sql['special']['year'] = $this->context['view']->year;
  783.         } elseif(!empty($this->context['view']->datestart) && !empty($this->context['view']->dateend)) { // par période
  784.             $params_sql['special']['period'] = array(
  785.                 'start' => $this->context['view']->datestart,
  786.                 'end' => $this->context['view']->dateend,
  787.             );
  788.         } else { // prochains jours
  789.             $params_sql['special']['prochains'] = $this->context['view']->days;
  790.         }
  791.         $this->context['view']->nb_spectacles_total $this->em->getRepository(Spectacles::class)->countListSpectacles($params_sql);
  792.         $params_sql['params']['limit'] = array($this->getLimitStart(),$this->perPage);
  793.         $this->context['view']->spectacles $this->em->getRepository(Spectacles::class)->getListSpectacles($params_sqlnullfalse, ['allauthors' => true]);
  794.         $this->context['view']->nb_spectacles_liste count($this->context['view']->spectacles);
  795.         $this->context['view']->pagination $this->getPagination($this->context['view']->nb_spectacles_total);
  796.         // ajouter masonery
  797.         $this->context['view']->js_more[] = 'jquery.masonry.min.js';
  798.         $this->action_en_scene(false);
  799.         $this->loadAsidesAnciensAfficheTous();
  800.         return $this->view('ecoles/anciens-affiche-tous.html.twig');
  801.     }
  802.     // }}}
  803.     // {{{ getSpectaclesCommon()
  804.     /** recherche sur les spectacles
  805.      *
  806.      */
  807.     public function getSpectaclesCommon($nb_days=3$ecoles null)
  808.     {
  809.         $this->person_ecole $this->em->getRepository(PersonEcole::class);
  810.         // trouver les spectacles des élèves d'une promo
  811.         $promos $this->person_ecole->getPromos(null,true);
  812.         // saison courante
  813.         $this->context['view']->current_saison Date_time::getLastSaison();
  814.         $this->context['view']->menu_jours = array(
  815.             => array('name' => '3 prochains jours','v_key' => 3),
  816.             =>array('name' => '7 prochains jours','v_key' => 7),
  817.             30 => array('name' => '30 prochains jours','v_key' => 30),
  818.             90 => array('name' => '3 prochains mois''v_key' => 90)
  819.         );
  820.         // une saison ?
  821.         $this->context['view']->saison Date_time::getSaisonParam();
  822.         if($this->context['view']->saison==$this->context['view']->current_saison) {
  823.             $this->context['view']->is_current_saison true;
  824.         }
  825.         // une période ?
  826.         $this->context['view']->datestart Date_time::getDateParam('datestart');
  827.         $this->context['view']->dateend Date_time::getDateParam('dateend');
  828.         if(!Date_time::checkDateFormat($this->context['view']->datestart)) {
  829.             $this->context['view']->datestart null;
  830.         } else {
  831.             $this->context['view']->datestart_string $this->person_ecole->getFormeDate($this->context['view']->datestart,'d/m/y');
  832.         }
  833.         if(!Date_time::checkDateFormat($this->context['view']->dateend)) {
  834.             $this->context['view']->dateend null;
  835.         } else {
  836.             $this->context['view']->dateend_string $this->person_ecole->getFormeDate($this->context['view']->dateend,'d/m/y');
  837.         }
  838.         // un nombre de jours ?
  839.         $this->context['view']->days Date_time::getDaysParam();
  840.         // une année ?
  841.         $this->context['view']->year Date_time::getYearParam();
  842.         if(!$this->context['view']->saison && !$this->context['view']->year && !$this->context['view']->days && !$this->context['view']->datestart && !$this->context['view']->dateend) {
  843.             $this->context['view']->days $nb_days;
  844.         }
  845.         if(!empty($this->context['view']->days)) {
  846.             foreach($this->context['view']->menu_jours as $k=>$v) {
  847.                 if($k==$this->context['view']->days) {
  848.                     $this->context['view']->menu_jours[$k]['active'] = 'on';
  849.                     $this->context['view']->days_name $v['name'];
  850.                 }
  851.             }
  852.         }
  853.         // les dates pour trouver les saisons et années
  854.         $cacheItem $this->cache->getItem("ecoles_spectacles_common_saisons_and_annees");
  855.         if (! $cacheItem->isHit()) {
  856.             $res $ecoles->getSaisonsAndAnnees();
  857.             $cacheItem->set($res)
  858.                 ->expiresAt((new \DateTime('now'))->add(\DateInterval::createFromDateString('7 hours')));
  859.             $this->cache->save($cacheItem);
  860.         }
  861.         $saisons_annees $cacheItem->get();
  862.         // liste des saisons des spectacles
  863.         if(!empty($saisons_annees['saisons'])) {
  864.             $this->context['view']->saisons $saisons_annees['saisons'];
  865. //            $this->context['form']->addElement('select', 's', 'Saisons', array_replace(array('' => 'Choisissez une saison...'),array_reverse($saisons_annees['saisons'])), array('id' => 'saisons'));
  866.         }
  867.         // liste des annees des spectacles
  868.         if(!empty($saisons_annees['annees'])) {
  869.             $this->context['view']->annees $saisons_annees['annees'];
  870. //            $this->context['form']->addElement('select', 'y', 'Années', array_replace(array('' => 'Choisissez une année...'), array_reverse($saisons_annees['annees'])), array('id' => 'annees'));
  871.         }
  872. //        $this->context['form']->addElement('text', 'datestart', 'Entre', array('size'=>'7','id'=>'datestart'));
  873. //        $this->context['form']->addElement('text', 'dateend', 'et', array('size'=>'7','id'=>'dateend'));
  874.         // nb de spectacles pour une saison
  875.         $params_sql = array(
  876.             'special' => array(
  877.                 'count_only' => true,
  878.                 'join_person' => true,
  879.                 'person_ecole' => true,
  880.                 'saison' => $this->context['view']->current_saison,
  881.             ),
  882.             'params' => array(
  883.                 'limit' => array(0,3000)
  884.             ),
  885.             'dbg' => array('spectacles_etudiants_saison','Les spectacles des anciens étudiants pour la saison '.$this->context['view']->current_saison)
  886.         );
  887.         // pour une école en particulier
  888.         if(!empty($this->idcontact)) {
  889.             $params_sql['special']['person_ecole'] = array('idcontact' => array($this->idcontact));
  890.         }
  891. //        $this->context['view']->nb_spectacles = $this->person_ecole->db->queryOne($this->em->getRepository(Spectacles::class)->getSQLSpectacles($params_sql['params'],$params_sql['special']));
  892.         $this->context['view']->jquery_cal 'datepicker';
  893.     }
  894.     // }}}
  895.     // {{{ getRolesCommon()
  896.     /** recherche sur les roles
  897.      *
  898.      */
  899.     public function getRolesCommon(&$params_sql)
  900.     {
  901.         $this->context['view']->roles $this->em->getRepository(EcoleRole::class)->getRoles(null,$params_sql);
  902.         foreach($this->context['view']->roles as $k=>$v) {
  903.             if(!empty($v['is_jeu'])) {
  904.                 $this->context['view']->display_jeu true;
  905.             } else {
  906.                 $this->context['view']->display_others true;
  907.             }
  908.         }
  909.         if(!empty($this->context['params']['role']) && $this->func->my_is_int($this->context['params']['role'])) {
  910.             $params_sql['special']['person_ecole']['idrole'] = $this->context['params']['role'];
  911.             $this->context['view']->role $this->context['view']->roles[$this->context['params']['role']];
  912.             $this->context['view']->idrole $this->context['params']['role'];
  913.             $this->context['view']->roles[$this->context['params']['role']]['active'] = true;
  914.         }
  915.     }
  916.     // }}}
  917.     // {{{ getWithPhoto()
  918.     /** recherche avec des photos
  919.      *
  920.      */
  921.     public function getWithPhoto(&$params_sql)
  922.     {
  923.         //C'est le JTN
  924.         $label_menu 'Type d\'affichage';
  925.         if(!empty($params_sql['special']['person_ecole']['idcontact']) && $params_sql['special']['person_ecole']['idcontact'] == 3914){
  926.             $label_menu 'artistes';
  927.         }
  928.         $this->context['view']->photos = array(
  929.             'all' => array(
  930.                 'label' => 'Avec ou sans photos',
  931.             ),
  932.             'with' => array(
  933.                 'label' => 'Avec photos',
  934.             )
  935.         );
  936.         if(empty($this->context['params']['photo']) || $this->context['params']['photo']=='all') {
  937.             $params_sql['special']['with_photo'] = false;
  938.             $this->context['view']->with_photo false;
  939.             $this->context['view']->photo 'all';
  940.             $this->context['view']->photos['all']['active'] = true;
  941.         }
  942.         if(!empty($this->context['params']['photo']) && $this->context['params']['photo']=='with') {
  943.             $this->context['view']->photo 'with';
  944.             $params_sql['special']['with_photo'] = true;
  945.             $this->context['view']->with_photo true;
  946.             $this->context['view']->photos['with']['active'] = true;
  947.         }
  948.     }
  949.     // }}}
  950.     // {{{ getSexeCommon()
  951.     /** recherche avec des photos
  952.      *
  953.      */
  954.     public function getSexeCommon(&$params_sql)
  955.     {
  956.         $this->context['view']->menu_sexes = array(
  957.             'all' => array(
  958.                 'label' => 'Tous',
  959.             ),
  960.             'H' => array(
  961.                 'label' => 'Tous les hommes',
  962.             ),
  963.             'F' => array(
  964.                 'label' => 'Toutes les femmes',
  965.             )
  966.         );
  967.         // le sexe
  968.         if(!empty($this->context['params']['sexe']) && strlen($this->context['params']['sexe'])==1) {
  969.             $params_sql['special']['sexe'] = $this->context['params']['sexe'];
  970.             $this->context['view']->sexe_string $GLOBALS['tr']->trans($this->context['params']['sexe'].'_pluriel');
  971.             $this->context['view']->sexe $this->context['params']['sexe'];
  972.             $this->context['view']->menu_sexes[$this->context['params']['sexe']]['active'] = true;
  973.         }
  974.         else{
  975.             $this->context['view']->menu_sexes['all']['active'] = true;
  976.         }
  977.     }
  978.     // }}}
  979.     // {{{ loadAsidesActualites()
  980.     /** Chargement des asides pour le page d'actualité
  981.      *
  982.      */
  983.     protected function loadAsidesActualites()
  984.     {
  985.         $this->asides->load('common_prochain_evenement');
  986.         $this->asides->load('common_carrer_informations');
  987.         $this->context['view']->info_theatre true;
  988.         $this->asides->load('common_participer_contacts');
  989.     }
  990.     // }}}
  991.     // {{{ loadAsidesSoutiens()
  992.     /** Chargement des asides pour le page d'actualité
  993.      *
  994.      */
  995.     protected function loadAsidesSoutiens()
  996.     {
  997.         $spectacles = [
  998.             array(
  999.                 'name' => 'Tous les spectacles',
  1000.                 'key_url' => ''
  1001.             )
  1002.         ];
  1003.         $this->asides->load(['url_lists' => array(
  1004.             'exec' => array(
  1005.                 'htmlstart' =>  true,
  1006.                 'htmlend' =>  true,
  1007.             ),
  1008.             'php' => [
  1009.                 'method' => 'asidesUrlLists',
  1010.                 'urls' => $spectacles,
  1011.                 'url' => '/ecoles/soutiens'
  1012.             ],
  1013.             'title' => 'Voir'
  1014.         )]);
  1015. //        $this->asides->load(['contact_list_aidecontacts' => [
  1016. //            'ecoles_pages' => true
  1017. //        ]]);
  1018.         $this->asides->load('common_carrer_informations');
  1019.     }
  1020.     // }}}
  1021.     protected function loadAsidesAnciensAfficheTous(){
  1022.         $this->loadEnScene('anciens-etudiants');
  1023. //        $this->asides->load(['par_annee' => array(
  1024. //            'exec' => array(
  1025. //                'alone' => false
  1026. //            ),
  1027. //            'php' => array(
  1028. //                'method' => 'asidesUrlLists',
  1029. //                'url' => '/ecoles/anciens-affiche-tous'
  1030. //            ),
  1031. //        )]);
  1032. //
  1033. //        $this->asides->load(['par_saison' => array(
  1034. //            'exec' => array(
  1035. //                'alone' => false,
  1036. //                'htmlend' => true
  1037. //            ),
  1038. //            'php' => array(
  1039. //                'method' => 'asidesUrlLists',
  1040. //                'url' => '/ecoles/anciens-affiche-tous'
  1041. //            ),
  1042. //        )]);
  1043. //        $this->asides->load(['par_saison' => array(
  1044. //            'exec' => array(
  1045. //                'alone' => false,
  1046. //                'htmlend' => true
  1047. //            ),
  1048. //            'php' => array(
  1049. //                'method' => 'asidesUrlLists',
  1050. //                'url' => '/ecoles/anciens-affiche-tous'
  1051. //            ),
  1052. //        )]);
  1053. //        $this->asides->load(['url_lists_alone,spectacles' => array(
  1054. //            'exec' => array(
  1055. //                'color' => 'spectacles'
  1056. //            ),
  1057. //            'php' => array(
  1058. //                'method' => 'asidesUrlLists',
  1059. //                'urls' => [
  1060. //    //                [
  1061. //    //                    'name' => 'A l\'affiche',
  1062. //    //                    'key_type' => 'in'
  1063. //    //                ],
  1064. //                    [
  1065. //                        'name' => 'Toutes les productions',
  1066. //                        'key_type' => 'prod'
  1067. //                    ]
  1068. //                ],
  1069. //                'url' => '/ecoles/en-scene/type/key_type',
  1070. //                'params' => array(
  1071. //                    'activate' => (!empty($this->context['params']['type'])) ? $this->context['params']['type'] : false
  1072. //                )
  1073. //            ),
  1074. //            'title' => 'voir'
  1075. //        )]);
  1076. //        $this->asides->load(['url_lists_alone,soutenus' => array(
  1077. //            'exec' => array(
  1078. //                'color' => 'spectacles'
  1079. //            ),
  1080. //            'php' => array(
  1081. //
  1082. //                'method' => 'asidesUrlLists',
  1083. //                'urls' => [
  1084. //                    [
  1085. //                        'name' => 'Spectacles à l\'affiche',
  1086. //                        'key_type' => 'soutiens'
  1087. //                    ]
  1088. //                ],
  1089. //                'url' => '/ecoles/en-scene/type/key_type',
  1090. //                'params' => array(
  1091. //                    'activate' => (!empty($this->context['params']['type'])) ? $this->context['params']['type'] : false
  1092. //                )
  1093. //            ),
  1094. //            'title' => 'soutiens'
  1095. //        )]);
  1096. //        $this->asides->load(['url_lists_alone,etudiants' => array(
  1097. //            'exec' => array(
  1098. //                'color' => 'spectacles'
  1099. //            ),
  1100. //            'php' => array(
  1101. //                'method' => 'asidesUrlLists',
  1102. //                'urls' => [
  1103. //                    [
  1104. //                        'name' => 'Anciens à l\'affiche',
  1105. //                        'key_url' => 'anciens-affiche-tous'
  1106. //                    ]
  1107. //                ],
  1108. //                'url' => '/ecoles/key_url',
  1109. //                'params' => array(
  1110. //                    'activate' => $this->context['action']
  1111. //                )
  1112. //            ),
  1113. //            'title' => 'Anciens étudiants'
  1114. //        )]);
  1115.     }
  1116.     protected function loadAsidesAnciensAffiche(){
  1117.         $this->asides->load(['ecoles_with_photos' => array(
  1118.             'exec' => array(
  1119.                 'htmlstart' => true,
  1120.                 // 'alone' => true,
  1121.             ),
  1122.             'title' => 'voir',
  1123.             'title_in_aside' => 'Trier',
  1124.         )]);
  1125.         $this->asides->load(['ecoles_roles' => array('exec' => array('alone' => false))]);
  1126.         $this->asides->load(['par_annee' => array('exec' => array('alone' => false))]);
  1127.         $this->asides->load(['par_saison' => array('exec' => array('alone' => false))]);
  1128.         $this->asides->load(['recherche_par_periode' => array(
  1129.             'exec' => array(
  1130.                 'htmlend' => true
  1131.             ),
  1132.             'php' => array(
  1133.                 'method' => 'asidesUrlLists',
  1134.                 'url' => '/ecoles/anciens-affiche/photo/key_photo/role/key_idrole/sexe/key_sexe'// TODO:  voir avec boussad
  1135.                 'params' => array(
  1136.                     // 'key_photo' => $this->context['view']['params']['photo'],
  1137.                     // 'key_idrole' => $this->context['view']['params']['idrole'],
  1138.                     // 'key_sexe' => $this->context['view']['params']['sexe']
  1139.                 )
  1140.             )
  1141.         )]);
  1142.         $this->asides->load('ecoles_modifier');
  1143.     }
  1144.     protected function loadEtudiants($courant true){
  1145.         $anciens_ou_nouveau_etudiants = [
  1146.             array(
  1147.                 'name' => 'Étudiants',
  1148.                 'key_url' => 'etudiants'
  1149.             ),
  1150.             array(
  1151.                 'name' => 'Anciens étudiants',
  1152.                 'key_url' => 'anciens'
  1153.             )
  1154.         ];
  1155.         $this->asides->load('ecoles_nb_etudiants');
  1156.         $this->asides->load(['url_lists_alone,anciens_nouveau' => array(
  1157.             'php' => array(
  1158.                 'method' => 'asidesUrlLists',
  1159.                 'urls' => $anciens_ou_nouveau_etudiants,
  1160.                 'url' => '/ecoles/key_url',
  1161.                 'params' => array(
  1162.                     'activate' => $this->context['action']
  1163.                 )
  1164.             ),
  1165.             'title' => 'voir'
  1166.         )]);
  1167.         $this->asides->load(['ecoles_with_photos' => array(
  1168.             'exec' => array(
  1169.                 'htmlstart' => true
  1170.             ),
  1171.             'title_sub' => html_entity_decode('Type d\'affichage'),
  1172.         )]);
  1173.         // étudiants
  1174.         if($courant){
  1175.             $this->asides->load(['ecoles_promotions_encours' => array(
  1176.                 'exec' => array(
  1177.                     'alone' => false
  1178.                 ),
  1179.                 'php' => array(
  1180.                     'method' => 'asidesUrlLists',
  1181.                     'urls' => (!empty($this->context['view']->annees)) ? $this->context['view']->annees : array(),
  1182.                     'url' => 'key_page/y/key_year/photo/key_photos',
  1183.                     'params' => array(
  1184.                         'annee' => 'auto_key',
  1185.                         'key_page' => (!empty($this->context['view']->page)) ? $this->context['view']->page '',
  1186.                         'key_photo' => (!empty($this->context['view']->photos)) ? $this->context['view']->photos '',
  1187.                     )
  1188.                 ),
  1189.                 'title' => 'Promotions en cours d\'étude',
  1190.             )]);
  1191.         }
  1192.         // Anciens étudiants
  1193.         else{
  1194.             $this->asides->load(['recherche_promotion' => array(
  1195.                 'exec' => array(
  1196.                     'alone' => false
  1197.                 ),
  1198.                 'title' => 'Rechercher une promotion',
  1199.                 'url' =>'/ecoles/anciens/',
  1200.             )]);
  1201.         }
  1202.         $this->asides->load(['ecoles_roles' => array(
  1203.             'exec' => array(
  1204.                 'alone' => false,
  1205.                 'htmlend' => true
  1206.             ),
  1207.             'title_seconds' => 'Tri par section pour la promo '.((!empty($this->context['view']->annee_promo)) ? $this->context['view']->annee_promo ''),
  1208.             'title_sub' => 'Tous les étudiants',
  1209.         )]);
  1210.         if($courant){
  1211.             $this->asides->load('ecoles_insertion');
  1212.             $this->asides->load(['common_participer_personne' => array(
  1213.                 'exec' => ['color' => 'contacts']
  1214.             )]);
  1215.             $this->asides->load('ecoles_maj');
  1216.         }
  1217.         else{
  1218. //            $this->asides->load(['recherche_personne' => array(
  1219. //                'exec' => array(
  1220. //                    'htmlend' => true,
  1221. //                    'color' => 'context'
  1222. //                ),
  1223. //                'url' => '/ecoles/anciens/',
  1224. //                'title' => 'Rechercher une personne',
  1225. //            )]);
  1226.             $this->asides->load('ecoles_modifier');
  1227.         }
  1228.     }
  1229.     protected function loadEnScene($type_specific null){
  1230.         if(($this->context['view']->spectacles_count_prod_anciens $this->context['view']->spectacles_count_prod_prochains) > 0) {
  1231.             $this->asides->load(['url_lists_alone,spectacles' => array(
  1232.                 'exec' => array(
  1233.                     'color' => 'spectacles'
  1234.                 ),
  1235.                 'php' => array(
  1236.                     'method' => 'asidesUrlLists',
  1237.                     'urls' => [
  1238.                         [
  1239.                             'name' => 'Productions en scène',
  1240.                             'key_type' => 'prod',
  1241.                             'key_periode' => 'prochains',
  1242.                             'key_activate' => 'prod_prochains',
  1243.                             'count' => $this->context['view']->spectacles_count_prod_prochains
  1244.                         ],
  1245.                         [
  1246.                             'name' => 'Toutes les productions',
  1247.                             'key_type' => 'prod',
  1248.                             'key_periode' => 'anciens',
  1249.                             'key_activate' => 'prod_anciens',
  1250.                             'count' => $this->context['view']->spectacles_count_prod_anciens
  1251.                         ]
  1252.                     ],
  1253.                     'url' => '/ecoles/en-scene/type/key_type/periode/key_periode',
  1254.                     'params' => array(
  1255.                         'activate' => (!empty($this->context['params']['type']) && isset($this->context['view']->periodes_selected)) ? $this->context['params']['type'] . '_' $this->context['view']->periodes_selected false
  1256.                     )
  1257.                 ),
  1258.                 'title' => 'voir'
  1259.             )]);
  1260.         }
  1261.         $this->asides->load(['url_lists_alone,soutenus' => array(
  1262.             'exec' => array(
  1263.                 'color' => 'spectacles'
  1264.             ),
  1265.             'php' => array(
  1266.                 'method' => 'asidesUrlLists',
  1267.                 'urls' => [
  1268.                     [
  1269.                         'name' => 'Spectacles à venir',
  1270.                         'key_type' => 'soutiens',
  1271.                         'key_periode' => 'prochains',
  1272.                         'key_activate' => 'soutiens_prochains',
  1273.                         'count' => $this->context['view']->spectacles_count_coprod_prochains
  1274.                     ],
  1275. //                    [
  1276. //                        'name' => 'Tous les spectacles en scène',
  1277. //                        'key_type' => 'soutiens',
  1278. //                        'key_periode' => 'anciens',
  1279. //                        'key_activate' => 'soutiens_anciens',
  1280. //                        'count' => $this->context['view']->spectacles_count_coprod_anciens
  1281. //                    ]
  1282.                 ],
  1283.                 'url' => '/ecoles/en-scene/type/key_type/periode/key_periode',
  1284.                 'params' => array(
  1285.                     'activate' => (!empty($this->context['params']['type']) && isset($this->context['view']->periodes_selected)) ? $this->context['params']['type'].'_'.$this->context['view']->periodes_selected false
  1286.                 )
  1287.             ),
  1288.             'title' => 'soutiens'
  1289.         )]);
  1290.         $this->asides->load(['url_lists,etudiants' => array(
  1291.             'exec' => array(
  1292.                 'color' => 'spectacles',
  1293.                 'htmlstart' => true,
  1294.                 'htmlend' => ($type_specific == 'anciens-etudiants') ? false true,
  1295.             ),
  1296.             'php' => array(
  1297.                 'method' => 'asidesUrlLists',
  1298.                 'urls' => [
  1299.                     [
  1300.                         'name' => 'Anciens à l\'affiche',
  1301.                         'key_url' => 'anciens-affiche-tous',
  1302.                         'key_periode' => 'anciens'
  1303.                     ]
  1304.                 ],
  1305.                 'url' => '/ecoles/key_url/periode/key_periode',
  1306.                 'params' => array(
  1307.                     'activate' => $this->context['action']
  1308.                 )
  1309.             ),
  1310.             'title' => 'Anciens étudiants'
  1311.         )]);
  1312.         if($type_specific == 'anciens-etudiants'){
  1313.             $this->asides->load(['url_lists,days_etudiants' => array(
  1314.                 'exec' => array(
  1315.                     'color' => 'spectacles',
  1316.                     'alone' => false
  1317.                 ),
  1318.                 'php' => [
  1319.                     'method' => 'asidesUrlLists',
  1320.                     'urls' => (!empty($this->context['view']->menu_jours)) ? $this->context['view']->menu_jours : array(),
  1321.                     'url' => '/ecoles/anciens-affiche-tous?d=v_key'
  1322.                 ],
  1323.                 'title' => 'Recherche par période'
  1324.             )]);
  1325.             $this->asides->load(['recherche_par_periode' => array(
  1326.                 'exec' => array(
  1327.                     'alone' => false,
  1328.                     'htmlend' => true
  1329.                 ),
  1330.                 'php' => array(
  1331.                     'method' => 'asidesUrlLists',
  1332.                     'url' => '/ecoles/anciens-affiche-tous'
  1333.                 ),
  1334. //                'title' => 'Rechercher par période'
  1335.             )]);
  1336.         }
  1337.     }
  1338. }