src/ClassTheatre/aside/asidesPodcasts.php line 66

Open in your IDE?
  1. <?php
  2. namespace App\ClassTheatre\aside;
  3. use App\ClassTheatre\aside\libs\asidesUrl;
  4. use TheatreCore\Entity\Podcasts;
  5. class asidesPodcasts extends asidesUrl {
  6.     public function __construct(&$aside$context){
  7.         $listes_stations = [
  8.             'franceculture' => [
  9.                 'custom_url_clean' => 'France-Culture',
  10.                 'title_custom' => 'France Culture',
  11.                 'logo_custom' => 'france-culture',
  12.                 'url' => 'https://www.franceculture.fr/emissions/',
  13.                 'url_thnet' => 'France-Culture',
  14.                 'params' => null,
  15.                 'getRelations' => []
  16.             ],
  17.             'franceinter' => [
  18.                 'custom_url_clean' => 'France-Inter',
  19.                 'title_custom' => 'France Inter',
  20.                 'logo_custom' => 'france-inter',
  21.                 'url' => 'https://www.franceinter.fr/emissions/',
  22.                 'url_thnet' => 'France-Inter',
  23.                 'params' => 1,
  24.                 'getRelations' => []
  25.             ],
  26.             'soundcloud' => [
  27.                 'title_custom' => 'Autres partenaires',
  28.                 'logo_custom' => false,
  29.                 'url_aside' => '/contacts/key_url_clean/podcasts/',
  30.                 'type_podcast' => 'soundcloud',
  31.                 'url_thnet' => false,
  32.                 'getRelations' => ['podcast_contact']
  33.             ]
  34.         ];
  35.         $params_emissions = [
  36.             'order' => ['podcasts' => 'title_program'],
  37.             'direction' => 'ASC',
  38.             'group' => [
  39.                 'podcasts' => 'title_program'
  40.             ],
  41.             'limit' => ['all'],
  42.             'special' => [],
  43.         ];
  44.         $selected $aside['php']['params']['station'] ?: 'franceculture';
  45.         if(!empty($listes_stations[$selected]['params'])){
  46.             $params_emissions['special'] = [
  47.                 'type_franceinter' => $listes_stations[$selected]['params']
  48.             ];
  49.         }
  50.         else if(!empty($listes_stations[$selected]['type_podcast'])){
  51.             unset($params_emissions['group']);
  52.             $params_emissions['special'] = [
  53.                 'type_podcast' => $listes_stations[$selected]['type_podcast']
  54.             ];
  55.         }
  56.         $podcasts $aside['php']['params']['em']->getRepository(Podcasts::class);
  57.         $listes_emissions $podcasts->getListEmissions($params_emissions, ['getRelations' => $listes_stations[$selected]['getRelations']]);
  58.         $menu_content = [];
  59.         if($selected == 'soundcloud') {
  60.             foreach($listes_emissions AS $item){
  61.                 if(!empty($item['podcast_contact'])) {
  62.                     foreach ($item['podcast_contact'] AS $k => $v){
  63.                         $menu_content[$k] = [
  64.                             'name' => $v['organisation'],
  65.                             'key_url_clean' => $v['url_clean']
  66.                         ];
  67.                     }
  68.                 }
  69.             }
  70.             usort($menu_content, function($a$b) {return strcmp($a['name'], $b['name']);});
  71.         }
  72.         else{
  73.             foreach($listes_emissions AS $item){
  74.                 if(!empty($item['title_program'])){
  75.                     $menu_content[] = [
  76.                         'name' => $item['title_program'],
  77.                         'key_program' => $item['name_program']
  78.                     ];
  79.                 }
  80.             }
  81.         }
  82.         foreach($listes_stations[$selected] AS $k => $v){
  83.             $aside[$k] = $v;
  84.         }
  85.         $aside['php'] = array(
  86.             'urls' => $menu_content,
  87.             'url' => (isset($listes_stations[$selected]['url_aside'])) ? $listes_stations[$selected]['url_aside'] : '/contacts/key_url/podcasts/emission/key_program',
  88.             'params' => array(
  89.                 'key_url' => $listes_stations[$aside['php']['params']['station']]['url_thnet'],
  90.                 'activate' => 'selections/'.$context->action
  91.             )
  92.         );
  93.         $aside['type_'.$selected] = true;
  94.         if($context->action == 'podcasts' && !empty($context->context['params']['emission'])){
  95.             $aside['php']['params']['activate'] = $context->context['params']['emission'];
  96.         }
  97.         parent::__construct($aside$context);
  98.         $this->run("url");
  99.     }
  100. }