osm-commerces/templates/public/rss/city_themes.xml.twig

45 lines
2.8 KiB
Twig
Raw Normal View History

2025-07-16 17:31:15 +02:00
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Mon Commerce OSM - Changements thématiques pour {{ city.name }}</title>
<link>https://{{ base_url }}</link>
<description>Flux RSS des changements thématiques sur OpenStreetMap pour la ville de {{ city.name }}</description>
<language>fr-fr</language>
<pubDate>{{ "now"|date("D, d M Y H:i:s O") }}</pubDate>
<atom:link href="https://{{ base_url }}{{ path('app_public_rss_city_themes', {'insee_code': city.zone}) }}" rel="self" type="application/rss+xml" />
{% for theme, changes in themeChanges %}
{% if changes|length > 0 %}
{% set latestChange = changes[0] %}
<item>
<title>{{ followup_labels[theme]|default(theme|capitalize) }} - {{ latestChange.measure }} objets</title>
<link>https://{{ base_url }}{{ path('admin_followup_theme_graph', {'insee_code': city.zone, 'theme': theme}) }}</link>
<guid>https://{{ base_url }}{{ path('admin_followup_theme_graph', {'insee_code': city.zone, 'theme': theme}) }}/{{ latestChange.date|date('Y-m-d') }}</guid>
<pubDate>{{ latestChange.date|date("D, d M Y H:i:s O") }}</pubDate>
<description>
<![CDATA[
<p><strong>Thème:</strong> {{ followup_labels[theme]|default(theme|capitalize) }}</p>
<p><strong>Nombre d'objets:</strong> {{ latestChange.measure }}</p>
<p><strong>Date de mesure:</strong> {{ latestChange.date|date("d/m/Y H:i:s") }}</p>
<p><strong>Ville:</strong> {{ city.name }} ({{ city.zone }})</p>
{% if changes|length > 1 %}
<p><strong>Évolution:</strong>
{% set previousChange = changes[1] %}
{% set diff = latestChange.measure - previousChange.measure %}
{% if diff > 0 %}
<span style="color: green;">+{{ diff }} objets</span>
{% elseif diff < 0 %}
<span style="color: red;">{{ diff }} objets</span>
{% else %}
<span>Pas de changement</span>
{% endif %}
depuis le {{ previousChange.date|date("d/m/Y") }}
</p>
{% endif %}
]]>
</description>
</item>
{% endif %}
{% endfor %}
</channel>
</rss>