app/template/default/Block/favorite_videos.twig line 1

Open in your IDE?
  1. <div class="home__favorite">
  2.   <div class="home__favorite-inner">
  3.     {% if is_granted('ROLE_USER') %}
  4.     {#{% if app.user is not empty and app.user.CustomerFavoriteProducts is not empty and app.user.CustomerFavoriteProducts|length > 0 %}#}
  5.         <h2>
  6.           見たい授業<span>見たい授業に登録した授業動画一覧</span>
  7.         </h2>
  8.         <ul class="home__favorite-list">
  9.           {% set FavoriteProductMaxCnt = FavoriteProductMaxCnt ?? 6 %}
  10.           {% set displayedCnt = 0 %}
  11.           {% for FavoriteProduct in app.user.CustomerFavoriteProducts %}
  12.             {% set Product = FavoriteProduct.Product %}
  13.             {% set productClass = Product.ProductClasses.get(0) %}
  14.             {% set videoContent = productClass.ProductClassContent.get(0) %}
  15.             {% if videoContent is not empty %}
  16.               {% set anker = url('video/{product_id}/content/{content_id}', {'product_id': Product.id, 'content_id': videoContent.Content.id}) %}
  17.             {% else %}
  18.               {% set anker = url('product_detail', {id: Product.id}) %}
  19.             {% endif %}
  20.         
  21.             {% set isFavorite = repository('Eccube\\Entity\\CustomerFavoriteProduct').isFavorite(app.user, Product) %}
  22.             {% set ProductWords = Product.search_word|split(',') %}
  23.             {% if displayedCnt < FavoriteProductMaxCnt %}
  24.               {% set displayedCnt = displayedCnt + 1 %}
  25.               <li class="home__favorite-item">
  26.                 <div class="home__favorite-item-inner">
  27.                   <div class="home__favorite-img-wrapper">
  28.                     <a href="{{ anker }}">
  29.                       {% if Product.ProductImage is defined and Product.ProductImage is not empty %}
  30.                         <img src="{{ asset(Product.ProductImage.get(0), 'save_image') }}" alt="{{ Product.name|trans }}" />
  31.                       {% else %}
  32.                         <img src="{{ asset(''|no_image_product, 'save_image') }}" alt="" />
  33.                       {% endif %}
  34.                     </a>
  35.                   </div>
  36.                   <div class="home__favorite-text-wrapper">
  37.                     <a href="{{ anker }}" class="home__favorite-title">{{ Product.name|trans }}</a>
  38.                     <ul class="home__favorite-keyword-list">
  39.                       {% for word in ProductWords %}
  40.                         {% if word is not empty %}
  41.                         <li class="mod_movie-keyword-item">
  42.                           <span>{{ word|trans }}</span>
  43.                         </li>
  44.                         {% endif %}
  45.                       {% endfor %}
  46.                     </ul>
  47.                     <div class="home__favorite-btn-wrapper">
  48.                       <div class="mod_movie-btn-favorite {{ (isFavorite == 1) ? 'favorite__del': 'favorite__add' }}" data-pid="{{ Product.id }}">
  49.                         {#{% if isFavorite %}#}
  50.                         {#<form action="{{ url('refine_delete_favorite', {id: Product.id}) }}" method="post">#}
  51.                         {#  <input type="submit" value="{{ '見たい授業'|trans }}" />#}
  52.                         {#</form>#}
  53.                         {#{% else %}#}
  54.                         {#<form action="{{ url('product_add_favorite', {id: Product.id}) }}" method="post">#}
  55.                         {#  <input type="submit" value="{{ '見たい授業'|trans }}" />#}
  56.                         {#</form>#}
  57.                         {#{% endif %}#}
  58.                         <input type="button" class="favorite-btn" value="{{ '見たい授業'|trans }}" />
  59.         
  60.                       </div>
  61.                       <a href="{{ anker }}" class="home__favorite-btn-watch"><span>{{ '見る'|trans }}</span></a>
  62.                     </div>
  63.                   </div>
  64.                 </div>
  65.               </li>
  66.             {% endif %}
  67.           {% endfor %}
  68.         </ul>
  69.         <div class="home__favorite-btn-more">
  70.           <a href="{{ url('product_list') }}">{{ '動画をもっと見る'|trans }}</a>
  71.         </div>
  72.     {% else %}
  73.         <a href="{{ url('user_data', {'route':'about'}) }}">
  74.             <img src="{{ asset('assets/images/common/favorite_blank_bannar.jpg', 'user_data') }}" alt="50代から始める認知症予防 健康まぁじゃんTVとは" />
  75.         </a>
  76.     {% endif %}
  77.   </div>
  78. </div>