Exemple #1
0
 /**
  * Common method to render iCal events
  *
  * @access private
  */
 private function renderCalendar(TaskFilter $filter, iCalendar $calendar)
 {
     $start = $this->request->getStringParam('start', strtotime('-2 month'));
     $end = $this->request->getStringParam('end', strtotime('+6 months'));
     // Tasks
     if ($this->config->get('calendar_project_tasks', 'date_started') === 'date_creation') {
         $filter->copy()->filterByCreationDateRange($start, $end)->setColumns('date_creation', 'date_completed')->setCalendar($calendar)->addDateTimeEvents();
     } else {
         $filter->copy()->filterByStartDateRange($start, $end)->setColumns('date_started', 'date_completed')->setCalendar($calendar)->addDateTimeEvents($calendar);
     }
     // Tasks with due date
     $filter->copy()->filterByDueDateRange($start, $end)->setColumns('date_due')->setCalendar($calendar)->addFullDayEvents($calendar);
     $this->response->contentType('text/calendar; charset=utf-8');
     echo $filter->setCalendar($calendar)->format();
 }
Exemple #2
0
 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);
 }