summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorFrédéric Guillot <fguillot@users.noreply.github.com>2014-03-10 22:23:16 -0400
committerFrédéric Guillot <fguillot@users.noreply.github.com>2014-03-10 22:23:16 -0400
commit66c7cf0caa5802c825e3f511158bb719cf82cafa (patch)
tree0fcce70f7fc513c98f60e5f25564a56b5ba11b24 /actions
parent1cda8059b577d4025efa96377def082bf8f35f94 (diff)
Add an automatic action to assign a color to a specific user
Diffstat (limited to 'actions')
-rw-r--r--actions/task_assign_color_user.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/actions/task_assign_color_user.php b/actions/task_assign_color_user.php
new file mode 100644
index 00000000..a9f08e30
--- /dev/null
+++ b/actions/task_assign_color_user.php
@@ -0,0 +1,47 @@
+<?php
+
+namespace Action;
+
+require_once __DIR__.'/base.php';
+
+class TaskAssignColorUser extends Base
+{
+ public function __construct($project_id, \Model\Task $task)
+ {
+ parent::__construct($project_id);
+ $this->task = $task;
+ }
+
+ public function getActionRequiredParameters()
+ {
+ return array(
+ 'column_id' => t('Column'),
+ 'color_id' => t('Color'),
+ 'user_id' => t('Assignee'),
+ );
+ }
+
+ public function getEventRequiredParameters()
+ {
+ return array(
+ 'task_id',
+ 'owner_id',
+ 'column_id',
+ );
+ }
+
+ public function doAction(array $data)
+ {
+ if ($data['column_id'] == $this->getParam('column_id') && $data['owner_id'] == $this->getParam('user_id')) {
+
+ $this->task->update(array(
+ 'id' => $data['task_id'],
+ 'color_id' => $this->getParam('color_id'),
+ ));
+
+ return true;
+ }
+
+ return false;
+ }
+}