Merge blog folder
This commit is contained in:
parent
23a1e929a3
commit
457b536fca
162
module/blog/blog.php
Normal file → Executable file
162
module/blog/blog.php
Normal file → Executable file
@ -18,6 +18,7 @@ class blog extends common {
|
|||||||
'add' => self::GROUP_MODERATOR,
|
'add' => self::GROUP_MODERATOR,
|
||||||
'comment' => self::GROUP_MODERATOR,
|
'comment' => self::GROUP_MODERATOR,
|
||||||
'commentDelete' => self::GROUP_MODERATOR,
|
'commentDelete' => self::GROUP_MODERATOR,
|
||||||
|
'commentDeleteAll' => self::GROUP_MODERATOR,
|
||||||
'config' => self::GROUP_MODERATOR,
|
'config' => self::GROUP_MODERATOR,
|
||||||
'delete' => self::GROUP_MODERATOR,
|
'delete' => self::GROUP_MODERATOR,
|
||||||
'edit' => self::GROUP_MODERATOR,
|
'edit' => self::GROUP_MODERATOR,
|
||||||
@ -26,8 +27,21 @@ class blog extends common {
|
|||||||
|
|
||||||
public static $articles = [];
|
public static $articles = [];
|
||||||
|
|
||||||
|
// Signature de l'article
|
||||||
|
public static $articleSignature = '';
|
||||||
|
|
||||||
|
// Signature du commentaire
|
||||||
|
public static $editCommentSignature = '';
|
||||||
|
|
||||||
public static $comments = [];
|
public static $comments = [];
|
||||||
|
|
||||||
|
public static $messageComments;
|
||||||
|
|
||||||
|
public static $commentsDelete;
|
||||||
|
|
||||||
|
// Signatures des commentaires déjà saisis
|
||||||
|
public static $commentsSignature = [];
|
||||||
|
|
||||||
public static $pages;
|
public static $pages;
|
||||||
|
|
||||||
public static $states = [
|
public static $states = [
|
||||||
@ -48,10 +62,18 @@ class blog extends common {
|
|||||||
'right' => 'À droite ',
|
'right' => 'À droite ',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
//Paramètre longueur maximale des commentaires en nb de caractères
|
||||||
|
public static $longueur_comment = [
|
||||||
|
'500' => '500',
|
||||||
|
'1000' => '1000',
|
||||||
|
'2000' => '2000',
|
||||||
|
'5000' => '5000',
|
||||||
|
'10000' => '10000'
|
||||||
|
];
|
||||||
|
|
||||||
public static $users = [];
|
public static $users = [];
|
||||||
|
|
||||||
const BLOG_VERSION = '2.02';
|
const BLOG_VERSION = '2.04';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Édition
|
* Édition
|
||||||
@ -59,6 +81,13 @@ class blog extends common {
|
|||||||
public function add() {
|
public function add() {
|
||||||
// Soumission du formulaire
|
// Soumission du formulaire
|
||||||
if($this->isPost()) {
|
if($this->isPost()) {
|
||||||
|
// Modification de l'userId
|
||||||
|
if($this->getUser('group') === self::GROUP_ADMIN){
|
||||||
|
$newuserid = $this->getInput('blogAddUserId', helper::FILTER_STRING_SHORT, true);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$newuserid = $this->getUser('id');
|
||||||
|
}
|
||||||
// Incrémente l'id de l'article
|
// Incrémente l'id de l'article
|
||||||
$articleId = helper::increment($this->getInput('blogAddTitle', helper::FILTER_ID), $this->getData(['page']));
|
$articleId = helper::increment($this->getInput('blogAddTitle', helper::FILTER_ID), $this->getData(['page']));
|
||||||
$articleId = helper::increment($articleId, (array) $this->getData(['module', $this->getUrl(0)]));
|
$articleId = helper::increment($articleId, (array) $this->getData(['module', $this->getUrl(0)]));
|
||||||
@ -77,7 +106,8 @@ class blog extends common {
|
|||||||
'publishedOn' => $this->getInput('blogAddPublishedOn', helper::FILTER_DATETIME, true),
|
'publishedOn' => $this->getInput('blogAddPublishedOn', helper::FILTER_DATETIME, true),
|
||||||
'state' => $this->getInput('blogAddState', helper::FILTER_BOOLEAN),
|
'state' => $this->getInput('blogAddState', helper::FILTER_BOOLEAN),
|
||||||
'title' => $this->getInput('blogAddTitle', helper::FILTER_STRING_SHORT, true),
|
'title' => $this->getInput('blogAddTitle', helper::FILTER_STRING_SHORT, true),
|
||||||
'userId' => $this->getInput('blogAddUserId', helper::FILTER_ID, true)
|
'userId' => $newuserid,
|
||||||
|
'maxlengthcomment' => $this->getInput('blogAddlength', null)
|
||||||
]]);
|
]]);
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
@ -108,14 +138,14 @@ class blog extends common {
|
|||||||
* Liste des commentaires
|
* Liste des commentaires
|
||||||
*/
|
*/
|
||||||
public function comment() {
|
public function comment() {
|
||||||
// Liste les commentaires
|
$comments = $this->getData(['module', $this->getUrl(0), $this->getUrl(2),'comment']);
|
||||||
$comments = [];
|
self::$messageComments = '<h2>Commentaires de l\'article '. $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'title']).'</h2>';
|
||||||
foreach((array) $this->getData(['module', $this->getUrl(0)]) as $articleId => $article) {
|
self::$commentsDelete = template::button('blogCommentDeleteAll', [
|
||||||
foreach($article['comment'] as &$comment) {
|
'class' => 'blogCommentDeleteAll buttonRed',
|
||||||
$comment['articleId'] = $articleId;
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/commentDeleteAll/' . $this->getUrl(2).'/' . $_SESSION['csrf'] ,
|
||||||
}
|
'ico' => 'cancel',
|
||||||
$comments += $article['comment'];
|
'value' => 'Tout effacer'
|
||||||
}
|
]);
|
||||||
// Ids des commentaires par ordre de création
|
// Ids des commentaires par ordre de création
|
||||||
$commentIds = array_keys(helper::arrayCollumn($comments, 'createdOn', 'SORT_DESC'));
|
$commentIds = array_keys(helper::arrayCollumn($comments, 'createdOn', 'SORT_DESC'));
|
||||||
// Pagination
|
// Pagination
|
||||||
@ -132,7 +162,7 @@ class blog extends common {
|
|||||||
$comment['userId'] ? $this->getData(['user', $comment['userId'], 'firstname']) . ' ' . $this->getData(['user', $comment['userId'], 'lastname']) : $comment['author'],
|
$comment['userId'] ? $this->getData(['user', $comment['userId'], 'firstname']) . ' ' . $this->getData(['user', $comment['userId'], 'lastname']) : $comment['author'],
|
||||||
template::button('blogCommentDelete' . $commentIds[$i], [
|
template::button('blogCommentDelete' . $commentIds[$i], [
|
||||||
'class' => 'blogCommentDelete buttonRed',
|
'class' => 'blogCommentDelete buttonRed',
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/comment-delete/' . $comment['articleId'] . '/' . $commentIds[$i] . '/' . $_SESSION['csrf'] ,
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/commentDelete/' . $this->getUrl(2) . '/' . $commentIds[$i] . '/' . $_SESSION['csrf'] ,
|
||||||
'value' => template::ico('cancel')
|
'value' => template::ico('cancel')
|
||||||
])
|
])
|
||||||
];
|
];
|
||||||
@ -168,13 +198,37 @@ class blog extends common {
|
|||||||
$this->deleteData(['module', $this->getUrl(0), $this->getUrl(2), 'comment', $this->getUrl(3)]);
|
$this->deleteData(['module', $this->getUrl(0), $this->getUrl(2), 'comment', $this->getUrl(3)]);
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/comment',
|
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/comment/'.$this->getUrl(2),
|
||||||
'notification' => 'Commentaire supprimé',
|
'notification' => 'Commentaire supprimé',
|
||||||
'state' => true
|
'state' => true
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Suppression de tous les commentaires de l'article $this->getUrl(2)
|
||||||
|
*/
|
||||||
|
public function commentDeleteAll() {
|
||||||
|
// Jeton incorrect
|
||||||
|
if ($this->getUrl(3) !== $_SESSION['csrf']) {
|
||||||
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
|
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||||
|
'notification' => 'Action non autorisée'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
// Suppression
|
||||||
|
else {
|
||||||
|
$this->setData(['module', $this->getUrl(0), $this->getUrl(2), 'comment',[] ]);
|
||||||
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
|
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/comment',
|
||||||
|
'notification' => 'Commentaires supprimés',
|
||||||
|
'state' => true
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration
|
* Configuration
|
||||||
*/
|
*/
|
||||||
@ -195,6 +249,12 @@ class blog extends common {
|
|||||||
.' à '.
|
.' à '.
|
||||||
utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), $articleIds[$i], 'publishedOn']))),
|
utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), $articleIds[$i], 'publishedOn']))),
|
||||||
self::$states[$this->getData(['module', $this->getUrl(0), $articleIds[$i], 'state'])],
|
self::$states[$this->getData(['module', $this->getUrl(0), $articleIds[$i], 'state'])],
|
||||||
|
// Bouton pour afficher les commentaires de l'article
|
||||||
|
template::button('blogConfigComment' . $articleIds[$i], [
|
||||||
|
'class' => 'buttonGrey',
|
||||||
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/comment/' . $articleIds[$i],
|
||||||
|
'value' => count($this->getData(['module', $this->getUrl(0), $articleIds[$i],'comment']))
|
||||||
|
]),
|
||||||
template::button('blogConfigEdit' . $articleIds[$i], [
|
template::button('blogConfigEdit' . $articleIds[$i], [
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $articleIds[$i] . '/' . $_SESSION['csrf'],
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $articleIds[$i] . '/' . $_SESSION['csrf'],
|
||||||
'value' => template::ico('pencil')
|
'value' => template::ico('pencil')
|
||||||
@ -266,6 +326,12 @@ class blog extends common {
|
|||||||
else {
|
else {
|
||||||
// Soumission du formulaire
|
// Soumission du formulaire
|
||||||
if($this->isPost()) {
|
if($this->isPost()) {
|
||||||
|
if($this->getUser('group') === self::GROUP_ADMIN){
|
||||||
|
$newuserid = $this->getInput('blogEditUserId', helper::FILTER_STRING_SHORT, true);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$newuserid = $this->getUser('id');
|
||||||
|
}
|
||||||
$articleId = $this->getInput('blogEditTitle', helper::FILTER_ID, true);
|
$articleId = $this->getInput('blogEditTitle', helper::FILTER_ID, true);
|
||||||
// Incrémente le nouvel id de l'article
|
// Incrémente le nouvel id de l'article
|
||||||
if($articleId !== $this->getUrl(2)) {
|
if($articleId !== $this->getUrl(2)) {
|
||||||
@ -286,7 +352,8 @@ class blog extends common {
|
|||||||
'publishedOn' => $this->getInput('blogEditPublishedOn', helper::FILTER_DATETIME, true),
|
'publishedOn' => $this->getInput('blogEditPublishedOn', helper::FILTER_DATETIME, true),
|
||||||
'state' => $this->getInput('blogEditState', helper::FILTER_BOOLEAN),
|
'state' => $this->getInput('blogEditState', helper::FILTER_BOOLEAN),
|
||||||
'title' => $this->getInput('blogEditTitle', helper::FILTER_STRING_SHORT, true),
|
'title' => $this->getInput('blogEditTitle', helper::FILTER_STRING_SHORT, true),
|
||||||
'userId' => $this->getInput('blogEditUserId', helper::FILTER_ID, true)
|
'userId' => $newuserid,
|
||||||
|
'maxlengthcomment' => $this->getInput('blogEditlength', null)
|
||||||
]]);
|
]]);
|
||||||
// Supprime l'ancien article
|
// Supprime l'ancien article
|
||||||
if($articleId !== $this->getUrl(2)) {
|
if($articleId !== $this->getUrl(2)) {
|
||||||
@ -350,7 +417,7 @@ class blog extends common {
|
|||||||
$commentId = helper::increment(uniqid(), $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment']));
|
$commentId = helper::increment(uniqid(), $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment']));
|
||||||
$this->setData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentId, [
|
$this->setData(['module', $this->getUrl(0), $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' => $this->getInput('blogArticleContent', helper::FILTER_STRING_SHORT, true),
|
'content' => $this->getInput('blogArticleContent', false),
|
||||||
'createdOn' => time(),
|
'createdOn' => time(),
|
||||||
'userId' => $this->getInput('blogArticleUserId'),
|
'userId' => $this->getInput('blogArticleUserId'),
|
||||||
]]);
|
]]);
|
||||||
@ -370,7 +437,8 @@ class blog extends common {
|
|||||||
$to,
|
$to,
|
||||||
'Nouveau commentaire',
|
'Nouveau commentaire',
|
||||||
'Bonjour' . ' <strong>' . $user['firstname'] . ' ' . $user['lastname'] . '</strong>,<br><br>' .
|
'Bonjour' . ' <strong>' . $user['firstname'] . ' ' . $user['lastname'] . '</strong>,<br><br>' .
|
||||||
'Nouveau commentaire déposé sur la page "' . $this->getData(['page', $this->getUrl(0), 'title']) . '" :<br><br>',
|
'Nouveau commentaire déposé sur la page "' . $this->getData(['page', $this->getUrl(0), 'title']) . '" :<br><br>'.
|
||||||
|
$this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentId, 'content']),
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
@ -398,14 +466,76 @@ class blog extends common {
|
|||||||
$pagination = helper::pagination($commentIds, $this->getUrl(),$this->getData(['config','itemsperPage']),'#comment');
|
$pagination = helper::pagination($commentIds, $this->getUrl(),$this->getData(['config','itemsperPage']),'#comment');
|
||||||
// Liste des pages
|
// Liste des pages
|
||||||
self::$pages = $pagination['pages'];
|
self::$pages = $pagination['pages'];
|
||||||
|
// Signature de l'article
|
||||||
|
$userIdArticle = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'userId']);
|
||||||
|
switch ($this->getData(['user', $userIdArticle, 'signature'])){
|
||||||
|
case 1:
|
||||||
|
self::$articleSignature = $userIdArticle;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
self::$articleSignature = $this->getData(['user', $userIdArticle, 'pseudo']);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
self::$articleSignature = $this->getData(['user', $userIdArticle, 'firstname']) . ' ' . $this->getData(['user', $userIdArticle, 'lastname']);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
self::$articleSignature = $this->getData(['user', $userIdArticle, 'lastname']) . ' ' . $this->getData(['user', $userIdArticle, 'firstname']);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
self::$articleSignature = $this->getData(['user', $userIdArticle, 'firstname']);
|
||||||
|
}
|
||||||
|
// Signature du commentaire édité
|
||||||
|
if($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')) {
|
||||||
|
$useridcomment = $this->getUser('id');
|
||||||
|
switch ($this->getData(['user', $useridcomment, 'signature'])){
|
||||||
|
case 1:
|
||||||
|
self::$editCommentSignature = $useridcomment;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
self::$editCommentSignature = $this->getData(['user', $useridcomment, 'pseudo']);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
self::$editCommentSignature = $this->getData(['user', $useridcomment, 'firstname']) . ' ' . $this->getData(['user', $useridcomment, 'lastname']);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
self::$editCommentSignature = $this->getData(['user', $useridcomment, 'lastname']) . ' ' . $this->getData(['user', $useridcomment, 'firstname']);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
self::$editCommentSignature = $this->getData(['user', $useridcomment, 'firstname']);
|
||||||
|
}
|
||||||
|
}
|
||||||
// Commentaires en fonction de la pagination
|
// Commentaires en fonction de la pagination
|
||||||
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
||||||
|
// Signatures des commentaires
|
||||||
|
$e = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentIds[$i],'userId']);
|
||||||
|
if ($e) {
|
||||||
|
switch ($this->getData(['user', $e, 'signature'])){
|
||||||
|
case 1:
|
||||||
|
self::$commentsSignature[$commentIds[$i]] = $e;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
self::$commentsSignature[$commentIds[$i]] = $this->getData(['user', $e, 'pseudo']);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
self::$commentsSignature[$commentIds[$i]] = $this->getData(['user', $e, 'firstname']) . ' ' . $this->getData(['user', $e, 'lastname']);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
self::$commentsSignature[$commentIds[$i]] = $this->getData(['user', $e, 'lastname']) . ' ' . $this->getData(['user', $e, 'firstname']);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
self::$commentsSignature[$commentIds[$i]] = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentIds[$i],'author']);
|
||||||
|
}
|
||||||
|
// Données du commentaire
|
||||||
self::$comments[$commentIds[$i]] = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentIds[$i]]);
|
self::$comments[$commentIds[$i]] = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentIds[$i]]);
|
||||||
}
|
}
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'showBarEditButton' => true,
|
'showBarEditButton' => true,
|
||||||
'title' => $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'title']),
|
'title' => $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'title']),
|
||||||
|
'vendor' => [
|
||||||
|
'tinymce'
|
||||||
|
],
|
||||||
'view' => 'article'
|
'view' => 'article'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -438,4 +568,4 @@ class blog extends common {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
10
module/blog/view/add/add.php
Normal file → Executable file
10
module/blog/view/add/add.php
Normal file → Executable file
@ -73,7 +73,8 @@
|
|||||||
<h4>Options de publication</h4>
|
<h4>Options de publication</h4>
|
||||||
<?php echo template::select('blogAddUserId', $module::$users, [
|
<?php echo template::select('blogAddUserId', $module::$users, [
|
||||||
'label' => 'Auteur',
|
'label' => 'Auteur',
|
||||||
'selected' => $this->getUser('id')
|
'selected' => $this->getUser('id'),
|
||||||
|
'disabled' => $this->getUser('group') !== self::GROUP_ADMIN ? true : false
|
||||||
]); ?>
|
]); ?>
|
||||||
<?php echo template::date('blogAddPublishedOn', [
|
<?php echo template::date('blogAddPublishedOn', [
|
||||||
'help' => 'L\'article n\'est visible qu\'après la date de publication prévue.',
|
'help' => 'L\'article n\'est visible qu\'après la date de publication prévue.',
|
||||||
@ -85,6 +86,11 @@
|
|||||||
<div class="col6">
|
<div class="col6">
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<h4>Options avancées</h4>
|
<h4>Options avancées</h4>
|
||||||
|
<?php echo template::select('blogAddlength', $module::$longueur_comment,[
|
||||||
|
'help' => 'Choix du nombre maximum de caractères pour chaque commentaire de l\'article, caractères de mise en forme html inclus.',
|
||||||
|
'label' => 'Nombre maximum de caractères pour chaque commentaire',
|
||||||
|
'selected' => '5000'
|
||||||
|
]); ?>
|
||||||
<?php echo template::checkbox('blogAddCloseComment', true, 'Fermer les commentaires' ); ?>
|
<?php echo template::checkbox('blogAddCloseComment', true, 'Fermer les commentaires' ); ?>
|
||||||
<?php echo template::checkbox('blogAddMailNotification', true, 'Notifier le commentaire aux groupes à partir de :', [
|
<?php echo template::checkbox('blogAddMailNotification', true, 'Notifier le commentaire aux groupes à partir de :', [
|
||||||
'help' => 'Editeurs = éditeurs + administrateurs<br/> Membres = membres + éditeurs + administrateurs'
|
'help' => 'Editeurs = éditeurs + administrateurs<br/> Membres = membres + éditeurs + administrateurs'
|
||||||
@ -95,4 +101,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php echo template::formClose(); ?>
|
<?php echo template::formClose(); ?>
|
||||||
|
@ -50,6 +50,4 @@
|
|||||||
.blogArticlePicture {
|
.blogArticlePicture {
|
||||||
height:auto;
|
height:auto;
|
||||||
max-width: 100%;}
|
max-width: 100%;}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
27
module/blog/view/article/article.php
Normal file → Executable file
27
module/blog/view/article/article.php
Normal file → Executable file
@ -3,7 +3,7 @@
|
|||||||
<div class="blogDate">
|
<div class="blogDate">
|
||||||
<i class="far fa-calendar-alt"></i>
|
<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']))); ?>
|
<?php echo utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'publishedOn']))); ?>
|
||||||
à <?php echo utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'publishedOn']))); ?>
|
à <?php echo utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'publishedOn']))); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php if($this->getUser('group') >= self::GROUP_ADMIN): ?>
|
<?php if($this->getUser('group') >= self::GROUP_ADMIN): ?>
|
||||||
@ -18,15 +18,11 @@
|
|||||||
<?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 $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) {
|
<?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']) .
|
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']) .
|
' 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']) . '">';
|
'" alt="' . $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'picture']) . '">';
|
||||||
} ?>
|
} ?>
|
||||||
|
|
||||||
<?php echo $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'content']); ?>
|
<?php echo $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'content']); ?>
|
||||||
<p class="clearBoth signature">
|
<p class="clearBoth signature"><?php echo $module::$articleSignature;?></p>
|
||||||
<?php echo $this->getData(['user', $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'userId']), 'firstname']); ?>
|
|
||||||
<?php echo $this->getData(['user', $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'userId']), 'lastname']); ?>
|
|
||||||
</p>
|
|
||||||
<?php if($this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'closeComment'])): ?>
|
<?php if($this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'closeComment'])): ?>
|
||||||
<p>Cet article ne reçoit pas de commentaire.</p>
|
<p>Cet article ne reçoit pas de commentaire.</p>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
@ -41,11 +37,11 @@
|
|||||||
'readonly' => true
|
'readonly' => true
|
||||||
]); ?>
|
]); ?>
|
||||||
<div id="blogArticleCommentWrapper" class="displayNone">
|
<div id="blogArticleCommentWrapper" class="displayNone">
|
||||||
<?php if($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')): ?>
|
<?php if($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')): ?>
|
||||||
<?php echo template::text('blogArticleUserName', [
|
<?php echo template::text('blogArticleUserName', [
|
||||||
'label' => 'Nom',
|
'label' => 'Nom',
|
||||||
'readonly' => true,
|
'readonly' => true,
|
||||||
'value' => $this->getUser('firstname') . ' ' . $this->getUser('lastname')
|
'value' => $module::$editCommentSignature
|
||||||
]); ?>
|
]); ?>
|
||||||
<?php echo template::hidden('blogArticleUserId', [
|
<?php echo template::hidden('blogArticleUserId', [
|
||||||
'value' => $this->getUser('id')
|
'value' => $this->getUser('id')
|
||||||
@ -69,9 +65,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php echo template::textarea('blogArticleContent', [
|
<?php echo template::textarea('blogArticleContent', [
|
||||||
'label' => 'Commentaire',
|
'label' => 'Commentaire avec maximum '.$this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'maxlengthcomment']).' caractères',
|
||||||
'maxlength' => '500'
|
'class' => 'editorWysiwygComment',
|
||||||
|
'maxlength' => $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'maxlengthcomment'])
|
||||||
]); ?>
|
]); ?>
|
||||||
|
<div id="blogArticleContentAlarm"> </div>
|
||||||
<?php if($this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')): ?>
|
<?php if($this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')): ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col4">
|
<div class="col4">
|
||||||
@ -101,12 +99,7 @@
|
|||||||
<div class="col12">
|
<div class="col12">
|
||||||
<?php foreach($module::$comments as $commentId => $comment): ?>
|
<?php foreach($module::$comments as $commentId => $comment): ?>
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<h4>
|
<h4><?php echo $module::$commentsSignature[$commentId]; ?>
|
||||||
<?php if($comment['userId']): ?>
|
|
||||||
<?php echo $this->getData(['user', $comment['userId'], 'firstname']) . ' ' . $this->getData(['user', $comment['userId'], 'lastname']); ?>
|
|
||||||
<?php else: ?>
|
|
||||||
<?php echo $comment['author']; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
le <?php echo utf8_encode(strftime('%d %B %Y - %H:%M', $comment['createdOn'])); ?>
|
le <?php echo utf8_encode(strftime('%d %B %Y - %H:%M', $comment['createdOn'])); ?>
|
||||||
</h4>
|
</h4>
|
||||||
<?php echo $comment['content']; ?>
|
<?php echo $comment['content']; ?>
|
||||||
|
8
module/blog/view/comment/comment.js.php
Normal file → Executable file
8
module/blog/view/comment/comment.js.php
Normal file → Executable file
@ -18,4 +18,10 @@ $(".blogCommentDelete").on("click", function() {
|
|||||||
return core.confirm("Êtes-vous sûr de vouloir supprimer ce commentaire ?", function() {
|
return core.confirm("Êtes-vous sûr de vouloir supprimer ce commentaire ?", function() {
|
||||||
$(location).attr("href", _this.attr("href"));
|
$(location).attr("href", _this.attr("href"));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
$(".blogCommentDeleteAll").on("click", function() {
|
||||||
|
var _this = $(this);
|
||||||
|
return core.confirm("Êtes-vous sûr de vouloir supprimer les "+ <?php echo count($this->getData(['module',$this->getUrl(0), $this->getUrl(2), 'comment']));?>+" commentaires de l'article sélectionné ?", function() {
|
||||||
|
$(location).attr("href", _this.attr("href"));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
15
module/blog/view/comment/comment.php
Normal file → Executable file
15
module/blog/view/comment/comment.php
Normal file → Executable file
@ -7,10 +7,19 @@
|
|||||||
'value' => 'Retour'
|
'value' => 'Retour'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<?php if($module::$comments): ?>
|
<?php if($module::$comments): ?>
|
||||||
|
<div class="col6 offset2">
|
||||||
|
<?php echo $module::$messageComments; ?>
|
||||||
|
</div>
|
||||||
|
<div class="col2">
|
||||||
|
<?php echo $module::$commentsDelete; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
<?php echo template::table([3, 6, 2, 1], $module::$comments, ['Date', 'Contenu', 'Auteur', '']); ?>
|
<?php echo template::table([3, 6, 2, 1], $module::$comments, ['Date', 'Contenu', 'Auteur', '']); ?>
|
||||||
<?php echo $module::$pages; ?>
|
<?php echo $module::$pages.'<br/>'; ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
</div>
|
||||||
<?php echo template::speech('Aucun commentaire.'); ?>
|
<?php echo template::speech('Aucun commentaire.'); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
12
module/blog/view/config/config.php
Normal file → Executable file
12
module/blog/view/config/config.php
Normal file → Executable file
@ -7,13 +7,7 @@
|
|||||||
'value' => 'Retour'
|
'value' => 'Retour'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col3 offset5">
|
<div class="col2 offset8">
|
||||||
<?php echo template::button('blogConfigComment', [
|
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/comment',
|
|
||||||
'value' => 'Gérer les commentaires'
|
|
||||||
]); ?>
|
|
||||||
</div>
|
|
||||||
<div class="col2">
|
|
||||||
<?php echo template::button('blogConfigAdd', [
|
<?php echo template::button('blogConfigAdd', [
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/add',
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/add',
|
||||||
'ico' => 'plus',
|
'ico' => 'plus',
|
||||||
@ -22,11 +16,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php if($module::$articles): ?>
|
<?php if($module::$articles): ?>
|
||||||
<?php echo template::table([4, 4, 2, 1, 1], $module::$articles, ['Titre', 'Date de publication', 'État', '', '']); ?>
|
<?php echo template::table([4, 4, 1, 1, 1, 1], $module::$articles, ['Titre', 'Date de publication', 'État', '', '','']); ?>
|
||||||
<?php echo $module::$pages; ?>
|
<?php echo $module::$pages; ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php echo template::speech('Aucun article.'); ?>
|
<?php echo template::speech('Aucun article.'); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div class="moduleVersion">Version n°
|
<div class="moduleVersion">Version n°
|
||||||
<?php echo $module::BLOG_VERSION; ?>
|
<?php echo $module::BLOG_VERSION; ?>
|
||||||
</div>
|
</div>
|
||||||
|
10
module/blog/view/edit/edit.php
Normal file → Executable file
10
module/blog/view/edit/edit.php
Normal file → Executable file
@ -78,7 +78,8 @@
|
|||||||
<h4>Options de publication</h4>
|
<h4>Options de publication</h4>
|
||||||
<?php echo template::select('blogEditUserId', $module::$users, [
|
<?php echo template::select('blogEditUserId', $module::$users, [
|
||||||
'label' => 'Auteur',
|
'label' => 'Auteur',
|
||||||
'selected' => $this->getUser('id')
|
'selected' => $this->getUser('id'),
|
||||||
|
'disabled' => $this->getUser('group') !== self::GROUP_ADMIN ? true : false
|
||||||
]); ?>
|
]); ?>
|
||||||
<?php echo template::date('blogEditPublishedOn', [
|
<?php echo template::date('blogEditPublishedOn', [
|
||||||
'help' => 'L\'article n\'est visible qu\'après la date de publication prévue.',
|
'help' => 'L\'article n\'est visible qu\'après la date de publication prévue.',
|
||||||
@ -90,6 +91,11 @@
|
|||||||
<div class="col6">
|
<div class="col6">
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<h4>Options avancées</h4>
|
<h4>Options avancées</h4>
|
||||||
|
<?php echo template::select('blogEditlength', $module::$longueur_comment,[
|
||||||
|
'help' => 'Choix du nombre maximum de caractères pour chaque commentaire de l\'article, caractères de mise en forme html inclus.',
|
||||||
|
'label' => 'Nombre maximum de caractères pour chaque commentaire',
|
||||||
|
'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'maxlengthcomment'])
|
||||||
|
]); ?>
|
||||||
<?php echo template::checkbox('blogEditCloseComment', true, 'Fermer les commentaires', [
|
<?php echo template::checkbox('blogEditCloseComment', true, 'Fermer les commentaires', [
|
||||||
'checked' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'closeComment'])
|
'checked' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'closeComment'])
|
||||||
]); ?>
|
]); ?>
|
||||||
@ -105,4 +111,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php echo template::formClose(); ?>
|
<?php echo template::formClose(); ?>
|
||||||
|
Loading…
Reference in New Issue
Block a user