ZwiiCMS/module/blog/view/article/article.php

188 lines
7.6 KiB
PHP
Raw Normal View History

2021-02-16 09:44:04 +01:00
<div class="row">
2021-03-15 16:40:29 +01:00
<div class="col12">
2023-12-20 13:00:50 +01:00
<?php $pictureSize = $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'pictureSize']); ?>
2021-03-15 16:40:29 +01:00
<?php if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'hidePicture']) == false) {
echo '<img class="blogArticlePicture blogArticlePicture' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picturePosition']) .
2022-10-08 17:41:26 +02:00
' pict' . $pictureSize . '" src="' . helper::baseUrl(false) . self::FILE_DIR . 'source/' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) .
'" alt="' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'picture']) . '">';
2021-03-15 16:40:29 +01:00
} ?>
2022-10-08 17:41:26 +02:00
<?php echo $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'content']); ?>
2021-02-16 09:44:04 +01:00
</div>
2021-03-15 16:40:29 +01:00
</div>
<div class="row verticalAlignMiddle">
2023-12-20 13:00:50 +01:00
<div class="col6 textAlignLeft">
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'buttonBack'])): ?>
<a href="<?php echo helper::baseUrl() . $this->getUrl(0); ?>">
<?php echo template::ico('left') . helper::translate('Retour'); ?>
</a>
<?php endif; ?>
</div>
<div class="col6 newsDate textAlignRight">
<!-- bloc signature -->
2024-10-15 14:40:13 +02:00
<?php if (
$this->getData(['module', $this->getUrl(0), 'config', 'showPseudo']) === true
): ?>
<?php echo template::ico('user'); ?>
<?php echo $this->signature($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'userId'])) ?>
<?php endif; ?>
<!-- bloc date -->
<?php if (
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
|| $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
): ?>
<?php echo template::ico('calendar-empty', ['margin' => 'left']); ?>
<?php endif; ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true): ?>
<?php echo helper::dateUTF8($module::$dateFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
<?php endif; ?>
<?php if (
$this->getData(['module', $this->getUrl(0), 'config', 'showDate']) === true
&& $this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true
): ?>
<?php echo '&nbsp;-&nbsp;'; ?>
<?php endif; ?>
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'showTime']) === true): ?>
<?php echo helper::dateUTF8($module::$timeFormat, $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']), self::$i18nUI); ?>
<?php endif; ?>
<!-- Bloc edition -->
2021-02-16 09:44:04 +01:00
<?php if (
2024-09-06 17:32:29 +02:00
$this->isConnected() === true
2022-10-08 17:41:26 +02:00
and
2021-03-15 16:40:29 +01:00
( // Propriétaire
2023-12-20 13:00:50 +01:00
($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'editConsent']) === $module::EDIT_OWNER
and ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'userId']) === $this->getUser('id')
2022-10-08 17:41:26 +02:00
or $this->getUser('group') === self::GROUP_ADMIN)
)
or (
2023-12-20 13:00:50 +01:00
// Groupe
($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'editConsent']) === self::GROUP_ADMIN
or $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'editConsent']) === self::GROUP_EDITOR)
and $this->getUser('group') >= $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'editConsent'])
2022-10-08 17:41:26 +02:00
)
or (
2021-03-15 16:40:29 +01:00
// Tout le monde
2023-12-20 13:00:50 +01:00
$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'editConsent']) === $module::EDIT_ALL
2022-10-08 17:41:26 +02:00
and $this->getUser('group') >= $module::$actions['config']
2021-02-16 09:44:04 +01:00
)
2021-03-15 16:40:29 +01:00
)
2023-12-20 13:00:50 +01:00
): ?>
2023-12-20 13:43:32 +01:00
&nbsp;-&nbsp;
2023-06-19 19:46:00 +02:00
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1); ?>">
2022-10-08 17:41:26 +02:00
<?php echo template::ico('pencil'); ?> Éditer
</a>
<?php endif; ?>
<!-- Bloc RSS-->
2023-12-20 13:00:50 +01:00
<?php if ($this->getData(['module', $this->getUrl(0), 'config', 'feeds'])): ?>
2023-12-20 13:43:32 +01:00
&nbsp;-&nbsp;
<div id="rssFeed">
2023-12-20 13:00:50 +01:00
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?>"
target="_blank">
2022-10-08 17:41:26 +02:00
<img src='module/blog/ressource/feed-icon-16.gif' />
2021-04-11 19:24:50 +02:00
<?php
2022-10-08 17:41:26 +02:00
echo '<p>' . $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel']) . '</p>';
?>
</a>
</div>
2021-02-16 09:44:04 +01:00
<?php endif; ?>
2020-04-27 12:14:42 +02:00
</div>
2021-02-16 09:44:04 +01:00
</div>
2023-12-20 13:00:50 +01:00
<?php if ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentClose'])): ?>
2021-02-16 09:44:04 +01:00
<p>Cet article ne reçoit pas de commentaire.</p>
2023-12-20 13:00:50 +01:00
<?php else: ?>
2022-03-15 16:04:25 +01:00
<div class="row">
<div class="col12" id="comment">
<h3>
<?php
2022-10-08 17:41:26 +02:00
echo template::ico('comment', ['margin' => 'right']);
if ($module::$nbCommentsApproved > 0) {
echo $module::$nbCommentsApproved . ' commentaire' . ($module::$nbCommentsApproved > 1 ? 's' : '');
} else {
2023-12-20 13:00:50 +01:00
echo 'Pas encore de commentaire';
2022-10-08 17:41:26 +02:00
}
2022-03-15 16:04:25 +01:00
?>
</h3>
</div>
</div>
2021-02-16 09:44:04 +01:00
<?php echo template::formOpen('blogArticleForm'); ?>
2022-10-08 17:41:26 +02:00
<?php echo template::text('blogArticleCommentShow', [
'placeholder' => 'Rédiger un commentaire...',
'readonly' => true
]); ?>
<div id="blogArticleCommentWrapper" class="displayNone">
2024-09-06 17:32:29 +02:00
<?php if ($this->isConnected() === true): ?>
2022-10-08 17:41:26 +02:00
<?php echo template::text('blogArticleUserName', [
'label' => 'Nom',
'readonly' => true,
'value' => $module::$editCommentSignature
2021-02-16 09:44:04 +01:00
]); ?>
2022-10-08 17:41:26 +02:00
<?php echo template::hidden('blogArticleUserId', [
'value' => $this->getUser('id')
]); ?>
2023-12-20 13:00:50 +01:00
<?php else: ?>
2021-02-16 09:44:04 +01:00
<div class="row">
2022-10-08 17:41:26 +02:00
<div class="col9">
<?php echo template::text('blogArticleAuthor', [
'label' => 'Nom'
2021-02-16 09:44:04 +01:00
]); ?>
</div>
2022-10-08 17:41:26 +02:00
<div class="col1 textAlignCenter verticalAlignBottom">
<div id="blogArticleOr">Ou</div>
</div>
<div class="col2 verticalAlignBottom">
<?php echo template::button('blogArticleLogin', [
'href' => helper::baseUrl() . 'user/login/' . str_replace('/', '_', $this->getUrl()) . '__comment',
'value' => 'Connexion'
2021-02-16 09:44:04 +01:00
]); ?>
</div>
</div>
2022-10-08 17:41:26 +02:00
<?php endif; ?>
<?php echo template::textarea('blogArticleContent', [
'label' => 'Commentaire avec maximum ' . $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentMaxlength']) . ' caractères',
'class' => 'editorWysiwygComment',
'noDirty' => true,
'maxlength' => $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentMaxlength'])
]); ?>
<div id="blogArticleContentAlarm"> </div>
2024-09-06 17:32:29 +02:00
<?php if ($this->isConnected() === false): ?>
2022-10-08 17:41:26 +02:00
<div class="row">
<div class="col12">
<?php echo template::captcha('blogArticleCaptcha', [
'limit' => $this->getData(['config', 'connect', 'captchaStrong']),
'type' => $this->getData(['config', 'connect', 'captchaType'])
]); ?>
</div>
</div>
<?php endif; ?>
<div class="row">
<div class="col2 offset8">
<?php echo template::button('blogArticleCommentHide', [
'class' => 'buttonGrey',
'value' => 'Annuler'
]); ?>
</div>
<div class="col2">
<?php echo template::submit('blogArticleSubmit', [
'value' => 'Envoyer',
'ico' => ''
]); ?>
</div>
2020-09-02 09:08:27 +02:00
</div>
2022-10-08 17:41:26 +02:00
</div>
<?php endif; ?>
2021-02-16 09:44:04 +01:00
<div class="row">
<div class="col12">
2023-12-20 13:00:50 +01:00
<?php foreach ($module::$comments as $commentId => $comment): ?>
2021-02-16 09:44:04 +01:00
<div class="block">
2022-10-08 17:41:26 +02:00
<h4>
<?php echo template::ico('user'); ?>
<?php echo $module::$commentsSignature[$commentId]; ?>
<?php echo template::ico('calendar-empty'); ?>
2024-01-26 16:34:01 +01:00
<?php echo helper::dateUTF8($module::$dateFormat, $comment['createdOn'], self::$i18nUI) . ' - ' . helper::dateUTF8($module::$timeFormat, $comment['createdOn'], self::$i18nUI); ?>
</h4>
2021-02-16 09:44:04 +01:00
<?php echo $comment['content']; ?>
</div>
<?php endforeach; ?>
2018-04-02 08:29:19 +02:00
</div>
2021-02-16 09:44:04 +01:00
</div>
<?php echo $module::$pages; ?>