Project

General

Profile

Paste
Download (8.99 KB) Statistics
| Branch: | Revision:

root / drupal7 / sites / all / modules / calendar / theme / calendar-week-overlap.tpl.php @ 62e0cc08

1
<?php
2

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

231
  // Show it now that it is complete and positioned
232
  jQuery('#single-day-container').css('visibility','visible');
233
}catch(e){
234
  // swallow
235
}
236
</script>
237
<?php endif; ?>