Code

Updated dashbaord
[gosa.git] / gosa-core / plugins / generic / dashBoard / dbInformation / class_dbInformation.inc
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         }
32     
33         // Read Feeds and sort the results 
34         $feeds = rssReader::feadToArray(array(
35                     'http://www.uweschwanz.com/de/rss/',
36                     'http://www.aviationpower.de/rss_de.php',
37                     'http://www.computerbild.de/rssfeed_2261.html?node=10',
38                     'http://www.charts-portal.de/games/Computerspiele.xml'));
39         $feeds = rssReader::sortFeedResultBy($feeds, 'timestamp');
41         // Append the results to the list.
42         $data = $lData = array();
43         foreach($feeds as $key => $feed){
44             $data[$key] = $feed;
45             $lData[$key] = array('data'=> array(htmlentities($feed['title'],ENT_QUOTES,'UTF-8')));
46         }
47         $this->feedList->setListData($data, $lData);
48         $this->feedList->update();
50         // Generate the HTML content
51         $smarty = get_smarty();
52         $smarty->assign('feedList', $this->feedList->render());
53         return($linkOpener.$smarty->fetch(get_template_path('dbInformation/contents.tpl', TRUE)));
54     }
56     function save_object()
57     {
58         parent::save_object();
59         $this->feedList->save_object();
60     }
62     function save()
63     {
64         parent::save();
65     }
67     function check()
68     {
69         return(parent::check());
70     }
72     function remove_from_parent()
73     {
74         parent::remove_from_parent();
75     }
76 }
78 ?>