You are here

calendar-week-overlap.html.twig in Calendar 8

Template to display a view as a calendar week with overlapping items

$day_names: An array of the day of week names for the table header. $rows: The rendered data for this week.

For each day of the week, you have: $rows['date'] - the date for this day, formatted as YYYY-MM-DD. $rows['datebox'] - the formatted datebox for this day. $rows['empty'] - empty text for this day, if no items were found. $rows['all_day'] - an array of formatted all day items. $rows['items'] - an array of timed items for the day. $rows['items'][$time_period]['hour'] - the formatted hour for a time period. $rows['items'][$time_period]['ampm'] - the formatted ampm value, if any for a time period. $rows['items'][$time_period]['values'] - An array of formatted items for a time period.

$view: The view. $min_date_formatted: The minimum date for this calendar in the format YYYY-MM-DD HH:MM:SS. $max_date_formatted: The maximum date for this calendar in the format YYYY-MM-DD HH:MM:SS.

See also

template_preprocess_calendar_week.

File

templates/calendar-week-overlap.html.twig
View source
  1. <?php
  2. /**
  3. * @file
  4. * Template to display a view as a calendar week with overlapping items
  5. *
  6. * @see template_preprocess_calendar_week.
  7. *
  8. * $day_names: An array of the day of week names for the table header.
  9. * $rows: The rendered data for this week.
  10. *
  11. * For each day of the week, you have:
  12. * $rows['date'] - the date for this day, formatted as YYYY-MM-DD.
  13. * $rows['datebox'] - the formatted datebox for this day.
  14. * $rows['empty'] - empty text for this day, if no items were found.
  15. * $rows['all_day'] - an array of formatted all day items.
  16. * $rows['items'] - an array of timed items for the day.
  17. * $rows['items'][$time_period]['hour'] - the formatted hour for a time period.
  18. * $rows['items'][$time_period]['ampm'] - the formatted ampm value, if any for a time period.
  19. * $rows['items'][$time_period]['values'] - An array of formatted items for a time period.
  20. *
  21. * $view: The view.
  22. * $min_date_formatted: The minimum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
  23. * $max_date_formatted: The maximum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
  24. *
  25. */
  26. ?>
  27. <div class="calendar-calendar"><div class="week-view">
  28. <div id="header-container">
  29. <table class="full">
  30. <tbody>
  31. <tr class="holder"><td class="calendar-time-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder margin-right"></td></tr>
  32. <tr>
  33. <th class="calendar-agenda-hour">&nbsp;</th>
  34. {% for cell in day_names %}
  35. <th class="{{ cell.class }}" id="{{ cell.header_id }}">
  36. {{ cell.data }}
  37. </th>
  38. {% endfor %}
  39. <th class="calendar-day-holder margin-right"></th>
  40. </tr>
  41. </tbody>
  42. </table>
  43. </div>
  44. {# Multi-day and all day events are not supported because dates don't have end values yes
  45. <div id="multi-day-container">
  46. <table class="full">
  47. <tbody>
  48. <tr class="holder"><td class="calendar-time-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td></tr>
  49. {% for i in 0..multiday_rows %}
  50. {% set row_class = 'all-day' %}
  51. {% set row_class_extra = '' %}
  52. {% if loop.first %}{% set row_class_extra = 'first' %}{% endif %}
  53. {% if loop.last %}{% set row_class_extra = 'last' %}{% endif %}
  54. <tr class="{{ row_class }} {{ row_class_extra }}">
  55. {% if loop.index0 == 0 and (by_hour_count > 0 or start_times is not empty) %}
  56. <td class="{{ agenda_hour_class }}" rowspan="{{ multiday_rows }}">
  57. <span class="calendar-hour">{% trans with {'context': 'datetime'} %}All day{% endtrans %}</span>
  58. </td>
  59. {% endif %}
  60. {% for j in 0..7 %}
  61. {% set cell = all_day[j][i] %}
  62. {% if cell is not empty and cell.filled and cell['wday'] == j %}
  63. {% for position in colpos..cell['wday'] %}
  64. {% set col_class = "calendar-agenda-items multi-day"%}
  65. {% set col_class_extra = '' %}
  66. {% if loop.first %}{% set col_class_extra = 'first' %}{% endif %}
  67. {% if loop.last %}{% set col_class_extra = 'last' %}{% endif %}
  68. <td class="{{ col_class }} {{ col_class_extra }}"><div class="inner">&nbsp;</div></td>
  69. {% endfor %}
  70. <td colspan="{{ cell['colspan'] }}" class="{{ col_class }}">
  71. <div class="inner">
  72. {{ cell.entry }}
  73. </div>
  74. </td>
  75. {% set colpos = colpos + cell['colspan'] %}
  76. {% endif %}
  77. {% endfor %}
  78. {% for k in colpos..7 %}
  79. {% set col_class = "calendar-agenda-items multi-day no-entry" %}
  80. {% set col_class_extra = '' %}
  81. {% if loop.first %}{% set col_class_extra = 'first' %}{% endif %}
  82. {% if loop.last %}{% set col_class_extra = 'last' %}{% endif %}
  83. <td class="{{ col_class }} {{ col_class_extra }}"><div class="inner">&nbsp;</div></td>
  84. {% endfor %}
  85. </tr>
  86. {% endfor %}
  87. {% if multiday_rows == 0 %}
  88. <tr>
  89. <td class="{{ agenda_hour_class }}">
  90. <span class="calendar-hour">{% trans with {'context': 'datetime'} %}All day{% endtrans %}</span>
  91. </td>
  92. {% for j in 0..7 %}
  93. {% set col_class = "calendar-agenda-items multi-day no-entry" %}
  94. {% set col_class_extra = '' %}
  95. {% if loop.first %}{% set col_class_extra = 'first' %}{% endif %}
  96. {% if loop.last %}{% set col_class_extra = 'last' %}{% endif %}
  97. <td class="{{ col_class }} {{ col_class_extra }}"><div class="inner">&nbsp;</div></td>
  98. {% endfor %}
  99. </tr>
  100. {% endif %}
  101. <tr class="expand">
  102. <td class="{{ agenda_hour_class }}">
  103. <span class="calendar-hour">&nbsp;</span>
  104. </td>
  105. {% for j in 0..7 %}
  106. {% set col_class = "calendar-agenda-items multi-day no-entry" %}
  107. {% set col_class_extra = '' %}
  108. {% if loop.first %}{% set col_class_extra = 'first' %}{% endif %}
  109. {% if loop.last %}{% set col_class_extra = 'last' %}{% endif %}
  110. <td class="{{ col_class }} {{ col_class_extra }}"><div class="inner">&nbsp;</div></td>
  111. {% endfor %}
  112. <td class="{{ col_class }}"><div class="inner">&nbsp;</div></td>
  113. </tr>
  114. </thead>
  115. </table>
  116. </div>
  117. <div class="header-body-divider">&nbsp;</div>
  118. #}
  119. <div id="single-day-container">
  120. <table class="full">
  121. <tbody>
  122. <tr class="holder"><td class="calendar-time-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td></tr>
  123. <tr>
  124. {% for i in 0..7 %}
  125. {% if loop.first %}
  126. <td class="first">
  127. {% elseif loop.index0 == 7 %}
  128. <td class="last" headers="{{ header_ids[loop.index0 - 1] }}">
  129. {% else %}
  130. <td headers="{{ header_ids[loop.index0 - 1] }}">
  131. {% endif %}
  132. {% for time_cnt, start_time in start_times %}
  133. {% if time_cnt == 0 %}
  134. {% set class = 'first' %}
  135. {% elseif time_cnt == start_times|length - 1 %}
  136. {% set class = 'last' %}
  137. {% else %}
  138. {% set class = '' %}
  139. {% endif %}
  140. {% if loop.parent.loop.first %}
  141. {% set time = items[start_time] %}
  142. <div class="{{ class }} calendar-agenda-hour">
  143. <span class="calendar-hour">{{ time.hour }}</span><span class="calendar-ampm">{{ time.ampm }}</span>
  144. </div>
  145. {% else %}
  146. <div class="{{ class }} calendar-agenda-items single-day">
  147. <div class="half-hour">&nbsp;</div>
  148. <div class="calendar item-wrapper">
  149. <div class="inner">
  150. {#{% if items[start_time]['values'] is not empty %}{{ dump(items[start_time]['values']) }}{% endif %}#}
  151. {% if items[start_time]['values'][loop.parent.loop.index0 - 1] %}
  152. {% for item in items[start_time]['values'][loop.parent.loop.index0 - 1] %}
  153. {% if item['is_first'] %}
  154. <div class="item {{ item.class }} first_item">
  155. {% else %}
  156. <div class="item {{ item.class }}">
  157. {% endif %}
  158. {{ item.entry }}
  159. </div>
  160. {% endfor %}
  161. {% endif %}
  162. </div>
  163. </div>
  164. </div>
  165. {% endif %}
  166. {% endfor %}
  167. </td>
  168. {% endfor %}
  169. </tr>
  170. </tbody>
  171. </table>
  172. </div>
  173. <div class="single-day-footer">&nbsp;</div>
  174. </div></div>