From: hickert Date: Wed, 30 Jun 2010 10:21:01 +0000 (+0000) Subject: Added RSS reader X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1acdea3a650b529be627e0623cd596edc08777af;hp=0316d220d06021fc32cba1bd4828c8ca39be634f;p=gosa.git Added RSS reader git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18883 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/plugins/generic/dashBoard/dbInformation/class_dbInformation.inc b/gosa-core/plugins/generic/dashBoard/dbInformation/class_dbInformation.inc index f04d4e65a..d9e9fc978 100644 --- a/gosa-core/plugins/generic/dashBoard/dbInformation/class_dbInformation.inc +++ b/gosa-core/plugins/generic/dashBoard/dbInformation/class_dbInformation.inc @@ -5,11 +5,32 @@ class dbInformation extends plugin function __construct($config) { parent::__construct($config, NULL); + + // Construct the plugin list. + $this->feedList = new sortableListing(); + $this->feedList->setDeleteable(false); + $this->feedList->setEditable(false); +# $this->feedList->setColspecs(array('30px','120px','*','100px')); +# $this->feedList->setHeader(array('?',_("Name"),_("Descriptio"),_("Status"))); + $this->feedList->setWidth("100%"); +# $this->feedList->setDefaultSortColumn(1); + $this->feedList->setHeight("200px"); + $this->feedList->setAcl("rwcdm"); } function execute() { $smarty = get_smarty(); + $feeds = rssReader::feadToArray('http://www.computerbild.de/rssfeed_2261.html?node=10'); + + $data = $lData = array(); + foreach($feeds as $key => $feed){ + $data[$key] = $feed; + $lData[$key] = array('data'=> array(date('H:i:s', $feed['timestamp']),$feed['title'])); + } + $this->feedList->setListData($data, $lData); + $this->feedList->update(); + $smarty->assign('feedList', $this->feedList->render()); return($smarty->fetch(get_template_path('dbInformation/contents.tpl', TRUE))); } diff --git a/gosa-core/plugins/generic/dashBoard/dbInformation/class_rssReader.inc b/gosa-core/plugins/generic/dashBoard/dbInformation/class_rssReader.inc new file mode 100644 index 000000000..11e8a7942 --- /dev/null +++ b/gosa-core/plugins/generic/dashBoard/dbInformation/class_rssReader.inc @@ -0,0 +1,25 @@ +load($url); + $entries = array(); + foreach ($doc->getElementsByTagName('item') as $item) { + $entry = array ( + 'title' => $item->getElementsByTagName('title')->item(0)->nodeValue, + 'desc' => $item->getElementsByTagName('description')->item(0)->nodeValue, + 'link' => $item->getElementsByTagName('link')->item(0)->nodeValue, + 'date' => $item->getElementsByTagName('pubDate')->item(0)->nodeValue, + 'timestamp' => strtotime($item->getElementsByTagName('pubDate')->item(0)->nodeValue) + ); + $entries[$entry['timestamp']."-".$entry['date']] = $entry; + } + return($entries); + } +} + +?> diff --git a/gosa-core/plugins/generic/dashBoard/dbInformation/contents.tpl b/gosa-core/plugins/generic/dashBoard/dbInformation/contents.tpl index 345e6aef7..841ab5d09 100644 --- a/gosa-core/plugins/generic/dashBoard/dbInformation/contents.tpl +++ b/gosa-core/plugins/generic/dashBoard/dbInformation/contents.tpl @@ -1 +1 @@ -Test +{$feedList}