| | <?php |
| |
|
| | namespace Kanboard\Formatter; |
| |
|
| | use Kanboard\Core\Filter\FormatterInterface; |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | class BoardColumnFormatter extends BaseFormatter implements FormatterInterface |
| | { |
| | protected $swimlaneId = 0; |
| | protected $columns = array(); |
| | protected $tasks = array(); |
| | protected $tags = array(); |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function withSwimlaneId($swimlaneId) |
| | { |
| | $this->swimlaneId = $swimlaneId; |
| | return $this; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function withColumns(array $columns) |
| | { |
| | $this->columns = $columns; |
| | return $this; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function withTasks(array $tasks) |
| | { |
| | $this->tasks = $tasks; |
| | return $this; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function withTags(array $tags) |
| | { |
| | $this->tags = $tags; |
| | return $this; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | public function format() |
| | { |
| | foreach ($this->columns as &$column) { |
| | $column['id'] = (int) $column['id']; |
| | $column['tasks'] = $this->boardTaskFormatter |
| | ->withTasks($this->tasks) |
| | ->withTags($this->tags) |
| | ->withSwimlaneId($this->swimlaneId) |
| | ->withColumnId($column['id']) |
| | ->format(); |
| |
|
| | $column['nb_tasks'] = count($column['tasks']); |
| | $column['score'] = (int) array_column_sum($column['tasks'], 'score'); |
| | } |
| |
|
| | return $this->columns; |
| | } |
| | } |
| |
|