ninegate/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewflux.html.twig

142 lines
6.4 KiB
Twig

{% set theme = app.session.get('theme') %}
{% if theme is not empty %}
{{ include('@Theme/'~theme~'/function.html.twig') }}
{% endif %}
{% import "@CadolesPortal/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) %}
{% set color = app.session.get('color') %}
{% set colorbodyfont = entity.colorbodyfont %}
{% if colorbodyfont is null %}
{% set colorbodyfont = color['fontcolorhover'] %}
{% endif %}
{% set colorbodyback = entity.colorbodyback %}
{% if colorbodyback is null %}
{% set colorbodyback = color['main'] %}
{% endif %}
{% set colorbodyfont = entity.colorbodyfont %}
{% if colorbodyfont is null %}
{% if colorbodyback==color['fontcolorhover'] %}
{% set colorbodyfont = color['main'] %}
{% else %}
{% set colorbodyfont = color['fontcolorhover'] %}
{% endif %}
{% endif %}
{% if modelist==0 %}
{% set stylegrid="grid-preview" %}
{% elseif modelist==1 %}
{% set stylegrid="grid-list" %}
{% endif %}
{%if mini %}
<div class="widget widget-mini widget-flux" data-id="{{ entity.id }}" loc="{{ entity.loc }}">
<div class="widgetheader">
<a style="cursor:pointer" onClick="bigWidget({{entity.id}})">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo" title="{{ entity.name }}"/>
{% else %}
<img src="/{{ alias }}/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-flux" 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 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="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span>
</div>
{% set firstflux="" %}
<div class="widgetbody" style="{{ stylewidgetbody }} ">
{% if fluxs is defined %}
{% if fluxs|length > 1 %}
<div class="cat-list-feed" onClick="showFlux({{ entity.id}},'all')" style="color:#{{ color['fontcolorhover'] }}; background-color: #{{ color['main'] }}">Tout</div>
{% for flux in fluxs %}
{% set stylefeed = "background-color: #" ~ color['main'] ~ ";" %}
{% if flux.color is not null %}
{% set stylefeed = "background-color: #" ~ flux.color ~ ";" %}
{% endif %}
<div class="cat-list-feed" onClick="showFlux({{ entity.id}},{{ flux.id }})" style="{{ stylefeed }} color:#{{ color['fontcolorhover'] }};">{{ flux.title }}</div>
{% endfor %}
{% endif %}
{% endif %}
<div class="grid clearfix">
{% for feed in feeds %}
{% if loop.index==1 %}
<div class="grid-sizer {{stylegrid}}"></div>
<div class="grid-gutter-sizer {{stylegrid}}-gutter-sizer"></div>
{% endif %}
{% set stylecolor = "background-color: #" ~ color['main'] ~ ";" %}
{% if feed.color is defined and feed.color is not null %}
{% set stylecolor = "background-color: #" ~ feed.color ~ ";" %}
{% endif %}
{% set stylefeed = "" %}
{% if feed.image is not null and feed.image != ""%}
{% set stylefeed = stylefeed ~ "background: url(" ~ feed.image ~ ") no-repeat center; background-size: cover;" %}
{% endif %}
<div class="grid-item {{ stylegrid }} feed flux-{{ feed.fluxid }}">
<div class="grid-item-content" style="{{ stylecolor }};">
<a href="{{ feed.link }}" target="_blank">
<div class="item-link clearfix">
{% if feed.image is not empty %}
<div class="grid-item-logo">
<img class="grid-item-img" src="{{feed.image}}" width="100%">
</div>
{% endif %}
<div class="caption" style="{{ stylecolor }};">
<div class="grid-item-title">
<h2>{{ feed.title }}</h2>
{% if modelist==0 %}
<small>le {{ feed.date|date("d/m/Y à H:i") }}</small><br>
{{ feed.description | nl2br }}
{% endif %}
</div>
</div>
</div>
</a>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
{% endif %}