<?php
namespace App\Controller;
use App\Repository\CompteRenduRepository;
use KodKodKod\DrupalConnectBundle\Traits\Services\NodeServiceTrait;
use KodKodKod\DrupalConnectBundle\Traits\Services\TaxonomyServiceTrait;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class HomeController extends AbstractController
{
use NodeServiceTrait;
use TaxonomyServiceTrait;
#[Route('/', name: 'app_home')]
public function index(): Response
{
return $this->redirectToRoute('app_login_index');
}
#[Route('/outil')]
public function outil(): Response
{
return $this->render('home/outil.html.twig', [
]);
}
#[Route('/administration')]
public function administration(Request $request): Response
{
$questions = $this->taxonomyService->findAllFirstQuestions();
if($request->isMethod(Request::METHOD_POST)){
$name = $request->request->get('name');
$this->taxonomyService->create($name);
$lastId = $this->taxonomyService->getLastId();
}
return $this->render('home/index.html.twig', [
'questions' => $questions,
]);
}
#[Route('/medecin')]
public function medecin(CompteRenduRepository $compteRenduRepository): Response
{
$comptes = $compteRenduRepository->findAll();
return $this->render('home/medecin.html.twig', [
'comptes' => $comptes
]);
}
}