コード例 #1
0
 public static function getCommentaire(&$dataErrors, $idCom = null, $idArticle = null, $login = null, $texte = null)
 {
     $commentaire = Commentaire::getDefaultCommentaire();
     $dataErrors = array();
     try {
         $commentaire->setIdCom($idCom);
     } catch (Exception $e) {
         $dataErrors['idCom'] = $e->getMessage() . "<br/>\n";
     }
     try {
         $commentaire->setIdArticle($idArticle);
     } catch (Exception $e) {
         $dataErrors['idArticle'] = $e->getMessage() . "<br/>\n";
     }
     try {
         $commentaire->setLogin($login);
     } catch (Exception $e) {
         $dataErrors['login'] = $e->getMessage() . "<br/>\n";
     }
     try {
         $commentaire->setTexte($texte);
     } catch (Exception $e) {
         $dataErrors['texte'] = $e->getMessage() . "<br/>\n";
     }
     return $commentaire;
 }
コード例 #2
0
 public static function getCommentaire(&$dataErrors, $Auteur, $DateParution, $Contenu, $IdArticle, $Id = null)
 {
     $com = Commentaire::getDefaultCommentaire();
     $dataErrors = array();
     try {
         $com->setId($Id);
     } catch (Exception $e) {
         $dataErrors['id'] = $e->getMessage() . "<br/>\n";
     }
     try {
         $com->setAuteur($Auteur);
     } catch (Exception $e) {
         $dataErrors['titre'] = $e->getMessage() . "<br/>\n";
     }
     try {
         $com->setDateParution($DateParution);
     } catch (Exception $e) {
         $dataErrors['dateParution'] = $e->getMessage() . "<br/>\n";
     }
     try {
         $com->setContenu($Contenu);
     } catch (Exception $e) {
         $dataErrors['contenu'] = $e->getMessage() . "<br/>\n";
     }
     try {
         $com->setIdArticle($IdArticle);
     } catch (Exception $e) {
         $dataErrors['contenu'] = $e->getMessage() . "<br/>\n";
     }
     return $com;
 }
コード例 #3
0
 public static function getModelDefaultCommentaire()
 {
     $model = new self(array());
     $model->commentaire = Commentaire::getDefaultCommentaire();
     $model->title = "Saisie d'un commentaire";
     return $model;
 }
コード例 #4
0
 public static function getCommentaireByArticleID(&$dataError, $idArticle)
 {
     $comm = Commentaire::getDefaultCommentaire();
     $collectionComm = array();
     if (isset($idArticle)) {
         try {
             $statement = DataBaseManager::getInstance()->prepareAndExecuteQuery('SELECT * ' . 'FROM commentaire ' . 'WHERE IdArticle = ?', array($idArticle));
         } catch (Exception $ex) {
             echo "Impossible d'accéder aux données.";
             $dataError['requete'] = "Impossible d'accéder aux données.";
         }
         if ($statement !== false) {
             foreach ($statement as $row) {
                 $comm = CommentaireFabrique::getCommentaire($dataError, $row['Auteur'], $row['DateParution'], $row['Contenu'], $row['IdArticle'], $row['Id']);
                 $collectionComm[] = $comm;
             }
         } else {
             $dataError['persistance-get'] = "Article Introuvable.";
         }
     } else {
         $dataError['persistance-get'] = "Impossible d'accéder aux données.";
     }
     DataBaseManager::destroyQueryResults($statement);
     return $collectionComm;
 }
コード例 #5
0
 public static function getHtmlDevelopped($Article)
 {
     $htmlCode = "<div class=\"actu_serie\"> <br/> \n";
     $htmlCode .= "<h3>" . $Article->getTitre() . "</h3> \n";
     $htmlCode .= "<p><small>" . $Article->getDateParution() . "</small></p> \n";
     if (strlen($Article->getImage()) >= 1) {
         $htmlCode .= "<img src=\"" . $Article->getImage() . "\" alt=\"" . $Article->getTitre() . "\" /> <br/> \n";
     }
     $htmlCode .= "<p>" . $Article->getContenu() . "</p> <br/> \n";
     $htmlCode .= "</div> <br/> \n";
     $htmlCode .= CommentaireView::getHtmlDevelopedCollection(CommentaireGateway::getCommentaireByArticleID($dataError, $Article->getId()));
     $htmlCode .= "<p> Ajouter un commentaire : </p>";
     $htmlCode .= CommentaireView::getFormHTML("?action=putCommentaire&id=" . $Article->getId(), Commentaire::getDefaultCommentaire());
     $_POST['test'] = "test";
     return $htmlCode;
 }
コード例 #6
0
 public static function getModelDefaultCommentaire()
 {
     $model = new ModelCommentaire();
     $model->setData(Commentaire::getDefaultCommentaire());
     return $model;
 }
コード例 #7
0
 public static function getDefaultFormHTML($action, $idArticle)
 {
     $commentaire = Commentaire::getDefaultCommentaire();
     $commentaire->setIdArticle($idArticle);
     return self::getFormHtml($action, $commentaire);
 }