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

164 lines
7.1 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">
<?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']); ?>
<?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']) .
' 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']) . '">';
} ?>
<?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">
<div class="col12 blogDate">
2021-03-15 16:40:29 +01:00
<!-- bloc signature et date -->
<?php echo $module::$articleSignature . ' - ';?>
2022-02-04 09:12:07 +01:00
<?php echo template::ico('calendar-empty'); ?>
2022-10-05 15:19:19 +02:00
<?php $date = mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
? \PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
: utf8_encode(\PHP81_BC\strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
$heure = mb_detect_encoding(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
? \PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))
: utf8_encode(\PHP81_BC\strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])));
2021-04-11 19:24:50 +02:00
echo $date . ' à ' . $heure;
2021-03-15 16:40:29 +01:00
?>
<!-- Bloc edition -->
2021-02-16 09:44:04 +01:00
<?php if (
2021-04-11 19:24:50 +02:00
2021-03-15 16:40:29 +01:00
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
AND
( // Propriétaire
(
$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')
OR $this->getUser('group') === self::GROUP_ADMIN )
)
OR (
// 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_MODERATOR)
AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts', $this->getUrl(1),'editConsent'])
)
OR (
// Tout le monde
$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1),'editConsent']) === $module::EDIT_ALL
AND $this->getUser('group') >= $module::$actions['config']
2021-02-16 09:44:04 +01:00
)
2021-03-15 16:40:29 +01:00
)
): ?>
<a href ="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1) . '/' . $_SESSION['csrf'];?>">
2022-10-02 10:59:42 +02:00
<?php echo template::ico('pencil');?> Éditer
2021-03-15 16:40:29 +01:00
</a>
<?php endif; ?>
<!-- Bloc RSS-->
<?php if ($this->getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?>
<div id="rssFeed">
2021-04-02 15:24:30 +02:00
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?>" target="_blank">
2022-06-02 11:31:40 +02:00
<img src='module/blog/ressource/feed-icon-16.gif' />
2021-04-11 19:24:50 +02:00
<?php
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>
<?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: ?>
2022-03-15 16:04:25 +01:00
<div class="row">
<div class="col12" id="comment">
<h3>
<?php
2022-09-02 18:14:42 +02:00
echo template::ico('comment', ['margin' => 'right']);
2022-03-15 16:04:25 +01:00
if ($module::$nbCommentsApproved > 0) {
echo $module::$nbCommentsApproved . ' commentaire' . ($module::$nbCommentsApproved > 1 ? 's' : '');
} else {
echo 'Pas encore de commentaire';
}
?>
</h3>
</div>
</div>
2021-02-16 09:44:04 +01:00
<?php echo template::formOpen('blogArticleForm'); ?>
<?php echo template::text('blogArticleCommentShow', [
'placeholder' => 'Rédiger un commentaire...',
'readonly' => true
]); ?>
<div id="blogArticleCommentWrapper" class="displayNone">
<?php if($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')): ?>
<?php echo template::text('blogArticleUserName', [
'label' => 'Nom',
'readonly' => true,
'value' => $module::$editCommentSignature
2018-04-02 08:29:19 +02:00
]); ?>
2021-02-16 09:44:04 +01:00
<?php echo template::hidden('blogArticleUserId', [
'value' => $this->getUser('id')
]); ?>
<?php else: ?>
2018-04-02 08:29:19 +02:00
<div class="row">
2021-02-16 09:44:04 +01:00
<div class="col9">
<?php echo template::text('blogArticleAuthor', [
'label' => 'Nom'
2018-04-02 08:29:19 +02:00
]); ?>
</div>
2021-02-16 09:44:04 +01: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'
2018-04-02 08:29:19 +02:00
]); ?>
</div>
</div>
2021-02-16 09:44:04 +01: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>
<?php if($this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')): ?>
<div class="row">
<div class="col12">
<?php echo template::captcha('blogArticleCaptcha', [
2021-11-12 18:22:06 +01:00
'limit' => $this->getData(['config','connect', 'captchaStrong']),
'type' => $this->getData(['config','connect', 'captchaType'])
2021-02-16 09:44:04 +01:00
]); ?>
</div>
2020-09-02 09:08:27 +02:00
</div>
2021-02-16 09:44:04 +01:00
<?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>
</div>
2020-09-02 09:08:27 +02:00
</div>
2021-02-16 09:44:04 +01:00
<?php endif;?>
<div class="row">
<div class="col12">
<?php foreach($module::$comments as $commentId => $comment): ?>
<div class="block">
<h4><?php echo $module::$commentsSignature[$commentId]; ?>
2022-10-05 15:19:19 +02:00
le <?php echo mb_detect_encoding(\PHP81_BC\strftime('%d %B %Y - %H:%M', $comment['createdOn']), 'UTF-8', true)
? \PHP81_BC\strftime('%d %B %Y - %H:%M', $comment['createdOn'])
: utf8_encode(\PHP81_BC\strftime('%d %B %Y - %H:%M', $comment['createdOn']));
2021-02-16 09:44:04 +01:00
?>
</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; ?>