<?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;
/* Slivki/comments/comments.html.twig */
class __TwigTemplate_49723ca76ef304c5f1de78cf08dd045ed81454797f328b653c07f95aa27b0a2e extends Template
{
private $source;
private $macros = [];
public function __construct(Environment $env)
{
parent::__construct($env);
$this->source = $this->getSourceContext();
$this->parent = false;
$this->blocks = [
];
$macros["_self"] = $this->macros["_self"] = $this;
}
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", "Slivki/comments/comments.html.twig"));
$__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "Slivki/comments/comments.html.twig"));
// line 1
$context["isLiveComments"] = array_key_exists("isLiveComments", $context);
// line 2
$context["showBanners"] = (array_key_exists("showBanners", $context) && !(isset($context["isLiveComments"]) || array_key_exists("isLiveComments", $context) ? $context["isLiveComments"] : (function () { throw new RuntimeError('Variable "isLiveComments" does not exist.', 2, $this->source); })()));
// line 3
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable((isset($context["comments"]) || array_key_exists("comments", $context) ? $context["comments"] : (function () { throw new RuntimeError('Variable "comments" does not exist.', 3, $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["comment"]) {
// line 4
echo " ";
if ((isset($context["isLiveComments"]) || array_key_exists("isLiveComments", $context) ? $context["isLiveComments"] : (function () { throw new RuntimeError('Variable "isLiveComments" does not exist.', 4, $this->source); })())) {
// line 5
echo " ";
$this->loadTemplate("Slivki/comments/comments_item.html.twig", "Slivki/comments/comments.html.twig", 5)->display($context);
// line 6
echo " ";
} else {
// line 7
echo " ";
echo twig_call_macro($macros["_self"], "macro_recursiveComment", [$context["comment"], (isset($context["isLiveComments"]) || array_key_exists("isLiveComments", $context) ? $context["isLiveComments"] : (function () { throw new RuntimeError('Variable "isLiveComments" does not exist.', 7, $this->source); })()), 1], 7, $context, $this->getSourceContext());
echo "
";
// line 8
if ((isset($context["showBanners"]) || array_key_exists("showBanners", $context) ? $context["showBanners"] : (function () { throw new RuntimeError('Variable "showBanners" does not exist.', 8, $this->source); })())) {
// line 9
echo " <span id=\"commentBannerPlaceHolder";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["loop"], "index", [], "any", false, false, false, 9), "html", null, true);
echo "\" class=\"hidden\"></span>
";
}
// line 11
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['comment'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 13
if ((array_key_exists("pagination", $context) && (isset($context["pagination"]) || array_key_exists("pagination", $context) ? $context["pagination"] : (function () { throw new RuntimeError('Variable "pagination" does not exist.', 13, $this->source); })()))) {
// line 14
echo " ";
echo (isset($context["pagination"]) || array_key_exists("pagination", $context) ? $context["pagination"] : (function () { throw new RuntimeError('Variable "pagination" does not exist.', 14, $this->source); })());
echo "
";
}
// line 16
if (((isset($context["hasMore"]) || array_key_exists("hasMore", $context) ? $context["hasMore"] : (function () { throw new RuntimeError('Variable "hasMore" does not exist.', 16, $this->source); })()) && (1 === twig_compare(twig_length_filter($this->env, (isset($context["comments"]) || array_key_exists("comments", $context) ? $context["comments"] : (function () { throw new RuntimeError('Variable "comments" does not exist.', 16, $this->source); })())), 0)))) {
// line 17
echo " <div id=\"afterCommentsBlock\">
";
// line 18
$context["lastEntityID"] = 0;
// line 19
echo " ";
$context["lastComment"] = twig_last($this->env, (isset($context["comments"]) || array_key_exists("comments", $context) ? $context["comments"] : (function () { throw new RuntimeError('Variable "comments" does not exist.', 19, $this->source); })()));
// line 20
echo " ";
if ( !(isset($context["isLiveComments"]) || array_key_exists("isLiveComments", $context) ? $context["isLiveComments"] : (function () { throw new RuntimeError('Variable "isLiveComments" does not exist.', 20, $this->source); })())) {
// line 21
echo " ";
$context["lastEntityID"] = twig_get_attribute($this->env, $this->source, twig_last($this->env, (isset($context["comments"]) || array_key_exists("comments", $context) ? $context["comments"] : (function () { throw new RuntimeError('Variable "comments" does not exist.', 21, $this->source); })())), "getEntityID", [], "method", false, false, false, 21);
// line 22
echo " ";
$context["lastComment"] = twig_last($this->env, (isset($context["comments"]) || array_key_exists("comments", $context) ? $context["comments"] : (function () { throw new RuntimeError('Variable "comments" does not exist.', 22, $this->source); })()));
// line 23
echo " ";
}
// line 24
echo " <div class=\"button--white\" onclick=\"loadComments(";
echo twig_escape_filter($this->env, (isset($context["lastEntityID"]) || array_key_exists("lastEntityID", $context) ? $context["lastEntityID"] : (function () { throw new RuntimeError('Variable "lastEntityID" does not exist.', 24, $this->source); })()), "html", null, true);
echo ", ";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, (isset($context["lastComment"]) || array_key_exists("lastComment", $context) ? $context["lastComment"] : (function () { throw new RuntimeError('Variable "lastComment" does not exist.', 24, $this->source); })()), "getID", [], "method", false, false, false, 24), "html", null, true);
echo ", ";
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, (isset($context["lastComment"]) || array_key_exists("lastComment", $context) ? $context["lastComment"] : (function () { throw new RuntimeError('Variable "lastComment" does not exist.', 24, $this->source); })()), "getTypeID", [], "method", false, false, false, 24), "html", null, true);
((array_key_exists("categoryID", $context)) ? (print (twig_escape_filter($this->env, (", " . (isset($context["categoryID"]) || array_key_exists("categoryID", $context) ? $context["categoryID"] : (function () { throw new RuntimeError('Variable "categoryID" does not exist.', 24, $this->source); })())), "html", null, true))) : (print ("")));
((array_key_exists("directorID", $context)) ? (print (twig_escape_filter($this->env, (", " . (isset($context["directorID"]) || array_key_exists("directorID", $context) ? $context["directorID"] : (function () { throw new RuntimeError('Variable "directorID" does not exist.', 24, $this->source); })())), "html", null, true))) : (print ("")));
echo ")\" id=\"newCommentsButtons\">Ещё отзывы</div>
";
// line 25
if ((( !(isset($context["isLiveComments"]) || array_key_exists("isLiveComments", $context) ? $context["isLiveComments"] : (function () { throw new RuntimeError('Variable "isLiveComments" does not exist.', 25, $this->source); })()) && !$this->extensions['Symfony\Bridge\Twig\Extension\SecurityExtension']->isGranted(twig_constant("Slivki\\Entity\\UserGroup::COMMENTS_BANNED_ROLE_NAME"))) && (0 !== twig_compare(twig_get_attribute($this->env, $this->source, (isset($context["lastComment"]) || array_key_exists("lastComment", $context) ? $context["lastComment"] : (function () { throw new RuntimeError('Variable "lastComment" does not exist.', 25, $this->source); })()), "getTypeID", [], "method", false, false, false, 25), twig_constant("Slivki\\Entity\\Comment::TYPE_MALL_BRAND_COMMENT"))))) {
// line 26
echo " <div id=\"bottomAddVoteLink\" class=\"addVoteLink button\">Добавить отзыв</div>
";
}
// line 28
echo " </div>
";
}
// line 30
echo "
";
$__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->leave($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof);
$__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
}
// line 31
public function macro_recursiveComment($__comment__ = null, $__isLiveComments__ = null, $__level__ = null, ...$__varargs__)
{
$macros = $this->macros;
$context = $this->env->mergeGlobals([
"comment" => $__comment__,
"isLiveComments" => $__isLiveComments__,
"level" => $__level__,
"varargs" => $__varargs__,
]);
$blocks = [];
ob_start();
try {
$__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
$__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->enter($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "macro", "recursiveComment"));
$__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "macro", "recursiveComment"));
// line 32
echo " ";
$this->loadTemplate("Slivki/comments/comments_item.html.twig", "Slivki/comments/comments.html.twig", 32)->display($context);
// line 33
echo " ";
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable(twig_array_filter($this->env, twig_get_attribute($this->env, $this->source, (isset($context["comment"]) || array_key_exists("comment", $context) ? $context["comment"] : (function () { throw new RuntimeError('Variable "comment" does not exist.', 33, $this->source); })()), "getChildren", [], "method", false, false, false, 33), function ($__child__) use ($context, $macros) { $context["child"] = $__child__; return ( !twig_get_attribute($this->env, $this->source, $context["child"], "isHidden", [], "method", false, false, false, 33) && twig_get_attribute($this->env, $this->source, $context["child"], "isConfirmedPhone", [], "method", false, false, false, 33)); }));
foreach ($context['_seq'] as $context["_key"] => $context["child"]) {
// line 34
echo " ";
echo (((0 === twig_compare((isset($context["level"]) || array_key_exists("level", $context) ? $context["level"] : (function () { throw new RuntimeError('Variable "level" does not exist.', 34, $this->source); })()), 1))) ? ("<ul>") : (""));
echo "
";
// line 35
echo twig_call_macro($macros["_self"], "macro_recursiveComment", [$context["child"], (isset($context["isLiveComments"]) || array_key_exists("isLiveComments", $context) ? $context["isLiveComments"] : (function () { throw new RuntimeError('Variable "isLiveComments" does not exist.', 35, $this->source); })()), ((isset($context["level"]) || array_key_exists("level", $context) ? $context["level"] : (function () { throw new RuntimeError('Variable "level" does not exist.', 35, $this->source); })()) + 1)], 35, $context, $this->getSourceContext());
echo "
";
// line 36
echo (((0 === twig_compare((isset($context["level"]) || array_key_exists("level", $context) ? $context["level"] : (function () { throw new RuntimeError('Variable "level" does not exist.', 36, $this->source); })()), 1))) ? ("</ul>") : (""));
echo "
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['child'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
$__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
$__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->leave($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof);
return ('' === $tmp = ob_get_contents()) ? '' : new Markup($tmp, $this->env->getCharset());
} finally {
ob_end_clean();
}
}
public function getTemplateName()
{
return "Slivki/comments/comments.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 202 => 36, 198 => 35, 193 => 34, 188 => 33, 185 => 32, 164 => 31, 153 => 30, 149 => 28, 145 => 26, 143 => 25, 132 => 24, 129 => 23, 126 => 22, 123 => 21, 120 => 20, 117 => 19, 115 => 18, 112 => 17, 110 => 16, 104 => 14, 102 => 13, 87 => 11, 81 => 9, 79 => 8, 74 => 7, 71 => 6, 68 => 5, 65 => 4, 48 => 3, 46 => 2, 44 => 1,);
}
public function getSourceContext()
{
return new Source("{% set isLiveComments = isLiveComments is defined %}
{% set showBanners = showBanners is defined and not isLiveComments %}
{% for comment in comments %}
{% if isLiveComments %}
{% include 'Slivki/comments/comments_item.html.twig' %}
{% else %}
{{ _self.recursiveComment(comment, isLiveComments, 1) }}
{% if showBanners %}
<span id=\"commentBannerPlaceHolder{{ loop.index }}\" class=\"hidden\"></span>
{% endif %}
{% endif %}
{% endfor %}
{% if pagination is defined and pagination %}
{{ pagination|raw }}
{% endif %}
{% if hasMore and comments|length > 0 %}
<div id=\"afterCommentsBlock\">
{% set lastEntityID = 0 %}
{% set lastComment = comments|last %}
{% if not isLiveComments %}
{% set lastEntityID = comments|last.getEntityID() %}
{% set lastComment = comments|last %}
{% endif %}
<div class=\"button--white\" onclick=\"loadComments({{ lastEntityID }}, {{ lastComment.getID() }}, {{ lastComment.getTypeID() }}{{ categoryID is defined ? ', ' ~ categoryID }}{{ directorID is defined ? ', ' ~ directorID }})\" id=\"newCommentsButtons\">Ещё отзывы</div>
{% if not isLiveComments and not is_granted(constant('Slivki\\\\Entity\\\\UserGroup::COMMENTS_BANNED_ROLE_NAME')) and lastComment.getTypeID() != constant('Slivki\\\\Entity\\\\Comment::TYPE_MALL_BRAND_COMMENT') %}
<div id=\"bottomAddVoteLink\" class=\"addVoteLink button\">Добавить отзыв</div>
{% endif %}
</div>
{% endif %}
{% macro recursiveComment(comment, isLiveComments, level) %}
{% include 'Slivki/comments/comments_item.html.twig' %}
{% for child in comment.getChildren()|filter(child => not child.isHidden() and child.isConfirmedPhone()) %}
{{ level == 1 ? '<ul>' }}
{{ _self.recursiveComment(child, isLiveComments, level + 1) }}
{{ level == 1 ? '</ul>' }}
{% endfor %}
{% endmacro %}
", "Slivki/comments/comments.html.twig", "/mnt/data/virtwww/slivki/templates/Slivki/comments/comments.html.twig");
}
}