calendar-day-overlap.tpl.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <?php
  2. /**
  3. * @file
  4. * Template to display a view as a calendar day, grouped by time with overlapping items
  5. *
  6. * @see template_preprocess_calendar_day.
  7. *
  8. * $rows: The rendered data for this day.
  9. * $rows['date'] - the date for this day, formatted as YYYY-MM-DD.
  10. * $rows['datebox'] - the formatted datebox for this day.
  11. * $rows['empty'] - empty text for this day, if no items were found.
  12. * $rows['all_day'] - an array of formatted all day items.
  13. * $rows['items'] - an array of timed items for the day.
  14. * $rows['items'][$time_period]['hour'] - the formatted hour for a time period.
  15. * $rows['items'][$time_period]['ampm'] - the formatted ampm value, if any for a time period.
  16. * $rows['items'][$time_period][$column]['values'] - An array of formatted
  17. * items for a time period and field column.
  18. *
  19. * $view: The view.
  20. * $columns: an array of column names.
  21. * $min_date_formatted: The minimum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
  22. * $max_date_formatted: The maximum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
  23. *
  24. * The width of the columns is dynamically set using <col></col>
  25. * based on the number of columns presented. The values passed in will
  26. * work to set the 'hour' column to 10% and split the remaining columns
  27. * evenly over the remaining 90% of the table.
  28. */
  29. //dsm('Display: '. $display_type .': '. $min_date_formatted .' to '. $max_date_formatted);
  30. ?>
  31. <div class="calendar-calendar"><div class="day-view">
  32. <div id="multi-day-container">
  33. <table class="full">
  34. <tbody>
  35. <tr class="holder">
  36. <td class="calendar-time-holder"></td>
  37. <td class="calendar-day-holder"></td>
  38. </tr>
  39. <tr>
  40. <td class="<?php print $agenda_hour_class ?> first">
  41. <span class="calendar-hour"><?php print t('All day', array(), array('context' => 'datetime')) ?></span>
  42. </td>
  43. <td class="calendar-agenda-items multi-day last">
  44. <?php foreach ($columns as $column): ?>
  45. <div class="calendar">
  46. <div class="inner">
  47. <?php print isset($rows['all_day'][$column]) ? implode($rows['all_day'][$column]) : '&nbsp;';?>
  48. </div>
  49. </div>
  50. <?php endforeach; ?>
  51. </td>
  52. </tr>
  53. </tbody>
  54. </table>
  55. </div>
  56. <div class="header-body-divider">&nbsp;</div>
  57. <div id="single-day-container">
  58. <?php if (!empty($scroll_content)) : ?>
  59. <script>
  60. try {
  61. // Hide container while it renders... Degrade w/o javascript support
  62. jQuery('#single-day-container').css('visibility','hidden');
  63. }catch(e){
  64. // swallow
  65. }
  66. </script>
  67. <?php endif; ?>
  68. <table class="full">
  69. <tbody>
  70. <tr class="holder">
  71. <td class="calendar-time-holder"></td>
  72. <td class="calendar-day-holder"></td>
  73. </tr>
  74. <tr>
  75. <td class="first">
  76. <?php $is_first = TRUE; ?>
  77. <?php foreach ($rows['items'] as $time_cnt => $hour): ?>
  78. <?php
  79. if ($time_cnt == 0) {
  80. $class = 'first ';
  81. }
  82. elseif ($time_cnt == count($start_times) - 1) {
  83. $class = 'last ';
  84. }
  85. else {
  86. $class = '';
  87. } ?>
  88. <div class="<?php print $class?>calendar-agenda-hour">
  89. <span class="calendar-hour"><?php print $hour['hour']; ?></span><span class="calendar-ampm"><?php print $hour['ampm']; ?></span>
  90. </div>
  91. <?php endforeach; ?>
  92. </td>
  93. <td class="last">
  94. <?php foreach ($rows['items'] as $time_cnt => $hour): ?>
  95. <?php
  96. if ($time_cnt == 0) {
  97. $class = 'first ';
  98. }
  99. elseif ($time_cnt == count($start_times) - 1) {
  100. $class = 'last ';
  101. }
  102. else {
  103. $class = '';
  104. } ?>
  105. <div class="<?php print $class?>calendar-agenda-items single-day">
  106. <div class="half-hour">&nbsp;</div>
  107. <?php if ($is_first && isset($hour['values'][$column])) :?>
  108. <div class="calendar item-wrapper first_item">
  109. <?php $is_first = FALSE; ?>
  110. <?php else : ?>
  111. <div class="calendar item-wrapper">
  112. <?php endif; ?>
  113. <div class="inner">
  114. <?php print isset($hour['values'][$column]) ? implode($hour['values'][$column]) : '&nbsp;'; ?>
  115. </div>
  116. </div>
  117. </div>
  118. <?php endforeach; ?>
  119. </td>
  120. </tr>
  121. </tbody>
  122. </table>
  123. </div>
  124. <div class="single-day-footer">&nbsp;</div>
  125. </div></div>
  126. <?php if (!empty($scroll_content)) : ?>
  127. <script>
  128. try {
  129. // Size and position the viewport inline so there are no delays
  130. calendar_resizeViewport(jQuery);
  131. calendar_scrollToFirst(jQuery);
  132. jQuery('#single-day-container').css('visibility','visible');
  133. }catch(e){
  134. // swallow
  135. }
  136. </script>
  137. <?php endif; ?>