diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-05-17 22:25:18 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-05-17 22:25:18 -0400 |
commit | 46ed06268dc3d591fb7bb90a5a9a75e77c17b86c (patch) | |
tree | 4e4cc7d42bed1d5ca5e1c9d65415def3161cad2c /app/Controller/SubtaskRestrictionController.php | |
parent | 996997a12d1b435956a96640eb6cf39045f6ef46 (diff) |
Rename subtask controller
Diffstat (limited to 'app/Controller/SubtaskRestrictionController.php')
-rw-r--r-- | app/Controller/SubtaskRestrictionController.php | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/app/Controller/SubtaskRestrictionController.php b/app/Controller/SubtaskRestrictionController.php new file mode 100644 index 00000000..185371e7 --- /dev/null +++ b/app/Controller/SubtaskRestrictionController.php @@ -0,0 +1,61 @@ +<?php + +namespace Kanboard\Controller; + +use Kanboard\Model\Subtask as SubtaskModel; + +/** + * Subtask Restriction + * + * @package Kanboard\Controller + * @author Frederic Guillot + */ +class SubtaskRestrictionController extends BaseController +{ + /** + * Show popup + * + * @access public + */ + public function show() + { + $task = $this->getTask(); + $subtask = $this->getSubtask(); + + $this->response->html($this->template->render('subtask_restriction/show', array( + 'status_list' => array( + SubtaskModel::STATUS_TODO => t('Todo'), + SubtaskModel::STATUS_DONE => t('Done'), + ), + 'subtask_inprogress' => $this->subtask->getSubtaskInProgress($this->userSession->getId()), + 'subtask' => $subtask, + 'task' => $task, + ))); + } + + /** + * Change status of the in progress subtask and the other subtask + * + * @access public + */ + public function save() + { + $task = $this->getTask(); + $subtask = $this->getSubtask(); + $values = $this->request->getValues(); + + // Change status of the previous "in progress" subtask + $this->subtask->update(array( + 'id' => $values['id'], + 'status' => $values['status'], + )); + + // Set the current subtask to "in progress" + $this->subtask->update(array( + 'id' => $subtask['id'], + 'status' => SubtaskModel::STATUS_INPROGRESS, + )); + + $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])), true); + } +} |