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

112 lines
4.6 KiB
PHP
Raw Normal View History

2020-04-27 12:14:42 +02:00
<div class="row">
<div class="col10">
<div class="blogDate">
<i class="far fa-calendar-alt"></i>
<?php echo utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'publishedOn']))); ?>
2020-07-02 19:48:47 +02:00
à <?php echo utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'publishedOn']))); ?>
2020-04-27 12:14:42 +02:00
</div>
</div>
<?php if($this->getUser('group') >= self::GROUP_ADMIN): ?>
<div class="col2">
<?php echo template::button('blogEdit', [
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1) . '/' . $_SESSION['csrf'],
'value' => 'Editer'
]); ?>
</div>
<?php endif; ?>
2019-02-22 22:38:06 +01:00
</div>
2020-04-27 12:14:42 +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']); ?>
2019-02-22 22:38:06 +01:00
<?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']) .
2020-07-02 19:48:47 +02:00
' 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']) . '">';
2019-02-22 22:38:06 +01:00
} ?>
2018-04-02 08:29:19 +02:00
<?php echo $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'content']); ?>
2020-07-02 19:48:47 +02:00
<p class="clearBoth signature"><?php echo $module::$articleSignature;?></p>
2018-04-02 08:29:19 +02:00
<?php if($this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'closeComment'])): ?>
2020-04-27 12:14:42 +02:00
<p>Cet article ne reçoit pas de commentaire.</p>
2018-04-02 08:29:19 +02:00
<?php else: ?>
2020-04-27 12:14:42 +02:00
<h3 id="comment">
<?php $commentsNb = count($this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment'])); ?>
<?php $s = $commentsNb === 1 ? '': 's' ?>
<?php echo $commentsNb > 0 ? $commentsNb . ' ' . 'commentaire' . $s : 'Pas encore de commentaire'; ?>
</h3>
2018-04-02 08:29:19 +02:00
<?php echo template::formOpen('blogArticleForm'); ?>
<?php echo template::text('blogArticleCommentShow', [
'placeholder' => 'Rédiger un commentaire...',
'readonly' => true
]); ?>
<div id="blogArticleCommentWrapper" class="displayNone">
2020-07-02 19:48:47 +02:00
<?php if($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')): ?>
2018-04-02 08:29:19 +02:00
<?php echo template::text('blogArticleUserName', [
'label' => 'Nom',
'readonly' => true,
2020-07-02 19:48:47 +02:00
'value' => $module::$editCommentSignature
2018-04-02 08:29:19 +02:00
]); ?>
<?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', [
2020-07-16 09:21:57 +02:00
'label' => 'Commentaire avec maximum '.$this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'commentMaxlength']).' caractères',
2020-07-02 19:48:47 +02:00
'class' => 'editorWysiwygComment',
2020-07-06 12:24:06 +02:00
'noDirty' => true,
2020-07-16 09:21:57 +02:00
'maxlength' => $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'commentMaxlength'])
2018-04-02 08:29:19 +02:00
]); ?>
2020-07-02 19:48:47 +02:00
<div id="blogArticleContentAlarm"> </div>
2018-04-02 08:29:19 +02:00
<?php if($this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')): ?>
<div class="row">
<div class="col4">
<?php echo template::capcha('blogArticleCapcha'); ?>
</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>
</div>
</div>
<?php echo template::formClose(); ?>
<?php endif;?>
2020-04-27 12:14:42 +02:00
2018-04-02 08:29:19 +02:00
<div class="row">
<div class="col12">
<?php foreach($module::$comments as $commentId => $comment): ?>
<div class="block">
2020-07-02 19:48:47 +02:00
<h4><?php echo $module::$commentsSignature[$commentId]; ?>
2019-12-03 18:19:34 +01:00
le <?php echo utf8_encode(strftime('%d %B %Y - %H:%M', $comment['createdOn'])); ?>
2018-04-02 08:29:19 +02:00
</h4>
<?php echo $comment['content']; ?>
</div>
<?php endforeach; ?>
</div>
</div>
<?php echo $module::$pages; ?>