images dans dossier fonctionnelles

evenements
Baptiste D 1 year ago
parent f1b6110bd5
commit ec76db2afc

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/php.iml" filepath="$PROJECT_DIR$/.idea/php.iml" />
</modules>
</component>
</project>

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" packagePrefix="App\" />
<excludeFolder url="file://$MODULE_DIR$/vendor/composer" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-ctype" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-mbstring" />
<excludeFolder url="file://$MODULE_DIR$/vendor/twig/twig" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MessDetectorOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCSFixerOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCodeSnifferOptionsConfiguration">
<option name="highlightLevel" value="WARNING" />
<option name="transferred" value="true" />
</component>
<component name="PhpIncludePathManager">
<include_path>
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-mbstring" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-ctype" />
<path value="$PROJECT_DIR$/vendor/composer" />
<path value="$PROJECT_DIR$/vendor/twig/twig" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="8.1">
<option name="suggestChangeDefaultLanguageLevel" value="false" />
</component>
<component name="PhpStanOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PsalmOptionsConfiguration">
<option name="transferred" value="true" />
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

@ -170,7 +170,7 @@ class UtilisateurControleur
$mdl = new \App\modele\UtilisateurModele(); $mdl = new \App\modele\UtilisateurModele();
$evenements = $mdl->getEvenement(); $evenements = $mdl->getEvenement();
global $twig; global $twig;
$twig->addExtension(new TwigExtensions());
echo $twig->render('evenement.html', ['evenements' => $evenements]); echo $twig->render('evenement.html', ['evenements' => $evenements]);
} }
@ -184,10 +184,10 @@ class UtilisateurControleur
$img = ImageSaver::SaveImage('image'); $img = ImageSaver::SaveImage('image');
$mdl = new \App\modele\UtilisateurModele(); $mdl = new \App\modele\UtilisateurModele();
$mdl->ajouterEvenement($img[1]); $mdl->ajouterEvenement($img[1]);
global $twig; global $twig;
$twig->addExtension(new TwigExtensions());
$evenements = $mdl->getEvenement(); $evenements = $mdl->getEvenement();
echo $twig->render('evenement.html', ['evenements' => $evenements]); echo $twig->render('evenement.html', ['evenements' => $evenements]);
} }
@ -204,7 +204,6 @@ class UtilisateurControleur
$mdl->deleteEvenement($_GET["id"]); $mdl->deleteEvenement($_GET["id"]);
global $twig; global $twig;
$twig->addExtension(new TwigExtensions());
$evenements = $mdl->getEvenement(); $evenements = $mdl->getEvenement();
echo $twig->render('evenement.html', ['evenements' => $evenements]); echo $twig->render('evenement.html', ['evenements' => $evenements]);
} }
@ -215,7 +214,6 @@ class UtilisateurControleur
$evenement = $mdl->getEvenementById($_GET["id"]); $evenement = $mdl->getEvenementById($_GET["id"]);
global $twig; global $twig;
$twig->addExtension(new TwigExtensions());
echo $twig->render('detailEvenement.html', ['evenement' => $evenement]); echo $twig->render('detailEvenement.html', ['evenement' => $evenement]);
} }
@ -231,7 +229,6 @@ class UtilisateurControleur
} }
global $twig; global $twig;
$twig->addExtension(new TwigExtensions());
echo $twig->render('evenement.html', ['evenements' => $evenements]); echo $twig->render('evenement.html', ['evenements' => $evenements]);
} }

