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

Open in your IDE?
  1. {% set apgScThisMonth = apg_sc_get_month_days(0) %}
  2. {% set apgScNextMonth = apg_sc_get_month_days(1) %}
  3. <link rel="stylesheet" href="{{ asset('ECApgSimpleCalendar/assets/calendar.css', 'plugin') }}">
  4. <table class="apg_sc_table">
  5.     <tbody>
  6.     <tr>
  7.         <th colspan="7" class="apg_sc_header">
  8.             <span class="apg_sc_year">{{ apgScThisMonth['year'] }}</span>年<span
  9.                     class="apg_sc_month">{{ apgScThisMonth['month'] }}</span>月
  10.         </th>
  11.     </tr>
  12.     <tr>
  13.         <th class="apg_sc_sunday_header">日</th>
  14.         <th class="apg_sc_monday_header">月</th>
  15.         <th class="apg_sc_tuesday_header">火</th>
  16.         <th class="apg_sc_wednesday_header">水</th>
  17.         <th class="apg_sc_thursday_header">木</th>
  18.         <th class="apg_sc_friday_header">金</th>
  19.         <th class="apg_sc_saturday_header">土</th>
  20.     </tr>
  21.     {% for tr in apgScThisMonth['days'] %}
  22.         <tr>
  23.             {% for td in tr %}
  24.                 {% set apgCalendarClass = '' %}
  25.                 {% if loop.index == 7 %}
  26.                     {% set apgCalendarClass = 'apg_sc_saturday' %}
  27.                 {% elseif loop.index == 1 %}
  28.                     {% set apgCalendarClass = 'apg_sc_sunday' %}
  29.                 {% elseif loop.index == 2 %}
  30.                     {% set apgCalendarClass = 'apg_sc_monday' %}
  31.                 {% elseif loop.index == 3 %}
  32.                     {% set apgCalendarClass = 'apg_sc_tuesday' %}
  33.                 {% elseif loop.index == 4 %}
  34.                     {% set apgCalendarClass = 'apg_sc_wednesday' %}
  35.                 {% elseif loop.index == 5 %}
  36.                     {% set apgCalendarClass = 'apg_sc_thursday' %}
  37.                 {% elseif loop.index == 6 %}
  38.                     {% set apgCalendarClass = 'apg_sc_friday' %}
  39.                 {% endif %}
  40.                 {% if td.day == "now"|date('j') %}
  41.                     {% set apgCalendarClass = apgCalendarClass~' apg_sc_today' %}
  42.                 {% endif %}
  43.                 {% if td.holiday %}
  44.                     {% set apgCalendarClass = apgCalendarClass~' apg_sc_holiday' %}
  45.                 {% endif %}
  46.                 {% if td.day is empty %}
  47.                     {% set apgCalendarClass = apgCalendarClass~' apg_sc_non_day' %}
  48.                 {% endif %}
  49.                 <td title="{{ td.name }}" class="{{ apgCalendarClass }}">{{ td.day }}</td>
  50.             {% endfor %}
  51.         </tr>
  52.     {% endfor %}
  53. </table>
  54. <table class="apg_sc_table">
  55.     <tbody>
  56.     <tr>
  57.         <th colspan="7" class="apg_sc_header">
  58.             <span class="apg_sc_year">{{ apgScNextMonth['year'] }}</span>年<span
  59.                     class="apg_sc_month">{{ apgScNextMonth['month'] }}</span>月
  60.         </th>
  61.     </tr>
  62.     <tr>
  63.         <th class="apg_sc_sunday_header">日</th>
  64.         <th class="apg_sc_monday_header">月</th>
  65.         <th class="apg_sc_tuesday_header">火</th>
  66.         <th class="apg_sc_wednesday_header">水</th>
  67.         <th class="apg_sc_thursday_header">木</th>
  68.         <th class="apg_sc_friday_header">金</th>
  69.         <th class="apg_sc_saturday_header">土</th>
  70.     </tr>
  71.     {% for tr in apgScNextMonth['days'] %}
  72.         <tr>
  73.             {% for td in tr %}
  74.                 {% set apgCalendarClass = '' %}
  75.                 {% if loop.index == 7 %}
  76.                     {% set apgCalendarClass = 'apg_sc_saturday' %}
  77.                 {% elseif loop.index == 1 %}
  78.                     {% set apgCalendarClass = 'apg_sc_sunday' %}
  79.                 {% elseif loop.index == 2 %}
  80.                     {% set apgCalendarClass = 'apg_sc_monday' %}
  81.                 {% elseif loop.index == 3 %}
  82.                     {% set apgCalendarClass = 'apg_sc_tuesday' %}
  83.                 {% elseif loop.index == 4 %}
  84.                     {% set apgCalendarClass = 'apg_sc_wednesday' %}
  85.                 {% elseif loop.index == 5 %}
  86.                     {% set apgCalendarClass = 'apg_sc_thursday' %}
  87.                 {% elseif loop.index == 6 %}
  88.                     {% set apgCalendarClass = 'apg_sc_friday' %}
  89.                 {% endif %}
  90.                 {% if td.day == "now"|date('j') %}
  91.                     {% set apgCalendarClass = apgCalendarClass~' apg_sc_today' %}
  92.                 {% endif %}
  93.                 {% if td.holiday %}
  94.                     {% set apgCalendarClass = apgCalendarClass~' apg_sc_holiday' %}
  95.                 {% endif %}
  96.                 {% if td.day is empty %}
  97.                     {% set apgCalendarClass = apgCalendarClass~' apg_sc_non_day' %}
  98.                 {% endif %}
  99.                 <td title="{{ td.name }}" class="{{ apgCalendarClass }}">{{ td.day }}</td>
  100.             {% endfor %}
  101.         </tr>
  102.     {% endfor %}
  103. </table>