src/Controller/IndexController.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Service\GoogleSheet\GoogleSheetGroups;
  4. use App\Service\LangLionService;
  5. use Doctrine\Persistence\ManagerRegistry;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. use Symfony\Component\HttpFoundation\Request;
  10. class IndexController extends AbstractController
  11. {
  12.     public function __construct(LangLionService $langLionService)
  13.     {
  14.         $this->langLionService $langLionService;
  15.     }
  16.     /**
  17.      * @Route("/", name="app_index")
  18.      */
  19.     public function index(GoogleSheetGroups $googleSheetGroups): Response
  20.     {
  21.         $accessToken $this->langLionService->authorize();
  22.         if (!$accessToken) {
  23.             return new Response('Authorization failed'Response::HTTP_UNAUTHORIZED);
  24.         }
  25.         //$groups = $googleSheetGroups->getGroups();
  26.         $groups $this->langLionService->getGroups($accessToken);
  27.         return $this->render('index/index.html.twig', [
  28.             'groups' => $groups
  29.         ])->setSharedMaxAge(3600);;
  30.     }
  31.     /**
  32.      * @Route("/warsztaty", name="workshop")
  33.      */
  34.     public function workshop(ManagerRegistry $doctrine): Response
  35.     {
  36.         return $this->render('index/workshop.html.twig');
  37.     }
  38.     /**
  39.      * @Route("/labolatorium", name="labolatory")
  40.      */
  41.     public function workshopSignUp(ManagerRegistry $doctrine): Response
  42.     {
  43.         return $this->render('index/workshop-registration.html.twig');
  44.     }
  45.     /**
  46.      * @Route("/szkolenia", name="training")
  47.      */
  48.     public function training(ManagerRegistry $doctrine): Response
  49.     {
  50.         return $this->render('index/training.html.twig');
  51.     }
  52.     /**
  53.      * @Route("/darmowe-zajecia-online", name="free_lesson_online")
  54.      */
  55.     public function freeLesson(ManagerRegistry $doctrine): Response
  56.     {
  57.         return $this->render('index/free_lesson.html.twig');
  58.     }
  59.     /**
  60.      * @Route("/cyber-cat", name="cyber-cat")
  61.      */
  62.     public function cyberCat(): Response
  63.     {
  64.         return $this->render('index/cybercat.html.twig');
  65.     }
  66.     /**
  67.      * @Route("/robotyka/podziekowanie", name="thanks")
  68.      */
  69.     public function thanksRobotics(): Response
  70.     {
  71.         return $this->render('index/thanks-robotics.html.twig');
  72.     }
  73.     /**
  74.      * @Route("/programowanie/podziekowanie", name="thanks2")
  75.      */
  76.     public function thanksProgramming(): Response
  77.     {
  78.         return $this->render('index/thanks-programming.html.twig');
  79.     }
  80.     /**
  81.      * @Route("/wakacje", name="vacation")
  82.      */
  83.     public function vacation(ManagerRegistry $doctrine): Response
  84.     {
  85.         return $this->render('index/vacation.html.twig');
  86.     }
  87.     /**
  88.      * @Route("/get_groups", name="get_groups")
  89.      */
  90.     public function getGroups(GoogleSheetGroups $googleSheetGroupsRequest $request): Response
  91.     {
  92.         $city $request->query->get('city');
  93.         $course $request->query->get('course');
  94.         $groups $googleSheetGroups->getGroups($city$course);
  95.         return $this->render('lang_lion/groups.html.twig', [
  96.             'groups' => $groups,
  97.         ]);
  98.     }
  99. }