{% block body %}
{% set printedCategories = [] %}
{% set hasEvents = false %}
{% if category.events|length > 0 %}
{% for categoryEvent in category.events %}
{% if event_exists(categoryEvent.event.id) %}
{% set hasEvents = true %}
{% endif %}
{% endfor %}
{% endif %}
{% set hasProducts = false %}
{% if category.categoryProducts|length > 0 %}
{% for categoryProduct in category.categoryProducts %}
{% set product = categoryProduct.product %}
{% if product_exists(product.id) %}
{% set hasProducts = true %}
{% endif %}
{% endfor %}
{% endif %}
{% set hasPersons = false %}
{% if category.persons|length > 0 %}
{% for categoryPerson in category.persons %}
{% set person = categoryPerson.person %}
{% if person_exists(person.id) %}
{% set hasPersons = true %}
{% endif %}
{% endfor %}
{% endif %}
{% if
hasEvents or
find_active_sub_categories_of_two_categories(category.id, 2)|length > 0 or
hasProducts or
get_category_projects(category.id)|length > 0 or
(find_active_sub_categories_of_two_categories(category.id, 67)|length > 0 and category.slug != "temata") or
(hasPersons and not is_department(category)) or
find_active_sub_categories_of_two_categories(category.id, 108)|length > 0 or
find_sub_categories_with_type(category.id, 2)|length > 0 or
find_sub_categories_with_type(category.id, 10)|length > 0 or
find_sub_categories_with_type(category.id, 1)|length > 0
%}
<section>
<div class="container">
<h2 class="mb-5">{% trans %}Související obsah{% endtrans %}</h2>
<div class="related-links">
{% if hasEvents %}
<a class="related-links__link" href="#akce">{% trans %}akce{% endtrans %}</a>
{% endif %}
{% if find_active_sub_categories_of_two_categories(category.id, 2)|length > 0 %}
<a class="related-links__link" href="#novinky">{% trans %}novinky{% endtrans %}</a>
{% endif %}
{% if hasProducts %}
<a class="related-links__link" href="#publikace">{% trans %}publikace{% endtrans %}</a>
{% endif %}
{% if find_active_sub_categories_of_two_categories(category.id, 108)|length > 0 %}
<a class="related-links__link" href="#edicniRady">{% trans %}edicni.rady{% endtrans %}</a>
{% endif %}
{% if get_category_projects(category.id)|length > 0 %}
<a class="related-links__link" href="#projekty">{% trans %}projekty{% endtrans %}</a>
{% endif %}
{% if find_active_sub_categories_of_two_categories(category.id, 67)|length > 0 and category.slug != "temata" %}
<a class="related-links__link" href="#temata">{% trans %}temata{% endtrans %}</a>
{% endif %}
{% if find_active_sub_categories_of_two_categories(category.id, 84)|length > 0 and category.slug != "tymy" %}
<a class="related-links__link" href="#tymy">{% trans %}tymy{% endtrans %}</a>
{% endif %}
{% if find_active_sub_categories_of_two_categories(category.id, 5)|length > 0 %}
<a class="related-links__link" href="#cfp">Call for papers</a>
{% endif %}
{% if find_sub_categories_with_type(category.id, 2)|length > 0 %}
<a class="related-links__link" href="#kategorie">{% trans %}dalsik.tematu{% endtrans %}</a>
{% endif %}
{% if find_sub_categories_with_type(category.id, 10)|length > 0 %}
<a class="related-links__link" href="#fotogalerie">{% trans %}fotogalerie{% endtrans %}</a>
{% endif %}
{% if hasPersons and not is_department(category) %}
<a class="related-links__link" href="#persons">{% trans %}lide{% endtrans %}</a>
{% endif %}
{% if find_sub_categories_with_type(category.id, 1)|length > 0 %}
<a class="related-links__link" href="#other">{% trans %}Související obsah{% endtrans %}</a>
{% endif %}
{% if 1 == 2 %}
<a class="related-links__link" href="#inMedia">{% trans %}medialni.vystupy{% endtrans %}</a>
{% endif %}
{% if 1 == 2 %}
<a class="related-links__link" href="#inArchive">{% trans %}archivni.fondy{% endtrans %}</a>
{% endif %}
{% if 1 == 2 %}
<a class="related-links__link" href="#other">{% trans %}na.webu{% endtrans %}</a>
{% endif %}
</div>
</div>
</section>
{% endif %}
{% if hasEvents %}
<section id="akce">
<div class="container">
<h3 class="mb-5">{% trans %}akce{% endtrans %}</h3>
<div class="upcoming-wrapper upcoming-wrapper--two-columns">
{% for categoryEvent in category.events %}
{% set event = categoryEvent.event %}
{% if event_exists(event.id) %}
<a href="{{ path('web_event_detail', {'slug':event.slug}) }}" class="upcoming">
<div class="upcoming__date">
<div class="upcoming__date-day">{{ event.dateStart|date("j. n") }}.</div>
<div class="upcoming__date-month">{{ event.dateStart|date("Y") }}</div>
</div>
<div class="upcoming__content">
<h3 class="upcoming__title">{{ event.name }}</h3>
<p class="upcoming__text">{{ event.description|striptags }}</p>
<p class="upcoming__info">
{% if event.dateStart|date('H:i') == "00:00" %}
{% set eventStart = event.dateStart|date('j. n. Y') %}
{% else %}
{% set eventStart = event.dateStart|date("j. n. Y, H:i") %}
{% endif %}
{% if event.dateEnd|date('H:i') == "00:00" %}
{% set eventEnd = event.dateEnd|date('j. n. Y') %}
{% else %}
{% set eventEnd = event.dateEnd|date("j. n. Y, H:i") %}
{% endif %}
{% if eventStart == eventEnd %}
{{ eventStart }}
{% else %}
{{ eventStart }} – {{ eventEnd }}
{% endif %}
</p>
</div>
</a>
{% endif %}
{% endfor %}
</div>
</div>
</section>
{% endif %}
{% if find_active_sub_categories_of_two_categories(category.id, 2)|length > 0 %}
<section id="novinky">
<div class="container">
<h3 class="mb-5">{% trans %}aktualnev.mua{% endtrans %}</h3>
<div class="hp-articles">
{% for blog_new in find_active_sub_categories_of_two_categories(category.id, 2) %}
<a href="{{ path('web_news_detail', {'slug':blog_new.slug}) }}" class="hp-article">
<div class="hp-article__image">
{% if blog_new.upload %}
<img src="{{ get_upload_background(blog_new.upload) }}" class="hp-article__img" alt="">
{% else %}
<img src="{{ asset('build/img/ilustracni.jpg') }}" class="hp-article__img" alt="">
{% endif %}
{% if blog_new.labels|length > 0 %}
<div class="hp-article__category">
{{ blog_new.labels[0].name }}
</div>
{% endif %}
</div>
<div class="hp-article__title">{{ blog_new.name }}</div>
{% if blog_new.description|length <= 120 %}
<p class="hp-article__text">{{ blog_new.description }}</p>
{% else %}
<p class="hp-article__text">{{ blog_new.description|slice(0, 120)~'..' }}</p>
{% endif %}
</a>
{% set printedCategories = printedCategories|merge([blog_new]) %}
{% endfor %}
</div>
<a href="/{{ app.request.locale }}/aktualne-v-mua" class="link-upper mt-7">{% trans %}vsechny.novinky{% endtrans %}</a>
</div>
</section>
{% endif %}
{% if hasProducts %}
<section id="publikace">
<div class="container">
<h3 class="mb-5">{% trans %}publikace{% endtrans %}</h3>
<div class="publications publications--related">
{% for categoryProduct in category.categoryProducts %}
{% set product = categoryProduct.product %}
{% if product_exists(product.id) %}
{% set productVariant = get_lowest_availability_variant(product.productVariants) %}
{% set digitalVersion = get_digital_version(product.productVariants) %}
<a href="{{ path('shop_product', {'slug':product.slug}) }}" class="publication">
<div class="publication__cover">
{% if productVariant.productVariantUploadGroups|length > 0 %}
{% if productVariant.productVariantUploadGroups[0].UploadGroup.upload|length > 0 %}
<img alt="Foto produktu" src="{{ asset(productVariant.productVariantUploadGroups[0].UploadGroup.upload[0].path) }}" class="publication__image">
{% else %}
<img class="publication__image" src="{{ asset('build/img/mua-no-photo.jpg') }}" alt="Foto produktu">
{% endif %}
{% else %}
<img class="publication__image" src="{{ asset('build/img/mua-no-photo.jpg') }}" alt="Foto produktu">
{% endif %}
<div class="badges">
{% if digitalVersion %}
<div class="badge">
<svg width="26" height="26"><use href="{{ asset('/build/svg/_btn-icons.svg#digital') }}"></svg>
</div>
{% endif %}
{% if productVariant.price and productVariant.availability.id in [1, 2] %}
<div class="badge">
<img alt="cart" src="{{ asset('/build/svg/cart.svg') }}">
</div>
{% endif %}
</div>
</div>
<div class="publication__info">
<h3 class="publication__title">{{ product.name }}</h3>
{% if productVariant.name != product.name %}
<p class="publication__author">{{ productVariant.name }}</p>
{% endif %}
<p class="publication__author">{{get_product_author(productVariant)}}</p>
</div>
</a>
{% endif %}
{% endfor %}
</div>
</div>
</section>
{% endif %}
{% if find_active_sub_categories_of_two_categories(category.id, 108)|length > 0 %}
<section id="edicniRady">
<div class="container">
<h3 class="mb-5">{% trans %}edicni.rady{% endtrans %}</h3>
<div class="row">
{% for category in find_active_sub_categories_of_two_categories(category.id, 108) %}
<div class="col-12 col-md-6 col-lg-3">
<a href="{{ path('shop_category_detail', {'slug': category.slug}) }}" class="shop-item">
<div class="shop-item__cover">
{% if category.upload %}
<img src="{{ category.upload.path }}" class="hp-article__img" alt="Article image">
{% else %}
<img src="{{ asset('build/img/ilustracni.jpg') }}" class="hp-article__img" alt="Article image">
{% endif %}
</div>
<h4 class="shop-item__title">{{ category.name }}</h4>
</a>
</div>
{% set printedCategories = printedCategories|merge([category]) %}
{% endfor %}
</div>
</div>
</section>
{% endif %}
{% if find_sub_categories_with_type(category.id, 2)|length > 0 %}
<section id="kategorie">
<div class="container">
<h3 class="mb-5">{% trans %}dalsik.tematu{% endtrans %}</h3>
<div class="row">
{% for category in find_sub_categories_with_type(category.id, 2) %}
<div class="col-12 col-md-6 col-lg-3">
<a href="{{ path('shop_category_detail', {'slug': category.slug}) }}" class="shop-item">
<div class="shop-item__cover">
{% if category.upload %}
<img src="{{ category.upload.path }}" class="shop-item__image" alt="Foto produktu">
{% else %}
<img src="{{ asset('build/img/ilustracni.jpg') }}" class="shop-item__image" alt="Foto produktu">
{% endif %}
</div>
<h4 class="shop-item__title">{{ category.name }}</h4>
</a>
</div>
{% set printedCategories = printedCategories|merge([category]) %}
{% endfor %}
</div>
</div>
</section>
{% endif %}
{% if get_category_projects(category.id)|length > 0 %}
<section id="projekty">
<div class="container">
<h3 class="mb-5">{% trans %}projekty{% endtrans %}</h3>
<div class="boxes boxes--departments--related">
{% for project in get_category_projects(category.id) %}
<ul class="list-box">
<li class="list-box__item align-items-start">
<a href="{{ path('web_project_detail', {'slug':project.slug}) }}" class="list-box__link list-box__link--rich">
<div class="list-box__link-title">{{ project.name }}</span></div>
<p class="list-box__link-perex">{% trans %}resitel{% endtrans %}: <span>{{ get_project_solver(project) }}</span></p>
<p class="list-box__link-perex">{% trans %}zdroj.podpory{% endtrans %}: <span>{{ get_project_provider(project) }}</p>
</a>
</li>
</ul>
{% set printedCategories = printedCategories|merge([project]) %}
{% endfor %}
</div>
</div>
</section>
{% endif %}
{% if find_active_sub_categories_of_two_categories(category.id, 67)|length > 0 and category.slug != "temata" %}
<section id="temata">
<div class="container">
<h3 class="mb-5">{% trans %}temata{% endtrans %}</h3>
<div class="topics">
{% for theme in find_active_sub_categories_of_two_categories(category.id, 67) %}
<a href="{{ path('web_theme_detail', {'slug':theme.slug}) }}" class="topics__link">
<div class="topics__cover">
{% if theme.upload %}
<img src="{{ theme.upload.path }}" class="topics__image" alt="category image">
{% else %}
<img src="{{ asset('build/img/ilustracni.jpg') }}" class="topics__image" alt="category image">
{% endif %}
</div>
<h3 class="topics__title">{{ theme.name }}</h3>
</a>
{% set printedCategories = printedCategories|merge([theme]) %}
{% endfor %}
</div>
</div>
</section>
{% endif %}
{% if find_active_sub_categories_of_two_categories(category.id, 84)|length > 0 and category.slug != "tymy" %}
<section id="tymy">
<div class="container">
<h3 class="mb-5">{% trans %}tymy{% endtrans %}</h3>
<div class="topics">
{% for team in find_active_sub_categories_of_two_categories(category.id, 84) %}
<a href="{{ path('web_get_page', {'slug':team.slug}) }}" class="projects__link">
<div class="topics__cover">
{% if team.upload %}
<img src="{{ team.upload.path }}" class="projects__image" alt="Project image">
{% else %}
<img src="{{ asset('build/img/ilustracni.jpg') }}" class="projects__image" alt="Project image">
{% endif %}
</div>
<h3 class="topics__title">{{ team.name }}</h3>
</a>
{% set printedCategories = printedCategories|merge([team]) %}
{% endfor %}
</div>
</div>
</section>
{% endif %}
{% if find_active_sub_categories_of_two_categories(category.id, 5)|length > 0 %}
<section id="cfp">
<div class="container">
<h3 class="mb-5">Call for papers</h3>
<div class="topics">
{% for cfp in find_active_sub_categories_of_two_categories(category.id, 5) %}
<a href="{{ path('web_call_for_papers_detail', {'slug':cfp.slug}) }}" class="projects__link">
<div class="topics__cover">
{% if cfp.upload %}
<img src="{{ cfp.upload.path }}" class="projects__image" alt="Project image">
{% else %}
<img src="{{ asset('build/img/ilustracni.jpg') }}" class="projects__image" alt="Project image">
{% endif %}
</div>
<h3 class="topics__title">{{ cfp.name }}</h3>
</a>
{% set printedCategories = printedCategories|merge([cfp]) %}
{% endfor %}
</div>
</div>
</section>
{% endif %}
{% if hasPersons and not is_department(category) %}
<section id="persons">
<div class="container">
<h3 class="mb-5">{% trans %}lide{% endtrans %}</h3>
<div class="members">
{% for categoryPerson in category.persons %}
{% set person = categoryPerson.person %}
{% if person_exists(person.id) %}
<div class="member">
{% if person.personUploadGroups|length > 0 %}
{% if person.personUploadGroups[0].UploadGroup.upload|length > 0 %}
<img alt="member__photo" src="{{ asset(person.personUploadGroups[0].UploadGroup.upload[0].path) }}" class="member__photo" alt="Member photo">
{% else %}
<img alt="member__photo" src="{{ asset('build/img/person.png') }}" class="member__photo" alt="Member photo">
{% endif %}
{% else %}
<img alt="member__photo" src="{{ asset('build/img/person.png') }}" class="member__photo" alt="Member photo">
{% endif %}
<div class="member__info">
<div class="member__name"><a href="{{ path('app_web_person_detail', {slug:person.slug}) }}">{{ person.titleBefore }} {{ person.name }} {{ person.surname }}{% if person.titleAfter %}, {% endif %} {{ person.titleAfter }}</a></div>
<div class="member__place">{{ person.department }}</div>
</div>
</div>
{% endif %}
{% endfor %}
</div>
</div>
</section>
{% endif %}
{% if find_sub_categories_with_type(category.id, 10)|length > 0 %}
<section id="fotogalerie">
<div class="container">
<h3 class="mb-5">{% trans %}fotogalerie{% endtrans %}</h3>
<div class="gallery-boxes">
{% for category in find_sub_categories_with_type(category.id, 10) %}
<a href="{{ path('web_gallery_detail', {'slug': category.slug}) }}" class="gallery-box">
<div class="gallery-box__img-wrap">
{% if category.upload %}
<img src="{{ category.upload.path }}" class="gallery-box__image" alt="Category image">
{% else %}
<img src="{{ asset('build/img/ilustracni.jpg') }}" class="gallery-box__image" alt="Category image">
{% endif %}
</div>
<h4 class="gallery-box__title">{{ category.name }}</h4>
</a>
{% set printedCategories = printedCategories|merge([category]) %}
{% endfor %}
</div>
</div>
</section>
{% endif %}
{% if find_sub_categories_with_type(category.id, 1)|length > 0 %}
<section id="other">
<div class="container">
<h3 class="mb-5">{% trans %}Ostatní{% endtrans %}</h3>
<div class="grid grid--3">
{% for category in find_sub_categories_with_type(category.id, 1) %}
<a href="{{ path('web_get_page', {'slug':category.slug}) }}" class="article-link list-box">
{# <div class="topics__cover">
{% if get_category_uploads_by_group_type(category, 0)|length > 0 %}
<img src="{{ get_category_uploads_by_group_type(category, 0)[0].path }}" class="topics__image" alt="Topic image">
{% else %}
<img src="{{ asset('build/img/ilustracni.jpg') }}" class="topics__image" alt="Topic image">
{% endif %}
</div> #}
<div class="list-box__item align-items-start">
<div class="list-box__link list-box__link--rich">
<h3 class="list-box__link-title">{{ category.name }}</h3>
</div>
</div>
</a>
{% endfor %}
</div>
</div>
</section>
{% endif %}
{% if 1 == 2 %}
<section id="inMedia">
<div class="container">
<h3 class="mb-5">{% trans %}medialni.vystupy{% endtrans %}</h3>
<div class="article-links">
<a href="#" class="article-link">
<div class="badge">
<img alt="radio" src="{{ asset('/build/svg/radio.svg') }}">
</div>
<h3 class="article-link__title">{% trans %}delnicke.kolonie{% endtrans %}</h3>
<div class="article-link__type">{% trans %}podcast.rozhlase{% endtrans %}</div>
<p class="article-link__perex">Cu saepe feugiat sit erroribus sea alii at nec no per in ex audiam te. Enim vix cibo vis agam eos sea eu solet est quas est accusam has ut.</p>
<div class="hp-box__link">{% trans %}zobrazit{% endtrans %}</div>
</a>
</div>
<a href="/{{ app.request.locale }}/aktualne-v-mua" class="link-upper mt-7">{% trans %}zobrazit.vsechny{% endtrans %}</a>
</div>
</section>
{% endif %}
{% if 1 == 2 %}
<section id="inArchive">
<div class="container">
<h3 class="mb-5">{% trans %}archivni.sbirky{% endtrans %}</h3>
<div class="article-links">
<a href="#" class="article-link">
<h3 class="article-link__title">{% trans %}delnicke.kolonie{% endtrans %}</h3>
<p class="article-link__perex">Cu saepe feugiat sit erroribus sea alii at nec no per in ex audiam te. Enim vix cibo vis agam eos sea eu solet est quas est accusam has ut.</p>
<div class="hp-box__link">{% trans %}detail.sbirky{% endtrans %}</div>
</a>
</div>
<a href="#" class="link-upper mt-7">{% trans %}zobrazit.vsechny{% endtrans %}</a>
</div>
</section>
{% endif %}
{% if 1 == 2 %}
<section id="other">
<div class="container">
<h3 class="mb-5">{% trans %}dalsi.obsah{% endtrans %}</h3>
<div class="article-links">
<a href="#" class="article-link list-box">
<div class="list-box__item align-items-start">
<div class="list-box__link list-box__link--rich">
<h3 class="list-box__link-title">{% trans %}nazev.stranky{% endtrans %}</h3>
<p class="list-box__link-perex">Cu saepe feugiat sit erroribus sea alii at nec no per in ex audiam tenim vix cibo.</p>
</div>
</div>
</a>
</div>
</div>
</section>
{% endif %}
{% endblock %}