コード例 #1
0
ファイル: PageRSS.php プロジェクト: r4mp/Foodle
 function show()
 {
     $url = 'https://foodl.org/api/e/feed/uninett-sj3gr86sb3';
     $as = new Data_EventStream($this->fdb);
     $feed = $this->parameters[0];
     $as->prepareFeed($feed);
     // $feed = $this->parameters[0];
     // header('Content-type: text/plain; charset=utf-8');
     // echo "hello world\n" . $feed;
     // print_r($as->getData());
     $feedData = $as->getData();
     $rssfeed = new RSS2FeedWriter();
     $rssfeed->setTitle('UNINETT Foodle');
     $rssfeed->setLink('https://foodl.org');
     $rssfeed->setDescription('Foodle is a simple tool for meeting invitations and polls');
     // $rssfeed->setImage('Testing the RSS writer class','http://www.ajaxray.com/projects/rss','http://www.rightbrainsolution.com/_resources/img/logo.png');
     foreach ($feedData as $feedItem) {
         $rssitem = $rssfeed->createNewItem();
         $rssitem->setTitle($feedItem['foodle']['name']);
         $rssitem->setLink('https://foodl.org/foodle/' . $feedItem['foodle']['id']);
         //The parameter is a timestamp for setDate() function
         $rssitem->setDate($feedItem['foodle']['unix']);
         $rssitem->setDescription($feedItem['foodle']['descr']);
         $rssfeed->addItem($rssitem);
     }
     $rssfeed->generateFeed();
     exit;
 }
コード例 #2
0
ファイル: CalendarUser.php プロジェクト: r4mp/Foodle
 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);
 }
コード例 #3
0
ファイル: Events.php プロジェクト: r4mp/Foodle
 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));
 }