Ajout route dans les bons controller (pas terminé)
continuous-integration/drone/push Build is failing Details

issue_031_Controlers
Antoine PINAGOT 1 year ago
parent c0c7d6560f
commit 637c522959

@ -1,37 +1,37 @@
<?php <?php
// namespace App\Controller; namespace App\Controller;
// use App\Container; use App\Container;
// use App\Router\Request\IRequest; use App\Router\Request\IRequest;
// use App\Router\Response\Response; use App\Router\Response\Response;
// use Shared\Attributes\Route; use Shared\Attributes\Route;
// use Twig\Environment; use Twig\Environment;
// use Data\Core\Preferences; use Data\Core\Preferences;
// use Shared\Log; use Shared\Log;
// class AuthController extends BaseController class AuthController extends BaseController
// { {
// #[Route('/login', name: 'login')] #[Route('/login', name: 'login')]
// public function login(?string $username, ?string $password ,IRequest $request): Response { public function login(?string $username, ?string $password ,IRequest $request): Response {
// // if user is already logged in, don't display the login page again // if user is already logged in, don't display the login page again
// if ($user) { if ($user) {
// return $this->redirectToRoute('blog_index'); return $this->redirectToRoute('blog_index');
// } }
// // this statement solves an edge-case: if you change the locale in the login // this statement solves an edge-case: if you change the locale in the login
// // page, after a successful login you are redirected to a page in the previous // page, after a successful login you are redirected to a page in the previous
// // locale. This code regenerates the referrer URL whenever the login page is // locale. This code regenerates the referrer URL whenever the login page is
// // browsed, to ensure that its locale is always the current one. // browsed, to ensure that its locale is always the current one.
// $this->saveTargetPath($request->getSession(), 'main', $this->generateUrl('admin_index')); $this->saveTargetPath($request->getSession(), 'main', $this->generateUrl('admin_index'));
// return $this->render('security/login.html.twig', [ return $this->render('security/login.html.twig', [
// // last username entered by the user (if any) // last username entered by the user (if any)
// 'last_username' => $helper->getLastUsername(), 'last_username' => $helper->getLastUsername(),
// // last authentication error (if any) // last authentication error (if any)
// 'error' => $helper->getLastAuthenticationError(), 'error' => $helper->getLastAuthenticationError(),
// ]); ]);
// } }
// #[Route('/login', name: 'login')] // #[Route('/login', name: 'login')]
// public function login(?string $username, ?string $password ,IRequest $request): Response { // public function login(?string $username, ?string $password ,IRequest $request): Response {
@ -55,28 +55,28 @@
// } // }
// function inscription() { function inscription() {
// $model = new ModelVisitor(); $model = new ModelVisitor();
// $log=Validation::clean_string($_POST['pseudo']); $log=Validation::clean_string($_POST['pseudo']);
// $mdp=Validation::clean_string($_POST['password']); $mdp=Validation::clean_string($_POST['password']);
// if($model->createAUser($log,$mdp)){ if($model->createAUser($log,$mdp)){
// if(ModelUser::login($log, $mdp)){ if(ModelUser::login($log, $mdp)){
// UserControler::displayView(); UserControler::displayView();
// } }
// } }
// } }
// function login() { function connexion(){
// $model = new ModelVisitor(); $model = new ModelVisitor();
// if(!isset($_POST['pseudo']) || !isset($_POST['password'])) throw new Exception(" some wrong with credentials !!!!!"); if(!isset($_POST['pseudo']) || !isset($_POST['password'])) throw new Exception(" some wrong with credentials !!!!!");
// $log=Validation::clean_string($_POST['pseudo']); $log=Validation::clean_string($_POST['pseudo']);
// $mdp=Validation::clean_string($_POST['password']); $mdp=Validation::clean_string($_POST['password']);
// if(ModelUser::login($log, $mdp)){ if(ModelUser::login($log, $mdp)){
// UserControler::displayView(); UserControler::displayView();
// } }
// } }
// } }
?> ?>

