<?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;
/* @CustomerReview42/Block/customer_review4_product_detail_review.twig */
class __TwigTemplate_77f77563214bd9df3a065888b1d86ee1 extends \Eccube\Twig\Template
{
private $source;
private $macros = [];
public function __construct(Environment $env)
{
parent::__construct($env);
$this->source = $this->getSourceContext();
$this->parent = false;
$this->blocks = [
];
$this->sandbox = $this->env->getExtension('\Twig\Extension\SandboxExtension');
$this->checkSecurity();
}
protected function doDisplay(array $context, array $blocks = [])
{
$macros = $this->macros;
$__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
$__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "@CustomerReview42/Block/customer_review4_product_detail_review.twig"));
$__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "@CustomerReview42/Block/customer_review4_product_detail_review.twig"));
// line 1
$macros["stars"] = $this->macros["stars"] = $this;
// line 2
echo "
";
// line 3
$context["star_size"] = 22;
// line 4
echo "
<script>
// レビュー折りたたみサイズ(px)
var foldSize = 95;
\$(document).ready(function(){
\t//総合スコアを上部へも表示
\tvar rs = \$('#product_review_area .review_score').clone();
\trs.find('.review_all_score_title').remove();
\trs.append('<span>のレビュー</span>');
\tif(\$('.product-detail-nav-section').length){
\t\t//特殊ページ
\t\t\$('.top_review_score').append(rs);
\t}else{
\t\t//デフォルトページ
\t\t\$('.top_review_score').append(rs);
\t}
\t// レビューエリアの移動
\tvar target = \$('#product_review_area');
\t\$('body').append(target);
\ttarget.ready(function() {
\t\t\$('#product_review_area').appendTo('#review_area');
\t});
\t// レビュー折りたたみ
\t\$('.review_list li .review-body').each(function(i, e){
\t\tif(foldSize < \$(e).innerHeight()){
\t\t\t\$(e).data('height', \$(e).outerHeight());
\t\t\t\$(e).innerHeight(foldSize);
\t\t\t\$(e).css('overflow', 'hidden');
\t\t\t\$(e).addClass('fold');
\t\t\t\$(e).after('<div class=\"fade\"></div>');
\t\t\t\$(e).after('<div class=\"moreread\"><a href=\"javascript:;\">⇩ 続きを読む</a></div>');
\t\t}
\t});
\t
\t\$(document).on('click', '.review_list li .moreread', function(){
\t\tvar rb = \$(this).parent().find('.review-body');
\t\trb.animate({'height': rb.data('height')}, function(){rb.css('height', 'auto')});
\t\trb.removeClass('fold');
\t\t\$(this).after('<div class=\"shortread\"><a href=\"javascript:;\">⇧ もっと少なく読む</a></div>');
\t\t\$(this).parent().find('.fade').remove();
\t\t\$(this).remove();
\t});
\t\$(document).on('click', '.review_list li .shortread', function(){
\t\tvar rb = \$(this).parent().find('.review-body');
\t\trb.animate({'height': foldSize});
\t\trb.addClass('fold');
\t\trb.after('<div class=\"fade\"></div>');
\t\t\$(this).after('<div class=\"moreread\"><a href=\"javascript:;\">⇩ 続きを読む</a></div>');
\t\t\$(this).remove();
\t});
});
</script>
";
// line 68
$context["review_config"] = twig_get_attribute($this->env, $this->source, $this->env->getFunction('repository')->getCallable()("Plugin\\CustomerReview42\\Entity\\CustomerReviewConfig"), "get", [], "method", false, false, true, 68);
// line 69
if (twig_get_attribute($this->env, $this->source, (isset($context["review_config"]) || array_key_exists("review_config", $context) ? $context["review_config"] : (function () { throw new RuntimeError('Variable "review_config" does not exist.', 69, $this->source); })()), "isDetailInReview", [], "any", false, false, true, 69)) {
// line 70
$context["review_list"] = twig_get_attribute($this->env, $this->source, $this->env->getFunction('repository')->getCallable()("Plugin\\CustomerReview42\\Entity\\CustomerReviewList"), "getReviewList", [0 => twig_get_attribute($this->env, $this->source, (isset($context["Product"]) || array_key_exists("Product", $context) ? $context["Product"] : (function () { throw new RuntimeError('Variable "Product" does not exist.', 70, $this->source); })()), "id", [], "any", false, false, true, 70)], "method", false, false, true, 70);
// line 71
$context["review_total"] = twig_get_attribute($this->env, $this->source, $this->env->getFunction('repository')->getCallable()("Plugin\\CustomerReview42\\Entity\\CustomerReviewTotal"), "getRecommend", [0 => twig_get_attribute($this->env, $this->source, (isset($context["Product"]) || array_key_exists("Product", $context) ? $context["Product"] : (function () { throw new RuntimeError('Variable "Product" does not exist.', 71, $this->source); })()), "id", [], "any", false, false, true, 71)], "method", false, false, true, 71);
// line 72
echo "
";
// line 73
$context["reviewer_total"] = 0;
// line 74
$context["review_total_point"] = 0;
// line 75
$context["count"] = 5;
// line 76
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable((isset($context["review_total"]) || array_key_exists("review_total", $context) ? $context["review_total"] : (function () { throw new RuntimeError('Variable "review_total" does not exist.', 76, $this->source); })()));
foreach ($context['_seq'] as $context["_key"] => $context["i"]) {
// line 77
echo " ";
$context["reviewer_total"] = ((isset($context["reviewer_total"]) || array_key_exists("reviewer_total", $context) ? $context["reviewer_total"] : (function () { throw new RuntimeError('Variable "reviewer_total" does not exist.', 77, $this->source); })()) + $context["i"]);
// line 78
echo " ";
$context["review_total_point"] = ((isset($context["review_total_point"]) || array_key_exists("review_total_point", $context) ? $context["review_total_point"] : (function () { throw new RuntimeError('Variable "review_total_point" does not exist.', 78, $this->source); })()) + ($context["i"] * (isset($context["count"]) || array_key_exists("count", $context) ? $context["count"] : (function () { throw new RuntimeError('Variable "count" does not exist.', 78, $this->source); })())));
// line 79
echo " ";
$context["count"] = ((isset($context["count"]) || array_key_exists("count", $context) ? $context["count"] : (function () { throw new RuntimeError('Variable "count" does not exist.', 79, $this->source); })()) - 1);
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['i'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 81
$context["review_point"] = ((((isset($context["reviewer_total"]) || array_key_exists("reviewer_total", $context) ? $context["reviewer_total"] : (function () { throw new RuntimeError('Variable "reviewer_total" does not exist.', 81, $this->source); })()) == 0)) ? (0) : (((isset($context["review_total_point"]) || array_key_exists("review_total_point", $context) ? $context["review_total_point"] : (function () { throw new RuntimeError('Variable "review_total_point" does not exist.', 81, $this->source); })()) / (isset($context["reviewer_total"]) || array_key_exists("reviewer_total", $context) ? $context["reviewer_total"] : (function () { throw new RuntimeError('Variable "reviewer_total" does not exist.', 81, $this->source); })()))));
// line 82
$context["number"] = (isset($context["reviewer_total"]) || array_key_exists("reviewer_total", $context) ? $context["reviewer_total"] : (function () { throw new RuntimeError('Variable "reviewer_total" does not exist.', 82, $this->source); })());
// line 83
$context["avg_star"] = (isset($context["review_point"]) || array_key_exists("review_point", $context) ? $context["review_point"] : (function () { throw new RuntimeError('Variable "review_point" does not exist.', 83, $this->source); })());
// line 84
echo "
<!--▼レビューエリア-->
<div id=\"product_review_area\" class=\"review_area\">
\t<h2>ユーザーレビュー</h2>
\t";
// line 88
if ((0 < twig_length_filter($this->env, (isset($context["review_list"]) || array_key_exists("review_list", $context) ? $context["review_list"] : (function () { throw new RuntimeError('Variable "review_list" does not exist.', 88, $this->source); })())))) {
// line 89
echo "\t\t<a href=\"";
echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getUrl("review_list", ["id" => twig_get_attribute($this->env, $this->source, (isset($context["Product"]) || array_key_exists("Product", $context) ? $context["Product"] : (function () { throw new RuntimeError('Variable "Product" does not exist.', 89, $this->source); })()), "id", [], "any", false, false, true, 89)]), "html", null, true);
echo "\">
\t \t<h3 class=\"review_score\" data-avg=\"";
// line 90
echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed((isset($context["avg_star"]) || array_key_exists("avg_star", $context) ? $context["avg_star"] : (function () { throw new RuntimeError('Variable "avg_star" does not exist.', 90, $this->source); })()), 90, $this->source), "html", null, true);
echo "\" data-num=\"";
echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed((isset($context["number"]) || array_key_exists("number", $context) ? $context["number"] : (function () { throw new RuntimeError('Variable "number" does not exist.', 90, $this->source); })()), 90, $this->source), "html", null, true);
echo "\" data-starsize=\"";
echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed((isset($context["star_size"]) || array_key_exists("star_size", $context) ? $context["star_size"] : (function () { throw new RuntimeError('Variable "star_size" does not exist.', 90, $this->source); })()), 90, $this->source), "html", null, true);
echo "\" data-imgbase=\"";
echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("aneros/img/products/"), "html", null, true);
echo "\">
\t \t\t<span class=\"review_all_score_title\">総合スコア:</span>
\t \t\t<span class=\"review_all_score_image\" style=\"display: inline-block\"></span>
\t \t\t<span class=\"review_all_score\"></span>
\t \t</h3>
\t\t\t<p style=\"text-align:center; font-weight:bold; text-decoration:underline;\">詳細を表示する</p>
\t\t</a>
<ul class=\"review_list\">
";
// line 98
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable((isset($context["review_list"]) || array_key_exists("review_list", $context) ? $context["review_list"] : (function () { throw new RuntimeError('Variable "review_list" does not exist.', 98, $this->source); })()));
foreach ($context['_seq'] as $context["_key"] => $context["Review"]) {
// line 99
echo " <li>
<h3 class=\"review-title\">";
// line 100
echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, $context["Review"], "title", [], "any", false, false, true, 100), 100, $this->source), "html", null, true);
echo "</h3>
<p class=\"review-hed\">
<span style=\"font-weight:bold;\">
\t <span>";
// line 103
echo twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, $context["Review"], "reviewer_name", [], "any", false, false, true, 103), 103, $this->source), "html", null, true);
echo "</span>
</span><br />
<span>
";
// line 106
echo twig_escape_filter($this->env, $this->extensions['Eccube\Twig\Extension\EccubeExtension']->getDateFormatFilter($this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, $context["Review"], "create_date", [], "any", false, false, true, 106), 106, $this->source)), "html", null, true);
echo "
</span><br />
<span class=\"recommend_level\">
<span>
";
// line 110
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable(range(0, 4));
foreach ($context['_seq'] as $context["_key"] => $context["i"]) {
// line 111
echo "\t ";
if (($context["i"] < twig_get_attribute($this->env, $this->source, $context["Review"], "recommend_level", [], "any", false, false, true, 111))) {
// line 112
echo "\t\t\t\t\t\t\t\t<img src=\"";
echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("aneros/img/products/star.jpg"), "html", null, true);
echo "\" class=\"recommend_star\" alt=\"星あり\">
\t ";
} else {
// line 114
echo "\t\t\t\t\t\t\t\t<img src=\"";
echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("aneros/img/products/no_star.jpg"), "html", null, true);
echo "\" class=\"recommend_nostar\" alt=\"星なし\">
\t\t\t\t\t\t\t";
}
// line 116
echo " ";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['i'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 117
echo " </span>
</span>
</p>
<p class=\"review-body\">";
// line 120
echo twig_nl2br(twig_escape_filter($this->env, $this->sandbox->ensureToStringAllowed(twig_get_attribute($this->env, $this->source, $context["Review"], "comment", [], "any", false, false, true, 120), 120, $this->source), "html", null, true));
echo "</p>
</li>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['Review'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 123
echo " </ul>
";
} else {
// line 125
echo " <ul class=\"review_list\">
<li>
\t\tただいま、レビューはありません。「レビューを書く」ボタンからレビューを書きましょう!
</li>
</ul>
";
}
// line 131
echo "
\t<div class=\"btn_area\">
\t\t<a href=\"";
// line 133
echo twig_escape_filter($this->env, $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getUrl("review_post", ["id" => twig_get_attribute($this->env, $this->source, (isset($context["Product"]) || array_key_exists("Product", $context) ? $context["Product"] : (function () { throw new RuntimeError('Variable "Product" does not exist.', 133, $this->source); })()), "id", [], "any", false, false, true, 133)]), "html", null, true);
echo "\"
\t\t\tclass=\"button btn btn-success btn-block\">レビューを書く</a>
\t</div>
</div>
<!-- ▲レビューエリア -->
";
}
$__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
}
public function getTemplateName()
{
return "@CustomerReview42/Block/customer_review4_product_detail_review.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 269 => 133, 265 => 131, 257 => 125, 253 => 123, 244 => 120, 239 => 117, 233 => 116, 227 => 114, 221 => 112, 218 => 111, 214 => 110, 207 => 106, 201 => 103, 195 => 100, 192 => 99, 188 => 98, 171 => 90, 166 => 89, 164 => 88, 158 => 84, 156 => 83, 154 => 82, 152 => 81, 145 => 79, 142 => 78, 139 => 77, 135 => 76, 133 => 75, 131 => 74, 129 => 73, 126 => 72, 124 => 71, 122 => 70, 120 => 69, 118 => 68, 52 => 4, 50 => 3, 47 => 2, 45 => 1,);
}
public function getSourceContext()
{
return new Source("{% import _self as stars %}
{% set star_size = 22 %}
<script>
// レビュー折りたたみサイズ(px)
var foldSize = 95;
\$(document).ready(function(){
\t//総合スコアを上部へも表示
\tvar rs = \$('#product_review_area .review_score').clone();
\trs.find('.review_all_score_title').remove();
\trs.append('<span>のレビュー</span>');
\tif(\$('.product-detail-nav-section').length){
\t\t//特殊ページ
\t\t\$('.top_review_score').append(rs);
\t}else{
\t\t//デフォルトページ
\t\t\$('.top_review_score').append(rs);
\t}
\t// レビューエリアの移動
\tvar target = \$('#product_review_area');
\t\$('body').append(target);
\ttarget.ready(function() {
\t\t\$('#product_review_area').appendTo('#review_area');
\t});
\t// レビュー折りたたみ
\t\$('.review_list li .review-body').each(function(i, e){
\t\tif(foldSize < \$(e).innerHeight()){
\t\t\t\$(e).data('height', \$(e).outerHeight());
\t\t\t\$(e).innerHeight(foldSize);
\t\t\t\$(e).css('overflow', 'hidden');
\t\t\t\$(e).addClass('fold');
\t\t\t\$(e).after('<div class=\"fade\"></div>');
\t\t\t\$(e).after('<div class=\"moreread\"><a href=\"javascript:;\">⇩ 続きを読む</a></div>');
\t\t}
\t});
\t
\t\$(document).on('click', '.review_list li .moreread', function(){
\t\tvar rb = \$(this).parent().find('.review-body');
\t\trb.animate({'height': rb.data('height')}, function(){rb.css('height', 'auto')});
\t\trb.removeClass('fold');
\t\t\$(this).after('<div class=\"shortread\"><a href=\"javascript:;\">⇧ もっと少なく読む</a></div>');
\t\t\$(this).parent().find('.fade').remove();
\t\t\$(this).remove();
\t});
\t\$(document).on('click', '.review_list li .shortread', function(){
\t\tvar rb = \$(this).parent().find('.review-body');
\t\trb.animate({'height': foldSize});
\t\trb.addClass('fold');
\t\trb.after('<div class=\"fade\"></div>');
\t\t\$(this).after('<div class=\"moreread\"><a href=\"javascript:;\">⇩ 続きを読む</a></div>');
\t\t\$(this).remove();
\t});
});
</script>
{% set review_config = repository('Plugin\\\\CustomerReview42\\\\Entity\\\\CustomerReviewConfig').get() %}
{% if review_config.isDetailInReview %}
{% set review_list = repository('Plugin\\\\CustomerReview42\\\\Entity\\\\CustomerReviewList').getReviewList(Product.id) %}
{% set review_total = repository('Plugin\\\\CustomerReview42\\\\Entity\\\\CustomerReviewTotal').getRecommend(Product.id) %}
{% set reviewer_total = 0 %}
{% set review_total_point = 0 %}
{% set count = 5 %}
{% for i in review_total %}
{% set reviewer_total = reviewer_total + i %}
{% set review_total_point = review_total_point + i * count %}
{% set count = count - 1 %}
{% endfor %}
{% set review_point = reviewer_total == 0 ? 0 : (review_total_point / reviewer_total) %}
{% set number = reviewer_total %}
{% set avg_star = review_point %}
<!--▼レビューエリア-->
<div id=\"product_review_area\" class=\"review_area\">
\t<h2>ユーザーレビュー</h2>
\t{% if 0 < review_list|length %}
\t\t<a href=\"{{ url('review_list', {'id': Product.id}) }}\">
\t \t<h3 class=\"review_score\" data-avg=\"{{ avg_star }}\" data-num=\"{{ number }}\" data-starsize=\"{{ star_size }}\" data-imgbase=\"{{ asset('aneros/img/products/') }}\">
\t \t\t<span class=\"review_all_score_title\">総合スコア:</span>
\t \t\t<span class=\"review_all_score_image\" style=\"display: inline-block\"></span>
\t \t\t<span class=\"review_all_score\"></span>
\t \t</h3>
\t\t\t<p style=\"text-align:center; font-weight:bold; text-decoration:underline;\">詳細を表示する</p>
\t\t</a>
<ul class=\"review_list\">
{% for Review in review_list %}
<li>
<h3 class=\"review-title\">{{ Review.title }}</h3>
<p class=\"review-hed\">
<span style=\"font-weight:bold;\">
\t <span>{{ Review.reviewer_name }}</span>
</span><br />
<span>
{{ Review.create_date|date_format }}
</span><br />
<span class=\"recommend_level\">
<span>
{% for i in 0..4 %}
\t {% if i < Review.recommend_level %}
\t\t\t\t\t\t\t\t<img src=\"{{ asset('aneros/img/products/star.jpg') }}\" class=\"recommend_star\" alt=\"星あり\">
\t {% else %}
\t\t\t\t\t\t\t\t<img src=\"{{ asset('aneros/img/products/no_star.jpg') }}\" class=\"recommend_nostar\" alt=\"星なし\">
\t\t\t\t\t\t\t{% endif %}
{% endfor %}
</span>
</span>
</p>
<p class=\"review-body\">{{ Review.comment|nl2br }}</p>
</li>
{% endfor %}
</ul>
{% else %}
<ul class=\"review_list\">
<li>
\t\tただいま、レビューはありません。「レビューを書く」ボタンからレビューを書きましょう!
</li>
</ul>
{% endif %}
\t<div class=\"btn_area\">
\t\t<a href=\"{{ url('review_post', {'id': Product.id}) }}\"
\t\t\tclass=\"button btn btn-success btn-block\">レビューを書く</a>
\t</div>
</div>
<!-- ▲レビューエリア -->
{% endif %}
", "@CustomerReview42/Block/customer_review4_product_detail_review.twig", "/home/kir018258/public_html/test.aneros.co.jp/aneros_2023_b/app/template/plugin/CustomerReview42/Block/customer_review4_product_detail_review.twig");
}
public function checkSecurity()
{
static $tags = array("import" => 1, "set" => 3, "if" => 69, "for" => 76);
static $filters = array("length" => 88, "escape" => 89, "date_format" => 106, "nl2br" => 120);
static $functions = array("repository" => 68, "url" => 89, "asset" => 90, "range" => 110);
try {
$this->sandbox->checkSecurity(
['import', 'set', 'if', 'for'],
['length', 'escape', 'date_format', 'nl2br'],
['repository', 'url', 'asset', 'range']
);
} catch (SecurityError $e) {
$e->setSourceContext($this->source);
if ($e instanceof SecurityNotAllowedTagError && isset($tags[$e->getTagName()])) {
$e->setTemplateLine($tags[$e->getTagName()]);
} elseif ($e instanceof SecurityNotAllowedFilterError && isset($filters[$e->getFilterName()])) {
$e->setTemplateLine($filters[$e->getFilterName()]);
} elseif ($e instanceof SecurityNotAllowedFunctionError && isset($functions[$e->getFunctionName()])) {
$e->setTemplateLine($functions[$e->getFunctionName()]);
}
throw $e;
}
}
}