var/cache/dev/twig/d5/d5218639809cc40cc0307fba109673eddc14acace35ba139b60c55c85cdafeba.php line 186

Open in your IDE?
  1. <?php
  2. use Twig\Environment;
  3. use Twig\Error\LoaderError;
  4. use Twig\Error\RuntimeError;
  5. use Twig\Extension\SandboxExtension;
  6. use Twig\Markup;
  7. use Twig\Sandbox\SecurityError;
  8. use Twig\Sandbox\SecurityNotAllowedTagError;
  9. use Twig\Sandbox\SecurityNotAllowedFilterError;
  10. use Twig\Sandbox\SecurityNotAllowedFunctionError;
  11. use Twig\Source;
  12. use Twig\Template;
  13. /* Slivki/comments/comments.html.twig */
  14. class __TwigTemplate_49723ca76ef304c5f1de78cf08dd045ed81454797f328b653c07f95aa27b0a2e extends Template
  15. {
  16.     private $source;
  17.     private $macros = [];
  18.     public function __construct(Environment $env)
  19.     {
  20.         parent::__construct($env);
  21.         $this->source $this->getSourceContext();
  22.         $this->parent false;
  23.         $this->blocks = [
  24.         ];
  25.         $macros["_self"] = $this->macros["_self"] = $this;
  26.     }
  27.     protected function doDisplay(array $context, array $blocks = [])
  28.     {
  29.         $macros $this->macros;
  30.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  31.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->enter($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template""Slivki/comments/comments.html.twig"));
  32.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  33.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template""Slivki/comments/comments.html.twig"));
  34.         // line 1
  35.         $context["isLiveComments"] = array_key_exists("isLiveComments"$context);
  36.         // line 2
  37.         $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); })()));
  38.         // line 3
  39.         $context['_parent'] = $context;
  40.         $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); })()));
  41.         $context['loop'] = [
  42.           'parent' => $context['_parent'],
  43.           'index0' => 0,
  44.           'index'  => 1,
  45.           'first'  => true,
  46.         ];
  47.         if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof \Countable)) {
  48.             $length count($context['_seq']);
  49.             $context['loop']['revindex0'] = $length 1;
  50.             $context['loop']['revindex'] = $length;
  51.             $context['loop']['length'] = $length;
  52.             $context['loop']['last'] = === $length;
  53.         }
  54.         foreach ($context['_seq'] as $context["_key"] => $context["comment"]) {
  55.             // line 4
  56.             echo "    ";
  57.             if ((isset($context["isLiveComments"]) || array_key_exists("isLiveComments"$context) ? $context["isLiveComments"] : (function () { throw new RuntimeError('Variable "isLiveComments" does not exist.'4$this->source); })())) {
  58.                 // line 5
  59.                 echo "        ";
  60.                 $this->loadTemplate("Slivki/comments/comments_item.html.twig""Slivki/comments/comments.html.twig"5)->display($context);
  61.                 // line 6
  62.                 echo "    ";
  63.             } else {
  64.                 // line 7
  65.                 echo "        ";
  66.                 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());
  67.                 echo "
  68.         ";
  69.                 // line 8
  70.                 if ((isset($context["showBanners"]) || array_key_exists("showBanners"$context) ? $context["showBanners"] : (function () { throw new RuntimeError('Variable "showBanners" does not exist.'8$this->source); })())) {
  71.                     // line 9
  72.                     echo "            <span id=\"commentBannerPlaceHolder";
  73.                     echo twig_escape_filter($this->envtwig_get_attribute($this->env$this->source$context["loop"], "index", [], "any"falsefalsefalse9), "html"nulltrue);
  74.                     echo "\" class=\"hidden\"></span>
  75.         ";
  76.                 }
  77.                 // line 11
  78.                 echo "    ";
  79.             }
  80.             ++$context['loop']['index0'];
  81.             ++$context['loop']['index'];
  82.             $context['loop']['first'] = false;
  83.             if (isset($context['loop']['length'])) {
  84.                 --$context['loop']['revindex0'];
  85.                 --$context['loop']['revindex'];
  86.                 $context['loop']['last'] = === $context['loop']['revindex0'];
  87.             }
  88.         }
  89.         $_parent $context['_parent'];
  90.         unset($context['_seq'], $context['_iterated'], $context['_key'], $context['comment'], $context['_parent'], $context['loop']);
  91.         $context array_intersect_key($context$_parent) + $_parent;
  92.         // line 13
  93.         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); })()))) {
  94.             // line 14
  95.             echo "    ";
  96.             echo (isset($context["pagination"]) || array_key_exists("pagination"$context) ? $context["pagination"] : (function () { throw new RuntimeError('Variable "pagination" does not exist.'14$this->source); })());
  97.             echo "
  98. ";
  99.         }
  100.         // line 16
  101.         if (((isset($context["hasMore"]) || array_key_exists("hasMore"$context) ? $context["hasMore"] : (function () { throw new RuntimeError('Variable "hasMore" does not exist.'16$this->source); })()) && (=== 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)))) {
  102.             // line 17
  103.             echo "    <div id=\"afterCommentsBlock\">
  104.         ";
  105.             // line 18
  106.             $context["lastEntityID"] = 0;
  107.             // line 19
  108.             echo "        ";
  109.             $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); })()));
  110.             // line 20
  111.             echo "        ";
  112.             if ( !(isset($context["isLiveComments"]) || array_key_exists("isLiveComments"$context) ? $context["isLiveComments"] : (function () { throw new RuntimeError('Variable "isLiveComments" does not exist.'20$this->source); })())) {
  113.                 // line 21
  114.                 echo "            ";
  115.                 $context["lastEntityID"] = twig_get_attribute($this->env$this->sourcetwig_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"falsefalsefalse21);
  116.                 // line 22
  117.                 echo "            ";
  118.                 $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); })()));
  119.                 // line 23
  120.                 echo "        ";
  121.             }
  122.             // line 24
  123.             echo "        <div class=\"button--white\" onclick=\"loadComments(";
  124.             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"nulltrue);
  125.             echo ", ";
  126.             echo twig_escape_filter($this->envtwig_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"falsefalsefalse24), "html"nulltrue);
  127.             echo ", ";
  128.             echo twig_escape_filter($this->envtwig_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"falsefalsefalse24), "html"nulltrue);
  129.             ((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"nulltrue))) : (print ("")));
  130.             ((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"nulltrue))) : (print ("")));
  131.             echo ")\" id=\"newCommentsButtons\">Ещё отзывы</div>
  132.         ";
  133.             // line 25
  134.             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"))) && (!== 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"falsefalsefalse25), twig_constant("Slivki\\Entity\\Comment::TYPE_MALL_BRAND_COMMENT"))))) {
  135.                 // line 26
  136.                 echo "            <div id=\"bottomAddVoteLink\" class=\"addVoteLink button\">Добавить отзыв</div>
  137.         ";
  138.             }
  139.             // line 28
  140.             echo "    </div>
  141. ";
  142.         }
  143.         // line 30
  144.         echo "
  145. ";
  146.         
  147.         $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->leave($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof);
  148.         
  149.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
  150.     }
  151.     // line 31
  152.     public function macro_recursiveComment($__comment__ null$__isLiveComments__ null$__level__ null, ...$__varargs__)
  153.     {
  154.         $macros $this->macros;
  155.         $context $this->env->mergeGlobals([
  156.             "comment" => $__comment__,
  157.             "isLiveComments" => $__isLiveComments__,
  158.             "level" => $__level__,
  159.             "varargs" => $__varargs__,
  160.         ]);
  161.         $blocks = [];
  162.         ob_start();
  163.         try {
  164.             $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  165.             $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->enter($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "macro""recursiveComment"));
  166.             $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  167.             $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "macro""recursiveComment"));
  168.             // line 32
  169.             echo "    ";
  170.             $this->loadTemplate("Slivki/comments/comments_item.html.twig""Slivki/comments/comments.html.twig"32)->display($context);
  171.             // line 33
  172.             echo "    ";
  173.             $context['_parent'] = $context;
  174.             $context['_seq'] = twig_ensure_traversable(twig_array_filter($this->envtwig_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"falsefalsefalse33), function ($__child__) use ($context$macros) { $context["child"] = $__child__; return ( !twig_get_attribute($this->env$this->source$context["child"], "isHidden", [], "method"falsefalsefalse33) && twig_get_attribute($this->env$this->source$context["child"], "isConfirmedPhone", [], "method"falsefalsefalse33)); }));
  175.             foreach ($context['_seq'] as $context["_key"] => $context["child"]) {
  176.                 // line 34
  177.                 echo "        ";
  178.                 echo (((=== 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>") : (""));
  179.                 echo "
  180.         ";
  181.                 // line 35
  182.                 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());
  183.                 echo "
  184.         ";
  185.                 // line 36
  186.                 echo (((=== 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>") : (""));
  187.                 echo "
  188.     ";
  189.             }
  190.             $_parent $context['_parent'];
  191.             unset($context['_seq'], $context['_iterated'], $context['_key'], $context['child'], $context['_parent'], $context['loop']);
  192.             $context array_intersect_key($context$_parent) + $_parent;
  193.             
  194.             $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
  195.             
  196.             $__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e->leave($__internal_085b0142806202599c7fe3b329164a92397d8978207a37e79d70b8c52599e33e_prof);
  197.             return ('' === $tmp ob_get_contents()) ? '' : new Markup($tmp$this->env->getCharset());
  198.         } finally {
  199.             ob_end_clean();
  200.         }
  201.     }
  202.     public function getTemplateName()
  203.     {
  204.         return "Slivki/comments/comments.html.twig";
  205.     }
  206.     public function isTraitable()
  207.     {
  208.         return false;
  209.     }
  210.     public function getDebugInfo()
  211.     {
  212.         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,);
  213.     }
  214.     public function getSourceContext()
  215.     {
  216.         return new Source("{% set isLiveComments = isLiveComments is defined  %}
  217. {% set showBanners = showBanners is defined and not isLiveComments %}
  218. {% for comment in comments %}
  219.     {% if isLiveComments %}
  220.         {% include 'Slivki/comments/comments_item.html.twig' %}
  221.     {% else %}
  222.         {{ _self.recursiveComment(comment, isLiveComments, 1) }}
  223.         {% if showBanners %}
  224.             <span id=\"commentBannerPlaceHolder{{ loop.index }}\" class=\"hidden\"></span>
  225.         {% endif %}
  226.     {% endif %}
  227. {% endfor %}
  228. {% if pagination is defined and pagination %}
  229.     {{ pagination|raw }}
  230. {% endif %}
  231. {% if hasMore and comments|length > 0 %}
  232.     <div id=\"afterCommentsBlock\">
  233.         {% set lastEntityID = 0 %}
  234.         {% set lastComment = comments|last %}
  235.         {% if not isLiveComments %}
  236.             {% set lastEntityID = comments|last.getEntityID() %}
  237.             {% set lastComment = comments|last %}
  238.         {% endif %}
  239.         <div class=\"button--white\" onclick=\"loadComments({{ lastEntityID }}, {{ lastComment.getID() }}, {{ lastComment.getTypeID() }}{{ categoryID is defined ? ', ' ~ categoryID }}{{ directorID is defined ? ', ' ~ directorID }})\" id=\"newCommentsButtons\">Ещё отзывы</div>
  240.         {% 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') %}
  241.             <div id=\"bottomAddVoteLink\" class=\"addVoteLink button\">Добавить отзыв</div>
  242.         {% endif %}
  243.     </div>
  244. {% endif %}
  245. {% macro recursiveComment(comment, isLiveComments, level) %}
  246.     {% include 'Slivki/comments/comments_item.html.twig' %}
  247.     {% for child in comment.getChildren()|filter(child => not child.isHidden() and child.isConfirmedPhone()) %}
  248.         {{ level == 1 ? '<ul>' }}
  249.         {{ _self.recursiveComment(child, isLiveComments, level + 1) }}
  250.         {{ level == 1 ? '</ul>' }}
  251.     {% endfor %}
  252. {% endmacro %}
  253. ""Slivki/comments/comments.html.twig""/mnt/data/virtwww/slivki/templates/Slivki/comments/comments.html.twig");
  254.     }
  255. }