summaryrefslogtreecommitdiff
path: root/app/Event/TaskModification.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-05-22 12:28:28 -0400
committerFrédéric Guillot <fred@kanboard.net>2014-05-22 12:28:28 -0400
commit2230dd4e6b148346c0ec596b9e3e12996a762ed8 (patch)
treeef99ccde4f8b18592a3fb06a6ec45162c501fe38 /app/Event/TaskModification.php
parenta750b8ab2a0cb715da6fd9025a7ec8375db68a4d (diff)
Code refactoring (add autoloader and change files organization)
Diffstat (limited to 'app/Event/TaskModification.php')
-rw-r--r--app/Event/TaskModification.php51
1 files changed, 51 insertions, 0 deletions
diff --git a/app/Event/TaskModification.php b/app/Event/TaskModification.php
new file mode 100644
index 00000000..b1d412c7
--- /dev/null
+++ b/app/Event/TaskModification.php
@@ -0,0 +1,51 @@
+<?php
+
+namespace Event;
+
+use Core\Listener;
+use Model\Project;
+
+/**
+ * Task modification listener
+ *
+ * @package events
+ * @author Frederic Guillot
+ */
+class TaskModification implements Listener
+{
+ /**
+ * Project model
+ *
+ * @accesss private
+ * @var \Model\Project
+ */
+ private $project;
+
+ /**
+ * Constructor
+ *
+ * @access public
+ * @param \Model\Project $project Project model instance
+ */
+ public function __construct(Project $project)
+ {
+ $this->project = $project;
+ }
+
+ /**
+ * 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)
+ {
+ if (isset($data['project_id'])) {
+ $this->project->updateModificationDate($data['project_id']);
+ return true;
+ }
+
+ return false;
+ }
+}