/** * @brief Méthode qui appelle la vue d'affichage de la page d'une oeuvre * @access private * @return void */ private function oeuvre() { $oeuvre = new Oeuvre(); $oeuvreAffichee = $oeuvre->getOeuvreById($_GET["o"]); $commentaire = new Commentaire(); $commentairesOeuvre = $commentaire->getCommentairesByOeuvre($_GET["o"], $this->langueAffichage); $classement = $commentaire->getClassementOeuvre($_GET["o"]); $photo = new Photo(); $photosOeuvre = $photo->getPhotosByOeuvre($_GET["o"], false); if (isset($_GET['action']) && $_GET['action'] == 'envoyerPhoto') { $msgInsertPhoto = $photo->ajouterPhoto($_GET["o"], false, "oeuvre"); } else { $msgInsertPhoto = null; } if (isset($_GET['action']) && $_GET['action'] == 'envoyerCommentaire') { if (isset($_SESSION["idUsager"])) { $usager = $_SESSION["idUsager"]; } else { $usager = 1; //id usager anonyme } $msgInsertCommentaire = $commentaire->ajoutCommentairesByOeuvre($_POST['idOeuvreencours'], $this->langueAffichage, $_POST['commentaireAjout'], $_POST['vote'], $usager, false); } else { $msgInsertCommentaire = null; } $artiste = new Artiste(); $artistesOeuvre = $artiste->getArtistesbyOeuvreId($_GET["o"]); $this->oVue = new VueOeuvre(); $this->oVue->setDataGlobal('oeuvre', "page d'une oeuvre", $this->langueAffichage, $this->pOeuvre); $this->oVue->setData($oeuvreAffichee, $commentairesOeuvre, $photosOeuvre, $artistesOeuvre, $classement, $this->langueAffichage); $this->oVue->setMsgPhoto($msgInsertPhoto); $this->oVue->setMsgCommentaire($msgInsertCommentaire); $this->oVue->afficherMeta(); $this->oVue->afficherEntete(); $this->oVue->afficherBody(); $this->oVue->afficherPiedPage(); }
<h2>Test unitaire - ajout commentaire BDD</h2> <div id="contenu"> <?php $commentaire = new Commentaire(); if (isset($_GET["testajoutCommentaire"])) { if (!empty($_GET["commentaireAjout"])) { $commentaire->ajoutCommentairesByOeuvre(1, 'FR', $_GET['commentaireAjout'], $_GET['vote'], 1, false); // $commentaire->ajoutCommentairesByOeuvre($_GET["o"], $this->langueAffichage, $_GET['Commentaire'],$_GET['vote']); } else { echo "ne laissez rien en blanc"; } } ?> <form method="get" name="formTestAjoutCommentaire" > <textarea name='commentaireAjout' placeholder="Commentaire (obligatoire)"></textarea> <div class="cont"> <div class="stars"> <input class="star star-5" name='vote' id="star-5-2" type="radio" name="star" value='5'/> <label class="star star-5" for="star-5-2"></label> <input class="star star-4" name='vote'id="star-4-2" type="radio" name="star" value='4'/> <label class="star star-4" for="star-4-2"></label> <input class="star star-3" name='vote' id="star-3-2" type="radio" name="star" checked="checked" value='3'/> <label class="star star-3" for="star-3-2"></label> <input class="star star-2" name='vote' id="star-2-2" type="radio" name="star" value='2'/> <label class="star star-2" for="star-2-2"></label> <input class="star star-1" name='vote' id="star-1-2" type="radio" name="star" value='1'/> <label class="star star-1" for="star-1-2"></label>