diff options
| author | Bharat Mediratta <bharat@menalto.com> | 2008-10-31 22:12:14 +0000 |
|---|---|---|
| committer | Bharat Mediratta <bharat@menalto.com> | 2008-10-31 22:12:14 +0000 |
| commit | eba717f95f586d2538007bd18da6e9b32b076c30 (patch) | |
| tree | 15fc596a270f9de0d163c66c96e3c65fca5ee100 /kohana/views/kohana_calendar.php | |
| parent | fff10f8b70376ef25722bd867df26bc5aefced43 (diff) | |
Merge over vendor code.
git-svn-id: http://gallery.svn.sourceforge.net/svnroot/gallery/trunk/eval/gx/gallery3/trunk@18408 57fcd75e-5312-0410-8df3-f5eb6fbb1595
Diffstat (limited to 'kohana/views/kohana_calendar.php')
| -rw-r--r-- | kohana/views/kohana_calendar.php | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/kohana/views/kohana_calendar.php b/kohana/views/kohana_calendar.php new file mode 100644 index 00000000..581c7da7 --- /dev/null +++ b/kohana/views/kohana_calendar.php @@ -0,0 +1,52 @@ +<?php + +// Get the day names +$days = Calendar::days(TRUE); + +// Previous and next month timestamps +$next = mktime(0, 0, 0, $month + 1, 1, $year); +$prev = mktime(0, 0, 0, $month - 1, 1, $year); + +// Import the GET query array locally and remove the day +$qs = $_GET; +unset($qs['day']); + +// Previous and next month query URIs +$prev = Router::$current_uri.'?'.http_build_query(array_merge($qs, array('month' => date('n', $prev), 'year' => date('Y', $prev)))); +$next = Router::$current_uri.'?'.http_build_query(array_merge($qs, array('month' => date('n', $next), 'year' => date('Y', $next)))); + +?> +<table class="calendar"> +<tr class="controls"> +<td class="prev"><?php echo html::anchor($prev, '«') ?></td> +<td class="title" colspan="5"><?php echo strftime('%B %Y', mktime(0, 0, 0, $month, 1, $year)) ?></td> +<td class="next"><?php echo html::anchor($next, '»') ?></td> +</tr> +<tr> +<?php foreach ($days as $day): ?> +<th><?php echo $day ?></th> +<?php endforeach ?> +</tr> +<?php foreach ($weeks as $week): ?> +<tr> +<?php foreach ($week as $day): + +list ($number, $current, $data) = $day; + +if (is_array($data)) +{ + $classes = $data['classes']; + $output = empty($data['output']) ? '' : '<ul class="output"><li>'.implode('</li><li>', $data['output']).'</li></ul>'; +} +else +{ + $classes = array(); + $output = ''; +} + +?> +<td class="<?php echo implode(' ', $classes) ?>"><span class="day"><?php echo $day[0] ?></span><?php echo $output ?></td> +<?php endforeach ?> +</tr> +<?php endforeach ?> +</table> |
