calendar-week-overlap.tpl.php 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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. //dsm('Display: '. $display_type .': '. $min_date_formatted .' to '. $max_date_formatted);
  27. ?>
  28. <div class="calendar-calendar"><div class="week-view">
  29. <div id="header-container">
  30. <table class="full">
  31. <tbody>
  32. <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>
  33. <tr>
  34. <th class="calendar-agenda-hour">&nbsp;</th>
  35. <?php foreach ($day_names as $cell): ?>
  36. <th class="<?php print $cell['class']; ?>">
  37. <?php print $cell['data']; ?>
  38. </th>
  39. <?php endforeach; ?>
  40. <th class="calendar-day-holder margin-right"></th>
  41. </tr>
  42. </tbody>
  43. </table>
  44. </div>
  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. <?php for ($i = 0; $i < $multiday_rows; $i++): ?>
  50. <?php
  51. $colpos = 0;
  52. $rowclass = "all-day";
  53. if ($i == 0) {
  54. $rowclass .= " first";
  55. }
  56. if ($i == $multiday_rows - 1) {
  57. $rowclass .= " last";
  58. }
  59. ?>
  60. <tr class="<?php print $rowclass?>">
  61. <?php if($i == 0 && ($by_hour_count > 0 || !empty($start_times))) :?>
  62. <td class="<?php print $agenda_hour_class ?>" rowspan="<?php print $multiday_rows?>">
  63. <span class="calendar-hour"><?php print t('All day', array(), array('context' => 'datetime'))?></span>
  64. </td>
  65. <?php endif; ?>
  66. <?php for($j = 0; $j < 7; $j++): ?>
  67. <?php $cell = (empty($all_day[$j][$i])) ? NULL : $all_day[$j][$i]; ?>
  68. <?php if($cell != NULL && $cell['filled'] && $cell['wday'] == $j): ?>
  69. <?php for($colpos; $colpos < $cell['wday']; $colpos++) : ?>
  70. <?php
  71. $colclass = "calendar-agenda-items multi-day";
  72. if ($colpos == 0) {
  73. $colclass .= " first";
  74. }
  75. if ($colpos == 6) {
  76. $colclass .= " last";
  77. }
  78. ?>
  79. <td class="<?php print $colclass?>"><div class="inner">&nbsp;</div></td>
  80. <?php endfor;?>
  81. <?php
  82. $colclass = "calendar-agenda-items multi-day";
  83. if ($colpos == 0) {
  84. $colclass .= " first";
  85. }
  86. if ($colpos == 6) {
  87. $colclass .= " last";
  88. }
  89. ?>
  90. <td colspan="<?php print $cell['colspan']?>" class="<?php print $colclass?>">
  91. <div class="inner">
  92. <?php print $cell['entry']?>
  93. </div>
  94. </td>
  95. <?php $colpos += $cell['colspan']; ?>
  96. <?php endif; ?>
  97. <?php endfor; ?>
  98. <?php while($colpos < 7) : ?>
  99. <?php
  100. $colclass = "calendar-agenda-items multi-day no-entry";
  101. if ($colpos == 0) {
  102. $colclass .= " first";
  103. }
  104. if ($colpos == 6) {
  105. $colclass .= " last";
  106. }
  107. ?>
  108. <td class="<?php print $colclass?>"><div class="inner">&nbsp;</div></td>
  109. <?php $colpos++; ?>
  110. <?php endwhile;?>
  111. </tr>
  112. <?php endfor; ?>
  113. <?php if ($multiday_rows == 0) :?>
  114. <tr>
  115. <td class="<?php print $agenda_hour_class ?>">
  116. <span class="calendar-hour"><?php print t('All day', array(), array('context' => 'datetime'))?></span>
  117. </td>
  118. <?php for($j = 0; $j < 7; $j++): ?>
  119. <?php
  120. $colclass = "calendar-agenda-items multi-day no-entry";
  121. if ($j == 0) {
  122. $colclass .= " first";
  123. }
  124. if ($j == 6) {
  125. $colclass .= " last";
  126. }
  127. ?>
  128. <td class="<?php print $colclass?>"><div class="inner">&nbsp;</div></td>
  129. <?php endfor; ?>
  130. </tr>
  131. <?php endif; ?>
  132. <tr class="expand">
  133. <td class="<?php print $agenda_hour_class ?>">
  134. <span class="calendar-hour">&nbsp;</span>
  135. </td>
  136. <?php for($j = 0; $j < 7; $j++): ?>
  137. <?php
  138. $colclass = "calendar-agenda-items multi-day no-entry";
  139. if ($j == 0) {
  140. $colclass .= " first";
  141. }
  142. if ($j == 6) {
  143. $colclass .= " last";
  144. }
  145. ?>
  146. <td class="<?php print $colclass?>"><div class="inner">&nbsp;</div></td>
  147. <?php endfor; ?>
  148. </tr>
  149. </thead>
  150. </table>
  151. </div>
  152. <div class="header-body-divider">&nbsp;</div>
  153. <div id="single-day-container">
  154. <?php if (!empty($scroll_content)) : ?>
  155. <script>
  156. try {
  157. // Hide container while it renders... Degrade w/o javascript support
  158. jQuery('#single-day-container').css('visibility','hidden');
  159. }catch(e){
  160. // swallow
  161. }
  162. </script>
  163. <?php endif; ?>
  164. <table class="full">
  165. <tbody>
  166. <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>
  167. <tr>
  168. <?php for ($index = 0; $index < 8; $index++): ?>
  169. <?php if ($index == 0 ): ?>
  170. <td class="first">
  171. <?php elseif ($index == 7 ) : ?>
  172. <td class="last">
  173. <?php else : ?>
  174. <td>
  175. <?php endif; ?>
  176. <?php foreach ($start_times as $time_cnt => $start_time): ?>
  177. <?php
  178. if ($time_cnt == 0) {
  179. $class = 'first ';
  180. }
  181. elseif ($time_cnt == count($start_times) - 1) {
  182. $class = 'last ';
  183. }
  184. else {
  185. $class = '';
  186. } ?>
  187. <?php if( $index == 0 ): ?>
  188. <?php $time = $items[$start_time];?>
  189. <div class="<?php print $class?>calendar-agenda-hour">
  190. <span class="calendar-hour"><?php print $time['hour']; ?></span><span class="calendar-ampm"><?php print $time['ampm']; ?></span>
  191. </div>
  192. <?php else: ?>
  193. <div class="<?php print $class?>calendar-agenda-items single-day">
  194. <div class="half-hour">&nbsp;</div>
  195. <div class="calendar item-wrapper">
  196. <div class="inner">
  197. <?php if(!empty($items[$start_time]['values'][$index - 1])) :?>
  198. <?php foreach($items[$start_time]['values'][$index - 1] as $item) :?>
  199. <?php if (isset($item['is_first']) && $item['is_first']) :?>
  200. <div class="item <?php print $item['class']?> first_item">
  201. <?php else : ?>
  202. <div class="item <?php print $item['class']?>">
  203. <?php endif; ?>
  204. <?php print $item['entry'] ?>
  205. </div>
  206. <?php endforeach; ?>
  207. <?php endif; ?>
  208. </div>
  209. </div>
  210. </div>
  211. <?php endif; ?>
  212. <?php endforeach;?>
  213. </td>
  214. <?php endfor;?>
  215. </tr>
  216. </tbody>
  217. </table>
  218. </div>
  219. <div class="single-day-footer">&nbsp;</div>
  220. </div></div>
  221. <?php if (!empty($scroll_content)) : ?>
  222. <script>
  223. try {
  224. // Size and position the viewport inline so there are no delays
  225. calendar_resizeViewport(jQuery);
  226. calendar_scrollToFirst(jQuery);
  227. // Show it now that it is complete and positioned
  228. jQuery('#single-day-container').css('visibility','visible');
  229. }catch(e){
  230. // swallow
  231. }
  232. </script>
  233. <?php endif; ?>