Browse Source

blog disposition moderne + ordre headings

12_dev
fredtempez 4 months ago
parent
commit
ca388016f7
  1. 4
      core/core.js.php
  2. 5
      module/blog/blog.php
  3. 3
      module/blog/changes.md
  4. 13
      module/blog/view/article/article.php
  5. 133
      module/blog/view/index/index.php
  6. 42
      module/blog/view/option/option.php

4
core/core.js.php

@ -216,7 +216,7 @@ core.start = function() {
var getUrl = window.location;
var domain = "domain=" + getUrl.host + ";";
var path = "path=" + getUrl.pathname.split('/')[1] + ";";
var e = new Date();
e.setFullYear(e.getFullYear() + 1);
var expires = "expires=" + e.toUTCString();
@ -225,7 +225,7 @@ core.start = function() {
var analytics = "<?php echo $this->getData(['config', 'seo', 'analyticsId']);?>";
// l'Id GA est défini dans la configuration, afficher la checkbox d'acceptation
if( analytics.length > 0){
// Traitement du retour de la checkbox
// Traitement du retour de la checkbox
if ($("#googleAnalytics").is(":checked")) {
// L'URL du serveur faut TRUE

5
module/blog/blog.php

@ -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;

3
module/blog/changes.md

@ -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

13
module/blog/view/article/article.php

@ -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', [

133
module/blog/view/index/index.php

@ -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>
<?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' ?>
<?php
<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>
<?php endif; ?>
<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: ?>
<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>
</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; ?>

42
module/blog/view/option/option.php

@ -14,19 +14,21 @@
<div class="row">
<div class="col12">
<div class="block">
<h4>Flux RSS</h4>
<h4>Disposition de la liste des articles</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 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">
<?php echo template::text('blogOptionFeedslabel', [
'label' => 'Texte de l\'étiquette',
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
<div class="col6">
<?php echo template::select('blogOptionItemsperPage', $module::$ArticlesListed, [
'label' => 'Articles par page',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage'])
]); ?>
</div>
</div>
</div>
</div>
@ -34,27 +36,19 @@
<div class="row">
<div class="col12">
<div class="block">
<h4>Disposition de la liste des articles</h4>
<h4>Flux RSS</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">
<?php echo template::select('blogOptionArticlesLenght', $module::$articlesLenght, [
'label' => 'Longueur des articles',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght'])
<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="col4">
<?php echo template::select('blogOptionItemsperPage', $module::$ArticlesListed, [
'label' => 'Articles par page',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage'])
<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>

Loading…
Cancel
Save