{% extends 'default_frame.twig' %}
{% block javascript %}{% endblock %}
{% block stylesheet %}
<style>
.pluginCMBblog .item_blog_image {
width: 100% !important;
height: 248px;
object-fit: cover;
}
.pluginCMBblog .figure__main_image{
margin: 0;
}
.pluginCMBblog .ec-topicpath .ec-topicpath__item{
display: initial !important;
}
.pluginCMBblog .list_blog_cat li {
display: initial !important;
letter-spacing: 0.2rem;
border-right: 1px solid #ddd;
font-size: 16px;
}
.pluginCMBblog .list_category_link{
padding: 0 0.5rem;
}
.pluginCMBblog .list_blog .list_category_link{
color: #337ab7;
padding: 0 0.5rem;
}
.pluginCMBblog .blog_category li:last-child{
border: none;
}
.pluginCMBblog .blog_category{
margin: 0;
padding: 0;
}
.pluginCMBblog .blog_category li{
display: initial;
border-right: 1px solid #ddd;
}
.pluginCMBblog .list_blog_cat li:last-child {
border-right: none;
}
.pluginCMBblog .blog_title_h3{
font-size: 16px !important;
line-height: 1.4;
margin-top: 10px;
word-break: break-word;
}
@media screen and (max-width: 768px){
.pluginCMBblog .item_blog_image {
width: 100% !important;
height: 40vw;
object-fit: cover;
}
}
.news_title.new{
position:relative;
}
.news_title.new::before{
content: "NEW";
background-color:#c60a1c;
padding:0.3em;
margin:0 0.5em 0 0;
border-radius:0.3em;
font-size:10px;
}
</style>
{% endblock %}
{% block main %}
{% set config = repository('Plugin\\CMBlogPro42\\Entity\\Config').get() %}
{% set blogs = repository('Plugin\\CMBlogPro42\\Entity\\Blog').getList(1) %}
{% set categoryLisst = repository('Plugin\\CMBlogPro42\\Entity\\Category').getFrontCategoryList() %}
<div id="page_user_data" class="ec-role pluginCMBblog">
<div class="ak-header">
<div class="ak-pageHeader">
<h1>NEWS</h1>
</div>
</div><!-- ak-header -->
<div class="ec-searchnavRole__topicpath" style="margin:0 0 2em 0;">
{# 20240805@hanari 出力順を任意にするために変更
<ol class="ec-topicpath list_blog_cat">
<li class="ec-topicpath__item">
<a href="{{ url('cm_blog_page_list') }}">{{ '全て'|trans }}</a>
</li>
{% for category in categories %}
<li class="{{category.class}}">
<a href="{{ url('cm_blog_page_list', {categories: [category.getId()]}) }}" class="list_category_link">
{{ category.getName|raw }}
</a>
</li>
{% endfor %}
</ol>
#}
<ol class="ec-topicpath list_blog_cat">
<li class="ec-topicpath__item">
<a href="{{ url('cm_blog_page_list') }}">{{ '一覧'|trans }}</a>
</li>
{% for i in [3,1,2,0] %}
<li class="{{categories[i].class}}">
<a href="{{ url('cm_blog_page_list', {categories: [categories[i].getId()]}) }}" class="list_category_link">
{{ categories[i].getName|raw }}
</a>
</li>
{% endfor %}
</ol>
</div>
<div>
{# dump(pagination) #}
{# dump(pagination.params == null) #}
{% if pagination.params == null or pagination.params["categories"][0] is not defined %}
{# 一覧表示 #}
{# dump(pagination.params["categories"][0]) #}
<ul class="news_category">
{# for category in categories #}
<li>
{#
<h2>
<a href="{{ url('cm_blog_page_list', {categories: [category.getId()]}) }}" class="list_category_link">
{{ category.getName|raw }}
</a>
</h2>
#}
<h2>一覧</h2>
<ul class="news_list">
{# dump(category.id) #}
{# set blogs = repository('Plugin\\CMBlogPro42\\Entity\\Blog').getListNews(category.id,is_granted('ROLE_USER')) #}
{% set blogs = repository('Plugin\\CMBlogPro42\\Entity\\Blog').getList() %}
{# dump(blogs) #}
{% for blog in pagination %}
{% set blogCategoryId = 0 %}
{# for blogCategory in blog.getBlogCategories #}
{# 同一のカテゴリー の 場合 表示 #}
{# if category.id == blogCategory.getCategory().getId() #}
<li>
<span class="news_release_date">{{ blog.release_date|date_day }}</span>
{% if blog.linkurl != null %}
{% if blog.release_date != null and blog.release_date|date('Y-m-d') > 'now'|date_modify('-1 month')|date('Y-m-d') %}
<a class="news_title new" href="{{ blog.linkurl }}" target="_blank">
{% else %}
<a class="news_title" href="{{ blog.linkurl }}" target="_blank">
{% endif %}
{# blog.getTitle|length > 45 ? blog.getTitle|striptags|replace({(' '):' '})|slice(0, 45)|raw ~ '...' : blog.getTitle|raw #}
{{ blog.getTitle|raw }}
</a>
{% else %}
{% if blog.release_date != null and blog.release_date|date('Y-m-d') > 'now'|date_modify('-1 month')|date('Y-m-d') %}
<a class="news_title new" href="{{ url('cm_blog_page_detail', {'id': blog.id}) }}">
{% else %}
<a class="news_title" href="{{ url('cm_blog_page_detail', {'id': blog.id}) }}">
{% endif %}
{# blog.getTitle|length > 45 ? blog.getTitle|striptags|replace({(' '):' '})|slice(0, 45)|raw ~ '...' : blog.getTitle|raw #}
{{ blog.getTitle|raw }}
</a>
{% endif %}
</li>
{# endif #}
{# endfor #}
{% endfor %}
{#
<li class="more">
<a href="{{ url('cm_blog_page_list', {categories: [category.getId()]}) }}" class="list_category_link">
過去の記事 >
</a>
</li>
#}
</ul>
</li>
<div class="ec-pagerRole">
{% include "pager.twig" with {'pages': pagination.paginationData, 'routes' : 'cm_blog_page_list'} %}
</div>
{# endfor #}
</ul>
{% else %}{# 一覧表示 #}
{# カテゴリー表示 #}
{# dump(pagination) #}
{# dump(pagination.params["categories"][0]) #}
{% set categoriesId = pagination.params["categories"][0] %}
<ul class="news_category">
{% for category in categories %}
{% if categoriesId == category.id %}
<li class="{{category.class}}">
<h2>
<a href="{{ url('cm_blog_page_list', {categories: [category.getId()]}) }}" class="list_category_link">
{{ category.getName|raw }}
</a>
</h2>
<ul class="news_list">
{% for blog in pagination %}
{% set blogCategoryId = 0 %}
{% for blogCategory in blog.getBlogCategories %}
{# 同一のカテゴリー の 場合 表示 #}
{% if category.id == blogCategory.getCategory().getId() %}
{% if is_granted('ROLE_USER') %}{# 会員限定 #}
<li>
<span class="news_release_date">{{ blog.release_date|date_day }}</span>
{% if blog.linkurl != null %}
{% if blog.release_date != null and blog.release_date|date('Y-m-d') > 'now'|date_modify('-1 month')|date('Y-m-d') %}
<a class="news_title new" href="{{ blog.linkurl }}" target="_blank">
{% else %}
<a class="news_title" href="{{ blog.linkurl }}" target="_blank">
{% endif %}
{# blog.getTitle|length > 45 ? blog.getTitle|striptags|replace({(' '):' '})|slice(0, 45)|raw ~ '...' : blog.getTitle|raw #}
{{ blog.getTitle|raw }}
</a>
{% else %}
{% if blog.release_date != null and blog.release_date|date('Y-m-d') > 'now'|date_modify('-1 month')|date('Y-m-d') %}
<a class="news_title new" href="{{ url('cm_blog_page_detail', {'id': blog.id}) }}">
{% else %}
<a class="news_title" href="{{ url('cm_blog_page_detail', {'id': blog.id}) }}">
{% endif %}
{# blog.getTitle|length > 45 ? blog.getTitle|striptags|replace({(' '):' '})|slice(0, 45)|raw ~ '...' : blog.getTitle|raw #}
{{ blog.getTitle|raw }}
</a>
{% endif %}
</li>
{% else %}{# 会員限定 一般 #}{% if blog.members != 1 %}
<li>
<span class="news_release_date">{{ blog.release_date|date_day }}</span>
{% if blog.linkurl != null %}
{% if blog.release_date != null and blog.release_date|date('Y-m-d') > 'now'|date_modify('-1 month')|date('Y-m-d') %}
<a class="news_title new" href="{{ blog.linkurl }}" target="_blank">
{% else %}
<a class="news_title" href="{{ blog.linkurl }}" target="_blank">
{% endif %}
{# blog.getTitle|length > 45 ? blog.getTitle|striptags|replace({(' '):' '})|slice(0, 45)|raw ~ '...' : blog.getTitle|raw #}
{{ blog.getTitle|raw }}
</a>
{% else %}
{% if blog.release_date != null and blog.release_date|date('Y-m-d') > 'now'|date_modify('-1 month')|date('Y-m-d') %}
<a class="news_title new" href="{{ url('cm_blog_page_detail', {'id': blog.id}) }}">
{% else %}
<a class="news_title" href="{{ url('cm_blog_page_detail', {'id': blog.id}) }}">
{% endif %}
{# blog.getTitle|length > 45 ? blog.getTitle|striptags|replace({(' '):' '})|slice(0, 45)|raw ~ '...' : blog.getTitle|raw #}
{{ blog.getTitle|raw }}
</a>
{% endif %}
</li>
{% endif %}{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
</ul>
</li>
{% endif %}
{% endfor %}
</ul>
<div class="ec-pagerRole">
{% include "pager.twig" with {'pages': pagination.paginationData, 'routes' : 'cm_blog_page_list'} %}
</div>
{% endif %}{# カテゴリー表示 #}
</div>
{#
{% if pagination.totalItemCount > 0 %}
<div class="ec-shelfRole" style="padding-top: 20px">
<ul class="ec-shelfGrid list_blog">
{% for blog in pagination %}
<li class="ec-shelfGrid__item">
<a href="{{ url('cm_blog_page_detail', {'id': blog.id}) }}">
<figure class="figure__main_image">
{% if blog.getMainListImage %}
<img src="{{ asset(blog.getMainListImage|no_image_product, 'save_image') }}" class='item_blog_image'></img>
{% else %}
<img src="{{ asset(''|no_image_product, 'save_image') }}" class='item_blog_image'></img>
{% endif %}
</figure>
</a>
<h3 class="blog_title_h3">
<a href="{{ url('cm_blog_page_detail', {'id': blog.id}) }}">
{{ blog.getTitle|length > 45 ? blog.getTitle|striptags|replace({(' '):' '})|slice(0, 45)|raw ~ '...' : blog.getTitle|raw }}
</a>
</h3>
<ul class="blog_category">
{% for category in blog.getBlogCategories %}
<li class="{{category.getCategory.class|raw}}">
<a href="{{ url('cm_blog_page_list', {categories: [category.getCategory().getId()]}) }}" class="list_category_link">
{{ category.getCategory.getName|length > 15 ? category.getCategory.getName|striptags|replace({(' '):' '})|slice(0, 15)|raw ~ '...' : category.getCategory.getName|raw }}
</a>
</li>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
</div>
<div class="ec-pagerRole">
{% include "pager.twig" with {'pages': pagination.paginationData, 'routes' : 'cm_blog_page_list'} %}
</div>
{% endif %}
#}
</div>
{% endblock %}