From 27e4b9db3b850908ed5c4bff9bd2b759d64f1574 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Wed, 28 Oct 2020 06:29:49 +0100 Subject: [PATCH] Validation d'un commentaire --- module/blog/blog.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/module/blog/blog.php b/module/blog/blog.php index 0d20088f..409123d9 100644 --- a/module/blog/blog.php +++ b/module/blog/blog.php @@ -279,19 +279,20 @@ class blog extends common { } // Inversion du statut else { + $approved = !$this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment', $this->getUrl(3), 'approval']) ; $this->setData(['module', $this->getUrl(0), $this->getUrl(2), 'comment', $this->getUrl(3), [ 'author' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment', $this->getUrl(3), 'author']), 'content' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment', $this->getUrl(3), 'content']), 'createdOn' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment', $this->getUrl(3), 'createdOn']), 'userId' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment', $this->getUrl(3), 'userId']), - 'approval' => !$this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment', $this->getUrl(3), 'approval']) + 'approval' => $approved ]]); // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/comment/'.$this->getUrl(2), - 'notification' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment', $this->getUrl(3), 'approval']) === true ? 'Commentaire rejeté' : 'Commentaire approuvé', - 'state' => !$this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment', $this->getUrl(3), 'approval']) + 'notification' => $approved ? 'Commentaire approuvé' : 'Commentaire rejeté', + 'state' => $approved ]); } }