*/ // must be run within Dokuwiki if(!defined('DOKU_INC')) die(); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); require_once(DOKU_PLUGIN."noticeboard/classes/NoticeList.php"); /** * Rss class * * @author Tomas Zaruba */ class helper_plugin_noticeboard_Rss extends DokuWiki_Plugin{ private $category; private $parentId; private $noticeList; public function helper_plugin_noticeboard_Rss($category,$parentId){ $this->category = $category; $this->parentId = $parentId; $this->noticeList = new helper_plugin_noticeboard_NoticeList($this->parentId); $this->noticeList->setCategoryFilter($category); $this->noticeList->setTimeFilter(3); $this->noticeList->setSortFilter(1); } public function generateOutput(){ Global $conf; header("Content-Type: application/xml; charset=UTF-8"); $out; $out .= $this->getHeader(); $out .= $this->getBody(); $out .= $this->getFooter(); echo $out; } private function getHeader(){ Global $conf; $link = "http://".$_SERVER['SERVER_NAME']; $out = ''; $out .= ""; $out .= ""; $out .= ""; $out .= "".$conf['title']." - ".$this->parentId.""; $out .= "".$conf['lang'].""; $out .= "".$this->getLang('rssDesc').""; $out .= "".$link .wl($this->parentId, array('do' => 'show')).""; return $out; } private function getBody(){ $link = "http://".$_SERVER['SERVER_NAME']; $out; $arrayList = $this->noticeList->getNoticeList(0,50); //last 50 msges while(($arrayList && $arrayList->hasNext())){ $notice = $arrayList->next(); $out .= ""; $out .= "".$notice->getName().""; $out .= "".$link .wl($notice->getId(), array('do' => 'show')).""; $out .= ""; $out .= $this->getLang('startTime').": "; if($notice->hasStartTime()){ $out .= date("d.m.Y H:i",$notice->getStartTime()); }else{ $out .= date("d.m.Y",$notice->getStartTime()); } $out .= "
"; $out .= $this->getLang('category').": ".$this->getLang($notice->getCategory()); $out .= "
"; if($notice->getEndTime()){ $out .= $this->getLang('endTime').": "; if($notice->hasEndTime()){ $out .= date("d.m.Y H:i",$notice->getEndTime()); }else{ $out .= date("d.m.Y",$notice->getEndTime()); } $out .= "
"; } if($notice->getDeadline()){ $out .= $this->getLang('deadline').": "; $out .= date("d.m.Y",$notice->getDeadline()); $out .= "
"; } if($notice->getPlace()){ $out .= $this->getLang('place').": "; $out .= $notice->getPlace(); $out .= "
"; } $out .= $this->getLang('moreInfo').": 'show'))."'>".$notice->getName().""; $out .= "
"; $out .= "".date(DATE_RFC822,$notice->getStartTime()).""; $out .= "
"; if($notice->getDeadline()){ $out .= ""; $out .= "".$notice->getName()." Deadline"; $out .= "".$link .wl($notice->getId(), array('do' => 'show')).""; $out .= ""; $out .= $this->getLang('startTime').": "; if($notice->hasStartTime()){ $out .= date("d.m.Y H:i",$notice->getStartTime()); }else{ $out .= date("d.m.Y",$notice->getStartTime()); } $out .= "
"; if($notice->getDeadline()){ $out .= $this->getLang('deadline').": "; $out .= date("d.m.Y",$notice->getDeadline()); $out .= "
"; } $out .= " 'show'))."'>".$this->getLang('moreInfo').""; $out .= "
"; $out .= "".date(DATE_RFC822,$notice->getDeadline()).""; $out .= "
"; } } return $out; } private function getFooter(){ $out; $out .="
"; return $out; } } ?>