summaryrefslogtreecommitdiff
path: root/app/Action
diff options
context:
space:
mode:
Diffstat (limited to 'app/Action')
-rw-r--r--app/Action/Base.php63
-rw-r--r--app/Action/CommentCreation.php83
-rw-r--r--app/Action/TaskAssignCategoryColor.php2
-rw-r--r--app/Action/TaskAssignCategoryLabel.php4
-rw-r--r--app/Action/TaskAssignColorCategory.php2
-rw-r--r--app/Action/TaskAssignColorColumn.php85
-rw-r--r--app/Action/TaskAssignColorUser.php2
-rw-r--r--app/Action/TaskAssignCurrentUser.php8
-rw-r--r--app/Action/TaskAssignSpecificUser.php2
-rw-r--r--app/Action/TaskAssignUser.php4
-rw-r--r--app/Action/TaskClose.php18
-rw-r--r--app/Action/TaskCreation.php8
-rw-r--r--app/Action/TaskDuplicateAnotherProject.php4
-rw-r--r--app/Action/TaskLogMoveAnotherColumn.php84
-rw-r--r--app/Action/TaskMoveAnotherProject.php4
-rw-r--r--app/Action/TaskMoveColumnAssigned.php90
-rw-r--r--app/Action/TaskMoveColumnUnAssigned.php90
-rw-r--r--app/Action/TaskOpen.php4
-rw-r--r--app/Action/TaskUpdateStartDate.php83
19 files changed, 585 insertions, 55 deletions
diff --git a/app/Action/Base.php b/app/Action/Base.php
index 80930a4c..f29e9323 100644
--- a/app/Action/Base.php
+++ b/app/Action/Base.php
@@ -2,23 +2,26 @@
namespace Action;
-use Core\Listener;
-use Core\Registry;
-use Core\Tool;
+use Event\GenericEvent;
+use Pimple\Container;
/**
* Base class for automatic actions
*
* @package action
* @author Frederic Guillot
- *
- * @property \Model\Acl $acl
- * @property \Model\Task $task
- * @property \Model\TaskFinder $taskFinder
*/
-abstract class Base implements Listener
+abstract class Base extends \Core\Base
{
/**
+ * Flag for called listener
+ *
+ * @access private
+ * @var boolean
+ */
+ private $called = false;
+
+ /**
* Project id
*
* @access private
@@ -43,12 +46,12 @@ abstract class Base implements Listener
protected $event_name = '';
/**
- * Registry instance
+ * Container instance
*
* @access protected
- * @var \Core\Registry
+ * @var \Pimple\Container
*/
- protected $registry;
+ protected $container;
/**
* Execute the action
@@ -100,15 +103,16 @@ abstract class Base implements Listener
* Constructor
*
* @access public
- * @param \Core\Registry $registry Regsitry instance
- * @param integer $project_id Project id
- * @param string $event_name Attached event name
+ * @param \Pimple\Container $container Container
+ * @param integer $project_id Project id
+ * @param string $event_name Attached event name
*/
- public function __construct(Registry $registry, $project_id, $event_name)
+ public function __construct(Container $container, $project_id, $event_name)
{
- $this->registry = $registry;
+ $this->container = $container;
$this->project_id = $project_id;
$this->event_name = $event_name;
+ $this->called = false;
}
/**
@@ -123,18 +127,6 @@ abstract class Base implements Listener
}
/**
- * Load automatically models
- *
- * @access public
- * @param string $name Model name
- * @return mixed
- */
- public function __get($name)
- {
- return Tool::loadModel($this->registry, $name);
- }
-
- /**
* Set an user defined parameter
*
* @access public
@@ -178,7 +170,6 @@ abstract class Base implements Listener
* Check if the event is compatible with the action
*
* @access public
- * @param array $data Event data dictionary
* @return bool
*/
public function hasCompatibleEvent()
@@ -220,12 +211,20 @@ abstract class Base implements Listener
* Execute the action
*
* @access public
- * @param array $data Event data dictionary
- * @return bool True if the action was executed or false when not executed
+ * @param \Event\GenericEvent $event Event data dictionary
+ * @return bool True if the action was executed or false when not executed
*/
- public function execute(array $data)
+ public function execute(GenericEvent $event)
{
+ // Avoid infinite loop, a listener instance can be called only one time
+ if ($this->called) {
+ return false;
+ }
+
+ $data = $event->getAll();
+
if ($this->isExecutable($data)) {
+ $this->called = true;
return $this->doAction($data);
}
diff --git a/app/Action/CommentCreation.php b/app/Action/CommentCreation.php
new file mode 100644
index 00000000..54d7be7d
--- /dev/null
+++ b/app/Action/CommentCreation.php
@@ -0,0 +1,83 @@
+<?php
+
+namespace Action;
+
+use Integration\GithubWebhook;
+
+/**
+ * Create automatically a comment from a webhook
+ *
+ * @package action
+ * @author Frederic Guillot
+ */
+class CommentCreation extends Base
+{
+ /**
+ * Get the list of compatible events
+ *
+ * @access public
+ * @return string[]
+ */
+ public function getCompatibleEvents()
+ {
+ return array(
+ GithubWebhook::EVENT_ISSUE_COMMENT,
+ );
+ }
+
+ /**
+ * Get the required parameter for the action (defined by the user)
+ *
+ * @access public
+ * @return string[]
+ */
+ public function getActionRequiredParameters()
+ {
+ return array();
+ }
+
+ /**
+ * Get the required parameter for the event
+ *
+ * @access public
+ * @return array
+ */
+ public function getEventRequiredParameters()
+ {
+ return array(
+ 'reference',
+ 'comment',
+ 'user_id',
+ 'task_id',
+ );
+ }
+
+ /**
+ * Execute the action (create a new comment)
+ *
+ * @access public
+ * @param array $data Event data dictionary
+ * @return bool True if the action was executed or false when not executed
+ */
+ public function doAction(array $data)
+ {
+ return (bool) $this->comment->create(array(
+ 'reference' => $data['reference'],
+ 'comment' => $data['comment'],
+ 'task_id' => $data['task_id'],
+ 'user_id' => $data['user_id'],
+ ));
+ }
+
+ /**
+ * Check if the event data meet the action condition
+ *
+ * @access public
+ * @param array $data Event data dictionary
+ * @return bool
+ */
+ public function hasRequiredCondition(array $data)
+ {
+ return true;
+ }
+}
diff --git a/app/Action/TaskAssignCategoryColor.php b/app/Action/TaskAssignCategoryColor.php
index be15f659..ba319a1f 100644
--- a/app/Action/TaskAssignCategoryColor.php
+++ b/app/Action/TaskAssignCategoryColor.php
@@ -67,7 +67,7 @@ class TaskAssignCategoryColor extends Base
'category_id' => $this->getParam('category_id'),
);
- return $this->task->update($values, false);
+ return $this->taskModification->update($values);
}
/**
diff --git a/app/Action/TaskAssignCategoryLabel.php b/app/Action/TaskAssignCategoryLabel.php
index 5e1b025e..1383d491 100644
--- a/app/Action/TaskAssignCategoryLabel.php
+++ b/app/Action/TaskAssignCategoryLabel.php
@@ -2,7 +2,7 @@
namespace Action;
-use Model\GithubWebhook;
+use Integration\GithubWebhook;
/**
* Set a category automatically according to a label
@@ -67,7 +67,7 @@ class TaskAssignCategoryLabel extends Base
'category_id' => isset($data['category_id']) ? $data['category_id'] : $this->getParam('category_id'),
);
- return $this->task->update($values, false);
+ return $this->taskModification->update($values);
}
/**
diff --git a/app/Action/TaskAssignColorCategory.php b/app/Action/TaskAssignColorCategory.php
index f5a9ac5a..a362c68f 100644
--- a/app/Action/TaskAssignColorCategory.php
+++ b/app/Action/TaskAssignColorCategory.php
@@ -67,7 +67,7 @@ class TaskAssignColorCategory extends Base
'color_id' => $this->getParam('color_id'),
);
- return $this->task->update($values, false);
+ return $this->taskModification->update($values);
}
/**
diff --git a/app/Action/TaskAssignColorColumn.php b/app/Action/TaskAssignColorColumn.php
new file mode 100644
index 00000000..deb3e2b0
--- /dev/null
+++ b/app/Action/TaskAssignColorColumn.php
@@ -0,0 +1,85 @@
+<?php
+
+namespace Action;
+
+use Model\Task;
+
+/**
+ * Assign a color to a task
+ *
+ * @package action
+ * @author Frederic Guillot
+ */
+class TaskAssignColorColumn extends Base
+{
+ /**
+ * Get the list of compatible events
+ *
+ * @access public
+ * @return array
+ */
+ public function getCompatibleEvents()
+ {
+ return array(
+ Task::EVENT_CREATE,
+ Task::EVENT_MOVE_COLUMN,
+ );
+ }
+
+ /**
+ * Get the required parameter for the action (defined by the user)
+ *
+ * @access public
+ * @return array
+ */
+ public function getActionRequiredParameters()
+ {
+ return array(
+ 'column_id' => t('Column'),
+ 'color_id' => t('Color'),
+ );
+ }
+
+ /**
+ * Get the required parameter for the event
+ *
+ * @access public
+ * @return string[]
+ */
+ public function getEventRequiredParameters()
+ {
+ return array(
+ 'task_id',
+ 'column_id',
+ );
+ }
+
+ /**
+ * Execute the action (set the task color)
+ *
+ * @access public
+ * @param array $data Event data dictionary
+ * @return bool True if the action was executed or false when not executed
+ */
+ public function doAction(array $data)
+ {
+ $values = array(
+ 'id' => $data['task_id'],
+ 'color_id' => $this->getParam('color_id'),
+ );
+
+ return $this->taskModification->update($values);
+ }
+
+ /**
+ * Check if the event data meet the action condition
+ *
+ * @access public
+ * @param array $data Event data dictionary
+ * @return bool
+ */
+ public function hasRequiredCondition(array $data)
+ {
+ return $data['column_id'] == $this->getParam('column_id');
+ }
+}
diff --git a/app/Action/TaskAssignColorUser.php b/app/Action/TaskAssignColorUser.php
index 00680186..6161514d 100644
--- a/app/Action/TaskAssignColorUser.php
+++ b/app/Action/TaskAssignColorUser.php
@@ -68,7 +68,7 @@ class TaskAssignColorUser extends Base
'color_id' => $this->getParam('color_id'),
);
- return $this->task->update($values, false);
+ return $this->taskModification->update($values);
}
/**
diff --git a/app/Action/TaskAssignCurrentUser.php b/app/Action/TaskAssignCurrentUser.php
index 7a9cf70b..ff3aaee1 100644
--- a/app/Action/TaskAssignCurrentUser.php
+++ b/app/Action/TaskAssignCurrentUser.php
@@ -62,12 +62,16 @@ class TaskAssignCurrentUser extends Base
*/
public function doAction(array $data)
{
+ if (! $this->userSession->isLogged()) {
+ return false;
+ }
+
$values = array(
'id' => $data['task_id'],
- 'owner_id' => $this->acl->getUserId(),
+ 'owner_id' => $this->userSession->getId(),
);
- return $this->task->update($values, false);
+ return $this->taskModification->update($values);
}
/**
diff --git a/app/Action/TaskAssignSpecificUser.php b/app/Action/TaskAssignSpecificUser.php
index f70459be..4c96f7f0 100644
--- a/app/Action/TaskAssignSpecificUser.php
+++ b/app/Action/TaskAssignSpecificUser.php
@@ -68,7 +68,7 @@ class TaskAssignSpecificUser extends Base
'owner_id' => $this->getParam('user_id'),
);
- return $this->task->update($values, false);
+ return $this->taskModification->update($values);
}
/**
diff --git a/app/Action/TaskAssignUser.php b/app/Action/TaskAssignUser.php
index 29ea91e6..cf2a9a4b 100644
--- a/app/Action/TaskAssignUser.php
+++ b/app/Action/TaskAssignUser.php
@@ -2,7 +2,7 @@
namespace Action;
-use Model\GithubWebhook;
+use Integration\GithubWebhook;
/**
* Assign a task to someone
@@ -64,7 +64,7 @@ class TaskAssignUser extends Base
'owner_id' => $data['owner_id'],
);
- return $this->task->update($values, false);
+ return $this->taskModification->update($values);
}
/**
diff --git a/app/Action/TaskClose.php b/app/Action/TaskClose.php
index f71d4b0e..b7cd4dbf 100644
--- a/app/Action/TaskClose.php
+++ b/app/Action/TaskClose.php
@@ -2,7 +2,9 @@
namespace Action;
-use Model\GithubWebhook;
+use Integration\GitlabWebhook;
+use Integration\GithubWebhook;
+use Integration\BitbucketWebhook;
use Model\Task;
/**
@@ -25,6 +27,9 @@ class TaskClose extends Base
Task::EVENT_MOVE_COLUMN,
GithubWebhook::EVENT_COMMIT,
GithubWebhook::EVENT_ISSUE_CLOSED,
+ GitlabWebhook::EVENT_COMMIT,
+ GitlabWebhook::EVENT_ISSUE_CLOSED,
+ BitbucketWebhook::EVENT_COMMIT,
);
}
@@ -39,6 +44,9 @@ class TaskClose extends Base
switch ($this->event_name) {
case GithubWebhook::EVENT_COMMIT:
case GithubWebhook::EVENT_ISSUE_CLOSED:
+ case GitlabWebhook::EVENT_COMMIT:
+ case GitlabWebhook::EVENT_ISSUE_CLOSED:
+ case BitbucketWebhook::EVENT_COMMIT:
return array();
default:
return array('column_id' => t('Column'));
@@ -56,6 +64,9 @@ class TaskClose extends Base
switch ($this->event_name) {
case GithubWebhook::EVENT_COMMIT:
case GithubWebhook::EVENT_ISSUE_CLOSED:
+ case GitlabWebhook::EVENT_COMMIT:
+ case GitlabWebhook::EVENT_ISSUE_CLOSED:
+ case BitbucketWebhook::EVENT_COMMIT:
return array('task_id');
default:
return array('task_id', 'column_id');
@@ -71,7 +82,7 @@ class TaskClose extends Base
*/
public function doAction(array $data)
{
- return $this->task->close($data['task_id']);
+ return $this->taskStatus->close($data['task_id']);
}
/**
@@ -86,6 +97,9 @@ class TaskClose extends Base
switch ($this->event_name) {
case GithubWebhook::EVENT_COMMIT:
case GithubWebhook::EVENT_ISSUE_CLOSED:
+ case GitlabWebhook::EVENT_COMMIT:
+ case GitlabWebhook::EVENT_ISSUE_CLOSED:
+ case BitbucketWebhook::EVENT_COMMIT:
return true;
default:
return $data['column_id'] == $this->getParam('column_id');
diff --git a/app/Action/TaskCreation.php b/app/Action/TaskCreation.php
index 41d0200c..1c093eee 100644
--- a/app/Action/TaskCreation.php
+++ b/app/Action/TaskCreation.php
@@ -2,7 +2,8 @@
namespace Action;
-use Model\GithubWebhook;
+use Integration\GithubWebhook;
+use Integration\GitlabWebhook;
/**
* Create automatically a task from a webhook
@@ -22,6 +23,7 @@ class TaskCreation extends Base
{
return array(
GithubWebhook::EVENT_ISSUE_OPENED,
+ GitlabWebhook::EVENT_ISSUE_OPENED,
);
}
@@ -59,11 +61,11 @@ class TaskCreation extends Base
*/
public function doAction(array $data)
{
- return $this->task->create(array(
+ return (bool) $this->taskCreation->create(array(
'project_id' => $data['project_id'],
'title' => $data['title'],
'reference' => $data['reference'],
- 'description' => $data['description'],
+ 'description' => isset($data['description']) ? $data['description'] : '',
));
}
diff --git a/app/Action/TaskDuplicateAnotherProject.php b/app/Action/TaskDuplicateAnotherProject.php
index 4ab88534..55ebc76e 100644
--- a/app/Action/TaskDuplicateAnotherProject.php
+++ b/app/Action/TaskDuplicateAnotherProject.php
@@ -64,9 +64,7 @@ class TaskDuplicateAnotherProject extends Base
*/
public function doAction(array $data)
{
- $task = $this->taskFinder->getById($data['task_id']);
- $this->task->duplicateToAnotherProject($this->getParam('project_id'), $task);
- return true;
+ return (bool) $this->taskDuplication->duplicateToProject($data['task_id'], $this->getParam('project_id'));
}
/**
diff --git a/app/Action/TaskLogMoveAnotherColumn.php b/app/Action/TaskLogMoveAnotherColumn.php
new file mode 100644
index 00000000..621e8e6c
--- /dev/null
+++ b/app/Action/TaskLogMoveAnotherColumn.php
@@ -0,0 +1,84 @@
+<?php
+
+namespace Action;
+
+use Model\GithubWebhook;
+use Model\Task;
+
+/**
+ * Add a log of the triggering event to the task description.
+ *
+ * @package action
+ * @author Oren Ben-Kiki
+ */
+class TaskLogMoveAnotherColumn extends Base
+{
+ /**
+ * Get the list of compatible events
+ *
+ * @access public
+ * @return array
+ */
+ public function getCompatibleEvents()
+ {
+ return array(
+ Task::EVENT_MOVE_COLUMN,
+ );
+ }
+
+ /**
+ * Get the required parameter for the action (defined by the user)
+ *
+ * @access public
+ * @return array
+ */
+ public function getActionRequiredParameters()
+ {
+ return array('column_id' => t('Column'));
+ }
+
+ /**
+ * Get the required parameter for the event
+ *
+ * @access public
+ * @return string[]
+ */
+ public function getEventRequiredParameters()
+ {
+ return array('task_id', 'column_id');
+ }
+
+ /**
+ * Execute the action (append to the task description).
+ *
+ * @access public
+ * @param array $data Event data dictionary
+ * @return bool True if the action was executed or false when not executed
+ */
+ public function doAction(array $data)
+ {
+ if (! $this->userSession->isLogged()) {
+ return false;
+ }
+
+ $column = $this->board->getColumn($data['column_id']);
+
+ return (bool) $this->comment->create(array(
+ 'comment' => t('Moved to column %s', $column['title']),
+ 'task_id' => $data['task_id'],
+ 'user_id' => $this->userSession->getId(),
+ ));
+ }
+
+ /**
+ * Check if the event data meet the action condition
+ *
+ * @access public
+ * @param array $data Event data dictionary
+ * @return bool
+ */
+ public function hasRequiredCondition(array $data)
+ {
+ return $data['column_id'] == $this->getParam('column_id');
+ }
+}
diff --git a/app/Action/TaskMoveAnotherProject.php b/app/Action/TaskMoveAnotherProject.php
index d852f56d..ee212998 100644
--- a/app/Action/TaskMoveAnotherProject.php
+++ b/app/Action/TaskMoveAnotherProject.php
@@ -64,9 +64,7 @@ class TaskMoveAnotherProject extends Base
*/
public function doAction(array $data)
{
- $task = $this->taskFinder->getById($data['task_id']);
- $this->task->moveToAnotherProject($this->getParam('project_id'), $task);
- return true;
+ return $this->taskDuplication->moveToProject($data['task_id'], $this->getParam('project_id'));
}
/**
diff --git a/app/Action/TaskMoveColumnAssigned.php b/app/Action/TaskMoveColumnAssigned.php
new file mode 100644
index 00000000..decf4b01
--- /dev/null
+++ b/app/Action/TaskMoveColumnAssigned.php
@@ -0,0 +1,90 @@
+<?php
+
+namespace Action;
+
+use Model\Task;
+
+/**
+ * Move a task to another column when an assignee is set
+ *
+ * @package action
+ * @author Francois Ferrand
+ */
+class TaskMoveColumnAssigned extends Base
+{
+ /**
+ * Get the list of compatible events
+ *
+ * @access public
+ * @return array
+ */
+ public function getCompatibleEvents()
+ {
+ return array(
+ Task::EVENT_ASSIGNEE_CHANGE,
+ );
+ }
+
+ /**
+ * Get the required parameter for the action (defined by the user)
+ *
+ * @access public
+ * @return array
+ */
+ public function getActionRequiredParameters()
+ {
+ return array(
+ 'src_column_id' => t('Source column'),
+ 'dest_column_id' => t('Destination column')
+ );
+ }
+
+ /**
+ * Get the required parameter for the event
+ *
+ * @access public
+ * @return string[]
+ */
+ public function getEventRequiredParameters()
+ {
+ return array(
+ 'task_id',
+ 'column_id',
+ 'project_id',
+ 'owner_id'
+ );
+ }
+
+ /**
+ * Execute the action (move the task to another column)
+ *
+ * @access public
+ * @param array $data Event data dictionary
+ * @return bool True if the action was executed or false when not executed
+ */
+ public function doAction(array $data)
+ {
+ $original_task = $this->taskFinder->getById($data['task_id']);
+
+ return $this->taskPosition->movePosition(
+ $data['project_id'],
+ $data['task_id'],
+ $this->getParam('dest_column_id'),
+ $original_task['position'],
+ $original_task['swimlane_id'],
+ false
+ );
+ }
+
+ /**
+ * Check if the event data meet the action condition
+ *
+ * @access public
+ * @param array $data Event data dictionary
+ * @return bool
+ */
+ public function hasRequiredCondition(array $data)
+ {
+ return $data['column_id'] == $this->getParam('src_column_id') && $data['owner_id'];
+ }
+}
diff --git a/app/Action/TaskMoveColumnUnAssigned.php b/app/Action/TaskMoveColumnUnAssigned.php
new file mode 100644
index 00000000..b773252d
--- /dev/null
+++ b/app/Action/TaskMoveColumnUnAssigned.php
@@ -0,0 +1,90 @@
+<?php
+
+namespace Action;
+
+use Model\Task;
+
+/**
+ * Move a task to another column when an assignee is cleared
+ *
+ * @package action
+ * @author Francois Ferrand
+ */
+class TaskMoveColumnUnAssigned extends Base
+{
+ /**
+ * Get the list of compatible events
+ *
+ * @access public
+ * @return array
+ */
+ public function getCompatibleEvents()
+ {
+ return array(
+ Task::EVENT_ASSIGNEE_CHANGE
+ );
+ }
+
+ /**
+ * Get the required parameter for the action (defined by the user)
+ *
+ * @access public
+ * @return array
+ */
+ public function getActionRequiredParameters()
+ {
+ return array(
+ 'src_column_id' => t('Source column'),
+ 'dest_column_id' => t('Destination column')
+ );
+ }
+
+ /**
+ * Get the required parameter for the event
+ *
+ * @access public
+ * @return string[]
+ */
+ public function getEventRequiredParameters()
+ {
+ return array(
+ 'task_id',
+ 'column_id',
+ 'project_id',
+ 'owner_id'
+ );
+ }
+
+ /**
+ * Execute the action (move the task to another column)
+ *
+ * @access public
+ * @param array $data Event data dictionary
+ * @return bool True if the action was executed or false when not executed
+ */
+ public function doAction(array $data)
+ {
+ $original_task = $this->taskFinder->getById($data['task_id']);
+
+ return $this->taskPosition->movePosition(
+ $data['project_id'],
+ $data['task_id'],
+ $this->getParam('dest_column_id'),
+ $original_task['position'],
+ $original_task['swimlane_id'],
+ false
+ );
+ }
+
+ /**
+ * Check if the event data meet the action condition
+ *
+ * @access public
+ * @param array $data Event data dictionary
+ * @return bool
+ */
+ public function hasRequiredCondition(array $data)
+ {
+ return $data['column_id'] == $this->getParam('src_column_id') && ! $data['owner_id'];
+ }
+}
diff --git a/app/Action/TaskOpen.php b/app/Action/TaskOpen.php
index 6847856c..73f1fad3 100644
--- a/app/Action/TaskOpen.php
+++ b/app/Action/TaskOpen.php
@@ -2,7 +2,7 @@
namespace Action;
-use Model\GithubWebhook;
+use Integration\GithubWebhook;
/**
* Open automatically a task
@@ -56,7 +56,7 @@ class TaskOpen extends Base
*/
public function doAction(array $data)
{
- return $this->task->open($data['task_id']);
+ return $this->taskStatus->open($data['task_id']);
}
/**
diff --git a/app/Action/TaskUpdateStartDate.php b/app/Action/TaskUpdateStartDate.php
new file mode 100644
index 00000000..4cd50c9a
--- /dev/null
+++ b/app/Action/TaskUpdateStartDate.php
@@ -0,0 +1,83 @@
+<?php
+
+namespace Action;
+
+use Model\Task;
+
+/**
+ * Set the start date of task
+ *
+ * @package action
+ * @author Frederic Guillot
+ */
+class TaskUpdateStartDate extends Base
+{
+ /**
+ * Get the list of compatible events
+ *
+ * @access public
+ * @return array
+ */
+ public function getCompatibleEvents()
+ {
+ return array(
+ Task::EVENT_MOVE_COLUMN,
+ );
+ }
+
+ /**
+ * Get the required parameter for the action (defined by the user)
+ *
+ * @access public
+ * @return array
+ */
+ public function getActionRequiredParameters()
+ {
+ return array(
+ 'column_id' => t('Column'),
+ );
+ }
+
+ /**
+ * Get the required parameter for the event
+ *
+ * @access public
+ * @return string[]
+ */
+ public function getEventRequiredParameters()
+ {
+ return array(
+ 'task_id',
+ 'column_id',
+ );
+ }
+
+ /**
+ * Execute the action (set the task color)
+ *
+ * @access public
+ * @param array $data Event data dictionary
+ * @return bool True if the action was executed or false when not executed
+ */
+ public function doAction(array $data)
+ {
+ $values = array(
+ 'id' => $data['task_id'],
+ 'date_started' => time(),
+ );
+
+ return $this->taskModification->update($values);
+ }
+
+ /**
+ * Check if the event data meet the action condition
+ *
+ * @access public
+ * @param array $data Event data dictionary
+ * @return bool
+ */
+ public function hasRequiredCondition(array $data)
+ {
+ return $data['column_id'] == $this->getParam('column_id');
+ }
+}