summaryrefslogtreecommitdiff
path: root/plugins/Timetrackingeditor/Formatter
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2020-05-05 14:25:42 +0200
committeremkael <emkael@tlen.pl>2020-05-05 14:25:42 +0200
commit62827e6cf470449c117624058fb36ad94804bcc0 (patch)
tree10cd1e4d36c34b694acfadaa69fc7f6ae2b1eabd /plugins/Timetrackingeditor/Formatter
parent7b66ddf2e4fbdb837e78d8b7dbaa9fc38391bc32 (diff)
Time tracking related pluginsHEADmaster
Diffstat (limited to 'plugins/Timetrackingeditor/Formatter')
-rw-r--r--plugins/Timetrackingeditor/Formatter/SubtaskAutoCompleteFormatter.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/plugins/Timetrackingeditor/Formatter/SubtaskAutoCompleteFormatter.php b/plugins/Timetrackingeditor/Formatter/SubtaskAutoCompleteFormatter.php
new file mode 100644
index 00000000..724a146e
--- /dev/null
+++ b/plugins/Timetrackingeditor/Formatter/SubtaskAutoCompleteFormatter.php
@@ -0,0 +1,39 @@
+<?php
+
+namespace Kanboard\Plugin\Timetrackingeditor\Formatter;
+
+use Kanboard\Core\Filter\FormatterInterface;
+use Kanboard\Model\ProjectModel;
+use Kanboard\Model\SubtaskModel;
+use Kanboard\Model\TaskModel;
+use Kanboard\Formatter\BaseFormatter;
+
+/**
+ * Subtask AutoComplete Formatter
+ *
+ * @package formatter
+ * @author Thomas Stinner
+ */
+class SubtaskAutoCompleteFormatter extends BaseFormatter implements FormatterInterface
+{
+ /**
+ * Apply formatter
+ *
+ * @access public
+ * @return array
+ */
+ public function format()
+ {
+ $subtasks = $this->query->columns(
+ SubtaskModel::TABLE.'.id',
+ SubtaskModel::TABLE.'.title'
+ )->asc(SubtaskModel::TABLE.'.id')->findAll();
+
+ foreach ($subtasks as &$subtask) {
+ $subtask['value'] = $subtask['title'];
+ $subtask['label'] = ' > #'.$subtask['id'].' '.$subtask['title'];
+ }
+
+ return $subtasks;
+ }
+}