|
|
|
@ -3,6 +3,7 @@ namespace App\modele;
|
|
|
|
|
use App\metier\Alumni;
|
|
|
|
|
use App\metier\Evenement;
|
|
|
|
|
use App\metier\Image;
|
|
|
|
|
use App\config;
|
|
|
|
|
|
|
|
|
|
class UtilisateurModele
|
|
|
|
|
|
|
|
|
@ -58,37 +59,27 @@ class UtilisateurModele
|
|
|
|
|
|
|
|
|
|
public function getEvenement() : array
|
|
|
|
|
{
|
|
|
|
|
$dsn = "mysql:host=localhost;dbname=dbAlica";
|
|
|
|
|
$login = "test";
|
|
|
|
|
$mdp = "test";
|
|
|
|
|
|
|
|
|
|
$con = new \App\gateway\Connection($dsn, $login, $mdp);
|
|
|
|
|
global $dsn, $username, $password;
|
|
|
|
|
$con = new \App\gateway\Connection($dsn, $username, $password);
|
|
|
|
|
|
|
|
|
|
$gate = new \App\gateway\EvenementGateway($con);
|
|
|
|
|
$gateImage = new \App\gateway\ImageGateway($con);
|
|
|
|
|
|
|
|
|
|
$data = $gate->getAllEvenement();
|
|
|
|
|
|
|
|
|
|
// $gateAlumni = new \App\gateway\AlumniGateway($con);
|
|
|
|
|
// $dataAlumni = $gateAlumni->findById($data[0]['organisateur']);
|
|
|
|
|
|
|
|
|
|
$gateImage = new \App\gateway\ImageGateway($con);
|
|
|
|
|
$image = $gateImage->obtenirParId($data[0]['image']);
|
|
|
|
|
|
|
|
|
|
// $organisateur = new \App\metier\Alumni(
|
|
|
|
|
// $dataAlumni[0]['id'],
|
|
|
|
|
// $dataAlumni[0]['mail'],
|
|
|
|
|
// $dataAlumni[0]['mdp'],
|
|
|
|
|
// $dataAlumni[0]['role']
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
|
|
$img = new \App\metier\Image(
|
|
|
|
|
$image[0]['id'],
|
|
|
|
|
$image[0]['nom'],
|
|
|
|
|
$image[0]['taille'],
|
|
|
|
|
$image[0]['type'],
|
|
|
|
|
$image[0]['blob']
|
|
|
|
|
);
|
|
|
|
|
$evenement = array();
|
|
|
|
|
|
|
|
|
|
foreach($data as $row)
|
|
|
|
|
{
|
|
|
|
|
$imgRaw = $gateImage->obtenirParId($row['image']);
|
|
|
|
|
$img = new Image(
|
|
|
|
|
intval($imgRaw[0]["id"]),
|
|
|
|
|
$imgRaw[0]['nom'],
|
|
|
|
|
$imgRaw[0]['taille'],
|
|
|
|
|
$imgRaw[0]['type'],
|
|
|
|
|
$imgRaw[0]['blob']
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$evenement[] = new \App\metier\Evenement(
|
|
|
|
|
$row['id'],
|
|
|
|
|
$row['organisateur'],
|
|
|
|
@ -104,11 +95,9 @@ class UtilisateurModele
|
|
|
|
|
|
|
|
|
|
public function ajouterEvenement(Image $img)
|
|
|
|
|
{
|
|
|
|
|
$dsn = "mysql:host=localhost;dbname=dbAlica";
|
|
|
|
|
$login = "test";
|
|
|
|
|
$mdp = "test";
|
|
|
|
|
global $dsn, $username, $password;
|
|
|
|
|
|
|
|
|
|
$con = new \App\gateway\Connection($dsn, $login, $mdp);
|
|
|
|
|
$con = new \App\gateway\Connection($dsn, $username, $password);
|
|
|
|
|
$gate = new \App\gateway\EvenementGateway($con);
|
|
|
|
|
|
|
|
|
|
$titre = $_POST["titre"];
|
|
|
|
@ -118,7 +107,7 @@ class UtilisateurModele
|
|
|
|
|
|
|
|
|
|
$evenement = new Evenement(
|
|
|
|
|
$gate->getNewId(),
|
|
|
|
|
'1',
|
|
|
|
|
'1', //TODO : Ajouter l'ID de l'admin connecté
|
|
|
|
|
$titre,
|
|
|
|
|
$description,
|
|
|
|
|
$date,
|
|
|
|
|