| <?php |
|
|
| namespace Kanboard\Action; |
|
|
| use Kanboard\Model\TaskModel; |
| use Kanboard\Model\SubtaskModel; |
|
|
| |
| |
| |
| |
| |
| |
| class SubtaskTimerMoveTaskColumn extends Base |
| { |
| |
| |
| |
| |
| |
| |
| public function getDescription() |
| { |
| return t('Add a subtask and activate the timer when moving a task to another column'); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| public function getCompatibleEvents() |
| { |
| return array( |
| TaskModel::EVENT_MOVE_COLUMN, |
| ); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| public function getActionRequiredParameters() |
| { |
| return array( |
| 'column_id' => t('Column'), |
| 'subtask' => t('Subtask Title'), |
| ); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| public function getEventRequiredParameters() |
| { |
| return array( |
| 'task_id', |
| 'task' => array( |
| 'id', |
| 'column_id', |
| 'project_id', |
| 'creator_id', |
| ), |
| ); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| public function doAction(array $data) |
| { |
| $subtaskID = $this->subtaskModel->create(array( |
| 'title' => $this->getParam('subtask'), |
| 'user_id' => $data['task']['creator_id'], |
| 'task_id' => $data['task']['id'], |
| 'status' => SubtaskModel::STATUS_INPROGRESS, |
| )); |
|
|
| if ($subtaskID !== false) { |
| return $this->subtaskTimeTrackingModel->toggleTimer($subtaskID, $data['task']['creator_id'], SubtaskModel::STATUS_INPROGRESS); |
| } |
|
|
| return false; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| public function hasRequiredCondition(array $data) |
| { |
| return $data['task']['column_id'] == $this->getParam('column_id'); |
| } |
| } |
|
|