Beispiel #1
0
 function show()
 {
     $as = new Data_EventStream($this->fdb, $this->user, false);
     $as->prepareUser();
     $stream = $as->getData();
     $feed = '';
     foreach ($stream as $e) {
         $feed .= $this->createVEvent($e);
     }
     // echo '<pre>'; print_r($stream); exit;
     //set correct content-type-header
     header('Content-type: text/calendar; charset=utf-8');
     header('Content-Disposition: inline; filename=calendar.ics');
     echo $this->createVCalendar($feed);
 }
Beispiel #2
0
 function prepare()
 {
     parent::prepare();
     $as = new Data_EventStream($this->fdb, $this->user);
     // error_log('Accessing API_Events');
     if (count($this->parameters) === 0) {
         $as->prepareUser();
         $limit = null;
         if (isset($_REQUEST['limit'])) {
             $limit = $_REQUEST['limit'];
         }
         return $as->getData($limit);
     }
     if (count($this->parameters) > 0) {
         if ($this->parameters[0] === 'group') {
             $groupid = $this->parameters[1];
             $as->prepareGroup($groupid);
             return $as->getData();
         }
     }
     throw new Exception('Invalid parameters: ' . var_export($this->parameters, TRUE));
 }