Il reste le AuthController, et le Athlete
continuous-integration/drone/push Build is failing Details

issue_031_Controlers
Antoine PINAGOT 1 year ago
parent 637c522959
commit 35cb501e47

@ -13,51 +13,60 @@
// class AthleteController extends BaseController // class AthleteController extends BaseController
// { // {
// #[Route(path: '/search-user', name: 'search-user', methods: ['GET'])] // private Environment $twig;
// public function searchUser(string $username, IRequest $req): Response // private Preferences $preference;
// {
// $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 ]);
// }
// // }
// public function __construct()
// {
// 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 // public function analyses(): Response
// { // {
// return $this->render('./page/analyze.html.twig',[ // 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 // public function exercice(): Response
// { // {
// return $this->render('./page/exercice.html.twig',[ // return $this->render('./page/exercice.html.twig',[
@ -158,7 +167,6 @@
// 'username' => 'alicesmith', // 'username' => 'alicesmith',
// ], // ],
// ]; // ];
// // $this->Auth->getUser->role->getFriends
// return $this->render('./page/addfriend.html.twig',[ // return $this->render('./page/addfriend.html.twig',[
// 'css' => $this->preference->getCookie(), // 'css' => $this->preference->getCookie(),
// 'pp' => "test2", // 'pp' => "test2",
@ -174,4 +182,76 @@
// ]); // ]);
// } // }
// #[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' => [],
// ]);
// }
// } // }
?>

