| | <?php |
| |
|
| | namespace Kanboard\Action; |
| |
|
| | use Kanboard\Model\TaskModel; |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | class TaskCloseNoActivity extends Base |
| | { |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function getDescription() |
| | { |
| | return t('Close a task when there is no activity'); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | public function getCompatibleEvents() |
| | { |
| | return array(TaskModel::EVENT_DAILY_CRONJOB); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | public function getActionRequiredParameters() |
| | { |
| | return array( |
| | 'duration' => t('Duration in days') |
| | ); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | public function getEventRequiredParameters() |
| | { |
| | return array('tasks'); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function doAction(array $data) |
| | { |
| | $results = array(); |
| | $max = $this->getParam('duration') * 86400; |
| |
|
| | foreach ($data['tasks'] as $task) { |
| | $duration = time() - $task['date_modification']; |
| |
|
| | if ($duration > $max) { |
| | $results[] = $this->taskStatusModel->close($task['id']); |
| | } |
| | } |
| |
|
| | return in_array(true, $results, true); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function hasRequiredCondition(array $data) |
| | { |
| | return count($data['tasks']) > 0; |
| | } |
| | } |
| |
|