news strftime + remplacement à par - dans les dates + uniformisation de la mise en page avec blog

This commit is contained in:
Fred Tempez 2022-10-09 10:35:56 +02:00
parent 221d42193c
commit d4713f15cd
7 changed files with 50 additions and 79 deletions

View File

@ -472,7 +472,7 @@ class blog extends common {
'<a href="' . helper::baseurl() . $this->getUrl(0) . '/' . $articleIds[$i] . '" target="_blank" >' . '<a href="' . helper::baseurl() . $this->getUrl(0) . '/' . $articleIds[$i] . '" target="_blank" >' .
$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) . $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) .
'</a>', '</a>',
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('%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'])),
self::$states[$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'state'])], self::$states[$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'state'])],
// Bouton pour afficher les commentaires de l'article // Bouton pour afficher les commentaires de l'article
template::button('blogConfigComment' . $articleIds[$i], [ template::button('blogConfigComment' . $articleIds[$i], [
@ -567,7 +567,7 @@ class blog extends common {
'<a href="' . helper::baseurl() . $this->getUrl(0) . '/' . $articleIds[$i] . '" target="_blank" >' . '<a href="' . helper::baseurl() . $this->getUrl(0) . '/' . $articleIds[$i] . '" target="_blank" >' .
$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) . $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) .
'</a>', '</a>',
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('%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'])),
self::$states[$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'state'])], self::$states[$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'state'])],
// Bouton pour afficher les commentaires de l'article // Bouton pour afficher les commentaires de l'article
template::button('blogConfigComment' . $articleIds[$i], [ template::button('blogConfigComment' . $articleIds[$i], [

View File

@ -15,7 +15,7 @@
<?php echo template::ico('user'); ?> <?php echo template::ico('user'); ?>
<?php echo $module::$articleSignature; ?> <?php echo $module::$articleSignature; ?>
<?php echo template::ico('calendar-empty'); ?> <?php echo template::ico('calendar-empty'); ?>
<?php echo helper::dateUTF8('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) . ' à ' . helper::dateUTF8('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])); ?> <?php echo helper::dateUTF8('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) . ' - ' . helper::dateUTF8('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])); ?>
<!-- Bloc edition --> <!-- Bloc edition -->
<?php if ( <?php if (
@ -147,7 +147,7 @@
<?php echo template::ico('user'); ?> <?php echo template::ico('user'); ?>
<?php echo $module::$commentsSignature[$commentId]; ?> <?php echo $module::$commentsSignature[$commentId]; ?>
<?php echo template::ico('calendar-empty'); ?> <?php echo template::ico('calendar-empty'); ?>
<?php echo helper::dateUTF8('%d %B %Y', $comment['createdOn']) . ' à ' . helper::dateUTF8('%H:%M', $comment['createdOn']); ?> <?php echo helper::dateUTF8('%d %B %Y', $comment['createdOn']) . ' - ' . helper::dateUTF8('%H:%M', $comment['createdOn']); ?>
</h4> </h4>
<?php echo $comment['content']; ?> <?php echo $comment['content']; ?>
</div> </div>

View File

@ -17,7 +17,7 @@
<?php echo template::ico('user'); ?> <?php echo template::ico('user'); ?>
<?php echo $module->signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId'])); ?> <?php echo $module->signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId'])); ?>
<?php echo template::ico('calendar-empty'); ?> <?php echo template::ico('calendar-empty'); ?>
<?php echo helper::dateUTF8('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])) . ' à ' . helper::dateUTF8('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])); ?> <?php echo helper::dateUTF8('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])) . ' - ' . helper::dateUTF8('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])); ?>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
@ -130,7 +130,7 @@
<?php echo template::ico('user'); ?> <?php echo template::ico('user'); ?>
<?php echo $module->signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId']));?> <?php echo $module->signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId']));?>
<?php echo template::ico('calendar-empty'); ?> <?php echo template::ico('calendar-empty'); ?>
<?php echo helper::dateUTF8('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])) . ' à ' . helper::dateUTF8('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])); ?> <?php echo helper::dateUTF8('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])) . ' - ' . helper::dateUTF8('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])); ?>
</div> </div>
<p class="blogContent"> <p class="blogContent">
<?php $lenght = $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght']) !== 0 ? $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght']) : 500 ?> <?php $lenght = $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght']) !== 0 ? $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght']) : 500 ?>

View File

