src/Easy/HTMLMenus.php
protected function renderSingleMenuItem(&$menuItem)
    {
        $profile = Openbizx::$app->getUserProfile();
        $svcobj = Openbizx::getService(ACCESS_SERVICE);
        $role = isset($profile["ROLE"]) ? $profile["ROLE"] : null;

        if ( isset($menuItem["ATTRIBUTES"]['URL']) ) {
            $url = $menuItem["ATTRIBUTES"]["URL"];
        } elseif ( isset($menuItem["ATTRIBUTES"]['VIEW']) ) {
            $view = $menuItem["ATTRIBUTES"]["VIEW"];
            // menuitem's containing VIEW attribute is renderd if access is granted in accessservice.xml
            // menuitem's are rendered if no definition is found in accessservice.xml (default)
            if ($svcobj->allowViewAccess($view, $role)) {
                $url = "javascript:GoToView('" . $view . "')";
            } else {
                return '';
            }
        }

        $caption = $this->translate($menuItem["ATTRIBUTES"]["CAPTION"]);
        $target = $menuItem["ATTRIBUTES"]["TARGET"];
        $icon = $menuItem["ATTRIBUTES"]["ICON"];
        $img = $icon ? "<img src='" . Openbizx::$app->getImageUrl() . "/$icon' class=menu_img> " : "";

        if ($view)
            $url = "javascript:GoToView('" . $view . "')";

        if ($target)
            $sHTML .= "<li><a href=\"" . $url . "\" target='$target'>$img" . $caption . "</a>";
        else
            $sHTML .= "<li><a href=\"" . $url . "\">$img" . $caption . "</a>";
        if ($menuItem["MENUITEM"]) {
            $sHTML .= "\n<ul>\n";
            $sHTML .= $this->renderMenuItems($menuItem["MENUITEM"]);
            $sHTML .= "</ul>";
        }
        $sHTML .= "</li>\n";

        return $sHTML;
    }
protected function renderSingleMenuItem(&$menuItem)
    {
        $profile = Openbizx::$app->getUserProfile();
        $svcobj = Openbizx::getService(ACCESS_SERVICE);
        $role = isset($profile["ROLE"]) ? $profile["ROLE"] : null;

        if ( isset($menuItem["ATTRIBUTES"]['URL']) ) {
            $url = $menuItem["ATTRIBUTES"]["URL"];
        } elseif ( isset($menuItem["ATTRIBUTES"]['VIEW']) ) {
            $view = $menuItem["ATTRIBUTES"]["VIEW"];
            // menuitem's containing VIEW attribute is renderd if access is granted in accessservice.xml
            // menuitem's are rendered if no definition is found in accessservice.xml (default)
            if ($svcobj->allowViewAccess($view, $role)) {
                $url = "javascript:GoToView('" . $view . "')";
            } else {
                return '';
            }
        }

        $caption = $this->translate($menuItem["ATTRIBUTES"]["CAPTION"]);
        $target = $menuItem["ATTRIBUTES"]["TARGET"];
        $icon = $menuItem["ATTRIBUTES"]["ICON"];
        $img = $icon ? "<img src='" . Openbizx::$app->getImageUrl() . "/$icon' class=menu_img> " : "";

        if ($view)
            $url = "javascript:GoToView('" . $view . "')";

        if ($target)
            $sHTML .= "<li><a href=\"" . $url . "\" target='$target'>$img" . $caption . "</a>";
        else
            $sHTML .= "<li><a href=\"" . $url . "\">$img" . $caption . "</a>";
        if ($menuItem["MENUITEM"]) {
            $sHTML .= "\n<ul>\n";
            $sHTML .= $this->renderMenuItems($menuItem["MENUITEM"]);
            $sHTML .= "</ul>";
        }
        $sHTML .= "</li>\n";

        return $sHTML;
    }
Render single menu item

@param array $menuItem menu item metadata xml array
@return string html content of each menu item