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

Open in your IDE?
  1. {#
  2. * Plugin Name : DeliveryDate4
  3. *
  4. * Copyright (C) BraTech Co., Ltd. All Rights Reserved.
  5. * http://www.bratech.co.jp/
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. #}
  10. <!--営業日カレンダー-->
  11. {% set Date = get_date() %}
  12. <div id="businessday_calendar">
  13.     <div class="calendar_title">営業日カレンダー</div>
  14.     <div class="note"><span></span>:店休日 <span></span>:本日</div>
  15.     {% set year = 'now'|date('Y') %}
  16.     {% for month, monthitem in Date %}
  17.         {% if loop.index0 > 0 and month == '1' %}
  18.             {% set year = year+1 %}
  19.         {% endif %}
  20.         <table>
  21.             <caption>{{ year }}年 {{ month }}月</caption>
  22.             <thead><tr><th id="sunday">日</th><th>月</th><th>火</th><th>水</th><th>木</th><th>金</th><th id="saturday">土</th></tr></thead>
  23.             <tbody>
  24.                 {% for dayitem in monthitem %}
  25.                     {% set day = dayitem.day %}
  26.                     {% if day|date('j') == '1' %}
  27.                         <tr>
  28.                         {% if day|date('w') != '0' %}
  29.                             {% for i in 1..day|date('w') %}
  30.                                 <td></td>
  31.                             {% endfor %}
  32.                         {% endif %}
  33.                     {% elseif day|date('w') == 0 %}
  34.                         <tr>
  35.                     {% endif %}
  36.                     {% set class = '' %}
  37.                     {% if day|date('y/m/d') < 'now'|date('y/m/d') %}
  38.                         {% set class = class ~ 'past' %}
  39.                     {% endif %}
  40.                     {% if day|date('y/m/d') == 'now'|date('y/m/d') %}
  41.                         {% set class = class ~ 'today' %}
  42.                     {% endif %}
  43.                     {% if dayitem.is_holiday %}
  44.                         {% if day|date('w') == 6 %}
  45.                             {% set class = class ~ ' saturday holiday' %}
  46.                         {% else %}
  47.                             {% set class = class ~ ' sunday holiday' %}
  48.                         {% endif %}
  49.                     {% endif %}
  50.                         <td {% if class != '' %} class="{{ class }}" {% endif %}>{{ day|date('j') }}</td>
  51.                     {% if day|date('w') == 6 or loop.last %}
  52.                         </tr>
  53.                     {% endif %}
  54.                 {% endfor %}
  55.             </tbody>
  56.         </table>
  57.     {% endfor %}
  58. </div>