From 4d6e5d2e2cc0950114cc3ca9f32e66aa779d3b48 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 16 May 2015 21:47:16 -0400 Subject: Add new automatic action to update the start date --- app/Action/TaskAssignColorColumn.php | 1 + app/Action/TaskUpdateStartDate.php | 83 ++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 app/Action/TaskUpdateStartDate.php (limited to 'app/Action') diff --git a/app/Action/TaskAssignColorColumn.php b/app/Action/TaskAssignColorColumn.php index 2d10b776..ee1d66ae 100644 --- a/app/Action/TaskAssignColorColumn.php +++ b/app/Action/TaskAssignColorColumn.php @@ -8,6 +8,7 @@ use Model\Task; * Assign a color to a task * * @package action + * @author Frederic Guillot */ class TaskAssignColorColumn extends Base { 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 @@ + 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'); + } +} -- cgit v1.2.3