- $this->menu = array_merge($this->menu,$this->menuRecurse($mcache,0,$filiation,0));
- }
-
-
- /** Return the filiation to get to the root element.
- *
- * @param mcache
- * @param MID
- * @param path
- */
- function menuToRoot($mcache, $MID, $path) {
- /* add ourself to the path */
- array_push($path,$MID);
-
- if ($MID) {
- /* recursion */
- return $this->menuToRoot($mcache, $mcache[$MID]['parent'], $path);
- } else {
- /* termination */
- return $path;
- }
- }
-
-
- /** Recursively add menu entries
- *
- * @param mcache
- * @param MIDpere
- * @param filiation
- * @param level
- */
- function menuRecurse($mcache, $MIDpere, $filiation, $level) {
- // the produced output
- $out = array();
-
- foreach ($mcache[$MIDpere]['children'] as $mid)
- {
- $mentry = $mcache[$mid];
-// echo "pid : $pid, location : $location<br/>";
- $entry = htmlentities(stripslashes($mentry['title']), ENT_QUOTES);
- if ($mentry['pid'])
- {
- $link = $this->urlSite($this->barrel->getLocation($mentry['pid']));
- } else {
- $link = $mentry['link'];
- }
- // decide whether this menu should be expanded
- $expanded = ($this->barrel->options->menu_min_level == 0) ||
- ($level+1 < $this->barrel->options->menu_min_level) ||
- in_array($mid, $filiation);
- array_push($out, array($level, $entry, $link, $expanded));
- $out = array_merge($out, $this->menuRecurse($mcache, $mid, $filiation, $level+1));
- }
-
- return $out;
+ $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')));