diff --git a/php/.idea/.gitignore b/php/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/php/.idea/.gitignore @@ -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 diff --git a/php/.idea/modules.xml b/php/.idea/modules.xml new file mode 100644 index 0000000..2047c36 --- /dev/null +++ b/php/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/php/.idea/php.iml b/php/.idea/php.iml new file mode 100644 index 0000000..d28f97f --- /dev/null +++ b/php/.idea/php.iml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/php/.idea/php.xml b/php/.idea/php.xml new file mode 100644 index 0000000..eed9a80 --- /dev/null +++ b/php/.idea/php.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/php/.idea/vcs.xml b/php/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/php/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/php/public/uploads/10246LOGO-CGI-1993-1998.svg.png b/php/public/uploads/10246LOGO-CGI-1993-1998.svg.png new file mode 100644 index 0000000..b02459b Binary files /dev/null and b/php/public/uploads/10246LOGO-CGI-1993-1998.svg.png differ diff --git a/php/public/uploads/10412LOGO-CGI-1993-1998.svg.png b/php/public/uploads/10412LOGO-CGI-1993-1998.svg.png new file mode 100644 index 0000000..b02459b Binary files /dev/null and b/php/public/uploads/10412LOGO-CGI-1993-1998.svg.png differ diff --git a/php/public/uploads/10989LOGO-CGI-1993-1998.svg.png b/php/public/uploads/10989LOGO-CGI-1993-1998.svg.png new file mode 100644 index 0000000..b02459b Binary files /dev/null and b/php/public/uploads/10989LOGO-CGI-1993-1998.svg.png differ diff --git a/php/public/uploads/11118LOGO-CGI-1993-1998.svg.png b/php/public/uploads/11118LOGO-CGI-1993-1998.svg.png new file mode 100644 index 0000000..b02459b Binary files /dev/null and b/php/public/uploads/11118LOGO-CGI-1993-1998.svg.png differ diff --git a/php/public/uploads/11371LOGO-CGI-1993-1998.svg.png b/php/public/uploads/11371LOGO-CGI-1993-1998.svg.png new file mode 100644 index 0000000..b02459b Binary files /dev/null and b/php/public/uploads/11371LOGO-CGI-1993-1998.svg.png differ diff --git a/php/public/uploads/11575LOGO-CGI-1993-1998.svg.png b/php/public/uploads/11575LOGO-CGI-1993-1998.svg.png new file mode 100644 index 0000000..b02459b Binary files /dev/null and b/php/public/uploads/11575LOGO-CGI-1993-1998.svg.png differ diff --git a/php/public/uploads/12020LOGO-CGI-1993-1998.svg.png b/php/public/uploads/12020LOGO-CGI-1993-1998.svg.png new file mode 100644 index 0000000..b02459b Binary files /dev/null and b/php/public/uploads/12020LOGO-CGI-1993-1998.svg.png differ diff --git a/php/public/uploads/13807LOGO-CGI-1993-1998.svg.png b/php/public/uploads/13807LOGO-CGI-1993-1998.svg.png new file mode 100644 index 0000000..b02459b Binary files /dev/null and b/php/public/uploads/13807LOGO-CGI-1993-1998.svg.png differ diff --git a/php/public/uploads/14902LOGO-CGI-1993-1998.svg.png b/php/public/uploads/14902LOGO-CGI-1993-1998.svg.png new file mode 100644 index 0000000..b02459b Binary files /dev/null and b/php/public/uploads/14902LOGO-CGI-1993-1998.svg.png differ diff --git a/php/public/uploads/15529LOGO-CGI-1993-1998.svg.png b/php/public/uploads/15529LOGO-CGI-1993-1998.svg.png new file mode 100644 index 0000000..b02459b Binary files /dev/null and b/php/public/uploads/15529LOGO-CGI-1993-1998.svg.png differ diff --git a/php/public/uploads/17285LOGO-CGI-1993-1998.svg.png b/php/public/uploads/17285LOGO-CGI-1993-1998.svg.png new file mode 100644 index 0000000..b02459b Binary files /dev/null and b/php/public/uploads/17285LOGO-CGI-1993-1998.svg.png differ diff --git a/php/public/uploads/17669LOGO-CGI-1993-1998.svg.png b/php/public/uploads/17669LOGO-CGI-1993-1998.svg.png new file mode 100644 index 0000000..b02459b Binary files /dev/null and b/php/public/uploads/17669LOGO-CGI-1993-1998.svg.png differ diff --git a/php/public/uploads/17854LOGO-CGI-1993-1998.svg.png b/php/public/uploads/17854LOGO-CGI-1993-1998.svg.png new file mode 100644 index 0000000..b02459b Binary files /dev/null and b/php/public/uploads/17854LOGO-CGI-1993-1998.svg.png differ diff --git a/php/public/uploads/18887LOGO-CGI-1993-1998.svg.png b/php/public/uploads/18887LOGO-CGI-1993-1998.svg.png new file mode 100644 index 0000000..b02459b Binary files /dev/null and b/php/public/uploads/18887LOGO-CGI-1993-1998.svg.png differ diff --git a/php/public/uploads/19015LOGO-CGI-1993-1998.svg.png b/php/public/uploads/19015LOGO-CGI-1993-1998.svg.png new file mode 100644 index 0000000..b02459b Binary files /dev/null and b/php/public/uploads/19015LOGO-CGI-1993-1998.svg.png differ diff --git a/php/public/uploads/19858LOGO-CGI-1993-1998.svg.png b/php/public/uploads/19858LOGO-CGI-1993-1998.svg.png new file mode 100644 index 0000000..b02459b Binary files /dev/null and b/php/public/uploads/19858LOGO-CGI-1993-1998.svg.png differ diff --git a/php/src/controleur/UtilisateurControleur.php b/php/src/controleur/UtilisateurControleur.php index a49690a..3c8d3a8 100755 --- a/php/src/controleur/UtilisateurControleur.php +++ b/php/src/controleur/UtilisateurControleur.php @@ -170,7 +170,7 @@ class UtilisateurControleur $mdl = new \App\modele\UtilisateurModele(); $evenements = $mdl->getEvenement(); global $twig; - $twig->addExtension(new TwigExtensions()); + echo $twig->render('evenement.html', ['evenements' => $evenements]); } @@ -184,10 +184,10 @@ class UtilisateurControleur $img = ImageSaver::SaveImage('image'); $mdl = new \App\modele\UtilisateurModele(); + $mdl->ajouterEvenement($img[1]); global $twig; - $twig->addExtension(new TwigExtensions()); $evenements = $mdl->getEvenement(); echo $twig->render('evenement.html', ['evenements' => $evenements]); } @@ -204,7 +204,6 @@ class UtilisateurControleur $mdl->deleteEvenement($_GET["id"]); global $twig; - $twig->addExtension(new TwigExtensions()); $evenements = $mdl->getEvenement(); echo $twig->render('evenement.html', ['evenements' => $evenements]); } @@ -215,7 +214,6 @@ class UtilisateurControleur $evenement = $mdl->getEvenementById($_GET["id"]); global $twig; - $twig->addExtension(new TwigExtensions()); echo $twig->render('detailEvenement.html', ['evenement' => $evenement]); } @@ -231,7 +229,6 @@ class UtilisateurControleur } global $twig; - $twig->addExtension(new TwigExtensions()); echo $twig->render('evenement.html', ['evenements' => $evenements]); } diff --git a/php/src/gateway/EvenementGateway.php b/php/src/gateway/EvenementGateway.php index ee2f5c7..bb9356d 100755 --- a/php/src/gateway/EvenementGateway.php +++ b/php/src/gateway/EvenementGateway.php @@ -23,24 +23,21 @@ class EvenementGateway public function insertEvenement(Evenement $evenement) { - echo "img :"; - echo $evenement->getImage(); - echo "
"; - //id organisateur titre description image date nbPlaceMax - $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) + $query = 'INSERT INTO Evenement VALUES (:i, :o, :t, :d, :img, :date, :nb)'; + $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() { $query='SELECT * FROM Evenement'; @@ -69,11 +66,12 @@ class EvenementGateway 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( - ':titre' => array($titre, \PDO::PARAM_STR) + ':titre' => array("%$titre%", \PDO::PARAM_STR) )); - $res=$this->con->getResults(); + $res = $this->con->getResults(); return $res; } + } \ No newline at end of file diff --git a/php/src/metier/Evenement.php b/php/src/metier/Evenement.php index 1e9de41..c009df7 100755 --- a/php/src/metier/Evenement.php +++ b/php/src/metier/Evenement.php @@ -47,7 +47,7 @@ class Evenement * @param string $description * @param string $date * @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) { @@ -58,6 +58,7 @@ class Evenement $this->date = $date; $this->nbPlaceMax = $nbPlaceMax; $this->image = $image; + } /** @@ -113,7 +114,7 @@ class Evenement */ public function getImage(): string { - return $this->image->getId(); + return $this->image; } diff --git a/php/src/modele/UtilisateurModele.php b/php/src/modele/UtilisateurModele.php index 3f3de7c..1e1bdc6 100755 --- a/php/src/modele/UtilisateurModele.php +++ b/php/src/modele/UtilisateurModele.php @@ -71,17 +71,6 @@ class UtilisateurModele 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 "
"; $evenement[] = new \App\metier\Evenement( $row['id'], @@ -137,18 +126,9 @@ class UtilisateurModele $con = new \App\gateway\Connection($dsn, $username, $password); $gate = new \App\gateway\EvenementGateway($con); - $gateImage = new \App\gateway\ImageGateway($con); $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( $data[0]['id'], @@ -157,7 +137,7 @@ class UtilisateurModele $data[0]['description'], $data[0]['date'], $data[0]['nbPlaceMax'], - $img + $data[0]['image'] ); return $evenement; @@ -169,7 +149,7 @@ class UtilisateurModele $con = new \App\gateway\Connection($dsn, $username, $password); $gate = new \App\gateway\EvenementGateway($con); - $gateImage = new \App\gateway\ImageGateway($con); + //$gateImage = new \App\gateway\ImageGateway($con); $data = $gate->findByTitle($titre); @@ -177,14 +157,7 @@ class UtilisateurModele 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'] - ); + //$imgRaw = $gateImage->obtenirParId($row['image']); $evenement[] = new \App\metier\Evenement( $row['id'], @@ -193,7 +166,7 @@ class UtilisateurModele $row['description'], $row['date'], $row['nbPlaceMax'], - $img + $row['image'] ); } return $evenement; diff --git a/php/templates/detailEvenement.html b/php/templates/detailEvenement.html index 93cd519..fd9e78d 100644 --- a/php/templates/detailEvenement.html +++ b/php/templates/detailEvenement.html @@ -22,7 +22,7 @@

Organisateur: {{ evenement.organisateurId }}

Date: {{ evenement.date }}

Description: {{ evenement.description }}

- Event Image + Event Image

Places disponibles: {{ evenement.nbPlaceMax }}

Retour diff --git a/php/templates/evenement.html b/php/templates/evenement.html index c5e6c86..bd3ac62 100644 --- a/php/templates/evenement.html +++ b/php/templates/evenement.html @@ -24,24 +24,7 @@

Liste des Événements

Publier événement - +