summaryrefslogtreecommitdiff
path: root/app/Event
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-09-09 20:39:45 +0200
committerFrédéric Guillot <fred@kanboard.net>2014-09-09 20:39:45 +0200
commit9bde377bbe85617dde280af985e033cf7de61803 (patch)
tree2d2c080a86542206f862bd6d1c14ce622aa225a8 /app/Event
parentef95c7c28479a22e41fff35a893f05eb084e1f2c (diff)
Start to implement task history and project activity
Diffstat (limited to 'app/Event')
-rw-r--r--app/Event/TaskHistoryListener.php52
1 files changed, 52 insertions, 0 deletions
diff --git a/app/Event/TaskHistoryListener.php b/app/Event/TaskHistoryListener.php
new file mode 100644
index 00000000..d6709f6e
--- /dev/null
+++ b/app/Event/TaskHistoryListener.php
@@ -0,0 +1,52 @@
+<?php
+
+namespace Event;
+
+use Core\Listener;
+use Model\TaskHistory;
+
+/**
+ * Task history listener
+ *
+ * @package event
+ * @author Frederic Guillot
+ */
+class TaskHistoryListener implements Listener
+{
+ /**
+ * TaskHistory model
+ *
+ * @accesss private
+ * @var \Model\TaskHistory
+ */
+ private $model;
+
+ /**
+ * Constructor
+ *
+ * @access public
+ * @param \Model\TaskHistory $model TaskHistory model instance
+ */
+ public function __construct(TaskHistory $model)
+ {
+ $this->model = $model;
+ }
+
+ /**
+ * 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)
+ {
+ $creator_id = $this->model->acl->getUserId();
+
+ if ($creator_id && isset($data['task_id']) && isset($data['project_id'])) {
+ $this->model->create($data['project_id'], $data['task_id'], $creator_id, $this->model->event->getLastTriggeredEvent());
+ }
+
+ return false;
+ }
+}