diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-04-09 22:42:17 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-04-09 22:42:17 -0400 |
commit | 11858be4e8d5aba983700c6cba1c4d0a33ea8e9d (patch) | |
tree | 38427e86d52185df95e2b891e4bcd50aeb56eeb9 /app/Formatter/BaseTaskCalendarFormatter.php | |
parent | 42813d702d1c3e5659301bc771f8dbb37a6d15cd (diff) |
Filter refactoring
Diffstat (limited to 'app/Formatter/BaseTaskCalendarFormatter.php')
-rw-r--r-- | app/Formatter/BaseTaskCalendarFormatter.php | 45 |
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; + } +} |