@ -23,24 +23,21 @@ class EvenementGateway
public function insertEvenement(Evenement $evenement) public function insertEvenement(Evenement $evenement)
{ {
echo "img :";
echo $evenement->getImage();
echo "<br>";
//id organisateur titre description image date nbPlaceMax $query = 'INSERT INTO Evenement VALUES (:i, :o, :t, :d, :img, :date, :nb)';
$query='INSERT INTO Evenement VALUES (:i, :o, :t, :d, :img,:date, :nb)';
$this->con->executeQuery($query, array(
':i' => array($evenement->getId(), \PDO::PARAM_INT),
':o' => array($evenement->getOrganisateurId(), \PDO::PARAM_INT),
':t' => array($evenement->getTitre(), \PDO::PARAM_STR),
':d' => array($evenement->getDescription(), \PDO::PARAM_STR),
':img' => array($evenement->getImage(), \PDO::PARAM_STR),
':date' => array($evenement->getDate(), \PDO::PARAM_STR),
':nb' => array($evenement->getNbPlaceMax(), \PDO::PARAM_INT)
$this->con->executeQuery($query,$params = array(
':i' => array($evenement->getId(), \PDO::PARAM_INT),
':o' => array($evenement->getOrganisateurId(), \PDO::PARAM_INT),
':t' => array($evenement->getTitre(), \PDO::PARAM_STR),
':d' => array($evenement->getDescription(), \PDO::PARAM_STR),
':img' => array($evenement->getImage(), \PDO::PARAM_STR),
':date' => array($evenement->getDate(), \PDO::PARAM_STR),
':nb' => array($evenement->getNbPlaceMax(), \PDO::PARAM_INT),
)); ));
} }
public function getAllEvenement() public function getAllEvenement()
{ {
$query='SELECT * FROM Evenement'; $query='SELECT * FROM Evenement';
@ -69,11 +66,12 @@ class EvenementGateway
public function findByTitle($titre) public function findByTitle($titre)
{ {
$query='SELECT * FROM Evenement WHERE titre LIKE "%'.$titre.'%"'; $query = 'SELECT * FROM Evenement WHERE titre LIKE :titre';
$this->con->executeQuery($query, array( $this->con->executeQuery($query, array(
':titre' => array($titre, \PDO::PARAM_STR) ':titre' => array("%$titre%", \PDO::PARAM_STR)
)); ));
$res=$this->con->getResults(); $res = $this->con->getResults();
return $res; return $res;
} }
} }

@ -47,7 +47,7 @@ class Evenement
* @param string $description * @param string $description
* @param string $date * @param string $date
* @param int $nbPlaceMax * @param int $nbPlaceMax
* @param Image $image * @param string $image
*/ */
public function __construct(int $id, int $organisateur, string $titre, string $description, string $date, int $nbPlaceMax, string $image) public function __construct(int $id, int $organisateur, string $titre, string $description, string $date, int $nbPlaceMax, string $image)
{ {
@ -58,6 +58,7 @@ class Evenement
$this->date = $date; $this->date = $date;
$this->nbPlaceMax = $nbPlaceMax; $this->nbPlaceMax = $nbPlaceMax;
$this->image = $image; $this->image = $image;
} }
/** /**
@ -113,7 +114,7 @@ class Evenement
*/ */
public function getImage(): string public function getImage(): string
{ {
return $this->image->getId(); return $this->image;
} }

@ -71,17 +71,6 @@ class UtilisateurModele
foreach($data as $row) 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']
// );
echo "row img",$row['image'];
echo "<br>";
$evenement[] = new \App\metier\Evenement( $evenement[] = new \App\metier\Evenement(
$row['id'], $row['id'],
@ -137,18 +126,9 @@ class UtilisateurModele
$con = new \App\gateway\Connection($dsn, $username, $password); $con = new \App\gateway\Connection($dsn, $username, $password);
$gate = new \App\gateway\EvenementGateway($con); $gate = new \App\gateway\EvenementGateway($con);
$gateImage = new \App\gateway\ImageGateway($con);
$data = $gate->findById($id); $data = $gate->findById($id);
$imgRaw = $gateImage->obtenirParId($data[0]['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( $evenement = new \App\metier\Evenement(
$data[0]['id'], $data[0]['id'],
@ -157,7 +137,7 @@ class UtilisateurModele
$data[0]['description'], $data[0]['description'],
$data[0]['date'], $data[0]['date'],
$data[0]['nbPlaceMax'], $data[0]['nbPlaceMax'],
$img $data[0]['image']
); );
return $evenement; return $evenement;
@ -169,7 +149,7 @@ class UtilisateurModele
$con = new \App\gateway\Connection($dsn, $username, $password); $con = new \App\gateway\Connection($dsn, $username, $password);
$gate = new \App\gateway\EvenementGateway($con); $gate = new \App\gateway\EvenementGateway($con);
$gateImage = new \App\gateway\ImageGateway($con); //$gateImage = new \App\gateway\ImageGateway($con);
$data = $gate->findByTitle($titre); $data = $gate->findByTitle($titre);
@ -177,14 +157,7 @@ class UtilisateurModele
foreach($data as $row) foreach($data as $row)
{ {
$imgRaw = $gateImage->obtenirParId($row['image']); //$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( $evenement[] = new \App\metier\Evenement(
$row['id'], $row['id'],
@ -193,7 +166,7 @@ class UtilisateurModele
$row['description'], $row['description'],
$row['date'], $row['date'],
$row['nbPlaceMax'], $row['nbPlaceMax'],
$img $row['image']
); );
} }
return $evenement; return $evenement;

