diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-10-12 21:38:56 -0400 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-10-12 21:38:56 -0400 |
commit | 074056352de98fc567b4d13184c72887c75625d0 (patch) | |
tree | 7d262c3a5d5f779648f51aa0eb7d9f279c05d89d /app/Event/BaseNotificationListener.php | |
parent | 4061927d215c846ff8eb196301bf61532018042b (diff) |
Project activity refactoring and listeners improvements
Diffstat (limited to 'app/Event/BaseNotificationListener.php')
-rw-r--r-- | app/Event/BaseNotificationListener.php | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/app/Event/BaseNotificationListener.php b/app/Event/BaseNotificationListener.php deleted file mode 100644 index fdabaf57..00000000 --- a/app/Event/BaseNotificationListener.php +++ /dev/null @@ -1,87 +0,0 @@ -<?php - -namespace Event; - -use Core\Listener; -use Model\Notification; - -/** - * Base notification listener - * - * @package event - * @author Frederic Guillot - */ -abstract class BaseNotificationListener implements Listener -{ - /** - * Notification model - * - * @accesss protected - * @var Model\Notification - */ - protected $notification; - - /** - * Template name - * - * @accesss private - * @var string - */ - private $template = ''; - - /** - * Fetch data for the mail template - * - * @access public - * @param array $data Event data - * @return array - */ - abstract public function getTemplateData(array $data); - - /** - * Constructor - * - * @access public - * @param \Model\Notification $notification Notification model instance - * @param string $template Template name - */ - public function __construct(Notification $notification, $template) - { - $this->template = $template; - $this->notification = $notification; - } - - /** - * Return class information - * - * @access public - * @return string - */ - public function __toString() - { - return get_called_class(); - } - - /** - * 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; - } -} |