{% extends 'pages/article/default.twig' %} {# show form or not #} {% set show_form = false %} {# we have to remove any parameters for the referer check #} {% set referer = app.request.server.get('HTTP_REFERER')|default('/')|split('?').0 %} {% if (referer == record|link(0) or referer == record|link(0, 'amp')) and (app.request.get("page") == "formular") %} {% set show_form = true %} {% endif %} {% set options = options|default({}) + { page_type: 'competition', sections_autowrapper_enabled: false, competition_prize_label: 'Das können Sie gewinnen:', competition_prize_size: 'image', competition_container_content_class: 'col-md-8 col-lg-7 offset-lg-1 col-xl-6 offset-xl-2', competition_container_advertisement_class: 'col-md-4 text-center', competition_recommendations_imagesize: 'teaser_landscape', competition_recommendations_listlabel: 'Mehr Gewinnspiele', competition_recommendations_teaser_container_class: 'col-lg-3 col-sm-6 col-12', competition_button_future: 'Zurück zur Übersicht', competition_button_now: 'Zum Gewinnspielformular', competition_button_past: 'Zurück zur Übersicht', competition_teaser_button_future: 'Bald geht\'s los!', competition_teaser_button_now: 'Jetzt mitmachen und gewinnen!', competition_teaser_button_past: 'Gewinnspiel beendet', intro_backlink: true, intro_image: show_form ? false : record.image.items|default([])|first, article_taxonomy: false, article_sharing: false, } %} {# This template needs: # record - A bolt content record of type competition # competitionStatus - a value containing time status, generated by record.registerstart|competitionStatus(record.registerend) # game - A bolt content record of type game (Optional!) #} {# Logik ------------------------------------------------------------------------------------------------------------ #} {# Set competition time status and override intro kicker #} {% set competitionStatus = record.registerstart|competitionStatus(record.registerend) %} {% if not competitionStatus %} {% set intro_overrides_kicker = false %} {% elseif competitionStatus == 'future' %} {% set intro_overrides_kicker = 'Teilnehmen von '~ record.registerstart|date("d.m.Y") ~' bis '~ record.registerend|date("d.m.Y")|default() %} {% elseif competitionStatus in ['now','today'] %} {% set intro_overrides_kicker = 'Teilnehmen bis '~ record.registerend|date("d.m.Y")|default() %} {% else %} {% set intro_overrides_kicker = 'Abgelaufen' %} {% endif %} {% set options = options + { intro_overrides_kicker: intro_overrides_kicker, } %} {# Load selected game #} {% set game = RelationList.getItems(record.game)|first %} {# Load recommendations #} {% set res = RelationFill.addShownId('competitions/'~record.id, 'content') %} {% set competition_objects = RelationFill.getItems('competitions', 4) %} {% set competition_teasers = generateTeasers(competition_objects, options + { teaserImageSize: options.competition_recommendations_imagesize }) %} {# Templating ------------------------------------------------------------------------------------------------------- #} {% block page_htmlhead %} {{ parent() }} {% endblock %} {% block article_intro %} {# We embed instead of include to override a block within the intro template #} {% embed 'blocks/intro/default.twig' %} {% block intro_additional_elements %} {# Backlink #} {% if options.intro_backlink and show_form %} Zurück {% endif %} {% endblock %} {% endembed %} {% endblock %} {% block article_content %}
{# Competition status box #}

Teilnahmeschluss

{% if competitionStatus == 'past' %}

Das gewünschte Gewinnspiel ist leider schon abgelaufen!

{% else %}

{{ record.registerend|date("d.m.Y")|default() }}

{% endif %}

Gewinn

{{ record.prizetext|default() }}

{# PAGE TWO - The registration form #} {% if show_form %} {% if competitionStatus == 'past' %}

Das gewünschte Gewinnspiel ist abgelaufen, neue Verlosungen finden Sie hier

{{ options.competition_button_past }}

{% elseif competitionStatus == 'future' %}

Das gewünschte Gewinnspiel ist noch nicht eröffnet, weitere Verlosungen finden Sie hier:

{{ options.competition_button_future }}

{% else %} {% include 'blocks/structured-content/default.twig' with {'sections': record.textform} %} {% if record.formtype|default and record.formid|default %} {% if record.formtype in ['sailthru','patrick'] %} {# form with correct form-specific attributes #} {% include 'sections/default/' ~ record.formtype ~ '.twig' with {'section':{'data':{'url': record.formid|default }}} %} {% else %} {# form with simple text attribute #} {% include 'sections/default/' ~ record.formtype ~ '.twig' with {'section':{'data':{'text': record.formid|default }}} %} {% endif %} {% endif %} {% endif %} {# PAGE ONE - The intro page #} {% else %} {% include 'blocks/structured-content/default.twig' with {'sections': record.text} %} {# Prize #} {% if record.prizetitle|default and record.prizetext|default and record.prizemedia|default %} {% set image = record.prizemedia.items|first|default %} {% if image %}

{{ options.competition_prize_label }}

{{ options.competition_prize_label }}
{{ record.prizetext|raw }}
{% endif %} {% endif %} {# Paging Buttons #} {% if competitionStatus in ['now','today'] %} {% if game|default %} {% include game.contenttype.record_template with {quiz: game} %} {% else %}
{% endif %} {% elseif competitionStatus == 'future' %}

Das gewünschte Gewinnspiel ist noch nicht eröffnet, weitere Verlosungen finden Sie hier:

{{ options.competition_button_future }}

{% else %}

Das gewünschte Gewinnspiel ist abgelaufen, neue Verlosungen finden Sie hier:

{{ options.competition_button_future }}
{% endif %} {% endif %}
{% include 'components/ads/slot.twig' with {options:{ slot_type: 'rail', slot_class: 'sticky-ad advertisement-rail', }} %}
{% endblock %} {% block article_recommendations %} {% include 'blocks/list/default.twig' with { teasers: competition_teasers, options: { list_label: options.competition_recommendations_listlabel, teaser_imagesize: options.competition_recommendations_imagesize, teaser_container_class: options.competition_recommendations_teaser_container_class, block_list_container_class: options.recommendations_block_list_container_class|default, teaser_author: false, teaser_date: false, teaser_buttontext: true, } + options } %} {{ parent() }} {% endblock %}