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

View File

@ -15,7 +15,7 @@
<?php echo template::ico('user'); ?>
<?php echo $module::$articleSignature; ?>
<?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 -->
<?php if (
@ -147,7 +147,7 @@
<?php echo template::ico('user'); ?>
<?php echo $module::$commentsSignature[$commentId]; ?>
<?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>
<?php echo $comment['content']; ?>
</div>

View File

@ -17,7 +17,7 @@
<?php echo template::ico('user'); ?>
<?php echo $module->signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId'])); ?>
<?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 class="row">
@ -130,7 +130,7 @@
<?php echo template::ico('user'); ?>
<?php echo $module->signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId']));?>
<?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>
<p class="blogContent">
<?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
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
// 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)
? \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'])));
$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']));
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)
? \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'])));
$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']));
} else {
$dateOff = 'Permanent';
}
@ -294,21 +282,9 @@ class news extends common {
// News en fonction de la pagination
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
// 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)
? \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'])));
$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']));
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)
? \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'])));
$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']));
} else {
$dateOff = 'Permanent';
}

View File

@ -6,16 +6,10 @@
<div class="row verticalAlignMiddle">
<div class="col12 newsDate">
<!-- bloc signature et date -->
<?php echo template::ico('user'); ?>
<?php echo $module::$articleSignature . ' - ';?>
<?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)
? \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;
?>
<?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 -->
<?php if (
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')

View File

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

View File

@ -1,53 +1,54 @@
<?php if($module::$news): ?>
<?php if ($module::$news) : ?>
<article>
<div class="row">
<?php foreach($module::$news as $newsId => $news): ?>
<div class="newsFrame col<?php echo $module::$nbrCol ;?>" >
<h2 class="newsTitle" id="<?php echo $newsId;?>">
<?php echo '<a href="'. helper::baseUrl(true) . $this->getUrl(0) . '/' . $newsId . '">' . $news['title'] . '</a>'; ?>
<?php foreach ($module::$news as $newsId => $news) : ?>
<div class="newsFrame col<?php echo $module::$nbrCol; ?>">
<h2 class="newsTitle" id="<?php echo $newsId; ?>">
<?php echo '<a href="' . helper::baseUrl(true) . $this->getUrl(0) . '/' . $newsId . '">' . $news['title'] . '</a>'; ?>
</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>'; ?>
<div class="newsSignature">
<?php echo template::ico('user'); ?>
<?php echo $news['userId']; ?>
<?php echo template::ico('calendar-empty'); ?>
<?php echo helper::dateUTF8('%d %B %Y', $news['publishedOn']) . ' - ' . helper::dateUTF8('%H:%M', $news['publishedOn']); ?>
<!-- Bloc edition -->
<?php if (
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
and
( // Propriétaire
($this->getUser('group') === self::GROUP_ADMIN)
)
) : ?>
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsId . '/' . $_SESSION['csrf']; ?>">
<?php echo template::ico('pencil'); ?> Éditer
</a>
<?php endif; ?>
</div>
<div class="newsSignature">
<?php echo template::ico('calendar-empty'); ?>
<?php echo mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $news['publishedOn']), 'UTF-8', true)
? \PHP81_BC\strftime('%d %B %Y', $news['publishedOn'])
: utf8_encode(\PHP81_BC\strftime('%d %B %Y', $news['publishedOn'])); ?>
- <?php echo $news['userId']; ?>
<!-- Bloc edition -->
<?php if (
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
AND
( // Propriétaire
( $this->getUser('group') === self::GROUP_ADMIN )
)
): ?>
<a href ="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsId . '/' . $_SESSION['csrf'];?>">
<?php echo template::ico('pencil');?> Éditer
</a>
<?php endif; ?>
</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>
</div>
<?php endforeach; ?>
</div>
</article>
<?php echo $module::$pages; ?>
<?php if ($this->getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'feeds'])) : ?>
<div id="rssFeed">
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?>" target="_blank">
<img src='module/news/ressource/feed-icon-16.gif' />
<img src='module/news/ressource/feed-icon-16.gif' />
<?php
echo '<p>' . $this->getData(['module',$this->getUrl(0), 'config', 'feedsLabel']) . '</p>' ;
echo '<p>' . $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel']) . '</p>';
?>
</a>
</div>
<?php endif; ?>
<?php else: ?>
<?php else : ?>
<?php echo template::speech('Aucune news.'); ?>
<?php endif; ?>
<?php endif; ?>