/**
  * Render global iCalendar feed
  *
  * @param void
  * @return null
  */
 function ical()
 {
     $filter = ProjectUsers::getVisibleTypesFilter($this->logged_user, array(PROJECT_STATUS_ACTIVE), get_completable_project_object_types());
     if ($filter) {
         $objects = ProjectObjects::find(array('conditions' => array($filter . ' AND completed_on IS NULL AND state >= ? AND visibility >= ?', STATE_VISIBLE, $this->logged_user->getVisibility()), 'order' => 'priority DESC'));
         render_icalendar(lang('Global Calendar'), $objects, true);
         die;
     } elseif ($this->request->get('subscribe')) {
         flash_error(lang('You are not able to download .ics file because you are not participating in any of the active projects at the moment'));
         $this->redirectTo('ical_subscribe');
     } else {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
 }
 /**
  * Serve iCal data
  *
  * @param void
  * @return null
  */
 function ical()
 {
     if ($this->active_project->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     $filter = ProjectUsers::getVisibleTypesFilterByProject($this->logged_user, $this->active_project, get_completable_project_object_types());
     if ($filter) {
         $objects = ProjectObjects::find(array('conditions' => array($filter . ' AND completed_on IS NULL AND state >= ? AND visibility >= ?', STATE_VISIBLE, $this->logged_user->getVisibility()), 'order' => 'priority DESC'));
         render_icalendar($this->active_project->getName() . ' ' . lang('calendar'), $objects);
         die;
     } else {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
 }
 /**
  * Render iCalendar feed
  *
  * @param void
  * @return null
  */
 function ical()
 {
     $filter = new AssignmentFilter();
     $filter->setUserFilter(USER_FILTER_SELECTED);
     $filter->setUserFilterData(array($this->active_user->getId()));
     $filter->setProjectFilter(PROJECT_FILTER_ACTIVE);
     $filter->setStatusFilter(STATUS_FILTER_ACTIVE);
     render_icalendar(lang(":user's calendar", array('user' => $this->active_user->getDisplayName())), AssignmentFilters::executeFilter($this->logged_user, $filter, false));
     die;
 }