merge selected changes from 'branches/diogenes-newplugins':
[diogenes.git] / include / diogenes.barrel.inc.php
index f3a27ae..65ad7ff 100644 (file)
@@ -214,7 +214,6 @@ class DiogenesBarrel extends DiogenesPage
         $render_plugin = $plugobj;
       }
     }
-
     // source page or pass it to a rendering plugin
     if (is_object($render_plugin)) {    
       $content = $render_plugin->render($path);
@@ -314,6 +313,9 @@ class DiogenesBarrel extends DiogenesPage
     // favicon
     if ($bbarrel->options->favicon)
       array_push($this->head, '<link rel="icon" href="'.$this->urlSite("", $bbarrel->options->favicon).'" type="image/png" />');
+
+    // RSS feed
+    array_push($this->head, '<link rel="alternate" type="application/rss+xml" title="'.stripslashes($bbarrel->options->title).'" href="'.$this->urlSite("admin", "rss").'" />');
   }
 
 
@@ -354,12 +356,39 @@ class DiogenesBarrel extends DiogenesPage
     if (!isset($this->table_menu))
       return;
    
-    // all menu entries from database
+    // add the user-defined part of the menu
     $bmenu = new Diogenes_Barrel_Menu($this->dbh, $this->table_menu);
     $this->menu = array_merge($this->menu, $bmenu->makeMenu($PID, $this->barrel->options->menu_min_level, array($this, 'urlSiteByPid')));
   }
 
 
+  /** Read this barrel's menu entries from database.
+   */
+  function menuRead()
+  {
+    $menu = array();
+    $menu[0]['children'] = array();
+    $res = $this->dbh->query("select MID,MIDpere,title,link,PID from {$this->table_menu} order by ordre");
+    while (list($mid, $parent, $title, $link, $pid) = mysql_fetch_row($res))
+    {
+      $menu[$mid]['parent'] = $parent;
+      $menu[$mid]['title'] = $title;
+      $menu[$mid]['link'] = $link;
+      $menu[$mid]['title'] = $title;
+      $menu[$mid]['pid'] = $pid;
+      if (!is_array($menu[$mid]['children']))
+        $menu[$mid]['children'] = array();
+
+      // register this entry with its parent
+      if (!is_array($menu[$parent]['children']))
+        $menu[$parent]['children'] = array();
+      array_push($menu[$parent]['children'], $mid);
+    }
+    mysql_free_result($res);
+    return $menu;
+  }
+
+
   /** 
    * Break down a PATH_INFO into site, page id and file
    * Directories *must* be accessed with a final slash.