From ab085e8591dc4e2096f1bc72f8c4c5fa8470be2e Mon Sep 17 00:00:00 2001 From: Nicolas Date: Wed, 18 Jan 2023 11:21:07 +0100 Subject: [PATCH 1/5] implement category with a data example --- Views/category/category.php | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Views/category/category.php diff --git a/Views/category/category.php b/Views/category/category.php new file mode 100644 index 0000000..6784b27 --- /dev/null +++ b/Views/category/category.php @@ -0,0 +1,47 @@ + "Quaso", + "img" => "4.jpg", + "note" => "4.5" + ), + array( + "nom" => "Quaso", + "img" => "4.jpg", + "note" => "4.5" + ), + array( + "nom" => "Quaso", + "img" => "4.jpg", + "note" => "4.5" + ) +); + +$array_categories = array( + "Type de cuisson" => $array_recepies_Type_de_cuisson, + "Temps de préparation" => $array_recepies_Type_de_cuisson, + "Difficulté" => $array_recepies_Type_de_cuisson, + "Végan" => $array_recepies_Type_de_cuisson, + "Sans gluten" => $array_recepies_Type_de_cuisson, + "Sans lactose" => $array_recepies_Type_de_cuisson +); +?> + + From ca1c97b94dd77e6941082e6edc3eea1357e78b4c Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 19 Jan 2023 16:07:54 +0100 Subject: [PATCH 2/5] category page --- Views/category/category.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Views/category/category.php b/Views/category/category.php index 6784b27..3cd02b7 100644 --- a/Views/category/category.php +++ b/Views/category/category.php @@ -1,16 +1,19 @@ "1", "nom" => "Quaso", "img" => "4.jpg", "note" => "4.5" ), array( + "id" => "1", "nom" => "Quaso", "img" => "4.jpg", "note" => "4.5" ), array( + "id" => "1", "nom" => "Quaso", "img" => "4.jpg", "note" => "4.5" @@ -32,11 +35,11 @@ $array_categories = array( $recipes) { echo '
  • -

    $key

    +

      '; foreach ($recipes as $recipe) { echo '
    • '; - View::show("../common/recipe", $recipe); + View::show("common/recipe", $recipe); echo '
    • '; } echo '
    From 4c02a3ec747904fea97bb2144c035f96cfaffdcb Mon Sep 17 00:00:00 2001 From: Thomas Rubini <74205383+ThomasRubini@users.noreply.github.com> Date: Thu, 19 Jan 2023 16:17:45 +0100 Subject: [PATCH 3/5] add CategoriesController --- Controllers/CategoriesController.php | 41 +++++++++++++++++++++++ Views/category/category.php | 50 ---------------------------- Views/category/view.php | 21 ++++++++++++ 3 files changed, 62 insertions(+), 50 deletions(-) create mode 100644 Controllers/CategoriesController.php delete mode 100644 Views/category/category.php create mode 100644 Views/category/view.php diff --git a/Controllers/CategoriesController.php b/Controllers/CategoriesController.php new file mode 100644 index 0000000..a0933f9 --- /dev/null +++ b/Controllers/CategoriesController.php @@ -0,0 +1,41 @@ + "1", + "nom" => "Quaso", + "img" => "4.jpg", + "note" => "4.5" + ), + array( + "id" => "1", + "nom" => "Quaso", + "img" => "4.jpg", + "note" => "4.5" + ), + array( + "id" => "1", + "nom" => "Quaso", + "img" => "4.jpg", + "note" => "4.5" + ) + ); + + $A_array_categories = array( + "Type de cuisson" => $A_array_recipes_Type_de_cuisson, + "Temps de préparation" => $A_array_recipes_Type_de_cuisson, + "Difficulté" => $A_array_recipes_Type_de_cuisson, + "Végan" => $A_array_recipes_Type_de_cuisson, + "Sans gluten" => $A_array_recipes_Type_de_cuisson, + "Sans lactose" => $A_array_recipes_Type_de_cuisson + ); + + View::show("category/view", $A_array_categories); + } + +} diff --git a/Views/category/category.php b/Views/category/category.php deleted file mode 100644 index 3cd02b7..0000000 --- a/Views/category/category.php +++ /dev/null @@ -1,50 +0,0 @@ - "1", - "nom" => "Quaso", - "img" => "4.jpg", - "note" => "4.5" - ), - array( - "id" => "1", - "nom" => "Quaso", - "img" => "4.jpg", - "note" => "4.5" - ), - array( - "id" => "1", - "nom" => "Quaso", - "img" => "4.jpg", - "note" => "4.5" - ) -); - -$array_categories = array( - "Type de cuisson" => $array_recepies_Type_de_cuisson, - "Temps de préparation" => $array_recepies_Type_de_cuisson, - "Difficulté" => $array_recepies_Type_de_cuisson, - "Végan" => $array_recepies_Type_de_cuisson, - "Sans gluten" => $array_recepies_Type_de_cuisson, - "Sans lactose" => $array_recepies_Type_de_cuisson -); -?> - - diff --git a/Views/category/view.php b/Views/category/view.php new file mode 100644 index 0000000..13aa765 --- /dev/null +++ b/Views/category/view.php @@ -0,0 +1,21 @@ + + + From d468d5fed0f1753f279ebee53a45a7697f878b2c Mon Sep 17 00:00:00 2001 From: Thomas Rubini <74205383+ThomasRubini@users.noreply.github.com> Date: Thu, 19 Jan 2023 16:18:23 +0100 Subject: [PATCH 4/5] modify key names in common/recipe --- Views/common/recipe.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Views/common/recipe.php b/Views/common/recipe.php index 1cabff5..7b46cc1 100644 --- a/Views/common/recipe.php +++ b/Views/common/recipe.php @@ -1,5 +1,5 @@ -"> - " alt=""> +"> + " alt="">

    From 69ee3faa650763f48cb289dce638be9963cab291 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 19 Jan 2023 16:55:09 +0100 Subject: [PATCH 5/5] fix category page with controller --- Controllers/CategoriesController.php | 24 ++++++++++++------------ Views/category/view.php | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Controllers/CategoriesController.php b/Controllers/CategoriesController.php index a0933f9..4731be8 100644 --- a/Controllers/CategoriesController.php +++ b/Controllers/CategoriesController.php @@ -7,22 +7,22 @@ final class CategoriesController { $A_array_recipes_Type_de_cuisson = array( //test array( - "id" => "1", - "nom" => "Quaso", - "img" => "4.jpg", - "note" => "4.5" + "RECIPE_LINK" => "http://exemple", + "IMG_LINK" => "2.jpg", + "NAME" => "Croissant", + "NOTE" => "4.5" ), array( - "id" => "1", - "nom" => "Quaso", - "img" => "4.jpg", - "note" => "4.5" + "RECIPE_LINK" => "http://exemple", + "IMG_LINK" => "2.jpg", + "NAME" => "Croissant", + "NOTE" => "4.5" ), array( - "id" => "1", - "nom" => "Quaso", - "img" => "4.jpg", - "note" => "4.5" + "RECIPE_LINK" => "http://exemple", + "IMG_LINK" => "2.jpg", + "NAME" => "Croissant", + "NOTE" => "4.5" ) ); diff --git a/Views/category/view.php b/Views/category/view.php index 13aa765..4575649 100644 --- a/Views/category/view.php +++ b/Views/category/view.php @@ -6,7 +6,7 @@ $recipes) { echo '
  • -

    +

    '.$categoryName.'

      '; foreach ($recipes as $recipe) { echo '
    • ';