Projet

Général

Profil

Paste
Télécharger (9,09 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / calendar / theme / calendar-week-overlap.tpl.php @ 76df55b7

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
$header_ids = array();
27
foreach ($day_names as $key => $value) {
28
  $header_ids[$key] = $value['header_id'];
29
}
30
//dsm('Display: '. $display_type .': '. $min_date_formatted .' to '. $max_date_formatted);
31
?>
32

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

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