aboutsummaryrefslogtreecommitdiff
path: root/src/controller/ContactFormController.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/controller/ContactFormController.php')
-rw-r--r--src/controller/ContactFormController.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/controller/ContactFormController.php b/src/controller/ContactFormController.php
index 181e93c..243740f 100644
--- a/src/controller/ContactFormController.php
+++ b/src/controller/ContactFormController.php
@@ -7,6 +7,15 @@ use Doctrine\ORM\EntityManager;
7 7
8class ContactFormController 8class ContactFormController
9{ 9{
10 static public function keepEmails(EntityManager $entityManager, array $json): void
11 {
12 $form_data = $entityManager->find('App\Entity\NodeData', $json['id']);
13 $form_data->updateData('keep_emails', $json['checked'] ? true : false);
14 $entityManager->persist($form_data);
15 $entityManager->flush();
16 echo json_encode(['success' => true, 'checked' => $json['checked']]);
17 die;
18 }
10 static public function setEmailParam(EntityManager $entityManager, array $json): void 19 static public function setEmailParam(EntityManager $entityManager, array $json): void
11 { 20 {
12 $form = new FormValidation($json, 'email_params'); 21 $form = new FormValidation($json, 'email_params');
@@ -80,4 +89,20 @@ class ContactFormController
80 } 89 }
81 die; 90 die;
82 } 91 }
92 static public function deleteEmail(EntityManager $entityManager, array $json): void
93 {
94 $email = $entityManager->find('App\Entity\Email', $json['id']);
95 $entityManager->remove($email);
96 $entityManager->flush();
97 echo json_encode(['success' => true]);
98 die;
99 }
100 static public function toggleSensitiveEmail(EntityManager $entityManager, array $json): void
101 {
102 $email = $entityManager->find('App\Entity\Email', $json['id']);
103 $email->makeSensitive($json['checked']);
104 $entityManager->flush();
105 echo json_encode(['success' => true, 'checked' => $json['checked'], 'deletion_date' => $email->getDeletionDate()->format('d/m/Y')]);
106 die;
107 }
83} \ No newline at end of file 108} \ No newline at end of file