<div id="topRightBar">

    {% macro topMenuItem(label, menu, currentModule, currentAction) %}
        {% if menu._html is defined %}
            {{ menu._html|raw }}
        {% elseif (menu._url.module == currentModule and (menu._url.action is empty or menu._url.action == currentAction)) %}
            <span class="topBarElem topBarElemActive"><strong>{{ label|translate }}</strong></span>
        {% else %}
            <span class="topBarElem" {% if menu._tooltip is defined %}title="{{ menu._tooltip }}"{% endif %}>
            <a id="topmenu-{{ menu._url.module|lower }}" href="index.php{{ menu._url|urlRewriteWithParameters }}">{{ label|translate }}</a>
        </span>
        {% endif %}
    {% endmacro %}

    {% macro userMenuItem(label, menu, currentModule, currentAction) %}

        <a class="item {% if (menu._url.module == currentModule and (menu._url.action is empty or menu._url.action == currentAction)) %}active{% endif %}"
           href="index.php{{ menu._url|urlRewriteWithParameters }}"
           id="usermenu-{{ menu._url.module|lower }}-{{ menu._url.action|default('index')|lower }}"
           {% if menu._tooltip is defined %}title="{{ menu._tooltip }}"{% endif %}
                >{{ label|translate }}</a>

    {% endmacro %}

    {% if topMenuModule is not defined %}
        {% set topMenuModule = currentModule %}
        {% set topMenuAction = currentAction %}
    {% endif %}

    {% for label,menu in topMenu %}
        {% if not loop.first %}
                |
        {% endif %}
        {{ _self.topMenuItem(label, menu, topMenuModule, topMenuAction) }}
    {% endfor %}

</div>
