diff options
Diffstat (limited to 'app/Helper/ICalHelper.php')
-rw-r--r-- | app/Helper/ICalHelper.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/app/Helper/ICalHelper.php b/app/Helper/ICalHelper.php new file mode 100644 index 00000000..dc399bf8 --- /dev/null +++ b/app/Helper/ICalHelper.php @@ -0,0 +1,38 @@ +<?php + +namespace Kanboard\Helper; + +use Kanboard\Core\Base; +use Kanboard\Core\Filter\QueryBuilder; +use Kanboard\Filter\TaskDueDateRangeFilter; +use Kanboard\Formatter\TaskICalFormatter; +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))); + + $formatter = new TaskICalFormatter($this->container); + $formatter->setColumns('date_due'); + $formatter->setCalendar($calendar); + $formatter->withQuery($queryBuilder->getQuery()); + $formatter->addFullDayEvents(); + } +} |