start to adapt views to new Recipe Model
This commit is contained in:
parent
1522018708
commit
63f8b9468a
@ -10,14 +10,15 @@ final class RecipeController
|
|||||||
}
|
}
|
||||||
|
|
||||||
//TODO MAKE THE VIEW USE THE NEW DATA FORMAT
|
//TODO MAKE THE VIEW USE THE NEW DATA FORMAT
|
||||||
$A_returnArray = RecipeModel::getFullRecipeWithApprs($A_urlParams[0]);
|
$O_recipe = RecipeModel::getFullRecipeWithApprs($A_urlParams[0]);
|
||||||
if ($A_returnArray === null) {
|
if ($O_recipe === null) {
|
||||||
throw new HTTPSpecialCaseException(404);
|
throw new HTTPSpecialCaseException(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$A_returnArray["ADMIN"] = Session::is_admin();
|
View::show("recipe/view", array(
|
||||||
|
"ADMIN" => Session::is_admin(),
|
||||||
View::show("recipe/view", $A_returnArray);
|
"RECIPE" => $O_recipe
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editAction(Array $A_urlParams = null, Array $A_postParams = null)
|
public function editAction(Array $A_urlParams = null, Array $A_postParams = null)
|
||||||
|
|||||||
@ -1,23 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
$O_recipe = $A_view["RECIPE"];
|
||||||
|
?>
|
||||||
<main>
|
<main>
|
||||||
<?php View::show("common/category_list") ?>
|
<?php View::show("common/category_list") ?>
|
||||||
<article>
|
<article>
|
||||||
<img src="<?= $A_view["IMG_LINK"] ?>" alt="Image d'illustration de la recette">
|
<img src="<?= $O_recipe->getImageLink() ?>" alt="Image d'illustration de la recette">
|
||||||
|
|
||||||
<section class="infosRecette">
|
<section class="infosRecette">
|
||||||
<header>
|
<header>
|
||||||
<h1><?= $A_view["NAME"] ?></h1>
|
<h1><?= $O_recipe->S_NAME ?></h1>
|
||||||
<p><?= $A_view["TIME"] ?> — <?= $A_view["DIFFICULTY_NAME"] ?></p>
|
<p><?= $O_recipe->I_TIME ?> — <?= $O_recipe->O_DIFFICULTY->S_NAME ?></p>
|
||||||
</header>
|
</header>
|
||||||
<p><?= $A_view["DESC"] ?></p>
|
<p><?= $O_recipe->S_DESC ?></p>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="ingredientsRecette">
|
<section class="ingredientsRecette">
|
||||||
<h2>Ingrédients</h2>
|
<h2>Ingrédients</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<?php
|
<?php
|
||||||
foreach($A_view["INGREDIENTS"] as $ingredient)
|
foreach($O_recipe->getIngredients() as $O_ingredient){
|
||||||
echo "<li> {$ingredient["NAME"]}: {$ingredient["QUANTITY"]} </li>";
|
echo "<li> $O_ingredient->S_NAME: $O_ingredient->I_QUANTITY </li>";
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
@ -26,13 +29,13 @@
|
|||||||
<h2>Préparation</h2>
|
<h2>Préparation</h2>
|
||||||
<ol>
|
<ol>
|
||||||
<?php
|
<?php
|
||||||
foreach(explode("\n", $A_view["RECIPE"]) as $instructions)
|
foreach(explode("\n", $O_recipe->S_RECIPE) as $S_instr)
|
||||||
echo "<li>".$instructions."</li>";
|
echo "<li>".$S_instr."</li>";
|
||||||
?>
|
?>
|
||||||
</ol>
|
</ol>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<p>By <?= $A_view["AUTHOR_USERNAME"] ?></p>
|
<p>By <?= $O_recipe->getAuthor()->S_USERNAME ?></p>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
View::show("appreciations/view_all", $A_view)
|
View::show("appreciations/view_all", $A_view)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user