{% extends 'TopxiaWebBundle::layout.html.twig' %}

{% block title %} {{user.nickname}}的公共主页 - {{ parent() }}{% endblock %}

{% set bodyClass = 'userpage' %}
{% set pageNav = pageNav|default(null) %}

{% set script_controller = 'user/user' %}

{% block content %}

{{ render(controller('TopxiaWebBundle:User:headerBlock', {user:user})) }}

<div class="es-row-wrap container-gap userpage-body">
  <ul class="nav nav-pills userpage-nav clearfix">
  	{% if 'ROLE_TEACHER' in user.roles %}
	    <li {% if pageNav == 'teach' %}class="active"{% endif %}><a href="{{ path('user_teach', {id: user.id}) }}">在教课程</a></li>
    {% endif %}
    <li {% if pageNav == 'learn' %}class="active"{% endif %}><a href="{{ path('user_learn', {id:user.id}) }}">在学课程</a></li>
    <li {% if pageNav == 'favorited' %}class="active"{% endif %}><a href="{{ path('user_favorited', {id:user.id}) }}">收藏的课程</a></li>
    <li {% if pageNav == 'group' %}class="active"{% endif %}><a href="{{path('user_group',{id:user.id})}}">加入的小组</a></li>
    <li {% if pageNav == 'friend' %}class="active"{% endif %}><a href="{{ path('user_following', {id:user.id}) }}">关注/粉丝</a></li>

    {% if is_plugin_installed('Classroom') and setting('classroom.enabled')|default(0) %}
    {% if 'ROLE_TEACHER' in user.roles %}
      <li {% if pageNav == 'teaching' %}class="active"{% endif %}><a href="{{ path('user_teaching_classrooms', {id:user.id}) }}">在教{{ setting('classroom.name')|default("班级") }}</a></li>
    {% endif %}
    
    <li {% if pageNav == 'learning' %}class="active"{% endif %}><a href="{{ path('user_learning_classrooms', {id:user.id}) }}">在学{{ setting('classroom.name')|default("班级") }}</a></li>
    {% endif %}
  </ul>

  {% block main %}{% endblock %}

</div>

{% endblock %}