Merge pull request #26 from ThomasRubini/fix_home_view

fixed recipes view and translations
This commit is contained in:
Marla 2023-01-18 14:22:34 +01:00 committed by GitHub
commit 8bd4cd4f66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 33 deletions

View File

@ -5,6 +5,26 @@ final class DefaultController
public function defaultAction(Array $A_urlParams = null, Array $A_postParams = null)
{
View::show("home/view");
$array_recipes = array(
array(
"LINK" => "/recipe/view/1",
"NAME" => "Pâte à crêpe",
"IMG" => "/static/img/recipes/1.jpg",
"NOTE" => "4.5"
),
array(
"LINK" => "/recipe/view/1",
"NAME" => "Pâte à crêpe",
"IMG" => "/static/img/recipes/1.jpg",
"NOTE" => "4.5"
),
array(
"LINK" => "/recipe/view/1",
"NAME" => "Pâte à crêpe",
"IMG" => "/static/img/recipes/1.jpg",
"NOTE" => "4.5"
),
);
View::show("home/view", $array_recipes);
}
}

View File

@ -9,7 +9,7 @@ final class RecipeModel
$stmt = $O_model->prepare("SELECT * FROM RECIPE WHERE ID=:id");
$stmt->bindParam("id", $I_id);
$stmt->execute();
$row = $stmt->fetch();
if ($row === false) return null;
return $row;
@ -19,15 +19,15 @@ final class RecipeModel
{
$A_recipe = self::getRecipeByID($I_id);
if ($A_recipe === null)return null;
$A_recipe["IMAGE_URL"] = "/static/img/recettes/".$A_recipe["ID"].".jpg";
$A_recipe["IMAGE_URL"] = "/static/img/recipes/".$A_recipe["ID"].".jpg";
$O_ingredientModel = new IngredientModel();
$A_recipe["INGREDIENTS"] = $O_ingredientModel->searchByRecipe($A_recipe["ID"]);
$O_userModel = new UserModel();
$A_recipe["AUTHOR_USERNAME"] = $O_userModel->getUsernameByID($A_recipe["AUTHOR_ID"]);
$O_userModel = new DifficultyModel();
$A_recipe["DIFFICULTY_NAME"] = $O_userModel->getByID($A_recipe["DIFFICULTY_ID"]);

View File

@ -1,7 +1,7 @@
<a href="/recipe/view/<?= $A_view["id"]?>">
<img src="<?= $A_view["img"] ?>" alt="<?= $A_view["nom"]?>">
<a href="<?= $A_view["LINK"]?>">
<img src="<?= $A_view["IMG"] ?>" alt="<?= $A_view["NAME"]?>">
<section>
<h2> <?= $A_view["nom"]?> </h2>
<p> <?= $A_view["note"]?> </p>
<h2> <?= $A_view["NAME"]?> </h2>
<p> <?= $A_view["NOTE"]?> </p>
</section>
</a>

View File

@ -1,34 +1,14 @@
<?php
$array_recipes = array(
array(
"nom" => "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"
),
);
?>
<img src="static/img/bandeau.jpg" alt="Cook">
<section>
<h1> idées recettes: </h1>
<main>
<section>
<h1> Nos idées recettes: </h1>
<?php
foreach ($array_recipes as $recipe){
foreach ($A_view as $recipe){
View::show("common/recipe", $recipe);
}
?>
</section>
</section>
</main>

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

Before

Width:  |  Height:  |  Size: 298 KiB

After

Width:  |  Height:  |  Size: 298 KiB