diff options
author | Michael Lüpkes <michael@luepkes.net> | 2015-02-03 11:16:10 +0100 |
---|---|---|
committer | Michael Lüpkes <michael@luepkes.net> | 2015-02-03 11:16:10 +0100 |
commit | e5ea36125536b5ac8f8a7e31c2602e9bd1b52075 (patch) | |
tree | 1879bcf0ca1fb3f7ea7375c548fdc00ab75e715a /app/Model/Swimlane.php | |
parent | 24300f828a684eedf71d63374effb2be95c13b1a (diff) |
Implemented Changes to Project Duplication to include Swimlanes and Tasks.
ProjectDuplication::duplicate accepts additional param of type array now. Array includes which optional parts to duplicate. Optional parts are: 'swimlane', 'category', 'task', 'action'.
Diffstat (limited to 'app/Model/Swimlane.php')
-rw-r--r-- | app/Model/Swimlane.php | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/app/Model/Swimlane.php b/app/Model/Swimlane.php index 71b95ae9..c9bc43e1 100644 --- a/app/Model/Swimlane.php +++ b/app/Model/Swimlane.php @@ -183,7 +183,7 @@ class Swimlane extends Base * @access public * @param integer $project_id * @param string $name - * @return bool + * @return integer|boolean */ public function create($project_id, $name) { @@ -413,6 +413,37 @@ class Swimlane extends Base } /** + * Duplicate Swimlane to project + * + * @access public + * @param integer $project_from Project Template + * @param integer $project_to Project that receives the copy + * @return integer|boolean + */ + + public function duplicate($project_from, $project_to) + { + $swimlanes = $this->getAll($project_from); + + foreach ($swimlanes as $swimlane) { + + unset($swimlane['id']); + $swimlane['project_id'] = $project_to; + + if (! $this->db->table(self::TABLE)->save($swimlane)) { + return false; + } + } + + $default_swimlane = $this->getDefault($project_from); + $default_swimlane['id'] = $project_to; + + $this->updateDefault($default_swimlane); + + return true; + } + + /** * Validate creation * * @access public |