public static function setMarkOnFilm($idFilm, $login, $mark) { if (Etoile::notRankedByUser($idFilm, $login)) { $res = SingletonRequete::getBase()->requeteParam("INSERT INTO Mark(mov_id, user_login, mark_value) VALUES (?,?,?)", array($idFilm, $login, $mark)); } else { $res = SingletonRequete::getBase()->requeteParam("UPDATE Mark SET mark_value=? WHERE mov_id=? AND user_login=?", array($mark, $idFilm, $login)); } }
?> "> <input type="hidden" name="id" value="<?php echo $movie['id']; ?> "> <button value="5" type="submit" name="nbEtoile" class="btn btn-info">5 <span class="glyphicon glyphicon-star"></span></button> <button value="4" type="submit" name="nbEtoile" class="btn btn-info">4 <span class="glyphicon glyphicon-star"></span></button> <button value="3" type="submit" name="nbEtoile" class="btn btn-info">3 <span class="glyphicon glyphicon-star"></span></button> <button value="2" type="submit" name="nbEtoile" class="btn btn-info">2 <span class="glyphicon glyphicon-star"></span></button> <button value="1" type="submit" name="nbEtoile" class="btn btn-info">1 <span class="glyphicon glyphicon-star"></span></button> <button value="0" type="submit" name="nbEtoile" class="btn btn-info">0 <span class="glyphicon glyphicon-star"></span></button> </form> <?php if (!Etoile::notRankedByUser($movie['id'], $_SESSION['login'])) { echo "<div> (Déjà voté: " . Etoile::getMarkByUserOnFilm($movie['id'], $_SESSION['login']) . "<span class='glyphicon glyphicon-star'></span> )</div>"; } ?> </p> <a type='button' class='btn btn-primary' href='<?php echo $path . 'Vue/edit_film_vue.php?id=' . escape($movie['id']); ?> '><span class='glyphicon glyphicon-edit'></span> Editer</a> </div> </div> </div> </div> <?php require_once $path . 'includes/footer.php'; ?>
<?php $path = "../"; session_start(); if (isset($_POST['nbEtoile'])) { require $path . "Modele/Etoile.class.php"; Etoile::setMarkOnFilm($_POST['id'], $_SESSION['login'], $_POST['nbEtoile']); header("Location: " . $path . "Vue/film_vue.php?id=" . $_POST['id']); }