_params = $params; $this->Itemid = $Itemid; $this->loadMenu(); } function loadMenu(){ $user =& JFactory::getUser(); $children = array (); // Get Menu Items $items = &JSite::getMenu(); if(is_array($GLOBALS['arr'])) $items->_items[500] = (object)$GLOBALS['arr']; $rows = $items->getItems('menutype', $this->getParam('menutype')); // first pass - collect children $cacheIndex = array(); $this->items = array(); foreach ($rows as $index => $v) { if ($v->access <= $user->get('gid')) { $pt = $v->parent; $list = @ $children[$pt] ? $children[$pt] : array (); array_push($list, $v); $children[$pt] = $list; } $cacheIndex[$v->id] = $index; $this->items[$v->id] = $v; } $this->children = $children; // second pass - collect 'open' menus $open = array ( $this->Itemid ); $count = 20; // maximum levels - to prevent runaway loop $id = $this->Itemid; while (-- $count) { if (isset($cacheIndex[$id])) { $index = $cacheIndex[$id]; if (isset ($rows[$index]) && $rows[$index]->parent > 0) { $id = $rows[$index]->parent; $open[] = $id; } else { break; } } } $this->open = $open; // $this->items = $rows; } function getParam($paramName){ return $this->_params->get($paramName); } function setParam($paramName, $paramValue){ return $this->_params->set($paramName, $paramValue); } function beginMenu($startlevel=0, $endlevel = 10){ // echo "
"; } function endMenu($startlevel=0, $endlevel = 10){ // echo "
"; } function beginMenuItems($pid=0, $level=0){ if($level == 0) echo "