summaryrefslogtreecommitdiff
path: root/controllers/task.php
diff options
context:
space:
mode:
Diffstat (limited to 'controllers/task.php')
-rw-r--r--controllers/task.php52
1 files changed, 46 insertions, 6 deletions
diff --git a/controllers/task.php b/controllers/task.php
index 9065c576..f5738a55 100644
--- a/controllers/task.php
+++ b/controllers/task.php
@@ -253,7 +253,7 @@ class Task extends Base
$this->session->flashError(t('Unable to close this task.'));
}
- $this->response->redirect('?controller=board&action=show&project_id='.$task['project_id']);
+ $this->response->redirect('?controller=task&action=show&task_id='.$task['id']);
}
/**
@@ -263,12 +263,12 @@ class Task extends Base
*/
public function confirmClose()
{
- $task = $this->task->getById($this->request->getIntegerParam('task_id'));
+ $task = $this->task->getById($this->request->getIntegerParam('task_id'), true);
if (! $task) $this->notfound();
$this->checkProjectPermissions($task['project_id']);
- $this->response->html($this->template->layout('task_close', array(
+ $this->response->html($this->taskLayout('task_close', array(
'task' => $task,
'menu' => 'tasks',
'title' => t('Close a task')
@@ -293,7 +293,7 @@ class Task extends Base
$this->session->flashError(t('Unable to open this task.'));
}
- $this->response->redirect('?controller=board&action=show&project_id='.$task['project_id']);
+ $this->response->redirect('?controller=task&action=show&task_id='.$task['id']);
}
/**
@@ -303,12 +303,12 @@ class Task extends Base
*/
public function confirmOpen()
{
- $task = $this->task->getById($this->request->getIntegerParam('task_id'));
+ $task = $this->task->getById($this->request->getIntegerParam('task_id'), true);
if (! $task) $this->notfound();
$this->checkProjectPermissions($task['project_id']);
- $this->response->html($this->template->layout('task_open', array(
+ $this->response->html($this->taskLayout('task_open', array(
'task' => $task,
'menu' => 'tasks',
'title' => t('Open a task')
@@ -316,6 +316,46 @@ class Task extends Base
}
/**
+ * Remove a task
+ *
+ * @access public
+ */
+ public function remove()
+ {
+ $task = $this->task->getById($this->request->getIntegerParam('task_id'));
+
+ if (! $task) $this->notfound();
+ $this->checkProjectPermissions($task['project_id']);
+
+ if ($this->task->remove($task['id'])) {
+ $this->session->flash(t('Task removed successfully.'));
+ } else {
+ $this->session->flashError(t('Unable to remove this task.'));
+ }
+
+ $this->response->redirect('?controller=board&action=show&project_id='.$task['project_id']);
+ }
+
+ /**
+ * Confirmation dialog before removing a task
+ *
+ * @access public
+ */
+ public function confirmRemove()
+ {
+ $task = $this->task->getById($this->request->getIntegerParam('task_id'), true);
+
+ if (! $task) $this->notfound();
+ $this->checkProjectPermissions($task['project_id']);
+
+ $this->response->html($this->taskLayout('task_remove', array(
+ 'task' => $task,
+ 'menu' => 'tasks',
+ 'title' => t('Remove a task')
+ )));
+ }
+
+ /**
* Duplicate a task (fill the form for a new task)
*
* @access public