コード例 #1
0
 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');
 }
コード例 #2
0
 public function insertAction($args)
 {
     if (strlen($_POST['title'] <= 20)) {
         $title = htmlentities(trim($_POST['title']));
     } else {
         echo "Le titre est trop long";
     }
     if (strlen($_POST['description'] <= 100)) {
         $description = htmlentities(trim($_POST['description']));
     } else {
         echo "La description est trop longue";
     }
     $id_member = $_SESSION['idUser'];
     $id_contest = $_SESSION['idContest'];
     $nb_like = 0;
     $id = '0';
     $image_link = $_POST['imgSelected'];
     //On vérifie si l'utilisateur a déjà participé ou pas
     $verifBdd = new pictureModel();
     $verifBdd->getAll(true);
     //$test = $verifBdd->getIdMember();
     $hasParticipate = false;
     foreach ($verifBdd as $obj) {
         if ($obj['id_member'] == $id_member && $obj['id_contest'] == $id_contest) {
             $hasParticipate = true;
         }
     }
     if (!$hasParticipate) {
         //Si non, on enregistre
         $participateObj = new pictureModel($id, $title, $description, $image_link, $id_contest, $id_member, $nb_like);
         $participateObj->save();
         header("Location: /contest");
     } else {
         header("Location: /contest");
     }
 }
コード例 #3
0
ファイル: contest.php プロジェクト: phjeannine/hakoopix
<!-- 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"] . '">';
        ?>
コード例 #4
0
<?php

session_start();
$title = $_POST['title'];
$description = $_POST['description'];
$idUser = $_SESSION['idUser'];
$participation = $_FILES['imgParticipation']['name'];
$participateObj = new pictureModel("title", "description", "nb_like", "image_link", 1, 2);
$participateObj->save();
//On récupère nos valeurs
/*
if(isset($_POST['title']) && isset($_POST['description']) && !empty($_POST['title']) && !empty($_POST['description'])) {
	$title = $_POST['title']²;
	$description = $_POST['description'];
	$idUser = $_SESSION['idUser'];
	$participation = $_FILES['imgParticipation']['name'];


	//On récupère l'id du concours
	$selectContest = "SELECT * FROM contest WHERE is_active = true"; 
	$result = $db->prepare($selectContest); 
	$result->execute(); 
	$contestResult = $result->fetch();
	$idContest = $contestResult['id_contest'];

	//Je vérifie si l'user n'a pas déjà participé au concours
		$verif = $db->prepare("SELECT id_member, id_contest FROM picture");
		$verif->execute();
		$result = $verif->fetchAll(PDO::FETCH_ASSOC);

		//Si le tableau est vide on enregistre la 1ère participation
コード例 #5
0
ファイル: dashboard.php プロジェクト: phjeannine/hakoopix
<?php

include "dashboardHead.php";
/* Count Member */
$memberCountObj = new memberModel();
$nbMember = $memberCountObj->countRow();
/* Count Picture */
$pictureCountObj = new pictureModel();
$nbPicture = $pictureCountObj->countRow();
/* Count Contest */
$contestCountObj = new contestModel();
$nbContest = $contestCountObj->countRow();
// Select user limit 8
$memberListObj = new memberModel();
$members = $memberListObj->getUserByLimit();
// Select contest limit 8
$contestListObj = new contestModel();
$contests = $contestListObj->getContestByLimit();
?>

<div id="wrapper">
    <div id="page-wrapper">
        <div class="container-fluid">
            <!-- Page Heading -->
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header">
                        Dashboard
                        <small>Statistics</small>
                    </h1>
                    <ol class="breadcrumb">
function showIconById($idArticle)
{
    $pictureModel = new pictureModel();
    $picture = $pictureModel->getPictureIcon($idArticle);
    include 'view/viewHome.php';
}