diff options
Diffstat (limited to 'app/Controller')
-rw-r--r-- | app/Controller/Comment.php | 2 | ||||
-rw-r--r-- | app/Controller/File.php | 2 | ||||
-rw-r--r-- | app/Controller/TaskRecurrence.php | 61 | ||||
-rw-r--r-- | app/Controller/Taskduplication.php | 2 | ||||
-rw-r--r-- | app/Controller/Taskmodification.php | 41 |
5 files changed, 64 insertions, 44 deletions
diff --git a/app/Controller/Comment.php b/app/Controller/Comment.php index 1e94779f..2ad3f379 100644 --- a/app/Controller/Comment.php +++ b/app/Controller/Comment.php @@ -119,7 +119,7 @@ class Comment extends Base $this->flash->failure(t('Unable to update your comment.')); } - return $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), 'comment-'.$comment['id'])); + return $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), false); } $this->edit($values, $errors); diff --git a/app/Controller/File.php b/app/Controller/File.php index b347f67f..50db3865 100644 --- a/app/Controller/File.php +++ b/app/Controller/File.php @@ -59,7 +59,7 @@ class File extends Base $this->flash->failure(t('Unable to upload the file.')); } - $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']))); + $this->response->redirect($this->helper->url->to('task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); } /** diff --git a/app/Controller/TaskRecurrence.php b/app/Controller/TaskRecurrence.php new file mode 100644 index 00000000..f02f3cdc --- /dev/null +++ b/app/Controller/TaskRecurrence.php @@ -0,0 +1,61 @@ +<?php + +namespace Kanboard\Controller; + +/** + * Task Recurrence controller + * + * @package controller + * @author Frederic Guillot + */ +class TaskRecurrence extends Base +{ + /** + * Edit recurrence form + * + * @access public + */ + public function edit(array $values = array(), array $errors = array()) + { + $task = $this->getTask(); + + if (empty($values)) { + $values = $task; + } + + $this->response->html($this->helper->layout->task('task_recurrence/edit', array( + 'values' => $values, + 'errors' => $errors, + 'task' => $task, + 'recurrence_status_list' => $this->task->getRecurrenceStatusList(), + 'recurrence_trigger_list' => $this->task->getRecurrenceTriggerList(), + 'recurrence_timeframe_list' => $this->task->getRecurrenceTimeframeList(), + 'recurrence_basedate_list' => $this->task->getRecurrenceBasedateList(), + ))); + } + + /** + * Update recurrence form + * + * @access public + */ + public function update() + { + $task = $this->getTask(); + $values = $this->request->getValues(); + + list($valid, $errors) = $this->taskValidator->validateEditRecurrence($values); + + if ($valid) { + if ($this->taskModification->update($values)) { + $this->flash->success(t('Task updated successfully.')); + } else { + $this->flash->failure(t('Unable to update your task.')); + } + + $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); + } + + $this->edit($values, $errors); + } +} diff --git a/app/Controller/Taskduplication.php b/app/Controller/Taskduplication.php index f940eee3..7e7fccd6 100644 --- a/app/Controller/Taskduplication.php +++ b/app/Controller/Taskduplication.php @@ -28,7 +28,7 @@ class Taskduplication extends Base $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task_id))); } else { $this->flash->failure(t('Unable to create this task.')); - $this->response->redirect($this->helper->url->to('taskduplication', 'duplicate', array('project_id' => $task['project_id'], 'task_id' => $task['id']))); + $this->response->redirect($this->helper->url->to('taskduplication', 'duplicate', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); } } diff --git a/app/Controller/Taskmodification.php b/app/Controller/Taskmodification.php index cae1d8ee..0e9316b2 100644 --- a/app/Controller/Taskmodification.php +++ b/app/Controller/Taskmodification.php @@ -138,45 +138,4 @@ class Taskmodification extends Base $this->edit($values, $errors); } } - - /** - * Edit recurrence form - * - * @access public - */ - public function recurrence() - { - $task = $this->getTask(); - - if ($this->request->isPost()) { - $values = $this->request->getValues(); - - list($valid, $errors) = $this->taskValidator->validateEditRecurrence($values); - - if ($valid) { - if ($this->taskModification->update($values)) { - $this->flash->success(t('Task updated successfully.')); - } else { - $this->flash->failure(t('Unable to update your task.')); - } - - $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id']))); - } - } else { - $values = $task; - $errors = array(); - } - - $params = array( - 'values' => $values, - 'errors' => $errors, - 'task' => $task, - 'recurrence_status_list' => $this->task->getRecurrenceStatusList(), - 'recurrence_trigger_list' => $this->task->getRecurrenceTriggerList(), - 'recurrence_timeframe_list' => $this->task->getRecurrenceTimeframeList(), - 'recurrence_basedate_list' => $this->task->getRecurrenceBasedateList(), - ); - - $this->response->html($this->helper->layout->task('task_modification/edit_recurrence', $params)); - } } |