function ical_export()
 {
     $this->setLayout('ical');
     require_once ROOT . '/environment/classes/event/CalFormatUtilities.php';
     if (!isset($_GET['t']) || !isset($_GET['cal'])) {
         header('HTTP/1.0 404 Not Found');
         die;
     }
     $token = $_GET['t'];
     $cal = $_GET['cal'];
     $inc_sub = isset($_GET['isw']) && $_GET['isw'] == 1;
     if (Users::tokenExists($token)) {
         $user = Users::getByToken($token);
         if ($cal == 0) {
             $project = null;
         } else {
             $project = Projects::findById($cal);
         }
         $events = ProjectEvents::getAllEventsByProject($project, false, $inc_sub, $user);
         $calendar_name = isset($_GET['n']) ? $_GET['n'] : $user->getDisplayName();
         tpl_assign('content', CalFormatUtilities::generateICalInfo($events, $calendar_name, $user));
     } else {
         header('HTTP/1.0 404 Not Found');
         die;
     }
 }
Example #2
0
 /**
  * This function will return all events in a project
  *
  * @param void
  * @return array
  */
 function getAllEvents()
 {
     if (is_null($this->all_events)) {
         $this->all_events = ProjectEvents::getAllEventsByProject($this);
     }
     // if
     return $this->all_events;
 }