@ -1,49 +1,35 @@
<?php <?php
// namespace App\Controller; namespace App\Controller;
// use App\Container; use App\Container;
// use App\Router\Request\IRequest; use App\Router\Request\IRequest;
// use App\Router\Response\Response; use App\Router\Response\Response;
// use App\Router\Response\IResponse; use App\Router\Response\IResponse;
// use Shared\Attributes\Route; use Shared\Attributes\Route;
// use Twig\Environment; use Twig\Environment;
// use Data\Core\Preferences; use Data\Core\Preferences;
// use Shared\Log; use Shared\Log;
// #[Route(path: '/coach', name: 'coach')] #[Route(path: '/coach', name: 'coach')]
// class CoachController extends BaseController class CoachController extends BaseController
// { {
// private ICoachManager $coachManager;
// private $security;
// public function __construct(DataManager $dataManager, Security $security) private ICoachManager $coachManager;
// { private $security;
// $this->coachManager = $dataManager->coachMgr; private Environment $twig;
// $this->security = $security; private Preferences $preference;
// }
// #[Route(path: '/', name: 'home', methods: ['GET'])] public function __construct(DataManager $dataManager, Security $security)
// public function index(): Response {
// { session_start();
// return $this->render('./page/home.html.twig',[ $this->coachManager = $dataManager->coachMgr;
// 'css' => $this->preference->getCookie(), $this->security = $security;
// 'pp' => "test2", $this->preference = new Preferences();
// 'user' => "Doe", }
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
// #[Route('/global-stats', name: 'coach_global_stats', methods: ['GET'])] // #[Route('/global-stats', name: 'coach_global_stats', methods: ['GET'])]
// public function globalStats(): Response // public function globalStats(): Response
@ -52,42 +38,24 @@
// return $this->render('coach/global_stats.html.twig'); // return $this->render('coach/global_stats.html.twig');
// } // }
// #[Route(path: '/exercice', name: 'exercice', methods: ['GET'])] // 8
// public function exercice(): Response
// {
// return $this->render('./page/exercice.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
#[Route(path: '/coaching', name: 'coaching', methods: ['GET'])]
// #[Route(path: '/coaching', name: 'coaching', methods: ['GET'])] public function coaching(): Response
// public function coaching(): Response {
// { return $this->render('./page/coaching.html.twig',[
// return $this->render('./page/coaching.html.twig',[ 'css' => $this->preference->getCookie(),
// 'css' => $this->preference->getCookie(), 'pp' => "test2",
// 'pp' => "test2", 'user' => "Doe",
// 'user' => "Doe", 'role' => "Coach",
// 'role' => "Athlète", 'friendship' => [],
// 'friendship' => [], 'analyzes' => [],
// 'analyzes' => [], 'mails' => [],
// 'mails' => [], 'users' => [],
// 'users' => [], 'infoUser' => [],
// 'infoUser' => [], 'exos' => [],
// 'exos' => [], 'member' => []
// 'member' => [] ]);
// ]); }
// }
// #[Route('/list-athletes', name: 'coach_list_athletes')] // #[Route('/list-athletes', name: 'coach_list_athletes')]
// public function listAthletes(): Response // public function listAthletes(): Response
@ -125,4 +93,4 @@
// // } // // }
// } }

