Changeset 2331 for trunk/system/views
- Timestamp:
- 03/24/2008 09:54:18 AM (8 months ago)
- Files:
-
- 1 modified
-
trunk/system/views/kohana_calendar.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/views/kohana_calendar.php
r1616 r2331 2 2 3 3 $first_day = mktime(1, 0, 0, $month, 1, $year); 4 $today = (date('Y/m') === date('Y/m', $first_day)) ? date('j') : FALSE;4 $today = (date('Y/m') === date('Y/m', $first_day)) ? (int) date('j') : FALSE; 5 5 6 6 /** … … 9 9 $headings = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'); 10 10 11 /** 12 * @todo This needs to be removed and placed in documentation. Inline styles are not allowed. 13 */ 14 ?><style type="text/css"> 15 table.calendar { text-align: right; } 16 table.calendar caption { font-size: 1.5em; padding: 0.2em; } 17 table.calendar th, table.calendar td { padding: 0.2em; background: #fff; border: 0; } 18 table.calendar td:hover { background: #ddf; } 19 table.calendar td.prev-next { background: #ccc; color: #999; } 20 table.calendar td.today { color: #800; } 21 </style> 22 11 ?> 23 12 <table class="calendar"> 24 13 <caption><?php echo strftime('%B %Y', $first_day) ?></caption> 25 14 <tr> 26 <?php foreach ($headings as $day): ?>27 <th><?php echo $day ?></th>28 <?php endforeach ?>29 </tr>30 <?php foreach ($weeks as $week): ?>31 <tr>32 <?php foreach ($week as $day): ?>33 <?php if ($day[1] === FALSE): ?>34 <td class="prev-next"><?php echo $day[0] ?></td>35 <?php else: ?>36 15 <?php 37 16 38 if ($today > 0 AND $day[0] == $today) 17 foreach ($headings as $day): 18 19 ?> 20 <th><?php echo $day ?></th> 21 <?php 22 23 endforeach 24 25 ?> 26 </tr> 27 <?php 28 29 foreach ($weeks as $week): 30 31 ?> 32 <tr> 33 <?php 34 35 foreach ($week as $day): 36 37 list ($number, $current, $data) = $day; 38 39 if (is_array($data)) 39 40 { 40 $class = ' class="today"'; 41 $classes = $data['classes']; 42 $output = empty($data['output']) ? '' : '<ul class="output"><li>'.implode('</li><li>', $data['output']).'</li></ul>'; 41 43 } 42 44 else 43 45 { 44 $class = ''; 46 $classes = array(); 47 $output = ''; 45 48 } 46 /** 47 * @todo Need to add assignable stuff to this. For example, making certain dates into links. 48 */ 49 50 if ($current === FALSE) 51 { 52 $classes[] = 'prev-next'; 53 } 54 elseif ($today > 0 AND $day[0] === $today) 55 { 56 $classes[] = 'today';; 57 } 58 49 59 ?> 50 <td<?php echo $class ?>><?php echo $day[0] ?></td> 51 <?php endif; ?> 52 <?php endforeach ?> 60 <td class="<?php echo implode(' ', $classes) ?>"><span class="day"><?php echo $day[0] ?></span><?php echo $output ?></td> 61 <?php 62 63 endforeach 64 65 ?> 53 66 </tr> 54 <?php endforeach ?> 67 <?php 68 69 endforeach 70 71 ?> 55 72 </table>