@ -22,7 +22,7 @@
<p><strong>Organisateur:</strong> {{ evenement.organisateurId }}</p> <p><strong>Organisateur:</strong> {{ evenement.organisateurId }}</p>
<p><strong>Date:</strong> {{ evenement.date }}</p> <p><strong>Date:</strong> {{ evenement.date }}</p>
<p><strong>Description:</strong> {{ evenement.description }}</p> <p><strong>Description:</strong> {{ evenement.description }}</p>
<img src="data:image/png;base64,{{ evenement.getImage().getBlob() | base64 }}" width="250px" class="img-fluid" alt="Event Image"> <img src="uploads/{{ evenement.getImage() }}" width="250px" class="img-fluid" alt="Event Image">
<p><strong>Places disponibles:</strong> {{ evenement.nbPlaceMax }}</p> <p><strong>Places disponibles:</strong> {{ evenement.nbPlaceMax }}</p>
<a href="../public/index.php?action=listerEvenement" class="btn btn-primary">Retour</a> <a href="../public/index.php?action=listerEvenement" class="btn btn-primary">Retour</a>
</div> </div>

@ -24,24 +24,7 @@
<h1>Liste des Événements</h1> <h1>Liste des Événements</h1>
<a href="../public/index.php?action=creerEvenement" class="btn btn-primary">Publier événement</a> <a href="../public/index.php?action=creerEvenement" class="btn btn-primary">Publier événement</a>
</div> </div>
<!-- <ul class="list-group">
{% for evenement in evenements %}
<li class="list-group-item">
<div class="infos">
<h2>{{ evenement.titre }}</h2>
<p><strong>Organisateur:</strong> {{ evenement.organisateurId}}</p>
<p><strong>Date:</strong> {{ evenement.date }}</p>
<p><strong>Description:</strong> {{ evenement.description }}</p>
<img src="data:image/png;base64,{{ evenement.getImage().getBlob() | base64 }}" width="250px" class="img-fluid">
<p><strong>Places disponibles:</strong> {{ evenement.nbPlaceMax }}</p>
<a href="../public/index.php?action=avoirDetailEvenement&id={{ evenement.id }}" class="btn btn-primary">Détails</a>
</div>
<a href="../public/index.php?action=supprimerEvenement&id={{ evenement.id }}" id="deleteButton">
<img src="assets/close.png" alt="Supprimer" width="20px">
</a>
</li>
{% endfor %}
</ul> -->
<ul class="list-group"> <ul class="list-group">
{% if evenements is not empty %} {% if evenements is not empty %}
{% for evenement in evenements %} {% for evenement in evenements %}
@ -51,7 +34,7 @@
<p><strong>Organisateur:</strong> {{ evenement.organisateurId}}</p> <p><strong>Organisateur:</strong> {{ evenement.organisateurId}}</p>
<p><strong>Date:</strong> {{ evenement.date }}</p> <p><strong>Date:</strong> {{ evenement.date }}</p>
<p><strong>Description:</strong> {{ evenement.description }}</p> <p><strong>Description:</strong> {{ evenement.description }}</p>
<img src="data:image/png;base64,{{ evenement.getImage().getBlob() | base64 }}" width="250px" class="img-fluid"> <img src="uploads/{{evenement.getImage()}}" width="250px" class="img-fluid">
<p><strong>Places disponibles:</strong> {{ evenement.nbPlaceMax }}</p> <p><strong>Places disponibles:</strong> {{ evenement.nbPlaceMax }}</p>
<a href="../public/index.php?action=avoirDetailEvenement&id={{ evenement.id }}" class="btn btn-primary">Détails</a> <a href="../public/index.php?action=avoirDetailEvenement&id={{ evenement.id }}" class="btn btn-primary">Détails</a>
</div> </div>

Loading…
Cancel
Save