@ -22,41 +22,41 @@ class Controller extends BaseController
$this->preference = new Preferences(); $this->preference = new Preferences();
} }
#[Route(path: '/', name: 'index', methods: ['GET'])] // #[Route(path: '/', name: 'index', methods: ['GET'])]
public function index(): Response // public function index(): Response
{ // {
return $this->render('./page/index.html',[ // return $this->render('./page/index.html',[
'css' => $this->preference->getCookie(), // 'css' => $this->preference->getCookie(),
'pp' => "test2", // 'pp' => "test2",
'user' => "Doe", // 'user' => "Doe",
'role' => "Athlète", // 'role' => "Athlète",
'friendship' => [], // 'friendship' => [],
'analyzes' => [], // 'analyzes' => [],
'mails' => [], // 'mails' => [],
'users' => [], // 'users' => [],
'infoUser' => [], // 'infoUser' => [],
'exos' => [], // 'exos' => [],
'member' => [] // 'member' => []
]); // ]);
} // }
#[Route(path: '/home', name: 'home', methods: ['GET'])] // #[Route(path: '/home', name: 'home', methods: ['GET'])]
public function home(): Response // public function home(): Response
{ // {
return $this->render('./page/home.html.twig',[ // return $this->render('./page/home.html.twig',[
'css' => $this->preference->getCookie(), // 'css' => $this->preference->getCookie(),
'pp' => "test2", // 'pp' => "test2",
'user' => "Doe", // 'user' => "Doe",
'role' => "Athlète", // 'role' => "Athlète",
'friendship' => [], // 'friendship' => [],
'analyzes' => [], // 'analyzes' => [],
'mails' => [], // 'mails' => [],
'users' => [], // 'users' => [],
'infoUser' => [], // 'infoUser' => [],
'exos' => [], // 'exos' => [],
'member' => [] // 'member' => []
]); // ]);
} // }
#[Route(path: '/analyses', name: 'analyses', methods: ['GET'])] #[Route(path: '/analyses', name: 'analyses', methods: ['GET'])]
public function analyses(): Response public function analyses(): Response
@ -450,180 +450,180 @@ class Controller extends BaseController
]); ]);
} }
#[Route(path: '/coaching', name: 'coaching', methods: ['GET'])] // #[Route(path: '/coaching', name: 'coaching', methods: ['GET'])]
public function coaching(): Response // public function coaching(): Response
{ // {
return $this->render('./page/coaching.html.twig',[ // return $this->render('./page/coaching.html.twig',[
'css' => $this->preference->getCookie(), // 'css' => $this->preference->getCookie(),
'pp' => "test2", // 'pp' => "test2",
'user' => "Doe", // 'user' => "Doe",
'role' => "Athlète", // 'role' => "Athlète",
'friendship' => [], // 'friendship' => [],
'analyzes' => [], // 'analyzes' => [],
'mails' => [], // 'mails' => [],
'users' => [], // 'users' => [],
'infoUser' => [], // 'infoUser' => [],
'exos' => [], // 'exos' => [],
'member' => [] // 'member' => []
]); // ]);
} // }
#[Route(path: '/mail', name: 'mail', methods: ['GET'])]
public function mail(): Response
{
return $this->render('./page/mail.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]);
}
#[Route(path: '/import', name: 'import', methods: ['GET'])]
public function import(): Response
{
return $this->render('./page/import.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]);
}
#[Route(path: '/settings', name: 'settings', methods: ['GET'])]
public function settings(IRequest $req): Response
{
return $this->render('./page/settings.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]);
}
#[Route(path: '/profile', name: 'profile', methods: ['GET'])]
public function profile(): Response
{
return $this->render('./page/profile.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]);
}
#[Route(path: '/preferences', name: 'preferences', methods: ['POST'])]
public function preferences(string $theme, IRequest $req): Response
{
/*TODO*/
// VALIDER LES DONNEES
$this->preference->majCookie($theme);
return $this->render('./page/settings.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]);
}
#[Route(path: '/psettings', name: 'psettings', methods: ['POST'])]
public function psettings(string $nom,string $prenom,string $dateNaissance,string $mail,string $tel, IRequest $req): Response
{
// #[Route(path: '/mail', name: 'mail', methods: ['GET'])]
// public function mail(): Response
// {
// return $this->render('./page/mail.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
return $this->render('./page/settings.html.twig',[ // #[Route(path: '/import', name: 'import', methods: ['GET'])]
'css' => $this->preference->getCookie(), // public function import(): Response
'pp' => "test2", // {
'user' => $prenom, // return $this->render('./page/import.html.twig',[
'role' => "Athlète", // 'css' => $this->preference->getCookie(),
'friendship' => [], // 'pp' => "test2",
'analyzes' => [], // 'user' => "Doe",
'mails' => [], // 'role' => "Athlète",
'users' => [], // 'friendship' => [],
'infoUser' => [], // 'analyzes' => [],
'exos' => [], // 'mails' => [],
'member' => [] // 'users' => [],
]); // 'infoUser' => [],
} // 'exos' => [],
// 'member' => []
// ]);
// }
#[Route(path: '/mdp', name: 'mdp', methods: ['POST'])] // #[Route(path: '/settings', name: 'settings', methods: ['GET'])]
public function mdp(string $ancienMotDePasse,string $nouveauMotDePasse,string $confirmerMotDePasse, IRequest $req): Response // public function settings(IRequest $req): Response
{ // {
// return $this->render('./page/settings.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
// CONFIRMER LES DONNESS !!!!! IMPORTANT // #[Route(path: '/profile', name: 'profile', methods: ['GET'])]
// public function profile(): Response
// {
// return $this->render('./page/profile.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
return $this->render('./page/settings.html.twig',[ // #[Route(path: '/preferences', name: 'preferences', methods: ['POST'])]
'css' => $this->preference->getCookie(), // public function preferences(string $theme, IRequest $req): Response
'pp' => "test2", // {
'user' => "Doe", // /*TODO*/
'role' => "Athlète",
'friendship' => [], // // VALIDER LES DONNEES
'analyzes' => [], // $this->preference->majCookie($theme);
'mails' => [],
'users' => [], // return $this->render('./page/settings.html.twig',[
'infoUser' => [], // 'css' => $this->preference->getCookie(),
'exos' => [], // 'pp' => "test2",
'member' => [] // 'user' => "Doe",
]); // 'role' => "Athlète",
} // 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
#[Route(path: '/login', name: 'login', methods: ['POST'])] // #[Route(path: '/psettings', name: 'psettings', methods: ['POST'])]
public function login(string $username,string $mdp, IRequest $req): Response // public function psettings(string $nom,string $prenom,string $dateNaissance,string $mail,string $tel, IRequest $req): Response
{ // {
// return $this->render('./page/settings.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => $prenom,
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
// CONFIRMER LES DONNESS !!!!! IMPORTANT // #[Route(path: '/mdp', name: 'mdp', methods: ['POST'])]
// public function mdp(string $ancienMotDePasse,string $nouveauMotDePasse,string $confirmerMotDePasse, IRequest $req): Response
// {
// // CONFIRMER LES DONNESS !!!!! IMPORTANT
// return $this->render('./page/settings.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
return $this->render('./page/home.html.twig',[ // #[Route(path: '/login', name: 'login', methods: ['POST'])]
'css' => $this->preference->getCookie(), // public function login(string $username,string $mdp, IRequest $req): Response
'pp' => "test2", // {
'user' => "Doe",
'role' => "Athlète", // // CONFIRMER LES DONNESS !!!!! IMPORTANT
'friendship' => [],
'analyzes' => [], // return $this->render('./page/home.html.twig',[
'mails' => [], // 'css' => $this->preference->getCookie(),
'users' => [], // 'pp' => "test2",
'infoUser' => [], // 'user' => "Doe",
'exos' => [], // 'role' => "Athlète",
'member' => [] // 'friendship' => [],
]); // 'analyzes' => [],
} // 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
#[Route(path: '/log', name: 'log', methods: ['GET'])] #[Route(path: '/log', name: 'log', methods: ['GET'])]
public function login2(): Response public function login2(): Response
@ -653,17 +653,7 @@ class Controller extends BaseController
// CONFIRMER LES DONNESS !!!!! IMPORTANT // CONFIRMER LES DONNESS !!!!! IMPORTANT
return $this->render('./page/home.html.twig',[ return $this->render('./page/home.html.twig',[
'css' => $this->preference->getCookie(), 'css' => $this->preference->getCookie()
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]); ]);
} }
@ -674,61 +664,51 @@ class Controller extends BaseController
// CONFIRMER LES DONNESS !!!!! IMPORTANT // CONFIRMER LES DONNESS !!!!! IMPORTANT
return $this->render('./page/register.html.twig',[ return $this->render('./page/register.html.twig',[
'css' => $this->preference->getCookie(), 'css' => $this->preference->getCookie()
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]); ]);
} }
#[Route(path: '/pass', name: 'pass', methods: ['GET'])] // #[Route(path: '/pass', name: 'pass', methods: ['GET'])]
public function pass(): Response // public function pass(): Response
{ // {
// CONFIRMER LES DONNESS !!!!! IMPORTANT // // CONFIRMER LES DONNESS !!!!! IMPORTANT
return $this->render('./page/password.html.twig',[ // return $this->render('./page/password.html.twig',[
'css' => $this->preference->getCookie(), // 'css' => $this->preference->getCookie(),
'pp' => "test2", // 'pp' => "test2",
'user' => "Doe", // 'user' => "Doe",
'role' => "Athlète", // 'role' => "Athlète",
'friendship' => [], // 'friendship' => [],
'analyzes' => [], // 'analyzes' => [],
'mails' => [], // 'mails' => [],
'users' => [], // 'users' => [],
'infoUser' => [], // 'infoUser' => [],
'exos' => [], // 'exos' => [],
'member' => [] // 'member' => []
]); // ]);
} // }
#[Route(path: '/password', name: 'password', methods: ['POST'])]
public function password(string $email, IRequest $req): Response
{
// CONFIRMER LES DONNESS !!!!! IMPORTANT
return $this->render('./page/login.html.twig',[ // #[Route(path: '/password', name: 'password', methods: ['POST'])]
'css' => $this->preference->getCookie(), // public function password(string $email, IRequest $req): Response
'pp' => "test2", // {
'user' => "Doe",
'role' => "Athlète", // // CONFIRMER LES DONNESS !!!!! IMPORTANT
'friendship' => [],
'analyzes' => [], // return $this->render('./page/login.html.twig',[
'mails' => [], // 'css' => $this->preference->getCookie(),
'users' => [], // 'pp' => "test2",
'infoUser' => [], // 'user' => "Doe",
'exos' => [], // 'role' => "Athlète",
'member' => [] // 'friendship' => [],
]); // 'analyzes' => [],
} // 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
} }

