Permissions + correction nbre commentaires + noms des variables

This commit is contained in:
Fred Tempez 2020-10-11 18:36:20 +02:00
parent 1051fa0731
commit 5c35bd3c1d
7 changed files with 193 additions and 178 deletions

View File

@ -643,7 +643,6 @@ class init extends common {
'module' => [
'blog' => [
'mon-premier-article' => [
'closeComment' => false,
'comment' => [
'58e11d09e5aff' => [
'author' => 'Rémi',
@ -660,10 +659,15 @@ class init extends common {
'publishedOn' => 1548790902,
'state' => true,
'title' => 'Mon premier article',
'userId' => '' // Géré au moment de l'installation
'userId' => '', // Géré au moment de l'installation
'editConsent' => 'group',
'commentMaxlength' => '500',
'commentApproved' => false,
'commentClose' => false,
'commentNotification' => false,
'commentGroupNotification' => 1
],
'mon-deuxieme-article' => [
'closeComment' => false,
'comment' => [],
'content' => '<p>Et prima post Osdroenam quam, ut dictum est, ab hac descriptione discrevimus, Commagena, nunc Euphratensis, clementer adsurgit, Hierapoli, vetere Nino et Samosata civitatibus amplis inlustris.</p><p>Ob haec et huius modi multa, quae cernebantur in paucis, omnibus timeri sunt coepta. et ne tot malis dissimulatis paulatimque serpentibus acervi crescerent aerumnarum, nobilitatis decreto legati mittuntur: Praetextatus ex urbi praefecto et ex vicario Venustus et ex consulari Minervius oraturi, ne delictis supplicia sint grandiora, neve senator quisquam inusitato et inlicito more tormentis exponeretur.</p><p>Sed ut tum ad senem senex de senectute, sic hoc libro ad amicum amicissimus scripsi de amicitia. Tum est Cato locutus, quo erat nemo fere senior temporibus illis, nemo prudentior; nunc Laelius et sapiens (sic enim est habitus) et amicitiae gloria excellens de amicitia loquetur. Tu velim a me animum parumper avertas, Laelium loqui ipsum putes. C. Fannius et Q. Mucius ad socerum veniunt post mortem Africani; ab his sermo oritur, respondet Laelius, cuius tota disputatio est de amicitia, quam legens te ipse cognosces.</p>',
'picture' => 'galerie/landscape/desert.jpg',
@ -672,10 +676,15 @@ class init extends common {
'publishedOn' => 1550432502,
'state' => true,
'title' => 'Mon deuxième article',
'userId' => '' // Géré au moment de l'installation
'userId' => '', // Géré au moment de l'installation
'editConsent' => 'group',
'commentMaxlength' => '500',
'commentApproved' => false,
'commentClose' => false,
'commentNotification' => false,
'commentGroupNotification' => 1
],
'mon-troisieme-article' => [
'closeComment' => true,
'comment' => [],
'content' => '<p>Rogatus ad ultimum admissusque in consistorium ambage nulla praegressa inconsiderate et leviter proficiscere inquit ut praeceptum est, Caesar sciens quod si cessaveris, et tuas et palatii tui auferri iubebo prope diem annonas. hocque solo contumaciter dicto subiratus abscessit nec in conspectum eius postea venit saepius arcessitus.</p><p>Proinde concepta rabie saeviore, quam desperatio incendebat et fames, amplificatis viribus ardore incohibili in excidium urbium matris Seleuciae efferebantur, quam comes tuebatur Castricius tresque legiones bellicis sudoribus induratae.</p><p>Inter has ruinarum varietates a Nisibi quam tuebatur accitus Vrsicinus, cui nos obsecuturos iunxerat imperiale praeceptum, dispicere litis exitialis certamina cogebatur abnuens et reclamans, adulatorum oblatrantibus turmis, bellicosus sane milesque semper et militum ductor sed forensibus iurgiis longe discretus, qui metu sui discriminis anxius cum accusatores quaesitoresque subditivos sibi consociatos ex isdem foveis cerneret emergentes, quae clam palamve agitabantur, occultis Constantium litteris edocebat inplorans subsidia, quorum metu tumor notissimus Caesaris exhalaret.</p>',
'picture' => 'galerie/landscape/iceberg.jpg',
@ -684,7 +693,13 @@ class init extends common {
'publishedOn' => 1550864502,
'state' => true,
'title' => 'Mon troisième article',
'userId' => '' // Géré au moment de l'installation
'userId' => '', // Géré au moment de l'installation
'editConsent' => 'group',
'commentMaxlength' => '500',
'commentApproved' => false,
'commentClose' => true,
'commentNotification' => false,
'commentGroupNotification' => 1
]
],
'galeries' => [

View File

@ -14,11 +14,8 @@
class blog extends common {
// Objets
// Propriétaire - groupe
const EDIT_ALL = '02'; // Groupes Editeurs et admins
const EDIT_OWNER_ADMIN = '23'; // Propriétaire éditeur + groupe admin
const EDIT_ADMIN = '03'; // Groupe des admin
const EDIT_OWNER = 'owner';
const EDIT_GROUP = 'group';
public static $actions = [
'add' => self::GROUP_EDITOR,
@ -41,7 +38,7 @@ class blog extends common {
public static $editCommentSignature = '';
public static $comments = [];
public static $nbCommentsApproved = 0;
public static $commentsDelete;
@ -79,19 +76,16 @@ class blog extends common {
];
// Permissions d'un article
public static $articleRightsAdmin = [
self::EDIT_ALL => 'Groupes des éditeurs et des administrateurs',
self::EDIT_OWNER_ADMIN => 'Editeur et groupe des administrateurs',
self::EDIT_ADMIN => 'Groupe des administrateurs'
];
public static $articleRightsModerator = [
self::EDIT_ALL => 'Groupes des éditeurs et des administrateurs',
self::EDIT_OWNER_ADMIN => 'Editeur et groupe des administrateurs'
public static $articleConsent = [
self::EDIT_GROUP => 'Groupe du propriétaire',
self::EDIT_OWNER => 'Propiétaire'
];
public static $users = [];
const BLOG_VERSION = '3.04.dev';
const BLOG_VERSION = '3.05.dev';
/**
* Édition
@ -111,22 +105,27 @@ class blog extends common {
$articleId = helper::increment($articleId, (array) $this->getData(['module', $this->getUrl(0)]));
$articleId = helper::increment($articleId, array_keys(self::$actions));
// Crée l'article
$this->setData(['module', $this->getUrl(0), $articleId, [
'closeComment' => $this->getInput('blogAddCloseComment', helper::FILTER_BOOLEAN),
'mailNotification' => $this->getInput('blogAddMailNotification', helper::FILTER_BOOLEAN),
'groupNotification' => $this->getInput('blogAddGroupNotification', helper::FILTER_INT),
'comment' => [],
'content' => $this->getInput('blogAddContent', null),
'picture' => $this->getInput('blogAddPicture', helper::FILTER_STRING_SHORT, true),
'hidePicture' => $this->getInput('blogAddHidePicture', helper::FILTER_BOOLEAN),
'pictureSize' => $this->getInput('blogAddPictureSize', helper::FILTER_STRING_SHORT),
'picturePosition' => $this->getInput('blogAddPicturePosition', helper::FILTER_STRING_SHORT),
'publishedOn' => $this->getInput('blogAddPublishedOn', helper::FILTER_DATETIME, true),
'state' => $this->getInput('blogAddState', helper::FILTER_BOOLEAN),
'title' => $this->getInput('blogAddTitle', helper::FILTER_STRING_SHORT, true),
'userId' => $newuserid,
'commentMaxlength' => $this->getInput('blogAddlength', null)
]]);
$this->setData(['module',
$this->getUrl(0),
$articleId, [
'comment' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment']),
'content' => $this->getInput('blogAddContent', null),
'picture' => $this->getInput('blogAddPicture', helper::FILTER_STRING_SHORT, true),
'hidePicture' => $this->getInput('blogAddHidePicture', helper::FILTER_BOOLEAN),
'pictureSize' => $this->getInput('blogAddPictureSize', helper::FILTER_STRING_SHORT),
'picturePosition' => $this->getInput('blogAddPicturePosition', helper::FILTER_STRING_SHORT),
'publishedOn' => $this->getInput('blogAddPublishedOn', helper::FILTER_DATETIME, true),
'state' => $this->getInput('blogAddState', helper::FILTER_BOOLEAN),
'title' => $this->getInput('blogAddTitle', helper::FILTER_STRING_SHORT, true),
'userId' => $newuserid,
'editConsent' => $this->getInput('blogAddConsent'),
'commentMaxlength' => $this->getInput('blogAddCommentMaxlength'),
'commentApproved' => $this->getInput('blogAddCommentApproved', helper::FILTER_BOOLEAN),
'commentClose' => $this->getInput('blogAddCommentClose', helper::FILTER_BOOLEAN),
'commentNotification' => $this->getInput('blogAddCommentNotification', helper::FILTER_BOOLEAN),
'commentGroupNotification' => $this->getInput('blogAddCommentGroupNotification', helper::FILTER_INT)
]
]);
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
@ -305,16 +304,15 @@ class blog extends common {
// Gestion des droits d'accès
$filterData=[];
foreach ($articleIds as $key => $value) {
$rights = $this->getData(['module', $this->getUrl(0), $value,'editRights']);
// Compatibilité pas de droit stocké placer droit par défaut
$rights = empty($rights) ? '02' : $rights;
// Check les droits du propriétaire
// Check les droits du groupe
$consent = $this->getData(['module', $this->getUrl(0), $value,'editConsent']);
if (
( substr($rights,0,1) === '2'
AND $this->getData(['module', $this->getUrl(0), $value,'userId']) === $this->getUser('id')
(
$consent === self::EDIT_OWNER
AND $this->getData(['module', $this->getUrl(0), $value,'userId']) === $this->getUser('id')
) OR (
$consent === self::EDIT_GROUP
AND $this->getUser('group') >= $this->getData(['user',$this->getUser('group'),'group'])
)
OR ( $this->getUser('group') >= substr($rights,1,1) )
) {
$filterData[] = $value;
}
@ -437,24 +435,27 @@ class blog extends common {
$articleId = helper::increment($articleId, $this->getData(['module', $this->getUrl(0)]));
$articleId = helper::increment($articleId, array_keys(self::$actions));
}
$this->setData(['module', $this->getUrl(0), $articleId, [
'closeComment' => $this->getInput('blogEditCloseComment', helper::FILTER_BOOLEAN),
'mailNotification' => $this->getInput('blogEditMailNotification', helper::FILTER_BOOLEAN),
'groupNotification' => $this->getInput('blogEditGroupNotification', helper::FILTER_INT),
'comment' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment']),
'content' => $this->getInput('blogEditContent', null),
'picture' => $this->getInput('blogEditPicture', helper::FILTER_STRING_SHORT, true),
'hidePicture' => $this->getInput('blogEditHidePicture', helper::FILTER_BOOLEAN),
'pictureSize' => $this->getInput('blogEditPictureSize', helper::FILTER_STRING_SHORT),
'picturePosition' => $this->getInput('blogEditPicturePosition', helper::FILTER_STRING_SHORT),
'publishedOn' => $this->getInput('blogEditPublishedOn', helper::FILTER_DATETIME, true),
'state' => $this->getInput('blogEditState', helper::FILTER_BOOLEAN),
'title' => $this->getInput('blogEditTitle', helper::FILTER_STRING_SHORT, true),
'userId' => $newuserid,
'commentMaxlength' => $this->getInput('blogEditCommentMaxlength'),
'commentApprove' => $this->getInput('blogEditCommentApprove', helper::FILTER_BOOLEAN),
'editRights' => $this->getInput('blogEditRights')
]]);
$this->setData(['module',
$this->getUrl(0),
$articleId, [
'comment' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment']),
'content' => $this->getInput('blogEditContent', null),
'picture' => $this->getInput('blogEditPicture', helper::FILTER_STRING_SHORT, true),
'hidePicture' => $this->getInput('blogEditHidePicture', helper::FILTER_BOOLEAN),
'pictureSize' => $this->getInput('blogEditPictureSize', helper::FILTER_STRING_SHORT),
'picturePosition' => $this->getInput('blogEditPicturePosition', helper::FILTER_STRING_SHORT),
'publishedOn' => $this->getInput('blogEditPublishedOn', helper::FILTER_DATETIME, true),
'state' => $this->getInput('blogEditState', helper::FILTER_BOOLEAN),
'title' => $this->getInput('blogEditTitle', helper::FILTER_STRING_SHORT, true),
'userId' => $newuserid,
'editConsent' => $this->getInput('blogEditConsent'),
'commentMaxlength' => $this->getInput('blogEditCommentMaxength'),
'commentApproved' => $this->getInput('blogEditCommentApproved', helper::FILTER_BOOLEAN),
'commentClose' => $this->getInput('blogEditCommentClose', helper::FILTER_BOOLEAN),
'commentNotification' => $this->getInput('blogEditCommentNotification', helper::FILTER_BOOLEAN),
'commentGroupNotification' => $this->getInput('blogEditCommentGroupNotification', helper::FILTER_INT)
]
]);
// Supprime l'ancien article
if($articleId !== $this->getUrl(2)) {
$this->deleteData(['module', $this->getUrl(0), $this->getUrl(2)]);
@ -473,7 +474,7 @@ class blog extends common {
// Les membres ne sont pas éditeurs, les exclure de la liste
if ( $this->getData(['user', $userId, 'group']) < self::GROUP_EDITOR) {
unset(self::$users[$userId]);
}
}
$userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']) . ' (' . self::$groupEdits[$this->getData(['user', $userId, 'group'])] . ')';
}
unset($userFirstname);
@ -526,19 +527,19 @@ class blog extends common {
'content' => $content,
'createdOn' => time(),
'userId' => $this->getInput('blogArticleUserId'),
'approval' => !$this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'commentApprove']) // true commentaire publié false en attente de publication
'approval' => !$this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'commentApproved']) // true commentaire publié false en attente de publication
]]);
// Envoi d'une notification aux administrateurs
// Init tableau
$to = [];
// Liste des destinataires
foreach($this->getData(['user']) as $userId => $user) {
if ($user['group'] >= $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'groupNotification']) ) {
if ($user['group'] >= $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'commentGroupNotification']) ) {
$to[] = $user['mail'];
}
}
// Envoi du mail $sent code d'erreur ou de réussite
$notification = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'commentApprove']) === true ? 'Commentaire déposé en attente d\'approbation': 'Commentaire déposé';
$notification = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'commentApproved']) === true ? 'Commentaire déposé en attente d\'approbation': 'Commentaire déposé';
if ($this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'mailNotification']) === true) {
$sent = $this->sendMail(
$to,
@ -567,11 +568,13 @@ class blog extends common {
}
// Ids des commentaires approuvés par ordre de publication
$commentsApproved = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment']);
foreach( $commentsApproved as $key => $value){
if($value['approval']===false) unset($commentsApproved[$key]);
if ($commentsApproved) {
foreach( $commentsApproved as $key => $value){
if($value['approval']===false) unset($commentsApproved[$key]);
}
// Ligne suivante si affichage du nombre total de commentaires approuvés sous l'article
self::$nbCommentsApproved = count($commentsApproved);
}
// Ligne suivante si affichage du nombre total de commentaires approuvés sous l'article
self::$nbCommentsApproved = count($commentsApproved);
$commentIds = array_keys(helper::arrayCollumn($commentsApproved, 'createdOn', 'SORT_DESC'));
// Pagination
$pagination = helper::pagination($commentIds, $this->getUrl(),$this->getData(['config','itemsperPage']),'#comment');

View File

@ -21,19 +21,19 @@ $("#blogAddDraft").on("click", function() {
/**
* Options de commentaires
*/
$("#blogAddCloseComment").on("change", function() {
$("#blogAddCommentClose").on("change", function() {
if ($(this).is(':checked') ) {
$("#commentOptionsWrapper").slideUp();
$(".commentOptionsWrapper").slideUp();
} else {
$("#commentOptionsWrapper").slideDown();
$(".commentOptionsWrapper").slideDown();
}
});
$("#blogAddMailNotification").on("change", function() {
$("#blogAddCommentNotification").on("change", function() {
if ($(this).is(':checked') ) {
$("#blogAddGroupNotification").slideDown();
$("#blogAddCommentGroupNotification").slideDown();
} else {
$("#blogAddGroupNotification").slideUp();
$("#blogAddCommentGroupNotification").slideUp();
}
});
@ -41,15 +41,14 @@ $("#blogAddMailNotification").on("change", function() {
$( document).ready(function() {
if ($("#blogAddCloseComment").is(':checked') ) {
$("#commentOptionsWrapper").slideUp();
$(".commentOptionsWrapper").slideUp();
} else {
$("#commentOptionsWrapper").slideDown();
$(".commentOptionsWrapper").slideDown();
}
if ($("#blogAddMailNotification").is(':checked') ) {
$("#blogAddGroupNotification").slideDown();
if ($("#blogAddCommentNotification").is(':checked') ) {
$("#blogAddCommentGroupNotification").slideDown();
} else {
$("#blogAddGroupNotification").slideUp();
$("#blogAddCommentGroupNotification").slideUp();
}
});

View File

@ -67,18 +67,11 @@
<?php echo template::textarea('blogAddContent', [
'class' => 'editorWysiwyg'
]); ?>
<div class="row">
<div class="row">
<div class="col12">
<div class="block">
<h4>Options de publication</h4>
<div class="row">
<div class="col4">
<?php echo template::select('blogAddCommentMaxlength', $module::$commentLength,[
'help' => 'Choix du nombre maximum de caractères pour chaque commentaire de l\'article, mise en forme html comprise.',
'label' => 'Caractères par commentaire',
'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'commentMaxlength'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('blogAddUserId', $module::$users, [
'label' => 'Auteur',
@ -93,47 +86,52 @@
'value' => time()
]); ?>
</div>
<div class="col4">
<?php echo template::select('blogAddConsent', $module::$articleConsent , [
'label' => 'Edition / Suppression',
'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'editConsent']),
'help' => 'Les utilisateurs des groupes supérieurs accèdent à l\'article sans restriction'
]); ?>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col6">
<div class="block">
<h4>Permissions</h4>
<?php echo template::select('blogAddRights', $this->getUser('group') === self::GROUP_ADMIN ? $module::$articleRightsAdmin : $module::$articleRightsModerator , [
'label' => 'Droits d\'édition et de modification',
'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'editRights'])
]); ?>
</div>
</div>
<div class="col6">
<div class="col12">
<div class="block">
<h4>Commentaires</h4>
<?php echo template::checkbox('blogAddCloseComment', true, 'Fermer les commentaires', [
'checked' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'closeComment'])
]); ?>
<div id="commentOptionsWrapper">
<div class="row">
<div class="col12">
<?php echo template::checkbox('blogAddCommentApprove', true, 'Approbation des commentaires', [
'checked' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'commentApprove']),
''
]); ?>
</div>
<div class="row">
<div class="col4 ">
<?php echo template::checkbox('blogAddCommentClose', true, 'Fermer les commentaires', [
'checked' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'commentClose'])
]); ?>
</div>
<div class="row">
<div class="col7">
<?php echo template::checkbox('blogAddMailNotification', true, 'Notification des nouveaux commentaires par mail aux groupes', [
'checked' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'mailNotification']),
]); ?>
</div>
<div class="col5">
<?php echo template::select('blogAddGroupNotification', $module::$groupNews, [
'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'groupNotification']),
'help' => 'Editeurs = éditeurs + administrateurs<br/> Membres = membres + éditeurs + administrateurs'
]); ?>
</div>
<div class="col4 commentOptionsWrapper ">
<?php echo template::checkbox('blogAddCommentApproved', true, 'Approbation par un modérateur', [
'checked' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'commentApproved']),
''
]); ?>
</div>
<div class="col4 commentOptionsWrapper">
<?php echo template::select('blogAddCommentMaxlength', $module::$commentLength,[
'help' => 'Choix du nombre maximum de caractères pour chaque commentaire de l\'article, mise en forme html comprise.',
'label' => 'Caractères par commentaire',
'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'commentMaxlength'])
]); ?>
</div>
</div>
<div class="row">
<div class="col3 commentOptionsWrapper offset2">
<?php echo template::checkbox('blogAddCommentNotification', true, 'Notification par email', [
'checked' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'commentNotification']),
]); ?>
</div>
<div class="col4 commentOptionsWrapper">
<?php echo template::select('blogAddCommentGroupNotification', $module::$groupNews, [
'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'commentGroupNotification']),
'help' => 'Editeurs = éditeurs + administrateurs<br/> Membres = membres + éditeurs + administrateurs'
]); ?>
</div>
</div>
</div>

View File

@ -33,19 +33,19 @@ $("#blogEditDraft").on("click", function() {
/**
* Options de commentaires
*/
$("#blogEditCloseComment").on("change", function() {
$("#blogEditCommentClose").on("change", function() {
if ($(this).is(':checked') ) {
$("#commentOptionsWrapper").slideUp();
$(".commentOptionsWrapper").slideUp();
} else {
$("#commentOptionsWrapper").slideDown();
$(".commentOptionsWrapper").slideDown();
}
});
$("#blogEditMailNotification").on("change", function() {
$("#blogEditCommentNotification").on("change", function() {
if ($(this).is(':checked') ) {
$("#blogEditGroupNotification").slideDown();
$("#blogEditCommentGroupNotification").slideDown();
} else {
$("#blogEditGroupNotification").slideUp();
$("#blogEditCommentGroupNotification").slideUp();
}
});
@ -53,15 +53,14 @@ $("#blogEditMailNotification").on("change", function() {
$( document).ready(function() {
if ($("#blogEditCloseComment").is(':checked') ) {
$("#commentOptionsWrapper").slideUp();
$(".commentOptionsWrapper").slideUp();
} else {
$("#commentOptionsWrapper").slideDown();
$(".commentOptionsWrapper").slideDown();
}
if ($("#blogEditMailNotification").is(':checked') ) {
$("#blogEditGroupNotification").slideDown();
if ($("#blogEditCommentNotification").is(':checked') ) {
$("#blogEditCommentGroupNotification").slideDown();
} else {
$("#blogEditGroupNotification").slideUp();
$("#blogEditCommentGroupNotification").slideUp();
}
});

View File

@ -78,13 +78,6 @@
<div class="block">
<h4>Options de publication</h4>
<div class="row">
<div class="col4">
<?php echo template::select('blogEditCommentMaxlength', $module::$commentLength,[
'help' => 'Choix du nombre maximum de caractères pour chaque commentaire de l\'article, mise en forme html comprise.',
'label' => 'Caractères par commentaire',
'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'commentMaxlength'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('blogEditUserId', $module::$users, [
'label' => 'Auteur',
@ -96,7 +89,14 @@
<?php echo template::date('blogEditPublishedOn', [
'help' => 'L\'article n\'est visible qu\'après la date de publication prévue.',
'label' => 'Date de publication',
'value' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'publishedOn'])
'value' => time()
]); ?>
</div>
<div class="col4">
<?php echo template::select('blogEditConsent', $module::$articleConsent , [
'label' => 'Edition / Suppression',
'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'editConsent']),
'help' => 'Les utilisateurs des groupes supérieurs accèdent à l\'article sans restriction'
]); ?>
</div>
</div>
@ -104,42 +104,41 @@
</div>
</div>
<div class="row">
<div class="col6">
<div class="block">
<h4>Permissions</h4>
<?php echo template::select('blogEditRights', $this->getUser('group') === self::GROUP_ADMIN ? $module::$articleRightsAdmin : $module::$articleRightsModerator , [
'label' => 'Droits d\'édition et de modification',
'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'editRights'])
]); ?>
</div>
</div>
<div class="col6">
<div class="col12">
<div class="block">
<h4>Commentaires</h4>
<?php echo template::checkbox('blogEditCloseComment', true, 'Fermer les commentaires', [
'checked' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'closeComment'])
]); ?>
<div id="commentOptionsWrapper">
<div class="row">
<div class="col12">
<?php echo template::checkbox('blogEditCommentApprove', true, 'Approbation des commentaires', [
'checked' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'commentApprove']),
''
]); ?>
</div>
<div class="row">
<div class="col4 ">
<?php echo template::checkbox('blogEditCommentClose', true, 'Fermer les commentaires', [
'checked' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'commentClose'])
]); ?>
</div>
<div class="row">
<div class="col7">
<?php echo template::checkbox('blogEditMailNotification', true, 'Notification des nouveaux commentaires par mail aux groupes', [
'checked' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'mailNotification']),
]); ?>
</div>
<div class="col5">
<?php echo template::select('blogEditGroupNotification', $module::$groupNews, [
'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'groupNotification']),
'help' => 'Editeurs = éditeurs + administrateurs<br/> Membres = membres + éditeurs + administrateurs'
]); ?>
</div>
<div class="col4 commentOptionsWrapper ">
<?php echo template::checkbox('blogEditCommentApprove', true, 'Approbation par un modérateur', [
'checked' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'commentApprove']),
''
]); ?>
</div>
<div class="col4 commentOptionsWrapper">
<?php echo template::select('blogEditCommentMaxlength', $module::$commentLength,[
'help' => 'Choix du nombre maximum de caractères pour chaque commentaire de l\'article, mise en forme html comprise.',
'label' => 'Caractères par commentaire',
'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'commentMaxlength'])
]); ?>
</div>
</div>
<div class="row">
<div class="col3 commentOptionsWrapper offset2">
<?php echo template::checkbox('blogEditCommentNotification', true, 'Notification par email', [
'checked' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'commentNotification']),
]); ?>
</div>
<div class="col4 commentOptionsWrapper">
<?php echo template::select('blogEditCommentGroupNotification', $module::$groupNews, [
'selected' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'commentGroupNotification']),
'help' => 'Editeurs = éditeurs + administrateurs<br/> Membres = membres + éditeurs + administrateurs'
]); ?>
</div>
</div>
</div>

View File

@ -29,7 +29,9 @@
</h1>
<div class="blogComment">
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>#comment">
<?php echo count($article['comment']); ?>
<?php if ($article['comment']): ?>
<?php echo count($article['comment']); ?>
<?php endif; ?>
</a>
<?php echo template::ico('comment', 'left'); ?>
</div>