From 97b39a45528dd25a03a249de981ff000e7c559ab Mon Sep 17 00:00:00 2001 From: Thomas Rubini <74205383+ThomasRubini@users.noreply.github.com> Date: Thu, 26 Jan 2023 16:56:51 +0100 Subject: [PATCH] make apprs use new models + allow users to delete their appr --- Controllers/RecipeController.php | 1 + Models/ApprModel.php | 2 +- Views/appreciations/view_all.php | 9 ++++++--- Views/appreciations/view_single.php | 18 ++++++++++++------ 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Controllers/RecipeController.php b/Controllers/RecipeController.php index 948b733..66b3eaf 100644 --- a/Controllers/RecipeController.php +++ b/Controllers/RecipeController.php @@ -17,6 +17,7 @@ final class RecipeController View::show("recipe/view", array( "ADMIN" => Session::is_admin(), + "USER_ID" => $_SESSION["ID"], "RECIPE" => $O_recipe )); } diff --git a/Models/ApprModel.php b/Models/ApprModel.php index 7756c09..2bcc685 100644 --- a/Models/ApprModel.php +++ b/Models/ApprModel.php @@ -18,7 +18,7 @@ final class ApprModel { $this->I_AUTHOR_ID = $I_AUTHOR_ID; $this->I_RECIPE_ID = $I_RECIPE_ID; } - private function createFromRow($A_row,$I_id){ + private static function createFromRow($A_row,$I_id){ $O_appr = new ApprModel($A_row["COMMENT"], $A_row["NOTE"], $A_row["DATE"], $A_row["AUTHOR_ID"], $A_row["RECIPE_ID"]); $O_appr->I_ID = $I_id; return $O_appr; diff --git a/Views/appreciations/view_all.php b/Views/appreciations/view_all.php index e77ecc6..d729c9d 100644 --- a/Views/appreciations/view_all.php +++ b/Views/appreciations/view_all.php @@ -21,9 +21,12 @@ $O_recipe = $A_view["RECIPE"]; getApprs() as $O_appr){ + View::show("appreciations/view_single", array( + "ADMIN" => $A_view["ADMIN"], + "USER_ID" => $A_view["USER_ID"], + "APPR" => $O_appr + )); } ?> diff --git a/Views/appreciations/view_single.php b/Views/appreciations/view_single.php index 9705cdc..e90d13f 100644 --- a/Views/appreciations/view_single.php +++ b/Views/appreciations/view_single.php @@ -1,10 +1,16 @@ + +
- " alt="profile picture"> -

-

-

- Supprimer l'appréciation" : "" ?> + profile picture +

getAuthor()->S_USERNAME ?>

+

I_NOTE ?>

+

S_DATE ?>

+ I_AUTHOR_ID) { ?> + Supprimer l'appréciation +
-

+

S_COMMENT ?>