Notification commentaire en attente d'approbation

This commit is contained in:
Fred Tempez 2020-07-16 13:59:04 +02:00
parent 90d281b483
commit d6b2dc7e20
1 changed files with 9 additions and 7 deletions

View File

@ -505,21 +505,21 @@ class blog extends common {
} }
} }
// Envoi du mail $sent code d'erreur ou de réussite // Envoi du mail $sent code d'erreur ou de réussite
$notification = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentId, 'approval']) === false ? 'Commentaire déposé en attente d\'approbation.': 'Commentaire déposé.';
if ($this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'mailNotification']) === true) { if ($this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'mailNotification']) === true) {
$sent = $this->sendMail( $sent = $this->sendMail(
$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 ' . $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentId, 'approval']) === false ? 'à approuver' : '' .
'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']), $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentId, 'content']),
'' ''
); );
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl() . '#comment', 'redirect' => helper::baseUrl() . $this->getUrl() . '#comment',
//'notification' => 'Commentaire ajouté', 'notification' => ($sent === true ? $notification . '<br/>Une notification a été envoyée.' : $notification . '<br/> Erreur de notification : ' . $sent),
//'state' => true
'notification' => ($sent === true ? 'Commentaire ajouté et une notification envoyée' : 'Commentaire ajouté, erreur de notification : <br/>' . $sent),
'state' => ($sent === true ? true : null) 'state' => ($sent === true ? true : null)
]); ]);
@ -527,7 +527,7 @@ class blog extends common {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl() . '#comment', 'redirect' => helper::baseUrl() . $this->getUrl() . '#comment',
'notification' => 'Commentaire ajouté', 'notification' => $notification,
'state' => true 'state' => true
]); ]);
} }
@ -599,8 +599,10 @@ class blog extends common {
} else { } else {
self::$commentsSignature[$commentIds[$i]] = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentIds[$i],'author']); self::$commentsSignature[$commentIds[$i]] = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentIds[$i],'author']);
} }
// Données du commentaire // Données du commentaire si approuvé
self::$comments[$commentIds[$i]] = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentIds[$i]]); if ($this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'comment', $commentIds[$i],'approval']) === true ) {
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([