Finition de link route/controller
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
parent
35cb501e47
commit
c201ee9bff
@ -1,257 +1,300 @@
|
||||
<?php
|
||||
|
||||
// namespace App\Controller;
|
||||
namespace App\Controller;
|
||||
|
||||
// use App\Container;
|
||||
// use App\Router\Request\IRequest;
|
||||
// use App\Router\Response\Response;
|
||||
// use Shared\Attributes\Route;
|
||||
// use Twig\Environment;
|
||||
// use Data\Core\Preferences;
|
||||
// use Shared\Log;
|
||||
use App\Container;
|
||||
use App\Router\Request\IRequest;
|
||||
use App\Router\Response\Response;
|
||||
use Shared\Attributes\Route;
|
||||
use Twig\Environment;
|
||||
use Data\Core\Preferences;
|
||||
use Shared\Log;
|
||||
|
||||
// class AthleteController extends BaseController
|
||||
// {
|
||||
class AthleteController extends BaseController
|
||||
{
|
||||
|
||||
// private Environment $twig;
|
||||
// private Preferences $preference;
|
||||
private Environment $twig;
|
||||
private Preferences $preference;
|
||||
|
||||
// public function __construct()
|
||||
// {
|
||||
// session_start();
|
||||
// $this->preference = new Preferences();
|
||||
// }
|
||||
public function __construct()
|
||||
{
|
||||
session_start();
|
||||
$this->preference = new Preferences();
|
||||
}
|
||||
|
||||
// #[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: '/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',[
|
||||
'css' => $this->preference->getCookie(),
|
||||
'pp' => "test2",
|
||||
'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' => [],
|
||||
// 'mails' => [],
|
||||
// 'users' => [],
|
||||
// 'infoUser' => [],
|
||||
// 'exos' => [],
|
||||
// 'member' => []
|
||||
// ]);
|
||||
// }
|
||||
#[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
|
||||
// {
|
||||
// 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: '/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: '/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: '/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',
|
||||
],
|
||||
];
|
||||
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' => [],
|
||||
]);
|
||||
}
|
||||
|
||||
// #[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',
|
||||
// ],
|
||||
// ];
|
||||
// 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' => [],
|
||||
// ]);
|
||||
// }
|
||||
#[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 */
|
||||
|
||||
// #[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
|
||||
|
||||
// // -> 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' => [],
|
||||
]);
|
||||
}
|
||||
|
||||
// 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: '/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: '/delete-friend', name: 'delete-friend', methods: ['POST'])]
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in new issue