app/lib/menu/ApplicationMenuEditorRenderer.php
/**
     * Parse a XMLElement reading menu entries
     * @param $xml A SimpleXMLElement Object
     * @param $permission_callback check permission callback
     */
Parse a XMLElement reading menu entries
@param $xml A SimpleXMLElement Object
@param $permission_callback check permission callback
Parse a XMLElement reading menu entries @param $xml A SimpleXMLElement Object @param $permission_callback check permission callback
public function parse($xml, $permission_callback = NULL)
    {
        $i = 0;
        foreach ($xml as $xmlElement)
        {
            $atts     = $xmlElement->attributes();
            $label    = (string) $atts['label'];
            $action   = (string) $xmlElement-> action;
            $icon     = (string) $xmlElement-> icon;
            $menu     = NULL;
            $menuItem = new ApplicationMenuEditorItemRenderer($label, $action, $icon, $this->menu_level);
            if ($xmlElement->menu)
            {
                $menu = new ApplicationMenuEditorRenderer($xmlElement-> menu-> menuitem, $this->menu_level +1);
                $menuItem->setMenu($menu);
            }
            if ( $action )
            {
                $this->addMenuItem($menuItem);
            }
            else if ( isset($menu) AND count($menu->getMenuItems()) > 0)
            {
                $this->addMenuItem($menuItem);
            }
            $i ++;
        }
    }
public function parse ( $ xml , $ permission_callback = NULL ) { $ i = 0 ; foreach ( $ xml as $ xmlElement ) { $ atts = $ xmlElement -> attributes ( ) ; $ label = ( string ) $ atts [ 'label' ] ; $ action = ( string ) $ xmlElement -> action ; $ icon = ( string ) $ xmlElement -> icon ; $ menu = NULL ; $ menuItem = new ApplicationMenuEditorItemRenderer ( $ label , $ action , $ icon , $ this -> menu_level ) ; if ( $ xmlElement -> menu ) { $ menu = new ApplicationMenuEditorRenderer ( $ xmlElement -> menu -> menuitem , $ this -> menu_level + 1 ) ; $ menuItem -> setMenu ( $ menu ) ; } if ( $ action ) { $ this -> addMenuItem ( $ menuItem ) ; } else if ( isset ( $ menu ) AND count ( $ menu -> getMenuItems ( ) ) > 0 ) { $ this -> addMenuItem ( $ menuItem ) ; } $ i ++ ; } }
Parse a XMLElement reading menu entries
 @param $xml A SimpleXMLElement Object
 @param $permission_callback check permission callback
Parse a XMLElement reading menu entries @param $xml A SimpleXMLElement Object @param $permission_callback check permission callback
// just child nodes have actions // menus without permission check // parent nodes are shown just when they have valid children (with permission)