summaryrefslogtreecommitdiff
path: root/app/Helper/ICalHelper.php
blob: 9572341757c43f4d7d71ceecd76160762aef7a5b (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
<?php

namespace Kanboard\Helper;

use Kanboard\Core\Base;
use Kanboard\Core\Filter\QueryBuilder;
use Kanboard\Filter\TaskDueDateRangeFilter;
use Eluceo\iCal\Component\Calendar as iCalendar;

/**
 * ICal Helper
 *
 * @package helper
 * @author  Frederic Guillot
 */
class ICalHelper extends Base
{
    /**
     * Get formatted calendar task due events
     *
     * @access public
     * @param  QueryBuilder  $queryBuilder
     * @param  iCalendar     $calendar
     * @param  string        $start
     * @param  string        $end
     */
    public function addTaskDateDueEvents(QueryBuilder $queryBuilder, iCalendar $calendar, $start, $end)
    {
        $queryBuilder->withFilter(new TaskDueDateRangeFilter(array($start, $end)));

        $this->taskICalFormatter
            ->setColumns('date_due')
            ->setCalendar($calendar)
            ->withQuery($queryBuilder->getQuery())
            ->addFullDayEvents();
    }
}