From 9eeded33f68872515954a2fc177fcb47a9273ae9 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Fri, 15 Aug 2014 17:23:41 -0700 Subject: Add email notifications --- app/Event/BaseNotificationListener.php | 76 ++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 app/Event/BaseNotificationListener.php (limited to 'app/Event/BaseNotificationListener.php') diff --git a/app/Event/BaseNotificationListener.php b/app/Event/BaseNotificationListener.php new file mode 100644 index 00000000..6c1728cb --- /dev/null +++ b/app/Event/BaseNotificationListener.php @@ -0,0 +1,76 @@ +template = $template; + $this->notification = $notification; + } + + /** + * Execute the action + * + * @access public + * @param array $data Event data dictionary + * @return bool True if the action was executed or false when not executed + */ + public function execute(array $data) + { + $values = $this->getTemplateData($data); + + // Get the list of users to be notified + $users = $this->notification->getUsersList($values['task']['project_id']); + + // Send notifications + if ($users) { + $this->notification->sendEmails($this->template, $users, $values); + return true; + } + + return false; + } +} -- cgit v1.2.3