diff --git a/Controllers/HelloworldController.php b/Controllers/HelloworldController.php deleted file mode 100644 index 4215141..0000000 --- a/Controllers/HelloworldController.php +++ /dev/null @@ -1,19 +0,0 @@ - $O_helloworld->getMessage())); - - } - - public function testformAction(Array $A_urlParams = null, Array $A_postParams = null) - { - - View::show('helloworld/testform', array('formData' => $A_postParams)); - - } - -} \ No newline at end of file diff --git a/Controllers/RecipeController.php b/Controllers/RecipeController.php new file mode 100644 index 0000000..cb09912 --- /dev/null +++ b/Controllers/RecipeController.php @@ -0,0 +1,46 @@ +getByID($A_urlParams[0]); + if($O_recipe === null){ + echo "404"; + return; + } + + $O_ingredientModel = new IngredientModel(); + $A_ingredients = $O_ingredientModel->searchByRecipe($O_recipe["id"]); + + $O_userModel = new UserModel(); + $A_authorName = $O_userModel->getNameByID($O_recipe["author_id"]); + + $O_userModel = new DifficultyModel(); + $A_difficultyName = $O_userModel->getByID($O_recipe["difficulty_id"]); + + $A_returnArray = array( + "recipe_name" => $O_recipe["name"], + "recipe_desc" => $O_recipe["desc"], + "author_name" => $A_authorName, + "recipe_ingredients" => $A_ingredients, + "difficulty_name" => $A_difficultyName, + ); + + View::show("recipe/view", $A_returnArray); + + // print_r($A_urlParams); + // $O_recetteModel = new RecipeIngredientsModel(); + // $O_recetteModel->getByID(""); + // View::show('helloworld/testform', array('formData' => $A_postParams)); + + } + +} \ No newline at end of file diff --git a/Models/DifficultyModel.php b/Models/DifficultyModel.php new file mode 100644 index 0000000..874c235 --- /dev/null +++ b/Models/DifficultyModel.php @@ -0,0 +1,14 @@ +_S_message ; - } - -} \ No newline at end of file diff --git a/Models/IngredientModel.php b/Models/IngredientModel.php new file mode 100644 index 0000000..b1d11b3 --- /dev/null +++ b/Models/IngredientModel.php @@ -0,0 +1,21 @@ + 1, + "name" => "oeuf", + "quantity" => "6", + ), + array( + "id" => 2, + "name" => "lait", + "quantity" => "1/2L", + ), + ); + } +} diff --git a/Models/RecipeModel.php b/Models/RecipeModel.php new file mode 100644 index 0000000..7f367a9 --- /dev/null +++ b/Models/RecipeModel.php @@ -0,0 +1,21 @@ + 36, + "name" => "Ma recette num 36", + "desc" => "Une brève description de la recette 36", + "recipe" => "Etape 1\nEtape 2\nEtape 3", + "difficulty_id" => 1, + "author_id" => 1, + ); + } else { + return null; + } + } +} diff --git a/Models/UserModel.php b/Models/UserModel.php new file mode 100644 index 0000000..4add48a --- /dev/null +++ b/Models/UserModel.php @@ -0,0 +1,14 @@ +" . $A_view['helloworld'] . "
"; diff --git a/Views/helloworld/testform.php b/Views/recipe/edit.php similarity index 100% rename from Views/helloworld/testform.php rename to Views/recipe/edit.php diff --git a/Views/recipe/view.php b/Views/recipe/view.php new file mode 100644 index 0000000..8cb32d2 --- /dev/null +++ b/Views/recipe/view.php @@ -0,0 +1,10 @@ += $A_view["recipe_name"] ?>
+Auteur: = $A_view["author_name"] ?>
+Difficulté: = $A_view["difficulty_name"] ?>
+Ingrédients:
+ {$i['name']}: {$i['quantity']} "; +} +?> \ No newline at end of file