summaryrefslogtreecommitdiff
path: root/app/Helper/ICalHelper.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-04-09 22:42:17 -0400
committerFrederic Guillot <fred@kanboard.net>2016-04-09 22:42:17 -0400
commit11858be4e8d5aba983700c6cba1c4d0a33ea8e9d (patch)
tree38427e86d52185df95e2b891e4bcd50aeb56eeb9 /app/Helper/ICalHelper.php
parent42813d702d1c3e5659301bc771f8dbb37a6d15cd (diff)
Filter refactoring
Diffstat (limited to 'app/Helper/ICalHelper.php')
-rw-r--r--app/Helper/ICalHelper.php38
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();
+ }
+}