From 98b05f8b8b95eb6235615a2faa054065109b7165 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Sat, 11 Feb 2023 10:02:44 +0100 Subject: [PATCH] Blog tables date --- module/blog/blog.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/module/blog/blog.php b/module/blog/blog.php index 5b76d1ca..d5c7c7af 100755 --- a/module/blog/blog.php +++ b/module/blog/blog.php @@ -338,8 +338,10 @@ class blog extends common 'help' => $comment['approval'] === true ? 'Approuvé' : 'Rejeté', ]); } + self::$dateFormat = $this->getData(['module', $this->getUrl(0), 'config', 'dateFormat']); + self::$timeFormat = $this->getData(['module', $this->getUrl(0), 'config', 'timeFormat']); self::$comments[] = [ - helper::dateUTF8('%d %B %Y', $comment['createdOn']) . ' - ' . helper::dateUTF8('%H:%M', $comment['createdOn']), + helper::dateUTF8(self::$dateFormat, $comment['createdOn']) . ' - ' . helper::dateUTF8(self::$timeFormat, $comment['createdOn']), $comment['content'], $comment['userId'] ? $this->getData(['user', $comment['userId'], 'firstname']) . ' ' . $this->getData(['user', $comment['userId'], 'lastname']) : $comment['author'], $buttonApproval, @@ -495,6 +497,9 @@ class blog extends common $pagination = helper::pagination($articleIds, $this->getUrl(), self::$itemsperPage); // Liste des pages self::$pages = $pagination['pages']; + // Format de temps + self::$dateFormat = $this->getData(['module', $this->getUrl(0), 'config', 'dateFormat']); + self::$timeFormat = $this->getData(['module', $this->getUrl(0), 'config', 'timeFormat']); // Articles en fonction de la pagination for ($i = $pagination['first']; $i < $pagination['last']; $i++) { // Nombre de commentaires à approuver et approuvés @@ -512,7 +517,7 @@ class blog extends common '' . $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) . '', - helper::dateUTF8('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])) . ' - ' . helper::dateUTF8('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), + helper::dateUTF8(self::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])) . ' - ' . helper::dateUTF8(self::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), self::$states[$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'state'])], // Bouton pour afficher les commentaires de l'article template::button('blogConfigComment' . $articleIds[$i], [