diff --git a/Sources/src/app/controller/AthleteController.php b/Sources/src/app/controller/AthleteController.php index 54d49e87..230804f2 100644 --- a/Sources/src/app/controller/AthleteController.php +++ b/Sources/src/app/controller/AthleteController.php @@ -12,52 +12,61 @@ // class AthleteController extends BaseController // { - -// #[Route(path: '/search-user', name: 'search-user', methods: ['GET'])] -// public function searchUser(string $username, IRequest $req): Response + +// private Environment $twig; +// private Preferences $preference; + +// public function __construct() // { -// $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->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 ]); -// } -// // } - +// session_start(); +// $this->preference = new Preferences(); // } -// #[Route(path: '/analyses', name: 'analyses', methods: ['GET'])] + // #[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->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',[ @@ -76,7 +85,7 @@ // } -// #[Route(path: '/exercice', name: 'exercice', methods: ['GET'])] // 8 +// #[Route(path: '/exercice', name: 'exercice', methods: ['GET'])] // 8 // public function exercice(): Response // { // return $this->render('./page/exercice.html.twig',[ @@ -158,7 +167,6 @@ // 'username' => 'alicesmith', // ], // ]; -// // $this->Auth->getUser->role->getFriends // return $this->render('./page/addfriend.html.twig',[ // 'css' => $this->preference->getCookie(), // 'pp' => "test2", @@ -173,5 +181,77 @@ // 'member' => [], // ]); // } + +// #[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' => [], +// ]); +// } -// } \ No newline at end of file +// } + +?> \ No newline at end of file diff --git a/Sources/src/app/controller/AuthController.php b/Sources/src/app/controller/AuthController.php index 6a88b292..c64cb6dd 100644 --- a/Sources/src/app/controller/AuthController.php +++ b/Sources/src/app/controller/AuthController.php @@ -54,6 +54,28 @@ class AuthController extends BaseController // ]); // } + #[Route(path: '/register', name: 'register', methods: ['POST'])] + public function register(string $username,string $mdp,string $confirmMdp,string $nom,string $prenom,string $dateNaissance,string $sexe,string $taille,string $poids, IRequest $req): Response + { + + // CONFIRMER LES DONNESS !!!!! IMPORTANT + + return $this->render('./page/home.html.twig',[ + 'css' => $this->preference->getCookie() + ]); + } + + #[Route(path: '/regist', name: 'regist', methods: ['GET'])] + public function register2(): Response + { + + // CONFIRMER LES DONNESS !!!!! IMPORTANT + + return $this->render('./page/register.html.twig',[ + 'css' => $this->preference->getCookie() + ]); + } + function inscription() { $model = new ModelVisitor(); diff --git a/Sources/src/app/controller/CoachController.php b/Sources/src/app/controller/CoachController.php index a7614f96..ed89bd8a 100644 --- a/Sources/src/app/controller/CoachController.php +++ b/Sources/src/app/controller/CoachController.php @@ -13,8 +13,6 @@ use Data\Core\Preferences; use Shared\Log; - -#[Route(path: '/coach', name: 'coach')] class CoachController extends BaseController { @@ -57,6 +55,127 @@ class CoachController 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('/list-athletes', name: 'coach_list_athletes')] // public function listAthletes(): Response // { diff --git a/Sources/src/app/controller/Controller.php b/Sources/src/app/controller/Controller.php index 18cae60e..6743f374 100644 --- a/Sources/src/app/controller/Controller.php +++ b/Sources/src/app/controller/Controller.php @@ -138,171 +138,171 @@ class Controller extends BaseController ]); } - #[Route(path: '/search-user', name: 'search-user', methods: ['GET'])] - public function searchUser(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/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: '/search-user', name: 'search-user', methods: ['GET'])] + // public function searchUser(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/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: '/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: '/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: '/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: '/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 @@ -668,47 +668,47 @@ class Controller extends BaseController ]); } - // #[Route(path: '/pass', name: 'pass', methods: ['GET'])] - // public function pass(): Response - // { + #[Route(path: '/pass', name: 'pass', methods: ['GET'])] + public function pass(): Response + { - // // CONFIRMER LES DONNESS !!!!! IMPORTANT + // CONFIRMER LES DONNESS !!!!! IMPORTANT - // return $this->render('./page/password.html.twig',[ - // 'css' => $this->preference->getCookie(), - // 'pp' => "test2", - // 'user' => "Doe", - // 'role' => "Athlète", - // 'friendship' => [], - // 'analyzes' => [], - // 'mails' => [], - // 'users' => [], - // 'infoUser' => [], - // 'exos' => [], - // 'member' => [] - // ]); - // } + return $this->render('./page/password.html.twig',[ + 'css' => $this->preference->getCookie(), + 'pp' => "test2", + 'user' => "Doe", + 'role' => "Athlète", + 'friendship' => [], + 'analyzes' => [], + 'mails' => [], + 'users' => [], + 'infoUser' => [], + 'exos' => [], + 'member' => [] + ]); + } - // #[Route(path: '/password', name: 'password', methods: ['POST'])] - // public function password(string $email, IRequest $req): Response - // { + #[Route(path: '/password', name: 'password', methods: ['POST'])] + public function password(string $email, IRequest $req): Response + { - // // CONFIRMER LES DONNESS !!!!! IMPORTANT + // CONFIRMER LES DONNESS !!!!! IMPORTANT - // return $this->render('./page/login.html.twig',[ - // 'css' => $this->preference->getCookie(), - // 'pp' => "test2", - // 'user' => "Doe", - // 'role' => "Athlète", - // 'friendship' => [], - // 'analyzes' => [], - // 'mails' => [], - // 'users' => [], - // 'infoUser' => [], - // 'exos' => [], - // 'member' => [] - // ]); - // } + return $this->render('./page/login.html.twig',[ + 'css' => $this->preference->getCookie(), + 'pp' => "test2", + 'user' => "Doe", + 'role' => "Athlète", + 'friendship' => [], + 'analyzes' => [], + 'mails' => [], + 'users' => [], + 'infoUser' => [], + 'exos' => [], + 'member' => [] + ]); + } }