From b815514ff147ed81ac91b4a3983ce8170f28652b Mon Sep 17 00:00:00 2001 From: "kevin.modejar" Date: Thu, 24 Oct 2024 08:27:24 +0200 Subject: [PATCH 1/5] gitignore --- src/Entity/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/Entity/.gitignore diff --git a/src/Entity/.gitignore b/src/Entity/.gitignore new file mode 100644 index 0000000..a725465 --- /dev/null +++ b/src/Entity/.gitignore @@ -0,0 +1 @@ +vendor/ \ No newline at end of file From 0ca51ee6e426e5d2fdd50193852acd8152a28ec3 Mon Sep 17 00:00:00 2001 From: beaulaton Date: Thu, 24 Oct 2024 08:46:48 +0200 Subject: [PATCH 2/5] =?UTF-8?q?Type=20d'image=20&=20id=20chang=C3=A9,=20st?= =?UTF-8?q?ring=20=3D>=20int?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Entity/userEntity.php | 18 +++++++++--------- src/Gateway/userGateway.php | 12 ++++++------ src/Model/userModel.php | 10 +++++----- vue/profil.html | 17 +++++++++++------ 4 files changed, 31 insertions(+), 26 deletions(-) diff --git a/src/Entity/userEntity.php b/src/Entity/userEntity.php index d2ccf0b..f0546be 100644 --- a/src/Entity/userEntity.php +++ b/src/Entity/userEntity.php @@ -3,22 +3,22 @@ class User{ - private string $id; + private int $id; private string $username; private string $passwd; private string $hidenPasswd; - private string $img; + private int $img; private string $email; /** - * @param string $id + * @param int $id * @param string $username * @param string $passwd * @param string $hidenPasswd - * @param string $img + * @param int $img * @param string $email */ - public function __construct(string $id, string $username, string $passwd, string $img, string $email) + public function __construct(int $id, string $username, string $passwd, int $img, string $email) { $this->id = $id; $this->username = $username; @@ -31,7 +31,7 @@ /** * @return string */ - public function getId(): string + public function getId(): int { return $this->id; } @@ -39,7 +39,7 @@ /** * @param string $id */ - public function setId(string $id): void + public function setId(int $id): void { $this->id = $id; } @@ -63,7 +63,7 @@ /** * @return string */ - public function getImg(): string + public function getImg(): int { return $this->img; } @@ -71,7 +71,7 @@ /** * @param string $img */ - public function setImg(string $img): void + public function setImg(int $img): void { $this->img = $img; } diff --git a/src/Gateway/userGateway.php b/src/Gateway/userGateway.php index 6a51b7d..4760260 100644 --- a/src/Gateway/userGateway.php +++ b/src/Gateway/userGateway.php @@ -41,8 +41,8 @@ Class UserGateway{ } - - public function findDataUser(string $id):array{ + //obtenir les information d'un user + public function findDataUser(int $id):array{ $query = 'SELECT * FROM Users WHERE id_user=:idUser'; $con->executeQuery($query, array(':idUser'=>array($id, PDO::PARAM_STR))); $result = $con->getResults(); @@ -51,7 +51,7 @@ Class UserGateway{ // ===================== UPDATE FUNCTION ===================== - public function updateUsername(string $id, string $newUsername):array{ + public function updateUsername(int $id, string $newUsername):array{ //Update le nom du user passé en paramètre $queryUpdate = 'UPDATE Users SET username=:newUsername WHERE id_user=:idUser'; $con->executeQuery($queryUpdate, array(':idUser'=>array($id, PDO::PARAM_STR), ':newUsername'=> array($newUsername, PDO::PARAM_STR))); @@ -62,7 +62,7 @@ Class UserGateway{ return $result; } - public function updateEmail(string $id, string $newEmail):array{ + public function updateEmail(int $id, string $newEmail):array{ //Update le email du user passé en paramètre $queryUpdate = 'UPDATE Users SET email=:newEmail WHERE id_user=:idUser'; $con->executeQuery($queryUpdate, array(':idUser'=>array($id, PDO::PARAM_STR), ':newEmail'=> array($newEmail, PDO::PARAM_STR))); @@ -74,7 +74,7 @@ Class UserGateway{ return $result; } - public function updateImg(string $id, string $newImg):array{ + public function updateImg(int $id, int $newImg):array{ //Update l'image du user passé en paramètre $query = 'UPDATE Users SET img=:newImg WHERE id_user=:idUser'; $con->executeQuery($query, array(':idUser'=>array($id, PDO::PARAM_STR), ':newImg'=> array($newImg, PDO::PARAM_STR))); @@ -86,7 +86,7 @@ Class UserGateway{ return $result; } - public function updatePasswd(string $id, string $newPassWd):array{ + public function updatePasswd(int $id, string $newPassWd):array{ //Update le passwd du user passé en paramètre $query = 'UPDATE Users SET pssword=:newPassWd WHERE id_user=:idUser'; $con->executeQuery($query, array(':idUser'=>array($id, PDO::PARAM_STR), ':newPassWd'=> array($newPassWd, PDO::PARAM_STR))); diff --git a/src/Model/userModel.php b/src/Model/userModel.php index db0b5f3..06892bf 100644 --- a/src/Model/userModel.php +++ b/src/Model/userModel.php @@ -30,7 +30,7 @@ // } // } - public function getDataUser(string $id){ + public function getDataUser(int $id){ $res = $this->gateway->findDataUser($id); foreach($res as $sources){ $src[] = new sourceEntity( @@ -45,28 +45,28 @@ } - public function setUsername(string $id, string $newUsername){ + public function setUsername(int $id, string $newUsername){ $res = $this->gateway->updateUsername($id,$newUsername); $src[] = new sourceEntity($res['username']); return $src; } - public function setEmail(string $id, string $newEmail){ + public function setEmail(int $id, string $newEmail){ $res = $this->gateway->updateEmail($id,$newEmail); $src[] = new sourceEntity($res['email']); return $src; } - public function setImg(string $id, string $newImg){ + public function setImg(int $id, int $newImg){ $res = $this->gateway->updateImg($id,$newImg); $src[] = new sourceEntity($res['img']); return $src; } - public function setPassWd(string $id, string $newPassWd){ + public function setPassWd(int $id, string $newPassWd){ $res = $this->gateway->updatePasswd($id,$newPassWd); $src[] = new sourceEntity($res['pssword']); diff --git a/vue/profil.html b/vue/profil.html index a36d2a6..977a6fc 100644 --- a/vue/profil.html +++ b/vue/profil.html @@ -3,11 +3,12 @@ - + Wiki Fantasy : Profil - + - + +
@@ -29,10 +30,14 @@ -

Tyler De Dordogne

+

Tyler De Dordogne

-

user@wikiFantasy.com

-

*********

+ +

user@wikiFantasy.com

+ + +

*********

+

Language :

From 45ecc5b5193bfdd18fcdb8366933f1ac4d6bd356 Mon Sep 17 00:00:00 2001 From: "kevin.modejar" Date: Thu, 24 Oct 2024 09:08:24 +0200 Subject: [PATCH 3/5] page quote --- src/Entity/.gitignore | 1 - vue/quote.html | 42 +++++++++++++++++++++++++++++------------- vue/quote.php | 16 ++++++++++++++++ 3 files changed, 45 insertions(+), 14 deletions(-) delete mode 100644 src/Entity/.gitignore create mode 100644 vue/quote.php diff --git a/src/Entity/.gitignore b/src/Entity/.gitignore deleted file mode 100644 index a725465..0000000 --- a/src/Entity/.gitignore +++ /dev/null @@ -1 +0,0 @@ -vendor/ \ No newline at end of file diff --git a/vue/quote.html b/vue/quote.html index 06de45d..395115d 100644 --- a/vue/quote.html +++ b/vue/quote.html @@ -1,15 +1,31 @@ - - - - - - - Wiki Fantasy : Citations - - + + +
+ {{ nameCarac }} +

+ + {{ quoteContent }} + +

+
    +
  • + {{ sourceName }} +
  • +
  • + {{ nameCarac }} +
  • +
  • + {{ dateSortie }} +
  • +
+ +
+
- - - - +
+ \ No newline at end of file diff --git a/vue/quote.php b/vue/quote.php new file mode 100644 index 0000000..30752cc --- /dev/null +++ b/vue/quote.php @@ -0,0 +1,16 @@ + false )); + $value = 'Salva'; + + echo $twig->render('quote.html', array( + 'srcImg' => "../default.jpg", + 'nameCarac' => "default", + 'quoteContent' => "je test la page", + 'sourceName' => "une source", + 'dateSortie' => "1999", + 'nbLike' => "0" +)); +?> \ No newline at end of file From 05e5cb3ffc29b51d3ed0a2421841faf0b46d23c4 Mon Sep 17 00:00:00 2001 From: "kevin.modejar" Date: Thu, 24 Oct 2024 09:34:02 +0200 Subject: [PATCH 4/5] page quote --- composer.json | 2 +- composer.lock | 14 -------------- vue/quote.php | 25 +++++++++++++++++++------ vue/{ => templates}/quote.html | 7 ++++++- 4 files changed, 26 insertions(+), 22 deletions(-) rename vue/{ => templates}/quote.html (73%) diff --git a/composer.json b/composer.json index df4bfc2..fce1394 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "require": { "twig/twig": "^3.0", "ext-pdo": "*", - "altorouter/altorouter": "^2.0" + "altorouter/altorouter": "^2.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index ac0a03b..32a9531 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,6 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], -<<<<<<< HEAD "content-hash": "68804b2111cb6b8bf6edf66cb2b4669c", "packages": [ { @@ -68,11 +67,6 @@ "time": "2020-03-09T08:34:59+00:00" }, { -======= - "content-hash": "e4bbfb6f07dd88c6288177f48b9cb54c", - "packages": [ - { ->>>>>>> 8f986a30433c4424563cac3b838b80c8e6a12f1d "name": "symfony/deprecation-contracts", "version": "v3.5.0", "source": { @@ -457,20 +451,12 @@ "packages-dev": [], "aliases": [], "minimum-stability": "stable", -<<<<<<< HEAD - "stability-flags": [], -======= "stability-flags": {}, ->>>>>>> 8f986a30433c4424563cac3b838b80c8e6a12f1d "prefer-stable": false, "prefer-lowest": false, "platform": { "ext-pdo": "*" }, -<<<<<<< HEAD - "platform-dev": [], -======= "platform-dev": {}, ->>>>>>> 8f986a30433c4424563cac3b838b80c8e6a12f1d "plugin-api-version": "2.6.0" } diff --git a/vue/quote.php b/vue/quote.php index 30752cc..8c2adf0 100644 --- a/vue/quote.php +++ b/vue/quote.php @@ -1,9 +1,13 @@ false )); - $value = 'Salva'; + // appele avec index.php ne pas metre si controleur fonctionnel + require __DIR__ . '/../vendor/autoload.php'; + + $loader = new \Twig\Loader\FilesystemLoader('templates'); + $twig = new \Twig\Environment($loader, [ + 'cache' => false, + ]); + // echo $twig->render('quote.html', array( 'srcImg' => "../default.jpg", @@ -11,6 +15,15 @@ 'quoteContent' => "je test la page", 'sourceName' => "une source", 'dateSortie' => "1999", - 'nbLike' => "0" -)); + 'nbLike' => "0", + 'comment'=> array( + array( + 'user'=>'toto', + 'content'=>'12345674fkjgvhgtfoidshfziutgfos' + ), + array( + 'user'=> 'tata', + 'content'=>'azertyuiopqsdfghjklmwxcvbn' + ) +))); ?> \ No newline at end of file diff --git a/vue/quote.html b/vue/templates/quote.html similarity index 73% rename from vue/quote.html rename to vue/templates/quote.html index 395115d..c35ecd8 100644 --- a/vue/quote.html +++ b/vue/templates/quote.html @@ -25,7 +25,12 @@
- + {% if comment|length > 0%}
+ {% for com in comment %} +

{{ com.user }}

+

{{ com.content }}

+ {% endfor %}
+ {% endif %}
\ No newline at end of file From 67952da915c4827b167a61062c394882852f7eda Mon Sep 17 00:00:00 2001 From: beaulaton Date: Thu, 24 Oct 2024 09:38:07 +0200 Subject: [PATCH 5/5] modif fct set --- src/Model/userModel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Model/userModel.php b/src/Model/userModel.php index 06892bf..7300c4d 100644 --- a/src/Model/userModel.php +++ b/src/Model/userModel.php @@ -47,28 +47,28 @@ public function setUsername(int $id, string $newUsername){ $res = $this->gateway->updateUsername($id,$newUsername); - $src[] = new sourceEntity($res['username']); + $src[] = new sourceEntity($res[0]['username']); return $src; } public function setEmail(int $id, string $newEmail){ $res = $this->gateway->updateEmail($id,$newEmail); - $src[] = new sourceEntity($res['email']); + $src[] = new sourceEntity($res[0]['email']); return $src; } public function setImg(int $id, int $newImg){ $res = $this->gateway->updateImg($id,$newImg); - $src[] = new sourceEntity($res['img']); + $src[] = new sourceEntity($res[0]['img']); return $src; } public function setPassWd(int $id, string $newPassWd){ $res = $this->gateway->updatePasswd($id,$newPassWd); - $src[] = new sourceEntity($res['pssword']); + $src[] = new sourceEntity($res[0]['pssword']); return $src; }