Esempio n. 1
0
                $node->addAttribute('class', 'active');
            }
        } else {
            if (isset($args['children']) && !$args['children']) {
                $children = $node->children();
                foreach ($node->children() as $child) {
                    if ($child->name() == 'ul') {
                        $node->removeChild($child);
                    }
                }
            }
        }
        if ($node->name() == 'li' && ($id = $node->attributes('id'))) {
            if ($node->attributes('class')) {
                $node->addAttribute('class', $node->attributes('class') . ' item' . $id);
            } else {
                $node->addAttribute('class', 'item' . $id);
            }
        }
        if (isset($path) && $node->attributes('id') == $path[0]) {
            $node->addAttribute('id', 'current');
        } else {
            $node->removeAttribute('id');
        }
        $node->removeAttribute('level');
        $node->removeAttribute('access');
    }
    define('modMainMenuNoixXMLCallbackDefined', true);
}
modMainMenuNoixHelper::render($params, 'modMainMenuNoixXMLCallback');
Esempio n. 2
0
 function render(&$params, $callback)
 {
     switch ($params->get('menu_style', 'list')) {
         case 'list_flat':
             // Include the legacy library file
             require_once dirname(__FILE__) . DS . 'legacy.php';
             mosShowHFMenu($params, 1);
             break;
         case 'horiz_flat':
             // Include the legacy library file
             require_once dirname(__FILE__) . DS . 'legacy.php';
             mosShowHFMenu($params, 0);
             break;
         case 'vert_indent':
             // Include the legacy library file
             require_once dirname(__FILE__) . DS . 'legacy.php';
             mosShowVIMenu($params);
             break;
         default:
             // Include the new menu class
             $xml = modMainMenuNoixHelper::getXML($params->get('menutype'), $params, $callback);
             if ($xml) {
                 $class = $params->get('class_sfx');
                 $xml->addAttribute('class', 'menu' . $class);
                 if ($tagId = $params->get('tag_id')) {
                     $xml->addAttribute('id', $tagId);
                 }
                 $result = JFilterOutput::ampReplace($xml->toString((bool) $params->get('show_whitespace')));
                 $result = str_replace(array('<ul/>', '<ul />'), '', $result);
                 echo $result;
             }
             break;
     }
 }