templates/course/_card.html.twig line 1

  1. <article class="c-card c-card--slim">
        <!--<div class="c-card__pre-content">
        </div>-->
    
        <div class="c-card__content">
            <div class="c-card__body">
                <div class="c-card__block">
                    <p class="c-card__block-title">{% trans %}Aimed-at{% endtrans %}</p>
                    <div class="c-card__block-copy">
                        {{ targetGroup|raw }}
                    </div>
                </div>
                <div class="c-card__block">
                    <p class="c-card__block-title">{% trans %}Date{% endtrans %}</p>
                    <p class="c-card__block-copy">
                        {% 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 Y')}} - {{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>
                </div>
    
                <div class="c-card__block">
                    <p class="c-card__block-title">{% trans %}Time{% endtrans %}</p>
                    <p class="c-card__block-copy">
                        {% if course.timeStart and course.timeEnd %}
                            {% trans %}From{% endtrans %} {{course.timeStart}} {% trans %}to{% endtrans %} {{course.timeEnd}}
                        {% else %}
                            {% trans %}Pending-to-define{% endtrans %}Pending to define
                        {% endif %}
                    </p>
                </div>
    
                <div class="c-card__block">
                    <p class="c-card__block-title">{% trans %}Sessions{% endtrans %}</p>
                    <p class="c-card__block-copy">
                        {{ course.getCourseLectures|length }} {% trans %}sessions{% endtrans %}
                    </p>
                </div>
    
                <div class="c-card__block">
                    <p class="c-card__block-title">{% trans %}Organizer{% endtrans %}</p>
                    <p class="c-card__block-copy">{{ course.organizer }}</p>
                </div>
    
                <div class="c-card__block">
                    <p class="c-card__block-title">{% trans %}Place{% endtrans %}</p>
                    <p class="c-card__block-copy">
                        {{ place }}
                    </p>
                </div>
    
                 {% if course.venue != null %}
                <div class="c-card__block">
                    <p class="c-card__block-title">{% trans %}Venue{% endtrans %}</p>
                    <p class="c-card__block-copy">
                        {{ course.venue }}
                    </p>
                </div>
                {% endif %}
    
                {% if course.language != null %}
                <div class="c-card__block">
                    <p class="c-card__block-title">{% trans %}Language_{% endtrans %}</p>
                    <p class="c-card__block-copy">
                        {{ course.language }}
                    </p>
                </div>
                {% endif %}
    
            </div>
    
            <div class="c-card__footer" style="text-align: center;">
                <div class="c-card__actions">
                {% if is_granted('ROLE_REGISTER') %}
    
                    {# // Construir timestamps de inicio y final actividad curso #}
                    {% set string1 = course.getDateStart()|date('m/d/Y') %}
                    {% set string2 = course.getTimeStart()~ '' %}
                    {% set timeendregin = (string1 ~' '~ string2)|date("U") %}
    
                    {% set string1course = course.getDateEnd()|date('m/d/Y') %}
                    {% set string2course = course.getTimeEnd()~ '' %}
                    {% set timeendcourse = (string1course ~' '~ string2course)|date("U") %}
    
                    {% if course.open == 1 and timeendregin > "now"|date("U") %}
                        {% set isregistered = false %}
                        {% for check in courseCheck %}
                            {% if check.course_id == course.id %}
                                {% set isregistered = true %}
                            {% endif %}
                        {% endfor %}
                        {% if isregistered == false %}
                        
                            <a class="c-button c-button--primary" onclick="openModalRegister({{course.id}})">
                                <span class="c-button__body c-button__body--primary">Register</span>
                                <span class="c-button__append c-button__append--primary">
                                →
                                </span>
                            </a>
    
                        {% else %}
    
                            {% if course.linkCourse %}
                                <a href="{{ course.linkCourse }}" target="_blank" class="c-button c-button--primary">
                                    <span class="c-button__body c-button__body--primary">{% trans %}Link-session{% endtrans %}</span>
                                    <span class="c-button__append c-button__append--primary">
                                    →
                                    </span>
                                </a>
                            {% else %}
                                <span>{% trans %}You are registered{% endtrans %}</span>
                            {% endif %}
                            
                        {% endif %}
    
                    {% elseif (course.open == 1 and timeendregin < "now"|date("U") and "now"|date("U") < timeendcourse) %}
                        
                        {% if course.linkCourse %}
                            <a href="{{ course.linkCourse }}" target="_blank" class="c-button c-button--primary">
                                <span class="c-button__body c-button__body--primary">{% trans %}Link-session{% endtrans %}</span>
                                <span class="c-button__append c-button__append--primary">
                                →
                                </span>
                            </a>
                        {% else %}
                            <span>{% trans %}This course is active{% endtrans %}</span>
                        {% endif %}
                    
                    {% elseif (course.open == 0 or timeendcourse < "now"|date("U")) %}
                        <span>{% trans %}This course is closed{% endtrans %}</span>
                    {% endif %}
                    
                {% else %}
                    {% if course.open == 1 %}
                        <p class="small mb-2">{% trans %}Sign up for the Academy before registration{% endtrans %}</p>
                        <a href="{{ path('app_register') }}" class="c-button c-button--primary">
                            <span class="c-button__body c-button__body--primary">{% trans %}Sign up{% endtrans %}</span>
                            <span class="c-button__append c-button__append--primary">
                            →
                            </span>
                        </a>
                    {% elseif course.open == 0 %}
                        <span>{% trans %}This course is closed{% endtrans %}</span>
                    {% endif %}
                {% endif %}
                    {# {% if course.open %}
                        <a href="{{ path('register-student', {'slug': course.slug}) }}" class="c-button c-button--primary">
                            <span class="c-button__body c-button__body--primary">Sign up</span>
                            <span class="c-button__append c-button__append--primary">
                            →
                            </span>
                        </a>
                    {% endif %} #}
                </div>
            </div>
        </div>
    
    </article>