summaryrefslogtreecommitdiff
path: root/app/Formatter/BaseTaskCalendarFormatter.php
blob: 3d9ead4d2e68e3418a145ff41145ad646dd48e81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php

namespace Kanboard\Formatter;

/**
 * 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 $this
     */
    public function setColumns($start_column, $end_column = '')
    {
        $this->startColumn = $start_column;
        $this->endColumn = $end_column ?: $start_column;
        return $this;
    }
}