[gosa.git] / gosa-core / plugins / generic / dashBoard / dbNotifications / class_dbNotifications.inc
1 <?php
3 class dbNotifications extends plugin
4 {
5 function __construct($config)
6 {
7 parent::__construct($config, NULL);
9 // Construct the plugin list.
10 $this->adviceList = new sortableListing();
11 $this->adviceList->setDeleteable(false);
12 $this->adviceList->setEditable(false);
13 $this->adviceList->setWidth("100%");
14 $this->adviceList->setHeight("200px");
15 $this->adviceList->setAcl("rwcdm");
16 }
18 function execute()
19 {
20 // Get logs as RSS feed.
21 $rsyslog = new rsyslog($this->config);
22 $source = $rsyslog->logToRss();
24 // Read Feeds and sort the results
25 $feeds = rssReader::parseFeedFromSource(array($source));
26 $feeds = rssReader::sortFeedResultBy($feeds, 'timestamp');
28 // Append the results to the list.
29 $data = $lData = array();
30 foreach($feeds as $key => $feed){
31 $data[$key] = $feed;
32 $lData[$key] = array('data'=> array(htmlentities($feed['title'],ENT_QUOTES,'UTF-8')));
33 }
34 $this->adviceList->setListData($data, $lData);
35 $this->adviceList->update();
37 // Generate the HTML content
38 $smarty = get_smarty();
39 $smarty->assign('adviceList', $this->adviceList->render());
40 return($smarty->fetch(get_template_path('dbNotifications/contents.tpl', TRUE)));
41 }
43 function save_object()
44 {
45 parent::save_object();
46 $this->adviceList->save_object();
47 }
48 }
50 ?>