src/Controller/WebinarController.php line 36

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4.  * @author Mehrez Labidi
  5.  */
  6. namespace App\Controller;
  7. use App\Services\MetaTag;
  8. use App\Services\ManagerEntity\WebinarManager;
  9. use Symfony\Component\HttpFoundation\Response;
  10. use Symfony\Component\HttpFoundation\Request;
  11. use App\Twig\TranslationExtension;
  12. class WebinarController extends EntityUsingController {
  13.     /**
  14.      * @var WebinarManager
  15.      */
  16.     private $wm;
  17.     /**
  18.      * @var MetaTag
  19.      */
  20.     private $metaTag;
  21.     public function __construct(WebinarManager $wmMetaTag $metaTag) {
  22.         $this->wm $wm;
  23.         $this->metaTag $metaTag;
  24.     }
  25.     /**
  26.      * @throws \Exception
  27.      */
  28.     public function index(): Response {
  29.         $webinars $this->wm->getWebinarList();
  30.         return $this->render('webinar/index.html.twig', [
  31.                     'controller_name' => 'WebinarController',
  32.                     'webinars' => $webinars,
  33.         ]);
  34.     }
  35.     /**
  36.      * @throws \Exception
  37.      */
  38.     public function detail(Request $requestTranslationExtension $translationExtension$idformation): Response {
  39.         if (!$idformation) {
  40.             throw $this->createNotFoundException('No Webinars found for id ' $idformation);
  41.         }
  42.         $filters $request->query->all();
  43.         $date = ($filters["date"]) ?? NULL;
  44.         $webinar $this->wm->getWebinarDetail($idformation,$date);
  45.         $metaTitle 'webinar FUSACQ, %$titre_webinar%$';
  46.         $metaDescription 'assistez au webinar FUSACQ, %$titre_webinar%$';
  47.         $arrayVarsTrans['titre_webinar'] = $webinar['titre'];
  48.         $lang $request->getSession()->get('lang');
  49.         $metaTag $this->metaTag
  50.                 ->setTitle($translationExtension->translate($metaTitle$lang"""M"""$arrayVarsTrans))
  51.                 ->setDescription($translationExtension->translate($metaDescription$lang"""M"""$arrayVarsTrans));
  52.         return $this->render('webinar/detail.html.twig', [
  53.                     'metaTag' => $metaTag,
  54.                     'controller_name' => 'WebinarController',
  55.                     'webinar' => $webinar,
  56.         ]);
  57.     }
  58. }