Beispiel #1
0
 /**
  * Common method to render iCal events
  *
  * @access private
  */
 private function renderCalendar(TaskFilter $filter, iCalendar $calendar)
 {
     $start = $this->request->getStringParam('start', strtotime('-1 month'));
     $end = $this->request->getStringParam('end', strtotime('+2 months'));
     // Tasks
     if ($this->config->get('calendar_project_tasks', 'date_started') === 'date_creation') {
         $filter->copy()->filterByCreationDateRange($start, $end)->addDateTimeIcalEvents('date_creation', 'date_completed', $calendar);
     } else {
         $filter->copy()->filterByStartDateRange($start, $end)->addDateTimeIcalEvents('date_started', 'date_completed', $calendar);
     }
     // Tasks with due date
     $filter->copy()->filterByDueDateRange($start, $end)->addAllDayIcalEvents('date_due', $calendar);
     $this->response->contentType('text/calendar; charset=utf-8');
     echo $calendar->render();
 }
 public function testCopy()
 {
     $tf = new TaskFilter($this->container);
     $filter1 = $tf->create();
     $filter2 = $tf->copy();
     $this->assertTrue($filter1 !== $filter2);
     $this->assertTrue($filter1->query !== $filter2->query);
     $this->assertTrue($filter1->query->condition !== $filter2->query->condition);
 }