public function renderRetouite(Touite $touite, touitosHandler $db_touitos, $pseudo) { $auteur = $db_touitos->get($touite->getIdAuteur()); echo '<article class = "message" id="' . $touite->getIdMessage() . '">'; echo '<p><a class="pseudo" href="profile.php?user='******'">@' . $pseudo . '</a>a retouité</p>'; echo '<div class="message_container">'; $this->renderPic($auteur); echo '<div class="containeur">'; echo '<header class= "info">'; echo '<div class="pseudo"><a href="profile.php?user='******'">@' . htmlentities($auteur->getPseudo()) . '</a></div>'; echo '<div class="date">' . ($newDate = date("d/m/Y", strtotime($touite->getLaDate())) . '</div>'); echo '</header>'; $this->echo_message($touite); $this->renderFooter($touite); echo '</div></div>'; echo '</article>'; }
} else { if (!empty($_GET['id']) and !empty($_GET['voirMessage'])) { voir_message($_GET['id'], $bd); } else { if (!empty($_SESSION['id']) && !empty($_POST['discution'])) { $touite = array("texte" => $_POST['message'], "idAuteur" => $_SESSION['id']); envoyer_reponse($_POST['id'], new Touite($touite), $bd); } else { if (!empty($_POST['message']) && !isset($_POST['sendDiscussion'])) { $touite = array("texte" => $_POST['message'], "idAuteur" => $_SESSION['id']); if (!empty($_POST['id_message'])) { $touite['id_message'] = $_POST['id_message']; $message = new Touite($touite); //réponse } else { $message = new Touite($touite); $message->setLadate(date("Y-m-d H:i:s")); addTouite($message, $bd); $th = new touitosHandler($bd); $user = $th->getByAttr("pseudo", $_SESSION['user'], PDO::PARAM_STR); $tr = new TouiteRender($user, $bd); $tr->render($message, $user); } } else { if (!empty($_GET['retouite'])) { recordRetouite($_GET['id'], $bd); } else { if (isset($_POST['follow'])) { follow($bd, $_POST['suivi']); } else { if (isset($_POST['unfollow'])) {
public function update(Touite $Touite) { $q = $this->_db->prepare('UPDATE touites SET texte = :texte, ladate=NOW() WHERE idMsg = :id'); $q->bindValue(':ladate', $Touite->getLaDate); $q->bindValue(':texte', $Touite->getTexte(), PDO::PARAM_STR); $q->bindValue(':id', $Touite->getId(), PDO::PARAM_INT); $q->execute(); }