root/trunk/system/views/kohana_calendar.php

Revision 3452, 1.4 kB (checked in by Shadowhand, 3 months ago)

Follow up to r3451

  • Property svn:eol-style set to LF
  • Property copyright set to Copyright (c) 2007 Kohana Team
  • Property svn:keywords set to Id
Line 
1<?php
2
3// Get the day names
4$days = Calendar::days(2);
5
6// Previous and next month timestamps
7$next = mktime(0, 0, 0, $month + 1, 1, $year);
8$prev = mktime(0, 0, 0, $month - 1, 1, $year);
9
10// Import the GET query array locally and remove the day
11$qs = $_GET;
12unset($qs['day']);
13
14// Previous and next month query URIs
15$prev = Router::$current_uri.'?'.http_build_query(array_merge($qs, array('month' => date('n', $prev), 'year' => date('Y', $prev))));
16$next = Router::$current_uri.'?'.http_build_query(array_merge($qs, array('month' => date('n', $next), 'year' => date('Y', $next))));
17
18?>
19<table class="calendar">
20<tr class="controls">
21<td class="prev"><?php echo html::anchor($prev, '&laquo;') ?></td>
22<td class="title" colspan="5"><?php echo strftime('%B %Y', mktime(0, 0, 0, $month, 1, $year)) ?></td>
23<td class="next"><?php echo html::anchor($next, '&raquo;') ?></td>
24</tr>
25<tr>
26<?php foreach ($days 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
34list ($number, $current, $data) = $day;
35
36if (is_array($data))
37{
38    $classes = $data['classes'];
39    $output = empty($data['output']) ? '' : '<ul class="output"><li>'.implode('</li><li>', $data['output']).'</li></ul>';
40}
41else
42{
43    $classes = array();
44    $output = '';
45}
46
47?>
48<td class="<?php echo implode(' ', $classes) ?>"><span class="day"><?php echo $day[0] ?></span><?php echo $output ?></td>
49<?php endforeach ?>
50</tr>
51<?php endforeach ?>
52</table>
Note: See TracBrowser for help on using the browser.