@ -1,36 +1,45 @@
<?php <?php
// namespace App\Controller; namespace App\Controller;
// use App\Container; use App\Container;
// use App\Router\Request\IRequest; use App\Router\Request\IRequest;
// use App\Router\Response\Response; use App\Router\Response\Response;
// use Shared\Attributes\Route; use Shared\Attributes\Route;
// use Twig\Environment; use Twig\Environment;
// use Data\Core\Preferences; use Data\Core\Preferences;
// use Shared\Log; use Shared\Log;
// class HeartRateController extends BaseController class HeartRateController extends BaseController
// { {
private Environment $twig;
// #[Route(path: '/import', name: 'import', methods: ['GET'])] private Preferences $preference;
// public function import(): Response
// { public function __construct()
// return $this->render('./page/import.html.twig',[ {
// 'css' => $this->preference->getCookie(), session_start();
// 'pp' => "test2", $this->preference = new Preferences();
// 'user' => "Doe", }
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [], #[Route(path: '/import', name: 'import', methods: ['GET'])]
// 'mails' => [], public function import(): Response
// 'users' => [], {
// 'infoUser' => [], return $this->render('./page/import.html.twig',[
// 'exos' => [], 'css' => $this->preference->getCookie(),
// 'member' => [] 'pp' => "test2",
// ]); 'user' => "Doe",
// } 'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
// } 'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]);
}
}

