Merge branch 'merged' of codefirst.iut.uca.fr:HeartDev/Web into merged
continuous-integration/drone/push Build is failing Details

master
Antoine PEREDERII 1 year ago
commit a374a77ca0

@ -4,7 +4,7 @@ use Dotenv\Dotenv;
$dotenv = Dotenv::createImmutable(__DIR__); $dotenv = Dotenv::createImmutable(__DIR__);
$dotenv->load(); $dotenv->load();
use Dotenv\Dotenv;
use Shared\Log; use Shared\Log;
$dotenv = Dotenv::createUnsafeImmutable(__DIR__,'.env'); $dotenv = Dotenv::createUnsafeImmutable(__DIR__,'.env');
@ -20,6 +20,6 @@ const DB_HOST = 'localhost';
const DB_DATABASE = 'heartTrack'; const DB_DATABASE = 'heartTrack';
const DB_USER = 'toto'; const DB_USER = 'toto';
const DB_PASSWORD = 'achanger'; const DB_PASSWORD = 'achanger';
const APP_ENV = 'console'; //const APP_ENV = 'console';
const DSN = "mysql:host=" . DB_HOST . ";dbname=" . DB_DATABASE; const DSN = "mysql:host=" . DB_HOST . ";dbname=" . DB_DATABASE;

@ -1,62 +1,63 @@
<?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;
// class AthleteController extends BaseController class AthleteController 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 = [];
// $utiliArray = [ // FILTER
// [ $utiliArray = [
// 'nom' => 'John', [
// 'prenom' => 'Doe', 'nom' => 'John',
// 'img' => 'john_doe', 'prenom' => 'Doe',
// 'username' => 'johndoe', 'img' => 'john_doe',
// ], 'username' => 'johndoe',
// [ ],
// 'nom' => 'Alice', [
// 'prenom' => 'Smith', 'nom' => 'Alice',
// 'img' => 'alice_smith', 'prenom' => 'Smith',
// 'username' => 'alicesmith', 'img' => 'alice_smith',
// ], 'username' => 'alicesmith',
// ]; ],
// // if(!Validation::val_string($name)){ ];
// try { // if(!Validation::val_string($name)){
// //code... try {
// // $model->userMgr->getUser($name); //code...
// return $this->render('./page/addfriend.html.twig',[ $model->userMgr->addFriend($username);
// 'css' => $this->preference->getCookie(), return $this->render('./page/addfriend.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' => $utiliArray, 'mails' => [],
// 'infoUser' => [], 'users' => $utiliArray,
// 'exos' => [], 'infoUser' => [],
// 'member' => [], 'exos' => [],
// 'responce' => "Notification d'ajout envoyée à $username" 'member' => [],
// ]); 'responce' => "Notification d'ajout envoyée à $username"
// } catch (\Throwable $th) { ]);
// //throw $th; } catch (\Throwable $th) {
// // return $this->render("addfriend.html.twig", ['tabError' => $taberror ]); //throw $th;
// } // return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
// // } }
// }
// }
}
}
// #[Route(path: '/analyses', name: 'analyses', methods: ['GET'])] // #[Route(path: '/analyses', name: 'analyses', methods: ['GET'])]
// public function analyses(): Response // public function analyses(): Response
// { // {

@ -120,50 +120,50 @@ 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
@ -713,6 +713,3 @@ class Controller extends BaseController
} }
} }

Loading…
Cancel
Save