summaryrefslogtreecommitdiff
path: root/app/Formatter/BaseTaskCalendarFormatter.php
diff options
context:
space:
mode:
authorImbasaur <yarrusg@gmail.com>2016-04-13 17:05:59 +0200
committerImbasaur <yarrusg@gmail.com>2016-04-13 17:05:59 +0200
commit99f275e5bb033cca33eee87b0e914645730f13d1 (patch)
treead845419d56304f2bf014744f0878186f7155a3c /app/Formatter/BaseTaskCalendarFormatter.php
parent13d5bd8e48bd6c0109d1272da58a8879bf9a6737 (diff)
parentcd5bf9d4d214ec9282b706c26bb27cabf150ee63 (diff)
Merge pull request #1 from fguillot/master
Diffstat (limited to 'app/Formatter/BaseTaskCalendarFormatter.php')
-rw-r--r--app/Formatter/BaseTaskCalendarFormatter.php45
1 files changed, 45 insertions, 0 deletions
diff --git a/app/Formatter/BaseTaskCalendarFormatter.php b/app/Formatter/BaseTaskCalendarFormatter.php
new file mode 100644
index 00000000..8fab3e9a
--- /dev/null
+++ b/app/Formatter/BaseTaskCalendarFormatter.php
@@ -0,0 +1,45 @@
+<?php
+
+namespace Kanboard\Formatter;
+
+use Kanboard\Core\Filter\FormatterInterface;
+
+/**
+ * Common class to handle calendar events
+ *
+ * @package formatter
+ * @author Frederic Guillot
+ */
+abstract class BaseTaskCalendarFormatter extends BaseFormatter
+{
+ /**
+ * Column used for event start date
+ *
+ * @access protected
+ * @var string
+ */
+ protected $startColumn = 'date_started';
+
+ /**
+ * Column used for event end date
+ *
+ * @access protected
+ * @var string
+ */
+ protected $endColumn = 'date_completed';
+
+ /**
+ * Transform results to calendar events
+ *
+ * @access public
+ * @param string $start_column Column name for the start date
+ * @param string $end_column Column name for the end date
+ * @return FormatterInterface
+ */
+ public function setColumns($start_column, $end_column = '')
+ {
+ $this->startColumn = $start_column;
+ $this->endColumn = $end_column ?: $start_column;
+ return $this;
+ }
+}