blog disposition moderne + ordre headings

This commit is contained in:
fredtempez 2022-03-15 15:30:33 +01:00
parent 732fa5ffea
commit ca388016f7
6 changed files with 104 additions and 104 deletions

View File

@ -94,7 +94,7 @@ class blog extends common {
];
public static $articlesLenght = [
0 => 'Article complet',
0 => 'Intégralité des articles, disposition moderne',
500 => '500 signes',
1000 => '1000 signes',
1500 => '1500 signes',
@ -503,7 +503,6 @@ class blog extends common {
'feeds' => $this->getInput('blogOptionShowFeeds',helper::FILTER_BOOLEAN),
'feedsLabel' => $this->getInput('blogOptionFeedslabel',helper::FILTER_STRING_SHORT),
'itemsperPage' => $this->getInput('blogOptionItemsperPage', helper::FILTER_INT,true),
'layout' => $this->getInput('blogOptionLayout',helper::FILTER_BOOLEAN),
'articlesLenght'=> $this->getInput('blogOptionArticlesLenght', helper::FILTER_INT),
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']),
]]);
@ -881,7 +880,7 @@ class blog extends common {
/**
* Retourne la signature d'un utilisateur
*/
private function signature($userId) {
public function signature($userId) {
switch ($this->getData(['user', $userId, 'signature'])){
case 1:
return $userId;

View File

@ -1,3 +1,4 @@
# version 6
- mise à la norme avec le module news : le formulaire est sorti de l'écran principal
- Les images ne sont plus obligatoire et la liste des articles peut être sans tableau.
- Présentation moderner de la liste des articles
- Respect des balises headings

View File

@ -66,11 +66,14 @@
<?php if($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentClose'])): ?>
<p>Cet article ne reçoit pas de commentaire.</p>
<?php else: ?>
<h5 id="comment">
<?php //$commentsNb = count($module::$comments); ?>
<?php $commentsNb = $module::$nbCommentsApproved; ?>
<?php $s = $commentsNb === 1 ? '': 's' ?>
<?php echo $commentsNb > 0 ? $commentsNb . ' ' . 'commentaire' . $s : 'Pas encore de commentaire'; ?>
<h4 id="comment">
<?php
if ($module::$nbCommentsApproved > 0) {
echo $module::$nbCommentsApproved . ' commentaire' . ($module::$nbCommentsApproved > 1 ? 's' : '');
} else {
echo 'Pas encore de commentaire';
}
?>
</h5>
<?php echo template::formOpen('blogArticleForm'); ?>
<?php echo template::text('blogArticleCommentShow', [

View File

@ -1,59 +1,13 @@
<?php if($module::$articles): ?>
<?php foreach($module::$articles as $articleId => $article): ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'layout']) !== true): ?>
<div class="row rowArticle">
<div class="col3">
<?php if ( file_exists(self::FILE_DIR . 'source/' . $article['picture']) ): ?>
<?php // Déterminer le nom de la miniature
$parts = explode('/',$article['picture']);
$thumb = str_replace ($parts[(count($parts)-1)],'mini_' . $parts[(count($parts)-1)], $article['picture']);
// Créer la miniature si manquante
if (!file_exists( self::FILE_DIR . 'thumb/' . $thumb) ) {
$this->makeThumb( self::FILE_DIR . 'source/' . $article['picture'],
self::FILE_DIR . 'thumb/' . $thumb,
self::THUMBS_WIDTH);
}
?>
<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']; ?>">
</a>
<?php endif;?>
</div>
<div class="col9">
<h1 class="blogTitle">
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>">
<?php echo $article['title']; ?>
</a>
</h1>
<div class="blogComment">
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>#comment">
<?php if ($article['comment']): ?>
<?php echo count($article['comment']); ?>
<?php endif; ?>
</a>
<?php echo template::ico('comment', 'left'); ?>
</div>
<div class="blogDate">
<?php echo template::ico('calendar-empty'); ?>
<?php echo mb_detect_encoding(strftime('%d %B %Y - %H:%M', $article['publishedOn']), 'UTF-8', true)
? strftime('%d %B %Y', $article['publishedOn'])
: utf8_encode(strftime('%d %B %Y', $article['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 ?>
<?php echo helper::subword(strip_tags($article['content'],'<br><p>'), 0, $lenght); ?>...
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>">Lire la suite</a>
</p>
</div>
</div>
<?php else: ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght']) === 0): ?>
<div class="row">
<div class="col12">
<h1 class="blogTitle">
<h2 class="blogTitle">
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>">
<?php echo $article['title']; ?>
</a>
</h1>
</h2>
</div>
</div>
<div class="row">
@ -70,7 +24,8 @@
<div class="row verticalAlignMiddle">
<div class="col12 blogDate">
<!-- bloc signature et date -->
<?php echo $module::$articleSignature . ' - ';?>
<?php echo $module->signature($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId']));?>
<?php echo ' - ';?>
<?php echo template::ico('calendar-empty'); ?>
<?php $date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts',$articleId, 'publishedOn'])), 'UTF-8', true)
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts',$articleId, 'publishedOn']))
@ -110,21 +65,69 @@
<?php endif; ?>
</div>
</div>
<div class="row">
<?php if($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'commentClose'])): ?>
<p>Cet article ne reçoit pas de commentaire.</p>
<?php else: ?>
<h5 id="comment">
<?php //$commentsNb = count($module::$comments); ?>
<?php $commentsNb = $module::$comments[$articleId];?>
<?php $s = $commentsNb === 1 ? '': 's' ?>
<h3 id="comment">
<?php
if ($module::$comments[$articleId] > 0) {
echo '<a href="'. helper::baseUrl() . $this->getUrl(0) . '/' . $articleId .'">';
echo $module::$comments[$articleId] . ' commentaire' . ($module::$comments[$articleId] > 1 ? 's' : '');
echo '</a>';
} else {
echo 'Pas encore de commentaire';
}
?>
</h3>
<?php endif; ?>
</div>
<?php else: ?>
<div class="row rowArticle">
<div class="col3">
<?php if ( file_exists(self::FILE_DIR . 'source/' . $article['picture']) ): ?>
<?php // Déterminer le nom de la miniature
$parts = explode('/',$article['picture']);
$thumb = str_replace ($parts[(count($parts)-1)],'mini_' . $parts[(count($parts)-1)], $article['picture']);
// Créer la miniature si manquante
if (!file_exists( self::FILE_DIR . 'thumb/' . $thumb) ) {
$this->makeThumb( self::FILE_DIR . 'source/' . $article['picture'],
self::FILE_DIR . 'thumb/' . $thumb,
self::THUMBS_WIDTH);
}
?>
<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']; ?>">
</a>
<?php endif;?>
</div>
<div class="col9">
<h2 class="blogTitle">
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>">
<?php echo $article['title']; ?>
</a>
echo $commentsNb > 0 ? $commentsNb . ' ' . 'commentaire' . $s : 'Pas encore de commentaire';
?>
</h5>
</h2>
<div class="blogComment">
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>#comment">
<?php if ($article['comment']): ?>
<?php echo count($article['comment']); ?>
<?php endif; ?>
</a>
<?php echo template::ico('comment', 'left'); ?>
</div>
<div class="blogDate">
<?php echo template::ico('calendar-empty'); ?>
<?php echo mb_detect_encoding(strftime('%d %B %Y - %H:%M', $article['publishedOn']), 'UTF-8', true)
? strftime('%d %B %Y', $article['publishedOn'])
: utf8_encode(strftime('%d %B %Y', $article['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 ?>
<?php echo helper::subword(strip_tags($article['content'],'<br><p>'), 0, $lenght); ?>...
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>">Lire la suite</a>
</p>
</div>
</div>
<?php endif; ?>
<?php endforeach; ?>
<?php echo $module::$pages; ?>

View File

@ -11,44 +11,18 @@
<?php echo template::submit('blogOptionSubmit'); ?>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Flux RSS</h4>
<div class="row">
<div class="col4">
<?php echo template::checkbox('blogOptionShowFeeds', true, 'Lien du flux RSS', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
]); ?>
</div>
<div class="col4">
<?php echo template::text('blogOptionFeedslabel', [
'label' => 'Texte de l\'étiquette',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
]); ?>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Disposition de la liste des articles</h4>
<div class="row">
<div class="col4">
<?php echo template::checkbox('blogOptionLayout', true, 'Disposition moderne', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'layout']),
'help' => 'La disposition moderne affiche les articles les uns à la suite des autres'
]); ?>
</div>
<div class="col4">
<div class="col6">
<?php echo template::select('blogOptionArticlesLenght', $module::$articlesLenght, [
'label' => 'Longueur des articles',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght'])
]); ?>
</div>
<div class="col4">
<div class="col6">
<?php echo template::select('blogOptionItemsperPage', $module::$ArticlesListed, [
'label' => 'Articles par page',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage'])
@ -59,6 +33,26 @@
</div>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Flux RSS</h4>
<div class="row">
<div class="col6">
<?php echo template::checkbox('blogOptionShowFeeds', true, 'Lien du flux RSS', [
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
]); ?>
</div>
<div class="col6">
<?php echo template::text('blogOptionFeedslabel', [
'label' => 'Texte de l\'étiquette',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
]); ?>
</div>
</div>
</div>
</div>
</div>
<?php echo template::formClose(); ?>
<div class="moduleVersion">Version
<?php echo $module::VERSION; ?>