update somes bugs

WORK_merged_APE
Antoine PEREDERII 1 year ago
parent 881cb5de37
commit ceb993528e

@ -1,422 +1,422 @@
<?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;
//
// TODO : Remove this BaseClass //// TODO : Remove this BaseClass
class Controller extends BaseController //class Controller extends BaseController
{ //{
//
#[Route(path: '/activity', name: 'activity', methods: ['GET'])] // #[Route(path: '/activity', name: 'activity', methods: ['GET'])]
public function activity(): Response // public function activity(): Response
{ // {
return $this->render('./page/activity.html.twig',[ // return $this->render('./page/activity.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: '/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',
'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: '/exercices', name: 'exercices', methods: ['POST'])] // 8
#[Route(path: '/search-member', name: 'search-member', methods: ['GET'])] // public function exercices(String $type, String $intensite, String $date, IRequest $req): Response
public function searchMember(string $username, IRequest $req): Response // {
{ // $exercicesArray = [
$taberror = []; // [
// FILTER // 'date' => $date,
$utiliArray = [ // 'type' => $type,
[ // 'intensite' => $intensite,
'nom' => 'John', // 'status' => 'A venur',
'prenom' => 'Doe', // ]
'img' => 'john_doe', // ];
'username' => 'johndoe', // return $this->render('./page/exercice.html.twig',[
], // 'css' => $this->preference->getCookie(),
[ // 'pp' => "test2",
'nom' => 'Alice', // 'user' => "Doe",
'prenom' => 'Smith', // 'role' => "Athlète",
'img' => 'alice_smith', // 'friendship' => [],
'username' => 'alicesmith', // 'analyzes' => [],
], // 'mails' => [],
]; // 'users' => [],
// if(!Validation::val_string($name)){ // 'infoUser' => [],
try { // 'exos' => $exercicesArray,
//code... // 'member' => []
// $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-user', name: 'search-user', methods: ['GET'])]
// public function searchUser(string $username, IRequest $req): Response
#[Route(path: '/add-member', name: 'add-member', methods: ['POST'])] // {
public function addmember(string $username, IRequest $req): Response // $taberror = [];
{ // // FILTER
$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/addfriend.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'])] //
public function member(): Response // #[Route(path: '/search-member', name: 'search-member', methods: ['GET'])]
{ // public function searchMember(string $username, IRequest $req): Response
$utiliArray = [ // {
[ // $taberror = [];
'nom' => 'John', // // FILTER
'prenom' => 'Doe', // $utiliArray = [
'img' => 'john_doe', // [
'username' => 'johndoe', // 'nom' => 'John',
], // 'prenom' => 'Doe',
[ // 'img' => 'john_doe',
'nom' => 'Alice', // 'username' => 'johndoe',
'prenom' => 'Smith', // ],
'img' => 'alice_smith', // [
'username' => 'alicesmith', // 'nom' => 'Alice',
], // 'prenom' => 'Smith',
]; // 'img' => 'alice_smith',
return $this->render('./page/addmember.html.twig',[ // 'username' => 'alicesmith',
'css' => $this->preference->getCookie(), // ],
'pp' => "test2", // ];
'user' => "Doe", // // if(!Validation::val_string($name)){
'role' => "Athlète", // try {
'friendship' => [], // //code...
'analyzes' => [], // // $model->userMgr->addFriend($name);
'mails' => [], // return $this->render('./page/addmember.html.twig',[
'users' => $utiliArray, // 'css' => $this->preference->getCookie(),
'infoUser' => [], // 'pp' => "test2",
'exos' => [], // 'user' => "Doe",
'member' => [], // 'role' => "Athlète",
]); // 'friendship' => [],
} // 'analyzes' => [],
// 'mails' => [],
// 'users' => $utiliArray,
#[Route(path: '/friendlist', name: 'friendlist', methods: ['POST'])] // 'infoUser' => [],
public function friendlist(string $username, IRequest $req): Response // 'exos' => [],
{ // 'member' => [],
$utiliArray = [ // 'responce' => "Notification d'ajout envoyée à $username"
[ // ]);
'nom' => 'John', // } catch (\Throwable $th) {
'prenom' => 'Doe', // //throw $th;
'img' => 'john_doe', // // return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
'username' => 'johndoe', // }
], // // }
[ //
'nom' => 'Alice', // }
'prenom' => 'Smith', //
'img' => 'alice_smith', // #[Route(path: '/add-member', name: 'add-member', methods: ['POST'])]
'username' => 'alicesmith', // public function addmember(string $username, IRequest $req): Response
], // {
]; // $taberror = [];
/* TODO */ // $utiliArray = [
// [
// -> Enlever ou bloquer un utilisateur en fonction de son username // 'nom' => 'John',
// 'prenom' => 'Doe',
return $this->render('./page/friend.html.twig',[ // 'img' => 'john_doe',
'css' => $this->preference->getCookie(), // 'username' => 'johndoe',
'pp' => "test2", // ],
'user' => "Doe", // [
'role' => "Athlète", // 'nom' => 'Alice',
'friendship' => $utiliArray, // 'prenom' => 'Smith',
'analyzes' => [], // 'img' => 'alice_smith',
'mails' => [], // 'username' => 'alicesmith',
'users' => [], // ],
'infoUser' => [], // ];
'exos' => [], // // if(!Validation::val_string($name)){
'member' => [], // try {
]); // //code...
} // // $model->userMgr->addFriend($name);
// return $this->render('./page/addmember.html.twig',[
#[Route(path: '/friendlist', name: 'friendlist2', methods: ['GET'])] // 'css' => $this->preference->getCookie(),
public function friendlist2(): Response // 'pp' => "test2",
{ // 'user' => "Doe",
$utiliArray = [ // 'role' => "Athlète",
[ // 'friendship' => [],
'nom' => 'John', // 'analyzes' => [],
'prenom' => 'Doe', // 'mails' => [],
'img' => 'test', // 'users' => $utiliArray,
'status' => 'johndoe', // 'infoUser' => [],
'username' => 'jdoe', // 'exos' => [],
], // 'member' => [],
[ // 'responce' => "Notification d'ajout envoyée à $username"
'nom' => 'Alice', // ]);
'prenom' => 'Smith', // } catch (\Throwable $th) {
'img' => 'test2', // //throw $th;
'status' => 'alicesmith', // // return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
'username' => 'asmith', // }
], // // }
]; //
return $this->render('./page/friend.html.twig',[ // }
'css' => $this->preference->getCookie(), //
'pp' => "test2", // #[Route(path: '/member', name: 'member', methods: ['GET'])]
'user' => "Doe", // public function member(): Response
'role' => "Athlète", // {
'friendship' => $utiliArray, // $utiliArray = [
'analyzes' => [], // [
'mails' => [], // 'nom' => 'John',
'users' => [], // 'prenom' => 'Doe',
'infoUser' => [], // 'img' => 'john_doe',
'exos' => [], // 'username' => 'johndoe',
'member' => [], // ],
]); // [
} // 'nom' => 'Alice',
// 'prenom' => 'Smith',
#[Route(path: '/coaching', name: 'coaching', methods: ['GET'])] // 'img' => 'alice_smith',
public function coaching(): Response // 'username' => 'alicesmith',
{ // ],
return $this->render('./page/coaching.html.twig',[ // ];
'css' => $this->preference->getCookie(), // return $this->render('./page/addmember.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' => $utiliArray,
'exos' => [], // 'infoUser' => [],
'member' => [] // 'exos' => [],
]); // 'member' => [],
} // ]);
// }
#[Route(path: '/mail', name: 'mail', methods: ['GET'])] //
public function mail(): Response //
{ // #[Route(path: '/friendlist', name: 'friendlist', methods: ['POST'])]
return $this->render('./page/mail.html.twig',[ // public function friendlist(string $username, IRequest $req): Response
'css' => $this->preference->getCookie(), // {
'pp' => "test2", // $utiliArray = [
'user' => "Doe", // [
'role' => "Athlète", // 'nom' => 'John',
'friendship' => [], // 'prenom' => 'Doe',
'analyzes' => [], // 'img' => 'john_doe',
'mails' => [], // 'username' => 'johndoe',
'users' => [], // ],
'infoUser' => [], // [
'exos' => [], // 'nom' => 'Alice',
'member' => [] // 'prenom' => 'Smith',
]); // 'img' => 'alice_smith',
} // 'username' => 'alicesmith',
// ],
// ];
#[Route(path: '/profile', name: 'profile', methods: ['GET'])] // /* TODO */
public function profile(): Response //
{ // // -> Enlever ou bloquer un utilisateur en fonction de son username
return $this->render('./page/profile.html.twig',[ //
'css' => $this->preference->getCookie(), // return $this->render('./page/friend.html.twig',[
'pp' => "test2", // 'css' => $this->preference->getCookie(),
'user' => "Doe", // 'pp' => "test2",
'role' => "Athlète", // 'user' => "Doe",
'friendship' => [], // 'role' => "Athlète",
'analyzes' => [], // 'friendship' => $utiliArray,
'mails' => [], // 'analyzes' => [],
'users' => [], // 'mails' => [],
'infoUser' => [], // 'users' => [],
'exos' => [], // 'infoUser' => [],
'member' => [] // 'exos' => [],
]); // 'member' => [],
} // ]);
// }
//
#[Route(path: '/psettings', name: 'psettings', methods: ['POST'])] // #[Route(path: '/friendlist', name: 'friendlist2', methods: ['GET'])]
public function psettings(string $nom,string $prenom,string $dateNaissance,string $mail,string $tel, IRequest $req): Response // public function friendlist2(): Response
{ // {
// $utiliArray = [
// [
return $this->render('./page/settings.html.twig',[ // 'nom' => 'John',
'css' => $this->preference->getCookie(), // 'prenom' => 'Doe',
'pp' => "test2", // 'img' => 'test',
'user' => $prenom, // 'status' => 'johndoe',
'role' => "Athlète", // 'username' => 'jdoe',
'friendship' => [], // ],
'analyzes' => [], // [
'mails' => [], // 'nom' => 'Alice',
'users' => [], // 'prenom' => 'Smith',
'infoUser' => [], // 'img' => 'test2',
'exos' => [], // 'status' => 'alicesmith',
'member' => [] // 'username' => 'asmith',
]); // ],
} // ];
// return $this->render('./page/friend.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
#[Route(path: '/pass', name: 'pass', methods: ['GET'])] // 'role' => "Athlète",
public function pass(): Response // 'friendship' => $utiliArray,
{ // 'analyzes' => [],
// 'mails' => [],
// CONFIRMER LES DONNESS !!!!! IMPORTANT // 'users' => [],
// 'infoUser' => [],
return $this->render('./page/password.html.twig',[ // 'exos' => [],
'css' => $this->preference->getCookie(), // 'member' => [],
'pp' => "test2", // ]);
'user' => "Doe", // }
'role' => "Athlète", //
'friendship' => [], // #[Route(path: '/coaching', name: 'coaching', methods: ['GET'])]
'analyzes' => [], // public function coaching(): Response
'mails' => [], // {
'users' => [], // return $this->render('./page/coaching.html.twig',[
'infoUser' => [], // 'css' => $this->preference->getCookie(),
'exos' => [], // 'pp' => "test2",
'member' => [] // 'user' => "Doe",
]); // 'role' => "Athlète",
} // 'friendship' => [],
// 'analyzes' => [],
#[Route(path: '/password', name: 'password', methods: ['POST'])] // 'mails' => [],
public function password(string $email, IRequest $req): Response // 'users' => [],
{ // 'infoUser' => [],
// 'exos' => [],
// CONFIRMER LES DONNESS !!!!! IMPORTANT // 'member' => []
// ]);
return $this->render('./page/login.html.twig',[ // }
'css' => $this->preference->getCookie(), //
'pp' => "test2", // #[Route(path: '/mail', name: 'mail', methods: ['GET'])]
'user' => "Doe", // public function mail(): Response
'role' => "Athlète", // {
'friendship' => [], // return $this->render('./page/mail.html.twig',[
'analyzes' => [], // 'css' => $this->preference->getCookie(),
'mails' => [], // 'pp' => "test2",
'users' => [], // 'user' => "Doe",
'infoUser' => [], // 'role' => "Athlète",
'exos' => [], // 'friendship' => [],
'member' => [] // '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: '/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: '/pass', name: 'pass', methods: ['GET'])]
// public function pass(): Response
// {
//
// // 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' => []
// ]);
// }
//
// #[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',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
//
//}
//
//

@ -87,25 +87,25 @@ class UserController extends BaseController
]); ]);
} }
#[Route(path: '/logout', name: 'logout', methods: ['GET'])] // #[Route(path: '/logout', name: 'logout', methods: ['GET'])]
public function logout(IRequest $request): IResponse // public function logout(IRequest $request): IResponse
{ // {
$error = []; // $error = [];
//
try { // try {
//
if($this->userMgr->deconnecter()){ // if($this->userMgr->deconnecter()){
return new RedirectResponse('/'); // return new RedirectResponse('/');
} // }
else{ // else{
$error [] = "Erreur de deconnexion. Essayez encore"; // $error [] = "Erreur de deconnexion. Essayez encore";
return new RedirectResponse('/'); // return new RedirectResponse('/');
} // }
//
} catch (\Throwable $th) { // } catch (\Throwable $th) {
$error [] =$th->getMessage(); // $error [] =$th->getMessage();
return new RedirectResponse('/'); // return new RedirectResponse('/');
} // }
} // }
} }

@ -79,13 +79,13 @@ class UserRepository implements IUserRepository {
return false; return false;
} }
public function addFriend(int $user1, int $user2) public function addFriend(User $user1, User $user2)
{ {
return true; return true;
} }
public function deleteFriend(int $user1, int $user2) public function deleteFriend(User $user1, User $user2)
{ {
return true; return true;
} }

Loading…
Cancel
Save