link model controller and view to be able to post an appr
This commit is contained in:
parent
899e6e0559
commit
6f57b5a189
@ -9,10 +9,10 @@ final class ApprController
|
||||
|
||||
$I_recipe_id = Utils::intOrDie(Utils::getOrDie($A_postParams, "recipe_id"));
|
||||
$S_comment = Utils::getOrDie($A_postParams, "comment");
|
||||
$I_score = Utils::intOrDie(Utils::getOrDie($A_postParams, "score"));
|
||||
$I_note = Utils::intOrDie(Utils::getOrDie($A_postParams, "note"));
|
||||
|
||||
$O_apprModel = new ApprModel();
|
||||
$O_apprModel->createAppr($_SESSION["ID"], $I_recipe_id, $S_comment, $I_score);
|
||||
$O_apprModel->createAppr($_SESSION["ID"], $I_recipe_id, $S_comment, $I_note);
|
||||
|
||||
header("Location: ".$_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
|
@ -29,14 +29,14 @@ final class ApprModel {
|
||||
return $stmt->fetchAll();
|
||||
}
|
||||
|
||||
public function createAppr($I_user_id, $I_recipe_id, $S_Comment, $I_score)
|
||||
public function createAppr($I_user_id, $I_recipe_id, $S_Comment, $I_note)
|
||||
{
|
||||
$O_model = Model::get();
|
||||
$stmt = $O_model->prepare("
|
||||
INSERT INTO APPRECIATION (COMMENT,SCORE,DATE,AUTHOR_ID,RECIPE_ID) VALUES (:comment, :score, :date, :author_id, :recipe_id)
|
||||
INSERT INTO APPRECIATION (COMMENT,NOTE,DATE,AUTHOR_ID,RECIPE_ID) VALUES (:comment, :note, :date, :author_id, :recipe_id)
|
||||
");
|
||||
$stmt->bindParam("comment",$S_Comment);
|
||||
$stmt->bindParam("score",$I_score);
|
||||
$stmt->bindParam("note",$I_note);
|
||||
$_date = date("Y-m-d");
|
||||
$stmt->bindParam("date",$_date);
|
||||
$stmt->bindParam("author_id",$I_user_id);
|
||||
|
@ -1,6 +1,6 @@
|
||||
<section>
|
||||
<h1> Appréciations: </h1>
|
||||
<form method="POST" action="/">
|
||||
<form method="POST" action="/appr/create">
|
||||
<label for="comment">Entrez votre commentaire :</label>
|
||||
<input type="text" name="comment" id="comment" placeholder="Commentaire">
|
||||
|
||||
@ -12,6 +12,8 @@
|
||||
<input type="radio" name="note" id="note" value="4" title="4"> 4
|
||||
<input type="radio" name="note" id="note" value="5" title="5"> 5
|
||||
|
||||
<input type="hidden" name="recipe_id" value="<?= $A_view["ID"] ?>">
|
||||
|
||||
<input type="submit" value="Envoyer">
|
||||
</form>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user