summaryrefslogtreecommitdiff
path: root/app/Controller/Action.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-08-30 14:08:46 -0800
committerFrédéric Guillot <fred@kanboard.net>2014-08-30 14:08:46 -0800
commit9194a2604d79ef97994d01c35fb454f745b5412c (patch)
tree365dd4294e536c440610bee4f07a1bffb00d00eb /app/Controller/Action.php
parente1eba08398c6c6ece684f9db6dedb0dff5d43071 (diff)
Projects management refactoring
Diffstat (limited to 'app/Controller/Action.php')
-rw-r--r--app/Controller/Action.php35
1 files changed, 9 insertions, 26 deletions
diff --git a/app/Controller/Action.php b/app/Controller/Action.php
index 797bbfa2..b2f80009 100644
--- a/app/Controller/Action.php
+++ b/app/Controller/Action.php
@@ -17,15 +17,9 @@ class Action extends Base
*/
public function index()
{
- $project_id = $this->request->getIntegerParam('project_id');
- $project = $this->project->getById($project_id);
+ $project = $this->getProject();
- if (! $project) {
- $this->session->flashError(t('Project not found.'));
- $this->response->redirect('?controller=project');
- }
-
- $this->response->html($this->template->layout('action_index', array(
+ $this->response->html($this->projectLayout('action_index', array(
'values' => array('project_id' => $project['id']),
'project' => $project,
'actions' => $this->action->getAllByProject($project['id']),
@@ -49,18 +43,11 @@ class Action extends Base
*/
public function params()
{
- $project_id = $this->request->getIntegerParam('project_id');
- $project = $this->project->getById($project_id);
-
- if (! $project) {
- $this->session->flashError(t('Project not found.'));
- $this->response->redirect('?controller=project');
- }
-
+ $project = $this->getProject();
$values = $this->request->getValues();
$action = $this->action->load($values['action_name'], $values['project_id']);
- $this->response->html($this->template->layout('action_params', array(
+ $this->response->html($this->projectLayout('action_params', array(
'values' => $values,
'action_params' => $action->getActionRequiredParameters(),
'columns_list' => $this->board->getColumnsList($project['id']),
@@ -81,14 +68,7 @@ class Action extends Base
*/
public function create()
{
- $project_id = $this->request->getIntegerParam('project_id');
- $project = $this->project->getById($project_id);
-
- if (! $project) {
- $this->session->flashError(t('Project not found.'));
- $this->response->redirect('?controller=project');
- }
-
+ $project = $this->getProject();
$values = $this->request->getValues();
list($valid,) = $this->action->validateCreation($values);
@@ -113,10 +93,13 @@ class Action extends Base
*/
public function confirm()
{
- $this->response->html($this->template->layout('action_remove', array(
+ $project = $this->getProject();
+
+ $this->response->html($this->projectLayout('action_remove', array(
'action' => $this->action->getById($this->request->getIntegerParam('action_id')),
'available_events' => $this->action->getAvailableEvents(),
'available_actions' => $this->action->getAvailableActions(),
+ 'project' => $project,
'menu' => 'projects',
'title' => t('Remove an action')
)));