public function updatelikeAction($args) { $idPhoto = $args['0']; $pictureGet = new pictureModel(); $pictureGet->getOneBy($idPhoto); $nbLike = $pictureGet->getNbLike(); $title = $pictureGet->getTitle(); $description = $pictureGet->getDescription(); $image_link = $pictureGet->getImageLink(); $id_contest = $pictureGet->getIdContest(); $id_member = $pictureGet->getIdMember(); $like = $nbLike + 1; $idVote = 0; $pictureObj = new pictureModel($idPhoto, $title, $description, $image_link, $id_contest, $id_member, $like); $pictureObj->save(); $voteObj = new voteModel($idVote, $like, $id_contest, $_SESSION['idUser'], $idPhoto); $voteObj->save(); header('Location: /contest'); }
<!-- Page Content --> <div class="container" id="contest"> <!-- Page Header --> <div class="row"> <div class="col-lg-12"> <h1 class="page-header">Contributions</h1> <div class="barre"></div> </div> </div><!-- /.row --> <?php $participationBdd = new pictureModel(); $participationBdd->getAll(true); $listLikes = new voteModel(); $listLikes->getAll(true); $hasParticipate = false; ?> <div class="row"> <!-- Galerie photos --> <?php foreach ($participationBdd as $userParticipate) { if ($userParticipate['id_contest'] == $_SESSION['idContest']) { ?> <div class="col-lg-4 col-md-4 col-sm-5 col-xs-12 contribution"> <div class="img_contest"> <?php echo '<img id="img-popup" class="img-responsive" src="' . $userParticipate['image_link'] . '" data-toggle="modal" data-target="#myModal" data-src="' . $userParticipate['image_link'] . '" data-title="' . $userParticipate["title"] . '">'; ?>
private function showVote() { $vote = new voteModel(); $this->smarty->assign("subject", $vote->getFrontVoteSubject()); $this->smarty->assign("items", $vote->getFrontVoteItem()); }