nineskeletor/templates/Pagewidget/viewcalendar.html.twig

101 lines
5.2 KiB
Twig

{% import "Pagewidget/constants.twig" as constants %}
{% set stylewidget = constants.mystylewidget(entity) %}
{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %}
{% set stylewidgetheader = constants.mystylewidgetheader(entity) %}
{% set stylewidgetbody = constants.mystylewidgetbody(entity) %}
{%if mini %}
<div class="widget widget-mini widget-calendar" data-id="{{ entity.id }}" loc="{{ entity.loc }}">
<div class="widgetheader">
<a style="cursor:pointer" onClick="bigWidget({{entity.id}})">
{% if entity.icon %}
<img src="/{{ appAlias }}/{{ entity.icon.label }}" class="logo" title="{{ entity.name }}"/>
{% else %}
<img src="/{{ appAlias }}/uploads/icon/icon_pin.png" class="logo" title="{{ entity.name }}"/>
{% endif %}
</a>
</div>
</div>
{% else %}
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-calendar" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widgetmenu">
{% if canupdate %}
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if access=="config" %}
<a title="Gérer mes Calendriers" href='{{ path('app_config_calendar') }}' style="{{ stylewidgetmenu }}"><i class="fa fa-paper-plane fa-fw"></i></a>
{% else %}
{% set url= path('app_'~access~'_calendar_view') %}
{% if usage=="group" and firstcalendar is defined %}
{% set url= path('app_'~access~'_calendar_view',{id:firstcalendar}) %}
{% endif %}
<a title="Ajouter / Modifier un Evènement" onClick="showFrameitem('calendar','{{ url }}',true)" style="{{ stylewidgetmenu }}"><i class="fa fa-plus fa-fw"></i></a>
{% endif %}
{% if look=="list" %}
<i class="glyphicon glyphicon-resize-small" title="Réduire le Widget" onClick="smallWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% else %}
<i class="glyphicon glyphicon-resize-full" title="Agrandir le Widget" onClick="bigWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
</div>
<div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ appAlias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ appAlias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span>
</div>
{% set firstflux="" %}
{% if events|length >= 1 %}
<div class="widgetbody" style="{{ stylewidgetbody }}">
{% set monthsel = "" %}
{% for i in 0..(nbday-1) %}
{% set dateeventstart = 'now'|date_modify("+"~i~" day midnight") %}
{% set dateeventend = 'now'|date_modify("+"~(i+1)~" day midnight") %}
{% set fgaffday=false %}
{% for event in events %}
{% if event.start< dateeventend and event.end>=dateeventstart %}
{% if monthsel == "" or dateeventstart|date("Y-m")!=monthsel %}
{% set monthsel = dateeventstart|date("Y-m") %}
{% set libmonth = constants.libmonth(dateeventstart|date("m")) %}
<h3>{{ libmonth ~ " " ~ dateeventstart|date("Y") }}</h3>
{% endif %}
{% if not fgaffday %}
{% set fgaffday=true %}
{% set libday = constants.libday(dateeventstart|date("N")) %}
<div style="margin-top:15px; font-weight:bold; font-size:18px;">{{ libday ~ " " ~ dateeventstart|date("d/m/Y") }}</div>
{% endif %}
<div class="widget-event" style="background-color:{{ event.color }}; color: #FFF; padding:2px;" title="{{ event.description }}">
{{ event.name }} =
{% if not event.allDay %}
{{ event.start | date("H:i") }} -
{%endif%}
{{ event.title }}
</div>
{% endif %}
{% endfor %}
{% endfor %}
{% if url is defined %}
<div style="cursor:pointer; text-align: right; margin-top:20px;"><a onClick="showFrameitem('calendar','{{url }}',true)" style="{{ stylewidgetbody }}">Voir mes Agendas</a></div>
{% endif %}
</div>
{% endif %}
</div>
{% endif %}