{% extends 'Layout/layout.html.twig' %}
{% block title %}TIMEPAC ACADEMY: Lecturers{% endblock %}
{% block nav_lecturers %} active {% endblock %}
{% block content %}
<section class="l-breadcrumb">
<nav class="l-breadcrumb__list" aria-label="breadcrumb">
<a class="l-breadcrumb__item" href="{{path('lecturers')}}">{% trans %}Lecturers{% endtrans %} <span class="l-breadcrumb__next"> </span></a>
<a class="l-breadcrumb__item is_active" href="#">{{lecturer.name}} {{lecturer.lastname}}</a>
</nav>
</section>
<section class="l-container l-container--min-color">
<div class="l-container__item">
<h3 class="title-name">{{lecturer.name}} {{lecturer.lastname}}</h3>
<div class="detail-person">
<div class="detail-person__left">
<img src="{{ asset('materials/'~lecturer.picture) }}"/>
<p class="detail-person__type">{{ lecturer.type}}</p>
<p class="detail-person__position"> {{ lecturer.partner }}</p>
</div>
<div class="detail-person__right">
<div class="detail-person__email">
{% if lecturer.email != null %} <a href="mailto:{{lecturer.email}}"><img src="{{ asset('custom/ic_email.png') }}"/></a> {% endif %}
</div>
<div class="detail-person__bio">
{% set local = false %}
{% set descriptionLecturer = '' %}
{% for lecturerTrans in lecturer.getLecturersTranslates() %}
{% if lecturerTrans.getFkLanguage().code == app.request.get('_locale') %}
{% set descriptionLecturer = lecturerTrans.description %}
{% set local = true %}
{% endif %}
{% endfor %}
{% if local == false %}
{% for lecturerTrans in lecturer.getLecturersTranslates() %}
{% if lecturerTrans.getFkLanguage().code == 'en' %}
{% set descriptionLecturer = lecturerTrans.description %}
{% endif %}
{% endfor %}
{% endif %}
{{descriptionLecturer|raw}}
</div>
</div>
</div>
</div>
</section>
<section class="l-container">
<div class="l-container__item">
{% if lecturer.getLectures()|length > 0 %}
<h3 class="title-section">{% trans %}Related training activities{% endtrans %}</h3>
{% endif %}
{% set courses = [] %}
{% set lectures = [] %}
{% for lecture in lecturer.getLectures() %}
{% set lectures = lectures|merge([lecture]) %}
{% for courseLecture in lecture.getCourseLectures() %}
{% if courseLecture.getFkCourse() not in courses %}
{% set courses = courses|merge([courseLecture.getFkCourse()]) %}
{% endif %}
{% endfor %}
{% endfor %}
<div class="list-courses">
{% for course in courses %}
{% set local = false %}
{% set title = '' %}
{% for courseTrans in course.getCourseTranslates() %}
{% if courseTrans.getFkLanguage().code == app.request.get('_locale') %}
{% set title = courseTrans.title %}
{% set local = true %}
{% endif %}
{% endfor %}
{% if local == false %}
{% for courseTrans in course.getCourseTranslates() %}
{% if courseTrans.getFkLanguage().code == 'en' %}
{% set title = courseTrans.title %}
{% endif %}
{% endfor %}
{% endif %}
<div class="list-courses__item">
<div class="list-courses__left">
<p>{% if course.dateStart|date('y-m-d') != course.dateEnd|date('y-m-d') %}
{% if course.dateStart|date('y') != course.dateEnd|date('y') %}
{{course.dateStart|date('d M. Y')}}-{{course.dateEnd|date('d M. Y')}}
{% elseif course.dateStart|date('m') != course.dateEnd|date('m') %}
{{course.dateStart|date('d M.')}}-{{course.dateEnd|date('d M. Y')}}
{% else %}
{{course.dateStart|date('d')}}-{{course.dateEnd|date('d')}} {{course.dateStart|date('M. Y')}}
{% endif %}
{% else %}
{{course.dateStart|date('d M. Y')}}
{% endif %}</p>
<h5>{{ title }}</h5>
<a href="{{ path('app_course_show', {'slug': course.slug})}}" class="c-button c-button--primary c-button--primary">
<span class="c-button__body c-button__body--primary">{% trans %}View more{% endtrans %}</span>
<span class="c-button__append c-button__append--primary">→</span>
</a>
</div>
<div class="list-courses__right">
{% for lectureCourse in course.getCourseLectures() %}
{% if lectureCourse.getFkLecture() in lectures %}
<p class="list-courses__lecture">{% trans %}Session{% endtrans %}</p>
{% set local = false %}
{% set titleLecture = '' %}
{% for lectureTrans in lectureCourse.getFkLecture().getLectureTranslates() %}
{% if lectureTrans.getFkLanguage().code == app.request.get('_locale') %}
{% set titleLecture = lectureTrans.title %}
{% set local = true %}
{% endif %}
{% endfor %}
{% if local == false %}
{% for lectureTrans in lectureCourse.getFkLecture().getLectureTranslates() %}
{% if lectureTrans.getFkLanguage().code == 'en' %}
{% set titleLecture = lectureTrans.title %}
{% endif %}
{% endfor %}
{% endif %}
<p class="list-courses__title-lecture">{{ titleLecture }}</p>
{% endif %}
{% endfor %}
</div>
</div>
{% endfor %}
</div>
</div>
</section>
{% endblock %}