<?php
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;
/* fiche/_includes/diaporama.html.twig */
class __TwigTemplate_7223d5e6bd599aca54d8ff6d4a46e61c6abcecf164fbbddf0cdb3afb42583e41 extends Template
{
private $source;
private $macros = [];
public function __construct(Environment $env)
{
parent::__construct($env);
$this->source = $this->getSourceContext();
$this->parent = false;
$this->blocks = [
];
}
protected function doDisplay(array $context, array $blocks = [])
{
$macros = $this->macros;
$__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
$__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->enter($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "fiche/_includes/diaporama.html.twig"));
$__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "fiche/_includes/diaporama.html.twig"));
// line 3
$context["diapoPrincipal"] = false;
// line 4
echo "
";
// line 5
if (twig_get_attribute($this->env, $this->source, (isset($context["etablissement"]) || array_key_exists("etablissement", $context) ? $context["etablissement"] : (function () { throw new RuntimeError('Variable "etablissement" does not exist.', 5, $this->source); })()), "isClient", [], "any", false, false, false, 5)) {
// line 6
echo " ";
if ((twig_get_attribute($this->env, $this->source, (isset($context["etablissement"]) || array_key_exists("etablissement", $context) ? $context["etablissement"] : (function () { throw new RuntimeError('Variable "etablissement" does not exist.', 6, $this->source); })()), "diapoPlus", [], "any", false, false, false, 6) && (1 === twig_compare(twig_length_filter($this->env, twig_get_attribute($this->env, $this->source, (isset($context["etablissement"]) || array_key_exists("etablissement", $context) ? $context["etablissement"] : (function () { throw new RuntimeError('Variable "etablissement" does not exist.', 6, $this->source); })()), "diaporamas", [], "any", false, false, false, 6)), 0)))) {
// line 7
echo " ";
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, (isset($context["etablissement"]) || array_key_exists("etablissement", $context) ? $context["etablissement"] : (function () { throw new RuntimeError('Variable "etablissement" does not exist.', 7, $this->source); })()), "diaporamas", [], "any", false, false, false, 7));
foreach ($context['_seq'] as $context["_key"] => $context["diapo"]) {
// line 8
echo " ";
if (twig_get_attribute($this->env, $this->source, $context["diapo"], "principal", [], "any", false, false, false, 8)) {
// line 9
echo " ";
$context["diapoPrincipal"] = $context["diapo"];
// line 10
echo " ";
}
// line 11
echo " ";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['diapo'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 12
echo " ";
}
// line 13
echo " ";
$context["diapoPrincipal"] = (((0 === twig_compare((isset($context["diapoPrincipal"]) || array_key_exists("diapoPrincipal", $context) ? $context["diapoPrincipal"] : (function () { throw new RuntimeError('Variable "diapoPrincipal" does not exist.', 13, $this->source); })()), true))) ? ((isset($context["diapoPrincipal"]) || array_key_exists("diapoPrincipal", $context) ? $context["diapoPrincipal"] : (function () { throw new RuntimeError('Variable "diapoPrincipal" does not exist.', 13, $this->source); })())) : (twig_first($this->env, twig_get_attribute($this->env, $this->source, (isset($context["etablissement"]) || array_key_exists("etablissement", $context) ? $context["etablissement"] : (function () { throw new RuntimeError('Variable "etablissement" does not exist.', 13, $this->source); })()), "diaporamas", [], "any", false, false, false, 13))));
// line 14
echo " ";
$context["diapoPrincipalPhotos"] = ((twig_get_attribute($this->env, $this->source, (isset($context["etablissement"]) || array_key_exists("etablissement", $context) ? $context["etablissement"] : (function () { throw new RuntimeError('Variable "etablissement" does not exist.', 14, $this->source); })()), "diapoPlus", [], "any", false, false, false, 14)) ? (twig_get_attribute($this->env, $this->source, (isset($context["diapoPrincipal"]) || array_key_exists("diapoPrincipal", $context) ? $context["diapoPrincipal"] : (function () { throw new RuntimeError('Variable "diapoPrincipal" does not exist.', 14, $this->source); })()), "photo", [], "any", false, false, false, 14)) : (twig_slice($this->env, twig_get_attribute($this->env, $this->source, (isset($context["diapoPrincipal"]) || array_key_exists("diapoPrincipal", $context) ? $context["diapoPrincipal"] : (function () { throw new RuntimeError('Variable "diapoPrincipal" does not exist.', 14, $this->source); })()), "photo", [], "any", false, false, false, 14), 0, twig_get_attribute($this->env, $this->source, (isset($context["etablissement"]) || array_key_exists("etablissement", $context) ? $context["etablissement"] : (function () { throw new RuntimeError('Variable "etablissement" does not exist.', 14, $this->source); })()), "nombrePhotosMax", [], "any", false, false, false, 14))));
}
// line 16
echo "
";
// line 17
if ((twig_get_attribute($this->env, $this->source, (isset($context["etablissement"]) || array_key_exists("etablissement", $context) ? $context["etablissement"] : (function () { throw new RuntimeError('Variable "etablissement" does not exist.', 17, $this->source); })()), "isClient", [], "any", false, false, false, 17) && ((0 !== twig_compare((isset($context["diapoPrincipal"]) || array_key_exists("diapoPrincipal", $context) ? $context["diapoPrincipal"] : (function () { throw new RuntimeError('Variable "diapoPrincipal" does not exist.', 17, $this->source); })()), false)) || !twig_test_empty(twig_get_attribute($this->env, $this->source, (isset($context["etablissement"]) || array_key_exists("etablissement", $context) ? $context["etablissement"] : (function () { throw new RuntimeError('Variable "etablissement" does not exist.', 17, $this->source); })()), "imagesDiaporama", [], "any", false, false, false, 17))))) {
// line 19
echo "<div id=\"diapo\" class=\"carousel slide carousel-dark\" data-bs-ride=\"carousel\">
";
// line 22
echo " ";
// line 27
echo "
";
// line 29
echo " <div class=\"carousel-inner\">
";
// line 32
echo " ";
if ((0 !== twig_compare((isset($context["diapoPrincipal"]) || array_key_exists("diapoPrincipal", $context) ? $context["diapoPrincipal"] : (function () { throw new RuntimeError('Variable "diapoPrincipal" does not exist.', 32, $this->source); })()), false))) {
// line 33
echo " ";
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable((isset($context["diapoPrincipalPhotos"]) || array_key_exists("diapoPrincipalPhotos", $context) ? $context["diapoPrincipalPhotos"] : (function () { throw new RuntimeError('Variable "diapoPrincipalPhotos" does not exist.', 33, $this->source); })()));
$context['loop'] = [
'parent' => $context['_parent'],
'index0' => 0,
'index' => 1,
'first' => true,
];
if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof \Countable)) {
$length = count($context['_seq']);
$context['loop']['revindex0'] = $length - 1;
$context['loop']['revindex'] = $length;
$context['loop']['length'] = $length;
$context['loop']['last'] = 1 === $length;
}
foreach ($context['_seq'] as $context["_key"] => $context["item"]) {
// line 34
echo " ";
if ((-1 === twig_compare(twig_get_attribute($this->env, $this->source, $context["loop"], "index0", [], "any", false, false, false, 34), twig_get_attribute($this->env, $this->source, (isset($context["etablissement"]) || array_key_exists("etablissement", $context) ? $context["etablissement"] : (function () { throw new RuntimeError('Variable "etablissement" does not exist.', 34, $this->source); })()), "getNombrePhotosMax", [], "any", false, false, false, 34)))) {
echo "
<div class=\"carousel-item ";
// line 35
if ((0 === twig_compare(twig_get_attribute($this->env, $this->source, $context["loop"], "index0", [], "any", false, false, false, 35), 0))) {
echo "active";
}
echo "\">
<img src=\"";
// line 36
echo twig_escape_filter($this->env, $this->extensions['Liip\ImagineBundle\Templating\FilterExtension']->filter($this->extensions['Vich\UploaderBundle\Twig\Extension\UploaderExtension']->asset($context["item"], "photoFile"), "diapo_une"), "html", null, true);
echo "\" alt=\"";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["item"], "legende", [], "any", false, false, false, 36), "html", null, true);
echo "\" class=\"d-block\" style=\"width:100%; cursor:pointer;\" data-bs-toggle=\"modal\" data-bs-target=\"#diapoModal";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["loop"], "index", [], "any", false, false, false, 36), "html", null, true);
echo "\">
<div class=\"carousel-caption\">
<p>";
// line 38
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["item"], "legende", [], "any", false, false, false, 38), "html", null, true);
echo "</p>
</div>
</div>
";
// line 43
echo " <div class=\"modal fade\" id=\"diapoModal";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["loop"], "index", [], "any", false, false, false, 43), "html", null, true);
echo "\" tabindex=\"-1\" aria-labelledby=\"diapoModalLabel";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["loop"], "index", [], "any", false, false, false, 43), "html", null, true);
echo "\" aria-hidden=\"true\">
<div class=\"modal-dialog modal-dialog-centered d-flex align-items-center justify-content-center\" style=\"min-height: 100vh;\">
<div class=\"modal-content\" style=\"width: auto; display: inline-block; margin: auto;\">
<div class=\"modal-body text-center\" style=\"padding:0;\">
<img src=\"";
// line 47
echo twig_escape_filter($this->env, $this->extensions['Vich\UploaderBundle\Twig\Extension\UploaderExtension']->asset($context["item"], "photoFile"), "html", null, true);
echo "\" alt=\"";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["item"], "legende", [], "any", false, false, false, 47), "html", null, true);
echo "\" class=\"img-fluid\" style=\"display:block; max-width:100%; height:auto;\">
</div>
</div>
</div>
</div>
";
}
// line 53
echo " ";
++$context['loop']['index0'];
++$context['loop']['index'];
$context['loop']['first'] = false;
if (isset($context['loop']['length'])) {
--$context['loop']['revindex0'];
--$context['loop']['revindex'];
$context['loop']['last'] = 0 === $context['loop']['revindex0'];
}
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['item'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 54
echo " ";
} else {
echo "
";
// line 56
echo " ";
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, (isset($context["etablissement"]) || array_key_exists("etablissement", $context) ? $context["etablissement"] : (function () { throw new RuntimeError('Variable "etablissement" does not exist.', 56, $this->source); })()), "imagesDiaporama", [], "any", false, false, false, 56));
$context['loop'] = [
'parent' => $context['_parent'],
'index0' => 0,
'index' => 1,
'first' => true,
];
if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof \Countable)) {
$length = count($context['_seq']);
$context['loop']['revindex0'] = $length - 1;
$context['loop']['revindex'] = $length;
$context['loop']['length'] = $length;
$context['loop']['last'] = 1 === $length;
}
foreach ($context['_seq'] as $context["_key"] => $context["item"]) {
// line 57
echo " <div class=\"carousel-item ";
if ((0 === twig_compare(twig_get_attribute($this->env, $this->source, $context["loop"], "index0", [], "any", false, false, false, 57), 0))) {
echo "active";
}
echo "\">
";
// line 58
if ((-1 === twig_compare(twig_get_attribute($this->env, $this->source, $context["loop"], "index0", [], "any", false, false, false, 58), twig_get_attribute($this->env, $this->source, (isset($context["etablissement"]) || array_key_exists("etablissement", $context) ? $context["etablissement"] : (function () { throw new RuntimeError('Variable "etablissement" does not exist.', 58, $this->source); })()), "getNombrePhotosMax", [], "any", false, false, false, 58)))) {
echo "
<img src=\"";
// line 59
echo twig_escape_filter($this->env, $this->extensions['Liip\ImagineBundle\Templating\FilterExtension']->filter($this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl(("images/jouve/photo/" . $context["item"])), "etab_fiche"), "html", null, true);
echo "\" class=\"d-block\" style=\"width:100%\">
";
}
// line 61
echo " </div>
";
++$context['loop']['index0'];
++$context['loop']['index'];
$context['loop']['first'] = false;
if (isset($context['loop']['length'])) {
--$context['loop']['revindex0'];
--$context['loop']['revindex'];
$context['loop']['last'] = 0 === $context['loop']['revindex0'];
}
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['item'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 62
echo "
";
}
// line 64
echo "
</div>
";
// line 68
echo " ";
if ((1 === twig_compare(twig_get_attribute($this->env, $this->source, (isset($context["etablissement"]) || array_key_exists("etablissement", $context) ? $context["etablissement"] : (function () { throw new RuntimeError('Variable "etablissement" does not exist.', 68, $this->source); })()), "getNombrePhotosMax", [], "any", false, false, false, 68), 1))) {
// line 69
echo " <button class=\"carousel-control-prev\" type=\"button\" data-bs-target=\"#diapo\" data-bs-slide=\"prev\">
<span class=\"carousel-control-prev-icon\"></span>
</button>
<button class=\"carousel-control-next\" type=\"button\" data-bs-target=\"#diapo\" data-bs-slide=\"next\">
<span class=\"carousel-control-next-icon\"></span>
</button>
";
}
// line 76
echo "
</div>
";
} else {
// line 79
echo "<div class=\"fiche-diapo\">
<div class=\"no-diapo\"><span class=\"no-logo\"></span></div>
</div>
";
}
// line 83
echo "
";
$__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->leave($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof);
$__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
}
public function getTemplateName()
{
return "fiche/_includes/diaporama.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 270 => 83, 264 => 79, 259 => 76, 250 => 69, 247 => 68, 242 => 64, 238 => 62, 223 => 61, 218 => 59, 214 => 58, 207 => 57, 189 => 56, 184 => 54, 170 => 53, 159 => 47, 149 => 43, 142 => 38, 133 => 36, 127 => 35, 122 => 34, 104 => 33, 101 => 32, 97 => 29, 94 => 27, 92 => 22, 88 => 19, 86 => 17, 83 => 16, 79 => 14, 76 => 13, 73 => 12, 67 => 11, 64 => 10, 61 => 9, 58 => 8, 53 => 7, 50 => 6, 48 => 5, 45 => 4, 43 => 3,);
}
public function getSourceContext()
{
return new Source("{# Retrouver la diapo principale, si aucune n'est définir on prend la 1ère #}
{# On prend la diapo princiaple, sinon la 1ère trouvée sinon la diapo importée depuis le BO Jouve #}
{% set diapoPrincipal = false %}
{% if etablissement.isClient %}
{% if etablissement.diapoPlus and etablissement.diaporamas|length > 0 %}
{% for diapo in etablissement.diaporamas %}
{% if diapo.principal %}
{% set diapoPrincipal = diapo %}
{% endif %}
{% endfor %}
{% endif %}
{% set diapoPrincipal = diapoPrincipal == true ? diapoPrincipal : etablissement.diaporamas | first %}
{% set diapoPrincipalPhotos = etablissement.diapoPlus ? diapoPrincipal.photo : diapoPrincipal.photo | slice(0, etablissement.nombrePhotosMax) %}
{% endif %}
{% if etablissement.isClient and (diapoPrincipal != false or etablissement.imagesDiaporama is not empty) %}
{# <!-- BS5 Carousel --> #}
<div id=\"diapo\" class=\"carousel slide carousel-dark\" data-bs-ride=\"carousel\">
{# <!-- Indicators/dots --> #}
{# <div class=\"carousel-indicators\">
<button type=\"button\" data-bs-target=\"#diapo\" data-bs-slide-to=\"0\" class=\"active\"></button>
<button type=\"button\" data-bs-target=\"#diapo\" data-bs-slide-to=\"1\"></button>
<button type=\"button\" data-bs-target=\"#diapo\" data-bs-slide-to=\"2\"></button>
</div> #}
{# <!-- The slideshow/carousel --> #}
<div class=\"carousel-inner\">
{# On affiche les photos du diaporama principal s'il existe #}
{% if diapoPrincipal != false %}
{% for item in diapoPrincipalPhotos %}
{% if loop.index0 < etablissement.getNombrePhotosMax %}
<div class=\"carousel-item {% if loop.index0 == 0 %}active{% endif %}\">
<img src=\"{{ vich_uploader_asset(item, 'photoFile')| imagine_filter('diapo_une') }}\" alt=\"{{ item.legende }}\" class=\"d-block\" style=\"width:100%; cursor:pointer;\" data-bs-toggle=\"modal\" data-bs-target=\"#diapoModal{{ loop.index }}\">
<div class=\"carousel-caption\">
<p>{{ item.legende }}</p>
</div>
</div>
{# Modal for image preview #}
<div class=\"modal fade\" id=\"diapoModal{{ loop.index }}\" tabindex=\"-1\" aria-labelledby=\"diapoModalLabel{{ loop.index }}\" aria-hidden=\"true\">
<div class=\"modal-dialog modal-dialog-centered d-flex align-items-center justify-content-center\" style=\"min-height: 100vh;\">
<div class=\"modal-content\" style=\"width: auto; display: inline-block; margin: auto;\">
<div class=\"modal-body text-center\" style=\"padding:0;\">
<img src=\"{{ vich_uploader_asset(item, 'photoFile') }}\" alt=\"{{ item.legende }}\" class=\"img-fluid\" style=\"display:block; max-width:100%; height:auto;\">
</div>
</div>
</div>
</div>
{% endif %}
{% endfor %}
{% else %}
{# On garde l'ancienne diapo au cas où la migration a foiré ... #}
{% for item in etablissement.imagesDiaporama %}
<div class=\"carousel-item {% if loop.index0 == 0 %}active{% endif %}\">
{% if loop.index0 < etablissement.getNombrePhotosMax %}
<img src=\"{{ asset('images/jouve/photo/' ~ item) | imagine_filter('etab_fiche')}}\" class=\"d-block\" style=\"width:100%\">
{% endif %}
</div>
{% endfor %}
{% endif %}
</div>
{# <!-- Left and right controls/icons --> #}
{% if etablissement.getNombrePhotosMax > 1 %}
<button class=\"carousel-control-prev\" type=\"button\" data-bs-target=\"#diapo\" data-bs-slide=\"prev\">
<span class=\"carousel-control-prev-icon\"></span>
</button>
<button class=\"carousel-control-next\" type=\"button\" data-bs-target=\"#diapo\" data-bs-slide=\"next\">
<span class=\"carousel-control-next-icon\"></span>
</button>
{% endif %}
</div>
{% else %}
<div class=\"fiche-diapo\">
<div class=\"no-diapo\"><span class=\"no-logo\"></span></div>
</div>
{% endif %}
{# {% if etablissement.isClient and etablissement.typeClient in ['établissement', 'internat'] %}
{% set isFav = favoris.has(etablissement) %}
<span class=\"fav-toggle {{ isFav ? 'fav-added' }}\" data-id=\"{{ etablissement.id }}\" title=\"{{ isFav ? 'Supprimer du favoris' : 'Ajouter aux favoris' }}\"></span>
{% endif %} #}", "fiche/_includes/diaporama.html.twig", "/app/templates/fiche/_includes/diaporama.html.twig");
}
}