summaryrefslogtreecommitdiff
path: root/app/Formatter
diff options
context:
space:
mode:
Diffstat (limited to 'app/Formatter')
-rw-r--r--app/Formatter/BoardColumnFormatter.php2
-rw-r--r--app/Formatter/BoardFormatter.php2
-rw-r--r--app/Formatter/BoardSwimlaneFormatter.php2
-rw-r--r--app/Formatter/GroupAutoCompleteFormatter.php22
-rw-r--r--app/Formatter/UserAutoCompleteFormatter.php6
5 files changed, 12 insertions, 22 deletions
diff --git a/app/Formatter/BoardColumnFormatter.php b/app/Formatter/BoardColumnFormatter.php
index 85d31b5c..0d59f54e 100644
--- a/app/Formatter/BoardColumnFormatter.php
+++ b/app/Formatter/BoardColumnFormatter.php
@@ -79,7 +79,7 @@ class BoardColumnFormatter extends BaseFormatter implements FormatterInterface
{
foreach ($this->columns as &$column) {
$column['id'] = (int) $column['id'];
- $column['tasks'] = BoardTaskFormatter::getInstance($this->container)
+ $column['tasks'] = $this->boardTaskFormatter
->withTasks($this->tasks)
->withTags($this->tags)
->withSwimlaneId($this->swimlaneId)
diff --git a/app/Formatter/BoardFormatter.php b/app/Formatter/BoardFormatter.php
index df443a52..3f47bfa9 100644
--- a/app/Formatter/BoardFormatter.php
+++ b/app/Formatter/BoardFormatter.php
@@ -59,7 +59,7 @@ class BoardFormatter extends BaseFormatter implements FormatterInterface
$task_ids = array_column($tasks, 'id');
$tags = $this->taskTagModel->getTagsByTasks($task_ids);
- return BoardSwimlaneFormatter::getInstance($this->container)
+ return $this->boardSwimlaneFormatter
->withSwimlanes($swimlanes)
->withColumns($columns)
->withTasks($tasks)
diff --git a/app/Formatter/BoardSwimlaneFormatter.php b/app/Formatter/BoardSwimlaneFormatter.php
index ce67c8a8..18db259d 100644
--- a/app/Formatter/BoardSwimlaneFormatter.php
+++ b/app/Formatter/BoardSwimlaneFormatter.php
@@ -82,7 +82,7 @@ class BoardSwimlaneFormatter extends BaseFormatter implements FormatterInterface
foreach ($this->swimlanes as &$swimlane) {
$swimlane['id'] = (int) $swimlane['id'];
- $swimlane['columns'] = BoardColumnFormatter::getInstance($this->container)
+ $swimlane['columns'] = $this->boardColumnFormatter
->withSwimlaneId($swimlane['id'])
->withColumns($this->columns)
->withTasks($this->tasks)
diff --git a/app/Formatter/GroupAutoCompleteFormatter.php b/app/Formatter/GroupAutoCompleteFormatter.php
index 4d552886..d811de7f 100644
--- a/app/Formatter/GroupAutoCompleteFormatter.php
+++ b/app/Formatter/GroupAutoCompleteFormatter.php
@@ -12,36 +12,26 @@ use PicoDb\Table;
* @package formatter
* @author Frederic Guillot
*/
-class GroupAutoCompleteFormatter implements FormatterInterface
+class GroupAutoCompleteFormatter extends BaseFormatter implements FormatterInterface
{
/**
* Groups found
*
- * @access private
+ * @access protected
* @var GroupProviderInterface[]
*/
- private $groups;
+ protected $groups;
/**
- * Format groups for the ajax auto-completion
+ * Set groups
*
* @access public
* @param GroupProviderInterface[] $groups
+ * @return $this
*/
- public function __construct(array $groups)
+ public function withGroups(array $groups)
{
$this->groups = $groups;
- }
-
- /**
- * Set query
- *
- * @access public
- * @param Table $query
- * @return FormatterInterface
- */
- public function withQuery(Table $query)
- {
return $this;
}
diff --git a/app/Formatter/UserAutoCompleteFormatter.php b/app/Formatter/UserAutoCompleteFormatter.php
index cd23a2a4..c81af00a 100644
--- a/app/Formatter/UserAutoCompleteFormatter.php
+++ b/app/Formatter/UserAutoCompleteFormatter.php
@@ -14,7 +14,7 @@ use Kanboard\Core\Filter\FormatterInterface;
class UserAutoCompleteFormatter extends BaseFormatter implements FormatterInterface
{
/**
- * Format the tasks for the ajax autocompletion
+ * Format the tasks for the ajax auto-completion
*
* @access public
* @return array
@@ -24,11 +24,11 @@ class UserAutoCompleteFormatter extends BaseFormatter implements FormatterInterf
$users = $this->query->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name')->findAll();
foreach ($users as &$user) {
- $user['value'] = $user['username'].' (#'.$user['id'].')';
-
if (empty($user['name'])) {
+ $user['value'] = $user['username'].' (#'.$user['id'].')';
$user['label'] = $user['username'];
} else {
+ $user['value'] = $user['name'].' (#'.$user['id'].')';
$user['label'] = $user['name'].' ('.$user['username'].')';
}
}