|
|
@ -1,31 +1,31 @@
|
|
|
|
<?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 App\Router\Response\IResponse;
|
|
|
|
use App\Router\Response\IResponse;
|
|
|
|
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// #[Route(path: '/coach', name: 'coach')]
|
|
|
|
#[Route(path: '/coach', name: 'coach')]
|
|
|
|
// class CoachController extends BaseController
|
|
|
|
class CoachController extends BaseController
|
|
|
|
// {
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
// private ICoachManager $coachManager;
|
|
|
|
private ICoachManager $coachManager;
|
|
|
|
// private $security;
|
|
|
|
private $security;
|
|
|
|
|
|
|
|
|
|
|
|
// public function __construct(DataManager $dataManager, Security $security)
|
|
|
|
public function __construct(DataManager $dataManager, Security $security)
|
|
|
|
// {
|
|
|
|
{
|
|
|
|
// $this->coachManager = $dataManager->coachMgr;
|
|
|
|
$this->coachManager = $dataManager->coachMgr;
|
|
|
|
// $this->security = $security;
|
|
|
|
$this->security = $security;
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// #[Route(path: '/', name: 'home', methods: ['GET'])]
|
|
|
|
// #[Route(path: '/', name: 'home', methods: ['GET'])]
|
|
|
|
// public function index(): Response
|
|
|
|
// public function index(): Response
|
|
|
@ -44,7 +44,7 @@
|
|
|
|
// 'member' => []
|
|
|
|
// 'member' => []
|
|
|
|
// ]);
|
|
|
|
// ]);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
// #[Route('/global-stats', name: 'coach_global_stats', methods: ['GET'])]
|
|
|
|
// #[Route('/global-stats', name: 'coach_global_stats', methods: ['GET'])]
|
|
|
|
// public function globalStats(): Response
|
|
|
|
// public function globalStats(): Response
|
|
|
|
// {
|
|
|
|
// {
|
|
|
@ -52,10 +52,194 @@
|
|
|
|
// return $this->render('coach/global_stats.html.twig');
|
|
|
|
// return $this->render('coach/global_stats.html.twig');
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// #[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',[
|
|
|
|
|
|
|
|
'css' => $this->preference->getCookie(),
|
|
|
|
|
|
|
|
'pp' => "test2",
|
|
|
|
|
|
|
|
'user' => "Doe",
|
|
|
|
|
|
|
|
'role' => "Athlète",
|
|
|
|
|
|
|
|
'friendship' => [],
|
|
|
|
|
|
|
|
'analyzes' => [],
|
|
|
|
|
|
|
|
'mails' => [],
|
|
|
|
|
|
|
|
'users' => [],
|
|
|
|
|
|
|
|
'infoUser' => [],
|
|
|
|
|
|
|
|
'exos' => [],
|
|
|
|
|
|
|
|
'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-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: '/coaching', name: 'coaching', methods: ['GET'])]
|
|
|
|
|
|
|
|
public function coaching(): Response
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return $this->render('./page/coaching.html.twig',[
|
|
|
|
|
|
|
|
'css' => $this->preference->getCookie(),
|
|
|
|
|
|
|
|
'pp' => "test2",
|
|
|
|
|
|
|
|
'user' => "Doe",
|
|
|
|
|
|
|
|
'role' => "Athlète",
|
|
|
|
|
|
|
|
'friendship' => [],
|
|
|
|
|
|
|
|
'analyzes' => [],
|
|
|
|
|
|
|
|
'mails' => [],
|
|
|
|
|
|
|
|
'users' => [],
|
|
|
|
|
|
|
|
'infoUser' => [],
|
|
|
|
|
|
|
|
'exos' => [],
|
|
|
|
|
|
|
|
'member' => []
|
|
|
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// #[Route(path: '/coaching', name: 'coaching', methods: ['GET'])]
|
|
|
|
|
|
|
|
// public function coaching(): Response
|
|
|
|
// {
|
|
|
|
// {
|
|
|
|
// return $this->render('./page/exercice.html.twig',[
|
|
|
|
// return $this->render('./page/coaching.html.twig',[
|
|
|
|
// 'css' => $this->preference->getCookie(),
|
|
|
|
// 'css' => $this->preference->getCookie(),
|
|
|
|
// 'pp' => "test2",
|
|
|
|
// 'pp' => "test2",
|
|
|
|
// 'user' => "Doe",
|
|
|
|
// 'user' => "Doe",
|
|
|
@ -69,32 +253,13 @@
|
|
|
|
// 'member' => []
|
|
|
|
// 'member' => []
|
|
|
|
// ]);
|
|
|
|
// ]);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
// #[Route(path: '/coaching', name: 'coaching', methods: ['GET'])]
|
|
|
|
|
|
|
|
// public function coaching(): Response
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// return $this->render('./page/coaching.html.twig',[
|
|
|
|
|
|
|
|
// 'css' => $this->preference->getCookie(),
|
|
|
|
|
|
|
|
// 'pp' => "test2",
|
|
|
|
|
|
|
|
// 'user' => "Doe",
|
|
|
|
|
|
|
|
// 'role' => "Athlète",
|
|
|
|
|
|
|
|
// 'friendship' => [],
|
|
|
|
|
|
|
|
// 'analyzes' => [],
|
|
|
|
|
|
|
|
// 'mails' => [],
|
|
|
|
|
|
|
|
// 'users' => [],
|
|
|
|
|
|
|
|
// '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
|
|
|
|
// {
|
|
|
|
// {
|
|
|
|
// $coach = $this->security->getUser();
|
|
|
|
// $coach = $this->security->getUser();
|
|
|
|
// $athletes = $this->coachManager->getAthletesForCoach($coach);
|
|
|
|
// $athletes = $this->coachManager->getAthletesForCoach($coach);
|
|
|
|
|
|
|
|
//
|
|
|
|
// return $this->render('coach/list_athletes.html.twig', [
|
|
|
|
// return $this->render('coach/list_athletes.html.twig', [
|
|
|
|
// 'athletes' => $athletes,
|
|
|
|
// 'athletes' => $athletes,
|
|
|
|
// ]);
|
|
|
|
// ]);
|
|
|
@ -107,22 +272,23 @@
|
|
|
|
// 'athleteId' => $athleteId,
|
|
|
|
// 'athleteId' => $athleteId,
|
|
|
|
// ]);
|
|
|
|
// ]);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
// #[Route('/add-athlete/{athleteId}', name: 'coach_add_athlete', methods: ['POST'])]
|
|
|
|
// #[Route('/add-athlete/{athleteId}', name: 'coach_add_athlete', methods: ['POST'])]
|
|
|
|
// public function addAthlete(IRequest $request, $athleteId): IResponse
|
|
|
|
// public function addAthlete(IRequest $request, $athleteId): IResponse
|
|
|
|
// {
|
|
|
|
// {
|
|
|
|
// // Implement logic to add athlete
|
|
|
|
// // Implement logic to add athlete
|
|
|
|
// // ...
|
|
|
|
// // ...
|
|
|
|
|
|
|
|
//
|
|
|
|
// return $this->redirectToRoute('coach_list_athletes');
|
|
|
|
// return $this->redirectToRoute('coach_list_athletes');
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// // #[Route('/remove-athlete', name: 'coach_remove_athlete', methods: ['POST'])]
|
|
|
|
// #[Route('/remove-athlete', name: 'coach_remove_athlete', methods: ['POST'])]
|
|
|
|
// // public function removeAthlete(int $athleteId, IRequest $request): IResponse
|
|
|
|
// public function removeAthlete(int $athleteId, IRequest $request): IResponse
|
|
|
|
// // {
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
|
|
// // return $this->redirectToRoute("/athletes");
|
|
|
|
// return $this->redirectToRoute("/athletes");
|
|
|
|
// // }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|