diff --git a/Sources/src/app/controller/AthleteController.php b/Sources/src/app/controller/AthleteController.php
new file mode 100644
index 00000000..54d49e87
--- /dev/null
+++ b/Sources/src/app/controller/AthleteController.php
@@ -0,0 +1,177 @@
+ 'John',
+// 'prenom' => 'Doe',
+// 'img' => 'john_doe',
+// 'username' => 'johndoe',
+// ],
+// [
+// 'nom' => 'Alice',
+// 'prenom' => 'Smith',
+// 'img' => 'alice_smith',
+// 'username' => 'alicesmith',
+// ],
+// ];
+// // if(!Validation::val_string($name)){
+// try {
+// //code...
+// // $model->userMgr->getUser($name);
+// return $this->render('./page/addfriend.html.twig',[
+// 'css' => $this->preference->getCookie(),
+// 'pp' => "test2",
+// 'user' => "Doe",
+// 'role' => "Athlète",
+// 'friendship' => [],
+// 'analyzes' => [],
+// 'mails' => [],
+// 'users' => $utiliArray,
+// 'infoUser' => [],
+// 'exos' => [],
+// 'member' => [],
+// 'responce' => "Notification d'ajout envoyée à $username"
+// ]);
+// } catch (\Throwable $th) {
+// //throw $th;
+// // return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
+// }
+// // }
+
+// }
+
+// #[Route(path: '/analyses', name: 'analyses', methods: ['GET'])]
+// public function analyses(): Response
+// {
+// return $this->render('./page/analyze.html.twig',[
+// 'css' => $this->preference->getCookie(),
+// 'pp' => "test2",
+// 'user' => "Doe",
+// 'role' => "Athlète",
+// 'friendship' => [],
+// 'analyzes' => [],
+// 'mails' => [],
+// 'users' => [],
+// 'infoUser' => [],
+// 'exos' => [],
+// 'member' => []
+// ]);
+// }
+
+
+// #[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: '/add-friend', name: 'add-friend', methods: ['POST'])]
+// public function addFriend(string $username, IRequest $req): Response
+// {
+// $taberror = [];
+// $utiliArray = [
+// [
+// 'nom' => 'John',
+// 'prenom' => 'Doe',
+// 'img' => 'john_doe',
+// 'username' => 'johndoe',
+// ],
+// [
+// 'nom' => 'Alice',
+// 'prenom' => 'Smith',
+// 'img' => 'alice_smith',
+// 'username' => 'alicesmith',
+// ],
+// ];
+// // if(!Validation::val_string($name)){
+// try {
+// //code...
+// // $model->userMgr->addFriend($name);
+// return $this->render('./page/addfriend.html.twig',[
+// 'css' => $this->preference->getCookie(),
+// 'pp' => "test2",
+// 'user' => "Doe",
+// 'role' => "Athlète",
+// 'friendship' => [],
+// 'analyzes' => [],
+// 'mails' => [],
+// 'users' => $utiliArray,
+// 'infoUser' => [],
+// 'exos' => [],
+// 'member' => [],
+// 'responce' => "Notification d'ajout envoyée à $username"
+// ]);
+// } catch (\Throwable $th) {
+// //throw $th;
+// // return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
+// }
+// // }
+
+// }
+
+// #[Route(path: '/delete-friend', name: 'delete-friend', methods: ['POST'])]
+
+
+// #[Route(path: '/friend', name: 'friend', methods: ['GET'])]
+// public function friend(): Response
+// {
+// $utiliArray = [
+// [
+// 'nom' => 'John',
+// 'prenom' => 'Doe',
+// 'img' => 'john_doe',
+// 'username' => 'johndoe',
+// ],
+// [
+// 'nom' => 'Alice',
+// 'prenom' => 'Smith',
+// 'img' => 'alice_smith',
+// 'username' => 'alicesmith',
+// ],
+// ];
+// // $this->Auth->getUser->role->getFriends
+// return $this->render('./page/addfriend.html.twig',[
+// 'css' => $this->preference->getCookie(),
+// 'pp' => "test2",
+// 'user' => "Doe",
+// 'role' => "Athlète",
+// 'friendship' => [],
+// 'analyzes' => [],
+// 'mails' => [],
+// 'users' => $utiliArray,
+// 'infoUser' => [],
+// 'exos' => [],
+// 'member' => [],
+// ]);
+// }
+
+// }
\ No newline at end of file
diff --git a/Sources/src/app/controller/AuthController.php b/Sources/src/app/controller/AuthController.php
new file mode 100644
index 00000000..92420559
--- /dev/null
+++ b/Sources/src/app/controller/AuthController.php
@@ -0,0 +1,80 @@
+redirectToRoute('blog_index');
+// }
+
+// // 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
+// // locale. This code regenerates the referrer URL whenever the login page is
+// // browsed, to ensure that its locale is always the current one.
+// $this->saveTargetPath($request->getSession(), 'main', $this->generateUrl('admin_index'));
+
+// return $this->render('security/login.html.twig', [
+// // last username entered by the user (if any)
+// 'last_username' => $helper->getLastUsername(),
+// // last authentication error (if any)
+// 'error' => $helper->getLastAuthenticationError(),
+// ]);
+// }
+
+// #[Route('/login', name: 'login')]
+// 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) {
+// return $this->redirectToRoute('blog_index');
+// }
+
+// // 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
+// // locale. This code regenerates the referrer URL whenever the login page is
+// // browsed, to ensure that its locale is always the current one.
+// $this->saveTargetPath($request->getSession(), 'main', $this->generateUrl('admin_index'));
+
+// return $this->render('security/login.html.twig', [
+// // last username entered by the user (if any)
+// 'last_username' => $helper->getLastUsername(),
+// // last authentication error (if any)
+// 'error' => $helper->getLastAuthenticationError(),
+// ]);
+// }
+
+
+// function inscription() {
+// $model = new ModelVisitor();
+// $log=Validation::clean_string($_POST['pseudo']);
+// $mdp=Validation::clean_string($_POST['password']);
+// if($model->createAUser($log,$mdp)){
+// if(ModelUser::login($log, $mdp)){
+// UserControler::displayView();
+// }
+// }
+// }
+// function login() {
+// $model = new ModelVisitor();
+// if(!isset($_POST['pseudo']) || !isset($_POST['password'])) throw new Exception(" some wrong with credentials !!!!!");
+// $log=Validation::clean_string($_POST['pseudo']);
+// $mdp=Validation::clean_string($_POST['password']);
+// if(ModelUser::login($log, $mdp)){
+// UserControler::displayView();
+// }
+
+// }
+
+
+// }
\ No newline at end of file
diff --git a/Sources/src/app/controller/BaseController.php b/Sources/src/app/controller/BaseController.php
index 5e321b07..18e1a5eb 100644
--- a/Sources/src/app/controller/BaseController.php
+++ b/Sources/src/app/controller/BaseController.php
@@ -17,8 +17,6 @@ abstract class BaseController
$this->container = $container;
}
- abstract public function index(): Response;
-
protected function renderView(string $view, array $parameters = []): string
{
if (!$this->container->has(\Twig\Environment::class)) {
diff --git a/Sources/src/app/controller/CoachController.php b/Sources/src/app/controller/CoachController.php
new file mode 100644
index 00000000..db95d553
--- /dev/null
+++ b/Sources/src/app/controller/CoachController.php
@@ -0,0 +1,128 @@
+coachManager = $dataManager->coachMgr;
+// $this->security = $security;
+// }
+
+// #[Route(path: '/', name: 'home', methods: ['GET'])]
+// public function index(): Response
+// {
+// return $this->render('./page/home.html.twig',[
+// 'css' => $this->preference->getCookie(),
+// 'pp' => "test2",
+// 'user' => "Doe",
+// 'role' => "Athlète",
+// 'friendship' => [],
+// 'analyzes' => [],
+// 'mails' => [],
+// 'users' => [],
+// 'infoUser' => [],
+// 'exos' => [],
+// 'member' => []
+// ]);
+// }
+
+// #[Route('/global-stats', name: 'coach_global_stats', methods: ['GET'])]
+// public function globalStats(): Response
+// {
+// // Add logic to fetch and process global stats
+// 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'])]
+// public function coaching(): Response
+// {
+// return $this->render('./page/coaching.html.twig',[
+// 'css' => $this->preference->getCookie(),
+// 'pp' => "test2",
+// 'user' => "Doe",
+// 'role' => "Athlète",
+// 'friendship' => [],
+// 'analyzes' => [],
+// 'mails' => [],
+// 'users' => [],
+// 'infoUser' => [],
+// 'exos' => [],
+// 'member' => []
+// ]);
+// }
+
+// #[Route('/list-athletes', name: 'coach_list_athletes')]
+// public function listAthletes(): Response
+// {
+// $coach = $this->security->getUser();
+// $athletes = $this->coachManager->getAthletesForCoach($coach);
+
+// return $this->render('coach/list_athletes.html.twig', [
+// 'athletes' => $athletes,
+// ]);
+// }
+// #[Route('/athlete-analysis/{athleteId}', name: 'coach_athlete_analysis', methods: ['GET'])]
+// public function athleteAnalysis($athleteId): Response
+// {
+// // Fetch and process data specific to the athlete
+// return $this->render('coach/athlete_analysis.html.twig', [
+// 'athleteId' => $athleteId,
+// ]);
+// }
+
+// #[Route('/add-athlete/{athleteId}', name: 'coach_add_athlete', methods: ['POST'])]
+// public function addAthlete(IRequest $request, $athleteId): IResponse
+// {
+// // Implement logic to add athlete
+// // ...
+
+// return $this->redirectToRoute('coach_list_athletes');
+// }
+
+// // #[Route('/remove-athlete', name: 'coach_remove_athlete', methods: ['POST'])]
+// // public function removeAthlete(int $athleteId, IRequest $request): IResponse
+// // {
+
+// // return $this->redirectToRoute("/athletes");
+// // }
+
+
+// }
\ No newline at end of file
diff --git a/Sources/src/app/controller/Controller.php b/Sources/src/app/controller/Controller.php
index 5480f9fe..ad066444 100644
--- a/Sources/src/app/controller/Controller.php
+++ b/Sources/src/app/controller/Controller.php
@@ -20,18 +20,33 @@ class Controller extends BaseController
{
session_start();
$this->preference = new Preferences();
- setcookie('toto', 'wallah connard', time()+3600);
}
-
- #[Route(path: '/', name: 'home', methods: ['GET'])] // 8
+
+ #[Route(path: '/', name: 'home', methods: ['GET'])]
public function index(): Response
{
- return $this->render('./page/settings.html.twig',[
+ return $this->render('./page/home.html.twig',[
'css' => $this->preference->getCookie(),
- 'cook' => "home",
- 'css' => 'pink_theme',
'pp' => "test2",
- 'user' => "Ladmion le Cochon",
+ 'user' => "Doe",
+ 'role' => "Athlète",
+ 'friendship' => [],
+ 'analyzes' => [],
+ 'mails' => [],
+ 'users' => [],
+ 'infoUser' => [],
+ 'exos' => [],
+ 'member' => []
+ ]);
+ }
+
+ #[Route(path: '/analyses', name: 'analyses', methods: ['GET'])]
+ public function analyses(): Response
+ {
+ return $this->render('./page/analyze.html.twig',[
+ 'css' => $this->preference->getCookie(),
+ 'pp' => "test2",
+ 'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
@@ -47,9 +62,9 @@ class Controller extends BaseController
public function exercice(): Response
{
return $this->render('./page/exercice.html.twig',[
- 'css' => $preference.getCookie(),
+ 'css' => $this->preference->getCookie(),
'pp' => "test2",
- 'user' => "Ladmion le Cochon",
+ 'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
@@ -60,32 +75,133 @@ class Controller extends BaseController
'member' => []
]);
}
+ #[Route(path: '/search-user', name: 'search-user', methods: ['GET'])]
+ public function searchUser(string $username, IRequest $req): Response
+ {
+ $taberror = [];
+ $utiliArray = [
+ [
+ 'nom' => 'John',
+ 'prenom' => 'Doe',
+ 'img' => 'john_doe',
+ 'username' => 'johndoe',
+ ],
+ [
+ 'nom' => 'Alice',
+ 'prenom' => 'Smith',
+ 'img' => 'alice_smith',
+ 'username' => 'alicesmith',
+ ],
+ ];
+ // if(!Validation::val_string($name)){
+ try {
+ //code...
+ // $model->userMgr->addFriend($name);
+ return $this->render('./page/addfriend.html.twig',[
+ 'css' => $this->preference->getCookie(),
+ 'pp' => "test2",
+ 'user' => "Doe",
+ 'role' => "Athlète",
+ 'friendship' => [],
+ 'analyzes' => [],
+ 'mails' => [],
+ 'users' => $utiliArray,
+ 'infoUser' => [],
+ 'exos' => [],
+ 'member' => [],
+ 'responce' => "Notification d'ajout envoyée à $username"
+ ]);
+ } catch (\Throwable $th) {
+ //throw $th;
+ // return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
+ }
+ // }
+
+ }
+
+ #[Route(path: '/add-friend', name: 'add-friend', methods: ['POST'])]
+ public function addFriend(string $username, IRequest $req): Response
+ {
+ $taberror = [];
+ $utiliArray = [
+ [
+ 'nom' => 'John',
+ 'prenom' => 'Doe',
+ 'img' => 'john_doe',
+ 'username' => 'johndoe',
+ ],
+ [
+ 'nom' => 'Alice',
+ 'prenom' => 'Smith',
+ 'img' => 'alice_smith',
+ 'username' => 'alicesmith',
+ ],
+ ];
+ // if(!Validation::val_string($name)){
+ try {
+ //code...
+ // $model->userMgr->addFriend($name);
+ return $this->render('./page/addfriend.html.twig',[
+ 'css' => $this->preference->getCookie(),
+ 'pp' => "test2",
+ 'user' => "Doe",
+ 'role' => "Athlète",
+ 'friendship' => [],
+ 'analyzes' => [],
+ 'mails' => [],
+ 'users' => $utiliArray,
+ 'infoUser' => [],
+ 'exos' => [],
+ 'member' => [],
+ 'responce' => "Notification d'ajout envoyée à $username"
+ ]);
+ } catch (\Throwable $th) {
+ //throw $th;
+ // return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
+ }
+ // }
+
+ }
- #[Route(path: '/friend', name: 'friend', methods: ['GET'])] // 8
+ #[Route(path: '/friend', name: 'friend', methods: ['GET'])]
public function friend(): Response
{
- return $this->render('./page/friend.html.twig',[
- 'css' => $preference.getCookie(),
+ $utiliArray = [
+ [
+ 'nom' => 'John',
+ 'prenom' => 'Doe',
+ 'img' => 'john_doe',
+ 'username' => 'johndoe',
+ ],
+ [
+ 'nom' => 'Alice',
+ 'prenom' => 'Smith',
+ 'img' => 'alice_smith',
+ 'username' => 'alicesmith',
+ ],
+ ];
+ return $this->render('./page/addfriend.html.twig',[
+ 'css' => $this->preference->getCookie(),
'pp' => "test2",
- 'user' => "Ladmion le Cochon",
+ 'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
- 'users' => [],
+ 'users' => $utiliArray,
'infoUser' => [],
'exos' => [],
- 'member' => []
+ 'member' => [],
]);
}
- #[Route(path: '/coaching', name: 'coaching', methods: ['GET'])] // 8
+ #[Route(path: '/coaching', name: 'coaching', methods: ['GET'])]
public function coaching(): Response
{
return $this->render('./page/coaching.html.twig',[
- 'css' => $preference.getCookie(),
+ 'css' => $this->preference->getCookie(),
'pp' => "test2",
- 'user' => "Ladmion le Cochon",
+ 'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
@@ -97,13 +213,13 @@ class Controller extends BaseController
]);
}
- #[Route(path: '/mail', name: 'mail', methods: ['GET'])] // 8
+ #[Route(path: '/mail', name: 'mail', methods: ['GET'])]
public function mail(): Response
{
return $this->render('./page/mail.html.twig',[
- 'css' => $preference.getCookie(),
+ 'css' => $this->preference->getCookie(),
'pp' => "test2",
- 'user' => "Ladmion le Cochon",
+ 'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
@@ -115,13 +231,13 @@ class Controller extends BaseController
]);
}
- #[Route(path: '/import', name: 'import', methods: ['GET'])] // 8
+ #[Route(path: '/import', name: 'import', methods: ['GET'])]
public function import(): Response
{
return $this->render('./page/import.html.twig',[
- 'css' => $preference.getCookie(),
+ 'css' => $this->preference->getCookie(),
'pp' => "test2",
- 'user' => "Ladmion le Cochon",
+ 'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
@@ -133,28 +249,36 @@ class Controller extends BaseController
]);
}
- #[Route(path: '/hello', name: 'hello', methods: ['GET'])]
- public function hello(): Response
+ #[Route(path: '/settings', name: 'settings', methods: ['GET'])]
+ public function settings(IRequest $req): Response
{
- return new Response('Hello');
+ 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: '/', name: 'preferences', methods: ['POST'])]
+ #[Route(path: '/preferences', name: 'preferences', methods: ['POST'])]
public function preferences(string $theme, IRequest $req): Response
{
/*TODO*/
- // FAUT VALIDER LES DONNEES BATARD
-
+ // VALIDER LES DONNEES
$this->preference->majCookie($theme);
- // throw new \Exception("connard");
- // return new Response("");
+
return $this->render('./page/settings.html.twig',[
- 'css' => $this->preference->getCookie(),
- 'cook' => $_COOKIE['preferences'] ?? "salopard",
'css' => $this->preference->getCookie(),
'pp' => "test2",
- 'user' => "Ladmion le Cochon",
+ 'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
diff --git a/Sources/src/app/controller/HeartRateController.php b/Sources/src/app/controller/HeartRateController.php
new file mode 100644
index 00000000..66509bf8
--- /dev/null
+++ b/Sources/src/app/controller/HeartRateController.php
@@ -0,0 +1,36 @@
+render('./page/import.html.twig',[
+// 'css' => $this->preference->getCookie(),
+// 'pp' => "test2",
+// 'user' => "Doe",
+// 'role' => "Athlète",
+// 'friendship' => [],
+// 'analyzes' => [],
+// 'mails' => [],
+// 'users' => [],
+// 'infoUser' => [],
+// 'exos' => [],
+// 'member' => []
+// ]);
+// }
+
+
+// }
\ No newline at end of file
diff --git a/Sources/src/app/controller/SocialController.php b/Sources/src/app/controller/SocialController.php
new file mode 100644
index 00000000..57fe43b8
--- /dev/null
+++ b/Sources/src/app/controller/SocialController.php
@@ -0,0 +1,17 @@
+
diff --git a/Sources/src/app/controller/UserController.php b/Sources/src/app/controller/UserController.php
new file mode 100644
index 00000000..ff363560
--- /dev/null
+++ b/Sources/src/app/controller/UserController.php
@@ -0,0 +1,80 @@
+render('./page/home.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: '/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' => []
+// ]);
+// }
+
+// }
\ No newline at end of file
diff --git a/Sources/src/app/views/Templates/base.html.twig b/Sources/src/app/views/Templates/base.html.twig
index 2938ab86..9556ed24 100755
--- a/Sources/src/app/views/Templates/base.html.twig
+++ b/Sources/src/app/views/Templates/base.html.twig
@@ -32,10 +32,10 @@
{{ responce }}
+ {% endif %} diff --git a/Sources/src/app/views/Templates/page/friend.html.twig b/Sources/src/app/views/Templates/page/friend.html.twig index 27cf62e5..65bc8597 100755 --- a/Sources/src/app/views/Templates/page/friend.html.twig +++ b/Sources/src/app/views/Templates/page/friend.html.twig @@ -21,6 +21,9 @@