{% set courseSet = data('MemberRecentlyLearned',{'user':app.user}) %}

{% if courseSet %}
  <div class="es-box">
    <div class="es-box-heading">
      <h2>{{'homepage.learning_course.content_title'|trans}}</h2>
    </div>
    <div class="es-box-body user-learn clearfix">
      <a href="{{ path('course_show',{id: courseSet.defaultCourseId}) }}">
        <img src="{{ filepath(course.cover.large|default(), 'course.png') }}"  class="img-responsive thumb pull-left">
      </a>
      <p>《{{ courseSet.title }}》</p>
      {% set teacher = courseSet.course.teachers|first %}
      {% set progress = courseSet.course.progress %}
      <p class="teacher-name">{{'homepage.learning_course.teacher_name'|trans({'%nickname%': teacher.nickname|default("") })}}</p>
      <div class="progress-block clearfix">
        <div class="progress" style="width:90%">
          <span class="progress-bar" style="width: {{ progress.percent }};"></span>
        </div>
        <div class="percentage clearfix">{{'homepage.learning_course.learning_progress'|trans({'%percent%': progress.percent })}}</div>

        {% set task = courseSet.course.nextLearnTask %}
        {% if task %}
          <div class="continue">
            <a href="{{ path('course_task_show', {id: task.id, courseId: courseSet.course.id}) }}" title="{{'homepage.learning_course'|trans({'%title%':  task.title })}}" class="btn btn-success pull-right">
            {{'homepage.learning_course.continue_learning_btn'|trans}}
            </a>
          </div>
        {% endif %}
      </div>
    </div>
  </div>
{% endif %}
