1 <?php
3 class dbInformation extends plugin
4 {
5 function __construct($config)
6 {
7 parent::__construct($config, NULL);
9 // Construct the plugin list.
10 $this->feedList = new sortableListing();
11 $this->feedList->setDeleteable(false);
12 $this->feedList->setEditable(true);
13 $this->feedList->setWidth("100%");
14 $this->feedList->setHeight("200px");
15 $this->feedList->setAcl("rwcdm");
16 }
18 function execute()
19 {
20 // Act on clicks on the feed list.
21 $linkOpener = "";
22 $action = $this->feedList->getAction();
23 if(isset($action['action']) && $action['action'] == 'edit'){
24 $data = $this->feedList->getData($action['targets'][0]);
25 if(isset($data['link']) && !empty($data['link'])){
26 $linkOpener = '
27 <script language="JavaScript" type="text/javascript">
28 window.open("'.$data['link'].'");
29 </script>';
30 }
31 }
33 // Read Feeds and sort the results
34 $feeds = rssReader::parseFeedFromUrl(array('http://www.heise.de/newsticker/heise.rdf'));
35 $feeds = rssReader::sortFeedResultBy($feeds, 'timestamp');
37 // Append the results to the list.
38 $data = $lData = array();
39 foreach($feeds as $key => $feed){
40 $data[$key] = $feed;
41 $lData[$key] = array('data'=> array(htmlentities($feed['title'],ENT_QUOTES,'UTF-8')));
42 }
43 $this->feedList->setListData($data, $lData);
44 $this->feedList->update();
46 // Generate the HTML content
47 $smarty = get_smarty();
48 $smarty->assign('feedList', $this->feedList->render());
49 return($linkOpener.$smarty->fetch(get_template_path('dbInformation/contents.tpl', TRUE)));
50 }
52 function save_object()
53 {
54 parent::save_object();
55 $this->feedList->save_object();
56 }
57 }
59 ?>