@ -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() { function inscription() {
$model = new ModelVisitor(); $model = new ModelVisitor();

@ -13,8 +13,6 @@ use Data\Core\Preferences;
use Shared\Log; use Shared\Log;
#[Route(path: '/coach', name: 'coach')]
class CoachController extends BaseController 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')] // #[Route('/list-athletes', name: 'coach_list_athletes')]
// public function listAthletes(): Response // public function listAthletes(): Response
// { // {

@ -138,171 +138,171 @@ class Controller extends BaseController
]); ]);
} }
#[Route(path: '/search-user', name: 'search-user', methods: ['GET'])] // #[Route(path: '/search-user', name: 'search-user', methods: ['GET'])]
public function searchUser(string $username, IRequest $req): Response // public function searchUser(string $username, IRequest $req): Response
{ // {
$taberror = []; // $taberror = [];
// FILTER // // FILTER
$utiliArray = [ // $utiliArray = [
[ // [
'nom' => 'John', // 'nom' => 'John',
'prenom' => 'Doe', // 'prenom' => 'Doe',
'img' => 'john_doe', // 'img' => 'john_doe',
'username' => 'johndoe', // 'username' => 'johndoe',
], // ],
[ // [
'nom' => 'Alice', // 'nom' => 'Alice',
'prenom' => 'Smith', // 'prenom' => 'Smith',
'img' => 'alice_smith', // 'img' => 'alice_smith',
'username' => 'alicesmith', // 'username' => 'alicesmith',
], // ],
]; // ];
// if(!Validation::val_string($name)){ // // if(!Validation::val_string($name)){
try { // try {
//code... // //code...
// $model->userMgr->addFriend($name); // // $model->userMgr->addFriend($name);
return $this->render('./page/addfriend.html.twig',[ // return $this->render('./page/addfriend.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' => $utiliArray, // 'users' => $utiliArray,
'infoUser' => [], // 'infoUser' => [],
'exos' => [], // 'exos' => [],
'member' => [], // 'member' => [],
'responce' => "Notification d'ajout envoyée à $username" // 'responce' => "Notification d'ajout envoyée à $username"
]); // ]);
} catch (\Throwable $th) { // } catch (\Throwable $th) {
//throw $th; // //throw $th;
// return $this->render("addfriend.html.twig", ['tabError' => $taberror ]); // // return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
} // }
// } // // }
} // }
#[Route(path: '/search-member', name: 'search-member', methods: ['GET'])] // #[Route(path: '/search-member', name: 'search-member', methods: ['GET'])]
public function searchMember(string $username, IRequest $req): Response // public function searchMember(string $username, IRequest $req): Response
{ // {
$taberror = []; // $taberror = [];
// FILTER // // FILTER
$utiliArray = [ // $utiliArray = [
[ // [
'nom' => 'John', // 'nom' => 'John',
'prenom' => 'Doe', // 'prenom' => 'Doe',
'img' => 'john_doe', // 'img' => 'john_doe',
'username' => 'johndoe', // 'username' => 'johndoe',
], // ],
[ // [
'nom' => 'Alice', // 'nom' => 'Alice',
'prenom' => 'Smith', // 'prenom' => 'Smith',
'img' => 'alice_smith', // 'img' => 'alice_smith',
'username' => 'alicesmith', // 'username' => 'alicesmith',
], // ],
]; // ];
// if(!Validation::val_string($name)){ // // if(!Validation::val_string($name)){
try { // try {
//code... // //code...
// $model->userMgr->addFriend($name); // // $model->userMgr->addFriend($name);
return $this->render('./page/addmember.html.twig',[ // return $this->render('./page/addmember.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' => $utiliArray, // 'users' => $utiliArray,
'infoUser' => [], // 'infoUser' => [],
'exos' => [], // 'exos' => [],
'member' => [], // 'member' => [],
'responce' => "Notification d'ajout envoyée à $username" // 'responce' => "Notification d'ajout envoyée à $username"
]); // ]);
} catch (\Throwable $th) { // } catch (\Throwable $th) {
//throw $th; // //throw $th;
// return $this->render("addfriend.html.twig", ['tabError' => $taberror ]); // // return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
} // }
// } // // }
} // }
#[Route(path: '/add-member', name: 'add-member', methods: ['POST'])] // #[Route(path: '/add-member', name: 'add-member', methods: ['POST'])]
public function addmember(string $username, IRequest $req): Response // public function addmember(string $username, IRequest $req): Response
{ // {
$taberror = []; // $taberror = [];
$utiliArray = [ // $utiliArray = [
[ // [
'nom' => 'John', // 'nom' => 'John',
'prenom' => 'Doe', // 'prenom' => 'Doe',
'img' => 'john_doe', // 'img' => 'john_doe',
'username' => 'johndoe', // 'username' => 'johndoe',
], // ],
[ // [
'nom' => 'Alice', // 'nom' => 'Alice',
'prenom' => 'Smith', // 'prenom' => 'Smith',
'img' => 'alice_smith', // 'img' => 'alice_smith',
'username' => 'alicesmith', // 'username' => 'alicesmith',
], // ],
]; // ];
// if(!Validation::val_string($name)){ // // if(!Validation::val_string($name)){
try { // try {
//code... // //code...
// $model->userMgr->addFriend($name); // // $model->userMgr->addFriend($name);
return $this->render('./page/addmember.html.twig',[ // return $this->render('./page/addmember.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' => $utiliArray, // 'users' => $utiliArray,
'infoUser' => [], // 'infoUser' => [],
'exos' => [], // 'exos' => [],
'member' => [], // 'member' => [],
'responce' => "Notification d'ajout envoyée à $username" // 'responce' => "Notification d'ajout envoyée à $username"
]); // ]);
} catch (\Throwable $th) { // } catch (\Throwable $th) {
//throw $th; // //throw $th;
// return $this->render("addfriend.html.twig", ['tabError' => $taberror ]); // // return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
} // }
// } // // }
} // }
#[Route(path: '/member', name: 'member', methods: ['GET'])] // #[Route(path: '/member', name: 'member', methods: ['GET'])]
public function member(): Response // public function member(): Response
{ // {
$utiliArray = [ // $utiliArray = [
[ // [
'nom' => 'John', // 'nom' => 'John',
'prenom' => 'Doe', // 'prenom' => 'Doe',
'img' => 'john_doe', // 'img' => 'john_doe',
'username' => 'johndoe', // 'username' => 'johndoe',
], // ],
[ // [
'nom' => 'Alice', // 'nom' => 'Alice',
'prenom' => 'Smith', // 'prenom' => 'Smith',
'img' => 'alice_smith', // 'img' => 'alice_smith',
'username' => 'alicesmith', // 'username' => 'alicesmith',
], // ],
]; // ];
return $this->render('./page/addmember.html.twig',[ // return $this->render('./page/addmember.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' => $utiliArray, // 'users' => $utiliArray,
'infoUser' => [], // 'infoUser' => [],
'exos' => [], // 'exos' => [],
'member' => [], // 'member' => [],
]); // ]);
} // }
#[Route(path: '/add-friend', name: 'add-friend', methods: ['POST'])] #[Route(path: '/add-friend', name: 'add-friend', methods: ['POST'])]
public function addFriend(string $username, IRequest $req): Response public function addFriend(string $username, IRequest $req): Response
@ -668,47 +668,47 @@ class Controller extends BaseController
]); ]);
} }
// #[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'])] #[Route(path: '/password', name: 'password', methods: ['POST'])]
// public function password(string $email, IRequest $req): Response public function password(string $email, IRequest $req): Response
// { {
// // CONFIRMER LES DONNESS !!!!! IMPORTANT // CONFIRMER LES DONNESS !!!!! IMPORTANT
// return $this->render('./page/login.html.twig',[ return $this->render('./page/login.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' => []
// ]); ]);
// } }
} }

Loading…
Cancel
Save