Code

Added navigation to registration process.
[gosa.git] / gosa-core / plugins / generic / dashBoard / dbInformation / class_dbInformation.inc
index 707447cbbb6e97d3a93940c3cb64b34aae21dbcd..218eb0eb6923e0820a9d5e205e7751f6c7ae01ec 100644 (file)
@@ -9,52 +9,50 @@ class dbInformation extends plugin
         // Construct the plugin list.
         $this->feedList = new sortableListing();
         $this->feedList->setDeleteable(false);
-        $this->feedList->setEditable(false);
-        #$this->feedList->setColspecs(array('130px','*'));
-        #$this->feedList->setHeader(array(_("Date"),_("Description")));
+        $this->feedList->setEditable(true);
         $this->feedList->setWidth("100%");
-        #$this->feedList->setDefaultSortColumn(0);
         $this->feedList->setHeight("200px");
         $this->feedList->setAcl("rwcdm");
     }
 
     function execute()
     {
-        $smarty = get_smarty();
-        $feeds = rssReader::feadToArray(array(
-                    'http://www.computerbild.de/rssfeed_2261.html?node=10',
-                    'http://www.charts-portal.de/games/Computerspiele.xml'));
+        // Act on clicks on the feed list.
+        $linkOpener = "";
+        $action = $this->feedList->getAction();
+        if(isset($action['action']) && $action['action'] == 'edit'){
+            $data = $this->feedList->getData($action['targets'][0]);
+            if(isset($data['link']) && !empty($data['link'])){
+                $linkOpener = '
+                    <script language="JavaScript" type="text/javascript">
+                        window.open("'.$data['link'].'");
+                    </script>';
+            }
+        }
+    
+        // Read Feeds and sort the results 
+        $feeds = rssReader::parseFeedFromUrl(array('http://www.heise.de/newsticker/heise.rdf'));
         $feeds = rssReader::sortFeedResultBy($feeds, 'timestamp');
+
+        // Append the results to the list.
         $data = $lData = array();
         foreach($feeds as $key => $feed){
             $data[$key] = $feed;
-            $lData[$key] = array('data'=> array($feed['title']));
+            $lData[$key] = array('data'=> array(htmlentities($feed['title'],ENT_QUOTES,'UTF-8')));
         }
-
         $this->feedList->setListData($data, $lData);
         $this->feedList->update();
+
+        // Generate the HTML content
+        $smarty = get_smarty();
         $smarty->assign('feedList', $this->feedList->render());
-        return($smarty->fetch(get_template_path('dbInformation/contents.tpl', TRUE)));
+        return($linkOpener.$smarty->fetch(get_template_path('dbInformation/contents.tpl', TRUE)));
     }
 
     function save_object()
     {
         parent::save_object();
-    }
-
-    function save()
-    {
-        parent::save();
-    }
-
-    function check()
-    {
-        return(parent::check());
-    }
-
-    function remove_from_parent()
-    {
-        parent::remove_from_parent();
+        $this->feedList->save_object();
     }
 }