Import automatic actions from another project

This commit is contained in:
Frederic Guillot
2016-03-05 13:39:55 -05:00
parent 9983e1422b
commit 1e169ae16c
5 changed files with 68 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
<?php
namespace Kanboard\Controller;
/**
* Duplicate automatic action from another project
*
* @package controller
* @author Frederic Guillot
*/
class ActionProject extends Base
{
public function project()
{
$project = $this->getProject();
$projects = $this->projectUserRole->getProjectsByUser($this->userSession->getId());
unset($projects[$project['id']]);
$this->response->html($this->helper->layout->project('action_project/project', 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('Action', 'index', array('project_id' => $project['id'])));
}
}