{% macro btn(link, expanded, icon, title, text, class) %} {% if expanded and not isMobile() %} {{text}} {% endif %} {% endmacro %} {% set expanded = expanded is defined and expanded ? true : false %} {% if offset is defined and count is defined %} {% if count > 0 %}
{% set route = app.request.attributes.get('_route') %} {% set pageRoute = route~'-page' %} {% set route = isRoute(pageRoute) ? pageRoute : route %} {% if table_limit is not defined %} {% set table_limit = 20 %} {% endif %} {% set limit = (offset+1)*table_limit %} {% set currentPath = path(app.request.attributes.get('_route'),app.request.attributes.get('_route_params')) %} {% if limit > count %} {% set limit = count %} {% endif %} {% if not expanded %}
{{ (offset*table_limit)+1 }} - {{ limit }} sur {{ count }}
{% endif %} {% set link = false %} {% if (offset*table_limit)+1 > 1 %} {% if params is defined and params|length %} {% set params = params|merge({'offset':offset}) %} {% set link = url(route,params) %} {% elseif cat is defined and cat %} {% set link = url(route,{'cat':cat,'offset':offset}) %} {% else %} {% set link = url(route,{'offset':offset}) %} {% endif %} {% endif %} {{ _self.btn(link, expanded, "arrow-left", "Page précédente", "Précédent", "adapt right-5") }} {% if expanded %} {{ (offset*table_limit)+1 }} - {{ limit }} sur {{ count }} {% endif %} {% set link = false %} {% if limit < count %} {% if params is defined and params|length %} {% set params = params|merge({'offset':offset+2}) %} {% set link = url(route,params) %} {% elseif cat is defined and cat %} {% set link = url(route,{'cat':cat,'offset':offset+2}) %} {% else %} {% set link = url(route,{'offset':offset+2}) %} {% endif %} {% endif %} {{ _self.btn(link, expanded, "arrow-right", "Page suivante", "Suivant", "adapt left-5 reverse") }}
{% else %} {% endif %} {% endif %}