| <?php |
|
|
| namespace Kanboard\Action; |
|
|
| use Kanboard\Model\TaskLinkModel; |
|
|
| |
| |
| |
| |
| |
| |
| |
| class TaskAssignCategoryLink extends Base |
| { |
| |
| |
| |
| |
| |
| |
| public function getDescription() |
| { |
| return t('Assign automatically a category based on a link'); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| public function getCompatibleEvents() |
| { |
| return array( |
| TaskLinkModel::EVENT_CREATE_UPDATE, |
| ); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| public function getActionRequiredParameters() |
| { |
| return array( |
| 'category_id' => t('Category'), |
| 'link_id' => t('Link type'), |
| ); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| public function getEventRequiredParameters() |
| { |
| return array( |
| 'task_link' => array( |
| 'task_id', |
| 'link_id', |
| ) |
| ); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| public function doAction(array $data) |
| { |
| $values = array( |
| 'id' => $data['task_link']['task_id'], |
| 'category_id' => $this->getParam('category_id'), |
| ); |
|
|
| return $this->taskModificationModel->update($values); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| public function hasRequiredCondition(array $data) |
| { |
| if ($data['task_link']['link_id'] == $this->getParam('link_id')) { |
| return empty($data['task']['category_id']); |
| } |
|
|
| return false; |
| } |
| } |
|
|