blog date complète dans la liste des articles

This commit is contained in:
Fred Tempez 2022-10-07 19:48:04 +02:00
parent 98ab381b0e
commit fc4900c66b
2 changed files with 20 additions and 7 deletions

View File

@ -278,10 +278,16 @@ class blog extends common {
'value' => $comment['approval'] === true ? 'A' : 'R' 'value' => $comment['approval'] === true ? 'A' : 'R'
]); ]);
} }
//Date et heure
$gdh = mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $comment['createdOn']), 'UTF-8', true)
? \PHP81_BC\strftime('%d %B %Y ', $comment['createdOn'])
: utf8_encode(\PHP81_BC\strftime('%d %B %Y', $comment['createdOn']));
$gdh .= ' - ';
$gdh .= mb_detect_encoding(\PHP81_BC\strftime('%H:%M', $comment['createdOn']), 'UTF-8', true)
? \PHP81_BC\strftime('%H:%M', $comment['createdOn'])
: utf8_encode(\PHP81_BC\strftime('%H:%M', $comment['createdOn']));
self::$comments[] = [ self::$comments[] = [
mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y - %H:%M', $comment['createdOn']), 'UTF-8', true) $gdh,
? \PHP81_BC\strftime('%d %B %Y - %H:%M', $comment['createdOn'])
: utf8_encode(\PHP81_BC\strftime('%d %B %Y - %H:%M', $comment['createdOn'])),
$comment['content'], $comment['content'],
$comment['userId'] ? $this->getData(['user', $comment['userId'], 'firstname']) . ' ' . $this->getData(['user', $comment['userId'], 'lastname']) : $comment['author'], $comment['userId'] ? $this->getData(['user', $comment['userId'], 'firstname']) . ' ' . $this->getData(['user', $comment['userId'], 'lastname']) : $comment['author'],
$buttonApproval, $buttonApproval,

View File

@ -13,7 +13,7 @@
$this->makeThumb( self::FILE_DIR . 'source/' . $article['picture'], $this->makeThumb( self::FILE_DIR . 'source/' . $article['picture'],
self::FILE_DIR . 'thumb/' . $thumb, self::FILE_DIR . 'thumb/' . $thumb,
self::THUMBS_WIDTH); self::THUMBS_WIDTH);
} }
?> ?>
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>" class="blogPicture"> <a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>" class="blogPicture">
<img src="<?php echo helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb; ?>" alt="<?php echo $article['picture']; ?>"> <img src="<?php echo helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb; ?>" alt="<?php echo $article['picture']; ?>">
@ -36,9 +36,16 @@
</div> </div>
<div class="blogDate"> <div class="blogDate">
<?php echo template::ico('calendar-empty'); ?> <?php echo template::ico('calendar-empty'); ?>
<?php echo mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y - %H:%M', $article['publishedOn']), 'UTF-8', true) <?php
? \PHP81_BC\strftime('%d %B %Y', $article['publishedOn']) // Date et heure
: utf8_encode(\PHP81_BC\strftime('%d %B %Y', $article['publishedOn'])); ?> echo mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $article['publishedOn']), 'UTF-8', true)
? \PHP81_BC\strftime('%d %B %Y', $article['publishedOn'])
: utf8_encode(\PHP81_BC\strftime('%d %B %Y', $article['publishedOn']));
echo ' - ';
echo mb_detect_encoding(\PHP81_BC\strftime('%H:%M',$article['publishedOn']), 'UTF-8', true)
? \PHP81_BC\strftime('%H:%M', $article['publishedOn'])
: utf8_encode(\PHP81_BC\strftime('%H:%M', $article['publishedOn']));
?>
</div> </div>
<p class="blogContent"> <p class="blogContent">
<?php echo helper::subword(strip_tags($article['content'],'<br><p>'), 0, 400); ?>... <?php echo helper::subword(strip_tags($article['content'],'<br><p>'), 0, 400); ?>...