Blog lien permanent + imga ede couvertire non obligatoire

This commit is contained in:
fredtempez 2022-03-16 11:53:26 +01:00
parent 038d85219f
commit b66a9562f1
4 changed files with 49 additions and 42 deletions

View File

@ -210,7 +210,7 @@ class blog extends common {
$newuserid = $this->getUser('id');
}
// Incrémente l'id de l'article
$articleId = helper::increment($this->getInput('blogAddTitle', helper::FILTER_ID), $this->getData(['page']));
$articleId = helper::increment($this->getInput('blogAddPermalink'), $this->getData(['page']));
$articleId = helper::increment($articleId, (array) $this->getData(['module', $this->getUrl(0)]));
$articleId = helper::increment($articleId, array_keys(self::$actions));
// Crée l'article
@ -218,9 +218,8 @@ class blog extends common {
$this->getUrl(0),
'posts',
$articleId, [
'comment' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment']),
'content' => $this->getInput('blogAddContent', null),
'picture' => $this->getInput('blogAddPicture', helper::FILTER_STRING_SHORT, true),
'picture' => $this->getInput('blogAddPicture', helper::FILTER_STRING_SHORT),
'hidePicture' => $this->getInput('blogAddHidePicture', helper::FILTER_BOOLEAN),
'pictureSize' => $this->getInput('blogAddPictureSize', helper::FILTER_STRING_SHORT),
'picturePosition' => $this->getInput('blogAddPicturePosition', helper::FILTER_STRING_SHORT),
@ -234,6 +233,7 @@ class blog extends common {
'commentClose' => $this->getInput('blogAddCommentClose', helper::FILTER_BOOLEAN),
'commentNotification' => $this->getInput('blogAddCommentNotification', helper::FILTER_BOOLEAN),
'commentGroupNotification' => $this->getInput('blogAddCommentGroupNotification', helper::FILTER_INT),
'comment' => []
]
]);
// Valeurs en sortie
@ -655,7 +655,7 @@ class blog extends common {
else{
$newuserid = $this->getUser('id');
}
$articleId = $this->getInput('blogEditTitle', helper::FILTER_ID, true);
$articleId = $this->getInput('blogEditPermalink', null, true);
// Incrémente le nouvel id de l'article
if($articleId !== $this->getUrl(2)) {
$articleId = helper::increment($articleId, $this->getData(['page']));
@ -667,10 +667,9 @@ class blog extends common {
'posts',
$articleId, [
'title' => $this->getInput('blogEditTitle', helper::FILTER_STRING_SHORT, true),
'permalink' => $this->getInput('blogEditPermalink', helper::FILTER_STRING_SHORT, true),
'comment' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment']),
'content' => $this->getInput('blogEditContent', null),
'picture' => $this->getInput('blogEditPicture', helper::FILTER_STRING_SHORT, true),
'picture' => $this->getInput('blogEditPicture', helper::FILTER_STRING_SHORT),
'hidePicture' => $this->getInput('blogEditHidePicture', helper::FILTER_BOOLEAN),
'pictureSize' => $this->getInput('blogEditPictureSize', helper::FILTER_STRING_SHORT),
'picturePosition' => $this->getInput('blogEditPicturePosition', helper::FILTER_STRING_SHORT),

View File

@ -2,3 +2,5 @@
- mise à la norme avec le module news : le formulaire est sorti de l'écran principal
- Présentation moderner de la liste des articles
- Respect des balises headings
- permalink des articles
- Image de couverture non obligatoire, présentation adaptive de la liste classique des articles.

View File

@ -37,7 +37,7 @@
<div class="col6">
<?php echo template::text('blogEditPermalink', [
'label' => 'Permalink',
'value' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'permalink'])
'value' => $this->getUrl(2)
]); ?>
</div>
</div>

View File

@ -12,12 +12,15 @@
</div>
<div class="row">
<div class="col12">
<?php if ( $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture']) &&
file_exists( self::FILE_DIR.'source/' . $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture'])) ): ?>
<?php $pictureSize = $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'pictureSize']); ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'hidePicture']) == false) {
echo '<img class="blogArticlePicture blogArticlePicture' . $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'picturePosition']) .
' pict' . $pictureSize . '" src="' . helper::baseUrl(false) . self::FILE_DIR.'source/' . $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture']) .
'" alt="' . $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture']) . '">';
} ?>
<?php endif; ?>
<?php echo $this->getData(['module', $this->getUrl(0),'posts', $articleId, 'content']); ?>
</div>
</div>
@ -85,8 +88,9 @@
</div>
<?php else: ?>
<div class="row rowArticle">
<?php if ( $article['picture'] &&
file_exists( self::FILE_DIR . 'source/' . $article['picture']) ):?>
<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']);
@ -100,9 +104,11 @@
<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">
<?php else:?>
<div class="col12">
<?php endif;?>
<h2 class="blogTitle">
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>">
<?php echo $article['title']; ?>