# V2_Calendar

    {% set calendar = module('V2_Calendar', null, { bid: null, cid: null, start: null }) %}

    <div>
      {{ include('/admin/module/setting.twig', { moduleInfo: calendar.moduleInfo }) }}

      {% macro renderEntries(entries) %}
        {% for entry in entries %}
          <div>
            {% if entry.url %}
              <a href="{{ entry.url }}">{{ entry.title }}</a>
            {% else %}
              {{ entry.title }}
            {% endif %}
          </div>
        {% endfor %}
      {% endmacro %}

      <div>
        {% if calendar.date %}
        <div>
          <h3 class="acms-text-center"><a href="{{ BASE_URL }}calendar.html/{{ calendar.date.year }}/{{ calendar.date.month }}">{{ calendar.date.month }}月</a></h3>
          <ul class="acms-text-center acms-list-inline">
            <li><a href="{{ BASE_URL }}calendar.html/{{ calendar.date.prevDate }}" class="acms-btn-flat" title="前月へ">«</a></li>
            <li>{{ calendar.date.year }}/{{ calendar.date.month }}</li>
            <li><a href="{{ BASE_URL }}calendar.html/{{ calendar.date.nextDate }}" class="acms-btn-flat" title="次月へ">»</a></li>
          </ul>
        </div>
        {% endif %}
        <table class="acms-table acms-table-bordered">
        <thead>
          <tr class="acms-text-center">
            {% for week in calendar.weekLabels %}
            <td >{{ week.label }}</td>
            {% endfor %}
          </tr>
        </thead>
        <tbody>
          {% for week in calendar.weeks %}
          <tr class="acms-text-center">
            {% for day in week %}
            <td>
              {% if day.entries %}
              <a href="{{ day.url }}">{{ day.day }}</a>
              {# {{ _self.renderEntries(day.entries) }} #}
              {% else %}
              {{ day.day }}
              {% endif %}
            </td>
            {% endfor %}
          </tr>
          {% endfor %}
        </tbody>
        </table>
      </div>
    </div>