@ -194,21 +194,9 @@ class news extends common {
// News en fonction de la pagination // News en fonction de la pagination
for($i = $pagination['first']; $i < $pagination['last']; $i++) { for($i = $pagination['first']; $i < $pagination['last']; $i++) {
// Met en forme le tableau // Met en forme le tableau
$dateOn = mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true) $dateOn = helper::dateUTF8('%d %B %Y',$this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])) . ' - ' . helper::dateUTF8('%H:%M',$this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']));
? \PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))
: utf8_encode(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
$dateOn .= ' à ';
$dateOn .= mb_detect_encoding(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true)
? \PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))
: utf8_encode(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
if ($this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) { if ($this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) {
$dateOff = mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true) $dateOff = helper::dateUTF8('%d %B %Y',$this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) . ' - ' . helper::dateUTF8('%H:%M',$this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']));
? \PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))
: utf8_encode(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
$dateOff .= ' à ';
$dateOff .= mb_detect_encoding(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true)
? \PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))
: utf8_encode(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
} else { } else {
$dateOff = 'Permanent'; $dateOff = 'Permanent';
} }
@ -294,21 +282,9 @@ class news extends common {
// News en fonction de la pagination // News en fonction de la pagination
for($i = $pagination['first']; $i < $pagination['last']; $i++) { for($i = $pagination['first']; $i < $pagination['last']; $i++) {
// Met en forme le tableau // Met en forme le tableau
$dateOn = mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true) $dateOn = $dateOn = helper::dateUTF8('%d %B %Y',$this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])) . ' - ' . helper::dateUTF8('%H:%M',$this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']));
? \PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))
: utf8_encode(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
$dateOn .= ' à ';
$dateOn .= mb_detect_encoding(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true)
? \PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))
: utf8_encode(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
if ($this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) { if ($this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) {
$dateOff = mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true) $dateOff = helper::dateUTF8('%d %B %Y',$this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) . ' - ' . helper::dateUTF8('%H:%M',$this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']));
? \PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))
: utf8_encode(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
$dateOff .= ' à ';
$dateOff .= mb_detect_encoding(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true)
? \PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))
: utf8_encode(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
} else { } else {
$dateOff = 'Permanent'; $dateOff = 'Permanent';
} }

View File

@ -6,16 +6,10 @@
<div class="row verticalAlignMiddle"> <div class="row verticalAlignMiddle">
<div class="col12 newsDate"> <div class="col12 newsDate">
<!-- bloc signature et date --> <!-- bloc signature et date -->
<?php echo template::ico('user'); ?>
<?php echo $module::$articleSignature . ' - ';?> <?php echo $module::$articleSignature . ' - ';?>
<?php echo template::ico('calendar-empty'); ?> <?php echo template::ico('calendar-empty'); ?>
<?php $date = mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) <?php echo helper::dateUTF8('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) . ' - ' . helper::dateUTF8('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])); ?>
? \PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
: utf8_encode(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
$heure = mb_detect_encoding(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
? \PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
: utf8_encode(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
echo $date . ' à ' . $heure;
?>
<!-- Bloc edition --> <!-- Bloc edition -->
<?php if ( <?php if (
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')

View File

@ -34,8 +34,8 @@
} }
.newsSignature { .newsSignature {
margin-right: 10px; /*margin-left: 10px;*/
float: right; float: left;
font-style: italic; font-style: italic;
color: grey; color: grey;
} }

View File

@ -6,24 +6,16 @@
<h2 class="newsTitle" id="<?php echo $newsId; ?>"> <h2 class="newsTitle" id="<?php echo $newsId; ?>">
<?php echo '<a href="' . helper::baseUrl(true) . $this->getUrl(0) . '/' . $newsId . '">' . $news['title'] . '</a>'; ?> <?php echo '<a href="' . helper::baseUrl(true) . $this->getUrl(0) . '/' . $newsId . '">' . $news['title'] . '</a>'; ?>
</h2> </h2>
<div class="newsContent">
<?php echo $news['content']; ?>
<?php if ( $this->getData(['module', $this->getUrl(0), 'config', 'height']) !== -1
&& strlen($this->getData(['module', $this->getUrl(0), 'posts', $newsId, 'content'])) >= $this->getData(['module', $this->getUrl(0), 'config', 'height'])):?>
<?php echo ' ... <a href="'. helper::baseUrl(true) . $this->getUrl(0) . '/' . $newsId . '"><span class="newsSuite">lire la suite</span></a>'; ?>
<?php endif; ?>
</div>
<div class="newsSignature"> <div class="newsSignature">
<?php echo template::ico('user'); ?>
<?php echo $news['userId']; ?>
<?php echo template::ico('calendar-empty'); ?> <?php echo template::ico('calendar-empty'); ?>
<?php echo mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $news['publishedOn']), 'UTF-8', true) <?php echo helper::dateUTF8('%d %B %Y', $news['publishedOn']) . ' - ' . helper::dateUTF8('%H:%M', $news['publishedOn']); ?>
? \PHP81_BC\strftime('%d %B %Y', $news['publishedOn'])
: utf8_encode(\PHP81_BC\strftime('%d %B %Y', $news['publishedOn'])); ?>
- <?php echo $news['userId']; ?>
<!-- Bloc edition --> <!-- Bloc edition -->
<?php if ( <?php if (
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
AND and
( // Propriétaire ( // Propriétaire
($this->getUser('group') === self::GROUP_ADMIN) ($this->getUser('group') === self::GROUP_ADMIN)
) )
@ -34,6 +26,15 @@
<?php endif; ?> <?php endif; ?>
</div> </div>
</div> </div>
<div class="newsContent">
<?php echo $news['content']; ?>
<?php if (
$this->getData(['module', $this->getUrl(0), 'config', 'height']) !== -1
&& strlen($this->getData(['module', $this->getUrl(0), 'posts', $newsId, 'content'])) >= $this->getData(['module', $this->getUrl(0), 'config', 'height'])
) : ?>
<?php echo ' ... <a href="' . helper::baseUrl(true) . $this->getUrl(0) . '/' . $newsId . '"><span class="newsSuite">lire la suite</span></a>'; ?>
<?php endif; ?>
</div>
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>
</article> </article>