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

137 lines
5.7 KiB
PHP
Raw Normal View History

2020-09-02 09:08:27 +02:00
<article>
2020-10-05 09:49:06 +02:00
<div class="row">
2020-09-02 09:08:27 +02:00
<div class="col10">
<div class="blogDate">
<i class="far fa-calendar-alt"></i>
2020-10-03 14:13:27 +02:00
<?php echo strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'publishedOn'])); ?>
2020-10-05 09:50:57 +02:00
à <?php echo strftime('%H:%M', $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'publishedOn'])); ?>
2020-09-02 09:08:27 +02:00
</div>
2020-04-27 12:14:42 +02:00
</div>
2020-10-14 10:29:44 +02:00
<div class="col2">
<?php if (
2020-10-12 19:12:38 +02:00
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
AND
( // Propriétaire
2020-10-12 19:27:53 +02:00
(
2020-10-15 21:13:48 +02:00
$this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER
AND ( $this->getData(['module', $this->getUrl(0), $this->getUrl(1),'userId']) === $this->getUser('id')
OR $this->getUser('group') === self::GROUP_ADMIN )
)
OR (
// Groupe
2020-10-16 16:59:13 +02:00
( $this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) === self::GROUP_ADMIN
OR $this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) === self::GROUP_MODERATOR)
2020-10-15 21:13:48 +02:00
AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), $this->getUrl(1),'editConsent'])
2020-10-12 19:12:38 +02:00
)
2020-10-14 11:07:38 +02:00
OR (
2020-10-15 21:13:48 +02:00
// Tout le monde
$this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) === $module::EDIT_ALL
2020-10-16 16:59:13 +02:00
AND $this->getUser('group') >= $module::$actions['config']
2020-10-15 21:13:48 +02:00
)
2020-10-14 11:07:38 +02:00
)
2020-10-05 09:50:57 +02:00
): ?>
2020-10-12 19:12:38 +02:00
<?php echo template::button('blogEdit', [
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1) . '/' . $_SESSION['csrf'],
'value' => 'Editer'
]); ?>
2020-10-14 10:29:44 +02:00
<?php endif; ?>
</div>
2020-04-27 12:14:42 +02:00
</div>
2020-09-02 09:08:27 +02:00
<?php $pictureSize = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'pictureSize']); ?>
<?php if ($this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'hidePicture']) == false) {
echo '<img class="blogArticlePicture blogArticlePicture' . $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'picturePosition']) .
' pict' . $pictureSize . '" src="' . helper::baseUrl(false) . self::FILE_DIR.'source/' . $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'picture']) .
'" alt="' . $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'picture']) . '">';
} ?>
<?php echo $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'content']); ?>
<p class="clearBoth signature"><?php echo $module::$articleSignature;?></p>
2020-10-16 16:59:13 +02:00
<?php if($this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'commentClose'])): ?>
2020-09-02 09:08:27 +02:00
<p>Cet article ne reçoit pas de commentaire.</p>
<?php else: ?>
<h3 id="comment">
2020-10-07 19:06:40 +02:00
<?php //$commentsNb = count($module::$comments); ?>
<?php $commentsNb = $module::$nbCommentsApproved; ?>
2020-09-02 09:08:27 +02:00
<?php $s = $commentsNb === 1 ? '': 's' ?>
<?php echo $commentsNb > 0 ? $commentsNb . ' ' . 'commentaire' . $s : 'Pas encore de commentaire'; ?>
</h3>
<?php echo template::formOpen('blogArticleForm'); ?>
<?php echo template::text('blogArticleCommentShow', [
'placeholder' => 'Rédiger un commentaire...',
'readonly' => true
2020-04-27 12:14:42 +02:00
]); ?>
2020-09-02 09:08:27 +02:00
<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
]); ?>
<?php echo template::hidden('blogArticleUserId', [
'value' => $this->getUser('id')
]); ?>
<?php else: ?>
<div class="row">
<div class="col9">
<?php echo template::text('blogArticleAuthor', [
'label' => 'Nom'
]); ?>
</div>
<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'
]); ?>
</div>
</div>
<?php endif; ?>
<?php echo template::textarea('blogArticleContent', [
'label' => 'Commentaire avec maximum '.$this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'commentMaxlength']).' caractères',
'class' => 'editorWysiwygComment',
'noDirty' => true,
'maxlength' => $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'commentMaxlength'])
2018-04-02 08:29:19 +02:00
]); ?>
2020-09-02 09:08:27 +02:00
<div id="blogArticleContentAlarm"> </div>
<?php if($this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')): ?>
<div class="row">
2020-10-05 09:49:06 +02:00
<div class="col12">
2020-10-11 19:29:33 +02:00
<?php echo template::captcha('blogArticleCaptcha', [
'limit' => $this->getData(['config','connect','captcha10'])
2020-10-11 19:29:33 +02:00
]); ?>
2020-09-02 09:08:27 +02:00
</div>
</div>
<?php endif; ?>
2018-04-02 08:29:19 +02:00
<div class="row">
2020-09-02 09:08:27 +02:00
<div class="col2 offset8">
<?php echo template::button('blogArticleCommentHide', [
'class' => 'buttonGrey',
'value' => 'Annuler'
2018-04-02 08:29:19 +02:00
]); ?>
</div>
2020-09-02 09:08:27 +02:00
<div class="col2">
<?php echo template::submit('blogArticleSubmit', [
'value' => 'Envoyer',
'ico' => ''
2018-04-02 08:29:19 +02:00
]); ?>
</div>
</div>
</div>
2020-09-02 09:08:27 +02:00
<?php echo template::formClose(); ?>
<?php endif;?>
2020-04-27 12:14:42 +02:00
2020-09-02 09:08:27 +02:00
<div class="row">
<div class="col12">
<?php foreach($module::$comments as $commentId => $comment): ?>
<div class="block">
<h4><?php echo $module::$commentsSignature[$commentId]; ?>
2020-10-03 14:13:27 +02:00
le <?php echo strftime('%d %B %Y - %H:%M', $comment['createdOn']); ?>
2020-09-02 09:08:27 +02:00
</h4>
<?php echo $comment['content']; ?>
</div>
<?php endforeach; ?>
</div>
2018-04-02 08:29:19 +02:00
</div>
2020-09-02 09:08:27 +02:00
<?php echo $module::$pages; ?>
</article>