diff --git a/Sources/src/app/controller/Controller.php b/Sources/src/app/controller/Controller.php index ad066444..76624c2d 100644 --- a/Sources/src/app/controller/Controller.php +++ b/Sources/src/app/controller/Controller.php @@ -58,6 +58,24 @@ class Controller extends BaseController ]); } + #[Route(path: '/activity', name: 'activity', methods: ['GET'])] + public function activity(): Response + { + return $this->render('./page/activity.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 { @@ -75,10 +93,38 @@ class Controller extends BaseController 'member' => [] ]); } + + #[Route(path: '/exercices', name: 'exercices', methods: ['POST'])] // 8 + public function exercices(String $type, String $intensite, String $date, IRequest $req): Response + { + $exercicesArray = [ + [ + 'date' => $date, + 'type' => $type, + 'intensite' => $intensite, + 'status' => 'A venur', + ] + ]; + return $this->render('./page/exercice.html.twig',[ + 'css' => $this->preference->getCookie(), + 'pp' => "test2", + 'user' => "Doe", + 'role' => "Athlète", + 'friendship' => [], + 'analyzes' => [], + 'mails' => [], + 'users' => [], + 'infoUser' => [], + 'exos' => $exercicesArray, + 'member' => [] + ]); + } + #[Route(path: '/search-user', name: 'search-user', methods: ['GET'])] public function searchUser(string $username, IRequest $req): Response { $taberror = []; + // FILTER $utiliArray = [ [ 'nom' => 'John', @@ -119,6 +165,127 @@ class Controller extends BaseController } + #[Route(path: '/search-member', name: 'search-member', methods: ['GET'])] + public function searchMember(string $username, IRequest $req): Response + { + $taberror = []; + // FILTER + $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/addmember.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-member', name: 'add-member', methods: ['POST'])] + public function addmember(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/addmember.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: '/member', name: 'member', methods: ['GET'])] + public function member(): Response + { + $utiliArray = [ + [ + 'nom' => 'John', + 'prenom' => 'Doe', + 'img' => 'john_doe', + 'username' => 'johndoe', + ], + [ + 'nom' => 'Alice', + 'prenom' => 'Smith', + 'img' => 'alice_smith', + 'username' => 'alicesmith', + ], + ]; + return $this->render('./page/addmember.html.twig',[ + 'css' => $this->preference->getCookie(), + 'pp' => "test2", + 'user' => "Doe", + 'role' => "Athlète", + 'friendship' => [], + 'analyzes' => [], + 'mails' => [], + 'users' => $utiliArray, + 'infoUser' => [], + 'exos' => [], + 'member' => [], + ]); + } + #[Route(path: '/add-friend', name: 'add-friend', methods: ['POST'])] public function addFriend(string $username, IRequest $req): Response { @@ -195,6 +362,76 @@ class Controller extends BaseController ]); } + #[Route(path: '/friendlist', name: 'friendlist', methods: ['POST'])] + public function friendlist(string $username, IRequest $req): Response + { + $utiliArray = [ + [ + 'nom' => 'John', + 'prenom' => 'Doe', + 'img' => 'john_doe', + 'username' => 'johndoe', + ], + [ + 'nom' => 'Alice', + 'prenom' => 'Smith', + 'img' => 'alice_smith', + 'username' => 'alicesmith', + ], + ]; + /* TODO */ + + // -> Enlever ou bloquer un utilisateur en fonction de son username + + return $this->render('./page/friend.html.twig',[ + 'css' => $this->preference->getCookie(), + 'pp' => "test2", + 'user' => "Doe", + 'role' => "Athlète", + 'friendship' => $utiliArray, + 'analyzes' => [], + 'mails' => [], + 'users' => [], + 'infoUser' => [], + 'exos' => [], + 'member' => [], + ]); + } + + #[Route(path: '/friendlist', name: 'friendlist2', methods: ['GET'])] + public function friendlist2(): Response + { + $utiliArray = [ + [ + 'nom' => 'John', + 'prenom' => 'Doe', + 'img' => 'test', + 'status' => 'johndoe', + 'username' => 'jdoe', + ], + [ + 'nom' => 'Alice', + 'prenom' => 'Smith', + 'img' => 'test2', + 'status' => 'alicesmith', + 'username' => 'asmith', + ], + ]; + return $this->render('./page/friend.html.twig',[ + 'css' => $this->preference->getCookie(), + 'pp' => "test2", + 'user' => "Doe", + 'role' => "Athlète", + 'friendship' => $utiliArray, + 'analyzes' => [], + 'mails' => [], + 'users' => [], + 'infoUser' => [], + 'exos' => [], + 'member' => [], + ]); + } + #[Route(path: '/coaching', name: 'coaching', methods: ['GET'])] public function coaching(): Response { @@ -267,6 +504,24 @@ class Controller extends BaseController ]); } + #[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 { @@ -290,6 +545,47 @@ class Controller extends BaseController ]); } + #[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' => [] + ]); + } + } diff --git a/Sources/src/app/controller/FrontController.php b/Sources/src/app/controller/FrontController.php index 79a48f91..1f37a16a 100644 --- a/Sources/src/app/controller/FrontController.php +++ b/Sources/src/app/controller/FrontController.php @@ -65,7 +65,7 @@ class FrontController { throw new \LogicException('You cannot use the "renderView" method if the Twig Bundle is not available. Try running "composer require symfony/twig-bundle".'); } - $response = new Response($this->container->get(\Twig\Environment::class)->render('./errorbase.html.twig',['title'=> $message , "nb" => $statusCode, "name" => $message, "descr" => $message ]),$statusCode); + $response = new Response($this->container->get(\Twig\Environment::class)->render('./error/error.html.twig',['title'=> $message , "code" => $statusCode, "name" => $message, "descr" => $message ]),$statusCode); $response->send(); } diff --git a/Sources/src/app/views/Templates/base.html.twig b/Sources/src/app/views/Templates/base.html.twig index 9556ed24..f4ef8621 100755 --- a/Sources/src/app/views/Templates/base.html.twig +++ b/Sources/src/app/views/Templates/base.html.twig @@ -60,7 +60,7 @@ Analyses
- + Amis diff --git a/Sources/src/app/views/Templates/error/error.html.twig b/Sources/src/app/views/Templates/error/error.html.twig new file mode 100644 index 00000000..4110a803 --- /dev/null +++ b/Sources/src/app/views/Templates/error/error.html.twig @@ -0,0 +1,7 @@ +{% extends "errorbase.html.twig" %} + +{% block title %}{{code}} : {{title}}{% endblock %} + + +{% block nb %}{{ responce }}
- {% endif %} @@ -64,4 +60,5 @@ ++ | Nom | +Prénom | ++ + | +
---|---|---|---|
+ ![]() |
+ {{utili.nom}} | +{{utili.prenom}} | ++ + + | +