|
|
|
@ -1,62 +1,63 @@
|
|
|
|
|
<?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
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// #[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 = [];
|
|
|
|
|
// 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($username);
|
|
|
|
|
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
|
|
|
|
|
// {
|
|
|
|
|