From 8dcea674e8ed4ad921589b6b08d369307ed78305 Mon Sep 17 00:00:00 2001
From: Liquidsoul <liquidsoul@liquidsoul.fr>
Date: Wed, 17 Apr 2019 16:50:00 +0200
Subject: [PATCH] Add notificationservice->sendPollCreationMails

---
 .../Framadate/Services/NotificationService.php       | 12 ++++++++++++
 tpl/mail/participants_forward_email.html.tpl         | 10 +---------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/app/classes/Framadate/Services/NotificationService.php b/app/classes/Framadate/Services/NotificationService.php
index 02a74e49..aca76c3b 100644
--- a/app/classes/Framadate/Services/NotificationService.php
+++ b/app/classes/Framadate/Services/NotificationService.php
@@ -85,4 +85,16 @@ class NotificationService {
     {
        return $type >= self::UPDATE_POLL;
     }
+
+    function sendPollCreationMails($creator_mail, $creator_name, $poll_name, $poll_id, $admin_poll_id) {
+        $this->smarty->assign('poll_creator_name', Utils::htmlMailEscape($creator_name));
+        $this->smarty->assign('poll_name', Utils::htmlMailEscape($poll_name));
+        $this->smarty->assign('poll_url', Utils::getUrlSondage($poll_id));
+        $message_participants = $this->smarty->fetch('mail/participants_forward_email.html.tpl');
+        $this->mailService->send($creator_mail, '[' . NOMAPPLICATION . '][' . __('Mail', 'Participant link') . '] ' . __('Generic', 'Poll') . ': ' . $poll_name, $message_participants);
+
+        $this->smarty->assign('poll_admin_url', Utils::getUrlSondage($admin_poll_id, true));
+        $message_admin = $this->smarty->fetch('mail/creation_notification_email.html.tpl');
+        $this->mailService->send($creator_mail, '[' . NOMAPPLICATION . '][' . __('Mail', 'Message for the author') . '] ' . __('Generic', 'Poll') . ': ' . $poll_name, $message_admin);
+    }
 }
diff --git a/tpl/mail/participants_forward_email.html.tpl b/tpl/mail/participants_forward_email.html.tpl
index 1df45448..dc8c3cf9 100644
--- a/tpl/mail/participants_forward_email.html.tpl
+++ b/tpl/mail/participants_forward_email.html.tpl
@@ -1,9 +1 @@
-{__('Mail', "This is the message to forward to the poll participants.")}
-<br/>
-<br/>
-{$poll_creator_name} {__('Mail', 'has just created a poll called')} {$poll_name}
-<br/>
-{__('Mail', 'Thank you for participating in the poll at the following link')}:
-<br/>
-<br/>
-<a href="{$poll_url}">{$poll_url}</a>
+{__('Mail', "This is the message to forward to the poll participants.")}<br/><br/>{$poll_creator_name} {__('Mail', 'has just created a poll called')} {$poll_name}<br/>{__('Mail', 'Thank you for participating in the poll at the following link')}:<br/><br/><a href="{$poll_url}">{$poll_url}</a>
-- 
GitLab