<header class="navbar">
      <div class="container">

        <div class="navbar-header">

          {# Site logo #}
          {% if setting('site.logo') %}
            <a href="{{ path('homepage') }}" class="navbar-brand-logo"><img src="{{ asset(setting('site.logo')) }}" class="" /></a>
          {% else %}
            <a href="{{ path('homepage') }}" class="navbar-brand">{{ setting('site.name', 'EDUSOHO') }}</a>
          {% endif %}

          <button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
        </div>

        <nav class="collapse navbar-collapse clearfix" role="navigation">
          {# User defined top nav #}
          {{ render(controller('TopxiaWebBundle:Default:topNavigation', {siteNav:siteNav|default(null)})) }}

          <ul class="nav-user">

            {% if app.user %}

            <li class="hidden-sm">
              {% if app.user.isTeacher() %}
                <a class="btn btn-k12" href="{{ path('my_teaching') }}"> 我的教学 </a>
              {% elseif app.user.isParent() %}
                <a class="btn btn-k12" href="{{ path('my_children') }}"> 我的主页 </a>
              {% else %}
                <a class="btn btn-k12" href="{{ path('my_class') }}"> 我的班级 </a>
              {% endif %}
            </li>

            <li class="user dropdown">
              <a href="" class="dropdown-toggle" data-toggle="dropdown">
                <img class="user-avatar" src="{{ file_path(app.user.smallAvatar, 'avatar.png') }}" />
                <span class="name">{{ app.user.truename }}</span>
                <span class="fa fa-sort-down"></span>
              </a>
              <ul class="dropdown-menu">
                {% if not app.user.isParent() %}
                <li>
                  <a href="{{ path('user_show', {id:app.user.id}) }}">
                    <span class="fa fa-home"></span><span>我的主页</span>
                  </a>
                </li>
                {% endif %}

                {% if app.user.isStudent() %}

                <li>
                  <a href="{{ path('my_courses_learning', {id:app.user.id}) }}">
                    <span class="fa fa-user"></span><span>个人中心</span>
                  </a>
                </li>

                {% endif %}

                <li><a href="{{ path('settings') }}"><span class="fa fa-cog"></span><span>账号设置</span></a></li>

                {% if is_granted('ROLE_BACKEND') %}
                <li><a href="{{ path('admin') }}"><span class="fa fa-unlock-alt"></span><span>管理后台</span></a></li>
                {% endif %}

                <li><a href="{{ path('logout') }}"><span class="fa fa-power-off"></span><span>退出账户</span></a></li>
              </ul>
            </li>

            <li class="hidden-sm">
              <a href="{{ path('notification') }}" title="通知">
                <span class="fa fa-bell-o"></span>
                {% if app.user.newNotificationNum > 0 %}
                  <span class="badge">{{ app.user.newNotificationNum }}</span>
                {% endif %}
              </a>
            </li>

            <li class="hidden-sm">
              <a href="{{ path('message') }}" title="私信">
                <span class="fa fa-envelope-o"></span>
                {% if app.user.newMessageNum > 0 %}
                  <span class="badge">{{ app.user.newMessageNum }}</span>
                {% endif %}
              </a>
            </li>

          {% else %}
            <li>
              <a id="login_link" href="{{ path('login') }}"><span class="glyphicon glyphicon-user prs"></span>登录</a>
            </li>
          {% endif %}
          </ul>

        </nav>
      </div>
    </header>