Article okay
option select sizes
This commit is contained in:
Fred Tempez 2023-02-10 22:45:26 +01:00
parent ed46aeb65a
commit 862f8f3496
3 changed files with 107 additions and 85 deletions

View File

@ -208,7 +208,7 @@ class blog extends common
$newsArticle->addElementArray([ $newsArticle->addElementArray([
'title' => $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'title']), 'title' => $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'title']),
'link' => helper::baseUrl() . $this->getUrl(0) . '/' . $articleId, 'link' => helper::baseUrl() . $this->getUrl(0) . '/' . $articleId,
'description' => '<img src="' . helper::baseUrl(false) . self::FILE_DIR .'thumb/' . $thumb 'description' => '<img src="' . helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb
. '" alt="' . $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'title']) . '" alt="' . $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'title'])
. '" title="' . $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'title']) . '" title="' . $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'title'])
. '" />' . . '" />' .
@ -259,7 +259,8 @@ class blog extends common
'module', 'module',
$this->getUrl(0), $this->getUrl(0),
'posts', 'posts',
$articleId, [ $articleId,
[
'content' => $this->getInput('blogAddContent', null), 'content' => $this->getInput('blogAddContent', null),
'picture' => $this->getInput('blogAddPicture', helper::FILTER_STRING_SHORT), 'picture' => $this->getInput('blogAddPicture', helper::FILTER_STRING_SHORT),
'hidePicture' => $this->getInput('blogAddHidePicture', helper::FILTER_BOOLEAN), 'hidePicture' => $this->getInput('blogAddHidePicture', helper::FILTER_BOOLEAN),
@ -436,13 +437,18 @@ class blog extends common
// Inversion du statut // Inversion du statut
else { else {
$approved = !$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'approval']); $approved = !$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'approval']);
$this->setData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), [ $this->setData([
'module', $this->getUrl(0),
'posts', $this->getUrl(2),
'comment', $this->getUrl(3),
[
'author' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'author']), 'author' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'author']),
'content' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'content']), 'content' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'content']),
'createdOn' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'createdOn']), 'createdOn' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'createdOn']),
'userId' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'userId']), 'userId' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment', $this->getUrl(3), 'userId']),
'approval' => $approved 'approval' => $approved
]]); ]
]);
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
@ -539,7 +545,10 @@ class blog extends common
$this->update(); $this->update();
// Soumission du formulaire // Soumission du formulaire
if ($this->isPost()) { if ($this->isPost()) {
$this->setData(['module', $this->getUrl(0), 'config', [ $this->setData([
'module', $this->getUrl(0),
'config',
[
'feeds' => $this->getInput('blogOptionShowFeeds', helper::FILTER_BOOLEAN), 'feeds' => $this->getInput('blogOptionShowFeeds', helper::FILTER_BOOLEAN),
'feedsLabel' => $this->getInput('blogOptionFeedslabel', helper::FILTER_STRING_SHORT), 'feedsLabel' => $this->getInput('blogOptionFeedslabel', helper::FILTER_STRING_SHORT),
'itemsperPage' => $this->getInput('blogOptionItemsperPage', helper::FILTER_INT, true), 'itemsperPage' => $this->getInput('blogOptionItemsperPage', helper::FILTER_INT, true),
@ -547,7 +556,8 @@ class blog extends common
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']), 'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']),
'dateFormat' => $this->getInput('blogOptionDateFormat'), 'dateFormat' => $this->getInput('blogOptionDateFormat'),
'timeFormat' => $this->getInput('blogOptionTimeFormat'), 'timeFormat' => $this->getInput('blogOptionTimeFormat'),
]]); ]
]);
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/option', 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/option',
@ -634,7 +644,8 @@ class blog extends common
'module', 'module',
$this->getUrl(0), $this->getUrl(0),
'posts', 'posts',
$articleId, [ $articleId,
[
'title' => $this->getInput('blogEditTitle', helper::FILTER_STRING_SHORT, true), 'title' => $this->getInput('blogEditTitle', helper::FILTER_STRING_SHORT, true),
'comment' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment']), 'comment' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(2), 'comment']),
'content' => $this->getInput('blogEditContent', null), 'content' => $this->getInput('blogEditContent', null),
@ -723,13 +734,19 @@ class blog extends common
// Crée le commentaire // Crée le commentaire
$commentId = helper::increment(uniqid(), $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment'])); $commentId = helper::increment(uniqid(), $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment']));
$content = $this->getInput('blogArticleContent', false); $content = $this->getInput('blogArticleContent', false);
$this->setData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentId, [ $this->setData([
'module', $this->getUrl(0),
'posts', $this->getUrl(1),
'comment',
$commentId,
[
'author' => $this->getInput('blogArticleAuthor', helper::FILTER_STRING_SHORT, empty($this->getInput('blogArticleUserId')) ? TRUE : FALSE), 'author' => $this->getInput('blogArticleAuthor', helper::FILTER_STRING_SHORT, empty($this->getInput('blogArticleUserId')) ? TRUE : FALSE),
'content' => $content, 'content' => $content,
'createdOn' => time(), 'createdOn' => time(),
'userId' => $this->getInput('blogArticleUserId'), 'userId' => $this->getInput('blogArticleUserId'),
'approval' => !$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentApproved']) // true commentaire publié false en attente de publication 'approval' => !$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentApproved']) // true commentaire publié false en attente de publication
]]); ]
]);
// Envoi d'une notification aux administrateurs // Envoi d'une notification aux administrateurs
// Init tableau // Init tableau
$to = []; $to = [];
@ -753,7 +770,8 @@ class blog extends common
'L\'article <a href="' . helper::baseUrl() . $this->getUrl(0) . '/ ' . $this->getUrl(1) . '">' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'title']) . '</a> a reçu un nouveau commentaire.<br><br>', 'L\'article <a href="' . helper::baseUrl() . $this->getUrl(0) . '/ ' . $this->getUrl(1) . '">' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'title']) . '</a> a reçu un nouveau commentaire.<br><br>',
'' ''
); );
if ($sent === false) $error++; if ($sent === false)
$error++;
} }
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
@ -774,7 +792,8 @@ class blog extends common
$commentsApproved = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment']); $commentsApproved = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment']);
if ($commentsApproved) { if ($commentsApproved) {
foreach ($commentsApproved as $key => $value) { foreach ($commentsApproved as $key => $value) {
if ($value['approval'] === false) unset($commentsApproved[$key]); if ($value['approval'] === false)
unset($commentsApproved[$key]);
} }
// Ligne suivante si affichage du nombre total de commentaires approuvés sous l'article // Ligne suivante si affichage du nombre total de commentaires approuvés sous l'article
self::$nbCommentsApproved = count($commentsApproved); self::$nbCommentsApproved = count($commentsApproved);
@ -804,6 +823,9 @@ class blog extends common
self::$comments[$commentIds[$i]] = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentIds[$i]]); self::$comments[$commentIds[$i]] = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'comment', $commentIds[$i]]);
} }
} }
// Format de temps
self::$dateFormat = $this->getData(['module', $this->getUrl(0), 'config', 'dateFormat']);
self::$timeFormat = $this->getData(['module', $this->getUrl(0), 'config', 'timeFormat']);
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'showBarEditButton' => true, 'showBarEditButton' => true,

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($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) . ' - ' . helper::dateUTF8($module::$timeFormat, $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($module::$dateFormat, $comment['createdOn']) . ' - ' . helper::dateUTF8($module::$timeFormat, $comment['createdOn']); ?>
</h4> </h4>
<?php echo $comment['content']; ?> <?php echo $comment['content']; ?>
</div> </div>

View File

@ -16,13 +16,13 @@
<div class="block"> <div class="block">
<h4><?php echo helper::translate('Paramètres');?></h4> <h4><?php echo helper::translate('Paramètres');?></h4>
<div class="row"> <div class="row">
<div class="col3"> <div class="col4">
<?php echo template::select('blogOptionArticlesLenght', $module::$articlesLenght, [ <?php echo template::select('blogOptionArticlesLenght', $module::$articlesLenght, [
'label' => 'Disposition', 'label' => 'Disposition',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght']) 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'articlesLenght'])
]); ?> ]); ?>
</div> </div>
<div class="col3"> <div class="col2">
<?php echo template::select('blogOptionItemsperPage', $module::$ArticlesListed, [ <?php echo template::select('blogOptionItemsperPage', $module::$ArticlesListed, [
'label' => 'Articles par page', 'label' => 'Articles par page',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage']) 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage'])