diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-09-01 18:14:40 -0800 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-09-01 18:14:40 -0800 |
commit | e4965546543be040da29dc341900fa9511a158be (patch) | |
tree | a17cc50c942331204061f220af43df9cce583198 /app/Model | |
parent | 52f9c82e303189b873dc21142cdcf7f9334ea78c (diff) |
Add an automated action to move a task to another project
Diffstat (limited to 'app/Model')
-rw-r--r-- | app/Model/Action.php | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/app/Model/Action.php b/app/Model/Action.php index f296a58f..ad995991 100644 --- a/app/Model/Action.php +++ b/app/Model/Action.php @@ -41,6 +41,7 @@ class Action extends Base 'TaskAssignSpecificUser' => t('Assign the task to a specific user'), 'TaskAssignCurrentUser' => t('Assign the task to the person who does the action'), 'TaskDuplicateAnotherProject' => t('Duplicate the task to another project'), + 'TaskMoveAnotherProject' => t('Move the task to another project'), 'TaskAssignColorUser' => t('Assign a color to a specific user'), 'TaskAssignColorCategory' => t('Assign automatically a color based on a category'), 'TaskAssignCategoryColor' => t('Assign automatically a category based on a color'), @@ -217,34 +218,16 @@ class Action extends Base * @param integer $project_id Project id * @throws \LogicException * @return \Core\Listener Action Instance - * @throw LogicException */ public function load($name, $project_id) { - switch ($name) { - case 'TaskClose': - $className = '\Action\TaskClose'; - return new $className($project_id, new Task($this->registry)); - case 'TaskAssignCurrentUser': - $className = '\Action\TaskAssignCurrentUser'; - return new $className($project_id, new Task($this->registry), new Acl($this->registry)); - case 'TaskAssignSpecificUser': - $className = '\Action\TaskAssignSpecificUser'; - return new $className($project_id, new Task($this->registry)); - case 'TaskDuplicateAnotherProject': - $className = '\Action\TaskDuplicateAnotherProject'; - return new $className($project_id, new Task($this->registry)); - case 'TaskAssignColorUser': - $className = '\Action\TaskAssignColorUser'; - return new $className($project_id, new Task($this->registry)); - case 'TaskAssignColorCategory': - $className = '\Action\TaskAssignColorCategory'; - return new $className($project_id, new Task($this->registry)); - case 'TaskAssignCategoryColor': - $className = '\Action\TaskAssignCategoryColor'; - return new $className($project_id, new Task($this->registry)); - default: - throw new LogicException('Action not found: '.$name); + $className = '\Action\\'.$name; + + if ($name === 'TaskAssignCurrentUser') { + return new $className($project_id, new Task($this->registry), new Acl($this->registry)); + } + else { + return new $className($project_id, new Task($this->registry)); } } |