calendar-week.tpl.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <?php
  2. /**
  3. * @file
  4. * Template to display a view as a calendar week.
  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. //dsm($rows);
  28. //dsm($items);
  29. $index = 0;
  30. ?>
  31. <div class="calendar-calendar"><div class="week-view">
  32. <table class="full">
  33. <thead>
  34. <tr>
  35. <?php if($by_hour_count > 0 || !empty($start_times)) :?>
  36. <th class="calendar-agenda-hour"><?php print t('Time')?></th>
  37. <?php endif;?>
  38. <?php foreach ($day_names as $cell): ?>
  39. <th class="<?php print $cell['class']; ?>">
  40. <?php print $cell['data']; ?>
  41. </th>
  42. <?php endforeach; ?>
  43. </tr>
  44. </thead>
  45. <tbody>
  46. <?php for ($i = 0; $i < $multiday_rows; $i++): ?>
  47. <?php
  48. $colpos = 0;
  49. $rowclass = "all-day";
  50. if( $i == 0) {
  51. $rowclass .= " first";
  52. }
  53. if( $i == $multiday_rows - 1) {
  54. $rowclass .= " last";
  55. }
  56. ?>
  57. <tr class="<?php print $rowclass?>">
  58. <?php if($i == 0 && ($by_hour_count > 0 || !empty($start_times))) :?>
  59. <td class="<?php print $agenda_hour_class ?>" rowspan="<?php print $multiday_rows?>">
  60. <span class="calendar-hour"><?php print t('All day', array(), array('context' => 'datetime'))?></span>
  61. </td>
  62. <?php endif; ?>
  63. <?php for($j = 0; $j < 6; $j++): ?>
  64. <?php $cell = (empty($all_day[$j][$i])) ? NULL : $all_day[$j][$i]; ?>
  65. <?php if($cell != NULL && $cell['filled'] && $cell['wday'] == $j): ?>
  66. <?php for($k = $colpos; $k < $cell['wday']; $k++) : ?>
  67. <td class="multi-day no-entry"><div class="inner">&nbsp;</div></td>
  68. <?php endfor;?>
  69. <td colspan="<?php print $cell['colspan']?>" class="multi-day">
  70. <div class="inner">
  71. <?php print $cell['entry']?>
  72. </div>
  73. </td>
  74. <?php $colpos = $cell['wday'] + $cell['colspan']; ?>
  75. <?php endif; ?>
  76. <?php endfor; ?>
  77. <?php for($j = $colpos; $j < 7; $j++) : ?>
  78. <td class="multi-day no-entry"><div class="inner">&nbsp;</div></td>
  79. <?php endfor;?>
  80. </tr>
  81. <?php endfor; ?>
  82. <?php foreach ($items as $time): ?>
  83. <tr class="not-all-day">
  84. <td class="calendar-agenda-hour">
  85. <span class="calendar-hour"><?php print $time['hour']; ?></span><span class="calendar-ampm"><?php print $time['ampm']; ?></span>
  86. </td>
  87. <?php $curpos = 0; ?>
  88. <?php foreach ($columns as $index => $column): ?>
  89. <?php $colpos = (isset($time['values'][$column][0])) ? $time['values'][$column][0]['wday'] : $index; ?>
  90. <?php for ($i = $curpos; $i < $colpos; $i++): ?>
  91. <td class="calendar-agenda-items single-day">
  92. <div class="calendar">
  93. <div class="inner">&nbsp</div>
  94. </div>
  95. </td>
  96. <?php endfor; ?>
  97. <?php $curpos = $colpos + 1;?>
  98. <td class="calendar-agenda-items single-day">
  99. <div class="calendar">
  100. <div class="inner">
  101. <?php if(!empty($time['values'][$column])) :?>
  102. <?php foreach($time['values'][$column] as $item) :?>
  103. <?php print $item['entry'] ?>
  104. <?php endforeach; ?>
  105. <?php endif; ?>
  106. </div>
  107. </div>
  108. </td>
  109. <?php endforeach; ?>
  110. <?php for ($i = $curpos; $i < 7; $i++): ?>
  111. <td class="calendar-agenda-items single-day">
  112. <div class="calendar">
  113. <div class="inner">&nbsp</div>
  114. </div>
  115. </td>
  116. <?php endfor; ?>
  117. </tr>
  118. <?php endforeach; ?>
  119. </tbody>
  120. </table>
  121. </div></div>