@ -1,4 +1,29 @@
<!-- #[Route(path: '/mail', name: 'mail', methods: ['GET'])] <?php
namespace App\Controller;
use App\Container;
use App\Router\Request\IRequest;
use App\Router\Response\Response;
use Shared\Attributes\Route;
use Twig\Environment;
use Data\Core\Preferences;
use Shared\Log;
class SocialController extends BaseController
{
private Environment $twig;
private Preferences $preference;
public function __construct()
{
session_start();
$this->preference = new Preferences();
}
#[Route(path: '/mail', name: 'mail', methods: ['GET'])]
public function mail(): Response public function mail(): Response
{ {
return $this->render('./page/mail.html.twig',[ return $this->render('./page/mail.html.twig',[
@ -14,4 +39,7 @@
'exos' => [], 'exos' => [],
'member' => [] 'member' => []
]); ]);
} --> }
}

@ -1,80 +1,163 @@
<?php <?php
// namespace App\Controller; namespace App\Controller;
// use App\Container; use App\Container;
// use App\Router\Request\IRequest; use App\Router\Request\IRequest;
// use App\Router\Response\Response; use App\Router\Response\Response;
// use Shared\Attributes\Route; use Shared\Attributes\Route;
// use Twig\Environment; use Twig\Environment;
// use Data\Core\Preferences; use Data\Core\Preferences;
// use Shared\Log; use Shared\Log;
// class UserController extends BaseController class UserController extends BaseController
// { {
private Environment $twig;
private Preferences $preference;
// #[Route(path: '/', name: 'home', methods: ['GET'])] public function __construct()
// public function index(): Response {
// { session_start();
// return $this->render('./page/home.html.twig',[ $this->preference = new Preferences();
// 'css' => $this->preference->getCookie(), }
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète", #[Route(path: '/', name: 'index', methods: ['GET'])]
// 'friendship' => [], public function index(): Response
// 'analyzes' => [], {
// 'mails' => [], return $this->render('./page/index.html',[
// 'users' => [], 'css' => $this->preference->getCookie(),
// 'infoUser' => [], 'pp' => "test2",
// 'exos' => [], 'user' => "Doe",
// 'member' => [] 'role' => "Athlète",
// ]); 'friendship' => [],
// } 'analyzes' => [],
'mails' => [],
'users' => [],
// #[Route(path: '/settings', name: 'settings', methods: ['GET'])] 'infoUser' => [],
// public function settings(IRequest $req): Response 'exos' => [],
// { 'member' => []
// return $this->render('./page/settings.html.twig',[ ]);
// 'css' => $this->preference->getCookie(), }
// 'pp' => "test2",
// 'user' => "Doe", #[Route(path: '/home', name: 'home', methods: ['GET'])]
// 'role' => "Athlète", public function home(): Response
// 'friendship' => [], {
// 'analyzes' => [], return $this->render('./page/home.html.twig',[
// 'mails' => [], 'css' => $this->preference->getCookie(),
// 'users' => [], 'pp' => "test2",
// 'infoUser' => [], 'user' => "Doe",
// 'exos' => [], 'role' => "Athlète",
// 'member' => [] 'friendship' => [],
// ]); 'analyzes' => [],
// } 'mails' => [],
'users' => [],
'infoUser' => [],
// #[Route(path: '/preferences', name: 'preferences', methods: ['POST'])] 'exos' => [],
// public function preferences(string $theme, IRequest $req): Response 'member' => []
// { ]);
// /*TODO*/ }
// // VALIDER LES DONNEES
// $this->preference->majCookie($theme); #[Route(path: '/settings', name: 'settings', methods: ['GET'])]
public function settings(IRequest $req): Response
// return $this->render('./page/settings.html.twig',[ {
// 'css' => $this->preference->getCookie(), return $this->render('./page/settings.html.twig',[
// 'pp' => "test2", 'css' => $this->preference->getCookie(),
// 'user' => "Doe", 'pp' => "test2",
// 'role' => "Athlète", 'user' => "Doe",
// 'friendship' => [], 'role' => "Athlète",
// 'analyzes' => [], 'friendship' => [],
// 'mails' => [], 'analyzes' => [],
// 'users' => [], 'mails' => [],
// 'infoUser' => [], 'users' => [],
// 'exos' => [], 'infoUser' => [],
// 'member' => [] 'exos' => [],
// ]); 'member' => []
// } ]);
}
// }
#[Route(path: '/profile', name: 'profile', methods: ['GET'])]
public function profile(): Response
{
return $this->render('./page/profile.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]);
}
#[Route(path: '/preferences', name: 'preferences', methods: ['POST'])]
public function preferences(string $theme, IRequest $req): Response
{
/*TODO*/
// VALIDER LES DONNEES
$this->preference->majCookie($theme);
return $this->render('./page/settings.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]);
}
#[Route(path: '/psettings', name: 'psettings', methods: ['POST'])]
public function psettings(string $nom,string $prenom,string $dateNaissance,string $mail,string $tel, IRequest $req): Response
{
return $this->render('./page/settings.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => $prenom,
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]);
}
#[Route(path: '/mdp', name: 'mdp', methods: ['POST'])]
public function mdp(string $ancienMotDePasse,string $nouveauMotDePasse,string $confirmerMotDePasse, IRequest $req): Response
{
// CONFIRMER LES DONNESS !!!!! IMPORTANT
return $this->render('./page/settings.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]);
}
}
Loading…
Cancel
Save