summaryrefslogtreecommitdiff
path: root/app/Controller/ProjectActionDuplicationController.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-05-28 13:41:54 -0400
committerFrederic Guillot <fred@kanboard.net>2016-05-28 13:41:54 -0400
commit1353929a7dbd3f2e897fa7d3ab88e959ca573f9f (patch)
tree30bdbac4e466e74c3dfb4d451422f03c62bcbe41 /app/Controller/ProjectActionDuplicationController.php
parentab48a09f0d674b703467975b376c5ac7352670ae (diff)
Rename controllers
Diffstat (limited to 'app/Controller/ProjectActionDuplicationController.php')
-rw-r--r--app/Controller/ProjectActionDuplicationController.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/app/Controller/ProjectActionDuplicationController.php b/app/Controller/ProjectActionDuplicationController.php
new file mode 100644
index 00000000..790b7ed3
--- /dev/null
+++ b/app/Controller/ProjectActionDuplicationController.php
@@ -0,0 +1,38 @@
+<?php
+
+namespace Kanboard\Controller;
+
+/**
+ * Duplicate automatic action from another project
+ *
+ * @package Kanboard\Controller
+ * @author Frederic Guillot
+ */
+class ProjectActionDuplicationController extends BaseController
+{
+ public function show()
+ {
+ $project = $this->getProject();
+ $projects = $this->projectUserRole->getProjectsByUser($this->userSession->getId());
+ unset($projects[$project['id']]);
+
+ $this->response->html($this->template->render('project_action_duplication/show', array(
+ 'project' => $project,
+ 'projects_list' => $projects,
+ )));
+ }
+
+ public function save()
+ {
+ $project = $this->getProject();
+ $src_project_id = $this->request->getValue('src_project_id');
+
+ if ($this->action->duplicate($src_project_id, $project['id'])) {
+ $this->flash->success(t('Actions duplicated successfully.'));
+ } else {
+ $this->flash->failure(t('Unable to duplicate actions.'));
+ }
+
+ $this->response->redirect($this->helper->url->to('ActionController', 'index', array('project_id' => $project['id'])));
+ }
+}